@decocms/apps-magento 7.37.2 → 7.37.3

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/client.ts +5 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/apps-magento",
3
- "version": "7.37.2",
3
+ "version": "7.37.3",
4
4
  "type": "module",
5
5
  "description": "Deco commerce app: Magento integration",
6
6
  "repository": {
@@ -26,9 +26,9 @@
26
26
  "lint:unused": "knip"
27
27
  },
28
28
  "dependencies": {
29
- "@decocms/blocks": "7.37.2",
30
- "@decocms/apps-commerce": "7.37.2",
31
- "@decocms/tanstack": "7.37.2"
29
+ "@decocms/blocks": "7.37.3",
30
+ "@decocms/apps-commerce": "7.37.3",
31
+ "@decocms/tanstack": "7.37.3"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "react": "^19.0.0",
package/src/client.ts CHANGED
@@ -15,6 +15,8 @@
15
15
  * Magento has consistent muscle memory.
16
16
  */
17
17
 
18
+ import { type FetchFn, withFetchTimeout } from "@decocms/blocks/sdk/fetchTimeout";
19
+
18
20
  // ---------------------------------------------------------------------------
19
21
  // Config shapes
20
22
  // ---------------------------------------------------------------------------
@@ -95,7 +97,7 @@ let config: MagentoConfig | null = null;
95
97
  * Mirrors VTEX's `setVtexFetch` / Shopify's `setShopifyFetch` so every commerce
96
98
  * app funnels egress through a single instrumented `_fetch`.
97
99
  */
98
- let _fetch: typeof fetch | undefined;
100
+ let _fetch: FetchFn = withFetchTimeout();
99
101
 
100
102
  /**
101
103
  * Override the fetch used by every Magento egress call.
@@ -106,7 +108,7 @@ let _fetch: typeof fetch | undefined;
106
108
  * setMagentoFetch(createMagentoFetch());
107
109
  * ```
108
110
  */
109
- export function setMagentoFetch(fetchFn: typeof fetch): void {
111
+ export function setMagentoFetch(fetchFn: FetchFn): void {
110
112
  _fetch = fetchFn;
111
113
  }
112
114
 
@@ -246,6 +248,5 @@ export function magentoFetch(path: string, opts: MagentoFetchOpts = {}): Promise
246
248
  // clarity at the call site.
247
249
  const sameOrigin = target.origin === baseUrl.origin;
248
250
 
249
- const doFetch = _fetch ?? globalThis.fetch;
250
- return doFetch(target, { ...opts, headers: buildHeaders(opts, c, sameOrigin) });
251
+ return _fetch(target, { ...opts, headers: buildHeaders(opts, c, sameOrigin) });
251
252
  }