From bbc91c816fcc8e2aa7ebf1bfb68896de578f5bca Mon Sep 17 00:00:00 2001 From: Helen Lin Date: Wed, 4 Dec 2024 13:46:09 -0800 Subject: [PATCH] fix generated types --- .../storefrontapi.generated.d.ts | 124 +----------------- .../storefrontapi.generated.d.ts | 124 +----------------- .../metaobjects/storefrontapi.generated.d.ts | 124 +----------------- .../multipass/storefrontapi.generated.d.ts | 124 +----------------- .../hydrogen-react/src/getProductOptions.ts | 4 +- 5 files changed, 7 insertions(+), 493 deletions(-) diff --git a/examples/custom-cart-method/storefrontapi.generated.d.ts b/examples/custom-cart-method/storefrontapi.generated.d.ts index bb16191af..a9a95484c 100644 --- a/examples/custom-cart-method/storefrontapi.generated.d.ts +++ b/examples/custom-cart-method/storefrontapi.generated.d.ts @@ -807,32 +807,6 @@ export type ProductFragment = Pick< >; } >; - variants: { - nodes: Array< - Pick< - StorefrontAPI.ProductVariant, - 'availableForSale' | 'id' | 'sku' | 'title' - > & { - compareAtPrice?: StorefrontAPI.Maybe< - Pick - >; - image?: StorefrontAPI.Maybe< - {__typename: 'Image'} & Pick< - StorefrontAPI.Image, - 'id' | 'url' | 'altText' | 'width' | 'height' - > - >; - price: Pick; - product: Pick; - selectedOptions: Array< - Pick - >; - unitPrice?: StorefrontAPI.Maybe< - Pick - >; - } - >; - }; seo: Pick; }; @@ -947,103 +921,11 @@ export type ProductQuery = { >; } >; - variants: { - nodes: Array< - Pick< - StorefrontAPI.ProductVariant, - 'availableForSale' | 'id' | 'sku' | 'title' - > & { - compareAtPrice?: StorefrontAPI.Maybe< - Pick - >; - image?: StorefrontAPI.Maybe< - {__typename: 'Image'} & Pick< - StorefrontAPI.Image, - 'id' | 'url' | 'altText' | 'width' | 'height' - > - >; - price: Pick; - product: Pick; - selectedOptions: Array< - Pick - >; - unitPrice?: StorefrontAPI.Maybe< - Pick - >; - } - >; - }; seo: Pick; } >; }; -export type ProductVariantsFragment = { - variants: { - nodes: Array< - Pick< - StorefrontAPI.ProductVariant, - 'availableForSale' | 'id' | 'sku' | 'title' - > & { - compareAtPrice?: StorefrontAPI.Maybe< - Pick - >; - image?: StorefrontAPI.Maybe< - {__typename: 'Image'} & Pick< - StorefrontAPI.Image, - 'id' | 'url' | 'altText' | 'width' | 'height' - > - >; - price: Pick; - product: Pick; - selectedOptions: Array< - Pick - >; - unitPrice?: StorefrontAPI.Maybe< - Pick - >; - } - >; - }; -}; - -export type ProductVariantsQueryVariables = StorefrontAPI.Exact<{ - country?: StorefrontAPI.InputMaybe; - language?: StorefrontAPI.InputMaybe; - handle: StorefrontAPI.Scalars['String']['input']; -}>; - -export type ProductVariantsQuery = { - product?: StorefrontAPI.Maybe<{ - variants: { - nodes: Array< - Pick< - StorefrontAPI.ProductVariant, - 'availableForSale' | 'id' | 'sku' | 'title' - > & { - compareAtPrice?: StorefrontAPI.Maybe< - Pick - >; - image?: StorefrontAPI.Maybe< - {__typename: 'Image'} & Pick< - StorefrontAPI.Image, - 'id' | 'url' | 'altText' | 'width' | 'height' - > - >; - price: Pick; - product: Pick; - selectedOptions: Array< - Pick - >; - unitPrice?: StorefrontAPI.Maybe< - Pick - >; - } - >; - }; - }>; -}; - export type SearchProductFragment = {__typename: 'Product'} & Pick< StorefrontAPI.Product, 'handle' | 'id' | 'publishedAt' | 'title' | 'trackingParameters' | 'vendor' @@ -1331,14 +1213,10 @@ interface GeneratedQueryTypes { return: PoliciesQuery; variables: PoliciesQueryVariables; }; - '#graphql\n query Product(\n $country: CountryCode\n $handle: String!\n $language: LanguageCode\n $selectedOptions: [SelectedOptionInput!]!\n ) @inContext(country: $country, language: $language) {\n product(handle: $handle) {\n ...Product\n }\n }\n #graphql\n fragment Product on Product {\n id\n title\n vendor\n handle\n descriptionHtml\n description\n encodedVariantExistence\n encodedVariantAvailability\n options {\n name\n optionValues {\n name\n firstSelectableVariant {\n ...ProductVariant\n }\n swatch {\n color\n image {\n previewImage {\n url\n }\n }\n }\n }\n }\n selectedOrFirstAvailableVariant(selectedOptions: $selectedOptions, ignoreUnknownOptions: true, caseInsensitiveMatch: true) {\n ...ProductVariant\n }\n adjacentVariants (selectedOptions: $selectedOptions) {\n ...ProductVariant\n }\n variants(first: 1) {\n nodes {\n ...ProductVariant\n }\n }\n seo {\n description\n title\n }\n }\n #graphql\n fragment ProductVariant on ProductVariant {\n availableForSale\n compareAtPrice {\n amount\n currencyCode\n }\n id\n image {\n __typename\n id\n url\n altText\n width\n height\n }\n price {\n amount\n currencyCode\n }\n product {\n title\n handle\n }\n selectedOptions {\n name\n value\n }\n sku\n title\n unitPrice {\n amount\n currencyCode\n }\n }\n\n\n': { + '#graphql\n query Product(\n $country: CountryCode\n $handle: String!\n $language: LanguageCode\n $selectedOptions: [SelectedOptionInput!]!\n ) @inContext(country: $country, language: $language) {\n product(handle: $handle) {\n ...Product\n }\n }\n #graphql\n fragment Product on Product {\n id\n title\n vendor\n handle\n descriptionHtml\n description\n encodedVariantExistence\n encodedVariantAvailability\n options {\n name\n optionValues {\n name\n firstSelectableVariant {\n ...ProductVariant\n }\n swatch {\n color\n image {\n previewImage {\n url\n }\n }\n }\n }\n }\n selectedOrFirstAvailableVariant(selectedOptions: $selectedOptions, ignoreUnknownOptions: true, caseInsensitiveMatch: true) {\n ...ProductVariant\n }\n adjacentVariants (selectedOptions: $selectedOptions) {\n ...ProductVariant\n }\n seo {\n description\n title\n }\n }\n #graphql\n fragment ProductVariant on ProductVariant {\n availableForSale\n compareAtPrice {\n amount\n currencyCode\n }\n id\n image {\n __typename\n id\n url\n altText\n width\n height\n }\n price {\n amount\n currencyCode\n }\n product {\n title\n handle\n }\n selectedOptions {\n name\n value\n }\n sku\n title\n unitPrice {\n amount\n currencyCode\n }\n }\n\n\n': { return: ProductQuery; variables: ProductQueryVariables; }; - '#graphql\n #graphql\n fragment ProductVariants on Product {\n variants(first: 250) {\n nodes {\n ...ProductVariant\n }\n }\n }\n #graphql\n fragment ProductVariant on ProductVariant {\n availableForSale\n compareAtPrice {\n amount\n currencyCode\n }\n id\n image {\n __typename\n id\n url\n altText\n width\n height\n }\n price {\n amount\n currencyCode\n }\n product {\n title\n handle\n }\n selectedOptions {\n name\n value\n }\n sku\n title\n unitPrice {\n amount\n currencyCode\n }\n }\n\n\n query ProductVariants(\n $country: CountryCode\n $language: LanguageCode\n $handle: String!\n ) @inContext(country: $country, language: $language) {\n product(handle: $handle) {\n ...ProductVariants\n }\n }\n': { - return: ProductVariantsQuery; - variables: ProductVariantsQueryVariables; - }; '#graphql\n query RegularSearch(\n $country: CountryCode\n $endCursor: String\n $first: Int\n $language: LanguageCode\n $last: Int\n $term: String!\n $startCursor: String\n ) @inContext(country: $country, language: $language) {\n articles: search(\n query: $term,\n types: [ARTICLE],\n first: $first,\n ) {\n nodes {\n ...on Article {\n ...SearchArticle\n }\n }\n }\n pages: search(\n query: $term,\n types: [PAGE],\n first: $first,\n ) {\n nodes {\n ...on Page {\n ...SearchPage\n }\n }\n }\n products: search(\n after: $endCursor,\n before: $startCursor,\n first: $first,\n last: $last,\n query: $term,\n sortKey: RELEVANCE,\n types: [PRODUCT],\n unavailableProducts: HIDE,\n ) {\n nodes {\n ...on Product {\n ...SearchProduct\n }\n }\n pageInfo {\n ...PageInfoFragment\n }\n }\n }\n #graphql\n fragment SearchProduct on Product {\n __typename\n handle\n id\n publishedAt\n title\n trackingParameters\n vendor\n variants(first: 1) {\n nodes {\n id\n image {\n url\n altText\n width\n height\n }\n price {\n amount\n currencyCode\n }\n compareAtPrice {\n amount\n currencyCode\n }\n selectedOptions {\n name\n value\n }\n product {\n handle\n title\n }\n }\n }\n }\n\n #graphql\n fragment SearchPage on Page {\n __typename\n handle\n id\n title\n trackingParameters\n }\n\n #graphql\n fragment SearchArticle on Article {\n __typename\n handle\n id\n title\n trackingParameters\n }\n\n #graphql\n fragment PageInfoFragment on PageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n\n': { return: RegularSearchQuery; variables: RegularSearchQueryVariables; diff --git a/examples/legacy-customer-account-flow/storefrontapi.generated.d.ts b/examples/legacy-customer-account-flow/storefrontapi.generated.d.ts index ab0abb040..c9075669c 100644 --- a/examples/legacy-customer-account-flow/storefrontapi.generated.d.ts +++ b/examples/legacy-customer-account-flow/storefrontapi.generated.d.ts @@ -1568,32 +1568,6 @@ export type ProductFragment = Pick< >; } >; - variants: { - nodes: Array< - Pick< - StorefrontAPI.ProductVariant, - 'availableForSale' | 'id' | 'sku' | 'title' - > & { - compareAtPrice?: StorefrontAPI.Maybe< - Pick - >; - image?: StorefrontAPI.Maybe< - {__typename: 'Image'} & Pick< - StorefrontAPI.Image, - 'id' | 'url' | 'altText' | 'width' | 'height' - > - >; - price: Pick; - product: Pick; - selectedOptions: Array< - Pick - >; - unitPrice?: StorefrontAPI.Maybe< - Pick - >; - } - >; - }; seo: Pick; }; @@ -1708,103 +1682,11 @@ export type ProductQuery = { >; } >; - variants: { - nodes: Array< - Pick< - StorefrontAPI.ProductVariant, - 'availableForSale' | 'id' | 'sku' | 'title' - > & { - compareAtPrice?: StorefrontAPI.Maybe< - Pick - >; - image?: StorefrontAPI.Maybe< - {__typename: 'Image'} & Pick< - StorefrontAPI.Image, - 'id' | 'url' | 'altText' | 'width' | 'height' - > - >; - price: Pick; - product: Pick; - selectedOptions: Array< - Pick - >; - unitPrice?: StorefrontAPI.Maybe< - Pick - >; - } - >; - }; seo: Pick; } >; }; -export type ProductVariantsFragment = { - variants: { - nodes: Array< - Pick< - StorefrontAPI.ProductVariant, - 'availableForSale' | 'id' | 'sku' | 'title' - > & { - compareAtPrice?: StorefrontAPI.Maybe< - Pick - >; - image?: StorefrontAPI.Maybe< - {__typename: 'Image'} & Pick< - StorefrontAPI.Image, - 'id' | 'url' | 'altText' | 'width' | 'height' - > - >; - price: Pick; - product: Pick; - selectedOptions: Array< - Pick - >; - unitPrice?: StorefrontAPI.Maybe< - Pick - >; - } - >; - }; -}; - -export type ProductVariantsQueryVariables = StorefrontAPI.Exact<{ - country?: StorefrontAPI.InputMaybe; - language?: StorefrontAPI.InputMaybe; - handle: StorefrontAPI.Scalars['String']['input']; -}>; - -export type ProductVariantsQuery = { - product?: StorefrontAPI.Maybe<{ - variants: { - nodes: Array< - Pick< - StorefrontAPI.ProductVariant, - 'availableForSale' | 'id' | 'sku' | 'title' - > & { - compareAtPrice?: StorefrontAPI.Maybe< - Pick - >; - image?: StorefrontAPI.Maybe< - {__typename: 'Image'} & Pick< - StorefrontAPI.Image, - 'id' | 'url' | 'altText' | 'width' | 'height' - > - >; - price: Pick; - product: Pick; - selectedOptions: Array< - Pick - >; - unitPrice?: StorefrontAPI.Maybe< - Pick - >; - } - >; - }; - }>; -}; - export type SearchProductFragment = {__typename: 'Product'} & Pick< StorefrontAPI.Product, 'handle' | 'id' | 'publishedAt' | 'title' | 'trackingParameters' | 'vendor' @@ -2100,14 +1982,10 @@ interface GeneratedQueryTypes { return: PoliciesQuery; variables: PoliciesQueryVariables; }; - '#graphql\n query Product(\n $country: CountryCode\n $handle: String!\n $language: LanguageCode\n $selectedOptions: [SelectedOptionInput!]!\n ) @inContext(country: $country, language: $language) {\n product(handle: $handle) {\n ...Product\n }\n }\n #graphql\n fragment Product on Product {\n id\n title\n vendor\n handle\n descriptionHtml\n description\n encodedVariantExistence\n encodedVariantAvailability\n options {\n name\n optionValues {\n name\n firstSelectableVariant {\n ...ProductVariant\n }\n swatch {\n color\n image {\n previewImage {\n url\n }\n }\n }\n }\n }\n selectedOrFirstAvailableVariant(selectedOptions: $selectedOptions, ignoreUnknownOptions: true, caseInsensitiveMatch: true) {\n ...ProductVariant\n }\n adjacentVariants (selectedOptions: $selectedOptions) {\n ...ProductVariant\n }\n variants(first: 1) {\n nodes {\n ...ProductVariant\n }\n }\n seo {\n description\n title\n }\n }\n #graphql\n fragment ProductVariant on ProductVariant {\n availableForSale\n compareAtPrice {\n amount\n currencyCode\n }\n id\n image {\n __typename\n id\n url\n altText\n width\n height\n }\n price {\n amount\n currencyCode\n }\n product {\n title\n handle\n }\n selectedOptions {\n name\n value\n }\n sku\n title\n unitPrice {\n amount\n currencyCode\n }\n }\n\n\n': { + '#graphql\n query Product(\n $country: CountryCode\n $handle: String!\n $language: LanguageCode\n $selectedOptions: [SelectedOptionInput!]!\n ) @inContext(country: $country, language: $language) {\n product(handle: $handle) {\n ...Product\n }\n }\n #graphql\n fragment Product on Product {\n id\n title\n vendor\n handle\n descriptionHtml\n description\n encodedVariantExistence\n encodedVariantAvailability\n options {\n name\n optionValues {\n name\n firstSelectableVariant {\n ...ProductVariant\n }\n swatch {\n color\n image {\n previewImage {\n url\n }\n }\n }\n }\n }\n selectedOrFirstAvailableVariant(selectedOptions: $selectedOptions, ignoreUnknownOptions: true, caseInsensitiveMatch: true) {\n ...ProductVariant\n }\n adjacentVariants (selectedOptions: $selectedOptions) {\n ...ProductVariant\n }\n seo {\n description\n title\n }\n }\n #graphql\n fragment ProductVariant on ProductVariant {\n availableForSale\n compareAtPrice {\n amount\n currencyCode\n }\n id\n image {\n __typename\n id\n url\n altText\n width\n height\n }\n price {\n amount\n currencyCode\n }\n product {\n title\n handle\n }\n selectedOptions {\n name\n value\n }\n sku\n title\n unitPrice {\n amount\n currencyCode\n }\n }\n\n\n': { return: ProductQuery; variables: ProductQueryVariables; }; - '#graphql\n #graphql\n fragment ProductVariants on Product {\n variants(first: 250) {\n nodes {\n ...ProductVariant\n }\n }\n }\n #graphql\n fragment ProductVariant on ProductVariant {\n availableForSale\n compareAtPrice {\n amount\n currencyCode\n }\n id\n image {\n __typename\n id\n url\n altText\n width\n height\n }\n price {\n amount\n currencyCode\n }\n product {\n title\n handle\n }\n selectedOptions {\n name\n value\n }\n sku\n title\n unitPrice {\n amount\n currencyCode\n }\n }\n\n\n query ProductVariants(\n $country: CountryCode\n $language: LanguageCode\n $handle: String!\n ) @inContext(country: $country, language: $language) {\n product(handle: $handle) {\n ...ProductVariants\n }\n }\n': { - return: ProductVariantsQuery; - variables: ProductVariantsQueryVariables; - }; '#graphql\n query RegularSearch(\n $country: CountryCode\n $endCursor: String\n $first: Int\n $language: LanguageCode\n $last: Int\n $term: String!\n $startCursor: String\n ) @inContext(country: $country, language: $language) {\n articles: search(\n query: $term,\n types: [ARTICLE],\n first: $first,\n ) {\n nodes {\n ...on Article {\n ...SearchArticle\n }\n }\n }\n pages: search(\n query: $term,\n types: [PAGE],\n first: $first,\n ) {\n nodes {\n ...on Page {\n ...SearchPage\n }\n }\n }\n products: search(\n after: $endCursor,\n before: $startCursor,\n first: $first,\n last: $last,\n query: $term,\n sortKey: RELEVANCE,\n types: [PRODUCT],\n unavailableProducts: HIDE,\n ) {\n nodes {\n ...on Product {\n ...SearchProduct\n }\n }\n pageInfo {\n ...PageInfoFragment\n }\n }\n }\n #graphql\n fragment SearchProduct on Product {\n __typename\n handle\n id\n publishedAt\n title\n trackingParameters\n vendor\n variants(first: 1) {\n nodes {\n id\n image {\n url\n altText\n width\n height\n }\n price {\n amount\n currencyCode\n }\n compareAtPrice {\n amount\n currencyCode\n }\n selectedOptions {\n name\n value\n }\n product {\n handle\n title\n }\n }\n }\n }\n\n #graphql\n fragment SearchPage on Page {\n __typename\n handle\n id\n title\n trackingParameters\n }\n\n #graphql\n fragment SearchArticle on Article {\n __typename\n handle\n id\n title\n trackingParameters\n }\n\n #graphql\n fragment PageInfoFragment on PageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n\n': { return: RegularSearchQuery; variables: RegularSearchQueryVariables; diff --git a/examples/metaobjects/storefrontapi.generated.d.ts b/examples/metaobjects/storefrontapi.generated.d.ts index a2d7a0bed..17e495f84 100644 --- a/examples/metaobjects/storefrontapi.generated.d.ts +++ b/examples/metaobjects/storefrontapi.generated.d.ts @@ -777,32 +777,6 @@ export type ProductFragment = Pick< >; } >; - variants: { - nodes: Array< - Pick< - StorefrontAPI.ProductVariant, - 'availableForSale' | 'id' | 'sku' | 'title' - > & { - compareAtPrice?: StorefrontAPI.Maybe< - Pick - >; - image?: StorefrontAPI.Maybe< - {__typename: 'Image'} & Pick< - StorefrontAPI.Image, - 'id' | 'url' | 'altText' | 'width' | 'height' - > - >; - price: Pick; - product: Pick; - selectedOptions: Array< - Pick - >; - unitPrice?: StorefrontAPI.Maybe< - Pick - >; - } - >; - }; seo: Pick; }; @@ -917,103 +891,11 @@ export type ProductQuery = { >; } >; - variants: { - nodes: Array< - Pick< - StorefrontAPI.ProductVariant, - 'availableForSale' | 'id' | 'sku' | 'title' - > & { - compareAtPrice?: StorefrontAPI.Maybe< - Pick - >; - image?: StorefrontAPI.Maybe< - {__typename: 'Image'} & Pick< - StorefrontAPI.Image, - 'id' | 'url' | 'altText' | 'width' | 'height' - > - >; - price: Pick; - product: Pick; - selectedOptions: Array< - Pick - >; - unitPrice?: StorefrontAPI.Maybe< - Pick - >; - } - >; - }; seo: Pick; } >; }; -export type ProductVariantsFragment = { - variants: { - nodes: Array< - Pick< - StorefrontAPI.ProductVariant, - 'availableForSale' | 'id' | 'sku' | 'title' - > & { - compareAtPrice?: StorefrontAPI.Maybe< - Pick - >; - image?: StorefrontAPI.Maybe< - {__typename: 'Image'} & Pick< - StorefrontAPI.Image, - 'id' | 'url' | 'altText' | 'width' | 'height' - > - >; - price: Pick; - product: Pick; - selectedOptions: Array< - Pick - >; - unitPrice?: StorefrontAPI.Maybe< - Pick - >; - } - >; - }; -}; - -export type ProductVariantsQueryVariables = StorefrontAPI.Exact<{ - country?: StorefrontAPI.InputMaybe; - language?: StorefrontAPI.InputMaybe; - handle: StorefrontAPI.Scalars['String']['input']; -}>; - -export type ProductVariantsQuery = { - product?: StorefrontAPI.Maybe<{ - variants: { - nodes: Array< - Pick< - StorefrontAPI.ProductVariant, - 'availableForSale' | 'id' | 'sku' | 'title' - > & { - compareAtPrice?: StorefrontAPI.Maybe< - Pick - >; - image?: StorefrontAPI.Maybe< - {__typename: 'Image'} & Pick< - StorefrontAPI.Image, - 'id' | 'url' | 'altText' | 'width' | 'height' - > - >; - price: Pick; - product: Pick; - selectedOptions: Array< - Pick - >; - unitPrice?: StorefrontAPI.Maybe< - Pick - >; - } - >; - }; - }>; -}; - export type SearchProductFragment = {__typename: 'Product'} & Pick< StorefrontAPI.Product, 'handle' | 'id' | 'publishedAt' | 'title' | 'trackingParameters' | 'vendor' @@ -1917,14 +1799,10 @@ interface GeneratedQueryTypes { return: PoliciesQuery; variables: PoliciesQueryVariables; }; - '#graphql\n query Product(\n $country: CountryCode\n $handle: String!\n $language: LanguageCode\n $selectedOptions: [SelectedOptionInput!]!\n ) @inContext(country: $country, language: $language) {\n product(handle: $handle) {\n ...Product\n }\n }\n #graphql\n fragment Product on Product {\n id\n title\n vendor\n handle\n descriptionHtml\n description\n encodedVariantExistence\n encodedVariantAvailability\n options {\n name\n optionValues {\n name\n firstSelectableVariant {\n ...ProductVariant\n }\n swatch {\n color\n image {\n previewImage {\n url\n }\n }\n }\n }\n }\n selectedOrFirstAvailableVariant(selectedOptions: $selectedOptions, ignoreUnknownOptions: true, caseInsensitiveMatch: true) {\n ...ProductVariant\n }\n adjacentVariants (selectedOptions: $selectedOptions) {\n ...ProductVariant\n }\n variants(first: 1) {\n nodes {\n ...ProductVariant\n }\n }\n seo {\n description\n title\n }\n }\n #graphql\n fragment ProductVariant on ProductVariant {\n availableForSale\n compareAtPrice {\n amount\n currencyCode\n }\n id\n image {\n __typename\n id\n url\n altText\n width\n height\n }\n price {\n amount\n currencyCode\n }\n product {\n title\n handle\n }\n selectedOptions {\n name\n value\n }\n sku\n title\n unitPrice {\n amount\n currencyCode\n }\n }\n\n\n': { + '#graphql\n query Product(\n $country: CountryCode\n $handle: String!\n $language: LanguageCode\n $selectedOptions: [SelectedOptionInput!]!\n ) @inContext(country: $country, language: $language) {\n product(handle: $handle) {\n ...Product\n }\n }\n #graphql\n fragment Product on Product {\n id\n title\n vendor\n handle\n descriptionHtml\n description\n encodedVariantExistence\n encodedVariantAvailability\n options {\n name\n optionValues {\n name\n firstSelectableVariant {\n ...ProductVariant\n }\n swatch {\n color\n image {\n previewImage {\n url\n }\n }\n }\n }\n }\n selectedOrFirstAvailableVariant(selectedOptions: $selectedOptions, ignoreUnknownOptions: true, caseInsensitiveMatch: true) {\n ...ProductVariant\n }\n adjacentVariants (selectedOptions: $selectedOptions) {\n ...ProductVariant\n }\n seo {\n description\n title\n }\n }\n #graphql\n fragment ProductVariant on ProductVariant {\n availableForSale\n compareAtPrice {\n amount\n currencyCode\n }\n id\n image {\n __typename\n id\n url\n altText\n width\n height\n }\n price {\n amount\n currencyCode\n }\n product {\n title\n handle\n }\n selectedOptions {\n name\n value\n }\n sku\n title\n unitPrice {\n amount\n currencyCode\n }\n }\n\n\n': { return: ProductQuery; variables: ProductQueryVariables; }; - '#graphql\n #graphql\n fragment ProductVariants on Product {\n variants(first: 250) {\n nodes {\n ...ProductVariant\n }\n }\n }\n #graphql\n fragment ProductVariant on ProductVariant {\n availableForSale\n compareAtPrice {\n amount\n currencyCode\n }\n id\n image {\n __typename\n id\n url\n altText\n width\n height\n }\n price {\n amount\n currencyCode\n }\n product {\n title\n handle\n }\n selectedOptions {\n name\n value\n }\n sku\n title\n unitPrice {\n amount\n currencyCode\n }\n }\n\n\n query ProductVariants(\n $country: CountryCode\n $language: LanguageCode\n $handle: String!\n ) @inContext(country: $country, language: $language) {\n product(handle: $handle) {\n ...ProductVariants\n }\n }\n': { - return: ProductVariantsQuery; - variables: ProductVariantsQueryVariables; - }; '#graphql\n query RegularSearch(\n $country: CountryCode\n $endCursor: String\n $first: Int\n $language: LanguageCode\n $last: Int\n $term: String!\n $startCursor: String\n ) @inContext(country: $country, language: $language) {\n articles: search(\n query: $term,\n types: [ARTICLE],\n first: $first,\n ) {\n nodes {\n ...on Article {\n ...SearchArticle\n }\n }\n }\n pages: search(\n query: $term,\n types: [PAGE],\n first: $first,\n ) {\n nodes {\n ...on Page {\n ...SearchPage\n }\n }\n }\n products: search(\n after: $endCursor,\n before: $startCursor,\n first: $first,\n last: $last,\n query: $term,\n sortKey: RELEVANCE,\n types: [PRODUCT],\n unavailableProducts: HIDE,\n ) {\n nodes {\n ...on Product {\n ...SearchProduct\n }\n }\n pageInfo {\n ...PageInfoFragment\n }\n }\n }\n #graphql\n fragment SearchProduct on Product {\n __typename\n handle\n id\n publishedAt\n title\n trackingParameters\n vendor\n variants(first: 1) {\n nodes {\n id\n image {\n url\n altText\n width\n height\n }\n price {\n amount\n currencyCode\n }\n compareAtPrice {\n amount\n currencyCode\n }\n selectedOptions {\n name\n value\n }\n product {\n handle\n title\n }\n }\n }\n }\n\n #graphql\n fragment SearchPage on Page {\n __typename\n handle\n id\n title\n trackingParameters\n }\n\n #graphql\n fragment SearchArticle on Article {\n __typename\n handle\n id\n title\n trackingParameters\n }\n\n #graphql\n fragment PageInfoFragment on PageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n\n': { return: RegularSearchQuery; variables: RegularSearchQueryVariables; diff --git a/examples/multipass/storefrontapi.generated.d.ts b/examples/multipass/storefrontapi.generated.d.ts index c69c7834f..9022bdf1e 100644 --- a/examples/multipass/storefrontapi.generated.d.ts +++ b/examples/multipass/storefrontapi.generated.d.ts @@ -1581,32 +1581,6 @@ export type ProductFragment = Pick< >; } >; - variants: { - nodes: Array< - Pick< - StorefrontAPI.ProductVariant, - 'availableForSale' | 'id' | 'sku' | 'title' - > & { - compareAtPrice?: StorefrontAPI.Maybe< - Pick - >; - image?: StorefrontAPI.Maybe< - {__typename: 'Image'} & Pick< - StorefrontAPI.Image, - 'id' | 'url' | 'altText' | 'width' | 'height' - > - >; - price: Pick; - product: Pick; - selectedOptions: Array< - Pick - >; - unitPrice?: StorefrontAPI.Maybe< - Pick - >; - } - >; - }; seo: Pick; }; @@ -1721,103 +1695,11 @@ export type ProductQuery = { >; } >; - variants: { - nodes: Array< - Pick< - StorefrontAPI.ProductVariant, - 'availableForSale' | 'id' | 'sku' | 'title' - > & { - compareAtPrice?: StorefrontAPI.Maybe< - Pick - >; - image?: StorefrontAPI.Maybe< - {__typename: 'Image'} & Pick< - StorefrontAPI.Image, - 'id' | 'url' | 'altText' | 'width' | 'height' - > - >; - price: Pick; - product: Pick; - selectedOptions: Array< - Pick - >; - unitPrice?: StorefrontAPI.Maybe< - Pick - >; - } - >; - }; seo: Pick; } >; }; -export type ProductVariantsFragment = { - variants: { - nodes: Array< - Pick< - StorefrontAPI.ProductVariant, - 'availableForSale' | 'id' | 'sku' | 'title' - > & { - compareAtPrice?: StorefrontAPI.Maybe< - Pick - >; - image?: StorefrontAPI.Maybe< - {__typename: 'Image'} & Pick< - StorefrontAPI.Image, - 'id' | 'url' | 'altText' | 'width' | 'height' - > - >; - price: Pick; - product: Pick; - selectedOptions: Array< - Pick - >; - unitPrice?: StorefrontAPI.Maybe< - Pick - >; - } - >; - }; -}; - -export type ProductVariantsQueryVariables = StorefrontAPI.Exact<{ - country?: StorefrontAPI.InputMaybe; - language?: StorefrontAPI.InputMaybe; - handle: StorefrontAPI.Scalars['String']['input']; -}>; - -export type ProductVariantsQuery = { - product?: StorefrontAPI.Maybe<{ - variants: { - nodes: Array< - Pick< - StorefrontAPI.ProductVariant, - 'availableForSale' | 'id' | 'sku' | 'title' - > & { - compareAtPrice?: StorefrontAPI.Maybe< - Pick - >; - image?: StorefrontAPI.Maybe< - {__typename: 'Image'} & Pick< - StorefrontAPI.Image, - 'id' | 'url' | 'altText' | 'width' | 'height' - > - >; - price: Pick; - product: Pick; - selectedOptions: Array< - Pick - >; - unitPrice?: StorefrontAPI.Maybe< - Pick - >; - } - >; - }; - }>; -}; - export type SearchProductFragment = {__typename: 'Product'} & Pick< StorefrontAPI.Product, 'handle' | 'id' | 'publishedAt' | 'title' | 'trackingParameters' | 'vendor' @@ -2117,14 +1999,10 @@ interface GeneratedQueryTypes { return: PoliciesQuery; variables: PoliciesQueryVariables; }; - '#graphql\n query Product(\n $country: CountryCode\n $handle: String!\n $language: LanguageCode\n $selectedOptions: [SelectedOptionInput!]!\n ) @inContext(country: $country, language: $language) {\n product(handle: $handle) {\n ...Product\n }\n }\n #graphql\n fragment Product on Product {\n id\n title\n vendor\n handle\n descriptionHtml\n description\n encodedVariantExistence\n encodedVariantAvailability\n options {\n name\n optionValues {\n name\n firstSelectableVariant {\n ...ProductVariant\n }\n swatch {\n color\n image {\n previewImage {\n url\n }\n }\n }\n }\n }\n selectedOrFirstAvailableVariant(selectedOptions: $selectedOptions, ignoreUnknownOptions: true, caseInsensitiveMatch: true) {\n ...ProductVariant\n }\n adjacentVariants (selectedOptions: $selectedOptions) {\n ...ProductVariant\n }\n variants(first: 1) {\n nodes {\n ...ProductVariant\n }\n }\n seo {\n description\n title\n }\n }\n #graphql\n fragment ProductVariant on ProductVariant {\n availableForSale\n compareAtPrice {\n amount\n currencyCode\n }\n id\n image {\n __typename\n id\n url\n altText\n width\n height\n }\n price {\n amount\n currencyCode\n }\n product {\n title\n handle\n }\n selectedOptions {\n name\n value\n }\n sku\n title\n unitPrice {\n amount\n currencyCode\n }\n }\n\n\n': { + '#graphql\n query Product(\n $country: CountryCode\n $handle: String!\n $language: LanguageCode\n $selectedOptions: [SelectedOptionInput!]!\n ) @inContext(country: $country, language: $language) {\n product(handle: $handle) {\n ...Product\n }\n }\n #graphql\n fragment Product on Product {\n id\n title\n vendor\n handle\n descriptionHtml\n description\n encodedVariantExistence\n encodedVariantAvailability\n options {\n name\n optionValues {\n name\n firstSelectableVariant {\n ...ProductVariant\n }\n swatch {\n color\n image {\n previewImage {\n url\n }\n }\n }\n }\n }\n selectedOrFirstAvailableVariant(selectedOptions: $selectedOptions, ignoreUnknownOptions: true, caseInsensitiveMatch: true) {\n ...ProductVariant\n }\n adjacentVariants (selectedOptions: $selectedOptions) {\n ...ProductVariant\n }\n seo {\n description\n title\n }\n }\n #graphql\n fragment ProductVariant on ProductVariant {\n availableForSale\n compareAtPrice {\n amount\n currencyCode\n }\n id\n image {\n __typename\n id\n url\n altText\n width\n height\n }\n price {\n amount\n currencyCode\n }\n product {\n title\n handle\n }\n selectedOptions {\n name\n value\n }\n sku\n title\n unitPrice {\n amount\n currencyCode\n }\n }\n\n\n': { return: ProductQuery; variables: ProductQueryVariables; }; - '#graphql\n #graphql\n fragment ProductVariants on Product {\n variants(first: 250) {\n nodes {\n ...ProductVariant\n }\n }\n }\n #graphql\n fragment ProductVariant on ProductVariant {\n availableForSale\n compareAtPrice {\n amount\n currencyCode\n }\n id\n image {\n __typename\n id\n url\n altText\n width\n height\n }\n price {\n amount\n currencyCode\n }\n product {\n title\n handle\n }\n selectedOptions {\n name\n value\n }\n sku\n title\n unitPrice {\n amount\n currencyCode\n }\n }\n\n\n query ProductVariants(\n $country: CountryCode\n $language: LanguageCode\n $handle: String!\n ) @inContext(country: $country, language: $language) {\n product(handle: $handle) {\n ...ProductVariants\n }\n }\n': { - return: ProductVariantsQuery; - variables: ProductVariantsQueryVariables; - }; '#graphql\n query RegularSearch(\n $country: CountryCode\n $endCursor: String\n $first: Int\n $language: LanguageCode\n $last: Int\n $term: String!\n $startCursor: String\n ) @inContext(country: $country, language: $language) {\n articles: search(\n query: $term,\n types: [ARTICLE],\n first: $first,\n ) {\n nodes {\n ...on Article {\n ...SearchArticle\n }\n }\n }\n pages: search(\n query: $term,\n types: [PAGE],\n first: $first,\n ) {\n nodes {\n ...on Page {\n ...SearchPage\n }\n }\n }\n products: search(\n after: $endCursor,\n before: $startCursor,\n first: $first,\n last: $last,\n query: $term,\n sortKey: RELEVANCE,\n types: [PRODUCT],\n unavailableProducts: HIDE,\n ) {\n nodes {\n ...on Product {\n ...SearchProduct\n }\n }\n pageInfo {\n ...PageInfoFragment\n }\n }\n }\n #graphql\n fragment SearchProduct on Product {\n __typename\n handle\n id\n publishedAt\n title\n trackingParameters\n vendor\n variants(first: 1) {\n nodes {\n id\n image {\n url\n altText\n width\n height\n }\n price {\n amount\n currencyCode\n }\n compareAtPrice {\n amount\n currencyCode\n }\n selectedOptions {\n name\n value\n }\n product {\n handle\n title\n }\n }\n }\n }\n\n #graphql\n fragment SearchPage on Page {\n __typename\n handle\n id\n title\n trackingParameters\n }\n\n #graphql\n fragment SearchArticle on Article {\n __typename\n handle\n id\n title\n trackingParameters\n }\n\n #graphql\n fragment PageInfoFragment on PageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n\n': { return: RegularSearchQuery; variables: RegularSearchQueryVariables; diff --git a/packages/hydrogen-react/src/getProductOptions.ts b/packages/hydrogen-react/src/getProductOptions.ts index 9f4318329..a2d0c7a04 100644 --- a/packages/hydrogen-react/src/getProductOptions.ts +++ b/packages/hydrogen-react/src/getProductOptions.ts @@ -250,7 +250,9 @@ export function checkProductParam( checkAll, ); } else { - validParam = logErrorAndReturnFalse('options.optionValues.firstSelectableVariant'); + validParam = logErrorAndReturnFalse( + 'options.optionValues.firstSelectableVariant', + ); } } else { validParam = logErrorAndReturnFalse('options.optionValues');