@shopify/hydrogen 2026.1.0 → 2026.1.2

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.
@@ -610,7 +610,7 @@ function getPrivacyBanner() {
610
610
  }
611
611
 
612
612
  // package.json
613
- var version = "2026.1.0";
613
+ var version = "2026.1.2";
614
614
 
615
615
  // src/analytics-manager/ShopifyAnalytics.tsx
616
616
  function getCustomerPrivacyRequired() {
@@ -2005,7 +2005,7 @@ function generateUUID() {
2005
2005
  }
2006
2006
 
2007
2007
  // src/version.ts
2008
- var LIB_VERSION = "2026.1.0";
2008
+ var LIB_VERSION = "2026.1.2";
2009
2009
 
2010
2010
  // src/utils/graphql.ts
2011
2011
  function minifyQuery(string) {
@@ -3922,9 +3922,30 @@ function createCustomerAccountHelper(customerApiVersion, shopId) {
3922
3922
  }
3923
3923
 
3924
3924
  // src/customer/customer.ts
3925
+ var HYDROGEN_TUNNEL_DOMAIN_SUFFIX = ".tryhydrogen.dev";
3926
+ function throwIfNotTunnelled(hostname) {
3927
+ {
3928
+ if (!hostname.endsWith(HYDROGEN_TUNNEL_DOMAIN_SUFFIX)) {
3929
+ throw new Response(
3930
+ [
3931
+ "Customer Account API OAuth requires a Hydrogen tunnel in local development.",
3932
+ "Run the development server with the `--customer-account-push` flag,",
3933
+ `then open the tunnel URL shown in your terminal (\`https://*${HYDROGEN_TUNNEL_DOMAIN_SUFFIX}\`) instead of localhost.`
3934
+ ].join("\n\n"),
3935
+ {
3936
+ status: 400,
3937
+ headers: {
3938
+ "Content-Type": "text/plain; charset=utf-8"
3939
+ }
3940
+ }
3941
+ );
3942
+ }
3943
+ }
3944
+ }
3925
3945
  function defaultAuthStatusHandler(request, defaultLoginUrl) {
3926
3946
  if (!request.url) return defaultLoginUrl;
3927
- const { pathname } = new URL(request.url);
3947
+ const { hostname, pathname } = new URL(request.url);
3948
+ throwIfNotTunnelled(hostname);
3928
3949
  const cleanedPathname = pathname.replace(/\.data$/, "").replace(/\/_root$/, "/").replace(/(.+)\/$/, "$1");
3929
3950
  const redirectTo = defaultLoginUrl + `?${new URLSearchParams({ return_to: cleanedPathname }).toString()}`;
3930
3951
  return redirect(redirectTo);
@@ -4088,6 +4109,7 @@ function createCustomerAccountClient({
4088
4109
  return session.get(CUSTOMER_ACCOUNT_SESSION_KEY)?.accessToken;
4089
4110
  }
4090
4111
  async function mutate(mutation, options) {
4112
+ throwIfNotTunnelled(requestUrl.hostname);
4091
4113
  ifInvalidCredentialThrowError();
4092
4114
  mutation = minifyQuery(mutation);
4093
4115
  assertMutation(mutation, "customer.mutate");
@@ -4097,6 +4119,7 @@ function createCustomerAccountClient({
4097
4119
  );
4098
4120
  }
4099
4121
  async function query(query2, options) {
4122
+ throwIfNotTunnelled(requestUrl.hostname);
4100
4123
  ifInvalidCredentialThrowError();
4101
4124
  query2 = minifyQuery(query2);
4102
4125
  assertQuery(query2, "customer.query");
@@ -4120,6 +4143,7 @@ function createCustomerAccountClient({
4120
4143
  return {
4121
4144
  i18n: { language: language ?? "EN" },
4122
4145
  login: async (options) => {
4146
+ throwIfNotTunnelled(requestUrl.hostname);
4123
4147
  ifInvalidCredentialThrowError();
4124
4148
  const loginUrl = new URL(getCustomerAccountUrl("AUTH" /* AUTH */));
4125
4149
  const state = generateState();
@@ -4171,6 +4195,7 @@ function createCustomerAccountClient({
4171
4195
  return redirect(loginUrl.toString());
4172
4196
  },
4173
4197
  logout: async (options) => {
4198
+ throwIfNotTunnelled(requestUrl.hostname);
4174
4199
  ifInvalidCredentialThrowError();
4175
4200
  const idToken = session.get(CUSTOMER_ACCOUNT_SESSION_KEY)?.idToken;
4176
4201
  const postLogoutRedirectUri = ensureLocalRedirectUrl({
@@ -4205,6 +4230,7 @@ function createCustomerAccountClient({
4205
4230
  mutate,
4206
4231
  query,
4207
4232
  authorize: async () => {
4233
+ throwIfNotTunnelled(requestUrl.hostname);
4208
4234
  ifInvalidCredentialThrowError();
4209
4235
  const code = requestUrl.searchParams.get("code");
4210
4236
  const state = requestUrl.searchParams.get("state");
@@ -4334,7 +4360,7 @@ function createIfInvalidCredentialThrowError(getCustomerAccountUrl, customerAcco
4334
4360
  "[h2:error:customerAccount] You do not have the valid credential to use Customer Account API.\nRun `h2 env pull` to link your store credentials."
4335
4361
  )
4336
4362
  );
4337
- const publicMessage = "You do not have the valid credential to use Customer Account API (/account).";
4363
+ const publicMessage = "You do not have valid credentials to use Customer Account API (/account).";
4338
4364
  throw new Response(publicMessage, { status: 500 });
4339
4365
  }
4340
4366
  };