@shopify/hydrogen 0.26.1 → 0.27.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.
- package/CHANGELOG.md +51 -5
- package/dist/esnext/components/LocalizationProvider/LocalizationProvider.server.js +1 -3
- package/dist/esnext/components/Money/Money.client.d.ts +1 -1
- package/dist/esnext/components/Money/Money.client.js +1 -1
- package/dist/esnext/foundation/Analytics/ServerAnalyticsRoute.js +31 -16
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.js +20 -3
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/ServerAnalyticsConnector.d.ts +1 -1
- package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/ServerAnalyticsConnector.js +3 -23
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ServerAnalyticsConnector.d.ts +1 -1
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ServerAnalyticsConnector.js +3 -17
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.client.js +4 -12
- package/dist/esnext/foundation/Analytics/connectors/Shopify/ShopifyAnalytics.server.js +20 -0
- package/dist/esnext/foundation/DevTools/DevTools.server.js +2 -2
- package/dist/esnext/foundation/ShopifyProvider/ShopifyProvider.server.js +5 -5
- package/dist/esnext/foundation/ShopifyProvider/types.d.ts +3 -3
- package/dist/esnext/foundation/constants.d.ts +2 -1
- package/dist/esnext/foundation/constants.js +2 -1
- package/dist/esnext/hooks/useMoney/hooks.d.ts +1 -1
- package/dist/esnext/shared-types.d.ts +2 -1
- package/dist/esnext/types.d.ts +1 -1
- package/dist/esnext/version.d.ts +1 -1
- package/dist/esnext/version.js +1 -1
- package/dist/node/shared-types.d.ts +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.27.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f1af7c3a`](https://github.com/Shopify/hydrogen/commit/f1af7c3a70e957a924c886b72450f5f5482bc19e) Thanks [@jplhomer](https://github.com/jplhomer)! - This is another patch test. Please ignore this version.
|
|
8
|
+
|
|
9
|
+
## 0.27.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#1728](https://github.com/Shopify/hydrogen/pull/1728) [`e8d4980a`](https://github.com/Shopify/hydrogen/commit/e8d4980a691c68e71c56762596a59415f59600c6) Thanks [@jplhomer](https://github.com/jplhomer)! - This is an example of backporting a fix. You can ignore this version.
|
|
14
|
+
|
|
15
|
+
## 0.27.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#1697](https://github.com/Shopify/hydrogen/pull/1697) [`85aab092`](https://github.com/Shopify/hydrogen/commit/85aab092b2f47d77bb917659918a011783cd8c34) Thanks [@blittle](https://github.com/blittle)! - Remove `defaultLocale` from the Hydrogen Config and instead add `defaultCountryCode` and `defaultLanguageCode`. Both of which are also now available by the `useShop()` hook:
|
|
20
|
+
|
|
21
|
+
```diff
|
|
22
|
+
export default defineConfig({
|
|
23
|
+
shopify: {
|
|
24
|
+
- defaultLocale: 'EN-US',
|
|
25
|
+
+ defaultCountryCode: 'US',
|
|
26
|
+
+ defaultLanguageCode: 'EN',
|
|
27
|
+
storeDomain: 'hydrogen-preview.myshopify.com',
|
|
28
|
+
storefrontToken: '3b580e70970c4528da70c98e097c2fa0',
|
|
29
|
+
storefrontApiVersion: '2022-07',
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
* [#1662](https://github.com/Shopify/hydrogen/pull/1662) [`4262b319`](https://github.com/Shopify/hydrogen/commit/4262b3196afb96415d3b0f8f874f351030e6a734) Thanks [@wizardlyhel](https://github.com/wizardlyhel)! - Fix server analytics route
|
|
35
|
+
|
|
36
|
+
- Fix ServerAnalyticsRoute so that it does complete all async work
|
|
37
|
+
- Move Performance and Shopify analytic reporting to client side
|
|
38
|
+
- Make sure `ShopifyAnalytics` make its own query for shop id and currency
|
|
39
|
+
- Remove query for shop id and currency from `DefaultSeo` component
|
|
40
|
+
- Make Performance and Shopify server analytics connector do nothing
|
|
41
|
+
|
|
42
|
+
### Deprecated components
|
|
43
|
+
|
|
44
|
+
Remove the following components from `hydrogen.config.js`
|
|
45
|
+
|
|
46
|
+
- `PerformanceMetricsServerAnalyticsConnector`
|
|
47
|
+
- `ShopifyServerAnalyticsConnector`
|
|
48
|
+
|
|
3
49
|
## 0.26.1
|
|
4
50
|
|
|
5
51
|
### Patch Changes
|
|
@@ -1541,11 +1587,11 @@
|
|
|
1541
1587
|
|
|
1542
1588
|
`queryShop` accepts a single argument object with the following properties:
|
|
1543
1589
|
|
|
1544
|
-
| Property | Type
|
|
1545
|
-
| ----------- |
|
|
1546
|
-
| `query` | `string \| ASTNode`
|
|
1547
|
-
| `variables` | `Record<string, any>`
|
|
1548
|
-
| `locale` | `string
|
|
1590
|
+
| Property | Type | Required |
|
|
1591
|
+
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
|
|
1592
|
+
| `query` | `string \| ASTNode` | Yes |
|
|
1593
|
+
| `variables` | `Record<string, any>` | No |
|
|
1594
|
+
| `locale` | `string`. Defaults to the locale value from the [LocalizationProvider](https://shopify.dev/api/hydrogen/components/localization/localizationprovider) component. | No |
|
|
1549
1595
|
|
|
1550
1596
|
**Important**: In order to use `queryShop`, you should pass `shopifyConfig` to `renderHydrogen` inside `App.server.jsx`:
|
|
1551
1597
|
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import LocalizationClientProvider from './LocalizationClientProvider.client';
|
|
3
3
|
import { useShop } from '../../foundation/useShop';
|
|
4
4
|
import { useServerRequest } from '../../foundation/ServerRequestProvider';
|
|
5
|
-
import { CountryCode } from '../../storefront-api-types';
|
|
6
5
|
/**
|
|
7
6
|
* The `LocalizationProvider` component automatically queries the Storefront API's
|
|
8
7
|
* [`localization`](https://shopify.dev/api/storefront/reference/common-objects/queryroot) field
|
|
@@ -11,8 +10,7 @@ import { CountryCode } from '../../storefront-api-types';
|
|
|
11
10
|
* Any descendents of this provider can use the `useLocalization` hook.
|
|
12
11
|
*/
|
|
13
12
|
export function LocalizationProvider(props) {
|
|
14
|
-
const {
|
|
15
|
-
const defaultCountryCode = locale.split(/[-_]/)[1] || CountryCode.Us;
|
|
13
|
+
const { defaultLanguageCode, defaultCountryCode } = useShop();
|
|
16
14
|
const languageCode = (props.languageCode ?? defaultLanguageCode).toUpperCase();
|
|
17
15
|
const countryCode = (props.countryCode ?? defaultCountryCode).toUpperCase();
|
|
18
16
|
const request = useServerRequest();
|
|
@@ -19,7 +19,7 @@ declare type MoneyProps<ComponentGeneric extends React.ElementType> = CustomProp
|
|
|
19
19
|
/**
|
|
20
20
|
* The `Money` component renders a string of the Storefront API's
|
|
21
21
|
* [MoneyV2 object](https://shopify.dev/api/storefront/reference/common-objects/moneyv2) according to the
|
|
22
|
-
* `
|
|
22
|
+
* `locale` in [the `LocalizationProvider` component](https://shopify.dev/api/hydrogen/components/localization/localizationprovider).
|
|
23
23
|
*/
|
|
24
24
|
export declare function Money<TTag extends React.ElementType>({ data, as, withoutCurrency, withoutTrailingZeros, measurement, measurementSeparator, ...passthroughProps }: MoneyProps<TTag>): JSX.Element;
|
|
25
25
|
export {};
|
|
@@ -3,7 +3,7 @@ import { useMoney } from '../../hooks';
|
|
|
3
3
|
/**
|
|
4
4
|
* The `Money` component renders a string of the Storefront API's
|
|
5
5
|
* [MoneyV2 object](https://shopify.dev/api/storefront/reference/common-objects/moneyv2) according to the
|
|
6
|
-
* `
|
|
6
|
+
* `locale` in [the `LocalizationProvider` component](https://shopify.dev/api/hydrogen/components/localization/localizationprovider).
|
|
7
7
|
*/
|
|
8
8
|
export function Money({ data, as, withoutCurrency, withoutTrailingZeros, measurement, measurementSeparator = '/', ...passthroughProps }) {
|
|
9
9
|
if (!isMoney(data)) {
|
|
@@ -1,36 +1,51 @@
|
|
|
1
1
|
import { log } from '../../utilities/log';
|
|
2
|
+
const analyticsDefaultResponse = new Response(null, {
|
|
3
|
+
status: 200,
|
|
4
|
+
});
|
|
2
5
|
export async function ServerAnalyticsRoute(request, { hydrogenConfig }) {
|
|
6
|
+
const serverAnalyticsConnectors = hydrogenConfig.serverAnalyticsConnectors;
|
|
7
|
+
if (!serverAnalyticsConnectors) {
|
|
8
|
+
return analyticsDefaultResponse;
|
|
9
|
+
}
|
|
3
10
|
const requestHeader = request.headers;
|
|
4
11
|
const requestUrl = request.url;
|
|
5
|
-
|
|
12
|
+
let analyticsPromise;
|
|
6
13
|
if (requestHeader.get('Content-Length') === '0') {
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
analyticsPromise = Promise.resolve(true)
|
|
15
|
+
.then(async () => {
|
|
16
|
+
return Promise.all(serverAnalyticsConnectors.map(async (connector) => {
|
|
17
|
+
return await connector.request(requestUrl, requestHeader);
|
|
18
|
+
}));
|
|
19
|
+
})
|
|
20
|
+
.catch((error) => {
|
|
21
|
+
log.warn('Failed to resolve server analytics (no content length): ', error);
|
|
9
22
|
});
|
|
10
23
|
}
|
|
11
24
|
else if (requestHeader.get('Content-Type') === 'application/json') {
|
|
12
|
-
Promise.resolve(request.json())
|
|
25
|
+
analyticsPromise = Promise.resolve(request.json())
|
|
13
26
|
.then((data) => {
|
|
14
|
-
serverAnalyticsConnectors
|
|
15
|
-
connector.request(requestUrl, requestHeader, data, 'json');
|
|
16
|
-
});
|
|
27
|
+
return Promise.all(serverAnalyticsConnectors.map(async (connector) => {
|
|
28
|
+
return await connector.request(requestUrl, requestHeader, data, 'json');
|
|
29
|
+
}));
|
|
17
30
|
})
|
|
18
31
|
.catch((error) => {
|
|
19
|
-
log.warn('Fail to resolve server analytics: ', error);
|
|
32
|
+
log.warn('Fail to resolve server analytics (json): ', error);
|
|
20
33
|
});
|
|
21
34
|
}
|
|
22
35
|
else {
|
|
23
|
-
Promise.resolve(request.text())
|
|
24
|
-
.then((data) => {
|
|
25
|
-
serverAnalyticsConnectors
|
|
26
|
-
connector.request(requestUrl, requestHeader, data, 'text');
|
|
36
|
+
analyticsPromise = Promise.resolve(request.text())
|
|
37
|
+
.then(async (data) => {
|
|
38
|
+
await serverAnalyticsConnectors.forEach(async (connector) => {
|
|
39
|
+
await connector.request(requestUrl, requestHeader, data, 'text');
|
|
27
40
|
});
|
|
41
|
+
return Promise.all(serverAnalyticsConnectors.map(async (connector) => {
|
|
42
|
+
return await connector.request(requestUrl, requestHeader, data, 'text');
|
|
43
|
+
}));
|
|
28
44
|
})
|
|
29
45
|
.catch((error) => {
|
|
30
|
-
log.warn('
|
|
46
|
+
log.warn('Failed to resolve server analytics (text): ', error);
|
|
31
47
|
});
|
|
32
48
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
49
|
+
await analyticsPromise;
|
|
50
|
+
return analyticsDefaultResponse;
|
|
36
51
|
}
|
package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/PerformanceMetrics.client.js
CHANGED
|
@@ -15,10 +15,27 @@ export function PerformanceMetrics() {
|
|
|
15
15
|
// Executes only on first mount
|
|
16
16
|
window.BOOMR = window.BOOMR || {};
|
|
17
17
|
window.BOOMR.hydrogenPerformanceEvent = (data) => {
|
|
18
|
+
const initTime = new Date().getTime();
|
|
18
19
|
ClientAnalytics.publish(ClientAnalytics.eventNames.PERFORMANCE, true, data);
|
|
19
|
-
ClientAnalytics.
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const pageData = ClientAnalytics.getPageAnalyticsData();
|
|
21
|
+
const shopId = pageData.shopify.shopId || '';
|
|
22
|
+
fetch('https://monorail-edge.shopifysvc.com/v1/produce', {
|
|
23
|
+
method: 'post',
|
|
24
|
+
headers: {
|
|
25
|
+
'content-type': 'text/plain',
|
|
26
|
+
},
|
|
27
|
+
body: JSON.stringify({
|
|
28
|
+
schema_id: 'hydrogen_buyer_performance/2.0',
|
|
29
|
+
payload: {
|
|
30
|
+
...data,
|
|
31
|
+
shop_id: shopId.substring(shopId.lastIndexOf('/') + 1) || '',
|
|
32
|
+
},
|
|
33
|
+
metadata: {
|
|
34
|
+
event_created_at_ms: initTime,
|
|
35
|
+
event_sent_at_ms: new Date().getTime(),
|
|
36
|
+
},
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
22
39
|
};
|
|
23
40
|
window.BOOMR.storeDomain = storeDomain;
|
|
24
41
|
function boomerangSaveLoadTime(e) {
|
package/dist/esnext/foundation/Analytics/connectors/PerformanceMetrics/ServerAnalyticsConnector.js
CHANGED
|
@@ -1,27 +1,7 @@
|
|
|
1
1
|
import { log } from '../../../../utilities/log';
|
|
2
2
|
export const PerformanceMetricsServerAnalyticsConnector = {
|
|
3
|
-
request(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const initTime = new Date().getTime();
|
|
7
|
-
fetch('https://monorail-edge.shopifysvc.com/v1/produce', {
|
|
8
|
-
method: 'post',
|
|
9
|
-
headers: {
|
|
10
|
-
'content-type': 'text/plain',
|
|
11
|
-
'x-forwarded-for': requestHeader.get('x-forwarded-for') || '',
|
|
12
|
-
'user-agent': requestHeader.get('user-agent') || '',
|
|
13
|
-
},
|
|
14
|
-
body: JSON.stringify({
|
|
15
|
-
schema_id: 'hydrogen_buyer_performance/2.0',
|
|
16
|
-
payload: data,
|
|
17
|
-
metadata: {
|
|
18
|
-
event_created_at_ms: initTime,
|
|
19
|
-
event_sent_at_ms: new Date().getTime(),
|
|
20
|
-
},
|
|
21
|
-
}),
|
|
22
|
-
}).catch((err) => {
|
|
23
|
-
log.error(err);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
3
|
+
request() {
|
|
4
|
+
log.warn('PerformanceMetricsServerAnalyticsConnector has been removed - please remove its reference from hydrogen.config.js');
|
|
5
|
+
return Promise.resolve();
|
|
26
6
|
},
|
|
27
7
|
};
|
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
import { log } from '../../../../utilities/log';
|
|
2
2
|
export const ShopifyServerAnalyticsConnector = {
|
|
3
|
-
request(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
data.events.forEach((event) => {
|
|
7
|
-
event.payload.client_ip_address = requestHeader.get('x-forwarded-for');
|
|
8
|
-
event.payload.client_user_agent = requestHeader.get('user-agent');
|
|
9
|
-
});
|
|
10
|
-
fetch('https://monorail-edge.shopifysvc.com/unstable/produce_batch', {
|
|
11
|
-
method: 'post',
|
|
12
|
-
headers: {
|
|
13
|
-
'content-type': 'text/plain',
|
|
14
|
-
},
|
|
15
|
-
body: JSON.stringify(data),
|
|
16
|
-
}).catch((err) => {
|
|
17
|
-
log.error(err);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
3
|
+
request() {
|
|
4
|
+
log.warn('ShopifyServerAnalyticsConnector has been removed - please remove its reference from hydrogen.config.js');
|
|
5
|
+
return Promise.resolve();
|
|
20
6
|
},
|
|
21
7
|
};
|
|
@@ -165,19 +165,8 @@ function sendToServer(data) {
|
|
|
165
165
|
};
|
|
166
166
|
batchedData = [];
|
|
167
167
|
batchedTimeout = null;
|
|
168
|
-
// Send to
|
|
168
|
+
// Send to Shopify
|
|
169
169
|
try {
|
|
170
|
-
fetch('/__event?shopify', {
|
|
171
|
-
method: 'post',
|
|
172
|
-
headers: {
|
|
173
|
-
'cache-control': 'no-cache',
|
|
174
|
-
'Content-Type': 'application/json',
|
|
175
|
-
},
|
|
176
|
-
body: JSON.stringify(batchedDataToBeSent),
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
catch (error) {
|
|
180
|
-
// Fallback to client-side
|
|
181
170
|
fetch('https://monorail-edge.shopifysvc.com/unstable/produce_batch', {
|
|
182
171
|
method: 'post',
|
|
183
172
|
headers: {
|
|
@@ -186,5 +175,8 @@ function sendToServer(data) {
|
|
|
186
175
|
body: JSON.stringify(batchedDataToBeSent),
|
|
187
176
|
});
|
|
188
177
|
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
// Do nothing
|
|
180
|
+
}
|
|
189
181
|
}, BATCH_SENT_TIMEOUT);
|
|
190
182
|
}
|
|
@@ -6,13 +6,23 @@ import { useServerAnalytics } from '../../hook';
|
|
|
6
6
|
import { useShop } from '../../../useShop';
|
|
7
7
|
import { SHOPIFY_S, SHOPIFY_Y } from './const';
|
|
8
8
|
import { ShopifyAnalyticsClient } from './ShopifyAnalytics.client';
|
|
9
|
+
import { useShopQuery } from '../../../../hooks/useShopQuery';
|
|
10
|
+
import { CacheLong } from '../../../Cache/strategies';
|
|
11
|
+
import { gql } from '../../../../utilities/graphql-tag';
|
|
9
12
|
export function ShopifyAnalytics({ cookieDomain }) {
|
|
10
13
|
const { storeDomain } = useShop();
|
|
11
14
|
const request = useServerRequest();
|
|
12
15
|
const cookies = parse(request.headers.get('Cookie') || '');
|
|
13
16
|
const domain = cookieDomain || storeDomain;
|
|
17
|
+
const { data: { shop: { id, paymentSettings: { currencyCode }, }, }, } = useShopQuery({
|
|
18
|
+
query: SHOP_QUERY,
|
|
19
|
+
cache: CacheLong(),
|
|
20
|
+
preload: '*',
|
|
21
|
+
});
|
|
14
22
|
useServerAnalytics({
|
|
15
23
|
shopify: {
|
|
24
|
+
shopId: id,
|
|
25
|
+
currency: currencyCode,
|
|
16
26
|
storefrontId: globalThis.Oxygen?.env?.SHOPIFY_STOREFRONT_ID || '0',
|
|
17
27
|
acceptedLanguage: request.headers.get('Accept-Language')?.replace(/-.*/, '') || 'en',
|
|
18
28
|
isPersistentCookie: !!cookies[SHOPIFY_S] || !!cookies[SHOPIFY_Y],
|
|
@@ -21,3 +31,13 @@ export function ShopifyAnalytics({ cookieDomain }) {
|
|
|
21
31
|
return (React.createElement(AnalyticsErrorBoundary, null,
|
|
22
32
|
React.createElement(ShopifyAnalyticsClient, { cookieDomain: domain })));
|
|
23
33
|
}
|
|
34
|
+
const SHOP_QUERY = gql `
|
|
35
|
+
query shopAnalyticsInfo {
|
|
36
|
+
shop {
|
|
37
|
+
id
|
|
38
|
+
paymentSettings {
|
|
39
|
+
currencyCode
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
@@ -4,9 +4,9 @@ import { useServerRequest } from '../ServerRequestProvider';
|
|
|
4
4
|
export function DevTools() {
|
|
5
5
|
const serverRequest = useServerRequest();
|
|
6
6
|
const { shopifyConfig } = serverRequest.ctx;
|
|
7
|
-
const {
|
|
7
|
+
const { defaultLanguageCode: languageCode, defaultCountryCode: countryCode, storeDomain, storefrontApiVersion, } = shopifyConfig || {};
|
|
8
8
|
const settings = {
|
|
9
|
-
locale
|
|
9
|
+
locale: `${languageCode}-${countryCode}`,
|
|
10
10
|
storeDomain,
|
|
11
11
|
storefrontApiVersion,
|
|
12
12
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { ShopifyProviderClient } from './ShopifyProvider.client';
|
|
3
|
-
import {
|
|
3
|
+
import { DEFAULT_COUNTRY, DEFAULT_LANGUAGE } from '../constants';
|
|
4
4
|
import { useRequestCacheData, useServerRequest } from '../ServerRequestProvider';
|
|
5
5
|
import { getOxygenVariable } from '../../utilities/storefrontApi';
|
|
6
6
|
import { SHOPIFY_STOREFRONT_ID_VARIABLE } from '../../constants';
|
|
7
7
|
function makeShopifyContext(shopifyConfig) {
|
|
8
|
-
const
|
|
9
|
-
const languageCode =
|
|
8
|
+
const countryCode = shopifyConfig.defaultCountryCode ?? DEFAULT_COUNTRY;
|
|
9
|
+
const languageCode = shopifyConfig.defaultLanguageCode ?? DEFAULT_LANGUAGE;
|
|
10
10
|
const storefrontId = getOxygenVariable(SHOPIFY_STOREFRONT_ID_VARIABLE);
|
|
11
11
|
return {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
defaultCountryCode: countryCode.toUpperCase(),
|
|
13
|
+
defaultLanguageCode: languageCode.toUpperCase(),
|
|
14
14
|
storeDomain: shopifyConfig?.storeDomain?.replace(/^https?:\/\//, ''),
|
|
15
15
|
storefrontToken: shopifyConfig.storefrontToken,
|
|
16
16
|
storefrontApiVersion: shopifyConfig.storefrontApiVersion,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { CountryCode, LanguageCode } from '../../storefront-api-types';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
import type { ShopifyConfigFetcher, ShopifyConfig } from '../../types';
|
|
4
|
-
export interface ShopifyContextValue extends Omit<ShopifyConfig, '
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export interface ShopifyContextValue extends Omit<ShopifyConfig, 'defaultLanguageCode' | 'defaultCountryCode'> {
|
|
5
|
+
defaultLanguageCode: `${LanguageCode}`;
|
|
6
|
+
defaultCountryCode: `${CountryCode}`;
|
|
7
7
|
storefrontId: string | null;
|
|
8
8
|
}
|
|
9
9
|
export declare type ShopifyProviderProps = {
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const DEFAULT_COUNTRY = "US";
|
|
2
|
+
export declare const DEFAULT_LANGUAGE = "EN";
|
|
@@ -26,7 +26,7 @@ export declare type UseMoneyValue = {
|
|
|
26
26
|
parts: Intl.NumberFormatPart[];
|
|
27
27
|
/**
|
|
28
28
|
* A string returned by `new Intl.NumberFormat` for the amount and currency code,
|
|
29
|
-
* using the `
|
|
29
|
+
* using the `locale` value in the [`LocalizationProvider` component](https://shopify.dev/api/hydrogen/components/localization/localizationprovider).
|
|
30
30
|
*/
|
|
31
31
|
localizedString: string;
|
|
32
32
|
/**
|
|
@@ -18,7 +18,8 @@ export interface RequestHandler {
|
|
|
18
18
|
(request: Request | IncomingMessage, options: RequestHandlerOptions): Promise<Response | undefined>;
|
|
19
19
|
}
|
|
20
20
|
export declare type ShopifyConfig = {
|
|
21
|
-
|
|
21
|
+
defaultLanguageCode?: string;
|
|
22
|
+
defaultCountryCode?: string;
|
|
22
23
|
storeDomain: string;
|
|
23
24
|
storefrontToken: string;
|
|
24
25
|
storefrontApiVersion: string;
|
package/dist/esnext/types.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export declare type ResolvedHydrogenRoutes = {
|
|
|
54
54
|
declare type ConfigFetcher<T> = (request: HydrogenRequest) => T | Promise<T>;
|
|
55
55
|
export declare type ShopifyConfigFetcher = ConfigFetcher<ShopifyConfig>;
|
|
56
56
|
export declare type ServerAnalyticsConnector = {
|
|
57
|
-
request: (requestUrl: string, requestHeader: Headers, data?: any, contentType?: 'json' | 'text') =>
|
|
57
|
+
request: (requestUrl: string, requestHeader: Headers, data?: any, contentType?: 'json' | 'text') => Promise<any>;
|
|
58
58
|
};
|
|
59
59
|
export declare type InlineHydrogenConfig = ClientConfig & {
|
|
60
60
|
routes?: InlineHydrogenRoutes;
|
package/dist/esnext/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "0.
|
|
1
|
+
export declare const LIB_VERSION = "0.27.2";
|
package/dist/esnext/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = '0.
|
|
1
|
+
export const LIB_VERSION = '0.27.2';
|
|
@@ -18,7 +18,8 @@ export interface RequestHandler {
|
|
|
18
18
|
(request: Request | IncomingMessage, options: RequestHandlerOptions): Promise<Response | undefined>;
|
|
19
19
|
}
|
|
20
20
|
export declare type ShopifyConfig = {
|
|
21
|
-
|
|
21
|
+
defaultLanguageCode?: string;
|
|
22
|
+
defaultCountryCode?: string;
|
|
22
23
|
storeDomain: string;
|
|
23
24
|
storefrontToken: string;
|
|
24
25
|
storefrontApiVersion: string;
|