@bagelink/blox 1.15.476 → 1.15.482

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-DihIptYr.cjs");
3
+ const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-D8-GUEa1.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-DrO2PTcS.js";
1
+ import { _ as _sfc_main } from "./PreviewApp.vue_vue_type_style_index_0_lang-DyLLS9Sb.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 routes = require("./routes-y2qluUdf.cjs");
3
+ const routes = require("./routes-BjJ-PTVC.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 { f as BLOX_REGISTRY_KEY, r as resolveBlockProps, u as useLocale, h as BLOX_RUNTIME_KEY } from "./routes-BLdP650Z.js";
2
+ import { f as BLOX_REGISTRY_KEY, r as resolveBlockProps, u as useLocale, h as BLOX_RUNTIME_KEY } from "./routes-C2hW-M4-.js";
3
3
  function sendToEditor(msg) {
4
4
  window.parent.postMessage(cloneForPostMessage(msg), "*");
5
5
  }
@@ -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;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,MAAM,EAAE,EAC1B,aAAa,EAAE,MAAM,GACnB,IAAI,CA8CN"}
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;AAQvD;;;;;;;;;;;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,CAuEN"}
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-y2qluUdf.cjs");
4
- const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-DihIptYr.cjs");
3
+ const routes = require("./routes-BjJ-PTVC.cjs");
4
+ const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-D8-GUEa1.cjs");
5
5
  const vue = require("vue");
6
6
  const vueRouter = require("vue-router");
7
7
  const pinia = require("pinia");
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { j as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, n as normalizeLink, h as BLOX_RUNTIME_KEY, k as useSeo, l as getRegistryData, m as getItemBySlug, o as getItemById, q as getContentRoute, p as provideBloxData, e as createBlox, g as generateContentRoutes, t as installContentFallback, i as installLocaleAwareResolve, b as setActiveLocale, v as installSmartLinks, w as consumePendingLocaleSwitch } from "./routes-BLdP650Z.js";
2
- import { _, x, y, z, B, A, C, D, E, F, P, G, H, c, d, I, J, K, L, M, N, O, Q, R, S, T, U, r, V, s, W, X, Y, Z } from "./routes-BLdP650Z.js";
3
- import { _ as _2, P as P2, s as s2, a } from "./PreviewApp.vue_vue_type_style_index_0_lang-DrO2PTcS.js";
1
+ import { j as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, n as normalizeLink, h as BLOX_RUNTIME_KEY, k as useSeo, l as getRegistryData, m as getItemBySlug, o as getItemById, q as getContentRoute, p as provideBloxData, e as createBlox, g as generateContentRoutes, t as installContentFallback, i as installLocaleAwareResolve, b as setActiveLocale, v as installSmartLinks, w as consumePendingLocaleSwitch } from "./routes-C2hW-M4-.js";
2
+ import { _, x, y, z, B, A, C, D, E, F, P, G, H, c, d, I, J, K, L, M, N, O, Q, R, S, T, U, r, V, s, W, X, Y, Z } from "./routes-C2hW-M4-.js";
3
+ import { _ as _2, P as P2, s as s2, a } from "./PreviewApp.vue_vue_type_style_index_0_lang-DyLLS9Sb.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";
@@ -912,7 +912,7 @@ class BloxInstance {
912
912
  }
913
913
  router.addRoute({
914
914
  path: "/_blox_preview",
915
- component: () => Promise.resolve().then(() => require("./PreviewApp-DdTJYLaU.cjs")),
915
+ component: () => Promise.resolve().then(() => require("./PreviewApp-BeB8Pc__.cjs")),
916
916
  beforeEnter: () => window.parent !== window ? true : "/"
917
917
  });
918
918
  router.addRoute({ path: "/:pathMatch(.*)*", component: _sfc_main$2 });
@@ -1170,22 +1170,44 @@ function installContentFallback(router, supportedLocales, defaultLocale) {
1170
1170
  const slug = String(to.params.slug ?? "");
1171
1171
  if (!slug) return true;
1172
1172
  const urlLocale = localeOf(to.path);
1173
- const here = await getItemBySlug(registration.collection, slug, urlLocale).catch(() => null);
1173
+ if (hasEmbeddedContentItem(registration.collection, slug, urlLocale)) {
1174
+ return true;
1175
+ }
1176
+ let here;
1177
+ try {
1178
+ here = await getItemBySlug(
1179
+ registration.collection,
1180
+ slug,
1181
+ urlLocale
1182
+ );
1183
+ } catch {
1184
+ return true;
1185
+ }
1174
1186
  if (here) return true;
1175
1187
  for (const sourceLocale of [defaultLocale, ...supportedLocales]) {
1176
1188
  if (sourceLocale === urlLocale) continue;
1177
- const source = await getItemBySlug(
1178
- registration.collection,
1179
- slug,
1180
- sourceLocale
1181
- ).catch(() => null);
1189
+ let source;
1190
+ try {
1191
+ source = await getItemBySlug(
1192
+ registration.collection,
1193
+ slug,
1194
+ sourceLocale
1195
+ );
1196
+ } catch {
1197
+ return true;
1198
+ }
1182
1199
  const id = String((source == null ? void 0 : source.id) ?? (source == null ? void 0 : source._id) ?? "");
1183
1200
  if (!id) continue;
1184
- const target = await getItemById(
1185
- registration.collection,
1186
- id,
1187
- urlLocale
1188
- ).catch(() => null);
1201
+ let target;
1202
+ try {
1203
+ target = await getItemById(
1204
+ registration.collection,
1205
+ id,
1206
+ urlLocale
1207
+ );
1208
+ } catch {
1209
+ return true;
1210
+ }
1189
1211
  const targetSlug = String((target == null ? void 0 : target.slug) ?? "");
1190
1212
  if (!targetSlug) break;
1191
1213
  const barePath = registration.route.replace(/:slug(?=\/|$)/, targetSlug);
@@ -1194,6 +1216,12 @@ function installContentFallback(router, supportedLocales, defaultLocale) {
1194
1216
  return urlLocale === defaultLocale ? "/" : `/${urlLocale}`;
1195
1217
  });
1196
1218
  }
1219
+ function hasEmbeddedContentItem(collection, slug, locale2) {
1220
+ if (typeof window === "undefined") return false;
1221
+ const payload = window[BLOX_DATA_WINDOW_KEY];
1222
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) return false;
1223
+ return `content:${collection}:${slug}:${locale2}` in payload;
1224
+ }
1197
1225
  exports.BLOX_ADMIN_CONFIG_KEY = BLOX_ADMIN_CONFIG_KEY;
1198
1226
  exports.BLOX_CONFIG_KEY = BLOX_CONFIG_KEY;
1199
1227
  exports.BLOX_DATA_KEY = BLOX_DATA_KEY;
@@ -911,7 +911,7 @@ class BloxInstance {
911
911
  }
912
912
  router.addRoute({
913
913
  path: "/_blox_preview",
914
- component: () => import("./PreviewApp-CCP5TufQ.js"),
914
+ component: () => import("./PreviewApp-CsV4ByJ6.js"),
915
915
  beforeEnter: () => window.parent !== window ? true : "/"
916
916
  });
917
917
  router.addRoute({ path: "/:pathMatch(.*)*", component: _sfc_main$2 });
@@ -1169,22 +1169,44 @@ function installContentFallback(router, supportedLocales, defaultLocale) {
1169
1169
  const slug = String(to.params.slug ?? "");
1170
1170
  if (!slug) return true;
1171
1171
  const urlLocale = localeOf(to.path);
1172
- const here = await getItemBySlug(registration.collection, slug, urlLocale).catch(() => null);
1172
+ if (hasEmbeddedContentItem(registration.collection, slug, urlLocale)) {
1173
+ return true;
1174
+ }
1175
+ let here;
1176
+ try {
1177
+ here = await getItemBySlug(
1178
+ registration.collection,
1179
+ slug,
1180
+ urlLocale
1181
+ );
1182
+ } catch {
1183
+ return true;
1184
+ }
1173
1185
  if (here) return true;
1174
1186
  for (const sourceLocale of [defaultLocale, ...supportedLocales]) {
1175
1187
  if (sourceLocale === urlLocale) continue;
1176
- const source = await getItemBySlug(
1177
- registration.collection,
1178
- slug,
1179
- sourceLocale
1180
- ).catch(() => null);
1188
+ let source;
1189
+ try {
1190
+ source = await getItemBySlug(
1191
+ registration.collection,
1192
+ slug,
1193
+ sourceLocale
1194
+ );
1195
+ } catch {
1196
+ return true;
1197
+ }
1181
1198
  const id = String((source == null ? void 0 : source.id) ?? (source == null ? void 0 : source._id) ?? "");
1182
1199
  if (!id) continue;
1183
- const target = await getItemById(
1184
- registration.collection,
1185
- id,
1186
- urlLocale
1187
- ).catch(() => null);
1200
+ let target;
1201
+ try {
1202
+ target = await getItemById(
1203
+ registration.collection,
1204
+ id,
1205
+ urlLocale
1206
+ );
1207
+ } catch {
1208
+ return true;
1209
+ }
1188
1210
  const targetSlug = String((target == null ? void 0 : target.slug) ?? "");
1189
1211
  if (!targetSlug) break;
1190
1212
  const barePath = registration.route.replace(/:slug(?=\/|$)/, targetSlug);
@@ -1193,6 +1215,12 @@ function installContentFallback(router, supportedLocales, defaultLocale) {
1193
1215
  return urlLocale === defaultLocale ? "/" : `/${urlLocale}`;
1194
1216
  });
1195
1217
  }
1218
+ function hasEmbeddedContentItem(collection, slug, locale2) {
1219
+ if (typeof window === "undefined") return false;
1220
+ const payload = window[BLOX_DATA_WINDOW_KEY];
1221
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) return false;
1222
+ return `content:${collection}:${slug}:${locale2}` in payload;
1223
+ }
1196
1224
  export {
1197
1225
  BLOX_LAYOUT_KEY as A,
1198
1226
  BLOX_DATA_WINDOW_KEY as B,
@@ -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-y2qluUdf.cjs");
29
+ const routes = require("../routes-BjJ-PTVC.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 setCollectionResolver, b as setActiveLocale, c as collectBloxData, d as collectBloxSeo, p as provideBloxData, e as createBlox, g as generateContentRoutes, i as installLocaleAwareResolve } from "../routes-BLdP650Z.js";
7
+ import { B as BLOX_DATA_WINDOW_KEY2, s as setApiOrigin, a as setCollectionResolver, b as setActiveLocale, c as collectBloxData, d as collectBloxSeo, p as provideBloxData, e as createBlox, g as generateContentRoutes, i as installLocaleAwareResolve } from "../routes-C2hW-M4-.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.476",
4
+ "version": "1.15.482",
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",