@cmssy/react 4.7.2 → 5.0.1
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/client.cjs +51 -260
- package/dist/client.d.cts +6 -9
- package/dist/client.d.ts +6 -9
- package/dist/client.js +5 -225
- package/dist/index.cjs +148 -777
- package/dist/index.d.cts +6 -252
- package/dist/index.d.ts +6 -252
- package/dist/index.js +4 -734
- package/dist/{registry-DBPEDxug.d.cts → registry-DnhIHuzF.d.cts} +1 -1
- package/dist/{registry-DBPEDxug.d.ts → registry-DnhIHuzF.d.ts} +1 -1
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -1,40 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var core = require('@cmssy/core');
|
|
3
4
|
var react = require('react');
|
|
4
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
6
|
var types = require('@cmssy/types');
|
|
6
7
|
|
|
7
|
-
// src/
|
|
8
|
-
function control(type) {
|
|
9
|
-
return (opts = {}) => ({
|
|
10
|
-
type,
|
|
11
|
-
label: opts.label ?? "",
|
|
12
|
-
...opts
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
var fields = {
|
|
16
|
-
text: control("text"),
|
|
17
|
-
textarea: control("textarea"),
|
|
18
|
-
richText: control("richText"),
|
|
19
|
-
markdown: control("markdown"),
|
|
20
|
-
number: control("number"),
|
|
21
|
-
date: control("date"),
|
|
22
|
-
datetime: control("datetime"),
|
|
23
|
-
boolean: control("boolean"),
|
|
24
|
-
color: control("color"),
|
|
25
|
-
media: control("media"),
|
|
26
|
-
link: control("link"),
|
|
27
|
-
url: control("url"),
|
|
28
|
-
email: control("email"),
|
|
29
|
-
select: control("select"),
|
|
30
|
-
multiselect: control("multiselect"),
|
|
31
|
-
radio: control("radio"),
|
|
32
|
-
repeater: control("repeater"),
|
|
33
|
-
table: control("table"),
|
|
34
|
-
json: control("json"),
|
|
35
|
-
form: control("form"),
|
|
36
|
-
pageSelector: control("pageSelector")
|
|
37
|
-
};
|
|
8
|
+
// src/index.ts
|
|
38
9
|
|
|
39
10
|
// src/registry.ts
|
|
40
11
|
function defineBlock(def) {
|
|
@@ -77,48 +48,6 @@ function blocksToMeta(blocks, defaults = {}) {
|
|
|
77
48
|
}
|
|
78
49
|
return out;
|
|
79
50
|
}
|
|
80
|
-
|
|
81
|
-
// src/components/block-context.ts
|
|
82
|
-
function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, forms, extra) {
|
|
83
|
-
return {
|
|
84
|
-
locale: {
|
|
85
|
-
current: locale,
|
|
86
|
-
default: defaultLocale,
|
|
87
|
-
enabled: enabledLocales && enabledLocales.length > 0 ? enabledLocales : Array.from(/* @__PURE__ */ new Set([defaultLocale, locale]))
|
|
88
|
-
},
|
|
89
|
-
isPreview: isPreview ?? false,
|
|
90
|
-
forms,
|
|
91
|
-
...extra?.auth ? { auth: extra.auth } : {},
|
|
92
|
-
...extra?.workspace ? { workspace: extra.workspace } : {}
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// src/content/get-block-content.ts
|
|
97
|
-
function isPlainObject(value) {
|
|
98
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
99
|
-
}
|
|
100
|
-
function looksLikeLocaleKey(key) {
|
|
101
|
-
return /^[a-z]{2}(-[A-Za-z]{2})?$/.test(key);
|
|
102
|
-
}
|
|
103
|
-
function getBlockContentForLanguage(content, locale, defaultLocale = "en", availableLocales) {
|
|
104
|
-
if (!isPlainObject(content)) return {};
|
|
105
|
-
const isLocale = availableLocales ? (key) => availableLocales.includes(key) : looksLikeLocaleKey;
|
|
106
|
-
const localeEntries = Object.entries(content).filter(
|
|
107
|
-
([key, value]) => isLocale(key) && isPlainObject(value)
|
|
108
|
-
);
|
|
109
|
-
if (localeEntries.length === 0) return { ...content };
|
|
110
|
-
const localeMap = Object.fromEntries(localeEntries);
|
|
111
|
-
const nonTranslatable = {};
|
|
112
|
-
for (const [key, value] of Object.entries(content)) {
|
|
113
|
-
if (!(isLocale(key) && isPlainObject(value))) nonTranslatable[key] = value;
|
|
114
|
-
}
|
|
115
|
-
const fallbackKey = Object.keys(localeMap)[0];
|
|
116
|
-
const chosen = localeMap[locale] ?? localeMap[defaultLocale] ?? localeMap[fallbackKey];
|
|
117
|
-
return { ...nonTranslatable, ...chosen };
|
|
118
|
-
}
|
|
119
|
-
function asBucket(value) {
|
|
120
|
-
return isPlainObject(value) ? value : {};
|
|
121
|
-
}
|
|
122
51
|
var WARN_CAP = 256;
|
|
123
52
|
var warned = /* @__PURE__ */ new Set();
|
|
124
53
|
function UnknownBlock({ type }) {
|
|
@@ -132,7 +61,7 @@ function UnknownBlock({ type }) {
|
|
|
132
61
|
function renderResolvedBlock(block, map, locale, defaultLocale, options = {}) {
|
|
133
62
|
const { context, data, resolvedContent, enabledLocales } = options;
|
|
134
63
|
const Component = Object.hasOwn(map, block.type) ? map[block.type] : void 0;
|
|
135
|
-
const content = resolvedContent ?? getBlockContentForLanguage(
|
|
64
|
+
const content = resolvedContent ?? core.getBlockContentForLanguage(
|
|
136
65
|
block.content,
|
|
137
66
|
locale,
|
|
138
67
|
defaultLocale,
|
|
@@ -146,8 +75,8 @@ function renderResolvedBlock(block, map, locale, defaultLocale, options = {}) {
|
|
|
146
75
|
style: Component ? void 0 : { display: "none" },
|
|
147
76
|
children: Component ? react.createElement(Component, {
|
|
148
77
|
content,
|
|
149
|
-
style: asBucket(block.style),
|
|
150
|
-
advanced: asBucket(block.advanced),
|
|
78
|
+
style: core.asBucket(block.style),
|
|
79
|
+
advanced: core.asBucket(block.advanced),
|
|
151
80
|
context,
|
|
152
81
|
data
|
|
153
82
|
}) : /* @__PURE__ */ jsxRuntime.jsx(UnknownBlock, { type: block.type })
|
|
@@ -155,12 +84,10 @@ function renderResolvedBlock(block, map, locale, defaultLocale, options = {}) {
|
|
|
155
84
|
block.id
|
|
156
85
|
);
|
|
157
86
|
}
|
|
158
|
-
|
|
159
|
-
// src/components/resolve-blocks.ts
|
|
160
87
|
async function resolveBlocks(blocks, loaderMap, locale, defaultLocale, context, enabledLocales) {
|
|
161
88
|
return Promise.all(
|
|
162
89
|
blocks.map(async (block) => {
|
|
163
|
-
const content = getBlockContentForLanguage(
|
|
90
|
+
const content = core.getBlockContentForLanguage(
|
|
164
91
|
block.content,
|
|
165
92
|
locale,
|
|
166
93
|
defaultLocale,
|
|
@@ -184,423 +111,6 @@ async function resolveBlocks(blocks, loaderMap, locale, defaultLocale, context,
|
|
|
184
111
|
})
|
|
185
112
|
);
|
|
186
113
|
}
|
|
187
|
-
|
|
188
|
-
// src/data/http.ts
|
|
189
|
-
var CmssyRequestError = class extends Error {
|
|
190
|
-
status;
|
|
191
|
-
constructor(message, status) {
|
|
192
|
-
super(message);
|
|
193
|
-
this.name = "CmssyRequestError";
|
|
194
|
-
this.status = status;
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
var DEFAULT_RETRY_STATUSES = [429, 503];
|
|
198
|
-
function retryAfterMs(response) {
|
|
199
|
-
const raw = response.headers?.get("retry-after");
|
|
200
|
-
if (!raw) return null;
|
|
201
|
-
const seconds = Number(raw);
|
|
202
|
-
if (Number.isFinite(seconds)) return Math.max(0, seconds * 1e3);
|
|
203
|
-
const date = Date.parse(raw);
|
|
204
|
-
if (Number.isFinite(date)) return Math.max(0, date - Date.now());
|
|
205
|
-
return null;
|
|
206
|
-
}
|
|
207
|
-
function sleep(ms, signal) {
|
|
208
|
-
return new Promise((resolve, reject) => {
|
|
209
|
-
if (signal?.aborted) {
|
|
210
|
-
reject(new Error("cmssy: request aborted"));
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
const timer = setTimeout(() => {
|
|
214
|
-
signal?.removeEventListener("abort", onAbort);
|
|
215
|
-
resolve();
|
|
216
|
-
}, ms);
|
|
217
|
-
function onAbort() {
|
|
218
|
-
clearTimeout(timer);
|
|
219
|
-
reject(new Error("cmssy: request aborted"));
|
|
220
|
-
}
|
|
221
|
-
signal?.addEventListener("abort", onAbort, { once: true });
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
async function fetchWithRetry(doFetch, url, init, retry) {
|
|
225
|
-
if (retry === false || retry === void 0) {
|
|
226
|
-
return doFetch(url, init);
|
|
227
|
-
}
|
|
228
|
-
const maxRetries = retry.maxRetries ?? 3;
|
|
229
|
-
const baseDelayMs = retry.baseDelayMs ?? 300;
|
|
230
|
-
const maxDelayMs = retry.maxDelayMs ?? 3e3;
|
|
231
|
-
const retryStatuses = retry.retryStatuses ?? DEFAULT_RETRY_STATUSES;
|
|
232
|
-
let response = await doFetch(url, init);
|
|
233
|
-
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
234
|
-
if (response.ok || !retryStatuses.includes(response.status)) {
|
|
235
|
-
return response;
|
|
236
|
-
}
|
|
237
|
-
const backoff = baseDelayMs * 2 ** attempt;
|
|
238
|
-
const wait = Math.min(retryAfterMs(response) ?? backoff, maxDelayMs);
|
|
239
|
-
await sleep(wait, init.signal);
|
|
240
|
-
response = await doFetch(url, init);
|
|
241
|
-
}
|
|
242
|
-
return response;
|
|
243
|
-
}
|
|
244
|
-
async function postGraphql(url, query, variables, options) {
|
|
245
|
-
const doFetch = options.fetch ?? globalThis.fetch;
|
|
246
|
-
if (typeof doFetch !== "function") {
|
|
247
|
-
throw new Error(
|
|
248
|
-
"cmssy: no fetch implementation available - pass options.fetch"
|
|
249
|
-
);
|
|
250
|
-
}
|
|
251
|
-
const response = await fetchWithRetry(
|
|
252
|
-
doFetch,
|
|
253
|
-
url,
|
|
254
|
-
{
|
|
255
|
-
method: "POST",
|
|
256
|
-
headers: { "content-type": "application/json", ...options.headers },
|
|
257
|
-
body: JSON.stringify({ query, variables }),
|
|
258
|
-
signal: options.signal
|
|
259
|
-
},
|
|
260
|
-
options.retry
|
|
261
|
-
);
|
|
262
|
-
if (!response.ok) {
|
|
263
|
-
let detail = "";
|
|
264
|
-
try {
|
|
265
|
-
const body = await response.json();
|
|
266
|
-
if (body.errors && body.errors.length > 0) {
|
|
267
|
-
detail = ` - ${body.errors.map((error) => error.message ?? "GraphQL error").join("; ")}`;
|
|
268
|
-
}
|
|
269
|
-
} catch {
|
|
270
|
-
detail = "";
|
|
271
|
-
}
|
|
272
|
-
throw new CmssyRequestError(
|
|
273
|
-
`cmssy: ${options.label} failed (${response.status})${detail}`,
|
|
274
|
-
response.status
|
|
275
|
-
);
|
|
276
|
-
}
|
|
277
|
-
let json;
|
|
278
|
-
try {
|
|
279
|
-
json = await response.json();
|
|
280
|
-
} catch {
|
|
281
|
-
throw new Error(`cmssy: invalid JSON response from the ${options.label}`);
|
|
282
|
-
}
|
|
283
|
-
if (json.errors && json.errors.length > 0) {
|
|
284
|
-
const message = json.errors.map((error) => error.message ?? "GraphQL error").join("; ");
|
|
285
|
-
throw new Error(`cmssy: ${options.label} error - ${message}`);
|
|
286
|
-
}
|
|
287
|
-
return json.data;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
// src/content/content-client.ts
|
|
291
|
-
var DEFAULT_CMSSY_API_URL = "https://api.cmssy.io/graphql";
|
|
292
|
-
function resolveApiUrl(apiUrl) {
|
|
293
|
-
const explicit = apiUrl?.trim();
|
|
294
|
-
if (explicit) return explicit;
|
|
295
|
-
const env = globalThis.process?.env;
|
|
296
|
-
const fromEnv = env?.CMSSY_API_URL?.trim() ?? "";
|
|
297
|
-
return fromEnv.length > 0 ? fromEnv : DEFAULT_CMSSY_API_URL;
|
|
298
|
-
}
|
|
299
|
-
function resolvePublicUrl(config) {
|
|
300
|
-
const base = resolveApiUrl(config.apiUrl).replace(/\/graphql\/?$/, "");
|
|
301
|
-
return `${base}/public/${config.org}/${config.workspaceSlug}/graphql`;
|
|
302
|
-
}
|
|
303
|
-
var PUBLIC_PAGE_QUERY = `query PublicPage($workspaceSlug: String!, $slug: String!, $previewSecret: String) {
|
|
304
|
-
public {
|
|
305
|
-
page {
|
|
306
|
-
get(workspaceSlug: $workspaceSlug, slug: $slug, previewSecret: $previewSecret) {
|
|
307
|
-
id
|
|
308
|
-
blocks { id type content style advanced }
|
|
309
|
-
publishedBlocks { id type content style advanced }
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}`;
|
|
314
|
-
var PUBLIC_PAGE_DEV_QUERY = `query PublicPage($workspaceSlug: String!, $slug: String!, $previewSecret: String, $devPreview: Boolean) {
|
|
315
|
-
public {
|
|
316
|
-
page {
|
|
317
|
-
get(workspaceSlug: $workspaceSlug, slug: $slug, previewSecret: $previewSecret, devPreview: $devPreview) {
|
|
318
|
-
id
|
|
319
|
-
blocks { id type content style advanced }
|
|
320
|
-
publishedBlocks { id type content style advanced }
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}`;
|
|
325
|
-
var PUBLIC_PAGE_BY_ID_QUERY = `query PublicPageById($workspaceSlug: String!, $pageId: ID!) {
|
|
326
|
-
public {
|
|
327
|
-
page {
|
|
328
|
-
getById(workspaceSlug: $workspaceSlug, pageId: $pageId) {
|
|
329
|
-
id
|
|
330
|
-
publishedBlocks { id type content style advanced }
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
}`;
|
|
335
|
-
var PUBLIC_PAGES_QUERY = `query PublicPages($workspaceSlug: String!) {
|
|
336
|
-
public {
|
|
337
|
-
page {
|
|
338
|
-
list(workspaceSlug: $workspaceSlug) {
|
|
339
|
-
id
|
|
340
|
-
slug
|
|
341
|
-
updatedAt
|
|
342
|
-
publishedAt
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}`;
|
|
347
|
-
var PUBLIC_PAGE_META_QUERY = `query PublicPageMeta($workspaceSlug: String!, $slug: String!) {
|
|
348
|
-
public {
|
|
349
|
-
page {
|
|
350
|
-
get(workspaceSlug: $workspaceSlug, slug: $slug) {
|
|
351
|
-
id
|
|
352
|
-
seoTitle
|
|
353
|
-
seoDescription
|
|
354
|
-
seoKeywords
|
|
355
|
-
displayName
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}`;
|
|
360
|
-
var PUBLIC_PAGE_LAYOUTS_QUERY = `query PublicPageLayouts($workspaceSlug: String!, $pageSlug: String!, $previewSecret: String) {
|
|
361
|
-
public {
|
|
362
|
-
page {
|
|
363
|
-
layouts(workspaceSlug: $workspaceSlug, pageSlug: $pageSlug, previewSecret: $previewSecret) {
|
|
364
|
-
position
|
|
365
|
-
blocks { id type content style advanced order isActive }
|
|
366
|
-
settings { desktopWidth mobileBehavior }
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}`;
|
|
371
|
-
function normalizeSlug(path) {
|
|
372
|
-
if (Array.isArray(path)) {
|
|
373
|
-
const joined = path.filter(Boolean).join("/");
|
|
374
|
-
return joined ? `/${joined}` : "/";
|
|
375
|
-
}
|
|
376
|
-
if (!path || path === "/") return "/";
|
|
377
|
-
return path.startsWith("/") ? path : `/${path}`;
|
|
378
|
-
}
|
|
379
|
-
async function fetchPage(config, path, options = {}) {
|
|
380
|
-
const slug = normalizeSlug(path);
|
|
381
|
-
const trimmedSecret = options.previewSecret?.trim();
|
|
382
|
-
const previewSecret = trimmedSecret ? trimmedSecret : null;
|
|
383
|
-
const devToken = options.devToken?.trim();
|
|
384
|
-
const devPreview = Boolean(options.devPreview && devToken);
|
|
385
|
-
const headers = {};
|
|
386
|
-
if (devPreview && devToken) {
|
|
387
|
-
headers["authorization"] = `Bearer ${devToken}`;
|
|
388
|
-
if (options.workspaceId) {
|
|
389
|
-
headers["x-workspace-id"] = options.workspaceId;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
const data = await postGraphql(
|
|
393
|
-
resolvePublicUrl(config),
|
|
394
|
-
devPreview ? PUBLIC_PAGE_DEV_QUERY : PUBLIC_PAGE_QUERY,
|
|
395
|
-
{
|
|
396
|
-
workspaceSlug: config.workspaceSlug,
|
|
397
|
-
slug,
|
|
398
|
-
previewSecret,
|
|
399
|
-
...devPreview ? { devPreview: true } : {}
|
|
400
|
-
},
|
|
401
|
-
{
|
|
402
|
-
fetch: options.fetch,
|
|
403
|
-
signal: options.signal,
|
|
404
|
-
headers,
|
|
405
|
-
retry: options.retry ?? {},
|
|
406
|
-
label: "page fetch"
|
|
407
|
-
}
|
|
408
|
-
);
|
|
409
|
-
const page = data?.public?.page?.get;
|
|
410
|
-
if (!page) return null;
|
|
411
|
-
const draft = previewSecret !== null || devPreview;
|
|
412
|
-
const blocks = (draft ? page.blocks : page.publishedBlocks) ?? [];
|
|
413
|
-
return { id: page.id, blocks };
|
|
414
|
-
}
|
|
415
|
-
async function fetchPageById(config, pageId, options = {}) {
|
|
416
|
-
const data = await postGraphql(
|
|
417
|
-
resolvePublicUrl(config),
|
|
418
|
-
PUBLIC_PAGE_BY_ID_QUERY,
|
|
419
|
-
{ workspaceSlug: config.workspaceSlug, pageId },
|
|
420
|
-
{
|
|
421
|
-
fetch: options.fetch,
|
|
422
|
-
signal: options.signal,
|
|
423
|
-
retry: options.retry ?? {},
|
|
424
|
-
label: "page-by-id fetch"
|
|
425
|
-
}
|
|
426
|
-
);
|
|
427
|
-
const page = data?.public?.page?.getById;
|
|
428
|
-
if (!page) return null;
|
|
429
|
-
return { id: page.id, blocks: page.publishedBlocks ?? [] };
|
|
430
|
-
}
|
|
431
|
-
async function fetchPages(config, options = {}) {
|
|
432
|
-
const data = await postGraphql(
|
|
433
|
-
resolvePublicUrl(config),
|
|
434
|
-
PUBLIC_PAGES_QUERY,
|
|
435
|
-
{ workspaceSlug: config.workspaceSlug },
|
|
436
|
-
{
|
|
437
|
-
fetch: options.fetch,
|
|
438
|
-
signal: options.signal,
|
|
439
|
-
retry: options.retry ?? {},
|
|
440
|
-
label: "pages fetch"
|
|
441
|
-
}
|
|
442
|
-
);
|
|
443
|
-
return data?.public?.page?.list ?? [];
|
|
444
|
-
}
|
|
445
|
-
async function fetchPageMeta(config, path, options = {}) {
|
|
446
|
-
const slug = normalizeSlug(path);
|
|
447
|
-
const data = await postGraphql(
|
|
448
|
-
resolvePublicUrl(config),
|
|
449
|
-
PUBLIC_PAGE_META_QUERY,
|
|
450
|
-
{ workspaceSlug: config.workspaceSlug, slug },
|
|
451
|
-
{
|
|
452
|
-
fetch: options.fetch,
|
|
453
|
-
signal: options.signal,
|
|
454
|
-
retry: options.retry ?? {},
|
|
455
|
-
label: "page meta fetch"
|
|
456
|
-
}
|
|
457
|
-
);
|
|
458
|
-
return data?.public?.page?.get ?? null;
|
|
459
|
-
}
|
|
460
|
-
async function fetchLayouts(config, path, options = {}) {
|
|
461
|
-
const pageSlug = normalizeSlug(path);
|
|
462
|
-
const trimmedSecret = options.previewSecret?.trim();
|
|
463
|
-
const previewSecret = trimmedSecret ? trimmedSecret : null;
|
|
464
|
-
const data = await postGraphql(
|
|
465
|
-
resolvePublicUrl(config),
|
|
466
|
-
PUBLIC_PAGE_LAYOUTS_QUERY,
|
|
467
|
-
{ workspaceSlug: config.workspaceSlug, pageSlug, previewSecret },
|
|
468
|
-
{
|
|
469
|
-
fetch: options.fetch,
|
|
470
|
-
signal: options.signal,
|
|
471
|
-
retry: options.retry ?? {},
|
|
472
|
-
label: "layouts fetch"
|
|
473
|
-
}
|
|
474
|
-
);
|
|
475
|
-
return data?.public?.page?.layouts ?? [];
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
// src/data/graphql-request.ts
|
|
479
|
-
async function graphqlRequest(config, query, variables, options = {}, label = "request") {
|
|
480
|
-
const url = options.public ? resolvePublicUrl(config) : resolveApiUrl(config.apiUrl);
|
|
481
|
-
return postGraphql(url, query, variables, {
|
|
482
|
-
fetch: options.fetch,
|
|
483
|
-
signal: options.signal,
|
|
484
|
-
headers: options.headers,
|
|
485
|
-
retry: options.retry,
|
|
486
|
-
label
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
// src/data/queries.ts
|
|
491
|
-
var SITE_CONFIG_QUERY = `query PublicSiteConfig($workspaceSlug: String!) {
|
|
492
|
-
public {
|
|
493
|
-
siteConfig(workspaceSlug: $workspaceSlug) {
|
|
494
|
-
id
|
|
495
|
-
workspaceId
|
|
496
|
-
siteName
|
|
497
|
-
defaultLanguage
|
|
498
|
-
enabledLanguages
|
|
499
|
-
enabledFeatures
|
|
500
|
-
notFoundPageId
|
|
501
|
-
previewUrl
|
|
502
|
-
branding {
|
|
503
|
-
brandName
|
|
504
|
-
logoUrl
|
|
505
|
-
faviconUrl
|
|
506
|
-
ogImageUrl
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
}`;
|
|
511
|
-
var MODEL_DEFINITIONS_QUERY = `query PublicModelDefinitions($workspaceId: String!) {
|
|
512
|
-
public {
|
|
513
|
-
model {
|
|
514
|
-
definitions(workspaceId: $workspaceId) {
|
|
515
|
-
id name slug description icon color displayField recordCount
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
}`;
|
|
520
|
-
var MODEL_RECORDS_QUERY = `query PublicModelRecords($workspaceId: String!, $modelSlug: String!, $filter: JSON, $sort: String, $locale: String, $limit: Int, $offset: Int, $populate: [String!]) {
|
|
521
|
-
public {
|
|
522
|
-
model {
|
|
523
|
-
records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, sort: $sort, locale: $locale, limit: $limit, offset: $offset, populate: $populate) {
|
|
524
|
-
items { id modelId data status createdAt updatedAt }
|
|
525
|
-
total
|
|
526
|
-
hasMore
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
}`;
|
|
531
|
-
var FORM_QUERY = `query PublicForm($formId: ID!) {
|
|
532
|
-
public {
|
|
533
|
-
form {
|
|
534
|
-
get(formId: $formId) {
|
|
535
|
-
id
|
|
536
|
-
name
|
|
537
|
-
slug
|
|
538
|
-
description
|
|
539
|
-
fields {
|
|
540
|
-
id name fieldType label placeholder helpText
|
|
541
|
-
defaultValue width order showWhen requiredWhen
|
|
542
|
-
options { value label disabled }
|
|
543
|
-
validation { required minLength maxLength minValue maxValue pattern customMessage }
|
|
544
|
-
}
|
|
545
|
-
settings {
|
|
546
|
-
actionType submitButtonLabel successMessage errorMessage
|
|
547
|
-
redirectUrl requireLogin enableCaptcha
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
}`;
|
|
553
|
-
var SUBMIT_FORM_MUTATION = `mutation SubmitForm($formId: ID!, $input: SubmitFormInput!) {
|
|
554
|
-
public {
|
|
555
|
-
form {
|
|
556
|
-
submit(formId: $formId, input: $input) {
|
|
557
|
-
success message submissionId redirectUrl accessToken customer
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
}`;
|
|
562
|
-
|
|
563
|
-
// src/data/site-locales.ts
|
|
564
|
-
var TTL_MS = 6e4;
|
|
565
|
-
var MAX_ENTRIES = 64;
|
|
566
|
-
var cache = /* @__PURE__ */ new Map();
|
|
567
|
-
async function resolveSiteLocales(config, options) {
|
|
568
|
-
const key = `${resolveApiUrl(config.apiUrl)}::${config.org}::${config.workspaceSlug}`;
|
|
569
|
-
const cached = cache.get(key);
|
|
570
|
-
if (cached && cached.expires > Date.now()) return cached.value;
|
|
571
|
-
cache.delete(key);
|
|
572
|
-
let value;
|
|
573
|
-
try {
|
|
574
|
-
const data = await graphqlRequest(
|
|
575
|
-
config,
|
|
576
|
-
SITE_CONFIG_QUERY,
|
|
577
|
-
{ workspaceSlug: config.workspaceSlug },
|
|
578
|
-
{ ...options, public: true, retry: options?.retry ?? {} },
|
|
579
|
-
"site config"
|
|
580
|
-
);
|
|
581
|
-
const siteConfig = data.public?.siteConfig ?? null;
|
|
582
|
-
const defaultLocale = siteConfig?.defaultLanguage || "en";
|
|
583
|
-
const enabled = siteConfig?.enabledLanguages ?? [];
|
|
584
|
-
value = {
|
|
585
|
-
defaultLocale,
|
|
586
|
-
locales: enabled.length > 0 ? enabled : [defaultLocale]
|
|
587
|
-
};
|
|
588
|
-
} catch {
|
|
589
|
-
value = { defaultLocale: "en", locales: ["en"] };
|
|
590
|
-
}
|
|
591
|
-
if (cache.size >= MAX_ENTRIES) cache.clear();
|
|
592
|
-
cache.set(key, { value, expires: Date.now() + TTL_MS });
|
|
593
|
-
return value;
|
|
594
|
-
}
|
|
595
|
-
function splitLocaleFromPath(path, siteLocales) {
|
|
596
|
-
const first = path?.[0];
|
|
597
|
-
if (first && first !== siteLocales.defaultLocale && siteLocales.locales.includes(first)) {
|
|
598
|
-
return { locale: first, path: path.slice(1) };
|
|
599
|
-
}
|
|
600
|
-
return { locale: siteLocales.defaultLocale, path };
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
// src/components/resolve-render-locale.ts
|
|
604
114
|
var warned2 = false;
|
|
605
115
|
async function resolveRenderLocale({
|
|
606
116
|
locale,
|
|
@@ -610,7 +120,7 @@ async function resolveRenderLocale({
|
|
|
610
120
|
}) {
|
|
611
121
|
if (locale && defaultLocale) return { locale, defaultLocale, enabledLocales };
|
|
612
122
|
if (config) {
|
|
613
|
-
const site = await resolveSiteLocales(config);
|
|
123
|
+
const site = await core.resolveSiteLocales(config);
|
|
614
124
|
return {
|
|
615
125
|
locale: locale ?? defaultLocale ?? site.defaultLocale,
|
|
616
126
|
defaultLocale: defaultLocale ?? site.defaultLocale,
|
|
@@ -649,7 +159,7 @@ async function CmssyServerPage({
|
|
|
649
159
|
});
|
|
650
160
|
const map = buildBlockMap(blocks);
|
|
651
161
|
const loaderMap = buildLoaderMap(blocks);
|
|
652
|
-
const context = buildBlockContext(
|
|
162
|
+
const context = core.buildBlockContext(
|
|
653
163
|
locale,
|
|
654
164
|
defaultLocale,
|
|
655
165
|
enabledLocales,
|
|
@@ -694,7 +204,7 @@ async function CmssyServerLayout({
|
|
|
694
204
|
if (layoutBlocks.length === 0) return null;
|
|
695
205
|
const map = buildBlockMap(blocks);
|
|
696
206
|
const loaderMap = buildLoaderMap(blocks);
|
|
697
|
-
const context = buildBlockContext(locale, defaultLocale, enabledLocales);
|
|
207
|
+
const context = core.buildBlockContext(locale, defaultLocale, enabledLocales);
|
|
698
208
|
const resolved = await resolveBlocks(
|
|
699
209
|
layoutBlocks,
|
|
700
210
|
loaderMap,
|
|
@@ -712,247 +222,6 @@ async function CmssyServerLayout({
|
|
|
712
222
|
})
|
|
713
223
|
) });
|
|
714
224
|
}
|
|
715
|
-
|
|
716
|
-
// src/bridge/protocol.ts
|
|
717
|
-
var PROTOCOL_VERSION = 2;
|
|
718
|
-
function isProtocolCompatible(version) {
|
|
719
|
-
return version === PROTOCOL_VERSION;
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
// src/bridge/messages.ts
|
|
723
|
-
function normalizeOrigin(origin) {
|
|
724
|
-
const trimmed = origin.trim();
|
|
725
|
-
if (trimmed === "*") return "*";
|
|
726
|
-
try {
|
|
727
|
-
return new URL(trimmed).origin;
|
|
728
|
-
} catch {
|
|
729
|
-
return trimmed;
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
function postToEditor(target, editorOrigin, message) {
|
|
733
|
-
target.postMessage(message, normalizeOrigin(editorOrigin));
|
|
734
|
-
}
|
|
735
|
-
function isOriginAllowed(origin, allowed) {
|
|
736
|
-
const list = Array.isArray(allowed) ? allowed : [allowed];
|
|
737
|
-
const actual = normalizeOrigin(origin);
|
|
738
|
-
return list.some((candidate) => {
|
|
739
|
-
const expected = normalizeOrigin(candidate);
|
|
740
|
-
return expected === "*" || expected === actual;
|
|
741
|
-
});
|
|
742
|
-
}
|
|
743
|
-
function isObject(value) {
|
|
744
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
745
|
-
}
|
|
746
|
-
function parseEditorMessage(data, origin, expectedOrigin) {
|
|
747
|
-
if (!isOriginAllowed(origin, expectedOrigin)) return null;
|
|
748
|
-
if (!isObject(data)) return null;
|
|
749
|
-
switch (data.type) {
|
|
750
|
-
case "cmssy:select":
|
|
751
|
-
return typeof data.blockId === "string" && data.protocolVersion === PROTOCOL_VERSION ? {
|
|
752
|
-
type: "cmssy:select",
|
|
753
|
-
protocolVersion: PROTOCOL_VERSION,
|
|
754
|
-
blockId: data.blockId
|
|
755
|
-
} : null;
|
|
756
|
-
case "cmssy:patch":
|
|
757
|
-
return typeof data.blockId === "string" && isObject(data.content) && data.protocolVersion === PROTOCOL_VERSION ? {
|
|
758
|
-
type: "cmssy:patch",
|
|
759
|
-
blockId: data.blockId,
|
|
760
|
-
content: data.content,
|
|
761
|
-
protocolVersion: PROTOCOL_VERSION,
|
|
762
|
-
...isObject(data.style) ? { style: data.style } : {},
|
|
763
|
-
...isObject(data.advanced) ? { advanced: data.advanced } : {},
|
|
764
|
-
...typeof data.layoutPosition === "string" ? { layoutPosition: data.layoutPosition } : {}
|
|
765
|
-
} : null;
|
|
766
|
-
case "cmssy:parent-ready":
|
|
767
|
-
return data.protocolVersion === PROTOCOL_VERSION ? { type: "cmssy:parent-ready", protocolVersion: PROTOCOL_VERSION } : null;
|
|
768
|
-
case "cmssy:insert":
|
|
769
|
-
return typeof data.blockId === "string" && typeof data.blockType === "string" && isObject(data.content) && typeof data.index === "number" && data.protocolVersion === PROTOCOL_VERSION ? {
|
|
770
|
-
type: "cmssy:insert",
|
|
771
|
-
protocolVersion: PROTOCOL_VERSION,
|
|
772
|
-
blockId: data.blockId,
|
|
773
|
-
blockType: data.blockType,
|
|
774
|
-
content: data.content,
|
|
775
|
-
...isObject(data.style) ? { style: data.style } : {},
|
|
776
|
-
...isObject(data.advanced) ? { advanced: data.advanced } : {},
|
|
777
|
-
index: data.index
|
|
778
|
-
} : null;
|
|
779
|
-
case "cmssy:reorder":
|
|
780
|
-
return Array.isArray(data.blockIds) && data.blockIds.every((id) => typeof id === "string") && data.protocolVersion === PROTOCOL_VERSION ? {
|
|
781
|
-
type: "cmssy:reorder",
|
|
782
|
-
protocolVersion: PROTOCOL_VERSION,
|
|
783
|
-
blockIds: data.blockIds
|
|
784
|
-
} : null;
|
|
785
|
-
case "cmssy:remove":
|
|
786
|
-
return typeof data.blockId === "string" && data.protocolVersion === PROTOCOL_VERSION ? {
|
|
787
|
-
type: "cmssy:remove",
|
|
788
|
-
protocolVersion: PROTOCOL_VERSION,
|
|
789
|
-
blockId: data.blockId
|
|
790
|
-
} : null;
|
|
791
|
-
case "cmssy:drag-over":
|
|
792
|
-
return typeof data.y === "number" && data.protocolVersion === PROTOCOL_VERSION ? {
|
|
793
|
-
type: "cmssy:drag-over",
|
|
794
|
-
protocolVersion: PROTOCOL_VERSION,
|
|
795
|
-
y: data.y
|
|
796
|
-
} : null;
|
|
797
|
-
case "cmssy:drag-end":
|
|
798
|
-
return data.protocolVersion === PROTOCOL_VERSION ? { type: "cmssy:drag-end", protocolVersion: PROTOCOL_VERSION } : null;
|
|
799
|
-
default:
|
|
800
|
-
return null;
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
// src/data/settings-client.ts
|
|
805
|
-
async function fetchSiteConfig(config, options = {}) {
|
|
806
|
-
const data = await graphqlRequest(
|
|
807
|
-
config,
|
|
808
|
-
SITE_CONFIG_QUERY,
|
|
809
|
-
{ workspaceSlug: config.workspaceSlug },
|
|
810
|
-
{ ...options, public: true, retry: options.retry ?? {} },
|
|
811
|
-
"site config query"
|
|
812
|
-
);
|
|
813
|
-
return data.public?.siteConfig ?? null;
|
|
814
|
-
}
|
|
815
|
-
async function resolveWorkspaceId(config, options = {}) {
|
|
816
|
-
const siteConfig = await fetchSiteConfig(config, options);
|
|
817
|
-
if (!siteConfig?.workspaceId) {
|
|
818
|
-
throw new Error(
|
|
819
|
-
`cmssy: could not resolve workspaceId for "${config.workspaceSlug}"`
|
|
820
|
-
);
|
|
821
|
-
}
|
|
822
|
-
return siteConfig.workspaceId;
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
// src/data/client.ts
|
|
826
|
-
function createCmssyClient(input) {
|
|
827
|
-
const config = {
|
|
828
|
-
...input,
|
|
829
|
-
apiUrl: resolveApiUrl(input.apiUrl)
|
|
830
|
-
};
|
|
831
|
-
let cachedWorkspaceId;
|
|
832
|
-
let inFlight;
|
|
833
|
-
function resolveWorkspaceId2(options) {
|
|
834
|
-
if (cachedWorkspaceId) return Promise.resolve(cachedWorkspaceId);
|
|
835
|
-
if (!inFlight) {
|
|
836
|
-
inFlight = resolveWorkspaceId(config, options).then((id) => {
|
|
837
|
-
cachedWorkspaceId = id;
|
|
838
|
-
return id;
|
|
839
|
-
}).finally(() => {
|
|
840
|
-
inFlight = void 0;
|
|
841
|
-
});
|
|
842
|
-
}
|
|
843
|
-
return inFlight;
|
|
844
|
-
}
|
|
845
|
-
return {
|
|
846
|
-
config,
|
|
847
|
-
resolveWorkspaceId: resolveWorkspaceId2,
|
|
848
|
-
query(document2, variables = {}, options) {
|
|
849
|
-
return graphqlRequest(
|
|
850
|
-
config,
|
|
851
|
-
document2,
|
|
852
|
-
variables,
|
|
853
|
-
options,
|
|
854
|
-
"graphql operation"
|
|
855
|
-
);
|
|
856
|
-
},
|
|
857
|
-
async queryScoped(document2, variables = {}, options = {}) {
|
|
858
|
-
const { workspaceId: provided, headers, ...rest } = options;
|
|
859
|
-
const workspaceId = provided ?? await resolveWorkspaceId2({ ...rest, headers });
|
|
860
|
-
const hasWorkspaceId = variables.workspaceId !== void 0 && variables.workspaceId !== null;
|
|
861
|
-
const scopedVariables = /\$workspaceId\b/.test(document2) && !hasWorkspaceId ? { ...variables, workspaceId } : variables;
|
|
862
|
-
return graphqlRequest(
|
|
863
|
-
config,
|
|
864
|
-
document2,
|
|
865
|
-
scopedVariables,
|
|
866
|
-
{ ...rest, headers: { ...headers, "x-workspace-id": workspaceId } },
|
|
867
|
-
"graphql operation"
|
|
868
|
-
);
|
|
869
|
-
}
|
|
870
|
-
};
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
// src/data/resolve-forms.ts
|
|
874
|
-
function collectFormIds(blocks, locale, defaultLocale) {
|
|
875
|
-
const ids = /* @__PURE__ */ new Set();
|
|
876
|
-
for (const block of blocks) {
|
|
877
|
-
const content = getBlockContentForLanguage(
|
|
878
|
-
block.content,
|
|
879
|
-
locale,
|
|
880
|
-
defaultLocale
|
|
881
|
-
);
|
|
882
|
-
const formId = content.formId;
|
|
883
|
-
if (typeof formId === "string" && formId.trim()) ids.add(formId);
|
|
884
|
-
}
|
|
885
|
-
return [...ids];
|
|
886
|
-
}
|
|
887
|
-
async function resolveForms(config, blocks, locale, defaultLocale, options) {
|
|
888
|
-
const ids = collectFormIds(blocks, locale, defaultLocale);
|
|
889
|
-
if (ids.length === 0) return {};
|
|
890
|
-
const client = createCmssyClient(config);
|
|
891
|
-
const entries = await Promise.all(
|
|
892
|
-
ids.map(async (id) => {
|
|
893
|
-
try {
|
|
894
|
-
const data = await client.queryScoped(FORM_QUERY, { formId: id }, options);
|
|
895
|
-
return [id, data.public.form.get];
|
|
896
|
-
} catch (err) {
|
|
897
|
-
if (typeof console !== "undefined") {
|
|
898
|
-
console.warn(`[cmssy] failed to resolve form ${id}`, err);
|
|
899
|
-
}
|
|
900
|
-
return [id, null];
|
|
901
|
-
}
|
|
902
|
-
})
|
|
903
|
-
);
|
|
904
|
-
const forms = {};
|
|
905
|
-
for (const [id, def] of entries) {
|
|
906
|
-
if (def) forms[id] = def;
|
|
907
|
-
}
|
|
908
|
-
return forms;
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
// src/data/localize-href.ts
|
|
912
|
-
var PROTOCOL_OR_RELATIVE = /^([a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
913
|
-
function isExternalHref(href) {
|
|
914
|
-
const value = href.trim();
|
|
915
|
-
if (!value) return true;
|
|
916
|
-
if (value.startsWith("#")) return true;
|
|
917
|
-
return PROTOCOL_OR_RELATIVE.test(value);
|
|
918
|
-
}
|
|
919
|
-
function stripLeadingLocale(path, locale) {
|
|
920
|
-
const segments = path.split("/");
|
|
921
|
-
const first = segments[1];
|
|
922
|
-
if (first && first !== locale.default && locale.enabled.includes(first)) {
|
|
923
|
-
segments.splice(1, 1);
|
|
924
|
-
const rest = segments.join("/");
|
|
925
|
-
return rest === "" ? "/" : rest;
|
|
926
|
-
}
|
|
927
|
-
return path;
|
|
928
|
-
}
|
|
929
|
-
function addLocalePrefix(path, target, locale) {
|
|
930
|
-
if (target === locale.default) return path;
|
|
931
|
-
if (path === "/") return `/${target}`;
|
|
932
|
-
return `/${target}${path}`;
|
|
933
|
-
}
|
|
934
|
-
function localizeHref(href, locale) {
|
|
935
|
-
const value = href.trim();
|
|
936
|
-
if (isExternalHref(value)) return href;
|
|
937
|
-
const boundary = value.search(/[?#]/);
|
|
938
|
-
const path = boundary === -1 ? value : value.slice(0, boundary);
|
|
939
|
-
const suffix = boundary === -1 ? "" : value.slice(boundary);
|
|
940
|
-
if (!path.startsWith("/")) return href;
|
|
941
|
-
const bare = stripLeadingLocale(path, locale);
|
|
942
|
-
return `${addLocalePrefix(bare, locale.current, locale)}${suffix}`;
|
|
943
|
-
}
|
|
944
|
-
function buildLocaleSwitchHref(target, pathname, locale) {
|
|
945
|
-
const path = pathname && pathname.startsWith("/") ? pathname : "/";
|
|
946
|
-
const bare = stripLeadingLocale(path, locale);
|
|
947
|
-
return addLocalePrefix(bare, target, locale);
|
|
948
|
-
}
|
|
949
|
-
var ANCHOR_HREF = /(<a\b(?:"[^"]*"|'[^']*'|[^>])*?\shref=)(["'])(.*?)\2/gi;
|
|
950
|
-
function localizeHtmlLinks(html, locale) {
|
|
951
|
-
return html.replace(
|
|
952
|
-
ANCHOR_HREF,
|
|
953
|
-
(_match, prefix, quote, url) => `${prefix}${quote}${localizeHref(url, locale)}${quote}`
|
|
954
|
-
);
|
|
955
|
-
}
|
|
956
225
|
function CmssyBlock({
|
|
957
226
|
block,
|
|
958
227
|
locale,
|
|
@@ -966,10 +235,10 @@ function CmssyBlock({
|
|
|
966
235
|
context
|
|
967
236
|
}) {
|
|
968
237
|
const Component = Object.hasOwn(blockMap, block.type) ? blockMap[block.type] : void 0;
|
|
969
|
-
const base = getBlockContentForLanguage(block.content, locale, defaultLocale);
|
|
238
|
+
const base = core.getBlockContentForLanguage(block.content, locale, defaultLocale);
|
|
970
239
|
const content = patchedContent ? { ...base, ...patchedContent } : base;
|
|
971
|
-
const style = patchedStyle ? { ...asBucket(block.style), ...patchedStyle } : asBucket(block.style);
|
|
972
|
-
const advanced = patchedAdvanced ? { ...asBucket(block.advanced), ...patchedAdvanced } : asBucket(block.advanced);
|
|
240
|
+
const style = patchedStyle ? { ...core.asBucket(block.style), ...patchedStyle } : core.asBucket(block.style);
|
|
241
|
+
const advanced = patchedAdvanced ? { ...core.asBucket(block.advanced), ...patchedAdvanced } : core.asBucket(block.advanced);
|
|
973
242
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
974
243
|
"div",
|
|
975
244
|
{
|
|
@@ -988,49 +257,151 @@ function CmssyBlock({
|
|
|
988
257
|
);
|
|
989
258
|
}
|
|
990
259
|
|
|
260
|
+
Object.defineProperty(exports, "CmssyRequestError", {
|
|
261
|
+
enumerable: true,
|
|
262
|
+
get: function () { return core.CmssyRequestError; }
|
|
263
|
+
});
|
|
264
|
+
Object.defineProperty(exports, "DEFAULT_CMSSY_API_URL", {
|
|
265
|
+
enumerable: true,
|
|
266
|
+
get: function () { return core.DEFAULT_CMSSY_API_URL; }
|
|
267
|
+
});
|
|
268
|
+
Object.defineProperty(exports, "FORM_QUERY", {
|
|
269
|
+
enumerable: true,
|
|
270
|
+
get: function () { return core.FORM_QUERY; }
|
|
271
|
+
});
|
|
272
|
+
Object.defineProperty(exports, "MODEL_DEFINITIONS_QUERY", {
|
|
273
|
+
enumerable: true,
|
|
274
|
+
get: function () { return core.MODEL_DEFINITIONS_QUERY; }
|
|
275
|
+
});
|
|
276
|
+
Object.defineProperty(exports, "MODEL_RECORDS_QUERY", {
|
|
277
|
+
enumerable: true,
|
|
278
|
+
get: function () { return core.MODEL_RECORDS_QUERY; }
|
|
279
|
+
});
|
|
280
|
+
Object.defineProperty(exports, "PROTOCOL_VERSION", {
|
|
281
|
+
enumerable: true,
|
|
282
|
+
get: function () { return core.PROTOCOL_VERSION; }
|
|
283
|
+
});
|
|
284
|
+
Object.defineProperty(exports, "SITE_CONFIG_QUERY", {
|
|
285
|
+
enumerable: true,
|
|
286
|
+
get: function () { return core.SITE_CONFIG_QUERY; }
|
|
287
|
+
});
|
|
288
|
+
Object.defineProperty(exports, "SUBMIT_FORM_MUTATION", {
|
|
289
|
+
enumerable: true,
|
|
290
|
+
get: function () { return core.SUBMIT_FORM_MUTATION; }
|
|
291
|
+
});
|
|
292
|
+
Object.defineProperty(exports, "buildBlockContext", {
|
|
293
|
+
enumerable: true,
|
|
294
|
+
get: function () { return core.buildBlockContext; }
|
|
295
|
+
});
|
|
296
|
+
Object.defineProperty(exports, "buildLocaleSwitchHref", {
|
|
297
|
+
enumerable: true,
|
|
298
|
+
get: function () { return core.buildLocaleSwitchHref; }
|
|
299
|
+
});
|
|
300
|
+
Object.defineProperty(exports, "collectFormIds", {
|
|
301
|
+
enumerable: true,
|
|
302
|
+
get: function () { return core.collectFormIds; }
|
|
303
|
+
});
|
|
304
|
+
Object.defineProperty(exports, "createCmssyClient", {
|
|
305
|
+
enumerable: true,
|
|
306
|
+
get: function () { return core.createCmssyClient; }
|
|
307
|
+
});
|
|
308
|
+
Object.defineProperty(exports, "fetchLayouts", {
|
|
309
|
+
enumerable: true,
|
|
310
|
+
get: function () { return core.fetchLayouts; }
|
|
311
|
+
});
|
|
312
|
+
Object.defineProperty(exports, "fetchPage", {
|
|
313
|
+
enumerable: true,
|
|
314
|
+
get: function () { return core.fetchPage; }
|
|
315
|
+
});
|
|
316
|
+
Object.defineProperty(exports, "fetchPageById", {
|
|
317
|
+
enumerable: true,
|
|
318
|
+
get: function () { return core.fetchPageById; }
|
|
319
|
+
});
|
|
320
|
+
Object.defineProperty(exports, "fetchPageMeta", {
|
|
321
|
+
enumerable: true,
|
|
322
|
+
get: function () { return core.fetchPageMeta; }
|
|
323
|
+
});
|
|
324
|
+
Object.defineProperty(exports, "fetchPages", {
|
|
325
|
+
enumerable: true,
|
|
326
|
+
get: function () { return core.fetchPages; }
|
|
327
|
+
});
|
|
328
|
+
Object.defineProperty(exports, "fetchSiteConfig", {
|
|
329
|
+
enumerable: true,
|
|
330
|
+
get: function () { return core.fetchSiteConfig; }
|
|
331
|
+
});
|
|
332
|
+
Object.defineProperty(exports, "fields", {
|
|
333
|
+
enumerable: true,
|
|
334
|
+
get: function () { return core.fields; }
|
|
335
|
+
});
|
|
336
|
+
Object.defineProperty(exports, "getBlockContentForLanguage", {
|
|
337
|
+
enumerable: true,
|
|
338
|
+
get: function () { return core.getBlockContentForLanguage; }
|
|
339
|
+
});
|
|
340
|
+
Object.defineProperty(exports, "graphqlRequest", {
|
|
341
|
+
enumerable: true,
|
|
342
|
+
get: function () { return core.graphqlRequest; }
|
|
343
|
+
});
|
|
344
|
+
Object.defineProperty(exports, "isProtocolCompatible", {
|
|
345
|
+
enumerable: true,
|
|
346
|
+
get: function () { return core.isProtocolCompatible; }
|
|
347
|
+
});
|
|
348
|
+
Object.defineProperty(exports, "localizeHref", {
|
|
349
|
+
enumerable: true,
|
|
350
|
+
get: function () { return core.localizeHref; }
|
|
351
|
+
});
|
|
352
|
+
Object.defineProperty(exports, "localizeHtmlLinks", {
|
|
353
|
+
enumerable: true,
|
|
354
|
+
get: function () { return core.localizeHtmlLinks; }
|
|
355
|
+
});
|
|
356
|
+
Object.defineProperty(exports, "normalizeOrigin", {
|
|
357
|
+
enumerable: true,
|
|
358
|
+
get: function () { return core.normalizeOrigin; }
|
|
359
|
+
});
|
|
360
|
+
Object.defineProperty(exports, "normalizeSlug", {
|
|
361
|
+
enumerable: true,
|
|
362
|
+
get: function () { return core.normalizeSlug; }
|
|
363
|
+
});
|
|
364
|
+
Object.defineProperty(exports, "parseEditorMessage", {
|
|
365
|
+
enumerable: true,
|
|
366
|
+
get: function () { return core.parseEditorMessage; }
|
|
367
|
+
});
|
|
368
|
+
Object.defineProperty(exports, "postToEditor", {
|
|
369
|
+
enumerable: true,
|
|
370
|
+
get: function () { return core.postToEditor; }
|
|
371
|
+
});
|
|
372
|
+
Object.defineProperty(exports, "resolveApiUrl", {
|
|
373
|
+
enumerable: true,
|
|
374
|
+
get: function () { return core.resolveApiUrl; }
|
|
375
|
+
});
|
|
376
|
+
Object.defineProperty(exports, "resolveForms", {
|
|
377
|
+
enumerable: true,
|
|
378
|
+
get: function () { return core.resolveForms; }
|
|
379
|
+
});
|
|
380
|
+
Object.defineProperty(exports, "resolvePublicUrl", {
|
|
381
|
+
enumerable: true,
|
|
382
|
+
get: function () { return core.resolvePublicUrl; }
|
|
383
|
+
});
|
|
384
|
+
Object.defineProperty(exports, "resolveSiteLocales", {
|
|
385
|
+
enumerable: true,
|
|
386
|
+
get: function () { return core.resolveSiteLocales; }
|
|
387
|
+
});
|
|
388
|
+
Object.defineProperty(exports, "resolveWorkspaceId", {
|
|
389
|
+
enumerable: true,
|
|
390
|
+
get: function () { return core.resolveWorkspaceId; }
|
|
391
|
+
});
|
|
392
|
+
Object.defineProperty(exports, "splitLocaleFromPath", {
|
|
393
|
+
enumerable: true,
|
|
394
|
+
get: function () { return core.splitLocaleFromPath; }
|
|
395
|
+
});
|
|
991
396
|
Object.defineProperty(exports, "evaluateFieldConditionGroup", {
|
|
992
397
|
enumerable: true,
|
|
993
398
|
get: function () { return types.evaluateFieldConditionGroup; }
|
|
994
399
|
});
|
|
995
400
|
exports.CmssyBlock = CmssyBlock;
|
|
996
|
-
exports.CmssyRequestError = CmssyRequestError;
|
|
997
401
|
exports.CmssyServerLayout = CmssyServerLayout;
|
|
998
402
|
exports.CmssyServerPage = CmssyServerPage;
|
|
999
|
-
exports.DEFAULT_CMSSY_API_URL = DEFAULT_CMSSY_API_URL;
|
|
1000
|
-
exports.FORM_QUERY = FORM_QUERY;
|
|
1001
|
-
exports.MODEL_DEFINITIONS_QUERY = MODEL_DEFINITIONS_QUERY;
|
|
1002
|
-
exports.MODEL_RECORDS_QUERY = MODEL_RECORDS_QUERY;
|
|
1003
|
-
exports.PROTOCOL_VERSION = PROTOCOL_VERSION;
|
|
1004
|
-
exports.SITE_CONFIG_QUERY = SITE_CONFIG_QUERY;
|
|
1005
|
-
exports.SUBMIT_FORM_MUTATION = SUBMIT_FORM_MUTATION;
|
|
1006
403
|
exports.UnknownBlock = UnknownBlock;
|
|
1007
404
|
exports.blocksToMeta = blocksToMeta;
|
|
1008
405
|
exports.blocksToSchemas = blocksToSchemas;
|
|
1009
|
-
exports.buildBlockContext = buildBlockContext;
|
|
1010
406
|
exports.buildBlockMap = buildBlockMap;
|
|
1011
|
-
exports.buildLocaleSwitchHref = buildLocaleSwitchHref;
|
|
1012
|
-
exports.collectFormIds = collectFormIds;
|
|
1013
|
-
exports.createCmssyClient = createCmssyClient;
|
|
1014
407
|
exports.defineBlock = defineBlock;
|
|
1015
|
-
exports.fetchLayouts = fetchLayouts;
|
|
1016
|
-
exports.fetchPage = fetchPage;
|
|
1017
|
-
exports.fetchPageById = fetchPageById;
|
|
1018
|
-
exports.fetchPageMeta = fetchPageMeta;
|
|
1019
|
-
exports.fetchPages = fetchPages;
|
|
1020
|
-
exports.fetchSiteConfig = fetchSiteConfig;
|
|
1021
|
-
exports.fields = fields;
|
|
1022
|
-
exports.getBlockContentForLanguage = getBlockContentForLanguage;
|
|
1023
|
-
exports.graphqlRequest = graphqlRequest;
|
|
1024
|
-
exports.isProtocolCompatible = isProtocolCompatible;
|
|
1025
|
-
exports.localizeHref = localizeHref;
|
|
1026
|
-
exports.localizeHtmlLinks = localizeHtmlLinks;
|
|
1027
|
-
exports.normalizeOrigin = normalizeOrigin;
|
|
1028
|
-
exports.normalizeSlug = normalizeSlug;
|
|
1029
|
-
exports.parseEditorMessage = parseEditorMessage;
|
|
1030
|
-
exports.postToEditor = postToEditor;
|
|
1031
|
-
exports.resolveApiUrl = resolveApiUrl;
|
|
1032
|
-
exports.resolveForms = resolveForms;
|
|
1033
|
-
exports.resolvePublicUrl = resolvePublicUrl;
|
|
1034
|
-
exports.resolveSiteLocales = resolveSiteLocales;
|
|
1035
|
-
exports.resolveWorkspaceId = resolveWorkspaceId;
|
|
1036
|
-
exports.splitLocaleFromPath = splitLocaleFromPath;
|