@bagelink/blox 1.15.661 → 1.15.665

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.
@@ -1 +1 @@
1
- {"version":3,"file":"CmsPageView.vue.d.ts","sourceRoot":"","sources":["../src/CmsPageView.vue"],"names":[],"mappings":";AA2pBA,wBAMG"}
1
+ {"version":3,"file":"CmsPageView.vue.d.ts","sourceRoot":"","sources":["../src/CmsPageView.vue"],"names":[],"mappings":";AA2rBA,wBAMG"}
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-BP6sRzCv.cjs");
3
+ const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-BnPd6x9t.cjs");
4
4
  exports.default = PreviewApp_vue_vue_type_style_index_0_lang._sfc_main;
@@ -1,4 +1,4 @@
1
- import { _ as _sfc_main } from "./PreviewApp.vue_vue_type_style_index_0_lang-D3nz9VR7.js";
1
+ import { _ as _sfc_main } from "./PreviewApp.vue_vue_type_style_index_0_lang-zAjDTnQg.js";
2
2
  export {
3
3
  _sfc_main as default
4
4
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const vue = require("vue");
3
- const appRuntime = require("./appRuntime-KrtrOgvG.cjs");
3
+ const appRuntime = require("./appRuntime-DriplkOx.cjs");
4
4
  function sendToEditor(msg) {
5
5
  window.parent.postMessage(cloneForPostMessage(msg), "*");
6
6
  }
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, inject, ref, h, provide, onMounted, onUnmounted, openBlock, createElementBlock, createVNode, unref, nextTick } from "vue";
2
- import { d as BLOX_REGISTRY_KEY, r as resolveBlockProps, u as useLocale, e as BLOX_RUNTIME_KEY } from "./appRuntime-wD8N8dxg.js";
2
+ import { d as BLOX_REGISTRY_KEY, r as resolveBlockProps, u as useLocale, e as BLOX_RUNTIME_KEY } from "./appRuntime-0WTFR_UL.js";
3
3
  function sendToEditor(msg) {
4
4
  window.parent.postMessage(cloneForPostMessage(msg), "*");
5
5
  }
@@ -268,6 +268,12 @@ const PageRenderer = defineComponent({
268
268
  };
269
269
  }
270
270
  });
271
+ const NOT_FOUND_SLUG = "/404";
272
+ function isMissingPageDocument({ hydratedSlug, requestedSlug }) {
273
+ if (!hydratedSlug) return false;
274
+ if (hydratedSlug !== NOT_FOUND_SLUG) return false;
275
+ return requestedSlug !== NOT_FOUND_SLUG;
276
+ }
271
277
  const _hoisted_1$1 = {
272
278
  key: 0,
273
279
  class: "blox-initial-loading"
@@ -345,10 +351,22 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
345
351
  return true;
346
352
  }
347
353
  const routeState = (_a2 = readBloxHydration()) == null ? void 0 : _a2.route;
348
- const entry = (routeState == null ? void 0 : routeState.path) === path ? routeState.resolved : void 0;
349
- if (!entry) return false;
350
- applyResolvedState(entry);
351
- return true;
354
+ if ((routeState == null ? void 0 : routeState.path) === path) {
355
+ applyResolvedState(routeState.resolved);
356
+ return true;
357
+ }
358
+ if (isNotFoundRoute(routeState == null ? void 0 : routeState.path)) {
359
+ applyResolvedState(routeState.resolved, routeState.path);
360
+ return true;
361
+ }
362
+ return false;
363
+ }
364
+ function isNotFoundRoute(path) {
365
+ var _a2;
366
+ if (!path) return false;
367
+ const hostname = typeof window !== "undefined" ? window.location.hostname : "";
368
+ const slug = strategy ? strategy.detect(hostname, path).slug : path;
369
+ return slug === NOT_FOUND_SLUG && !!((_a2 = readBloxHydration()) == null ? void 0 : _a2.route);
352
370
  }
353
371
  function applyResolvedState(entry, path) {
354
372
  var _a2, _b, _c;
@@ -408,7 +426,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
408
426
  } catch (e) {
409
427
  const msg = e instanceof Error ? e.message : String(e);
410
428
  if (msg.includes("404")) {
411
- await router.replace(homePath(urlLocale));
429
+ notFound.value = true;
412
430
  } else {
413
431
  error.value = msg;
414
432
  }
@@ -898,7 +916,7 @@ class BloxInstance {
898
916
  router.addRoute({
899
917
  path: "/_blox_preview",
900
918
  name: BLOX_PREVIEW_ROUTE_NAME,
901
- component: () => import("./PreviewApp-6imffI4L.js"),
919
+ component: () => import("./PreviewApp-Djh38Iw-.js"),
902
920
  beforeEnter: () => typeof window === "undefined" || window.parent !== window ? true : "/"
903
921
  });
904
922
  }
@@ -1288,24 +1306,26 @@ function installBloxRuntime(options) {
1288
1306
  return blox;
1289
1307
  }
1290
1308
  export {
1291
- classifyLink as A,
1309
+ _sfc_main as A,
1292
1310
  BLOX_SSR_ROUTE_STATE_KEY as B,
1293
- contentRoutes as C,
1294
- createBlox as D,
1295
- defineContent as E,
1296
- generateContentRoutes as F,
1297
- getContentRouteByCollection as G,
1298
- installContentFallback as H,
1299
- isAbsoluteExternal as I,
1300
- isSoloContentPage as J,
1301
- isSpecialScheme as K,
1302
- normalizeTo as L,
1303
- provideContentItem as M,
1304
- toInternalPath as N,
1305
- useBloxEdit as O,
1311
+ applyLayoutChrome as C,
1312
+ classifyLink as D,
1313
+ contentRoutes as E,
1314
+ createBlox as F,
1315
+ defineContent as G,
1316
+ generateContentRoutes as H,
1317
+ getContentRouteByCollection as I,
1318
+ installContentFallback as J,
1319
+ isAbsoluteExternal as K,
1320
+ isSoloContentPage as L,
1321
+ isSpecialScheme as M,
1322
+ normalizeTo as N,
1323
+ provideContentItem as O,
1306
1324
  PageRenderer as P,
1307
- useContentItem as Q,
1308
- useData as R,
1325
+ toInternalPath as Q,
1326
+ useBloxEdit as R,
1327
+ useContentItem as S,
1328
+ useData as T,
1309
1329
  _sfc_main$3 as _,
1310
1330
  collectBloxSeo as a,
1311
1331
  provideBloxLocale as b,
@@ -1317,20 +1337,20 @@ export {
1317
1337
  getRegistryData as h,
1318
1338
  installBloxRuntime as i,
1319
1339
  getContentRoute as j,
1320
- installSmartLinks as k,
1321
- consumePendingLocaleSwitch as l,
1322
- BLOX_ADMIN_CONFIG_KEY as m,
1340
+ isMissingPageDocument as k,
1341
+ installSmartLinks as l,
1342
+ consumePendingLocaleSwitch as m,
1323
1343
  normalizeLink as n,
1324
- BLOX_CONFIG_KEY as o,
1344
+ BLOX_CMS_ROUTE_NAME as o,
1325
1345
  provideBloxData as p,
1326
- BLOX_DATA_KEY as q,
1346
+ BLOX_ADMIN_CONFIG_KEY as q,
1327
1347
  resolveBlockProps as r,
1328
1348
  setActiveLocale as s,
1329
- BLOX_LAYOUT_KEY as t,
1349
+ BLOX_CONFIG_KEY as t,
1330
1350
  useLocale as u,
1331
- BloxInstance as v,
1332
- _sfc_main$2 as w,
1333
- _sfc_main$1 as x,
1334
- _sfc_main as y,
1335
- applyLayoutChrome as z
1351
+ BLOX_DATA_KEY as v,
1352
+ BLOX_LAYOUT_KEY as w,
1353
+ BloxInstance as x,
1354
+ _sfc_main$2 as y,
1355
+ _sfc_main$1 as z
1336
1356
  };
@@ -269,6 +269,12 @@ const PageRenderer = vue.defineComponent({
269
269
  };
270
270
  }
271
271
  });
272
+ const NOT_FOUND_SLUG = "/404";
273
+ function isMissingPageDocument({ hydratedSlug, requestedSlug }) {
274
+ if (!hydratedSlug) return false;
275
+ if (hydratedSlug !== NOT_FOUND_SLUG) return false;
276
+ return requestedSlug !== NOT_FOUND_SLUG;
277
+ }
272
278
  const _hoisted_1$1 = {
273
279
  key: 0,
274
280
  class: "blox-initial-loading"
@@ -346,10 +352,22 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
346
352
  return true;
347
353
  }
348
354
  const routeState = (_a2 = ssg_client.readBloxHydration()) == null ? void 0 : _a2.route;
349
- const entry = (routeState == null ? void 0 : routeState.path) === path ? routeState.resolved : void 0;
350
- if (!entry) return false;
351
- applyResolvedState(entry);
352
- return true;
355
+ if ((routeState == null ? void 0 : routeState.path) === path) {
356
+ applyResolvedState(routeState.resolved);
357
+ return true;
358
+ }
359
+ if (isNotFoundRoute(routeState == null ? void 0 : routeState.path)) {
360
+ applyResolvedState(routeState.resolved, routeState.path);
361
+ return true;
362
+ }
363
+ return false;
364
+ }
365
+ function isNotFoundRoute(path) {
366
+ var _a2;
367
+ if (!path) return false;
368
+ const hostname = typeof window !== "undefined" ? window.location.hostname : "";
369
+ const slug = strategy ? strategy.detect(hostname, path).slug : path;
370
+ return slug === NOT_FOUND_SLUG && !!((_a2 = ssg_client.readBloxHydration()) == null ? void 0 : _a2.route);
353
371
  }
354
372
  function applyResolvedState(entry, path) {
355
373
  var _a2, _b, _c;
@@ -409,7 +427,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
409
427
  } catch (e) {
410
428
  const msg = e instanceof Error ? e.message : String(e);
411
429
  if (msg.includes("404")) {
412
- await router.replace(homePath(urlLocale));
430
+ notFound.value = true;
413
431
  } else {
414
432
  error.value = msg;
415
433
  }
@@ -899,7 +917,7 @@ class BloxInstance {
899
917
  router.addRoute({
900
918
  path: "/_blox_preview",
901
919
  name: BLOX_PREVIEW_ROUTE_NAME,
902
- component: () => Promise.resolve().then(() => require("./PreviewApp-_sBftiOk.cjs")),
920
+ component: () => Promise.resolve().then(() => require("./PreviewApp-8TIZXoXH.cjs")),
903
921
  beforeEnter: () => typeof window === "undefined" || window.parent !== window ? true : "/"
904
922
  });
905
923
  }
@@ -1289,6 +1307,7 @@ function installBloxRuntime(options) {
1289
1307
  return blox;
1290
1308
  }
1291
1309
  exports.BLOX_ADMIN_CONFIG_KEY = BLOX_ADMIN_CONFIG_KEY;
1310
+ exports.BLOX_CMS_ROUTE_NAME = BLOX_CMS_ROUTE_NAME;
1292
1311
  exports.BLOX_CONFIG_KEY = BLOX_CONFIG_KEY;
1293
1312
  exports.BLOX_DATA_KEY = BLOX_DATA_KEY;
1294
1313
  exports.BLOX_LAYOUT_KEY = BLOX_LAYOUT_KEY;
@@ -1318,6 +1337,7 @@ exports.installBloxRuntime = installBloxRuntime;
1318
1337
  exports.installContentFallback = installContentFallback;
1319
1338
  exports.installSmartLinks = installSmartLinks;
1320
1339
  exports.isAbsoluteExternal = isAbsoluteExternal;
1340
+ exports.isMissingPageDocument = isMissingPageDocument;
1321
1341
  exports.isSoloContentPage = isSoloContentPage;
1322
1342
  exports.isSpecialScheme = isSpecialScheme;
1323
1343
  exports.normalizeLink = normalizeLink;
@@ -12,6 +12,7 @@
12
12
  */
13
13
  export declare function useLocaleNav(): {
14
14
  switchLocale: (targetLocale: string) => void;
15
+ alternatePath: (targetLocale: string) => string;
15
16
  toPath: (slug: string) => string;
16
17
  localePath: (targetLocale: string, slug?: string) => string;
17
18
  detect: (path: string) => {
@@ -1 +1 @@
1
- {"version":3,"file":"useLocaleNav.d.ts","sourceRoot":"","sources":["../../src/composables/useLocaleNav.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY;iCAYS,MAAM;mBAiBpB,MAAM,KAAG,MAAM;+BAOH,MAAM,oBAAe,MAAM;mBAYvC,MAAM,KAAG;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;;;EAa/D"}
1
+ {"version":3,"file":"useLocaleNav.d.ts","sourceRoot":"","sources":["../../src/composables/useLocaleNav.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY;iCAYS,MAAM;kCAeL,MAAM,KAAG,MAAM;mBAI9B,MAAM,KAAG,MAAM;+BAOH,MAAM,oBAAe,MAAM;mBAYvC,MAAM,KAAG;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;;;EAa/D"}
@@ -92,6 +92,12 @@ export interface PlausibleOptions {
92
92
  /** Self-hosted Plausible host. @default 'https://analytics.bagel.to' */
93
93
  apiHost?: string;
94
94
  }
95
+ /**
96
+ * True when `slug` matches a registered route other than the CMS catch-all —
97
+ * i.e. the URL belongs to a real section whose resource may simply be missing
98
+ * in this language. Paths that only match the catch-all do not exist at all.
99
+ */
100
+ export declare function matchesRealRoute(router: Router, slug: string): boolean;
95
101
  /**
96
102
  * Inject the Plausible tracking script into `<head>` (client-only, idempotent).
97
103
  * No-ops during SSR or if a script for the same domain already exists.
@@ -1 +1 @@
1
- {"version":3,"file":"createBloxApp.d.ts","sourceRoot":"","sources":["../src/createBloxApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,KAAK,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAWhD,MAAM,WAAW,oBAAoB;IACpC,oCAAoC;IACpC,aAAa,EAAE,SAAS,CAAA;IACxB,2BAA2B;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd;;;;;OAKG;IACH,OAAO,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;IACpD,4EAA4E;IAC5E,WAAW,EAAE,MAAM,CAAA;IACnB,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,kDAAkD;IAClD,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,oCAAoC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACxB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAA;IAClD;;;OAGG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,MAAM,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,CAAA;IAChD;;;OAGG;IACH,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;AAC7C,MAAM,WAAW,gBAAgB;IAChC,gGAAgG;IAChG,MAAM,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAA;CAChB;AAID;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAQtE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAoCvE;AAED,MAAM,WAAW,aAAa;IAC7B,GAAG,EAAE,GAAG,CAAA;IACR,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,YAAY,CAAA;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAyK1E"}
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const index = require("./index-DUjEj7ts.cjs");
4
- const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-BP6sRzCv.cjs");
5
- const appRuntime = require("./appRuntime-KrtrOgvG.cjs");
4
+ const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-BnPd6x9t.cjs");
5
+ const appRuntime = require("./appRuntime-DriplkOx.cjs");
6
6
  const vue = require("vue");
7
7
  const ssg_client = require("./client-AoDTJJXJ.cjs");
8
8
  const vueRouter = require("vue-router");
@@ -138,9 +138,11 @@ function useLocaleNav() {
138
138
  });
139
139
  function switchLocale(targetLocale) {
140
140
  if (!strategy) return;
141
- const alts = currentAlternates.value;
142
- const alternateSlug = alts[targetLocale] ?? "/";
143
- strategy.switchTo(targetLocale, alternateSlug, router);
141
+ strategy.switchTo(targetLocale, alternatePath(targetLocale), router);
142
+ }
143
+ function alternatePath(targetLocale) {
144
+ var _a;
145
+ return ((_a = currentAlternates.value) == null ? void 0 : _a[targetLocale]) ?? "/";
144
146
  }
145
147
  function toPath(slug) {
146
148
  const normalized = appRuntime.normalizeLink(slug) ?? slug;
@@ -164,7 +166,7 @@ function useLocaleNav() {
164
166
  }
165
167
  return { locale: def, slug: path || "/" };
166
168
  }
167
- return { switchLocale, toPath, localePath, detect, availableLocales, locale };
169
+ return { switchLocale, alternatePath, toPath, localePath, detect, availableLocales, locale };
168
170
  }
169
171
  function usePageContext(key = "$page") {
170
172
  const contexts = vue.inject("contexts");
@@ -230,6 +232,16 @@ function safeRoute() {
230
232
  }
231
233
  }
232
234
  const DEFAULT_PLAUSIBLE_HOST = "https://analytics.bagel.to";
235
+ function matchesRealRoute(router, slug) {
236
+ var _a;
237
+ try {
238
+ const resolved = router.resolve(slug || "/");
239
+ if (!((_a = resolved == null ? void 0 : resolved.matched) == null ? void 0 : _a.length)) return false;
240
+ return resolved.name !== appRuntime.BLOX_CMS_ROUTE_NAME;
241
+ } catch {
242
+ return false;
243
+ }
244
+ }
233
245
  function injectPlausible(config) {
234
246
  var _a, _b;
235
247
  if (typeof document === "undefined") return;
@@ -255,7 +267,7 @@ function injectPlausible(config) {
255
267
  document.head.appendChild(el);
256
268
  }
257
269
  function createBloxApp(options) {
258
- var _a;
270
+ var _a, _b, _c;
259
271
  const {
260
272
  rootComponent,
261
273
  router,
@@ -337,6 +349,18 @@ function createBloxApp(options) {
337
349
  const initialPath = typeof window !== "undefined" && ((_a = window.location) == null ? void 0 : _a.pathname) ? window.location.pathname : router.currentRoute.value.path;
338
350
  appRuntime.setActiveLocale(localeOf(initialPath), localeState);
339
351
  appRuntime.setActiveLocale(localeOf(initialPath), localeState);
352
+ if (hasSsgState && strategy && typeof window !== "undefined") {
353
+ const hostname = window.location.hostname;
354
+ const hydratedPath = (_c = (_b = ssg_client.readBloxHydration()) == null ? void 0 : _b.route) == null ? void 0 : _c.path;
355
+ const requestedSlug = strategy.detect(hostname, initialPath).slug;
356
+ if (appRuntime.isMissingPageDocument({
357
+ hydratedSlug: hydratedPath ? strategy.detect(hostname, hydratedPath).slug : "",
358
+ requestedSlug
359
+ }) && matchesRealRoute(router, requestedSlug)) {
360
+ window.location.replace(strategy.toPath("/", localeOf(initialPath)));
361
+ return { app, router, blox };
362
+ }
363
+ }
340
364
  router.isReady().then(() => {
341
365
  appRuntime.installSmartLinks(router);
342
366
  if (navigation === "document") installDocumentNavigation(router);
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { useBloxApi, getItemBySlug, getItemById, provideBloxApi } from "./index-I81QTzv-.js";
2
2
  import { configureApi, createBloxApi, getCollectionResolver, getWebsiteId, getWebsiteIdSync, listItems, resolvePath, setApiOrigin, setCollectionResolver } from "./index-I81QTzv-.js";
3
- import { _, P, s, a } from "./PreviewApp.vue_vue_type_style_index_0_lang-D3nz9VR7.js";
4
- import { f as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, n as normalizeLink, e as BLOX_RUNTIME_KEY, g as useSeo, h as getRegistryData, j as getContentRoute, p as provideBloxData, b as provideBloxLocale, i as installBloxRuntime, s as setActiveLocale, k as installSmartLinks, l as consumePendingLocaleSwitch } from "./appRuntime-wD8N8dxg.js";
5
- import { _ as _2, m, o, q, t, v, w, x, y, P as P2, z, A, c, a as a2, C, D, E, F, G, H, I, J, K, L, M, r, N, O, Q, R } from "./appRuntime-wD8N8dxg.js";
3
+ import { _, P, s, a } from "./PreviewApp.vue_vue_type_style_index_0_lang-zAjDTnQg.js";
4
+ import { f as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, n as normalizeLink, e as BLOX_RUNTIME_KEY, g as useSeo, h as getRegistryData, j as getContentRoute, p as provideBloxData, b as provideBloxLocale, i as installBloxRuntime, s as setActiveLocale, k as isMissingPageDocument, l as installSmartLinks, m as consumePendingLocaleSwitch, o as BLOX_CMS_ROUTE_NAME } from "./appRuntime-0WTFR_UL.js";
5
+ import { _ as _2, q, t, v, w, x, y, z, A, P as P2, C, D, c, a as a2, E, F, G, H, I, J, K, L, M, N, O, r, Q, R, S, T } from "./appRuntime-0WTFR_UL.js";
6
6
  import { defineComponent, resolveComponent, openBlock, createBlock, withCtx, Transition, resolveDynamicComponent, inject, ref, watch, onMounted, onUnmounted, computed, onServerPrefetch, toValue, h, Suspense, createSSRApp, createApp } from "vue";
7
7
  import { r as readBloxHydration } from "./client-Ce9fRCGH.js";
8
8
  import { useRouter, useRoute } from "vue-router";
@@ -138,9 +138,11 @@ function useLocaleNav() {
138
138
  });
139
139
  function switchLocale(targetLocale) {
140
140
  if (!strategy) return;
141
- const alts = currentAlternates.value;
142
- const alternateSlug = alts[targetLocale] ?? "/";
143
- strategy.switchTo(targetLocale, alternateSlug, router);
141
+ strategy.switchTo(targetLocale, alternatePath(targetLocale), router);
142
+ }
143
+ function alternatePath(targetLocale) {
144
+ var _a;
145
+ return ((_a = currentAlternates.value) == null ? void 0 : _a[targetLocale]) ?? "/";
144
146
  }
145
147
  function toPath(slug) {
146
148
  const normalized = normalizeLink(slug) ?? slug;
@@ -164,7 +166,7 @@ function useLocaleNav() {
164
166
  }
165
167
  return { locale: def, slug: path || "/" };
166
168
  }
167
- return { switchLocale, toPath, localePath, detect, availableLocales, locale };
169
+ return { switchLocale, alternatePath, toPath, localePath, detect, availableLocales, locale };
168
170
  }
169
171
  function usePageContext(key = "$page") {
170
172
  const contexts = inject("contexts");
@@ -230,6 +232,16 @@ function safeRoute() {
230
232
  }
231
233
  }
232
234
  const DEFAULT_PLAUSIBLE_HOST = "https://analytics.bagel.to";
235
+ function matchesRealRoute(router, slug) {
236
+ var _a;
237
+ try {
238
+ const resolved = router.resolve(slug || "/");
239
+ if (!((_a = resolved == null ? void 0 : resolved.matched) == null ? void 0 : _a.length)) return false;
240
+ return resolved.name !== BLOX_CMS_ROUTE_NAME;
241
+ } catch {
242
+ return false;
243
+ }
244
+ }
233
245
  function injectPlausible(config) {
234
246
  var _a, _b;
235
247
  if (typeof document === "undefined") return;
@@ -255,7 +267,7 @@ function injectPlausible(config) {
255
267
  document.head.appendChild(el);
256
268
  }
257
269
  function createBloxApp(options) {
258
- var _a;
270
+ var _a, _b, _c;
259
271
  const {
260
272
  rootComponent,
261
273
  router,
@@ -337,6 +349,18 @@ function createBloxApp(options) {
337
349
  const initialPath = typeof window !== "undefined" && ((_a = window.location) == null ? void 0 : _a.pathname) ? window.location.pathname : router.currentRoute.value.path;
338
350
  setActiveLocale(localeOf(initialPath), localeState);
339
351
  setActiveLocale(localeOf(initialPath), localeState);
352
+ if (hasSsgState && strategy && typeof window !== "undefined") {
353
+ const hostname = window.location.hostname;
354
+ const hydratedPath = (_c = (_b = readBloxHydration()) == null ? void 0 : _b.route) == null ? void 0 : _c.path;
355
+ const requestedSlug = strategy.detect(hostname, initialPath).slug;
356
+ if (isMissingPageDocument({
357
+ hydratedSlug: hydratedPath ? strategy.detect(hostname, hydratedPath).slug : "",
358
+ requestedSlug
359
+ }) && matchesRealRoute(router, requestedSlug)) {
360
+ window.location.replace(strategy.toPath("/", localeOf(initialPath)));
361
+ return { app, router, blox };
362
+ }
363
+ }
340
364
  router.isReady().then(() => {
341
365
  installSmartLinks(router);
342
366
  if (navigation === "document") installDocumentNavigation(router);
@@ -413,53 +437,53 @@ function buildBloxManifest(blox) {
413
437
  }
414
438
  export {
415
439
  _2 as AdminEditBar,
416
- m as BLOX_ADMIN_CONFIG_KEY,
417
- o as BLOX_CONFIG_KEY,
418
- q as BLOX_DATA_KEY,
419
- t as BLOX_LAYOUT_KEY,
440
+ q as BLOX_ADMIN_CONFIG_KEY,
441
+ t as BLOX_CONFIG_KEY,
442
+ v as BLOX_DATA_KEY,
443
+ w as BLOX_LAYOUT_KEY,
420
444
  BLOX_LOCALE_STRATEGY_KEY,
421
445
  BLOX_RUNTIME_KEY,
422
- v as BloxInstance,
446
+ x as BloxInstance,
423
447
  _sfc_main as BloxRouterView,
424
- w as CmsPageView,
425
- x as ContentDetailView,
426
- y as ContentHost,
448
+ y as CmsPageView,
449
+ z as ContentDetailView,
450
+ A as ContentHost,
427
451
  P2 as PageRenderer,
428
452
  _ as PreviewApp,
429
453
  P as PreviewRenderer,
430
- z as applyLayoutChrome,
454
+ C as applyLayoutChrome,
431
455
  buildBloxManifest,
432
- A as classifyLink,
456
+ D as classifyLink,
433
457
  c as collectBloxData,
434
458
  a2 as collectBloxSeo,
435
459
  configureApi,
436
- C as contentRoutes,
437
- D as createBlox,
460
+ E as contentRoutes,
461
+ F as createBlox,
438
462
  createBloxApi,
439
463
  createBloxApp,
440
464
  defineBlock,
441
465
  defineBloxSite,
442
- E as defineContent,
443
- F as generateContentRoutes,
466
+ G as defineContent,
467
+ H as generateContentRoutes,
444
468
  getCollectionResolver,
445
469
  getContentRoute,
446
- G as getContentRouteByCollection,
470
+ I as getContentRouteByCollection,
447
471
  getItemById,
448
472
  getItemBySlug,
449
473
  getWebsiteId,
450
474
  getWebsiteIdSync,
451
475
  injectPlausible,
452
- H as installContentFallback,
476
+ J as installContentFallback,
453
477
  installDocumentNavigation,
454
478
  installSmartLinks,
455
- I as isAbsoluteExternal,
456
- J as isSoloContentPage,
457
- K as isSpecialScheme,
479
+ K as isAbsoluteExternal,
480
+ L as isSoloContentPage,
481
+ M as isSpecialScheme,
458
482
  listItems,
459
483
  normalizeLink,
460
- L as normalizeTo,
484
+ N as normalizeTo,
461
485
  provideBloxData,
462
- M as provideContentItem,
486
+ O as provideContentItem,
463
487
  readBloxHydration,
464
488
  r as resolveBlockProps,
465
489
  resolvePath,
@@ -468,13 +492,13 @@ export {
468
492
  serializeRegistry,
469
493
  setApiOrigin,
470
494
  setCollectionResolver,
471
- N as toInternalPath,
495
+ Q as toInternalPath,
472
496
  useBloxApi,
473
- O as useBloxEdit,
497
+ R as useBloxEdit,
474
498
  useBloxRuntime,
475
- Q as useContentItem,
499
+ S as useContentItem,
476
500
  useContentSeo,
477
- R as useData,
501
+ T as useData,
478
502
  useGlobalBlock,
479
503
  useLocale,
480
504
  useLocaleNav,
@@ -0,0 +1,29 @@
1
+ /**
2
+ * A host (Netlify) serves the site's not-found document for any path that has no
3
+ * prerendered page, with an HTTP 404 status. JavaScript cannot read that status,
4
+ * but the document's embedded hydration payload describes the not-found page, so
5
+ * comparing it with the current URL is the only client-visible signal that the
6
+ * requested page does not exist.
7
+ *
8
+ * Used at boot: if we are NOT on the not-found page itself, the URL is missing
9
+ * and the visitor should go to the homepage of the requested language. Acting
10
+ * before mount also prevents hydrating a 404 document against a different view
11
+ * (which produces hydration mismatches and a broken nav/page).
12
+ */
13
+ /** Route slug of the site's not-found page. */
14
+ export declare const NOT_FOUND_SLUG = "/404";
15
+ export interface NotFoundDetection {
16
+ /** Hydrated page's route path (from the SSG payload), if any. */
17
+ hydratedPath?: string | null;
18
+ /** Locale-stripped slug of the URL actually requested. */
19
+ requestedSlug: string;
20
+ /** Locale-stripped slug of the hydrated page. */
21
+ hydratedSlug: string;
22
+ }
23
+ /**
24
+ * True when the loaded document is the not-found page but the requested URL is
25
+ * something else — i.e. the URL does not exist and the visitor must be sent
26
+ * elsewhere.
27
+ */
28
+ export declare function isMissingPageDocument({ hydratedSlug, requestedSlug }: NotFoundDetection): boolean;
29
+ //# sourceMappingURL=notFoundDocument.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notFoundDocument.d.ts","sourceRoot":"","sources":["../src/notFoundDocument.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,+CAA+C;AAC/C,eAAO,MAAM,cAAc,SAAS,CAAA;AAEpC,MAAM,WAAW,iBAAiB;IACjC,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,0DAA0D;IAC1D,aAAa,EAAE,MAAM,CAAA;IACrB,iDAAiD;IACjD,YAAY,EAAE,MAAM,CAAA;CACpB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,YAAY,EAAE,aAAa,EAAE,EAAE,iBAAiB,GAAG,OAAO,CAIjG"}
@@ -26,7 +26,7 @@ const llmArtifacts = require("../validate-output-BdzD7fIN.cjs");
26
26
  const ssg_buildGrant = require("./build-grant.cjs");
27
27
  const ssg_client = require("../client-AoDTJJXJ.cjs");
28
28
  const vue = require("vue");
29
- const appRuntime = require("../appRuntime-KrtrOgvG.cjs");
29
+ const appRuntime = require("../appRuntime-DriplkOx.cjs");
30
30
  const index = require("../index-DUjEj7ts.cjs");
31
31
  async function renderBloxSsgPage(options) {
32
32
  var _a, _b, _c, _d;
@@ -3,7 +3,7 @@ import { k, l, f, m, n, o, q, g, r, s, t, w, x, y, p, a, z, A, u, c, v } from ".
3
3
  import { parseBloxBuildGrantBody, resolveBloxBuildGrant } from "./build-grant.mjs";
4
4
  import { a as BLOX_HYDRATION_WINDOW_KEY } from "../client-Ce9fRCGH.js";
5
5
  import { createSSRApp, h, Suspense } from "vue";
6
- import { c as collectBloxData, a as collectBloxSeo, p as provideBloxData, b as provideBloxLocale, B as BLOX_SSR_ROUTE_STATE_KEY, i as installBloxRuntime, s as setActiveLocale } from "../appRuntime-wD8N8dxg.js";
6
+ import { c as collectBloxData, a as collectBloxSeo, p as provideBloxData, b as provideBloxLocale, B as BLOX_SSR_ROUTE_STATE_KEY, i as installBloxRuntime, s as setActiveLocale } from "../appRuntime-0WTFR_UL.js";
7
7
  import { provideBloxApi, getCollectionResolver } from "../index-I81QTzv-.js";
8
8
  async function renderBloxSsgPage(options) {
9
9
  var _a, _b, _c, _d;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/blox",
3
3
  "type": "module",
4
- "version": "1.15.661",
4
+ "version": "1.15.665",
5
5
  "description": "Blox page builder library for drag-and-drop page building and static data management",
6
6
  "author": {
7
7
  "name": "Bagel Studio",