@makeswift/runtime 0.10.0 → 0.10.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/dist/index.es.js CHANGED
@@ -1076,7 +1076,7 @@ Received "${apiKey}" instead.`);
1076
1076
  throw new Error(`Failed to get page snapshot with error: "${response.statusText}"`);
1077
1077
  }
1078
1078
  const document2 = await response.json();
1079
- const { cacheData, localizedResourcesMap } = await this.introspect(document2.data, previewOverride, unstable_locale);
1079
+ const { cacheData, localizedResourcesMap } = await this.introspect(document2.data, previewOverride, locale != null ? locale : void 0);
1080
1080
  const apiOrigin = this.apiOrigin.href;
1081
1081
  const preview = siteVersion === MakeswiftSiteVersion.Working;
1082
1082
  return {
@@ -1179,7 +1179,7 @@ async function fonts(_req, res, { getFonts } = {}) {
1179
1179
  const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
1180
1180
  return res.json(fonts2);
1181
1181
  }
1182
- const version = "0.10.0";
1182
+ const version = "0.10.2";
1183
1183
  async function handler(req, res, { apiKey, unstable_siteVersions }) {
1184
1184
  if (req.query.secret !== apiKey) {
1185
1185
  return res.status(401).json({ message: "Unauthorized" });
@@ -1319,7 +1319,7 @@ Read more about dynamic catch-all routes here: https://nextjs.org/docs/routing/d
1319
1319
  return client.getGlobalElement(m.params.id).then(handleResource);
1320
1320
  }
1321
1321
  if (m = matches("/localized-global-elements/:globalElementId/:locale")) {
1322
- return client.getLocalizedGlobalElement(m.params.globalElementId, m.params.locale).then(handleResource);
1322
+ return client.getLocalizedGlobalElement(m.params.globalElementId, m.params.locale).then((resource) => resource === null ? res.json({ message: "Not Found" }) : res.json(resource));
1323
1323
  }
1324
1324
  if (m = matches("/page-pathname-slices/:id")) {
1325
1325
  return client.getPagePathnameSlice(m.params.id).then(handleResource);
@@ -1452,7 +1452,8 @@ const Page = memo(({
1452
1452
  const client = useMemo(() => new MakeswiftClient({
1453
1453
  uri: new URL("graphql", snapshot.apiOrigin).href,
1454
1454
  cacheData: snapshot.cacheData,
1455
- localizedResourcesMap: snapshot.localizedResourcesMap
1455
+ localizedResourcesMap: snapshot.localizedResourcesMap,
1456
+ locale: snapshot.locale ? new Intl.Locale(snapshot.locale) : void 0
1456
1457
  }), [snapshot]);
1457
1458
  const rootElements = /* @__PURE__ */ new Map([[snapshot.document.id, snapshot.document.data]]);
1458
1459
  snapshot.document.localizedPages.forEach((localizedPage) => {