@bagelink/blox 1.15.471 → 1.15.474

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,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-CEh91Yrm.cjs");
3
+ const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-tpv-FEao.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-CeKeWiF0.js";
1
+ import { _ as _sfc_main } from "./PreviewApp.vue_vue_type_style_index_0_lang-BWIYB9Ha.js";
2
2
  export {
3
3
  _sfc_main as default
4
4
  };
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, inject, ref, h, provide, onMounted, onUnmounted, openBlock, createElementBlock, createVNode, unref, nextTick } from "vue";
2
- import { e as BLOX_REGISTRY_KEY, r as resolveBlockProps, u as useLocale, f as BLOX_RUNTIME_KEY } from "./routes-CQJBBmcV.js";
2
+ import { e as BLOX_REGISTRY_KEY, r as resolveBlockProps, u as useLocale, f as BLOX_RUNTIME_KEY } from "./routes-Bs6eosZ6.js";
3
3
  function sendToEditor(msg) {
4
4
  window.parent.postMessage(cloneForPostMessage(msg), "*");
5
5
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const vue = require("vue");
3
- const routes = require("./routes-CKAgyLxC.cjs");
3
+ const routes = require("./routes-DAqHLDK2.cjs");
4
4
  function sendToEditor(msg) {
5
5
  window.parent.postMessage(cloneForPostMessage(msg), "*");
6
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,E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O,CAAC,CAAC,GAAG,IAAI,CAAC,CAMnB;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5D,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,MAAM,EACV,MAAM,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAOnB"}
@@ -5,14 +5,15 @@
5
5
  * using `currentAlternates[targetLocale]` when set (e.g. legal pages with
6
6
  * per-locale paths). Falls back to the current URL slug, then home.
7
7
  * - `toPath(slug)` — returns the locale-aware path for any slug.
8
+ * - `localePath(locale, slug)` — builds a path for an explicit target locale.
8
9
  * - `availableLocales` — locales this page can switch to (CMS alternates when
9
10
  * set; otherwise all strategy locales).
10
11
  * - `detect(path)` — strip locale prefix from a path → `{ locale, slug }`.
11
12
  */
12
13
  export declare function useLocaleNav(): {
13
14
  switchLocale: (targetLocale: string) => void;
14
- localePath: (targetLocale: string) => string;
15
15
  toPath: (slug: string) => string;
16
+ localePath: (targetLocale: string, slug?: string) => string;
16
17
  detect: (path: string) => {
17
18
  locale: string;
18
19
  slug: string;
@@ -1 +1 @@
1
- {"version":3,"file":"useLocaleNav.d.ts","sourceRoot":"","sources":["../../src/composables/useLocaleNav.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY;iCAYS,MAAM;+BA0BR,MAAM,KAAG,MAAM;mBAR3B,MAAM,KAAG,MAAM;mBA2Bf,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;mBAkBpB,MAAM,KAAG,MAAM;+BAOH,MAAM,oBAAe,MAAM;mBAYvC,MAAM,KAAG;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;;;EAa/D"}
@@ -38,11 +38,10 @@ export declare function installLocaleAwareResolve(router: Router, strategy: Loca
38
38
  /**
39
39
  * Cross-locale fallback for content detail routes.
40
40
  *
41
- * If a content URL's slug isn't available in the URL's locale but the entity
42
- * exists in another locale, REDIRECT to that locale's URL (real navigation →
43
- * correct URL, correct hreflang, no content/URL mismatch). Order: URL locale
44
- * default locale any available locale. Only runs for content routes; anything
45
- * unresolved falls through untouched (soft not-found handled by the view).
41
+ * If a content URL's slug isn't available in the URL's locale but identifies an
42
+ * entity in another locale, redirect to that same entity's translated slug.
43
+ * Unknown entities fall back to the requested locale's home instead of leaving
44
+ * a detail URL that renders an empty site shell.
46
45
  */
47
46
  export declare function installContentFallback(router: Router, supportedLocales: string[], defaultLocale: string): void;
48
47
  //# sourceMappingURL=routes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/content/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAOvD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACpC,gBAAgB,EAAE,MAAM,EAAE,EAC1B,aAAa,EAAE,MAAM,GACnB,cAAc,EAAE,CA4BlB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,yBAAyB,CACxC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,cAAc,GACtB,IAAI,CA4BN;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,MAAM,EAAE,EAC1B,aAAa,EAAE,MAAM,GACnB,IAAI,CAsCN"}
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/content/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAOvD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACpC,gBAAgB,EAAE,MAAM,EAAE,EAC1B,aAAa,EAAE,MAAM,GACnB,cAAc,EAAE,CA4BlB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,yBAAyB,CACxC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,cAAc,GACtB,IAAI,CA4BN;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,MAAM,EAAE,EAC1B,aAAa,EAAE,MAAM,GACnB,IAAI,CA8CN"}
@@ -1 +1 @@
1
- {"version":3,"file":"useContentSeo.d.ts","sourceRoot":"","sources":["../../src/content/useContentSeo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAA;AAI3C,OAAO,EAA2B,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAG3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAG7C,KAAK,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAA;AAE/C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAC5B,IAAI,EAAE,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,EAC1C,IAAI,EAAE,MAAM,QAAQ,GAAG,IAAI,GAAG,SAAS,GACrC,IAAI,CAmDN"}
1
+ {"version":3,"file":"useContentSeo.d.ts","sourceRoot":"","sources":["../../src/content/useContentSeo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAA;AAI3C,OAAO,EAA2B,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAG3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAG7C,KAAK,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAA;AAE/C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAC5B,IAAI,EAAE,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,EAC1C,IAAI,EAAE,MAAM,QAAQ,GAAG,IAAI,GAAG,SAAS,GACrC,IAAI,CAqDN"}
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const routes = require("./routes-CKAgyLxC.cjs");
4
- const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-CEh91Yrm.cjs");
3
+ const routes = require("./routes-DAqHLDK2.cjs");
4
+ const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-tpv-FEao.cjs");
5
5
  const vue = require("vue");
6
6
  const vueRouter = require("vue-router");
7
7
  const pinia = require("pinia");
@@ -103,13 +103,10 @@ function useLocaleNav() {
103
103
  const loc = String(locale.value || "").slice(0, 2).toLowerCase();
104
104
  return strategy.toPath(normalized, loc || void 0);
105
105
  }
106
- function localePath(targetLocale) {
107
- if (!strategy) return "/";
108
- const alts = currentAlternates.value;
109
- const hostname = typeof window !== "undefined" ? window.location.hostname : "";
110
- const { slug: currentSlug } = strategy.detect(hostname, router.currentRoute.value.path);
111
- const alternateSlug = alts[targetLocale] ?? alts[strategy.defaultLocale] ?? currentSlug ?? "/";
112
- return strategy.toPath(alternateSlug, targetLocale);
106
+ function localePath(targetLocale, slug = "/") {
107
+ const normalized = routes.normalizeLink(slug) ?? slug;
108
+ if (!strategy) return normalized;
109
+ return strategy.toPath(normalized, targetLocale);
113
110
  }
114
111
  function detect(path) {
115
112
  const def = (strategy == null ? void 0 : strategy.defaultLocale) ?? String(locale.value || "en");
@@ -122,7 +119,7 @@ function useLocaleNav() {
122
119
  }
123
120
  return { locale: def, slug: path || "/" };
124
121
  }
125
- return { switchLocale, localePath, toPath, detect, availableLocales, locale };
122
+ return { switchLocale, toPath, localePath, detect, availableLocales, locale };
126
123
  }
127
124
  function usePageContext(key) {
128
125
  const contexts = vue.inject("contexts");
@@ -162,7 +159,8 @@ function useContentSeo(item, head) {
162
159
  if (!reg) return;
163
160
  const slug = String(((_a = route == null ? void 0 : route.params) == null ? void 0 : _a.slug) ?? ((_b = vue.toValue(item)) == null ? void 0 : _b.slug) ?? "");
164
161
  const activeLoc = String(locale.value || "en").slice(0, 2).toLowerCase();
165
- const entity = slug ? await routes.getItemBySlug(reg.collection, slug, activeLoc).catch(() => null) : vue.toValue(item);
162
+ const activeItem = vue.toValue(item);
163
+ const entity = activeItem ?? (slug ? await routes.getItemBySlug(reg.collection, slug, activeLoc).catch(() => null) : null);
166
164
  if (!entity) return;
167
165
  const id = String(entity.id ?? entity._id ?? "");
168
166
  const supported = (strategy == null ? void 0 : strategy.locales) ?? [locale.value];
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { h as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, n as normalizeLink, f as BLOX_RUNTIME_KEY, j as useSeo, k as getRegistryData, l as getItemBySlug, m as getItemById, o as getContentRoute, p as provideBloxData, d as createBlox, g as generateContentRoutes, q as installContentFallback, i as installLocaleAwareResolve, a as setActiveLocale, t as installSmartLinks, v as consumePendingLocaleSwitch } from "./routes-CQJBBmcV.js";
2
- import { _, w, x, y, B, z, A, C, D, E, P, F, G, c, b, H, I, J, K, L, M, N, O, Q, R, S, T, r, U, s, V, W, X, Y } from "./routes-CQJBBmcV.js";
3
- import { _ as _2, P as P2, s as s2, a } from "./PreviewApp.vue_vue_type_style_index_0_lang-CeKeWiF0.js";
1
+ import { h as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, n as normalizeLink, f as BLOX_RUNTIME_KEY, j as useSeo, k as getRegistryData, l as getItemBySlug, m as getItemById, o as getContentRoute, p as provideBloxData, d as createBlox, g as generateContentRoutes, q as installContentFallback, i as installLocaleAwareResolve, a as setActiveLocale, t as installSmartLinks, v as consumePendingLocaleSwitch } from "./routes-Bs6eosZ6.js";
2
+ import { _, w, x, y, B, z, A, C, D, E, P, F, G, c, b, H, I, J, K, L, M, N, O, Q, R, S, T, r, U, s, V, W, X, Y } from "./routes-Bs6eosZ6.js";
3
+ import { _ as _2, P as P2, s as s2, a } from "./PreviewApp.vue_vue_type_style_index_0_lang-BWIYB9Ha.js";
4
4
  import { defineComponent, resolveComponent, openBlock, createBlock, withCtx, Transition, resolveDynamicComponent, inject, ref, watch, onMounted, onUnmounted, computed, onServerPrefetch, toValue, createApp, h, Suspense, markRaw } from "vue";
5
5
  import { useRouter, useRoute } from "vue-router";
6
6
  import { createPinia } from "pinia";
@@ -102,13 +102,10 @@ function useLocaleNav() {
102
102
  const loc = String(locale.value || "").slice(0, 2).toLowerCase();
103
103
  return strategy.toPath(normalized, loc || void 0);
104
104
  }
105
- function localePath(targetLocale) {
106
- if (!strategy) return "/";
107
- const alts = currentAlternates.value;
108
- const hostname = typeof window !== "undefined" ? window.location.hostname : "";
109
- const { slug: currentSlug } = strategy.detect(hostname, router.currentRoute.value.path);
110
- const alternateSlug = alts[targetLocale] ?? alts[strategy.defaultLocale] ?? currentSlug ?? "/";
111
- return strategy.toPath(alternateSlug, targetLocale);
105
+ function localePath(targetLocale, slug = "/") {
106
+ const normalized = normalizeLink(slug) ?? slug;
107
+ if (!strategy) return normalized;
108
+ return strategy.toPath(normalized, targetLocale);
112
109
  }
113
110
  function detect(path) {
114
111
  const def = (strategy == null ? void 0 : strategy.defaultLocale) ?? String(locale.value || "en");
@@ -121,7 +118,7 @@ function useLocaleNav() {
121
118
  }
122
119
  return { locale: def, slug: path || "/" };
123
120
  }
124
- return { switchLocale, localePath, toPath, detect, availableLocales, locale };
121
+ return { switchLocale, toPath, localePath, detect, availableLocales, locale };
125
122
  }
126
123
  function usePageContext(key) {
127
124
  const contexts = inject("contexts");
@@ -161,7 +158,8 @@ function useContentSeo(item, head) {
161
158
  if (!reg) return;
162
159
  const slug = String(((_a = route == null ? void 0 : route.params) == null ? void 0 : _a.slug) ?? ((_b = toValue(item)) == null ? void 0 : _b.slug) ?? "");
163
160
  const activeLoc = String(locale.value || "en").slice(0, 2).toLowerCase();
164
- const entity = slug ? await getItemBySlug(reg.collection, slug, activeLoc).catch(() => null) : toValue(item);
161
+ const activeItem = toValue(item);
162
+ const entity = activeItem ?? (slug ? await getItemBySlug(reg.collection, slug, activeLoc).catch(() => null) : null);
165
163
  if (!entity) return;
166
164
  const id = String(entity.id ?? entity._id ?? "");
167
165
  const supported = (strategy == null ? void 0 : strategy.locales) ?? [locale.value];
@@ -74,14 +74,17 @@ async function listItems(collection, { locale: locale2, q, offset = 0, limit = 1
74
74
  });
75
75
  }
76
76
  async function getItemBySlug(collection, slug, locale2) {
77
- const res = await listItems(collection, { locale: locale2, q: `slug eq "${slug}"`, limit: 1 });
77
+ const res = await listItems(collection, { locale: locale2, limit: 1e3 });
78
78
  const items = Array.isArray(res) ? res : (res == null ? void 0 : res.items) ?? [];
79
- return items[0] ?? null;
79
+ return items.find((item) => String((item == null ? void 0 : item.slug) ?? "") === slug) ?? null;
80
80
  }
81
81
  async function getItemById(collection, id, locale2) {
82
- const res = await listItems(collection, { locale: locale2, q: `id eq "${id}"`, limit: 1 });
82
+ const res = await listItems(collection, { locale: locale2, limit: 1e3 });
83
83
  const items = Array.isArray(res) ? res : (res == null ? void 0 : res.items) ?? [];
84
- return items[0] ?? null;
84
+ return items.find((item) => {
85
+ const record = item;
86
+ return String((record == null ? void 0 : record.id) ?? (record == null ? void 0 : record._id) ?? "") === id;
87
+ }) ?? null;
85
88
  }
86
89
  const BLOX_REGISTRY_KEY = Symbol("blox:registry");
87
90
  const BLOX_CONFIG_KEY = Symbol("blox:config");
@@ -901,7 +904,7 @@ class BloxInstance {
901
904
  }
902
905
  router.addRoute({
903
906
  path: "/_blox_preview",
904
- component: () => import("./PreviewApp-WPsOZrDv.js"),
907
+ component: () => import("./PreviewApp-CTq4OGBA.js"),
905
908
  beforeEnter: () => window.parent !== window ? true : "/"
906
909
  });
907
910
  router.addRoute({ path: "/:pathMatch(.*)*", component: _sfc_main$2 });
@@ -1161,17 +1164,26 @@ function installContentFallback(router, supportedLocales, defaultLocale) {
1161
1164
  const urlLocale = localeOf(to.path);
1162
1165
  const here = await getItemBySlug(registration.collection, slug, urlLocale).catch(() => null);
1163
1166
  if (here) return true;
1164
- const probe = await getItemBySlug(registration.collection, slug).catch(() => null);
1165
- const available = Array.isArray(probe == null ? void 0 : probe.available_locales) ? probe.available_locales : [];
1166
- const target = [defaultLocale, ...supportedLocales].find(
1167
- (l) => l !== urlLocale && available.includes(l)
1168
- );
1169
- if (!target || !probe) return true;
1170
- const targetItem = await getItemBySlug(registration.collection, slug, target).catch(() => null);
1171
- const targetSlug = String((targetItem == null ? void 0 : targetItem.slug) ?? slug);
1172
- const barePath = registration.route.replace(/:slug(?=\/|$)/, targetSlug);
1173
- const redirect = target === defaultLocale ? barePath : `/${target}${barePath}`;
1174
- return redirect;
1167
+ for (const sourceLocale of [defaultLocale, ...supportedLocales]) {
1168
+ if (sourceLocale === urlLocale) continue;
1169
+ const source = await getItemBySlug(
1170
+ registration.collection,
1171
+ slug,
1172
+ sourceLocale
1173
+ ).catch(() => null);
1174
+ const id = String((source == null ? void 0 : source.id) ?? (source == null ? void 0 : source._id) ?? "");
1175
+ if (!id) continue;
1176
+ const target = await getItemById(
1177
+ registration.collection,
1178
+ id,
1179
+ urlLocale
1180
+ ).catch(() => null);
1181
+ const targetSlug = String((target == null ? void 0 : target.slug) ?? "");
1182
+ if (!targetSlug) break;
1183
+ const barePath = registration.route.replace(/:slug(?=\/|$)/, targetSlug);
1184
+ return urlLocale === defaultLocale ? barePath : `/${urlLocale}${barePath}`;
1185
+ }
1186
+ return urlLocale === defaultLocale ? "/" : `/${urlLocale}`;
1175
1187
  });
1176
1188
  }
1177
1189
  export {
@@ -75,14 +75,17 @@ async function listItems(collection, { locale: locale2, q, offset = 0, limit = 1
75
75
  });
76
76
  }
77
77
  async function getItemBySlug(collection, slug, locale2) {
78
- const res = await listItems(collection, { locale: locale2, q: `slug eq "${slug}"`, limit: 1 });
78
+ const res = await listItems(collection, { locale: locale2, limit: 1e3 });
79
79
  const items = Array.isArray(res) ? res : (res == null ? void 0 : res.items) ?? [];
80
- return items[0] ?? null;
80
+ return items.find((item) => String((item == null ? void 0 : item.slug) ?? "") === slug) ?? null;
81
81
  }
82
82
  async function getItemById(collection, id, locale2) {
83
- const res = await listItems(collection, { locale: locale2, q: `id eq "${id}"`, limit: 1 });
83
+ const res = await listItems(collection, { locale: locale2, limit: 1e3 });
84
84
  const items = Array.isArray(res) ? res : (res == null ? void 0 : res.items) ?? [];
85
- return items[0] ?? null;
85
+ return items.find((item) => {
86
+ const record = item;
87
+ return String((record == null ? void 0 : record.id) ?? (record == null ? void 0 : record._id) ?? "") === id;
88
+ }) ?? null;
86
89
  }
87
90
  const BLOX_REGISTRY_KEY = Symbol("blox:registry");
88
91
  const BLOX_CONFIG_KEY = Symbol("blox:config");
@@ -902,7 +905,7 @@ class BloxInstance {
902
905
  }
903
906
  router.addRoute({
904
907
  path: "/_blox_preview",
905
- component: () => Promise.resolve().then(() => require("./PreviewApp-C9oZu-7e.cjs")),
908
+ component: () => Promise.resolve().then(() => require("./PreviewApp-C3lNxUYR.cjs")),
906
909
  beforeEnter: () => window.parent !== window ? true : "/"
907
910
  });
908
911
  router.addRoute({ path: "/:pathMatch(.*)*", component: _sfc_main$2 });
@@ -1162,17 +1165,26 @@ function installContentFallback(router, supportedLocales, defaultLocale) {
1162
1165
  const urlLocale = localeOf(to.path);
1163
1166
  const here = await getItemBySlug(registration.collection, slug, urlLocale).catch(() => null);
1164
1167
  if (here) return true;
1165
- const probe = await getItemBySlug(registration.collection, slug).catch(() => null);
1166
- const available = Array.isArray(probe == null ? void 0 : probe.available_locales) ? probe.available_locales : [];
1167
- const target = [defaultLocale, ...supportedLocales].find(
1168
- (l) => l !== urlLocale && available.includes(l)
1169
- );
1170
- if (!target || !probe) return true;
1171
- const targetItem = await getItemBySlug(registration.collection, slug, target).catch(() => null);
1172
- const targetSlug = String((targetItem == null ? void 0 : targetItem.slug) ?? slug);
1173
- const barePath = registration.route.replace(/:slug(?=\/|$)/, targetSlug);
1174
- const redirect = target === defaultLocale ? barePath : `/${target}${barePath}`;
1175
- return redirect;
1168
+ for (const sourceLocale of [defaultLocale, ...supportedLocales]) {
1169
+ if (sourceLocale === urlLocale) continue;
1170
+ const source = await getItemBySlug(
1171
+ registration.collection,
1172
+ slug,
1173
+ sourceLocale
1174
+ ).catch(() => null);
1175
+ const id = String((source == null ? void 0 : source.id) ?? (source == null ? void 0 : source._id) ?? "");
1176
+ if (!id) continue;
1177
+ const target = await getItemById(
1178
+ registration.collection,
1179
+ id,
1180
+ urlLocale
1181
+ ).catch(() => null);
1182
+ const targetSlug = String((target == null ? void 0 : target.slug) ?? "");
1183
+ if (!targetSlug) break;
1184
+ const barePath = registration.route.replace(/:slug(?=\/|$)/, targetSlug);
1185
+ return urlLocale === defaultLocale ? barePath : `/${urlLocale}${barePath}`;
1186
+ }
1187
+ return urlLocale === defaultLocale ? "/" : `/${urlLocale}`;
1176
1188
  });
1177
1189
  }
1178
1190
  exports.BLOX_ADMIN_CONFIG_KEY = BLOX_ADMIN_CONFIG_KEY;
@@ -26,7 +26,7 @@ const llmArtifacts = require("../prerender-JdRKimQ5.cjs");
26
26
  const ssg_client = require("./client.cjs");
27
27
  const pinia = require("pinia");
28
28
  const vue = require("vue");
29
- const routes = require("../routes-CKAgyLxC.cjs");
29
+ const routes = require("../routes-DAqHLDK2.cjs");
30
30
  async function renderBloxSsgPage(options) {
31
31
  var _a, _b, _c;
32
32
  const {
@@ -4,7 +4,7 @@ import { BLOX_STATE_WINDOW_KEY, BLOX_WEBSITE_ID_WINDOW_KEY } from "./client.mjs"
4
4
  import { BLOX_COLLECTIONS_WINDOW_KEY, BLOX_DATA_WINDOW_KEY, BLOX_PAGE_SEO_WINDOW_KEY, getCollectionCache, getEmbeddedWebsiteId, installBloxStateCache, installCollectionCache } from "./client.mjs";
5
5
  import { createPinia } from "pinia";
6
6
  import { createSSRApp, h, Suspense, markRaw } from "vue";
7
- import { B as BLOX_DATA_WINDOW_KEY2, s as setApiOrigin, a as setActiveLocale, c as collectBloxData, b as collectBloxSeo, p as provideBloxData, d as createBlox, g as generateContentRoutes, i as installLocaleAwareResolve } from "../routes-CQJBBmcV.js";
7
+ import { B as BLOX_DATA_WINDOW_KEY2, s as setApiOrigin, a as setActiveLocale, c as collectBloxData, b as collectBloxSeo, p as provideBloxData, d as createBlox, g as generateContentRoutes, i as installLocaleAwareResolve } from "../routes-Bs6eosZ6.js";
8
8
  async function renderBloxSsgPage(options) {
9
9
  var _a, _b, _c;
10
10
  const {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/blox",
3
3
  "type": "module",
4
- "version": "1.15.471",
4
+ "version": "1.15.474",
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",