@weaverse/hydrogen 6.0.0 → 6.1.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/internal.js +1 -1
- package/dist/internal.mjs +1 -1
- package/dist/react-router.js +1 -1
- package/dist/react-router.mjs +1 -1
- package/dist/translation-store-BpPWqZ0B.js.map +1 -1
- package/dist/translation-store-C42QdI0e.mjs.map +1 -1
- package/dist/types/types.d.ts +13 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/weaverse-client.d.ts +1 -0
- package/dist/types/weaverse-client.d.ts.map +1 -1
- package/dist/{weaverse-client-yC4TYuVV.js → weaverse-client-BDMvJ0Dp.js} +7 -5
- package/dist/{weaverse-client-yC4TYuVV.js.map → weaverse-client-BDMvJ0Dp.js.map} +1 -1
- package/dist/{weaverse-client-Clu3u7md.mjs → weaverse-client-D1n6tucX.mjs} +7 -5
- package/dist/{weaverse-client-Clu3u7md.mjs.map → weaverse-client-D1n6tucX.mjs.map} +1 -1
- package/package.json +3 -3
- package/readme.md +11 -0
- package/src/types.ts +14 -1
- package/src/weaverse-client.ts +7 -5
|
@@ -1334,6 +1334,7 @@ var WeaverseClient = class {
|
|
|
1334
1334
|
waitUntil;
|
|
1335
1335
|
parsedUrl;
|
|
1336
1336
|
componentsByType;
|
|
1337
|
+
locale;
|
|
1337
1338
|
fetchTimeoutMs;
|
|
1338
1339
|
throwPageLoadFailures;
|
|
1339
1340
|
/** Creates a request-scoped client from the storefront's request context. */
|
|
@@ -1348,6 +1349,7 @@ var WeaverseClient = class {
|
|
|
1348
1349
|
this.waitUntil = args.waitUntil;
|
|
1349
1350
|
this.parsedUrl = new URL(args.request.url);
|
|
1350
1351
|
this.componentsByType = this.buildComponentLookupMap(args.components);
|
|
1352
|
+
this.locale = args.locale ?? args.storefront.i18n;
|
|
1351
1353
|
this.fetchTimeoutMs = args.fetchTimeoutMs || DEFAULT_FETCH_TIMEOUT_MS;
|
|
1352
1354
|
this.throwPageLoadFailures = args.throwPageLoadFailures === true;
|
|
1353
1355
|
this.initializeCache(args);
|
|
@@ -1388,7 +1390,7 @@ var WeaverseClient = class {
|
|
|
1388
1390
|
};
|
|
1389
1391
|
this.basePageRequestBody = {
|
|
1390
1392
|
isDesignMode: this.configs.isDesignMode,
|
|
1391
|
-
i18n:
|
|
1393
|
+
i18n: this.locale,
|
|
1392
1394
|
projectId: this.configs.projectId
|
|
1393
1395
|
};
|
|
1394
1396
|
Object.freeze(this.configs);
|
|
@@ -1735,7 +1737,7 @@ var WeaverseClient = class {
|
|
|
1735
1737
|
fetchMerchantOverrides = async (strategy) => {
|
|
1736
1738
|
try {
|
|
1737
1739
|
const { projectId, weaverseHost } = this.configs;
|
|
1738
|
-
const i18n = this.
|
|
1740
|
+
const i18n = this.locale;
|
|
1739
1741
|
if (!this.themeSchema?.i18n) return;
|
|
1740
1742
|
if (!(projectId && weaverseHost)) return;
|
|
1741
1743
|
const url = `${weaverseHost}/api/translation/static?projectId=${projectId}&locale=${`${(i18n?.language || "en").toLowerCase()}-${(i18n?.country || "us").toLowerCase()}`}`;
|
|
@@ -1842,7 +1844,7 @@ var WeaverseClient = class {
|
|
|
1842
1844
|
}
|
|
1843
1845
|
}
|
|
1844
1846
|
try {
|
|
1845
|
-
const { request,
|
|
1847
|
+
const { request, basePageRequestBody, basePageConfigs } = this;
|
|
1846
1848
|
const { projectId: clientProjectId, weaverseHost, isPreviewMode, sectionType } = this.configs;
|
|
1847
1849
|
const effectiveProjectId = params.projectId || clientProjectId;
|
|
1848
1850
|
if (isPreviewMode) return getPreviewData(sectionType || "", this.components, weaverseHost);
|
|
@@ -1906,7 +1908,7 @@ var WeaverseClient = class {
|
|
|
1906
1908
|
configs: {
|
|
1907
1909
|
...basePageConfigs,
|
|
1908
1910
|
requestInfo: {
|
|
1909
|
-
i18n:
|
|
1911
|
+
i18n: this.locale,
|
|
1910
1912
|
queries: getRequestQueries(request),
|
|
1911
1913
|
pathname: this.parsedUrl.pathname,
|
|
1912
1914
|
search: this.parsedUrl.search
|
|
@@ -1963,4 +1965,4 @@ var WeaverseClient = class {
|
|
|
1963
1965
|
//#endregion
|
|
1964
1966
|
export { useThemeText as _, registerComponent as a, createWeaverseDataContext as c, getSelectedProductOptions$1 as d, formatMetaDescriptors as f, interpolate as g, TranslationProvider as h, WeaverseHydrogenRoot as i, useWeaverseDataContext as l, ThemeTextProvider as m, WeaverseHydrogen as n, useThemeSettings as o, getWeaverseSeoMeta as p, WeaverseHydrogenItem as r, withWeaverse as s, WeaverseClient as t, defaultComponents as u, useTranslation as v };
|
|
1965
1967
|
|
|
1966
|
-
//# sourceMappingURL=weaverse-client-
|
|
1968
|
+
//# sourceMappingURL=weaverse-client-D1n6tucX.mjs.map
|