@shopify/hydrogen 2026.4.5 → 2026.4.7

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.
@@ -32,6 +32,31 @@ type VisitorConsent = {
32
32
  preferences: ConsentStatus;
33
33
  sale_of_data: ConsentStatus;
34
34
  };
35
+ /** Consent choices returned by the Customer Privacy API. */
36
+ type VisitorConsentValues = Record<keyof VisitorConsent, 'yes' | 'no' | ''>;
37
+ type CustomerPrivacyConfiguration = {
38
+ isHeadless?: boolean;
39
+ asyncConsent?: boolean;
40
+ asyncVisitorState?: boolean;
41
+ consentDomain?: string;
42
+ storefrontAccessToken?: string;
43
+ injectedConsent?: string;
44
+ debug?: {
45
+ hydrogen?: {
46
+ generation: number;
47
+ serverTiming: boolean;
48
+ };
49
+ [key: string]: unknown;
50
+ };
51
+ };
52
+ type VisitorConsentCollected = {
53
+ analyticsAllowed: boolean;
54
+ firstPartyMarketingAllowed: boolean;
55
+ marketingAllowed: boolean;
56
+ preferencesAllowed: boolean;
57
+ saleOfDataAllowed: boolean;
58
+ thirdPartyMarketingAllowed: boolean;
59
+ };
35
60
  type CustomerPrivacyConsentConfig = {
36
61
  checkoutRootDomain: string;
37
62
  storefrontRootDomain?: string;
@@ -40,11 +65,11 @@ type CustomerPrivacyConsentConfig = {
40
65
  /** The privacyBanner refers to `language` as `locale` */
41
66
  locale?: LanguageCode;
42
67
  };
43
- type SetConsentHeadlessParams = VisitorConsent & CustomerPrivacyConsentConfig & {
68
+ type SetConsentHeadlessParams = Partial<VisitorConsent> & CustomerPrivacyConsentConfig & {
44
69
  headlessStorefront?: boolean;
45
70
  };
46
71
  /**
47
- Ideally this type should come from the Custoemr Privacy API sdk
72
+ Ideally this type should come from the Customer Privacy API sdk
48
73
  analyticsProcessingAllowed -
49
74
  currentVisitorConsent
50
75
  doesMerchantSupportGranularConsent
@@ -61,7 +86,9 @@ type SetConsentHeadlessParams = VisitorConsent & CustomerPrivacyConsentConfig &
61
86
  thirdPartyMarketingAllowed
62
87
  **/
63
88
  type OriginalCustomerPrivacy = {
64
- currentVisitorConsent: () => VisitorConsent;
89
+ currentVisitorConsent: () => VisitorConsentValues;
90
+ consentStatus?: 'loading' | 'loaded';
91
+ config?: CustomerPrivacyConfiguration;
65
92
  preferencesProcessingAllowed: () => boolean;
66
93
  saleOfDataAllowed: () => boolean;
67
94
  marketingAllowed: () => boolean;
@@ -72,7 +99,7 @@ type OriginalCustomerPrivacy = {
72
99
  shouldShowBanner: () => boolean;
73
100
  };
74
101
  type CustomerPrivacy = Omit<OriginalCustomerPrivacy, 'setTrackingConsent'> & {
75
- setTrackingConsent: (consent: VisitorConsent, // we have already applied the headlessStorefront in the override
102
+ setTrackingConsent: (consent: Partial<VisitorConsent>, // we have already applied the headlessStorefront in the override
76
103
  callback: (data: {
77
104
  error: string;
78
105
  } | undefined) => void) => void;
@@ -81,6 +108,11 @@ type PrivacyBanner = {
81
108
  loadBanner: (options?: Partial<CustomerPrivacyConsentConfig>) => void;
82
109
  showPreferences: (options?: Partial<CustomerPrivacyConsentConfig>) => void;
83
110
  };
111
+ interface CustomEventMap {
112
+ visitorConsentCollected: CustomEvent<VisitorConsentCollected>;
113
+ consentTrackingApiLoaded: Event;
114
+ shopifyCustomerPrivacyApiLoaded: CustomEvent<null>;
115
+ }
84
116
 
85
117
  type WaitUntil = (promise: Promise<unknown>) => void;
86
118
 
@@ -88,9 +120,9 @@ declare global {
88
120
  interface Window {
89
121
  privacyBanner: PrivacyBanner;
90
122
  Shopify: {
91
- customerPrivacy?: Partial<CustomerPrivacy> & {
92
- backendConsentEnabled?: boolean;
93
- };
123
+ country?: string;
124
+ locale?: string;
125
+ customerPrivacy?: Partial<CustomerPrivacy>;
94
126
  };
95
127
  }
96
128
  interface Document {
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "@shopify:registry": "https://registry.npmjs.org"
6
6
  },
7
7
  "type": "module",
8
- "version": "2026.4.5",
8
+ "version": "2026.4.7",
9
9
  "license": "MIT",
10
10
  "main": "dist/index.cjs",
11
11
  "module": "dist/production/index.js",
@@ -80,7 +80,7 @@
80
80
  "use-resize-observer": "^9.1.0",
81
81
  "worktop": "^0.7.3",
82
82
  "@shopify/graphql-client": "1.4.1",
83
- "@shopify/hydrogen-react": "2026.4.3"
83
+ "@shopify/hydrogen-react": "2026.4.4"
84
84
  },
85
85
  "devDependencies": {
86
86
  "react-router": "7.16.0",