diff --git a/shopify/loaders/ProductDetailsPage.ts b/shopify/loaders/ProductDetailsPage.ts index 29c345c81..52028c0a9 100644 --- a/shopify/loaders/ProductDetailsPage.ts +++ b/shopify/loaders/ProductDetailsPage.ts @@ -6,9 +6,11 @@ import { GetProductQuery, GetProductQueryVariables, HasMetafieldsMetafieldsArgs, + LanguageCode, + CountryCode } from "../utils/storefront/storefront.graphql.gen.ts"; import { GetProduct } from "../utils/storefront/queries.ts"; -import { Metafield } from "../utils/types.ts"; +import { LanguageContextArgs, Metafield } from "../utils/types.ts"; export interface Props { slug: RequestURLParam; @@ -17,6 +19,18 @@ export interface Props { * @description search for metafields */ metafields?: Metafield[]; + /** + * @title Language Code + * @description Language code for the storefront API + * @example "EN" for English, "FR" for French, etc. + */ + languageCode?: LanguageCode; + /** + * @title Country Code + * @description Country code for the storefront API + * @example "US" for United States, "FR" for France, etc. + */ + countryCode?: CountryCode; } /** @@ -29,7 +43,7 @@ const loader = async ( ctx: AppContext, ): Promise => { const { storefront } = ctx; - const { slug } = props; + const { slug, languageCode = "PT", countryCode = "BR" } = props; const metafields = props.metafields || []; const splitted = slug?.split("-"); @@ -39,9 +53,9 @@ const loader = async ( const data = await storefront.query< GetProductQuery, - GetProductQueryVariables & HasMetafieldsMetafieldsArgs + GetProductQueryVariables & HasMetafieldsMetafieldsArgs & LanguageContextArgs >({ - variables: { handle, identifiers: metafields }, + variables: { handle, identifiers: metafields, languageCode, countryCode }, ...GetProduct, }); diff --git a/shopify/loaders/ProductList.ts b/shopify/loaders/ProductList.ts index 6fa9f405d..3c0bcd241 100644 --- a/shopify/loaders/ProductList.ts +++ b/shopify/loaders/ProductList.ts @@ -13,6 +13,8 @@ import { QueryRootCollectionArgs, QueryRootSearchArgs, SearchResultItemConnection, + LanguageCode, + CountryCode } from "../utils/storefront/storefront.graphql.gen.ts"; import { toProduct } from "../utils/transform.ts"; import { @@ -21,7 +23,7 @@ import { searchSortShopify, sortShopify, } from "../utils/utils.ts"; -import { Metafield } from "../utils/types.ts"; +import { LanguageContextArgs, Metafield } from "../utils/types.ts"; export interface QueryProps { /** @description search term to use on search */ @@ -70,6 +72,18 @@ export type Props = { * @description search for metafields */ metafields?: Metafield[]; + /** + * @title Language Code + * @description Language code for the storefront API + * @example "EN" for English, "FR" for French, etc. + */ + languageCode?: LanguageCode; + /** + * @title Country Code + * @description Country code for the storefront API + * @example "US" for United States, "FR" for France, etc. + */ + countryCode?: CountryCode; }; // deno-lint-ignore no-explicit-any @@ -92,6 +106,8 @@ const loader = async ( const count = props.count ?? 12; const metafields = expandedProps.metafields || []; + const languageCode = expandedProps?.languageCode ?? "PT"; + const countryCode = expandedProps?.countryCode ?? "BR"; let shopifyProducts: | SearchResultItemConnection @@ -119,15 +135,18 @@ const loader = async ( }); if (isQueryList(props)) { + const data = await storefront.query< QueryRoot, - QueryRootSearchArgs & HasMetafieldsMetafieldsArgs + QueryRootSearchArgs & HasMetafieldsMetafieldsArgs & LanguageContextArgs >({ variables: { first: count, query: props.query, productFilters: filters, identifiers: metafields, + languageCode, + countryCode, ...searchSortShopify[sort], }, ...SearchProducts, @@ -139,12 +158,15 @@ const loader = async ( & QueryRootCollectionArgs & CollectionProductsArgs & HasMetafieldsMetafieldsArgs + & LanguageContextArgs >({ variables: { first: count, handle: props.collection, filters, identifiers: metafields, + languageCode, + countryCode, ...sortShopify[sort], }, ...ProductsByCollection, diff --git a/shopify/loaders/ProductListingPage.ts b/shopify/loaders/ProductListingPage.ts index 4672b8efa..ecca0c0a7 100644 --- a/shopify/loaders/ProductListingPage.ts +++ b/shopify/loaders/ProductListingPage.ts @@ -13,9 +13,11 @@ import { QueryRootCollectionArgs, QueryRootSearchArgs, SearchResultItemConnection, + LanguageCode, + CountryCode } from "../utils/storefront/storefront.graphql.gen.ts"; import { toFilter, toProduct } from "../utils/transform.ts"; -import { Metafield } from "../utils/types.ts"; +import { LanguageContextArgs, Metafield } from "../utils/types.ts"; import { getFiltersByUrl, searchSortOptions, @@ -69,6 +71,18 @@ export interface Props { * @description The URL of the page, used to override URL from request */ pageHref?: string; + /** + * @title Language Code + * @description Language code for the storefront API + * @example "EN" for English, "FR" for French, etc. + */ + languageCode?: LanguageCode; + /** + * @title Country Code + * @description Country code for the storefront API + * @example "US" for United States, "FR" for France, etc. + */ + countryCode?: CountryCode; } /** @@ -94,6 +108,8 @@ const loader = async ( const startCursor = props.startCursor || url.searchParams.get("startCursor") || ""; const metafields = props.metafields || []; + const languageCode = props?.languageCode || "PT"; + const countryCode = props?.countryCode || "BR"; const isSearch = Boolean(query); let hasNextPage = false; @@ -113,7 +129,7 @@ const loader = async ( if (isSearch) { const data = await storefront.query< QueryRoot, - QueryRootSearchArgs & HasMetafieldsMetafieldsArgs + QueryRootSearchArgs & HasMetafieldsMetafieldsArgs & LanguageContextArgs >({ variables: { ...(!endCursor && { first: count }), @@ -123,6 +139,8 @@ const loader = async ( query: query, productFilters: getFiltersByUrl(url), identifiers: metafields, + languageCode, + countryCode, ...searchSortShopify[sort], }, ...SearchProducts, @@ -145,6 +163,7 @@ const loader = async ( & QueryRootCollectionArgs & CollectionProductsArgs & HasMetafieldsMetafieldsArgs + & LanguageContextArgs >({ variables: { ...(!endCursor && { first: count }), @@ -154,6 +173,8 @@ const loader = async ( identifiers: metafields, handle: pathname, filters: getFiltersByUrl(url), + languageCode, + countryCode, ...sortShopify[sort], }, ...ProductsByCollection, diff --git a/shopify/loaders/RelatedProducts.ts b/shopify/loaders/RelatedProducts.ts index a1d8b0ece..a677f8038 100644 --- a/shopify/loaders/RelatedProducts.ts +++ b/shopify/loaders/RelatedProducts.ts @@ -11,9 +11,11 @@ import { HasMetafieldsMetafieldsArgs, ProductRecommendationsQuery, ProductRecommendationsQueryVariables, + LanguageCode, + CountryCode } from "../utils/storefront/storefront.graphql.gen.ts"; import { toProduct } from "../utils/transform.ts"; -import { Metafield } from "../utils/types.ts"; +import { LanguageContextArgs, Metafield } from "../utils/types.ts"; export interface Props { slug: RequestURLParam; @@ -27,6 +29,18 @@ export interface Props { * @description search for metafields */ metafields?: Metafield[]; + /** + * @title Language Code + * @description Language code for the storefront API + * @example "EN" for English, "FR" for French, etc. + */ + languageCode?: LanguageCode; + /** + * @title Country Code + * @description Country code for the storefront API + * @example "US" for United States, "FR" for France, etc. + */ + countryCode?: CountryCode; } /** @@ -39,7 +53,7 @@ const loader = async ( ctx: AppContext, ): Promise => { const { storefront } = ctx; - const { slug, count } = props; + const { slug, count, languageCode = "PT", countryCode = "BR" } = props; const splitted = slug?.split("-"); const maybeSkuId = Number(splitted[splitted.length - 1]); @@ -48,9 +62,9 @@ const loader = async ( const query = await storefront.query< GetProductQuery, - GetProductQueryVariables & HasMetafieldsMetafieldsArgs + GetProductQueryVariables & HasMetafieldsMetafieldsArgs & LanguageContextArgs >({ - variables: { handle, identifiers: metafields }, + variables: { handle, identifiers: metafields, languageCode, countryCode }, ...GetProduct, }); @@ -60,11 +74,13 @@ const loader = async ( const data = await storefront.query< ProductRecommendationsQuery, - ProductRecommendationsQueryVariables & HasMetafieldsMetafieldsArgs + ProductRecommendationsQueryVariables & HasMetafieldsMetafieldsArgs & LanguageContextArgs >({ variables: { productId: query.product.id, identifiers: metafields, + languageCode, + countryCode }, ...ProductRecommendations, }); diff --git a/shopify/loaders/cart.ts b/shopify/loaders/cart.ts index 960d3f7b1..fc1b4c793 100644 --- a/shopify/loaders/cart.ts +++ b/shopify/loaders/cart.ts @@ -2,31 +2,54 @@ import { AppContext } from "../mod.ts"; import { getCartCookie, setCartCookie } from "../utils/cart.ts"; import { CreateCart, GetCart } from "../utils/storefront/queries.ts"; import { + CountryCode, CreateCartMutation, CreateCartMutationVariables, GetCartQuery, GetCartQueryVariables, + LanguageCode, } from "../utils/storefront/storefront.graphql.gen.ts"; +import { LanguageContextArgs } from "../utils/types.ts"; + +export interface Props { + /** + * @title Language Code + * @description Language code for the storefront API + * @example "EN" for English, "FR" for French, etc. + */ + languageCode?: LanguageCode; + /** + * @title Country Code + * @description Country code for the storefront API + * @example "US" for United States, "FR" for France, etc. + */ + countryCode?: CountryCode; +} const loader = async ( - _props: unknown, + props: Props, req: Request, ctx: AppContext, ): Promise => { + const { languageCode = "PT", countryCode = "BR" } = props; const { storefront } = ctx; const maybeCartId = getCartCookie(req.headers); const cartId = maybeCartId || - await storefront.query( - CreateCart, - ).then((data) => data.payload?.cart?.id); + await storefront.query({ + variables: { countryCode }, + ...CreateCart, + }).then((data) => data.payload?.cart?.id); if (!cartId) { throw new Error("Missing cart id"); } - const cart = await storefront.query({ - variables: { id: decodeURIComponent(cartId) }, + const cart = await storefront.query< + GetCartQuery, + GetCartQueryVariables & LanguageContextArgs + >({ + variables: { id: decodeURIComponent(cartId), languageCode, countryCode }, ...GetCart, }).then((data) => data.cart); diff --git a/shopify/loaders/shop.ts b/shopify/loaders/shop.ts index 1498e0c85..22db0b638 100644 --- a/shopify/loaders/shop.ts +++ b/shopify/loaders/shop.ts @@ -1,10 +1,12 @@ import { AppContext } from "../mod.ts"; import { GetShopInfo } from "../utils/storefront/queries.ts"; import { + CountryCode, + LanguageCode, Shop, ShopMetafieldsArgs, } from "../utils/storefront/storefront.graphql.gen.ts"; -import { Metafield } from "../utils/types.ts"; +import { LanguageContextArgs, Metafield } from "../utils/types.ts"; export interface Props { /** @@ -12,6 +14,18 @@ export interface Props { * @description search for metafields */ metafields?: Metafield[]; + /** + * @title Language Code + * @description Language code for the storefront API + * @example "EN" for English, "FR" for French, etc. + */ + languageCode?: LanguageCode; + /** + * @title Country Code + * @description Country code for the storefront API + * @example "US" for United States, "FR" for France, etc. + */ + countryCode?: CountryCode; } export const defaultVisibility = "private"; @@ -22,10 +36,13 @@ const loader = async ( ctx: AppContext, ): Promise => { const { storefront } = ctx; - const { metafields = [] } = props; + const { metafields = [], languageCode = "PT", countryCode = "BR" } = props; - const shop = await storefront.query<{ shop: Shop }, ShopMetafieldsArgs>({ - variables: { identifiers: metafields }, + const shop = await storefront.query< + { shop: Shop }, + ShopMetafieldsArgs & LanguageContextArgs + >({ + variables: { identifiers: metafields, languageCode, countryCode }, ...GetShopInfo, }).then((data) => data.shop); diff --git a/shopify/utils/storefront/queries.ts b/shopify/utils/storefront/queries.ts index bd5e2bc3e..c7aac585f 100644 --- a/shopify/utils/storefront/queries.ts +++ b/shopify/utils/storefront/queries.ts @@ -266,112 +266,103 @@ const Customer = gql` `; export const CreateCart = { - query: gql`mutation CreateCart { - payload: cartCreate { - cart { id } + query: gql` + mutation CreateCart($countryCode: CountryCode) { + payload: cartCreate(input: { buyerIdentity: { countryCode: $countryCode } }) { + cart { + id + } + } } - }`, + `, }; export const GetCart = { fragments: [Cart], - query: gql`query GetCart($id: ID!) { cart(id: $id) { ...Cart } }`, + query: gql` + query GetCart( + $id: ID!, + $languageCode: LanguageCode, + $countryCode: CountryCode + ) @inContext(language: $languageCode, country: $countryCode) { + cart(id: $id) { + ...Cart + } + } + `, }; export const GetProduct = { fragments: [Product, ProductVariant, Collection], - query: - gql`query GetProduct($handle: String, $identifiers: [HasMetafieldsIdentifier!]!) { - product(handle: $handle) { ...Product } - }`, + query: gql` + query GetProduct( + $handle: String, + $identifiers: [HasMetafieldsIdentifier!]!, + $languageCode: LanguageCode, + $countryCode: CountryCode + ) @inContext(language: $languageCode, country: $countryCode) { + product(handle: $handle) { + ...Product + } + } + `, }; export const ListProducts = { fragments: [Product, ProductVariant, Collection], - query: - gql`query ListProducts($first: Int, $after: String, $query: String, $identifiers: [HasMetafieldsIdentifier!]!) { - products(first: $first, after: $after, query: $query) { - nodes { - ...Product + query: gql` + query ListProducts( + $first: Int, + $after: String, + $query: String, + $identifiers: [HasMetafieldsIdentifier!]!, + $languageCode: LanguageCode, + $countryCode: CountryCode + ) @inContext(language: $languageCode, country: $countryCode) { + products(first: $first, after: $after, query: $query) { + nodes { + ...Product + } } } - }`, + `, }; export const SearchProducts = { fragments: [Product, ProductVariant, Filter, Collection], - query: gql`query searchWithFilters( - $first: Int, - $last: Int, - $after: String, - $before: String, - $query: String!, - $productFilters: [ProductFilter!] - $sortKey: SearchSortKeys, + query: gql` + query searchWithFilters( + $first: Int, + $last: Int, + $after: String, + $before: String, + $query: String!, + $productFilters: [ProductFilter!], + $sortKey: SearchSortKeys, $reverse: Boolean, - $identifiers: [HasMetafieldsIdentifier!]! - ){ - search( - first: $first, - last: $last, - after: $after, - before: $before, - query: $query, - productFilters: $productFilters, - types: PRODUCT, - sortKey: $sortKey, - reverse: $reverse, - ){ - totalCount - pageInfo { - hasNextPage - hasPreviousPage - endCursor - startCursor - } - productFilters { - ...Filter - } - nodes { - ...Product - } - } - }`, -}; - -export const ProductsByCollection = { - fragments: [Product, ProductVariant, Collection, Filter], - query: gql`query AllProducts( - $first: Int, - $last: Int, - $after: String, - $before: String, - $handle: String, - $sortKey: ProductCollectionSortKeys, - $reverse: Boolean, - $filters: [ProductFilter!], - $identifiers: [HasMetafieldsIdentifier!]! - ){ - collection(handle: $handle) { - handle - description - title - products( - first: $first, - last: $last, - after: $after, - before: $before, - sortKey: $sortKey, - reverse: $reverse, - filters: $filters - ){ + $identifiers: [HasMetafieldsIdentifier!]!, + $languageCode: LanguageCode, + $countryCode: CountryCode + ) @inContext(language: $languageCode, country: $countryCode) { + search( + first: $first, + last: $last, + after: $after, + before: $before, + query: $query, + productFilters: $productFilters, + types: PRODUCT, + sortKey: $sortKey, + reverse: $reverse + ) { + totalCount pageInfo { hasNextPage hasPreviousPage endCursor startCursor } - filters { + productFilters { ...Filter } nodes { @@ -379,63 +370,122 @@ export const ProductsByCollection = { } } } - }`, + `, +}; + +export const ProductsByCollection = { + fragments: [Product, ProductVariant, Collection, Filter], + query: gql` + query AllProducts( + $first: Int, + $last: Int, + $after: String, + $before: String, + $handle: String, + $sortKey: ProductCollectionSortKeys, + $reverse: Boolean, + $filters: [ProductFilter!], + $identifiers: [HasMetafieldsIdentifier!]!, + $languageCode: LanguageCode, + $countryCode: CountryCode + ) @inContext(language: $languageCode, country: $countryCode) { + collection(handle: $handle) { + handle + description + title + products( + first: $first, + last: $last, + after: $after, + before: $before, + sortKey: $sortKey, + reverse: $reverse, + filters: $filters + ) { + pageInfo { + hasNextPage + hasPreviousPage + endCursor + startCursor + } + filters { + ...Filter + } + nodes { + ...Product + } + } + } + } + `, }; export const ProductRecommendations = { fragments: [Product, ProductVariant, Collection], - query: - gql`query productRecommendations($productId: ID!, $identifiers: [HasMetafieldsIdentifier!]!) { - productRecommendations(productId: $productId) { - ...Product + query: gql` + query ProductRecommendations( + $productId: ID!, + $identifiers: [HasMetafieldsIdentifier!]!, + $languageCode: LanguageCode, + $countryCode: CountryCode + ) @inContext(language: $languageCode, country: $countryCode) { + productRecommendations(productId: $productId) { + ...Product + } } - }`, + `, }; export const GetShopInfo = { - query: gql`query GetShopInfo($identifiers: [HasMetafieldsIdentifier!]!) { - shop { - name - description - privacyPolicy { - title - body - } - refundPolicy { - title - body - } - shippingPolicy { - title - body - } - subscriptionPolicy { - title - body - } - termsOfService { - title - body - } - metafields(identifiers: $identifiers) { + query: gql` + query GetShopInfo( + $identifiers: [HasMetafieldsIdentifier!]!, + $languageCode: LanguageCode, + $countryCode: CountryCode + ) @inContext(language: $languageCode, country: $countryCode) { + shop { + name description - key - namespace - type - value - reference { - ... on MediaImage { - image { - url + privacyPolicy { + title + body + } + refundPolicy { + title + body + } + shippingPolicy { + title + body + } + subscriptionPolicy { + title + body + } + termsOfService { + title + body + } + metafields(identifiers: $identifiers) { + description + key + namespace + type + value + reference { + ... on MediaImage { + image { + url + } } } - } - references(first: 250) { - edges { - node { - ... on MediaImage { - image { - url + references(first: 250) { + edges { + node { + ... on MediaImage { + image { + url + } } } } @@ -443,88 +493,106 @@ export const GetShopInfo = { } } } - }`, + `, }; export const FetchCustomerInfo = { fragments: [Customer], - query: gql`query FetchCustomerInfo($customerAccessToken: String!) { - customer(customerAccessToken: $customerAccessToken) { - ...Customer + query: gql` + query FetchCustomerInfo($customerAccessToken: String!) { + customer(customerAccessToken: $customerAccessToken) { + ...Customer + } } - }`, + `, }; export const AddItemToCart = { fragments: [Cart], - query: gql`mutation AddItemToCart($cartId: ID!, $lines: [CartLineInput!]!) { - payload: cartLinesAdd(cartId: $cartId, lines: $lines) { - cart { ...Cart } + query: gql` + mutation AddItemToCart($cartId: ID!, $lines: [CartLineInput!]!) { + payload: cartLinesAdd(cartId: $cartId, lines: $lines) { + cart { + ...Cart + } + } } - }`, + `, }; export const RegisterAccount = { - query: gql`mutation RegisterAccount( + query: gql` + mutation RegisterAccount( $email: String!, $password: String!, $firstName: String, $lastName: String, $acceptsMarketing: Boolean = false ) { - customerCreate(input: { - email: $email, - password: $password, - firstName: $firstName, - lastName: $lastName, - acceptsMarketing: $acceptsMarketing, - }) { - customer { - id - } - customerUserErrors { - code - message + customerCreate( + input: { + email: $email, + password: $password, + firstName: $firstName, + lastName: $lastName, + acceptsMarketing: $acceptsMarketing + } + ) { + customer { + id + } + customerUserErrors { + code + message + } } } - }`, + `, }; export const AddCoupon = { fragments: [Cart], - query: gql`mutation AddCoupon($cartId: ID!, $discountCodes: [String!]!) { - payload: cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) { - cart { ...Cart } - userErrors { - field - message + query: gql` + mutation AddCoupon($cartId: ID!, $discountCodes: [String!]!) { + payload: cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) { + cart { + ...Cart + } + userErrors { + field + message + } } } - }`, + `, }; export const UpdateItems = { fragments: [Cart], - query: - gql`mutation UpdateItems($cartId: ID!, $lines: [CartLineUpdateInput!]!) { + query: gql` + mutation UpdateItems($cartId: ID!, $lines: [CartLineUpdateInput!]!) { payload: cartLinesUpdate(cartId: $cartId, lines: $lines) { - cart { ...Cart } + cart { + ...Cart + } } - }`, + } + `, }; export const SignInWithEmailAndPassword = { - query: - gql`mutation SignInWithEmailAndPassword($email: String!, $password: String!) { - customerAccessTokenCreate(input: { email: $email, password: $password }) { - customerAccessToken { - accessToken - expiresAt - } - customerUserErrors { - code - message + query: gql` + mutation SignInWithEmailAndPassword($email: String!, $password: String!) { + customerAccessTokenCreate(input: { email: $email, password: $password }) { + customerAccessToken { + accessToken + expiresAt + } + customerUserErrors { + code + message + } } } - }`, + `, }; diff --git a/shopify/utils/storefront/storefront.graphql.gen.ts b/shopify/utils/storefront/storefront.graphql.gen.ts index b1bb5499d..919963df5 100644 --- a/shopify/utils/storefront/storefront.graphql.gen.ts +++ b/shopify/utils/storefront/storefront.graphql.gen.ts @@ -7706,13 +7706,17 @@ export type CartFragment = { id: string, checkoutUrl: any, totalQuantity: number export type CustomerFragment = { id: string, email?: string | null, firstName?: string | null, lastName?: string | null }; -export type CreateCartMutationVariables = Exact<{ [key: string]: never; }>; +export type CreateCartMutationVariables = Exact<{ + countryCode?: InputMaybe; +}>; export type CreateCartMutation = { payload?: { cart?: { id: string } | null } | null }; export type GetCartQueryVariables = Exact<{ id: Scalars['ID']['input']; + languageCode?: InputMaybe; + countryCode?: InputMaybe; }>; @@ -7721,6 +7725,8 @@ export type GetCartQuery = { cart?: { id: string, checkoutUrl: any, totalQuantit export type GetProductQueryVariables = Exact<{ handle?: InputMaybe; identifiers: Array | HasMetafieldsIdentifier; + languageCode?: InputMaybe; + countryCode?: InputMaybe; }>; @@ -7731,6 +7737,8 @@ export type ListProductsQueryVariables = Exact<{ after?: InputMaybe; query?: InputMaybe; identifiers: Array | HasMetafieldsIdentifier; + languageCode?: InputMaybe; + countryCode?: InputMaybe; }>; @@ -7746,6 +7754,8 @@ export type SearchWithFiltersQueryVariables = Exact<{ sortKey?: InputMaybe; reverse?: InputMaybe; identifiers: Array | HasMetafieldsIdentifier; + languageCode?: InputMaybe; + countryCode?: InputMaybe; }>; @@ -7761,6 +7771,8 @@ export type AllProductsQueryVariables = Exact<{ reverse?: InputMaybe; filters?: InputMaybe | ProductFilter>; identifiers: Array | HasMetafieldsIdentifier; + languageCode?: InputMaybe; + countryCode?: InputMaybe; }>; @@ -7769,6 +7781,8 @@ export type AllProductsQuery = { collection?: { handle: string, description: str export type ProductRecommendationsQueryVariables = Exact<{ productId: Scalars['ID']['input']; identifiers: Array | HasMetafieldsIdentifier; + languageCode?: InputMaybe; + countryCode?: InputMaybe; }>; @@ -7776,6 +7790,8 @@ export type ProductRecommendationsQuery = { productRecommendations?: Array<{ ava export type GetShopInfoQueryVariables = Exact<{ identifiers: Array | HasMetafieldsIdentifier; + languageCode?: InputMaybe; + countryCode?: InputMaybe; }>; diff --git a/shopify/utils/types.ts b/shopify/utils/types.ts index cf02cad48..c7e9f7b9e 100644 --- a/shopify/utils/types.ts +++ b/shopify/utils/types.ts @@ -1,10 +1,10 @@ import { - CountryCode, CurrencyCode, OrderCancelReason, OrderFinancialStatus, OrderFulfillmentStatus, } from "./enums.ts"; +import { LanguageCode, CountryCode } from "./storefront/storefront.graphql.gen.ts"; type Attribute = { key: string; @@ -189,3 +189,8 @@ export interface Metafield { namespace: string; key: string; } + +export interface LanguageContextArgs { + languageCode: LanguageCode; + countryCode: CountryCode; +}