@shopify/hydrogen 2026.1.1 → 2026.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -434,7 +434,7 @@ function getPrivacyBanner() {
434
434
  }
435
435
 
436
436
  // package.json
437
- var version = "2026.1.1";
437
+ var version = "2026.1.3";
438
438
 
439
439
  // src/analytics-manager/ShopifyAnalytics.tsx
440
440
  function getCustomerPrivacyRequired() {
@@ -1829,7 +1829,7 @@ function generateUUID() {
1829
1829
  }
1830
1830
 
1831
1831
  // src/version.ts
1832
- var LIB_VERSION = "2026.1.1";
1832
+ var LIB_VERSION = "2026.1.3";
1833
1833
 
1834
1834
  // src/utils/graphql.ts
1835
1835
  function minifyQuery(string) {
@@ -3746,9 +3746,30 @@ function createCustomerAccountHelper(customerApiVersion, shopId) {
3746
3746
  }
3747
3747
 
3748
3748
  // src/customer/customer.ts
3749
+ var HYDROGEN_TUNNEL_DOMAIN_SUFFIX = ".tryhydrogen.dev";
3750
+ function throwIfNotTunnelled(hostname) {
3751
+ {
3752
+ if (!hostname.endsWith(HYDROGEN_TUNNEL_DOMAIN_SUFFIX)) {
3753
+ throw new Response(
3754
+ [
3755
+ "Customer Account API OAuth requires a Hydrogen tunnel in local development.",
3756
+ "Run the development server with the `--customer-account-push` flag,",
3757
+ `then open the tunnel URL shown in your terminal (\`https://*${HYDROGEN_TUNNEL_DOMAIN_SUFFIX}\`) instead of localhost.`
3758
+ ].join("\n\n"),
3759
+ {
3760
+ status: 400,
3761
+ headers: {
3762
+ "Content-Type": "text/plain; charset=utf-8"
3763
+ }
3764
+ }
3765
+ );
3766
+ }
3767
+ }
3768
+ }
3749
3769
  function defaultAuthStatusHandler(request, defaultLoginUrl) {
3750
3770
  if (!request.url) return defaultLoginUrl;
3751
- const { pathname } = new URL(request.url);
3771
+ const { hostname, pathname } = new URL(request.url);
3772
+ throwIfNotTunnelled(hostname);
3752
3773
  const cleanedPathname = pathname.replace(/\.data$/, "").replace(/\/_root$/, "/").replace(/(.+)\/$/, "$1");
3753
3774
  const redirectTo = defaultLoginUrl + `?${new URLSearchParams({ return_to: cleanedPathname }).toString()}`;
3754
3775
  return redirect(redirectTo);
@@ -3912,6 +3933,7 @@ function createCustomerAccountClient({
3912
3933
  return session.get(CUSTOMER_ACCOUNT_SESSION_KEY)?.accessToken;
3913
3934
  }
3914
3935
  async function mutate(mutation, options) {
3936
+ throwIfNotTunnelled(requestUrl.hostname);
3915
3937
  ifInvalidCredentialThrowError();
3916
3938
  mutation = minifyQuery(mutation);
3917
3939
  assertMutation(mutation, "customer.mutate");
@@ -3921,6 +3943,7 @@ function createCustomerAccountClient({
3921
3943
  );
3922
3944
  }
3923
3945
  async function query(query2, options) {
3946
+ throwIfNotTunnelled(requestUrl.hostname);
3924
3947
  ifInvalidCredentialThrowError();
3925
3948
  query2 = minifyQuery(query2);
3926
3949
  assertQuery(query2, "customer.query");
@@ -3944,6 +3967,7 @@ function createCustomerAccountClient({
3944
3967
  return {
3945
3968
  i18n: { language: language ?? "EN" },
3946
3969
  login: async (options) => {
3970
+ throwIfNotTunnelled(requestUrl.hostname);
3947
3971
  ifInvalidCredentialThrowError();
3948
3972
  const loginUrl = new URL(getCustomerAccountUrl("AUTH" /* AUTH */));
3949
3973
  const state = generateState();
@@ -3995,6 +4019,7 @@ function createCustomerAccountClient({
3995
4019
  return redirect(loginUrl.toString());
3996
4020
  },
3997
4021
  logout: async (options) => {
4022
+ throwIfNotTunnelled(requestUrl.hostname);
3998
4023
  ifInvalidCredentialThrowError();
3999
4024
  const idToken = session.get(CUSTOMER_ACCOUNT_SESSION_KEY)?.idToken;
4000
4025
  const postLogoutRedirectUri = ensureLocalRedirectUrl({
@@ -4029,6 +4054,7 @@ function createCustomerAccountClient({
4029
4054
  mutate,
4030
4055
  query,
4031
4056
  authorize: async () => {
4057
+ throwIfNotTunnelled(requestUrl.hostname);
4032
4058
  ifInvalidCredentialThrowError();
4033
4059
  const code = requestUrl.searchParams.get("code");
4034
4060
  const state = requestUrl.searchParams.get("state");
@@ -4158,7 +4184,7 @@ function createIfInvalidCredentialThrowError(getCustomerAccountUrl, customerAcco
4158
4184
  "[h2:error:customerAccount] You do not have the valid credential to use Customer Account API.\nRun `h2 env pull` to link your store credentials."
4159
4185
  )
4160
4186
  );
4161
- const publicMessage = "You do not have the valid credential to use Customer Account API (/account).";
4187
+ const publicMessage = "You do not have valid credentials to use Customer Account API (/account).";
4162
4188
  throw new Response(publicMessage, { status: 500 });
4163
4189
  }
4164
4190
  };