@decocms/apps-shopify 7.37.2 → 7.37.4
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/package.json +4 -4
- package/src/client.ts +3 -2
- package/src/utils/graphql.ts +3 -2
- package/src/utils/instrumentedFetch.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/apps-shopify",
|
|
3
|
-
"version": "7.37.
|
|
3
|
+
"version": "7.37.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Deco commerce app: Shopify integration",
|
|
6
6
|
"repository": {
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"lint:unused": "knip"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@decocms/blocks": "7.37.
|
|
35
|
-
"@decocms/apps-commerce": "7.37.
|
|
36
|
-
"@decocms/tanstack": "7.37.
|
|
34
|
+
"@decocms/blocks": "7.37.4",
|
|
35
|
+
"@decocms/apps-commerce": "7.37.4",
|
|
36
|
+
"@decocms/tanstack": "7.37.4"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"react": "^19.0.0",
|
package/src/client.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FetchFn } from "@decocms/blocks/sdk/fetchTimeout";
|
|
1
2
|
import { createGraphqlClient, type GraphQLClient } from "./utils/graphql";
|
|
2
3
|
|
|
3
4
|
export interface ShopifyConfig {
|
|
@@ -8,7 +9,7 @@ export interface ShopifyConfig {
|
|
|
8
9
|
|
|
9
10
|
let _client: GraphQLClient | null = null;
|
|
10
11
|
let _config: ShopifyConfig | null = null;
|
|
11
|
-
let _fetch:
|
|
12
|
+
let _fetch: FetchFn | undefined;
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Override the fetch function used by the Shopify GraphQL client.
|
|
@@ -21,7 +22,7 @@ let _fetch: typeof fetch | undefined;
|
|
|
21
22
|
* setShopifyFetch(createInstrumentedFetch("shopify"));
|
|
22
23
|
* ```
|
|
23
24
|
*/
|
|
24
|
-
export function setShopifyFetch(fetchFn:
|
|
25
|
+
export function setShopifyFetch(fetchFn: FetchFn) {
|
|
25
26
|
_fetch = fetchFn;
|
|
26
27
|
if (_config) configureShopify(_config);
|
|
27
28
|
}
|
package/src/utils/graphql.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FetchFn, withFetchTimeout } from "@decocms/blocks/sdk/fetchTimeout";
|
|
1
2
|
import type { InstrumentedFetchInit } from "@decocms/blocks/sdk/instrumentedFetch";
|
|
2
3
|
import { extractGraphqlOperationName } from "./graphqlOperationName";
|
|
3
4
|
|
|
@@ -22,9 +23,9 @@ export interface GraphQLClient {
|
|
|
22
23
|
export function createGraphqlClient(
|
|
23
24
|
endpoint: string,
|
|
24
25
|
headers: Record<string, string>,
|
|
25
|
-
fetchFn?:
|
|
26
|
+
fetchFn?: FetchFn,
|
|
26
27
|
): GraphQLClient {
|
|
27
|
-
const _fetch = fetchFn ??
|
|
28
|
+
const _fetch = fetchFn ?? withFetchTimeout();
|
|
28
29
|
return {
|
|
29
30
|
async query<T>(
|
|
30
31
|
queryOrDef: string | QueryDefinition,
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
* extractor returns `undefined`.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
+
import type { FetchFn } from "@decocms/blocks/sdk/fetchTimeout";
|
|
26
27
|
import {
|
|
27
28
|
createInstrumentedFetch,
|
|
28
29
|
type InstrumentedFetch,
|
|
@@ -31,7 +32,7 @@ import { recordCommerceMetric } from "@decocms/blocks/sdk/observability";
|
|
|
31
32
|
import { shopifyOperationRouter } from "./operationRouter";
|
|
32
33
|
|
|
33
34
|
export interface CreateShopifyFetchOptions {
|
|
34
|
-
baseFetch?:
|
|
35
|
+
baseFetch?: FetchFn;
|
|
35
36
|
disableHistogram?: boolean;
|
|
36
37
|
}
|
|
37
38
|
|