Skip to content

Commit

Permalink
Updating to 2025-01 SFAPI (#2715)
Browse files Browse the repository at this point in the history
Co-authored-by: Helen Lin <[email protected]>
  • Loading branch information
rbshop and wizardlyhel authored Jan 23, 2025
1 parent b45de26 commit 064de13
Show file tree
Hide file tree
Showing 74 changed files with 859 additions and 291 deletions.
9 changes: 9 additions & 0 deletions .changeset/thick-lamps-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@shopify/hydrogen-react': patch
'skeleton': patch
'@shopify/hydrogen': patch
'@shopify/cli-hydrogen': patch
'@shopify/create-hydrogen': patch
---

Bump SFAPI to 2025-01
2 changes: 1 addition & 1 deletion examples/express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@remix-run/node": "^2.15.2",
"@remix-run/react": "^2.15.2",
"@remix-run/server-runtime": "^2.15.2",
"@shopify/hydrogen": "2024.10.1",
"@shopify/hydrogen": "2025.1.0",
"compression": "^1.7.4",
"cross-env": "^7.0.3",
"express": "^4.19.2",
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/cli/src/lib/route-validator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('reserved-routes', () => {

it('returns an array of reserved routes', async () => {
expect(
findReservedRoutes(createRoute('api/2024-10/graphql.json')),
findReservedRoutes(createRoute('api/2025-01/graphql.json')),
).toHaveLength(1);

expect(
Expand Down
4 changes: 2 additions & 2 deletions packages/hydrogen-react/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
customerAccountApiCustomScalars,
} from './src/codegen.helpers';

const SF_API_VERSION = '2024-10';
const CA_API_VERSION = '2024-10';
const SF_API_VERSION = '2025-01';
const CA_API_VERSION = '2025-01';

const storefrontAPISchema: CodegenConfig['schema'] = {
[`https://hydrogen-preview.myshopify.com/api/${SF_API_VERSION}/graphql.json`]:
Expand Down
2 changes: 1 addition & 1 deletion packages/hydrogen-react/customer-account.schema.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const data: LandingTemplateSchema = {
anchorLink: 'authentication',
title: 'Authentication',
sectionContent:
'To use Hydrogen React, you need to authenticate with and make requests to the [Storefront API](/docs/api/storefront). Hydrogen React includes an [API client](/docs/api/hydrogen-react/2024-10/utilities/createstorefrontclient) to securely handle API queries and mutations.\n\nYou can create and manage Storefront API access tokens by installing the [Headless sales channel](https://apps.shopify.com/headless) on your store.\n\nApps have access to [two kinds of tokens](/docs/api/usage/authentication#access-tokens-for-the-storefront-api): a public API token, which can be used in client-side code, and a private API token, which should only be used in server-side contexts and never exposed publicly.',
'To use Hydrogen React, you need to authenticate with and make requests to the [Storefront API](/docs/api/storefront). Hydrogen React includes an [API client](/docs/api/hydrogen-react/2025-01/utilities/createstorefrontclient) to securely handle API queries and mutations.\n\nYou can create and manage Storefront API access tokens by installing the [Headless sales channel](https://apps.shopify.com/headless) on your store.\n\nApps have access to [two kinds of tokens](/docs/api/usage/authentication#access-tokens-for-the-storefront-api): a public API token, which can be used in client-side code, and a private API token, which should only be used in server-side contexts and never exposed publicly.',
sectionCard: [
{
subtitle: 'Install',
Expand Down
2 changes: 1 addition & 1 deletion packages/hydrogen-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shopify/hydrogen-react",
"version": "2024.10.1",
"version": "2025.1.0",
"description": "React components, hooks, and utilities for creating custom Shopify storefronts",
"homepage": "https://github.com/Shopify/hydrogen/tree/main/packages/hydrogen-react",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/hydrogen-react/src/CartLineProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type CartLinePartialDeep = PartialDeep<
export const CartLineContext = createContext<CartLinePartialDeep | null>(null);

/**
* The `useCartLine` hook provides access to the [CartLine object](https://shopify.dev/api/storefront/2024-10/objects/cartline) from the Storefront API. It must be a descendent of a `CartProvider` component.
* The `useCartLine` hook provides access to the [CartLine object](https://shopify.dev/api/storefront/2025-01/objects/cartline) from the Storefront API. It must be a descendent of a `CartProvider` component.
*/
export function useCartLine(): CartLinePartialDeep {
const context = useContext(CartLineContext);
Expand Down
4 changes: 2 additions & 2 deletions packages/hydrogen-react/src/CartProvider.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ function CartComponent() {
const config: ShopifyProviderProps = {
storeDomain: 'hydrogen-preview.myshopify.com',
storefrontToken: '3b580e70970c4528da70c98e097c2fa0',
storefrontApiVersion: '2024-10',
storefrontApiVersion: '2025-01',
countryIsoCode: 'CA',
languageIsoCode: 'EN',
};
Expand All @@ -249,7 +249,7 @@ Default.args = {
numCartLines: 30,
/** A callback that is invoked when the process to create a cart begins, but before the cart is created in the Storefront API. */
data: undefined,
/** A fragment used to query the Storefront API's [Cart object](https://shopify.dev/api/storefront/2024-10/objects/cart) for all queries and mutations. A default value is used if no argument is provided. */
/** A fragment used to query the Storefront API's [Cart object](https://shopify.dev/api/storefront/2025-01/objects/cart) for all queries and mutations. A default value is used if no argument is provided. */
cartFragment: undefined,
/** A customer access token that's accessible on the server if there's a customer login. */
customerAccessToken: undefined,
Expand Down
4 changes: 2 additions & 2 deletions packages/hydrogen-react/src/CartProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ type CartProviderProps = {
onAttributesUpdateComplete?: () => void;
/** A callback that is invoked when the process to update the cart discount codes completes */
onDiscountCodesUpdateComplete?: () => void;
/** An object with fields that correspond to the Storefront API's [Cart object](https://shopify.dev/api/storefront/2024-10/objects/cart). */
/** An object with fields that correspond to the Storefront API's [Cart object](https://shopify.dev/api/storefront/2025-01/objects/cart). */
data?: PartialDeep<CartType, {recurseIntoArrays: true}>;
/** A fragment used to query the Storefront API's [Cart object](https://shopify.dev/api/storefront/2024-10/objects/cart) for all queries and mutations. A default value is used if no argument is provided. */
/** A fragment used to query the Storefront API's [Cart object](https://shopify.dev/api/storefront/2025-01/objects/cart) for all queries and mutations. A default value is used if no argument is provided. */
cartFragment?: string;
/** A customer access token that's accessible on the server if there's a customer login. */
customerAccessToken?: CartBuyerIdentityInput['customerAccessToken'];
Expand Down
2 changes: 1 addition & 1 deletion packages/hydrogen-react/src/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ type HydrogenImageBaseProps = {
* @defaultValue `center`
*/
crop?: Crop;
/** Data mapping to the [Storefront API `Image`](https://shopify.dev/docs/api/storefront/2024-10/objects/Image) object. Must be an Image object.
/** Data mapping to the [Storefront API `Image`](https://shopify.dev/docs/api/storefront/2025-01/objects/Image) object. Must be an Image object.
*
* @example
* ```
Expand Down
2 changes: 1 addition & 1 deletion packages/hydrogen-react/src/ModelViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type ModelViewerProps = Omit<
ModelViewerBaseProps;

type ModelViewerBaseProps = {
/** An object with fields that correspond to the Storefront API's [Model3D object](https://shopify.dev/api/storefront/2024-10/objects/model3d). */
/** An object with fields that correspond to the Storefront API's [Model3D object](https://shopify.dev/api/storefront/2025-01/objects/model3d). */
data: PartialDeep<Model3d, {recurseIntoArrays: true}>;
/** The callback to invoke when the 'error' event is triggered. Refer to [error in the <model-viewer> documentation](https://modelviewer.dev/docs/index.html#entrydocs-loading-events-error). */
onError?: (event: Event) => void;
Expand Down
2 changes: 1 addition & 1 deletion packages/hydrogen-react/src/Money.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface MoneyPropsBase<ComponentGeneric extends React.ElementType> {
withoutCurrency?: boolean;
/** Whether to remove trailing zeros (fractional money) from the output. */
withoutTrailingZeros?: boolean;
/** A [UnitPriceMeasurement object](https://shopify.dev/api/storefront/2024-10/objects/unitpricemeasurement). */
/** A [UnitPriceMeasurement object](https://shopify.dev/api/storefront/2025-01/objects/unitpricemeasurement). */
measurement?: PartialDeep<UnitPriceMeasurement, {recurseIntoArrays: true}>;
/** Customizes the separator between the money output and the measurement output. Used with the `measurement` prop. Defaults to `'/'`. */
measurementSeparator?: ReactNode;
Expand Down
2 changes: 1 addition & 1 deletion packages/hydrogen-react/src/ShopPayButton2.example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default function App() {
<ShopifyProvider
storeDomain="my-store"
storefrontToken="abc123"
storefrontApiVersion="2024-10"
storefrontApiVersion="2025-01"
countryIsoCode="CA"
languageIsoCode="EN"
>
Expand Down
2 changes: 1 addition & 1 deletion packages/hydrogen-react/src/ShopPayButton2.example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default function App() {
<ShopifyProvider
storeDomain="my-store"
storefrontToken="abc123"
storefrontApiVersion="2024-10"
storefrontApiVersion="2025-01"
countryIsoCode="CA"
languageIsoCode="EN"
>
Expand Down
2 changes: 1 addition & 1 deletion packages/hydrogen-react/src/ShopifyProvider.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ export const Default = Template.bind({});
Default.args = {
storeDomain: 'notashop.myshopify.com',
storefrontToken: 'abc123',
version: '2024-10',
version: '2025-01',
};
16 changes: 8 additions & 8 deletions packages/hydrogen-react/src/ShopifyProvider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {PartialDeep} from 'type-fest';
const SHOPIFY_CONFIG: ShopifyProviderProps = {
storeDomain: 'https://notashop.myshopify.com',
storefrontToken: 'abc123',
storefrontApiVersion: '2024-10',
storefrontApiVersion: '2025-01',
countryIsoCode: 'CA',
languageIsoCode: 'EN',
};
Expand Down Expand Up @@ -41,7 +41,7 @@ describe('<ShopifyProvider/>', () => {
});

expect(result.current.getStorefrontApiUrl()).toBe(
'https://notashop.myshopify.com/api/2024-10/graphql.json',
'https://notashop.myshopify.com/api/2025-01/graphql.json',
);
});

Expand Down Expand Up @@ -84,7 +84,7 @@ describe('<ShopifyProvider/>', () => {
).toEqual({
'X-SDK-Variant': 'hydrogen-react',
'X-SDK-Variant-Source': 'react',
'X-SDK-Version': '2024-10',
'X-SDK-Version': '2025-01',
'X-Shopify-Storefront-Access-Token': 'abc123',
'content-type': 'application/json',
});
Expand All @@ -110,7 +110,7 @@ describe('<ShopifyProvider/>', () => {
).toEqual({
'X-SDK-Variant': 'hydrogen-react',
'X-SDK-Variant-Source': 'react',
'X-SDK-Version': '2024-10',
'X-SDK-Version': '2025-01',
'X-Shopify-Storefront-Access-Token': 'newtoken',
'content-type': 'application/graphql',
});
Expand Down Expand Up @@ -183,7 +183,7 @@ describe('<ShopifyProvider/>', () => {
});

expect(result.current.getStorefrontApiUrl()).toBe(
'https://notashop.myshopify.com/api/2024-10/graphql.json',
'https://notashop.myshopify.com/api/2025-01/graphql.json',
);
});

Expand All @@ -203,7 +203,7 @@ describe('<ShopifyProvider/>', () => {
result.current.getStorefrontApiUrl({
storeDomain: 'https://test.myshopify.com',
}),
).toBe('https://test.myshopify.com/api/2024-10/graphql.json');
).toBe('https://test.myshopify.com/api/2025-01/graphql.json');
});

it(`handles when a '/' is at the end of the url and doesn't add an extra one`, () => {
Expand All @@ -219,7 +219,7 @@ describe('<ShopifyProvider/>', () => {
});

expect(result.current.getStorefrontApiUrl()).toBe(
'https://notashop.myshopify.com/api/2024-10/graphql.json',
'https://notashop.myshopify.com/api/2025-01/graphql.json',
);
});
});
Expand All @@ -233,6 +233,6 @@ export function getShopifyConfig(
languageIsoCode: config.languageIsoCode ?? 'EN',
storeDomain: config.storeDomain ?? 'https://notashop.myshopify.io',
storefrontToken: config.storefrontToken ?? 'abc123',
storefrontApiVersion: config.storefrontApiVersion ?? '2024-10',
storefrontApiVersion: config.storefrontApiVersion ?? '2025-01',
};
}
2 changes: 1 addition & 1 deletion packages/hydrogen-react/src/Video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {Video as VideoType} from './storefront-api-types.js';
import type {PartialDeep} from 'type-fest';

export interface VideoProps {
/** An object with fields that correspond to the Storefront API's [Video object](https://shopify.dev/api/storefront/2024-10/objects/video). */
/** An object with fields that correspond to the Storefront API's [Video object](https://shopify.dev/api/storefront/2025-01/objects/video). */
data: PartialDeep<VideoType, {recurseIntoArrays: true}>;
/** An object of image size options for the video's `previewImage`. Uses `shopifyImageLoader` to generate the `poster` URL. */
previewImageOptions?: Parameters<typeof shopifyLoader>[0];
Expand Down
4 changes: 2 additions & 2 deletions packages/hydrogen-react/src/codegen.helpers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Meant to be used with GraphQL CodeGen to type the Storefront API's custom scalars correctly.
* Reference for the GraphQL types: https://shopify.dev/docs/api/storefront/2024-10/scalars/HTML
* Reference for the GraphQL types: https://shopify.dev/docs/api/storefront/2025-01/scalars/HTML
* Note: JSON is generated as 'unknown' by default.
*/
export const storefrontApiCustomScalars = {
Expand All @@ -15,7 +15,7 @@ export const storefrontApiCustomScalars = {

/**
* Meant to be used with GraphQL CodeGen to type the Storefront API's custom scalars correctly.
* Reference for the GraphQL types: https://shopify.dev/docs/api/customer/2024-10/scalars/HTML
* Reference for the GraphQL types: https://shopify.dev/docs/api/customer/2025-01/scalars/HTML
* Note: JSON is generated as 'unknown' by default.
*/
export const customerAccountApiCustomScalars = {
Expand Down
Loading

0 comments on commit 064de13

Please sign in to comment.