@bagelink/blox 1.15.627 → 1.15.631
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/{PreviewApp-DcD_Cjzn.js → PreviewApp-DQ5p-pJu.js} +1 -1
- package/dist/{PreviewApp-5XGQVrnd.cjs → PreviewApp-j062gN6d.cjs} +1 -1
- package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-OZtgkMXq.cjs → PreviewApp.vue_vue_type_style_index_0_lang-B9_7wgnw.cjs} +1 -1
- package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-m2TIr6Wk.js → PreviewApp.vue_vue_type_style_index_0_lang-DCYf0VuH.js} +1 -1
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/{appRuntime-BqvP0NaP.cjs → appRuntime-BWlOTcQo.cjs} +13 -210
- package/dist/{appRuntime-FphnGcV2.js → appRuntime-DEeCouh7.js} +38 -235
- package/dist/{client-XQnL-B6N.js → client-Ce9fRCGH.js} +2 -2
- package/dist/index.cjs +23 -19
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +52 -47
- package/dist/pageTitle-DyJ9r6xJ.cjs +268 -0
- package/dist/pageTitle-tOzMNilm.js +269 -0
- package/dist/{shard-runner-CinJMC5z.cjs → shard-runner-BJ7J4qF3.cjs} +2 -2
- package/dist/{shard-runner-C7_xAkA1.js → shard-runner-BSUEe9p3.js} +2 -2
- package/dist/ssg/cli.cjs +8 -2
- package/dist/ssg/cli.mjs +8 -2
- package/dist/ssg/client.mjs +2 -2
- package/dist/ssg/cms-routes.d.ts +19 -0
- package/dist/ssg/cms-routes.d.ts.map +1 -1
- package/dist/ssg/createSSREntry.d.ts +2 -0
- package/dist/ssg/createSSREntry.d.ts.map +1 -1
- package/dist/ssg/index.cjs +10 -5
- package/dist/ssg/index.mjs +25 -20
- package/dist/{validate-output-e0E998g_.js → validate-output-CRv_cnji.js} +44 -24
- package/dist/{validate-output-DQTw64Rc.cjs → validate-output-oVFDwKIA.cjs} +24 -4
- package/package.json +1 -1
- package/dist/pageTitle-BOTMH-D8.js +0 -56
- package/dist/pageTitle-nIl1cDfD.cjs +0 -55
|
@@ -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-
|
|
3
|
+
const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-B9_7wgnw.cjs");
|
|
4
4
|
exports.default = PreviewApp_vue_vue_type_style_index_0_lang._sfc_main;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, inject, ref, h, provide, onMounted, onUnmounted, openBlock, createElementBlock, createVNode, unref, nextTick } from "vue";
|
|
2
|
-
import {
|
|
2
|
+
import { d as BLOX_REGISTRY_KEY, r as resolveBlockProps, u as useLocale, e as BLOX_RUNTIME_KEY } from "./appRuntime-DEeCouh7.js";
|
|
3
3
|
function sendToEditor(msg) {
|
|
4
4
|
window.parent.postMessage(cloneForPostMessage(msg), "*");
|
|
5
5
|
}
|
package/dist/api/index.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export declare function configureApi(websiteName: string, store: string): void;
|
|
|
27
27
|
export declare function setApiOrigin(base: string): void;
|
|
28
28
|
/** Use an immutable build-time collection source instead of HTTP during SSR. */
|
|
29
29
|
export declare function setCollectionResolver(resolver: CollectionResolver | null): void;
|
|
30
|
+
/** Read the active build-time collection resolver (SSG bulk-loaded data). */
|
|
31
|
+
export declare function getCollectionResolver(): CollectionResolver | null;
|
|
30
32
|
export declare function createBloxApi(options: BloxApiOptions): BloxApiClient;
|
|
31
33
|
export declare function provideBloxApi(app: App, options: BloxApiOptions): BloxApiClient;
|
|
32
34
|
export declare function useBloxApi(): BloxApiClient | null;
|
package/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,wBAAgB,sBAAsB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjE,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,gBAAqB,GAC5B,OAAO,CAAC,mBAAmB,GAAG;IAAE,KAAK,EAAE,CAAC,EAAE,CAAA;CAAE,CAAC,CAE/C"}
|
|
@@ -4,196 +4,10 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
const pinia = require("pinia");
|
|
6
6
|
const vue = require("vue");
|
|
7
|
-
const
|
|
7
|
+
const pageTitle = require("./pageTitle-DyJ9r6xJ.cjs");
|
|
8
8
|
const vueRouter = require("vue-router");
|
|
9
9
|
const vue$1 = require("@bagelink/vue");
|
|
10
|
-
const
|
|
11
|
-
let BASE = "/api";
|
|
12
|
-
let _websiteName = "";
|
|
13
|
-
let _store = "";
|
|
14
|
-
let _websiteId = null;
|
|
15
|
-
let _origin = "";
|
|
16
|
-
const BLOX_API_KEY = Symbol("blox:api");
|
|
17
|
-
function configureApi(websiteName, store) {
|
|
18
|
-
_websiteName = websiteName;
|
|
19
|
-
_store = store;
|
|
20
|
-
_websiteId = null;
|
|
21
|
-
}
|
|
22
|
-
function setApiOrigin(base) {
|
|
23
|
-
if (!base) return;
|
|
24
|
-
try {
|
|
25
|
-
const u = new URL(base);
|
|
26
|
-
_origin = u.origin;
|
|
27
|
-
BASE = u.pathname && u.pathname !== "/" ? u.pathname.replace(/\/$/, "") : "";
|
|
28
|
-
} catch {
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
function apiBase(base = "/api", origin = "") {
|
|
32
|
-
if (!origin) return { base, origin };
|
|
33
|
-
try {
|
|
34
|
-
const url = new URL(origin);
|
|
35
|
-
return {
|
|
36
|
-
origin: url.origin,
|
|
37
|
-
base: url.pathname && url.pathname !== "/" ? url.pathname.replace(/\/$/, "") : ""
|
|
38
|
-
};
|
|
39
|
-
} catch {
|
|
40
|
-
return { base, origin: "" };
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function createBloxApi(options) {
|
|
44
|
-
const configured = apiBase("/api", options.origin);
|
|
45
|
-
let websiteId = null;
|
|
46
|
-
async function scopedRequest(path, { locale: locale2, params, ...opts } = {}) {
|
|
47
|
-
const origin = configured.origin || (typeof window !== "undefined" ? window.location.origin : "");
|
|
48
|
-
const url = new URL(`${configured.base}${path}`, origin || void 0);
|
|
49
|
-
if (locale2) url.searchParams.set("locale", locale2);
|
|
50
|
-
if (params) {
|
|
51
|
-
for (const [key, value] of Object.entries(params)) url.searchParams.set(key, String(value));
|
|
52
|
-
}
|
|
53
|
-
const response = await fetch(url.toString(), opts);
|
|
54
|
-
if (!response.ok) throw new Error(`API ${response.status}: ${path}`);
|
|
55
|
-
if (response.status === 204) return null;
|
|
56
|
-
return response.json();
|
|
57
|
-
}
|
|
58
|
-
function getWebsiteIdSync2() {
|
|
59
|
-
var _a;
|
|
60
|
-
if (websiteId) return websiteId;
|
|
61
|
-
return ((_a = ssg_client.readBloxHydration()) == null ? void 0 : _a.websiteId) ?? null;
|
|
62
|
-
}
|
|
63
|
-
async function getWebsiteId2() {
|
|
64
|
-
const existing = getWebsiteIdSync2();
|
|
65
|
-
if (existing) {
|
|
66
|
-
websiteId = existing;
|
|
67
|
-
return existing;
|
|
68
|
-
}
|
|
69
|
-
try {
|
|
70
|
-
const website = await scopedRequest(
|
|
71
|
-
`/blox/sites/${encodeURIComponent(options.websiteName)}`
|
|
72
|
-
);
|
|
73
|
-
websiteId = website.id;
|
|
74
|
-
return website.id;
|
|
75
|
-
} catch {
|
|
76
|
-
throw new Error(`Website "${options.websiteName}" not found. Run: npm run seed`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
async function listItems2(collection, { locale: locale2, q, offset = 0, limit = 100 } = {}) {
|
|
80
|
-
if (options.collectionResolver) {
|
|
81
|
-
return await options.collectionResolver(collection, {
|
|
82
|
-
locale: locale2,
|
|
83
|
-
q,
|
|
84
|
-
offset,
|
|
85
|
-
limit
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
return scopedRequest(`/datastore/${options.store}/collections/${collection}`, {
|
|
89
|
-
locale: locale2,
|
|
90
|
-
params: { ...q ? { q } : {}, offset, limit }
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
return {
|
|
94
|
-
getWebsiteIdSync: getWebsiteIdSync2,
|
|
95
|
-
getWebsiteId: getWebsiteId2,
|
|
96
|
-
resolvePath: async (path, locale2) => {
|
|
97
|
-
const id = await getWebsiteId2();
|
|
98
|
-
return scopedRequest(`/blox/websites/${id}/resolve-path`, {
|
|
99
|
-
locale: locale2,
|
|
100
|
-
params: { path }
|
|
101
|
-
});
|
|
102
|
-
},
|
|
103
|
-
listItems: listItems2,
|
|
104
|
-
getItemBySlug: async (collection, slug, locale2) => {
|
|
105
|
-
const result = await listItems2(collection, { locale: locale2, limit: 1e3 });
|
|
106
|
-
const items = Array.isArray(result) ? result : (result == null ? void 0 : result.items) ?? [];
|
|
107
|
-
return items.find((item) => String((item == null ? void 0 : item.slug) ?? "") === slug) ?? null;
|
|
108
|
-
},
|
|
109
|
-
getItemById: async (collection, id, locale2) => {
|
|
110
|
-
const result = await listItems2(collection, { locale: locale2, limit: 1e3 });
|
|
111
|
-
const items = Array.isArray(result) ? result : (result == null ? void 0 : result.items) ?? [];
|
|
112
|
-
return items.find((item) => {
|
|
113
|
-
const record = item;
|
|
114
|
-
return String((record == null ? void 0 : record.id) ?? (record == null ? void 0 : record._id) ?? "") === id;
|
|
115
|
-
}) ?? null;
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
function provideBloxApi(app, options) {
|
|
120
|
-
const client = createBloxApi(options);
|
|
121
|
-
app.provide(BLOX_API_KEY, client);
|
|
122
|
-
return client;
|
|
123
|
-
}
|
|
124
|
-
function useBloxApi() {
|
|
125
|
-
return vue.getCurrentInstance() ? vue.inject(BLOX_API_KEY, null) : null;
|
|
126
|
-
}
|
|
127
|
-
async function request(path, { locale: locale2, params, ...opts } = {}) {
|
|
128
|
-
const origin = _origin || (typeof window !== "undefined" ? window.location.origin : "");
|
|
129
|
-
const url = new URL(`${BASE}${path}`, origin || void 0);
|
|
130
|
-
if (locale2) url.searchParams.set("locale", locale2);
|
|
131
|
-
if (params) {
|
|
132
|
-
for (const [k, v] of Object.entries(params)) url.searchParams.set(k, String(v));
|
|
133
|
-
}
|
|
134
|
-
const res = await fetch(url.toString(), opts);
|
|
135
|
-
if (!res.ok) throw new Error(`API ${res.status}: ${path}`);
|
|
136
|
-
if (res.status === 204) return null;
|
|
137
|
-
return res.json();
|
|
138
|
-
}
|
|
139
|
-
function getWebsiteIdSync() {
|
|
140
|
-
if (_websiteId) return _websiteId;
|
|
141
|
-
if (typeof window !== "undefined") {
|
|
142
|
-
const embedded = window[ssg_client.BLOX_WEBSITE_ID_WINDOW_KEY];
|
|
143
|
-
if (typeof embedded === "string" && embedded !== "") return embedded;
|
|
144
|
-
}
|
|
145
|
-
return null;
|
|
146
|
-
}
|
|
147
|
-
async function getWebsiteId() {
|
|
148
|
-
if (_websiteId) return _websiteId;
|
|
149
|
-
if (typeof window !== "undefined") {
|
|
150
|
-
const embedded = window[ssg_client.BLOX_WEBSITE_ID_WINDOW_KEY];
|
|
151
|
-
if (typeof embedded === "string" && embedded !== "") {
|
|
152
|
-
_websiteId = embedded;
|
|
153
|
-
return _websiteId;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
let website;
|
|
157
|
-
try {
|
|
158
|
-
website = await request(
|
|
159
|
-
`/blox/sites/${encodeURIComponent(_websiteName)}`
|
|
160
|
-
);
|
|
161
|
-
} catch {
|
|
162
|
-
throw new Error(`Website "${_websiteName}" not found. Run: npm run seed`);
|
|
163
|
-
}
|
|
164
|
-
_websiteId = website.id;
|
|
165
|
-
return website.id;
|
|
166
|
-
}
|
|
167
|
-
async function resolvePath(path, locale2) {
|
|
168
|
-
const websiteId = await getWebsiteId();
|
|
169
|
-
return request(`/blox/websites/${websiteId}/resolve-path`, {
|
|
170
|
-
locale: locale2,
|
|
171
|
-
params: { path }
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
async function listItems(collection, { locale: locale2, q, offset = 0, limit = 100 } = {}) {
|
|
175
|
-
return request(`/datastore/${_store}/collections/${collection}`, {
|
|
176
|
-
locale: locale2,
|
|
177
|
-
params: { ...q ? { q } : {}, offset, limit }
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
async function getItemBySlug(collection, slug, locale2) {
|
|
181
|
-
const res = await listItemsFromActiveApi(collection, { locale: locale2, limit: 1e3 });
|
|
182
|
-
const items = Array.isArray(res) ? res : (res == null ? void 0 : res.items) ?? [];
|
|
183
|
-
return items.find((item) => String((item == null ? void 0 : item.slug) ?? "") === slug) ?? null;
|
|
184
|
-
}
|
|
185
|
-
async function getItemById(collection, id, locale2) {
|
|
186
|
-
const res = await listItemsFromActiveApi(collection, { locale: locale2, limit: 1e3 });
|
|
187
|
-
const items = Array.isArray(res) ? res : (res == null ? void 0 : res.items) ?? [];
|
|
188
|
-
return items.find((item) => {
|
|
189
|
-
const record = item;
|
|
190
|
-
return String((record == null ? void 0 : record.id) ?? (record == null ? void 0 : record._id) ?? "") === id;
|
|
191
|
-
}) ?? null;
|
|
192
|
-
}
|
|
193
|
-
function listItemsFromActiveApi(collection, options = {}) {
|
|
194
|
-
var _a;
|
|
195
|
-
return ((_a = useBloxApi()) == null ? void 0 : _a.listItems(collection, options)) ?? listItems(collection, options);
|
|
196
|
-
}
|
|
10
|
+
const ssg_client = require("./client-AoDTJJXJ.cjs");
|
|
197
11
|
const BLOX_REGISTRY_KEY = Symbol("blox:registry");
|
|
198
12
|
const BLOX_CONFIG_KEY = Symbol("blox:config");
|
|
199
13
|
const BLOX_LOCALE_STRATEGY_KEY = Symbol("blox:locale-strategy");
|
|
@@ -479,13 +293,13 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
479
293
|
const strategy = vue.inject(BLOX_LOCALE_STRATEGY_KEY, null);
|
|
480
294
|
const config = vue.inject(BLOX_CONFIG_KEY, null);
|
|
481
295
|
const ssrRouteState = vue.inject(BLOX_SSR_ROUTE_STATE_KEY, null);
|
|
482
|
-
const api = useBloxApi();
|
|
296
|
+
const api = pageTitle.useBloxApi();
|
|
483
297
|
const blocks = vue.ref([]);
|
|
484
298
|
const contexts = vue.ref({});
|
|
485
299
|
vue.provide("contexts", contexts);
|
|
486
300
|
const adminConfig = vue.inject(BLOX_ADMIN_CONFIG_KEY, null);
|
|
487
301
|
const currentPageId = vue.ref(null);
|
|
488
|
-
const websiteId = vue.ref((api == null ? void 0 : api.getWebsiteIdSync()) ?? getWebsiteIdSync());
|
|
302
|
+
const websiteId = vue.ref((api == null ? void 0 : api.getWebsiteIdSync()) ?? pageTitle.getWebsiteIdSync());
|
|
489
303
|
const notFound = vue.ref(false);
|
|
490
304
|
const error = vue.ref(null);
|
|
491
305
|
const initialLoading = vue.ref(true);
|
|
@@ -553,7 +367,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
553
367
|
}
|
|
554
368
|
navigating.value = true;
|
|
555
369
|
try {
|
|
556
|
-
const resolved = await ((api == null ? void 0 : api.resolvePath(slug, urlLocale)) ?? resolvePath(slug, urlLocale));
|
|
370
|
+
const resolved = await ((api == null ? void 0 : api.resolvePath(slug, urlLocale)) ?? pageTitle.resolvePath(slug, urlLocale));
|
|
557
371
|
blocks.value = ((_a = resolved.page.content) == null ? void 0 : _a.blocks) ?? [];
|
|
558
372
|
contexts.value = resolved.contexts ?? {};
|
|
559
373
|
currentPageId.value = resolved.page.id ?? null;
|
|
@@ -578,7 +392,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
578
392
|
vue.watch(currentRoutePath, load);
|
|
579
393
|
vue.onMounted(() => {
|
|
580
394
|
if (adminConfig && !websiteId.value) {
|
|
581
|
-
((api == null ? void 0 : api.getWebsiteId()) ?? getWebsiteId()).then((id) => {
|
|
395
|
+
((api == null ? void 0 : api.getWebsiteId()) ?? pageTitle.getWebsiteId()).then((id) => {
|
|
582
396
|
websiteId.value = id;
|
|
583
397
|
}).catch(() => {
|
|
584
398
|
});
|
|
@@ -1052,7 +866,7 @@ class BloxInstance {
|
|
|
1052
866
|
router.addRoute({
|
|
1053
867
|
path: "/_blox_preview",
|
|
1054
868
|
name: BLOX_PREVIEW_ROUTE_NAME,
|
|
1055
|
-
component: () => Promise.resolve().then(() => require("./PreviewApp-
|
|
869
|
+
component: () => Promise.resolve().then(() => require("./PreviewApp-j062gN6d.cjs")),
|
|
1056
870
|
beforeEnter: () => typeof window === "undefined" || window.parent !== window ? true : "/"
|
|
1057
871
|
});
|
|
1058
872
|
}
|
|
@@ -1085,7 +899,7 @@ class BloxInstance {
|
|
|
1085
899
|
if (options == null ? void 0 : options.router) this.registerRoutes(options.router);
|
|
1086
900
|
if (options == null ? void 0 : options.adminEdit) this._adminEdit = options.adminEdit;
|
|
1087
901
|
if ((options == null ? void 0 : options.websiteName) || (options == null ? void 0 : options.store)) {
|
|
1088
|
-
configureApi(options.websiteName ?? "", options.store ?? "");
|
|
902
|
+
pageTitle.configureApi(options.websiteName ?? "", options.store ?? "");
|
|
1089
903
|
}
|
|
1090
904
|
if (options == null ? void 0 : options.defaultLocale) {
|
|
1091
905
|
const { setLocale } = useLocale();
|
|
@@ -1103,7 +917,7 @@ function isBlockDefinition(value) {
|
|
|
1103
917
|
function createBlox(options) {
|
|
1104
918
|
const instance = new BloxInstance(options);
|
|
1105
919
|
if ((options == null ? void 0 : options.websiteName) || (options == null ? void 0 : options.store)) {
|
|
1106
|
-
configureApi(options.websiteName ?? "", options.store ?? "");
|
|
920
|
+
pageTitle.configureApi(options.websiteName ?? "", options.store ?? "");
|
|
1107
921
|
}
|
|
1108
922
|
if (options == null ? void 0 : options.modules) instance.registerModules(options.modules);
|
|
1109
923
|
if (options == null ? void 0 : options.components) instance.registerComponents(options.components);
|
|
@@ -1165,7 +979,7 @@ function useContentItem(collectionArg, slugArg) {
|
|
|
1165
979
|
const c = coll();
|
|
1166
980
|
const s = slg();
|
|
1167
981
|
if (!c || !s) return null;
|
|
1168
|
-
const res = await listItemsFromActiveApi(c, { locale: loc(), limit: 1e3 });
|
|
982
|
+
const res = await pageTitle.listItemsFromActiveApi(c, { locale: loc(), limit: 1e3 });
|
|
1169
983
|
const items = Array.isArray(res) ? res : (res == null ? void 0 : res.items) ?? [];
|
|
1170
984
|
return items.find((it) => String((it == null ? void 0 : it.slug) ?? "") === s) ?? null;
|
|
1171
985
|
},
|
|
@@ -1331,7 +1145,7 @@ function installContentFallback(router, supportedLocales, defaultLocale, api) {
|
|
|
1331
1145
|
registration.collection,
|
|
1332
1146
|
slug,
|
|
1333
1147
|
urlLocale
|
|
1334
|
-
)) ?? getItemBySlug(
|
|
1148
|
+
)) ?? pageTitle.getItemBySlug(
|
|
1335
1149
|
registration.collection,
|
|
1336
1150
|
slug,
|
|
1337
1151
|
urlLocale
|
|
@@ -1348,7 +1162,7 @@ function installContentFallback(router, supportedLocales, defaultLocale, api) {
|
|
|
1348
1162
|
registration.collection,
|
|
1349
1163
|
slug,
|
|
1350
1164
|
sourceLocale
|
|
1351
|
-
)) ?? getItemBySlug(
|
|
1165
|
+
)) ?? pageTitle.getItemBySlug(
|
|
1352
1166
|
registration.collection,
|
|
1353
1167
|
slug,
|
|
1354
1168
|
sourceLocale
|
|
@@ -1364,7 +1178,7 @@ function installContentFallback(router, supportedLocales, defaultLocale, api) {
|
|
|
1364
1178
|
registration.collection,
|
|
1365
1179
|
id,
|
|
1366
1180
|
urlLocale
|
|
1367
|
-
)) ?? getItemById(
|
|
1181
|
+
)) ?? pageTitle.getItemById(
|
|
1368
1182
|
registration.collection,
|
|
1369
1183
|
id,
|
|
1370
1184
|
urlLocale
|
|
@@ -1459,39 +1273,28 @@ exports.applyLayoutChrome = applyLayoutChrome;
|
|
|
1459
1273
|
exports.classifyLink = classifyLink;
|
|
1460
1274
|
exports.collectBloxData = collectBloxData;
|
|
1461
1275
|
exports.collectBloxSeo = collectBloxSeo;
|
|
1462
|
-
exports.configureApi = configureApi;
|
|
1463
1276
|
exports.consumePendingLocaleSwitch = consumePendingLocaleSwitch;
|
|
1464
1277
|
exports.contentRoutes = contentRoutes;
|
|
1465
1278
|
exports.createBlox = createBlox;
|
|
1466
|
-
exports.createBloxApi = createBloxApi;
|
|
1467
1279
|
exports.defineContent = defineContent;
|
|
1468
1280
|
exports.generateContentRoutes = generateContentRoutes;
|
|
1469
1281
|
exports.getContentRoute = getContentRoute;
|
|
1470
1282
|
exports.getContentRouteByCollection = getContentRouteByCollection;
|
|
1471
|
-
exports.getItemById = getItemById;
|
|
1472
|
-
exports.getItemBySlug = getItemBySlug;
|
|
1473
1283
|
exports.getRegistryData = getRegistryData;
|
|
1474
|
-
exports.getWebsiteId = getWebsiteId;
|
|
1475
|
-
exports.getWebsiteIdSync = getWebsiteIdSync;
|
|
1476
1284
|
exports.installBloxRuntime = installBloxRuntime;
|
|
1477
1285
|
exports.installContentFallback = installContentFallback;
|
|
1478
1286
|
exports.installSmartLinks = installSmartLinks;
|
|
1479
1287
|
exports.isAbsoluteExternal = isAbsoluteExternal;
|
|
1480
1288
|
exports.isSoloContentPage = isSoloContentPage;
|
|
1481
1289
|
exports.isSpecialScheme = isSpecialScheme;
|
|
1482
|
-
exports.listItems = listItems;
|
|
1483
1290
|
exports.normalizeLink = normalizeLink;
|
|
1484
1291
|
exports.normalizeTo = normalizeTo;
|
|
1485
|
-
exports.provideBloxApi = provideBloxApi;
|
|
1486
1292
|
exports.provideBloxData = provideBloxData;
|
|
1487
1293
|
exports.provideBloxLocale = provideBloxLocale;
|
|
1488
1294
|
exports.provideContentItem = provideContentItem;
|
|
1489
1295
|
exports.resolveBlockProps = resolveBlockProps;
|
|
1490
|
-
exports.resolvePath = resolvePath;
|
|
1491
1296
|
exports.setActiveLocale = setActiveLocale;
|
|
1492
|
-
exports.setApiOrigin = setApiOrigin;
|
|
1493
1297
|
exports.toInternalPath = toInternalPath;
|
|
1494
|
-
exports.useBloxApi = useBloxApi;
|
|
1495
1298
|
exports.useBloxEdit = useBloxEdit;
|
|
1496
1299
|
exports.useContentItem = useContentItem;
|
|
1497
1300
|
exports.useData = useData;
|