@shopify/hydrogen-react
Version:
React components, hooks, and utilities for creating custom Shopify storefronts
43 lines (42 loc) • 2.2 kB
TypeScript
import { type ReactNode } from 'react';
import type { LanguageCode, CountryCode, Shop } from './storefront-api-types.js';
/**
* The `<ShopifyProvider/>` component enables use of the `useShop()` hook. The component should wrap your app.
*/
export declare function ShopifyProvider({ children, shopifyConfig, }: {
children: ReactNode;
shopifyConfig: ShopifyContextValue;
}): JSX.Element;
/**
* Provides access to the `shopifyConfig` prop of `<ShopifyProvider/>`. Must be a descendent of `<ShopifyProvider/>`.
*/
export declare function useShop(): ShopifyContextValue;
/**
* Shopify-specific values that are used in various Hydrogen-UI components and hooks.
*/
export declare type ShopifyContextValue = {
/** The globally-unique identifier for the Shop */
storefrontId?: string;
/** The host name of the domain (eg: `{shop}.myshopify.com`). If a URL with a scheme (for example `https://`) is passed in, then the scheme is removed. */
storeDomain: Shop['primaryDomain']['host'];
/** The Storefront API public access token. Refer to the [authentication](https://shopify.dev/api/storefront#authentication) documentation for more details. */
storefrontToken: string;
/** The Storefront API version. This should almost always be the same as the version Hydrogen-UI was built for. Learn more about Shopify [API versioning](https://shopify.dev/api/usage/versioning) for more details. */
storefrontApiVersion: string;
country?: {
/**
* The code designating a country, which generally follows ISO 3166-1 alpha-2 guidelines. If a territory doesn't have a country code value in the `CountryCode` enum, it might be considered a subdivision of another country. For example, the territories associated with Spain are represented by the country code `ES`, and the territories associated with the United States of America are represented by the country code `US`.
*/
isoCode: CountryCode;
};
language?: {
/**
* `ISO 369` language codes supported by Shopify.
*/
isoCode: LanguageCode;
};
/**
* The locale string based on `country` and `language`.
*/
locale?: string;
};