@shopify/hydrogen 1.6.8 → 1.7.0
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.
- package/dist/esnext/components/CartProvider/CartProvider.client.js +4 -2
- package/dist/esnext/entry-server.js +1 -1
- package/dist/esnext/foundation/Cache/cache.js +4 -3
- package/dist/esnext/utilities/hash.js +1 -1
- package/dist/esnext/version.d.ts +1 -1
- package/dist/esnext/version.js +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useRef, useState, useTransition, } from 'react';
|
|
2
|
-
import { CountryCode, } from '../../storefront-api-types.js';
|
|
3
2
|
import { defaultCartFragment } from './cart-queries.js';
|
|
4
3
|
import { CartContext } from './context.js';
|
|
5
4
|
import { useCartAPIStateMachine } from './useCartAPIStateMachine.client.js';
|
|
6
5
|
import { CART_ID_STORAGE_KEY } from './constants.js';
|
|
7
6
|
import { ClientAnalytics } from '../../foundation/Analytics/ClientAnalytics.js';
|
|
8
|
-
|
|
7
|
+
import { useLocalization } from '../../hooks/useLocalization/useLocalization.js';
|
|
8
|
+
export function CartProvider({ children, numCartLines, onCreate, onLineAdd, onLineRemove, onLineUpdate, onNoteUpdate, onBuyerIdentityUpdate, onAttributesUpdate, onDiscountCodesUpdate, onCreateComplete, onLineAddComplete, onLineRemoveComplete, onLineUpdateComplete, onNoteUpdateComplete, onBuyerIdentityUpdateComplete, onAttributesUpdateComplete, onDiscountCodesUpdateComplete, data: cart, cartFragment = defaultCartFragment, customerAccessToken, countryCode, }) {
|
|
9
|
+
const { country } = useLocalization();
|
|
10
|
+
countryCode = (countryCode ?? country.isoCode).toUpperCase();
|
|
9
11
|
if (countryCode)
|
|
10
12
|
countryCode = countryCode.toUpperCase();
|
|
11
13
|
const [prevCountryCode, setPrevCountryCode] = useState(countryCode);
|
|
@@ -71,7 +71,7 @@ export const renderHydrogen = (App) => {
|
|
|
71
71
|
}
|
|
72
72
|
if (hydrogenConfig.poweredByHeader ?? true) {
|
|
73
73
|
// If undefined in the config, then always show the header
|
|
74
|
-
response.headers.set('powered-by', 'Shopify
|
|
74
|
+
response.headers.set('powered-by', 'Shopify, Hydrogen');
|
|
75
75
|
}
|
|
76
76
|
sessionApi ??= hydrogenConfig.session?.(log);
|
|
77
77
|
request.ctx.session = getSyncSessionApi(request, response, log, sessionApi);
|
|
@@ -81,13 +81,14 @@ export async function setItemInCache(request, response, userCacheOptions) {
|
|
|
81
81
|
*/
|
|
82
82
|
const cacheControl = getCacheControlSetting(userCacheOptions);
|
|
83
83
|
// The padded cache-control to mimic stale-while-revalidate
|
|
84
|
-
|
|
84
|
+
const paddedCacheControlString = generateDefaultCacheControlHeader(getCacheControlSetting(cacheControl, {
|
|
85
85
|
maxAge: (cacheControl.maxAge || 0) + (cacheControl.staleWhileRevalidate || 0),
|
|
86
|
-
}))
|
|
86
|
+
}));
|
|
87
87
|
// The cache-control we want to set on response
|
|
88
|
-
const cacheControlString = generateDefaultCacheControlHeader(
|
|
88
|
+
const cacheControlString = generateDefaultCacheControlHeader(cacheControl);
|
|
89
89
|
// CF will override cache-control, so we need to keep a
|
|
90
90
|
// non-modified real-cache-control
|
|
91
|
+
response.headers.set('cache-control', paddedCacheControlString);
|
|
91
92
|
response.headers.set('real-cache-control', cacheControlString);
|
|
92
93
|
response.headers.set('cache-put-date', new Date().toUTCString());
|
|
93
94
|
logCacheApiStatus('PUT', request.url);
|
package/dist/esnext/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "1.
|
|
1
|
+
export declare const LIB_VERSION = "1.7.0";
|
package/dist/esnext/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = '1.
|
|
1
|
+
export const LIB_VERSION = '1.7.0';
|