@cmssy/react 0.5.4 → 0.5.6
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 +4 -2
- package/dist/client.d.cts +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/client.js +4 -2
- package/dist/{commerce-queries-DLiN9uHz.d.cts → commerce-queries-Dx6EW4Sr.d.cts} +30 -3
- package/dist/{commerce-queries-DLiN9uHz.d.ts → commerce-queries-Dx6EW4Sr.d.ts} +30 -3
- package/dist/index.cjs +27 -12
- package/dist/index.d.cts +9 -5
- package/dist/index.d.ts +9 -5
- package/dist/index.js +26 -13
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -447,7 +447,7 @@ function useDragAgent(config) {
|
|
|
447
447
|
}
|
|
448
448
|
|
|
449
449
|
// src/components/block-context.ts
|
|
450
|
-
function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, forms) {
|
|
450
|
+
function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, forms, extra) {
|
|
451
451
|
return {
|
|
452
452
|
locale: {
|
|
453
453
|
current: locale,
|
|
@@ -455,7 +455,9 @@ function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, for
|
|
|
455
455
|
enabled: enabledLocales && enabledLocales.length > 0 ? enabledLocales : Array.from(/* @__PURE__ */ new Set([defaultLocale, locale]))
|
|
456
456
|
},
|
|
457
457
|
isPreview: isPreview ?? false,
|
|
458
|
-
forms
|
|
458
|
+
forms,
|
|
459
|
+
...{},
|
|
460
|
+
...{}
|
|
459
461
|
};
|
|
460
462
|
}
|
|
461
463
|
|
package/dist/client.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { B as BlockSchema, a as BlockMeta, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, e as CmssyLocaleContext, f as CmssyCart, g as CmssyOrder, h as CmssyProduct } from './commerce-queries-
|
|
3
|
-
export { i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, l as CmssyOrderItem, m as CmssyProductVariant } from './commerce-queries-
|
|
2
|
+
import { B as BlockSchema, a as BlockMeta, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, e as CmssyLocaleContext, f as CmssyCart, g as CmssyOrder, h as CmssyProduct } from './commerce-queries-Dx6EW4Sr.cjs';
|
|
3
|
+
export { i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, l as CmssyOrderItem, m as CmssyProductVariant } from './commerce-queries-Dx6EW4Sr.cjs';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
|
|
6
6
|
interface EditBridgeConfig {
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { B as BlockSchema, a as BlockMeta, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, e as CmssyLocaleContext, f as CmssyCart, g as CmssyOrder, h as CmssyProduct } from './commerce-queries-
|
|
3
|
-
export { i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, l as CmssyOrderItem, m as CmssyProductVariant } from './commerce-queries-
|
|
2
|
+
import { B as BlockSchema, a as BlockMeta, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, e as CmssyLocaleContext, f as CmssyCart, g as CmssyOrder, h as CmssyProduct } from './commerce-queries-Dx6EW4Sr.js';
|
|
3
|
+
export { i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, l as CmssyOrderItem, m as CmssyProductVariant } from './commerce-queries-Dx6EW4Sr.js';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
|
|
6
6
|
interface EditBridgeConfig {
|
package/dist/client.js
CHANGED
|
@@ -445,7 +445,7 @@ function useDragAgent(config) {
|
|
|
445
445
|
}
|
|
446
446
|
|
|
447
447
|
// src/components/block-context.ts
|
|
448
|
-
function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, forms) {
|
|
448
|
+
function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, forms, extra) {
|
|
449
449
|
return {
|
|
450
450
|
locale: {
|
|
451
451
|
current: locale,
|
|
@@ -453,7 +453,9 @@ function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, for
|
|
|
453
453
|
enabled: enabledLocales && enabledLocales.length > 0 ? enabledLocales : Array.from(/* @__PURE__ */ new Set([defaultLocale, locale]))
|
|
454
454
|
},
|
|
455
455
|
isPreview: isPreview ?? false,
|
|
456
|
-
forms
|
|
456
|
+
forms,
|
|
457
|
+
...{},
|
|
458
|
+
...{}
|
|
457
459
|
};
|
|
458
460
|
}
|
|
459
461
|
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* The cmssy cloud GraphQL delivery endpoint. It is the same for every workspace,
|
|
5
|
+
* so consumers never need to set it - `apiUrl` defaults to this. Self-hosted /
|
|
6
|
+
* staging deployments override it via config.
|
|
7
|
+
*/
|
|
8
|
+
declare const DEFAULT_CMSSY_API_URL = "https://api.cmssy.io/graphql";
|
|
9
|
+
/** Resolves `apiUrl`, falling back to the cmssy cloud endpoint when unset. */
|
|
10
|
+
declare function resolveApiUrl(apiUrl: string | undefined): string;
|
|
3
11
|
interface CmssyClientConfig {
|
|
4
|
-
|
|
12
|
+
/** Full GraphQL delivery endpoint. Defaults to {@link DEFAULT_CMSSY_API_URL}. */
|
|
13
|
+
apiUrl?: string;
|
|
5
14
|
workspaceSlug: string;
|
|
6
15
|
}
|
|
7
16
|
interface FetchLikeResponse {
|
|
@@ -155,12 +164,30 @@ interface CmssyLocaleContext {
|
|
|
155
164
|
default: string;
|
|
156
165
|
enabled: string[];
|
|
157
166
|
}
|
|
167
|
+
interface CmssyBlockMember {
|
|
168
|
+
recordId: string;
|
|
169
|
+
email: string;
|
|
170
|
+
}
|
|
171
|
+
interface CmssyBlockAuthContext {
|
|
172
|
+
isAuthenticated: boolean;
|
|
173
|
+
member: CmssyBlockMember | null;
|
|
174
|
+
}
|
|
175
|
+
interface CmssyBlockWorkspace {
|
|
176
|
+
id: string;
|
|
177
|
+
slug: string;
|
|
178
|
+
}
|
|
158
179
|
interface CmssyBlockContext {
|
|
159
180
|
locale: CmssyLocaleContext;
|
|
160
181
|
isPreview: boolean;
|
|
161
182
|
forms?: Record<string, CmssyFormDefinition>;
|
|
183
|
+
auth?: CmssyBlockAuthContext;
|
|
184
|
+
workspace?: CmssyBlockWorkspace;
|
|
185
|
+
}
|
|
186
|
+
interface BuildBlockContextExtra {
|
|
187
|
+
auth?: CmssyBlockAuthContext;
|
|
188
|
+
workspace?: CmssyBlockWorkspace;
|
|
162
189
|
}
|
|
163
|
-
declare function buildBlockContext(locale: string, defaultLocale: string, enabledLocales?: string[], isPreview?: boolean, forms?: Record<string, CmssyFormDefinition
|
|
190
|
+
declare function buildBlockContext(locale: string, defaultLocale: string, enabledLocales?: string[], isPreview?: boolean, forms?: Record<string, CmssyFormDefinition>, extra?: BuildBlockContextExtra): CmssyBlockContext;
|
|
164
191
|
|
|
165
192
|
declare const PROTOCOL_VERSION = 1;
|
|
166
193
|
type FieldType = "singleLine" | "multiLine" | "richText" | "numeric" | "date" | "media" | "link" | "select" | "multiselect" | "boolean" | "color" | "repeater";
|
|
@@ -425,4 +452,4 @@ interface CmssyOrder {
|
|
|
425
452
|
createdAt?: string;
|
|
426
453
|
}
|
|
427
454
|
|
|
428
|
-
export {
|
|
455
|
+
export { SITE_CONFIG_QUERY as $, type AppToEditorMessage as A, type BlockSchema as B, type CmssyPageData as C, type CmssyFormField as D, type EditorToAppMessage as E, type FieldDefinition as F, type CmssyFormSettings as G, type CmssyFormSubmitResponse as H, type CmssyLocalizedValue as I, type CmssyModelDefinition as J, type CmssyModelRecord as K, type CmssyPageMeta as L, type CmssyPageSummary as M, type CmssyRecordList as N, DEFAULT_CMSSY_API_URL as O, FORM_QUERY as P, type FetchLikeResponse as Q, type RawBlock as R, type FetchPageOptions as S, type FieldType as T, MODEL_DEFINITIONS_QUERY as U, MODEL_RECORDS_QUERY as V, PROTOCOL_VERSION as W, type ParentReadyMessage as X, type PatchMessage as Y, type RawLayoutBlock as Z, type ReadyMessage as _, type BlockMeta as a, SUBMIT_FORM_MUTATION as a0, type SelectMessage as a1, type SubmitFormInput as a2, blocksToMeta as a3, blocksToSchemas as a4, buildBlockContext as a5, buildBlockMap as a6, defineBlock as a7, fetchLayouts as a8, fetchPage as a9, fetchPageById as aa, fetchPageMeta as ab, fetchPages as ac, isProtocolCompatible as ad, normalizeSlug as ae, resolveApiUrl as af, type BlockDefinition as b, type CmssyFormDefinition as c, type CmssyLayoutGroup as d, type CmssyLocaleContext as e, type CmssyCart as f, type CmssyOrder as g, type CmssyProduct as h, type CmssyCartDiscount as i, type CmssyCartItem as j, type CmssyCartItemSnapshot as k, type CmssyOrderItem as l, type CmssyProductVariant as m, type CmssyBlockAuthContext as n, type CmssyBlockWorkspace as o, type FetchLike as p, type CmssyClientConfig as q, type CmssySiteConfig as r, type BlockMap as s, type CmssyBlockContext as t, type BlockRect as u, type BoundsMessage as v, type BuildBlockContextExtra as w, type ClickMessage as x, type CmssyBlockMember as y, type CmssyBranding as z };
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* The cmssy cloud GraphQL delivery endpoint. It is the same for every workspace,
|
|
5
|
+
* so consumers never need to set it - `apiUrl` defaults to this. Self-hosted /
|
|
6
|
+
* staging deployments override it via config.
|
|
7
|
+
*/
|
|
8
|
+
declare const DEFAULT_CMSSY_API_URL = "https://api.cmssy.io/graphql";
|
|
9
|
+
/** Resolves `apiUrl`, falling back to the cmssy cloud endpoint when unset. */
|
|
10
|
+
declare function resolveApiUrl(apiUrl: string | undefined): string;
|
|
3
11
|
interface CmssyClientConfig {
|
|
4
|
-
|
|
12
|
+
/** Full GraphQL delivery endpoint. Defaults to {@link DEFAULT_CMSSY_API_URL}. */
|
|
13
|
+
apiUrl?: string;
|
|
5
14
|
workspaceSlug: string;
|
|
6
15
|
}
|
|
7
16
|
interface FetchLikeResponse {
|
|
@@ -155,12 +164,30 @@ interface CmssyLocaleContext {
|
|
|
155
164
|
default: string;
|
|
156
165
|
enabled: string[];
|
|
157
166
|
}
|
|
167
|
+
interface CmssyBlockMember {
|
|
168
|
+
recordId: string;
|
|
169
|
+
email: string;
|
|
170
|
+
}
|
|
171
|
+
interface CmssyBlockAuthContext {
|
|
172
|
+
isAuthenticated: boolean;
|
|
173
|
+
member: CmssyBlockMember | null;
|
|
174
|
+
}
|
|
175
|
+
interface CmssyBlockWorkspace {
|
|
176
|
+
id: string;
|
|
177
|
+
slug: string;
|
|
178
|
+
}
|
|
158
179
|
interface CmssyBlockContext {
|
|
159
180
|
locale: CmssyLocaleContext;
|
|
160
181
|
isPreview: boolean;
|
|
161
182
|
forms?: Record<string, CmssyFormDefinition>;
|
|
183
|
+
auth?: CmssyBlockAuthContext;
|
|
184
|
+
workspace?: CmssyBlockWorkspace;
|
|
185
|
+
}
|
|
186
|
+
interface BuildBlockContextExtra {
|
|
187
|
+
auth?: CmssyBlockAuthContext;
|
|
188
|
+
workspace?: CmssyBlockWorkspace;
|
|
162
189
|
}
|
|
163
|
-
declare function buildBlockContext(locale: string, defaultLocale: string, enabledLocales?: string[], isPreview?: boolean, forms?: Record<string, CmssyFormDefinition
|
|
190
|
+
declare function buildBlockContext(locale: string, defaultLocale: string, enabledLocales?: string[], isPreview?: boolean, forms?: Record<string, CmssyFormDefinition>, extra?: BuildBlockContextExtra): CmssyBlockContext;
|
|
164
191
|
|
|
165
192
|
declare const PROTOCOL_VERSION = 1;
|
|
166
193
|
type FieldType = "singleLine" | "multiLine" | "richText" | "numeric" | "date" | "media" | "link" | "select" | "multiselect" | "boolean" | "color" | "repeater";
|
|
@@ -425,4 +452,4 @@ interface CmssyOrder {
|
|
|
425
452
|
createdAt?: string;
|
|
426
453
|
}
|
|
427
454
|
|
|
428
|
-
export {
|
|
455
|
+
export { SITE_CONFIG_QUERY as $, type AppToEditorMessage as A, type BlockSchema as B, type CmssyPageData as C, type CmssyFormField as D, type EditorToAppMessage as E, type FieldDefinition as F, type CmssyFormSettings as G, type CmssyFormSubmitResponse as H, type CmssyLocalizedValue as I, type CmssyModelDefinition as J, type CmssyModelRecord as K, type CmssyPageMeta as L, type CmssyPageSummary as M, type CmssyRecordList as N, DEFAULT_CMSSY_API_URL as O, FORM_QUERY as P, type FetchLikeResponse as Q, type RawBlock as R, type FetchPageOptions as S, type FieldType as T, MODEL_DEFINITIONS_QUERY as U, MODEL_RECORDS_QUERY as V, PROTOCOL_VERSION as W, type ParentReadyMessage as X, type PatchMessage as Y, type RawLayoutBlock as Z, type ReadyMessage as _, type BlockMeta as a, SUBMIT_FORM_MUTATION as a0, type SelectMessage as a1, type SubmitFormInput as a2, blocksToMeta as a3, blocksToSchemas as a4, buildBlockContext as a5, buildBlockMap as a6, defineBlock as a7, fetchLayouts as a8, fetchPage as a9, fetchPageById as aa, fetchPageMeta as ab, fetchPages as ac, isProtocolCompatible as ad, normalizeSlug as ae, resolveApiUrl as af, type BlockDefinition as b, type CmssyFormDefinition as c, type CmssyLayoutGroup as d, type CmssyLocaleContext as e, type CmssyCart as f, type CmssyOrder as g, type CmssyProduct as h, type CmssyCartDiscount as i, type CmssyCartItem as j, type CmssyCartItemSnapshot as k, type CmssyOrderItem as l, type CmssyProductVariant as m, type CmssyBlockAuthContext as n, type CmssyBlockWorkspace as o, type FetchLike as p, type CmssyClientConfig as q, type CmssySiteConfig as r, type BlockMap as s, type CmssyBlockContext as t, type BlockRect as u, type BoundsMessage as v, type BuildBlockContextExtra as w, type ClickMessage as x, type CmssyBlockMember as y, type CmssyBranding as z };
|
package/dist/index.cjs
CHANGED
|
@@ -92,7 +92,7 @@ function getBlockContentForLanguage(content, locale, defaultLocale = "en", avail
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
// src/components/block-context.ts
|
|
95
|
-
function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, forms) {
|
|
95
|
+
function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, forms, extra) {
|
|
96
96
|
return {
|
|
97
97
|
locale: {
|
|
98
98
|
current: locale,
|
|
@@ -100,7 +100,9 @@ function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, for
|
|
|
100
100
|
enabled: enabledLocales && enabledLocales.length > 0 ? enabledLocales : Array.from(/* @__PURE__ */ new Set([defaultLocale, locale]))
|
|
101
101
|
},
|
|
102
102
|
isPreview: isPreview ?? false,
|
|
103
|
-
forms
|
|
103
|
+
forms,
|
|
104
|
+
...extra?.auth ? { auth: extra.auth } : {},
|
|
105
|
+
...extra?.workspace ? { workspace: extra.workspace } : {}
|
|
104
106
|
};
|
|
105
107
|
}
|
|
106
108
|
var WARN_CAP = 256;
|
|
@@ -139,7 +141,9 @@ async function CmssyServerPage({
|
|
|
139
141
|
locale = "en",
|
|
140
142
|
defaultLocale = "en",
|
|
141
143
|
enabledLocales,
|
|
142
|
-
forms
|
|
144
|
+
forms,
|
|
145
|
+
auth,
|
|
146
|
+
workspace
|
|
143
147
|
}) {
|
|
144
148
|
if (!page) return null;
|
|
145
149
|
const map = buildBlockMap(blocks);
|
|
@@ -149,7 +153,8 @@ async function CmssyServerPage({
|
|
|
149
153
|
defaultLocale,
|
|
150
154
|
enabledLocales,
|
|
151
155
|
false,
|
|
152
|
-
forms
|
|
156
|
+
forms,
|
|
157
|
+
{ auth, workspace }
|
|
153
158
|
);
|
|
154
159
|
const resolved = await Promise.all(
|
|
155
160
|
page.blocks.map(async (block) => {
|
|
@@ -283,6 +288,10 @@ function parseEditorMessage(data, origin, expectedOrigin) {
|
|
|
283
288
|
}
|
|
284
289
|
|
|
285
290
|
// src/content/content-client.ts
|
|
291
|
+
var DEFAULT_CMSSY_API_URL = "https://api.cmssy.io/graphql";
|
|
292
|
+
function resolveApiUrl(apiUrl) {
|
|
293
|
+
return apiUrl && apiUrl.length > 0 ? apiUrl : DEFAULT_CMSSY_API_URL;
|
|
294
|
+
}
|
|
286
295
|
var PUBLIC_PAGE_QUERY = `query PublicPage($workspaceSlug: String!, $slug: String!, $previewSecret: String) {
|
|
287
296
|
publicPage(workspaceSlug: $workspaceSlug, slug: $slug, previewSecret: $previewSecret) {
|
|
288
297
|
id
|
|
@@ -337,7 +346,7 @@ async function fetchPage(config, path, options = {}) {
|
|
|
337
346
|
}
|
|
338
347
|
const trimmedSecret = options.previewSecret?.trim();
|
|
339
348
|
const previewSecret = trimmedSecret ? trimmedSecret : null;
|
|
340
|
-
const response = await doFetch(config.apiUrl, {
|
|
349
|
+
const response = await doFetch(resolveApiUrl(config.apiUrl), {
|
|
341
350
|
method: "POST",
|
|
342
351
|
headers: { "content-type": "application/json" },
|
|
343
352
|
body: JSON.stringify({
|
|
@@ -385,7 +394,7 @@ async function fetchPageById(config, pageId, options = {}) {
|
|
|
385
394
|
"cmssy: no fetch implementation available - pass options.fetch"
|
|
386
395
|
);
|
|
387
396
|
}
|
|
388
|
-
const response = await doFetch(config.apiUrl, {
|
|
397
|
+
const response = await doFetch(resolveApiUrl(config.apiUrl), {
|
|
389
398
|
method: "POST",
|
|
390
399
|
headers: { "content-type": "application/json" },
|
|
391
400
|
body: JSON.stringify({
|
|
@@ -429,7 +438,7 @@ async function fetchPages(config, options = {}) {
|
|
|
429
438
|
"cmssy: no fetch implementation available - pass options.fetch"
|
|
430
439
|
);
|
|
431
440
|
}
|
|
432
|
-
const response = await doFetch(config.apiUrl, {
|
|
441
|
+
const response = await doFetch(resolveApiUrl(config.apiUrl), {
|
|
433
442
|
method: "POST",
|
|
434
443
|
headers: { "content-type": "application/json" },
|
|
435
444
|
body: JSON.stringify({
|
|
@@ -461,7 +470,7 @@ async function fetchPageMeta(config, path, options = {}) {
|
|
|
461
470
|
"cmssy: no fetch implementation available - pass options.fetch"
|
|
462
471
|
);
|
|
463
472
|
}
|
|
464
|
-
const response = await doFetch(config.apiUrl, {
|
|
473
|
+
const response = await doFetch(resolveApiUrl(config.apiUrl), {
|
|
465
474
|
method: "POST",
|
|
466
475
|
headers: { "content-type": "application/json" },
|
|
467
476
|
body: JSON.stringify({
|
|
@@ -495,7 +504,7 @@ async function fetchLayouts(config, path, options = {}) {
|
|
|
495
504
|
}
|
|
496
505
|
const trimmedSecret = options.previewSecret?.trim();
|
|
497
506
|
const previewSecret = trimmedSecret ? trimmedSecret : null;
|
|
498
|
-
const response = await doFetch(config.apiUrl, {
|
|
507
|
+
const response = await doFetch(resolveApiUrl(config.apiUrl), {
|
|
499
508
|
method: "POST",
|
|
500
509
|
headers: { "content-type": "application/json" },
|
|
501
510
|
body: JSON.stringify({
|
|
@@ -532,7 +541,7 @@ async function graphqlRequest(config, query, variables, options = {}, label = "r
|
|
|
532
541
|
"cmssy: no fetch implementation available - pass options.fetch"
|
|
533
542
|
);
|
|
534
543
|
}
|
|
535
|
-
const response = await doFetch(config.apiUrl, {
|
|
544
|
+
const response = await doFetch(resolveApiUrl(config.apiUrl), {
|
|
536
545
|
method: "POST",
|
|
537
546
|
headers: { "content-type": "application/json", ...options.headers },
|
|
538
547
|
body: JSON.stringify({ query, variables }),
|
|
@@ -640,7 +649,11 @@ async function resolveWorkspaceId(config, options = {}) {
|
|
|
640
649
|
}
|
|
641
650
|
|
|
642
651
|
// src/data/client.ts
|
|
643
|
-
function createCmssyClient(
|
|
652
|
+
function createCmssyClient(input) {
|
|
653
|
+
const config = {
|
|
654
|
+
...input,
|
|
655
|
+
apiUrl: resolveApiUrl(input.apiUrl)
|
|
656
|
+
};
|
|
644
657
|
let cachedWorkspaceId;
|
|
645
658
|
let inFlight;
|
|
646
659
|
function resolveWorkspaceId2(options) {
|
|
@@ -726,7 +739,7 @@ var TTL_MS = 6e4;
|
|
|
726
739
|
var MAX_ENTRIES = 64;
|
|
727
740
|
var cache = /* @__PURE__ */ new Map();
|
|
728
741
|
async function resolveSiteLocales(config, options) {
|
|
729
|
-
const key = `${config.apiUrl}::${config.workspaceSlug}`;
|
|
742
|
+
const key = `${resolveApiUrl(config.apiUrl)}::${config.workspaceSlug}`;
|
|
730
743
|
const cached = cache.get(key);
|
|
731
744
|
if (cached && cached.expires > Date.now()) return cached.value;
|
|
732
745
|
cache.delete(key);
|
|
@@ -835,6 +848,7 @@ function CmssyBlock({
|
|
|
835
848
|
exports.CmssyBlock = CmssyBlock;
|
|
836
849
|
exports.CmssyServerLayout = CmssyServerLayout;
|
|
837
850
|
exports.CmssyServerPage = CmssyServerPage;
|
|
851
|
+
exports.DEFAULT_CMSSY_API_URL = DEFAULT_CMSSY_API_URL;
|
|
838
852
|
exports.FORM_QUERY = FORM_QUERY;
|
|
839
853
|
exports.MODEL_DEFINITIONS_QUERY = MODEL_DEFINITIONS_QUERY;
|
|
840
854
|
exports.MODEL_RECORDS_QUERY = MODEL_RECORDS_QUERY;
|
|
@@ -866,6 +880,7 @@ exports.normalizeOrigin = normalizeOrigin;
|
|
|
866
880
|
exports.normalizeSlug = normalizeSlug;
|
|
867
881
|
exports.parseEditorMessage = parseEditorMessage;
|
|
868
882
|
exports.postToEditor = postToEditor;
|
|
883
|
+
exports.resolveApiUrl = resolveApiUrl;
|
|
869
884
|
exports.resolveForms = resolveForms;
|
|
870
885
|
exports.resolveSiteLocales = resolveSiteLocales;
|
|
871
886
|
exports.resolveWorkspaceId = resolveWorkspaceId;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FieldDefinition, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, E as EditorToAppMessage, A as AppToEditorMessage,
|
|
2
|
-
export { a as BlockMeta,
|
|
1
|
+
import { F as FieldDefinition, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, n as CmssyBlockAuthContext, o as CmssyBlockWorkspace, d as CmssyLayoutGroup, E as EditorToAppMessage, A as AppToEditorMessage, p as FetchLike, q as CmssyClientConfig, r as CmssySiteConfig, R as RawBlock, e as CmssyLocaleContext, s as BlockMap, t as CmssyBlockContext } from './commerce-queries-Dx6EW4Sr.cjs';
|
|
2
|
+
export { a as BlockMeta, u as BlockRect, B as BlockSchema, v as BoundsMessage, w as BuildBlockContextExtra, x as ClickMessage, y as CmssyBlockMember, z as CmssyBranding, f as CmssyCart, i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, D as CmssyFormField, G as CmssyFormSettings, H as CmssyFormSubmitResponse, I as CmssyLocalizedValue, J as CmssyModelDefinition, K as CmssyModelRecord, g as CmssyOrder, L as CmssyPageMeta, M as CmssyPageSummary, h as CmssyProduct, m as CmssyProductVariant, N as CmssyRecordList, O as DEFAULT_CMSSY_API_URL, P as FORM_QUERY, Q as FetchLikeResponse, S as FetchPageOptions, T as FieldType, U as MODEL_DEFINITIONS_QUERY, V as MODEL_RECORDS_QUERY, W as PROTOCOL_VERSION, X as ParentReadyMessage, Y as PatchMessage, Z as RawLayoutBlock, _ as ReadyMessage, $ as SITE_CONFIG_QUERY, a0 as SUBMIT_FORM_MUTATION, a1 as SelectMessage, a2 as SubmitFormInput, a3 as blocksToMeta, a4 as blocksToSchemas, a5 as buildBlockContext, a6 as buildBlockMap, a7 as defineBlock, a8 as fetchLayouts, a9 as fetchPage, aa as fetchPageById, ab as fetchPageMeta, ac as fetchPages, ad as isProtocolCompatible, ae as normalizeSlug, af as resolveApiUrl } from './commerce-queries-Dx6EW4Sr.cjs';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
|
@@ -30,13 +30,17 @@ interface CmssyServerPageProps {
|
|
|
30
30
|
enabledLocales?: string[];
|
|
31
31
|
/** Form definitions referenced by page blocks, exposed via context.forms. */
|
|
32
32
|
forms?: Record<string, CmssyFormDefinition>;
|
|
33
|
+
/** Member auth state, exposed via context.auth. Resolved by createCmssyPage. */
|
|
34
|
+
auth?: CmssyBlockAuthContext;
|
|
35
|
+
/** Workspace identity, exposed via context.workspace. Resolved by createCmssyPage. */
|
|
36
|
+
workspace?: CmssyBlockWorkspace;
|
|
33
37
|
}
|
|
34
38
|
/**
|
|
35
39
|
* Async React Server Component (Next.js App Router / RSC). It runs each block's
|
|
36
40
|
* loader server-side before rendering, so it must be rendered in a server
|
|
37
41
|
* component tree (as `createCmssyPage` does) - not in a client component.
|
|
38
42
|
*/
|
|
39
|
-
declare function CmssyServerPage({ page, blocks, locale, defaultLocale, enabledLocales, forms, }: CmssyServerPageProps): Promise<react_jsx_runtime.JSX.Element | null>;
|
|
43
|
+
declare function CmssyServerPage({ page, blocks, locale, defaultLocale, enabledLocales, forms, auth, workspace, }: CmssyServerPageProps): Promise<react_jsx_runtime.JSX.Element | null>;
|
|
40
44
|
|
|
41
45
|
interface CmssyServerLayoutProps {
|
|
42
46
|
groups: CmssyLayoutGroup[];
|
|
@@ -77,7 +81,7 @@ interface CmssyClient {
|
|
|
77
81
|
queryScoped<T = unknown>(document: string, variables?: Record<string, unknown>, options?: QueryScopedOptions): Promise<T>;
|
|
78
82
|
resolveWorkspaceId(options?: GraphqlRequestOptions): Promise<string>;
|
|
79
83
|
}
|
|
80
|
-
declare function createCmssyClient(
|
|
84
|
+
declare function createCmssyClient(input: CmssyClientConfig): CmssyClient;
|
|
81
85
|
|
|
82
86
|
declare function collectFormIds(blocks: RawBlock[], locale: string, defaultLocale: string): string[];
|
|
83
87
|
declare function resolveForms(config: CmssyClientConfig, blocks: RawBlock[], locale: string, defaultLocale: string, options?: QueryScopedOptions): Promise<Record<string, CmssyFormDefinition>>;
|
|
@@ -126,4 +130,4 @@ interface UnknownBlockProps {
|
|
|
126
130
|
}
|
|
127
131
|
declare function UnknownBlock({ type }: UnknownBlockProps): react_jsx_runtime.JSX.Element;
|
|
128
132
|
|
|
129
|
-
export { AppToEditorMessage, BlockDefinition, BlockMap, CmssyBlock, CmssyBlockContext, type CmssyBlockProps, type CmssyClient, CmssyClientConfig, CmssyFormDefinition, CmssyLayoutGroup, CmssyLocaleContext, CmssyPageData, CmssyServerLayout, type CmssyServerLayoutProps, CmssyServerPage, type CmssyServerPageProps, CmssySiteConfig, type CmssySiteLocales, EditorToAppMessage, FetchLike, type FieldControl, FieldDefinition, type GraphqlRequestOptions, type PostTarget, type QueryScopedOptions, RawBlock, UnknownBlock, type UnknownBlockProps, buildLocaleSwitchHref, collectFormIds, createCmssyClient, fetchSiteConfig, fields, getBlockContentForLanguage, graphqlRequest, localizeHref, localizeHtmlLinks, normalizeOrigin, parseEditorMessage, postToEditor, resolveForms, resolveSiteLocales, resolveWorkspaceId, splitLocaleFromPath };
|
|
133
|
+
export { AppToEditorMessage, BlockDefinition, BlockMap, CmssyBlock, CmssyBlockAuthContext, CmssyBlockContext, type CmssyBlockProps, CmssyBlockWorkspace, type CmssyClient, CmssyClientConfig, CmssyFormDefinition, CmssyLayoutGroup, CmssyLocaleContext, CmssyPageData, CmssyServerLayout, type CmssyServerLayoutProps, CmssyServerPage, type CmssyServerPageProps, CmssySiteConfig, type CmssySiteLocales, EditorToAppMessage, FetchLike, type FieldControl, FieldDefinition, type GraphqlRequestOptions, type PostTarget, type QueryScopedOptions, RawBlock, UnknownBlock, type UnknownBlockProps, buildLocaleSwitchHref, collectFormIds, createCmssyClient, fetchSiteConfig, fields, getBlockContentForLanguage, graphqlRequest, localizeHref, localizeHtmlLinks, normalizeOrigin, parseEditorMessage, postToEditor, resolveForms, resolveSiteLocales, resolveWorkspaceId, splitLocaleFromPath };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FieldDefinition, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, E as EditorToAppMessage, A as AppToEditorMessage,
|
|
2
|
-
export { a as BlockMeta,
|
|
1
|
+
import { F as FieldDefinition, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, n as CmssyBlockAuthContext, o as CmssyBlockWorkspace, d as CmssyLayoutGroup, E as EditorToAppMessage, A as AppToEditorMessage, p as FetchLike, q as CmssyClientConfig, r as CmssySiteConfig, R as RawBlock, e as CmssyLocaleContext, s as BlockMap, t as CmssyBlockContext } from './commerce-queries-Dx6EW4Sr.js';
|
|
2
|
+
export { a as BlockMeta, u as BlockRect, B as BlockSchema, v as BoundsMessage, w as BuildBlockContextExtra, x as ClickMessage, y as CmssyBlockMember, z as CmssyBranding, f as CmssyCart, i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, D as CmssyFormField, G as CmssyFormSettings, H as CmssyFormSubmitResponse, I as CmssyLocalizedValue, J as CmssyModelDefinition, K as CmssyModelRecord, g as CmssyOrder, L as CmssyPageMeta, M as CmssyPageSummary, h as CmssyProduct, m as CmssyProductVariant, N as CmssyRecordList, O as DEFAULT_CMSSY_API_URL, P as FORM_QUERY, Q as FetchLikeResponse, S as FetchPageOptions, T as FieldType, U as MODEL_DEFINITIONS_QUERY, V as MODEL_RECORDS_QUERY, W as PROTOCOL_VERSION, X as ParentReadyMessage, Y as PatchMessage, Z as RawLayoutBlock, _ as ReadyMessage, $ as SITE_CONFIG_QUERY, a0 as SUBMIT_FORM_MUTATION, a1 as SelectMessage, a2 as SubmitFormInput, a3 as blocksToMeta, a4 as blocksToSchemas, a5 as buildBlockContext, a6 as buildBlockMap, a7 as defineBlock, a8 as fetchLayouts, a9 as fetchPage, aa as fetchPageById, ab as fetchPageMeta, ac as fetchPages, ad as isProtocolCompatible, ae as normalizeSlug, af as resolveApiUrl } from './commerce-queries-Dx6EW4Sr.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
|
@@ -30,13 +30,17 @@ interface CmssyServerPageProps {
|
|
|
30
30
|
enabledLocales?: string[];
|
|
31
31
|
/** Form definitions referenced by page blocks, exposed via context.forms. */
|
|
32
32
|
forms?: Record<string, CmssyFormDefinition>;
|
|
33
|
+
/** Member auth state, exposed via context.auth. Resolved by createCmssyPage. */
|
|
34
|
+
auth?: CmssyBlockAuthContext;
|
|
35
|
+
/** Workspace identity, exposed via context.workspace. Resolved by createCmssyPage. */
|
|
36
|
+
workspace?: CmssyBlockWorkspace;
|
|
33
37
|
}
|
|
34
38
|
/**
|
|
35
39
|
* Async React Server Component (Next.js App Router / RSC). It runs each block's
|
|
36
40
|
* loader server-side before rendering, so it must be rendered in a server
|
|
37
41
|
* component tree (as `createCmssyPage` does) - not in a client component.
|
|
38
42
|
*/
|
|
39
|
-
declare function CmssyServerPage({ page, blocks, locale, defaultLocale, enabledLocales, forms, }: CmssyServerPageProps): Promise<react_jsx_runtime.JSX.Element | null>;
|
|
43
|
+
declare function CmssyServerPage({ page, blocks, locale, defaultLocale, enabledLocales, forms, auth, workspace, }: CmssyServerPageProps): Promise<react_jsx_runtime.JSX.Element | null>;
|
|
40
44
|
|
|
41
45
|
interface CmssyServerLayoutProps {
|
|
42
46
|
groups: CmssyLayoutGroup[];
|
|
@@ -77,7 +81,7 @@ interface CmssyClient {
|
|
|
77
81
|
queryScoped<T = unknown>(document: string, variables?: Record<string, unknown>, options?: QueryScopedOptions): Promise<T>;
|
|
78
82
|
resolveWorkspaceId(options?: GraphqlRequestOptions): Promise<string>;
|
|
79
83
|
}
|
|
80
|
-
declare function createCmssyClient(
|
|
84
|
+
declare function createCmssyClient(input: CmssyClientConfig): CmssyClient;
|
|
81
85
|
|
|
82
86
|
declare function collectFormIds(blocks: RawBlock[], locale: string, defaultLocale: string): string[];
|
|
83
87
|
declare function resolveForms(config: CmssyClientConfig, blocks: RawBlock[], locale: string, defaultLocale: string, options?: QueryScopedOptions): Promise<Record<string, CmssyFormDefinition>>;
|
|
@@ -126,4 +130,4 @@ interface UnknownBlockProps {
|
|
|
126
130
|
}
|
|
127
131
|
declare function UnknownBlock({ type }: UnknownBlockProps): react_jsx_runtime.JSX.Element;
|
|
128
132
|
|
|
129
|
-
export { AppToEditorMessage, BlockDefinition, BlockMap, CmssyBlock, CmssyBlockContext, type CmssyBlockProps, type CmssyClient, CmssyClientConfig, CmssyFormDefinition, CmssyLayoutGroup, CmssyLocaleContext, CmssyPageData, CmssyServerLayout, type CmssyServerLayoutProps, CmssyServerPage, type CmssyServerPageProps, CmssySiteConfig, type CmssySiteLocales, EditorToAppMessage, FetchLike, type FieldControl, FieldDefinition, type GraphqlRequestOptions, type PostTarget, type QueryScopedOptions, RawBlock, UnknownBlock, type UnknownBlockProps, buildLocaleSwitchHref, collectFormIds, createCmssyClient, fetchSiteConfig, fields, getBlockContentForLanguage, graphqlRequest, localizeHref, localizeHtmlLinks, normalizeOrigin, parseEditorMessage, postToEditor, resolveForms, resolveSiteLocales, resolveWorkspaceId, splitLocaleFromPath };
|
|
133
|
+
export { AppToEditorMessage, BlockDefinition, BlockMap, CmssyBlock, CmssyBlockAuthContext, CmssyBlockContext, type CmssyBlockProps, CmssyBlockWorkspace, type CmssyClient, CmssyClientConfig, CmssyFormDefinition, CmssyLayoutGroup, CmssyLocaleContext, CmssyPageData, CmssyServerLayout, type CmssyServerLayoutProps, CmssyServerPage, type CmssyServerPageProps, CmssySiteConfig, type CmssySiteLocales, EditorToAppMessage, FetchLike, type FieldControl, FieldDefinition, type GraphqlRequestOptions, type PostTarget, type QueryScopedOptions, RawBlock, UnknownBlock, type UnknownBlockProps, buildLocaleSwitchHref, collectFormIds, createCmssyClient, fetchSiteConfig, fields, getBlockContentForLanguage, graphqlRequest, localizeHref, localizeHtmlLinks, normalizeOrigin, parseEditorMessage, postToEditor, resolveForms, resolveSiteLocales, resolveWorkspaceId, splitLocaleFromPath };
|
package/dist/index.js
CHANGED
|
@@ -90,7 +90,7 @@ function getBlockContentForLanguage(content, locale, defaultLocale = "en", avail
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
// src/components/block-context.ts
|
|
93
|
-
function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, forms) {
|
|
93
|
+
function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, forms, extra) {
|
|
94
94
|
return {
|
|
95
95
|
locale: {
|
|
96
96
|
current: locale,
|
|
@@ -98,7 +98,9 @@ function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, for
|
|
|
98
98
|
enabled: enabledLocales && enabledLocales.length > 0 ? enabledLocales : Array.from(/* @__PURE__ */ new Set([defaultLocale, locale]))
|
|
99
99
|
},
|
|
100
100
|
isPreview: isPreview ?? false,
|
|
101
|
-
forms
|
|
101
|
+
forms,
|
|
102
|
+
...extra?.auth ? { auth: extra.auth } : {},
|
|
103
|
+
...extra?.workspace ? { workspace: extra.workspace } : {}
|
|
102
104
|
};
|
|
103
105
|
}
|
|
104
106
|
var WARN_CAP = 256;
|
|
@@ -137,7 +139,9 @@ async function CmssyServerPage({
|
|
|
137
139
|
locale = "en",
|
|
138
140
|
defaultLocale = "en",
|
|
139
141
|
enabledLocales,
|
|
140
|
-
forms
|
|
142
|
+
forms,
|
|
143
|
+
auth,
|
|
144
|
+
workspace
|
|
141
145
|
}) {
|
|
142
146
|
if (!page) return null;
|
|
143
147
|
const map = buildBlockMap(blocks);
|
|
@@ -147,7 +151,8 @@ async function CmssyServerPage({
|
|
|
147
151
|
defaultLocale,
|
|
148
152
|
enabledLocales,
|
|
149
153
|
false,
|
|
150
|
-
forms
|
|
154
|
+
forms,
|
|
155
|
+
{ auth, workspace }
|
|
151
156
|
);
|
|
152
157
|
const resolved = await Promise.all(
|
|
153
158
|
page.blocks.map(async (block) => {
|
|
@@ -281,6 +286,10 @@ function parseEditorMessage(data, origin, expectedOrigin) {
|
|
|
281
286
|
}
|
|
282
287
|
|
|
283
288
|
// src/content/content-client.ts
|
|
289
|
+
var DEFAULT_CMSSY_API_URL = "https://api.cmssy.io/graphql";
|
|
290
|
+
function resolveApiUrl(apiUrl) {
|
|
291
|
+
return apiUrl && apiUrl.length > 0 ? apiUrl : DEFAULT_CMSSY_API_URL;
|
|
292
|
+
}
|
|
284
293
|
var PUBLIC_PAGE_QUERY = `query PublicPage($workspaceSlug: String!, $slug: String!, $previewSecret: String) {
|
|
285
294
|
publicPage(workspaceSlug: $workspaceSlug, slug: $slug, previewSecret: $previewSecret) {
|
|
286
295
|
id
|
|
@@ -335,7 +344,7 @@ async function fetchPage(config, path, options = {}) {
|
|
|
335
344
|
}
|
|
336
345
|
const trimmedSecret = options.previewSecret?.trim();
|
|
337
346
|
const previewSecret = trimmedSecret ? trimmedSecret : null;
|
|
338
|
-
const response = await doFetch(config.apiUrl, {
|
|
347
|
+
const response = await doFetch(resolveApiUrl(config.apiUrl), {
|
|
339
348
|
method: "POST",
|
|
340
349
|
headers: { "content-type": "application/json" },
|
|
341
350
|
body: JSON.stringify({
|
|
@@ -383,7 +392,7 @@ async function fetchPageById(config, pageId, options = {}) {
|
|
|
383
392
|
"cmssy: no fetch implementation available - pass options.fetch"
|
|
384
393
|
);
|
|
385
394
|
}
|
|
386
|
-
const response = await doFetch(config.apiUrl, {
|
|
395
|
+
const response = await doFetch(resolveApiUrl(config.apiUrl), {
|
|
387
396
|
method: "POST",
|
|
388
397
|
headers: { "content-type": "application/json" },
|
|
389
398
|
body: JSON.stringify({
|
|
@@ -427,7 +436,7 @@ async function fetchPages(config, options = {}) {
|
|
|
427
436
|
"cmssy: no fetch implementation available - pass options.fetch"
|
|
428
437
|
);
|
|
429
438
|
}
|
|
430
|
-
const response = await doFetch(config.apiUrl, {
|
|
439
|
+
const response = await doFetch(resolveApiUrl(config.apiUrl), {
|
|
431
440
|
method: "POST",
|
|
432
441
|
headers: { "content-type": "application/json" },
|
|
433
442
|
body: JSON.stringify({
|
|
@@ -459,7 +468,7 @@ async function fetchPageMeta(config, path, options = {}) {
|
|
|
459
468
|
"cmssy: no fetch implementation available - pass options.fetch"
|
|
460
469
|
);
|
|
461
470
|
}
|
|
462
|
-
const response = await doFetch(config.apiUrl, {
|
|
471
|
+
const response = await doFetch(resolveApiUrl(config.apiUrl), {
|
|
463
472
|
method: "POST",
|
|
464
473
|
headers: { "content-type": "application/json" },
|
|
465
474
|
body: JSON.stringify({
|
|
@@ -493,7 +502,7 @@ async function fetchLayouts(config, path, options = {}) {
|
|
|
493
502
|
}
|
|
494
503
|
const trimmedSecret = options.previewSecret?.trim();
|
|
495
504
|
const previewSecret = trimmedSecret ? trimmedSecret : null;
|
|
496
|
-
const response = await doFetch(config.apiUrl, {
|
|
505
|
+
const response = await doFetch(resolveApiUrl(config.apiUrl), {
|
|
497
506
|
method: "POST",
|
|
498
507
|
headers: { "content-type": "application/json" },
|
|
499
508
|
body: JSON.stringify({
|
|
@@ -530,7 +539,7 @@ async function graphqlRequest(config, query, variables, options = {}, label = "r
|
|
|
530
539
|
"cmssy: no fetch implementation available - pass options.fetch"
|
|
531
540
|
);
|
|
532
541
|
}
|
|
533
|
-
const response = await doFetch(config.apiUrl, {
|
|
542
|
+
const response = await doFetch(resolveApiUrl(config.apiUrl), {
|
|
534
543
|
method: "POST",
|
|
535
544
|
headers: { "content-type": "application/json", ...options.headers },
|
|
536
545
|
body: JSON.stringify({ query, variables }),
|
|
@@ -638,7 +647,11 @@ async function resolveWorkspaceId(config, options = {}) {
|
|
|
638
647
|
}
|
|
639
648
|
|
|
640
649
|
// src/data/client.ts
|
|
641
|
-
function createCmssyClient(
|
|
650
|
+
function createCmssyClient(input) {
|
|
651
|
+
const config = {
|
|
652
|
+
...input,
|
|
653
|
+
apiUrl: resolveApiUrl(input.apiUrl)
|
|
654
|
+
};
|
|
642
655
|
let cachedWorkspaceId;
|
|
643
656
|
let inFlight;
|
|
644
657
|
function resolveWorkspaceId2(options) {
|
|
@@ -724,7 +737,7 @@ var TTL_MS = 6e4;
|
|
|
724
737
|
var MAX_ENTRIES = 64;
|
|
725
738
|
var cache = /* @__PURE__ */ new Map();
|
|
726
739
|
async function resolveSiteLocales(config, options) {
|
|
727
|
-
const key = `${config.apiUrl}::${config.workspaceSlug}`;
|
|
740
|
+
const key = `${resolveApiUrl(config.apiUrl)}::${config.workspaceSlug}`;
|
|
728
741
|
const cached = cache.get(key);
|
|
729
742
|
if (cached && cached.expires > Date.now()) return cached.value;
|
|
730
743
|
cache.delete(key);
|
|
@@ -830,4 +843,4 @@ function CmssyBlock({
|
|
|
830
843
|
);
|
|
831
844
|
}
|
|
832
845
|
|
|
833
|
-
export { CmssyBlock, CmssyServerLayout, CmssyServerPage, FORM_QUERY, MODEL_DEFINITIONS_QUERY, MODEL_RECORDS_QUERY, PROTOCOL_VERSION, SITE_CONFIG_QUERY, SUBMIT_FORM_MUTATION, UnknownBlock, blocksToMeta, blocksToSchemas, buildBlockContext, buildBlockMap, buildLocaleSwitchHref, collectFormIds, createCmssyClient, defineBlock, fetchLayouts, fetchPage, fetchPageById, fetchPageMeta, fetchPages, fetchSiteConfig, fields, getBlockContentForLanguage, graphqlRequest, isProtocolCompatible, localizeHref, localizeHtmlLinks, normalizeOrigin, normalizeSlug, parseEditorMessage, postToEditor, resolveForms, resolveSiteLocales, resolveWorkspaceId, splitLocaleFromPath };
|
|
846
|
+
export { CmssyBlock, CmssyServerLayout, CmssyServerPage, DEFAULT_CMSSY_API_URL, FORM_QUERY, MODEL_DEFINITIONS_QUERY, MODEL_RECORDS_QUERY, PROTOCOL_VERSION, SITE_CONFIG_QUERY, SUBMIT_FORM_MUTATION, UnknownBlock, blocksToMeta, blocksToSchemas, buildBlockContext, buildBlockMap, buildLocaleSwitchHref, collectFormIds, createCmssyClient, defineBlock, fetchLayouts, fetchPage, fetchPageById, fetchPageMeta, fetchPages, fetchSiteConfig, fields, getBlockContentForLanguage, graphqlRequest, isProtocolCompatible, localizeHref, localizeHtmlLinks, normalizeOrigin, normalizeSlug, parseEditorMessage, postToEditor, resolveApiUrl, resolveForms, resolveSiteLocales, resolveWorkspaceId, splitLocaleFromPath };
|