@bagelink/blox 1.15.657 → 1.15.659

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":";AAqjBA,wBAMG"}
1
+ {"version":3,"file":"CmsPageView.vue.d.ts","sourceRoot":"","sources":["../src/CmsPageView.vue"],"names":[],"mappings":";AAioBA,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-BNAjDevX.cjs");
3
+ const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-BunY96Db.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-C8ZUqyan.js";
1
+ import { _ as _sfc_main } from "./PreviewApp.vue_vue_type_style_index_0_lang-DNNMZc3y.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-D2R6KNSO.cjs");
3
+ const appRuntime = require("./appRuntime-wuyiLmzO.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-D6mBmhEl.js";
2
+ import { d as BLOX_REGISTRY_KEY, r as resolveBlockProps, u as useLocale, e as BLOX_RUNTIME_KEY } from "./appRuntime-GZNiXRKQ.js";
3
3
  function sendToEditor(msg) {
4
4
  window.parent.postMessage(cloneForPostMessage(msg), "*");
5
5
  }
@@ -315,6 +315,22 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
315
315
  function currentRouteTarget(fallback) {
316
316
  return typeof (route == null ? void 0 : route.fullPath) === "string" && route.fullPath ? route.fullPath : currentRoutePath() || fallback;
317
317
  }
318
+ function homePath(localeCode) {
319
+ if (strategy) return strategy.toPath("/", localeCode);
320
+ return localeCode === "en" ? "/" : `/${localeCode}`;
321
+ }
322
+ function hasUnresolvedBinding(resolved) {
323
+ var _a2;
324
+ const bindings = (_a2 = resolved.page) == null ? void 0 : _a2.data_bindings;
325
+ if (!bindings) return false;
326
+ const boundKeys = Object.keys(bindings).filter((key) => key !== "$website");
327
+ if (!boundKeys.length) return false;
328
+ const contexts2 = resolved.contexts ?? {};
329
+ return boundKeys.some((key) => {
330
+ const value = contexts2[key];
331
+ return value === null || value === void 0;
332
+ });
333
+ }
318
334
  function tryHydrateFromState(path) {
319
335
  var _a2;
320
336
  if ((ssrRouteState == null ? void 0 : ssrRouteState.path) === path && ssrRouteState.resolved) {
@@ -373,6 +389,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
373
389
  navigating.value = true;
374
390
  try {
375
391
  const resolved = await ((api == null ? void 0 : api.resolvePath(slug, urlLocale)) ?? resolvePath(slug, urlLocale));
392
+ if (hasUnresolvedBinding(resolved)) {
393
+ await router.replace(homePath(urlLocale));
394
+ return;
395
+ }
376
396
  blocks.value = ((_a2 = resolved.page.content) == null ? void 0 : _a2.blocks) ?? [];
377
397
  contexts.value = resolved.contexts ?? {};
378
398
  currentPageId.value = resolved.page.id ?? null;
@@ -381,8 +401,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
381
401
  } catch (e) {
382
402
  const msg = e instanceof Error ? e.message : String(e);
383
403
  if (msg.includes("404")) {
384
- const home = strategy ? strategy.toPath("/", urlLocale) : `/${urlLocale === "en" ? "" : urlLocale}`;
385
- await router.replace(home);
404
+ await router.replace(homePath(urlLocale));
386
405
  } else {
387
406
  error.value = msg;
388
407
  }
@@ -872,7 +891,7 @@ class BloxInstance {
872
891
  router.addRoute({
873
892
  path: "/_blox_preview",
874
893
  name: BLOX_PREVIEW_ROUTE_NAME,
875
- component: () => import("./PreviewApp-BTXBGqk_.js"),
894
+ component: () => import("./PreviewApp-HmKWAJlr.js"),
876
895
  beforeEnter: () => typeof window === "undefined" || window.parent !== window ? true : "/"
877
896
  });
878
897
  }
@@ -316,6 +316,22 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
316
316
  function currentRouteTarget(fallback) {
317
317
  return typeof (route == null ? void 0 : route.fullPath) === "string" && route.fullPath ? route.fullPath : currentRoutePath() || fallback;
318
318
  }
319
+ function homePath(localeCode) {
320
+ if (strategy) return strategy.toPath("/", localeCode);
321
+ return localeCode === "en" ? "/" : `/${localeCode}`;
322
+ }
323
+ function hasUnresolvedBinding(resolved) {
324
+ var _a2;
325
+ const bindings = (_a2 = resolved.page) == null ? void 0 : _a2.data_bindings;
326
+ if (!bindings) return false;
327
+ const boundKeys = Object.keys(bindings).filter((key) => key !== "$website");
328
+ if (!boundKeys.length) return false;
329
+ const contexts2 = resolved.contexts ?? {};
330
+ return boundKeys.some((key) => {
331
+ const value = contexts2[key];
332
+ return value === null || value === void 0;
333
+ });
334
+ }
319
335
  function tryHydrateFromState(path) {
320
336
  var _a2;
321
337
  if ((ssrRouteState == null ? void 0 : ssrRouteState.path) === path && ssrRouteState.resolved) {
@@ -374,6 +390,10 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
374
390
  navigating.value = true;
375
391
  try {
376
392
  const resolved = await ((api == null ? void 0 : api.resolvePath(slug, urlLocale)) ?? index.resolvePath(slug, urlLocale));
393
+ if (hasUnresolvedBinding(resolved)) {
394
+ await router.replace(homePath(urlLocale));
395
+ return;
396
+ }
377
397
  blocks.value = ((_a2 = resolved.page.content) == null ? void 0 : _a2.blocks) ?? [];
378
398
  contexts.value = resolved.contexts ?? {};
379
399
  currentPageId.value = resolved.page.id ?? null;
@@ -382,8 +402,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
382
402
  } catch (e) {
383
403
  const msg = e instanceof Error ? e.message : String(e);
384
404
  if (msg.includes("404")) {
385
- const home = strategy ? strategy.toPath("/", urlLocale) : `/${urlLocale === "en" ? "" : urlLocale}`;
386
- await router.replace(home);
405
+ await router.replace(homePath(urlLocale));
387
406
  } else {
388
407
  error.value = msg;
389
408
  }
@@ -873,7 +892,7 @@ class BloxInstance {
873
892
  router.addRoute({
874
893
  path: "/_blox_preview",
875
894
  name: BLOX_PREVIEW_ROUTE_NAME,
876
- component: () => Promise.resolve().then(() => require("./PreviewApp-_AiXsd8B.cjs")),
895
+ component: () => Promise.resolve().then(() => require("./PreviewApp-6SFipygX.cjs")),
877
896
  beforeEnter: () => typeof window === "undefined" || window.parent !== window ? true : "/"
878
897
  });
879
898
  }
@@ -1 +1 @@
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"}
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"}
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-BNAjDevX.cjs");
5
- const appRuntime = require("./appRuntime-D2R6KNSO.cjs");
4
+ const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-BunY96Db.cjs");
5
+ const appRuntime = require("./appRuntime-wuyiLmzO.cjs");
6
6
  const vue = require("vue");
7
7
  const ssg_client = require("./client-AoDTJJXJ.cjs");
8
8
  const vueRouter = require("vue-router");
@@ -139,9 +139,7 @@ function useLocaleNav() {
139
139
  function switchLocale(targetLocale) {
140
140
  if (!strategy) return;
141
141
  const alts = currentAlternates.value;
142
- const hostname = typeof window !== "undefined" ? window.location.hostname : "";
143
- const { slug: currentSlug } = strategy.detect(hostname, router.currentRoute.value.path);
144
- const alternateSlug = alts[targetLocale] ?? alts[strategy.defaultLocale] ?? currentSlug ?? "/";
142
+ const alternateSlug = alts[targetLocale] ?? "/";
145
143
  strategy.switchTo(targetLocale, alternateSlug, router);
146
144
  }
147
145
  function toPath(slug) {
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-C8ZUqyan.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-D6mBmhEl.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-D6mBmhEl.js";
3
+ import { _, P, s, a } from "./PreviewApp.vue_vue_type_style_index_0_lang-DNNMZc3y.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-GZNiXRKQ.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-GZNiXRKQ.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";
@@ -139,9 +139,7 @@ function useLocaleNav() {
139
139
  function switchLocale(targetLocale) {
140
140
  if (!strategy) return;
141
141
  const alts = currentAlternates.value;
142
- const hostname = typeof window !== "undefined" ? window.location.hostname : "";
143
- const { slug: currentSlug } = strategy.detect(hostname, router.currentRoute.value.path);
144
- const alternateSlug = alts[targetLocale] ?? alts[strategy.defaultLocale] ?? currentSlug ?? "/";
142
+ const alternateSlug = alts[targetLocale] ?? "/";
145
143
  strategy.switchTo(targetLocale, alternateSlug, router);
146
144
  }
147
145
  function toPath(slug) {
@@ -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-D2R6KNSO.cjs");
29
+ const appRuntime = require("../appRuntime-wuyiLmzO.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-D6mBmhEl.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-GZNiXRKQ.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.657",
4
+ "version": "1.15.659",
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",