@cmssy/react 2.3.0 → 2.4.0
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.d.cts +3 -3
- package/dist/client.d.ts +3 -3
- package/dist/{commerce-queries-C-qnHDOq.d.cts → commerce-queries-BJCoqTJW.d.cts} +2 -231
- package/dist/{commerce-queries-C-qnHDOq.d.ts → commerce-queries-BJCoqTJW.d.ts} +2 -231
- package/dist/index.d.cts +132 -11
- package/dist/index.d.ts +132 -11
- package/package.json +2 -2
package/dist/client.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { BlockSchema, BlockMeta, CmssyPageData, CmssyLayoutGroup } from '@cmssy/types';
|
|
3
|
+
import { B as BlockDefinition, C as CmssyFormDefinition, a as CmssyLocaleContext, b as CmssyAddress, c as CmssyCart, d as CmssyOrder, e as CmssyProduct } from './commerce-queries-BJCoqTJW.cjs';
|
|
4
|
+
export { f as CmssyCartDiscount, g as CmssyCartItem, h as CmssyCartItemSnapshot, i as CmssyOrderItem, j as CmssyProductVariant } from './commerce-queries-BJCoqTJW.cjs';
|
|
4
5
|
import { ReactNode } from 'react';
|
|
5
|
-
import '@cmssy/types';
|
|
6
6
|
|
|
7
7
|
interface EditBridgeConfig {
|
|
8
8
|
editorOrigin: string | string[];
|
package/dist/client.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { BlockSchema, BlockMeta, CmssyPageData, CmssyLayoutGroup } from '@cmssy/types';
|
|
3
|
+
import { B as BlockDefinition, C as CmssyFormDefinition, a as CmssyLocaleContext, b as CmssyAddress, c as CmssyCart, d as CmssyOrder, e as CmssyProduct } from './commerce-queries-BJCoqTJW.js';
|
|
4
|
+
export { f as CmssyCartDiscount, g as CmssyCartItem, h as CmssyCartItemSnapshot, i as CmssyOrderItem, j as CmssyProductVariant } from './commerce-queries-BJCoqTJW.js';
|
|
4
5
|
import { ReactNode } from 'react';
|
|
5
|
-
import '@cmssy/types';
|
|
6
6
|
|
|
7
7
|
interface EditBridgeConfig {
|
|
8
8
|
editorOrigin: string | string[];
|
|
@@ -1,117 +1,6 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
|
-
import { FieldConditionGroup,
|
|
2
|
+
import { FieldConditionGroup, FieldDefinition, BlockMeta, BlockSchema } from '@cmssy/types';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* The cmssy cloud GraphQL delivery endpoint. It is the same for every workspace,
|
|
6
|
-
* so consumers never need to set it - `apiUrl` defaults to this. Self-hosted /
|
|
7
|
-
* staging deployments override it via config.
|
|
8
|
-
*/
|
|
9
|
-
declare const DEFAULT_CMSSY_API_URL = "https://api.cmssy.io/graphql";
|
|
10
|
-
declare function resolveApiUrl(apiUrl: string | undefined): string;
|
|
11
|
-
/**
|
|
12
|
-
* Public delivery endpoint for a workspace: the org-scoped path
|
|
13
|
-
* `{base}/public/{orgSlug}/{workspaceSlug}/graphql`. `apiUrl` is the GraphQL
|
|
14
|
-
* base (its trailing `/graphql` is stripped); the org path is what tells the
|
|
15
|
-
* backend which workspace to serve, so slugs only need to be unique per org.
|
|
16
|
-
*/
|
|
17
|
-
declare function resolvePublicUrl(config: CmssyClientConfig): string;
|
|
18
|
-
interface CmssyClientConfig {
|
|
19
|
-
/**
|
|
20
|
-
* Full GraphQL endpoint (used as-is for authenticated requests). Defaults to
|
|
21
|
-
* {@link DEFAULT_CMSSY_API_URL}. Public reads strip its trailing `/graphql`
|
|
22
|
-
* and append the org-scoped path (see {@link resolvePublicUrl}).
|
|
23
|
-
*/
|
|
24
|
-
apiUrl?: string;
|
|
25
|
-
/** Organization slug - part of the org-scoped delivery path. */
|
|
26
|
-
org: string;
|
|
27
|
-
workspaceSlug: string;
|
|
28
|
-
}
|
|
29
|
-
interface FetchLikeResponse {
|
|
30
|
-
ok: boolean;
|
|
31
|
-
status: number;
|
|
32
|
-
json: () => Promise<unknown>;
|
|
33
|
-
}
|
|
34
|
-
type FetchLike = (url: string, init: {
|
|
35
|
-
method: string;
|
|
36
|
-
headers: Record<string, string>;
|
|
37
|
-
body: string;
|
|
38
|
-
signal?: AbortSignal;
|
|
39
|
-
}) => Promise<FetchLikeResponse>;
|
|
40
|
-
interface FetchPageOptions {
|
|
41
|
-
previewSecret?: string;
|
|
42
|
-
devPreview?: boolean;
|
|
43
|
-
devToken?: string;
|
|
44
|
-
workspaceId?: string;
|
|
45
|
-
fetch?: FetchLike;
|
|
46
|
-
signal?: AbortSignal;
|
|
47
|
-
}
|
|
48
|
-
interface RawBlock {
|
|
49
|
-
id: string;
|
|
50
|
-
type: string;
|
|
51
|
-
content: unknown;
|
|
52
|
-
style?: unknown;
|
|
53
|
-
advanced?: unknown;
|
|
54
|
-
}
|
|
55
|
-
interface CmssyPageData {
|
|
56
|
-
id: string;
|
|
57
|
-
blocks: RawBlock[];
|
|
58
|
-
}
|
|
59
|
-
interface RawLayoutBlock {
|
|
60
|
-
id: string;
|
|
61
|
-
type: string;
|
|
62
|
-
content: unknown;
|
|
63
|
-
style?: unknown;
|
|
64
|
-
advanced?: unknown;
|
|
65
|
-
order: number;
|
|
66
|
-
isActive: boolean;
|
|
67
|
-
}
|
|
68
|
-
interface CmssyLayoutSettings {
|
|
69
|
-
desktopWidth: number | null;
|
|
70
|
-
mobileBehavior: string;
|
|
71
|
-
}
|
|
72
|
-
interface CmssyLayoutGroup {
|
|
73
|
-
position: string;
|
|
74
|
-
blocks: RawLayoutBlock[];
|
|
75
|
-
settings?: CmssyLayoutSettings | null;
|
|
76
|
-
}
|
|
77
|
-
declare function normalizeSlug(path: string | string[] | undefined): string;
|
|
78
|
-
declare function fetchPage(config: CmssyClientConfig, path: string | string[] | undefined, options?: FetchPageOptions): Promise<CmssyPageData | null>;
|
|
79
|
-
declare function fetchPageById(config: CmssyClientConfig, pageId: string, options?: Pick<FetchPageOptions, "fetch" | "signal">): Promise<CmssyPageData | null>;
|
|
80
|
-
interface CmssyPageSummary {
|
|
81
|
-
id: string;
|
|
82
|
-
slug: string;
|
|
83
|
-
updatedAt: string | null;
|
|
84
|
-
publishedAt: string | null;
|
|
85
|
-
}
|
|
86
|
-
declare function fetchPages(config: CmssyClientConfig, options?: Pick<FetchPageOptions, "fetch" | "signal">): Promise<CmssyPageSummary[]>;
|
|
87
|
-
type CmssyLocalizedValue = Record<string, string> | string | null;
|
|
88
|
-
interface CmssyPageMeta {
|
|
89
|
-
id: string;
|
|
90
|
-
seoTitle: CmssyLocalizedValue;
|
|
91
|
-
seoDescription: CmssyLocalizedValue;
|
|
92
|
-
seoKeywords: string[] | null;
|
|
93
|
-
displayName: CmssyLocalizedValue;
|
|
94
|
-
}
|
|
95
|
-
declare function fetchPageMeta(config: CmssyClientConfig, path: string | string[] | undefined, options?: Pick<FetchPageOptions, "fetch" | "signal">): Promise<CmssyPageMeta | null>;
|
|
96
|
-
declare function fetchLayouts(config: CmssyClientConfig, path: string | string[] | undefined, options?: FetchPageOptions): Promise<CmssyLayoutGroup[]>;
|
|
97
|
-
|
|
98
|
-
interface CmssyBranding {
|
|
99
|
-
brandName: string | null;
|
|
100
|
-
logoUrl: string | null;
|
|
101
|
-
faviconUrl: string | null;
|
|
102
|
-
ogImageUrl: string | null;
|
|
103
|
-
}
|
|
104
|
-
interface CmssySiteConfig {
|
|
105
|
-
id: string;
|
|
106
|
-
workspaceId: string;
|
|
107
|
-
siteName: unknown;
|
|
108
|
-
defaultLanguage: string | null;
|
|
109
|
-
enabledLanguages: string[];
|
|
110
|
-
enabledFeatures: string[];
|
|
111
|
-
notFoundPageId: string | null;
|
|
112
|
-
previewUrl: string | null;
|
|
113
|
-
branding: CmssyBranding | null;
|
|
114
|
-
}
|
|
115
4
|
declare const SITE_CONFIG_QUERY = "query PublicSiteConfig($workspaceSlug: String!) {\n public {\n siteConfig(workspaceSlug: $workspaceSlug) {\n id\n workspaceId\n siteName\n defaultLanguage\n enabledLanguages\n enabledFeatures\n notFoundPageId\n previewUrl\n branding {\n brandName\n logoUrl\n faviconUrl\n ogImageUrl\n }\n }\n }\n}";
|
|
116
5
|
interface CmssyModelDefinition {
|
|
117
6
|
id: string;
|
|
@@ -215,124 +104,6 @@ interface BuildBlockContextExtra {
|
|
|
215
104
|
}
|
|
216
105
|
declare function buildBlockContext(locale: string, defaultLocale: string, enabledLocales?: string[], isPreview?: boolean, forms?: Record<string, CmssyFormDefinition>, extra?: BuildBlockContextExtra): CmssyBlockContext;
|
|
217
106
|
|
|
218
|
-
declare const PROTOCOL_VERSION = 2;
|
|
219
|
-
|
|
220
|
-
interface FieldDefinition {
|
|
221
|
-
type: FieldType;
|
|
222
|
-
label: string;
|
|
223
|
-
defaultValue?: unknown;
|
|
224
|
-
helperText?: string;
|
|
225
|
-
required?: boolean;
|
|
226
|
-
placeholder?: string;
|
|
227
|
-
tab?: string;
|
|
228
|
-
options?: string[];
|
|
229
|
-
itemSchema?: Record<string, FieldDefinition>;
|
|
230
|
-
itemLabel?: string;
|
|
231
|
-
addButtonLabel?: string;
|
|
232
|
-
minItems?: number;
|
|
233
|
-
maxItems?: number;
|
|
234
|
-
collapsible?: boolean;
|
|
235
|
-
}
|
|
236
|
-
type BlockSchema = Record<string, FieldDefinition>;
|
|
237
|
-
interface BlockMeta {
|
|
238
|
-
label: string;
|
|
239
|
-
category?: string;
|
|
240
|
-
icon?: string;
|
|
241
|
-
layoutPositions?: string[];
|
|
242
|
-
/** One-line block description; surfaced to the AI page composer. */
|
|
243
|
-
description?: string;
|
|
244
|
-
}
|
|
245
|
-
interface BlockRect {
|
|
246
|
-
x: number;
|
|
247
|
-
y: number;
|
|
248
|
-
width: number;
|
|
249
|
-
height: number;
|
|
250
|
-
}
|
|
251
|
-
interface ReadyMessage {
|
|
252
|
-
type: "cmssy:ready";
|
|
253
|
-
protocolVersion: number;
|
|
254
|
-
blocks: Array<{
|
|
255
|
-
id: string;
|
|
256
|
-
type: string;
|
|
257
|
-
bounds: BlockRect;
|
|
258
|
-
layoutPosition?: string;
|
|
259
|
-
}>;
|
|
260
|
-
schemas: Record<string, BlockSchema>;
|
|
261
|
-
blockMeta?: Record<string, BlockMeta>;
|
|
262
|
-
}
|
|
263
|
-
interface BoundsMessage {
|
|
264
|
-
type: "cmssy:bounds";
|
|
265
|
-
blockId: string;
|
|
266
|
-
rect: BlockRect;
|
|
267
|
-
}
|
|
268
|
-
interface ClickMessage {
|
|
269
|
-
type: "cmssy:click";
|
|
270
|
-
blockId: string;
|
|
271
|
-
rect: BlockRect;
|
|
272
|
-
layoutPosition?: string;
|
|
273
|
-
}
|
|
274
|
-
interface MoveMessage {
|
|
275
|
-
type: "cmssy:move";
|
|
276
|
-
protocolVersion: number;
|
|
277
|
-
blockId: string;
|
|
278
|
-
index: number;
|
|
279
|
-
}
|
|
280
|
-
interface DragIndexMessage {
|
|
281
|
-
type: "cmssy:drag-index";
|
|
282
|
-
protocolVersion: number;
|
|
283
|
-
index: number;
|
|
284
|
-
}
|
|
285
|
-
type AppToEditorMessage = ReadyMessage | BoundsMessage | ClickMessage | MoveMessage | DragIndexMessage;
|
|
286
|
-
interface SelectMessage {
|
|
287
|
-
type: "cmssy:select";
|
|
288
|
-
protocolVersion: number;
|
|
289
|
-
blockId: string;
|
|
290
|
-
}
|
|
291
|
-
interface PatchMessage {
|
|
292
|
-
type: "cmssy:patch";
|
|
293
|
-
protocolVersion: number;
|
|
294
|
-
blockId: string;
|
|
295
|
-
content: Record<string, unknown>;
|
|
296
|
-
style?: Record<string, unknown>;
|
|
297
|
-
advanced?: Record<string, unknown>;
|
|
298
|
-
layoutPosition?: string;
|
|
299
|
-
}
|
|
300
|
-
interface ParentReadyMessage {
|
|
301
|
-
type: "cmssy:parent-ready";
|
|
302
|
-
protocolVersion: number;
|
|
303
|
-
}
|
|
304
|
-
interface InsertMessage {
|
|
305
|
-
type: "cmssy:insert";
|
|
306
|
-
protocolVersion: number;
|
|
307
|
-
blockId: string;
|
|
308
|
-
blockType: string;
|
|
309
|
-
content: Record<string, unknown>;
|
|
310
|
-
style?: Record<string, unknown>;
|
|
311
|
-
advanced?: Record<string, unknown>;
|
|
312
|
-
index: number;
|
|
313
|
-
}
|
|
314
|
-
interface ReorderMessage {
|
|
315
|
-
type: "cmssy:reorder";
|
|
316
|
-
protocolVersion: number;
|
|
317
|
-
blockIds: string[];
|
|
318
|
-
}
|
|
319
|
-
interface RemoveMessage {
|
|
320
|
-
type: "cmssy:remove";
|
|
321
|
-
protocolVersion: number;
|
|
322
|
-
blockId: string;
|
|
323
|
-
}
|
|
324
|
-
interface DragOverMessage {
|
|
325
|
-
type: "cmssy:drag-over";
|
|
326
|
-
protocolVersion: number;
|
|
327
|
-
y: number;
|
|
328
|
-
}
|
|
329
|
-
interface DragEndMessage {
|
|
330
|
-
type: "cmssy:drag-end";
|
|
331
|
-
protocolVersion: number;
|
|
332
|
-
}
|
|
333
|
-
type EditorToAppMessage = SelectMessage | PatchMessage | ParentReadyMessage | InsertMessage | ReorderMessage | RemoveMessage | DragOverMessage | DragEndMessage;
|
|
334
|
-
declare function isProtocolCompatible(version: number): boolean;
|
|
335
|
-
|
|
336
107
|
interface BlockLoaderArgs {
|
|
337
108
|
content: Record<string, unknown>;
|
|
338
109
|
context?: CmssyBlockContext;
|
|
@@ -552,4 +323,4 @@ interface CmssyOrder {
|
|
|
552
323
|
accessToken?: string | null;
|
|
553
324
|
}
|
|
554
325
|
|
|
555
|
-
export {
|
|
326
|
+
export { type CmssyTaxSummaryLine as A, type BlockDefinition as B, type CmssyFormDefinition as C, MODEL_RECORDS_QUERY as D, SUBMIT_FORM_MUTATION as E, FORM_QUERY as F, type SubmitFormInput as G, blocksToMeta as H, blocksToSchemas as I, buildBlockContext as J, buildBlockMap as K, defineBlock as L, MODEL_DEFINITIONS_QUERY as M, SITE_CONFIG_QUERY as S, type CmssyLocaleContext as a, type CmssyAddress as b, type CmssyCart as c, type CmssyOrder as d, type CmssyProduct as e, type CmssyCartDiscount as f, type CmssyCartItem as g, type CmssyCartItemSnapshot as h, type CmssyOrderItem as i, type CmssyProductVariant as j, type CmssyBlockAuthContext as k, type CmssyBlockWorkspace as l, type BlockMap as m, type CmssyBlockContext as n, type BuildBlockContextExtra as o, type CmssyBlockMember as p, type CmssyFormField as q, type CmssyFormSettings as r, type CmssyFormSubmitResponse as s, type CmssyModelDefinition as t, type CmssyModelRecord as u, type CmssyOrderDiscount as v, type CmssyOrderTaxSummaryLine as w, type CmssyPriceTier as x, type CmssyRecordList as y, type CmssyShippingMethod as z };
|
|
@@ -1,117 +1,6 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
|
-
import { FieldConditionGroup,
|
|
2
|
+
import { FieldConditionGroup, FieldDefinition, BlockMeta, BlockSchema } from '@cmssy/types';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* The cmssy cloud GraphQL delivery endpoint. It is the same for every workspace,
|
|
6
|
-
* so consumers never need to set it - `apiUrl` defaults to this. Self-hosted /
|
|
7
|
-
* staging deployments override it via config.
|
|
8
|
-
*/
|
|
9
|
-
declare const DEFAULT_CMSSY_API_URL = "https://api.cmssy.io/graphql";
|
|
10
|
-
declare function resolveApiUrl(apiUrl: string | undefined): string;
|
|
11
|
-
/**
|
|
12
|
-
* Public delivery endpoint for a workspace: the org-scoped path
|
|
13
|
-
* `{base}/public/{orgSlug}/{workspaceSlug}/graphql`. `apiUrl` is the GraphQL
|
|
14
|
-
* base (its trailing `/graphql` is stripped); the org path is what tells the
|
|
15
|
-
* backend which workspace to serve, so slugs only need to be unique per org.
|
|
16
|
-
*/
|
|
17
|
-
declare function resolvePublicUrl(config: CmssyClientConfig): string;
|
|
18
|
-
interface CmssyClientConfig {
|
|
19
|
-
/**
|
|
20
|
-
* Full GraphQL endpoint (used as-is for authenticated requests). Defaults to
|
|
21
|
-
* {@link DEFAULT_CMSSY_API_URL}. Public reads strip its trailing `/graphql`
|
|
22
|
-
* and append the org-scoped path (see {@link resolvePublicUrl}).
|
|
23
|
-
*/
|
|
24
|
-
apiUrl?: string;
|
|
25
|
-
/** Organization slug - part of the org-scoped delivery path. */
|
|
26
|
-
org: string;
|
|
27
|
-
workspaceSlug: string;
|
|
28
|
-
}
|
|
29
|
-
interface FetchLikeResponse {
|
|
30
|
-
ok: boolean;
|
|
31
|
-
status: number;
|
|
32
|
-
json: () => Promise<unknown>;
|
|
33
|
-
}
|
|
34
|
-
type FetchLike = (url: string, init: {
|
|
35
|
-
method: string;
|
|
36
|
-
headers: Record<string, string>;
|
|
37
|
-
body: string;
|
|
38
|
-
signal?: AbortSignal;
|
|
39
|
-
}) => Promise<FetchLikeResponse>;
|
|
40
|
-
interface FetchPageOptions {
|
|
41
|
-
previewSecret?: string;
|
|
42
|
-
devPreview?: boolean;
|
|
43
|
-
devToken?: string;
|
|
44
|
-
workspaceId?: string;
|
|
45
|
-
fetch?: FetchLike;
|
|
46
|
-
signal?: AbortSignal;
|
|
47
|
-
}
|
|
48
|
-
interface RawBlock {
|
|
49
|
-
id: string;
|
|
50
|
-
type: string;
|
|
51
|
-
content: unknown;
|
|
52
|
-
style?: unknown;
|
|
53
|
-
advanced?: unknown;
|
|
54
|
-
}
|
|
55
|
-
interface CmssyPageData {
|
|
56
|
-
id: string;
|
|
57
|
-
blocks: RawBlock[];
|
|
58
|
-
}
|
|
59
|
-
interface RawLayoutBlock {
|
|
60
|
-
id: string;
|
|
61
|
-
type: string;
|
|
62
|
-
content: unknown;
|
|
63
|
-
style?: unknown;
|
|
64
|
-
advanced?: unknown;
|
|
65
|
-
order: number;
|
|
66
|
-
isActive: boolean;
|
|
67
|
-
}
|
|
68
|
-
interface CmssyLayoutSettings {
|
|
69
|
-
desktopWidth: number | null;
|
|
70
|
-
mobileBehavior: string;
|
|
71
|
-
}
|
|
72
|
-
interface CmssyLayoutGroup {
|
|
73
|
-
position: string;
|
|
74
|
-
blocks: RawLayoutBlock[];
|
|
75
|
-
settings?: CmssyLayoutSettings | null;
|
|
76
|
-
}
|
|
77
|
-
declare function normalizeSlug(path: string | string[] | undefined): string;
|
|
78
|
-
declare function fetchPage(config: CmssyClientConfig, path: string | string[] | undefined, options?: FetchPageOptions): Promise<CmssyPageData | null>;
|
|
79
|
-
declare function fetchPageById(config: CmssyClientConfig, pageId: string, options?: Pick<FetchPageOptions, "fetch" | "signal">): Promise<CmssyPageData | null>;
|
|
80
|
-
interface CmssyPageSummary {
|
|
81
|
-
id: string;
|
|
82
|
-
slug: string;
|
|
83
|
-
updatedAt: string | null;
|
|
84
|
-
publishedAt: string | null;
|
|
85
|
-
}
|
|
86
|
-
declare function fetchPages(config: CmssyClientConfig, options?: Pick<FetchPageOptions, "fetch" | "signal">): Promise<CmssyPageSummary[]>;
|
|
87
|
-
type CmssyLocalizedValue = Record<string, string> | string | null;
|
|
88
|
-
interface CmssyPageMeta {
|
|
89
|
-
id: string;
|
|
90
|
-
seoTitle: CmssyLocalizedValue;
|
|
91
|
-
seoDescription: CmssyLocalizedValue;
|
|
92
|
-
seoKeywords: string[] | null;
|
|
93
|
-
displayName: CmssyLocalizedValue;
|
|
94
|
-
}
|
|
95
|
-
declare function fetchPageMeta(config: CmssyClientConfig, path: string | string[] | undefined, options?: Pick<FetchPageOptions, "fetch" | "signal">): Promise<CmssyPageMeta | null>;
|
|
96
|
-
declare function fetchLayouts(config: CmssyClientConfig, path: string | string[] | undefined, options?: FetchPageOptions): Promise<CmssyLayoutGroup[]>;
|
|
97
|
-
|
|
98
|
-
interface CmssyBranding {
|
|
99
|
-
brandName: string | null;
|
|
100
|
-
logoUrl: string | null;
|
|
101
|
-
faviconUrl: string | null;
|
|
102
|
-
ogImageUrl: string | null;
|
|
103
|
-
}
|
|
104
|
-
interface CmssySiteConfig {
|
|
105
|
-
id: string;
|
|
106
|
-
workspaceId: string;
|
|
107
|
-
siteName: unknown;
|
|
108
|
-
defaultLanguage: string | null;
|
|
109
|
-
enabledLanguages: string[];
|
|
110
|
-
enabledFeatures: string[];
|
|
111
|
-
notFoundPageId: string | null;
|
|
112
|
-
previewUrl: string | null;
|
|
113
|
-
branding: CmssyBranding | null;
|
|
114
|
-
}
|
|
115
4
|
declare const SITE_CONFIG_QUERY = "query PublicSiteConfig($workspaceSlug: String!) {\n public {\n siteConfig(workspaceSlug: $workspaceSlug) {\n id\n workspaceId\n siteName\n defaultLanguage\n enabledLanguages\n enabledFeatures\n notFoundPageId\n previewUrl\n branding {\n brandName\n logoUrl\n faviconUrl\n ogImageUrl\n }\n }\n }\n}";
|
|
116
5
|
interface CmssyModelDefinition {
|
|
117
6
|
id: string;
|
|
@@ -215,124 +104,6 @@ interface BuildBlockContextExtra {
|
|
|
215
104
|
}
|
|
216
105
|
declare function buildBlockContext(locale: string, defaultLocale: string, enabledLocales?: string[], isPreview?: boolean, forms?: Record<string, CmssyFormDefinition>, extra?: BuildBlockContextExtra): CmssyBlockContext;
|
|
217
106
|
|
|
218
|
-
declare const PROTOCOL_VERSION = 2;
|
|
219
|
-
|
|
220
|
-
interface FieldDefinition {
|
|
221
|
-
type: FieldType;
|
|
222
|
-
label: string;
|
|
223
|
-
defaultValue?: unknown;
|
|
224
|
-
helperText?: string;
|
|
225
|
-
required?: boolean;
|
|
226
|
-
placeholder?: string;
|
|
227
|
-
tab?: string;
|
|
228
|
-
options?: string[];
|
|
229
|
-
itemSchema?: Record<string, FieldDefinition>;
|
|
230
|
-
itemLabel?: string;
|
|
231
|
-
addButtonLabel?: string;
|
|
232
|
-
minItems?: number;
|
|
233
|
-
maxItems?: number;
|
|
234
|
-
collapsible?: boolean;
|
|
235
|
-
}
|
|
236
|
-
type BlockSchema = Record<string, FieldDefinition>;
|
|
237
|
-
interface BlockMeta {
|
|
238
|
-
label: string;
|
|
239
|
-
category?: string;
|
|
240
|
-
icon?: string;
|
|
241
|
-
layoutPositions?: string[];
|
|
242
|
-
/** One-line block description; surfaced to the AI page composer. */
|
|
243
|
-
description?: string;
|
|
244
|
-
}
|
|
245
|
-
interface BlockRect {
|
|
246
|
-
x: number;
|
|
247
|
-
y: number;
|
|
248
|
-
width: number;
|
|
249
|
-
height: number;
|
|
250
|
-
}
|
|
251
|
-
interface ReadyMessage {
|
|
252
|
-
type: "cmssy:ready";
|
|
253
|
-
protocolVersion: number;
|
|
254
|
-
blocks: Array<{
|
|
255
|
-
id: string;
|
|
256
|
-
type: string;
|
|
257
|
-
bounds: BlockRect;
|
|
258
|
-
layoutPosition?: string;
|
|
259
|
-
}>;
|
|
260
|
-
schemas: Record<string, BlockSchema>;
|
|
261
|
-
blockMeta?: Record<string, BlockMeta>;
|
|
262
|
-
}
|
|
263
|
-
interface BoundsMessage {
|
|
264
|
-
type: "cmssy:bounds";
|
|
265
|
-
blockId: string;
|
|
266
|
-
rect: BlockRect;
|
|
267
|
-
}
|
|
268
|
-
interface ClickMessage {
|
|
269
|
-
type: "cmssy:click";
|
|
270
|
-
blockId: string;
|
|
271
|
-
rect: BlockRect;
|
|
272
|
-
layoutPosition?: string;
|
|
273
|
-
}
|
|
274
|
-
interface MoveMessage {
|
|
275
|
-
type: "cmssy:move";
|
|
276
|
-
protocolVersion: number;
|
|
277
|
-
blockId: string;
|
|
278
|
-
index: number;
|
|
279
|
-
}
|
|
280
|
-
interface DragIndexMessage {
|
|
281
|
-
type: "cmssy:drag-index";
|
|
282
|
-
protocolVersion: number;
|
|
283
|
-
index: number;
|
|
284
|
-
}
|
|
285
|
-
type AppToEditorMessage = ReadyMessage | BoundsMessage | ClickMessage | MoveMessage | DragIndexMessage;
|
|
286
|
-
interface SelectMessage {
|
|
287
|
-
type: "cmssy:select";
|
|
288
|
-
protocolVersion: number;
|
|
289
|
-
blockId: string;
|
|
290
|
-
}
|
|
291
|
-
interface PatchMessage {
|
|
292
|
-
type: "cmssy:patch";
|
|
293
|
-
protocolVersion: number;
|
|
294
|
-
blockId: string;
|
|
295
|
-
content: Record<string, unknown>;
|
|
296
|
-
style?: Record<string, unknown>;
|
|
297
|
-
advanced?: Record<string, unknown>;
|
|
298
|
-
layoutPosition?: string;
|
|
299
|
-
}
|
|
300
|
-
interface ParentReadyMessage {
|
|
301
|
-
type: "cmssy:parent-ready";
|
|
302
|
-
protocolVersion: number;
|
|
303
|
-
}
|
|
304
|
-
interface InsertMessage {
|
|
305
|
-
type: "cmssy:insert";
|
|
306
|
-
protocolVersion: number;
|
|
307
|
-
blockId: string;
|
|
308
|
-
blockType: string;
|
|
309
|
-
content: Record<string, unknown>;
|
|
310
|
-
style?: Record<string, unknown>;
|
|
311
|
-
advanced?: Record<string, unknown>;
|
|
312
|
-
index: number;
|
|
313
|
-
}
|
|
314
|
-
interface ReorderMessage {
|
|
315
|
-
type: "cmssy:reorder";
|
|
316
|
-
protocolVersion: number;
|
|
317
|
-
blockIds: string[];
|
|
318
|
-
}
|
|
319
|
-
interface RemoveMessage {
|
|
320
|
-
type: "cmssy:remove";
|
|
321
|
-
protocolVersion: number;
|
|
322
|
-
blockId: string;
|
|
323
|
-
}
|
|
324
|
-
interface DragOverMessage {
|
|
325
|
-
type: "cmssy:drag-over";
|
|
326
|
-
protocolVersion: number;
|
|
327
|
-
y: number;
|
|
328
|
-
}
|
|
329
|
-
interface DragEndMessage {
|
|
330
|
-
type: "cmssy:drag-end";
|
|
331
|
-
protocolVersion: number;
|
|
332
|
-
}
|
|
333
|
-
type EditorToAppMessage = SelectMessage | PatchMessage | ParentReadyMessage | InsertMessage | ReorderMessage | RemoveMessage | DragOverMessage | DragEndMessage;
|
|
334
|
-
declare function isProtocolCompatible(version: number): boolean;
|
|
335
|
-
|
|
336
107
|
interface BlockLoaderArgs {
|
|
337
108
|
content: Record<string, unknown>;
|
|
338
109
|
context?: CmssyBlockContext;
|
|
@@ -552,4 +323,4 @@ interface CmssyOrder {
|
|
|
552
323
|
accessToken?: string | null;
|
|
553
324
|
}
|
|
554
325
|
|
|
555
|
-
export {
|
|
326
|
+
export { type CmssyTaxSummaryLine as A, type BlockDefinition as B, type CmssyFormDefinition as C, MODEL_RECORDS_QUERY as D, SUBMIT_FORM_MUTATION as E, FORM_QUERY as F, type SubmitFormInput as G, blocksToMeta as H, blocksToSchemas as I, buildBlockContext as J, buildBlockMap as K, defineBlock as L, MODEL_DEFINITIONS_QUERY as M, SITE_CONFIG_QUERY as S, type CmssyLocaleContext as a, type CmssyAddress as b, type CmssyCart as c, type CmssyOrder as d, type CmssyProduct as e, type CmssyCartDiscount as f, type CmssyCartItem as g, type CmssyCartItemSnapshot as h, type CmssyOrderItem as i, type CmssyProductVariant as j, type CmssyBlockAuthContext as k, type CmssyBlockWorkspace as l, type BlockMap as m, type CmssyBlockContext as n, type BuildBlockContextExtra as o, type CmssyBlockMember as p, type CmssyFormField as q, type CmssyFormSettings as r, type CmssyFormSubmitResponse as s, type CmssyModelDefinition as t, type CmssyModelRecord as u, type CmssyOrderDiscount as v, type CmssyOrderTaxSummaryLine as w, type CmssyPriceTier as x, type CmssyRecordList as y, type CmssyShippingMethod as z };
|
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,137 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { CmssyClientConfig, CmssyLayoutGroup, CmssyPageData, CmssyPageMeta, CmssyPageSummary, BlockRect, BlockSchema, BlockMeta, FieldControl, FieldDefinition, CmssySiteConfig, RawBlock, CmssySiteLocales } from '@cmssy/types';
|
|
2
|
+
export { BlockMeta, BlockRect, BlockSchema, CmssyBranding, CmssyClientConfig, CmssyLayoutGroup, CmssyLayoutSettings, CmssyLocalizedValue, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssySiteConfig, CmssySiteLocales, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldType, RawBlock, RawLayoutBlock, evaluateFieldConditionGroup } from '@cmssy/types';
|
|
3
|
+
import { B as BlockDefinition, C as CmssyFormDefinition, k as CmssyBlockAuthContext, l as CmssyBlockWorkspace, a as CmssyLocaleContext, m as BlockMap, n as CmssyBlockContext } from './commerce-queries-BJCoqTJW.cjs';
|
|
4
|
+
export { o as BuildBlockContextExtra, b as CmssyAddress, p as CmssyBlockMember, c as CmssyCart, f as CmssyCartDiscount, g as CmssyCartItem, h as CmssyCartItemSnapshot, q as CmssyFormField, r as CmssyFormSettings, s as CmssyFormSubmitResponse, t as CmssyModelDefinition, u as CmssyModelRecord, d as CmssyOrder, v as CmssyOrderDiscount, i as CmssyOrderItem, w as CmssyOrderTaxSummaryLine, x as CmssyPriceTier, e as CmssyProduct, j as CmssyProductVariant, y as CmssyRecordList, z as CmssyShippingMethod, A as CmssyTaxSummaryLine, F as FORM_QUERY, M as MODEL_DEFINITIONS_QUERY, D as MODEL_RECORDS_QUERY, S as SITE_CONFIG_QUERY, E as SUBMIT_FORM_MUTATION, G as SubmitFormInput, H as blocksToMeta, I as blocksToSchemas, J as buildBlockContext, K as buildBlockMap, L as defineBlock } from './commerce-queries-BJCoqTJW.cjs';
|
|
3
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
export { FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldType, evaluateFieldConditionGroup } from '@cmssy/types';
|
|
5
6
|
import 'react';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The cmssy cloud GraphQL delivery endpoint. It is the same for every workspace,
|
|
10
|
+
* so consumers never need to set it - `apiUrl` defaults to this. Self-hosted /
|
|
11
|
+
* staging deployments override it via config.
|
|
12
|
+
*/
|
|
13
|
+
declare const DEFAULT_CMSSY_API_URL = "https://api.cmssy.io/graphql";
|
|
14
|
+
declare function resolveApiUrl(apiUrl: string | undefined): string;
|
|
15
|
+
/**
|
|
16
|
+
* Public delivery endpoint for a workspace: the org-scoped path
|
|
17
|
+
* `{base}/public/{orgSlug}/{workspaceSlug}/graphql`. `apiUrl` is the GraphQL
|
|
18
|
+
* base (its trailing `/graphql` is stripped); the org path is what tells the
|
|
19
|
+
* backend which workspace to serve, so slugs only need to be unique per org.
|
|
20
|
+
*/
|
|
21
|
+
declare function resolvePublicUrl(config: CmssyClientConfig): string;
|
|
22
|
+
interface FetchLikeResponse {
|
|
23
|
+
ok: boolean;
|
|
24
|
+
status: number;
|
|
25
|
+
json: () => Promise<unknown>;
|
|
26
|
+
}
|
|
27
|
+
type FetchLike = (url: string, init: {
|
|
28
|
+
method: string;
|
|
29
|
+
headers: Record<string, string>;
|
|
30
|
+
body: string;
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
}) => Promise<FetchLikeResponse>;
|
|
33
|
+
interface FetchPageOptions {
|
|
34
|
+
previewSecret?: string;
|
|
35
|
+
devPreview?: boolean;
|
|
36
|
+
devToken?: string;
|
|
37
|
+
workspaceId?: string;
|
|
38
|
+
fetch?: FetchLike;
|
|
39
|
+
signal?: AbortSignal;
|
|
40
|
+
}
|
|
41
|
+
declare function normalizeSlug(path: string | string[] | undefined): string;
|
|
42
|
+
declare function fetchPage(config: CmssyClientConfig, path: string | string[] | undefined, options?: FetchPageOptions): Promise<CmssyPageData | null>;
|
|
43
|
+
declare function fetchPageById(config: CmssyClientConfig, pageId: string, options?: Pick<FetchPageOptions, "fetch" | "signal">): Promise<CmssyPageData | null>;
|
|
44
|
+
declare function fetchPages(config: CmssyClientConfig, options?: Pick<FetchPageOptions, "fetch" | "signal">): Promise<CmssyPageSummary[]>;
|
|
45
|
+
declare function fetchPageMeta(config: CmssyClientConfig, path: string | string[] | undefined, options?: Pick<FetchPageOptions, "fetch" | "signal">): Promise<CmssyPageMeta | null>;
|
|
46
|
+
declare function fetchLayouts(config: CmssyClientConfig, path: string | string[] | undefined, options?: FetchPageOptions): Promise<CmssyLayoutGroup[]>;
|
|
47
|
+
|
|
48
|
+
declare const PROTOCOL_VERSION = 2;
|
|
49
|
+
|
|
50
|
+
interface ReadyMessage {
|
|
51
|
+
type: "cmssy:ready";
|
|
52
|
+
protocolVersion: number;
|
|
53
|
+
blocks: Array<{
|
|
54
|
+
id: string;
|
|
55
|
+
type: string;
|
|
56
|
+
bounds: BlockRect;
|
|
57
|
+
layoutPosition?: string;
|
|
58
|
+
}>;
|
|
59
|
+
schemas: Record<string, BlockSchema>;
|
|
60
|
+
blockMeta?: Record<string, BlockMeta>;
|
|
61
|
+
}
|
|
62
|
+
interface BoundsMessage {
|
|
63
|
+
type: "cmssy:bounds";
|
|
64
|
+
blockId: string;
|
|
65
|
+
rect: BlockRect;
|
|
66
|
+
}
|
|
67
|
+
interface ClickMessage {
|
|
68
|
+
type: "cmssy:click";
|
|
69
|
+
blockId: string;
|
|
70
|
+
rect: BlockRect;
|
|
71
|
+
layoutPosition?: string;
|
|
72
|
+
}
|
|
73
|
+
interface MoveMessage {
|
|
74
|
+
type: "cmssy:move";
|
|
75
|
+
protocolVersion: number;
|
|
76
|
+
blockId: string;
|
|
77
|
+
index: number;
|
|
78
|
+
}
|
|
79
|
+
interface DragIndexMessage {
|
|
80
|
+
type: "cmssy:drag-index";
|
|
81
|
+
protocolVersion: number;
|
|
82
|
+
index: number;
|
|
83
|
+
}
|
|
84
|
+
type AppToEditorMessage = ReadyMessage | BoundsMessage | ClickMessage | MoveMessage | DragIndexMessage;
|
|
85
|
+
interface SelectMessage {
|
|
86
|
+
type: "cmssy:select";
|
|
87
|
+
protocolVersion: number;
|
|
88
|
+
blockId: string;
|
|
89
|
+
}
|
|
90
|
+
interface PatchMessage {
|
|
91
|
+
type: "cmssy:patch";
|
|
92
|
+
protocolVersion: number;
|
|
93
|
+
blockId: string;
|
|
94
|
+
content: Record<string, unknown>;
|
|
95
|
+
style?: Record<string, unknown>;
|
|
96
|
+
advanced?: Record<string, unknown>;
|
|
97
|
+
layoutPosition?: string;
|
|
98
|
+
}
|
|
99
|
+
interface ParentReadyMessage {
|
|
100
|
+
type: "cmssy:parent-ready";
|
|
101
|
+
protocolVersion: number;
|
|
102
|
+
}
|
|
103
|
+
interface InsertMessage {
|
|
104
|
+
type: "cmssy:insert";
|
|
105
|
+
protocolVersion: number;
|
|
106
|
+
blockId: string;
|
|
107
|
+
blockType: string;
|
|
108
|
+
content: Record<string, unknown>;
|
|
109
|
+
style?: Record<string, unknown>;
|
|
110
|
+
advanced?: Record<string, unknown>;
|
|
111
|
+
index: number;
|
|
112
|
+
}
|
|
113
|
+
interface ReorderMessage {
|
|
114
|
+
type: "cmssy:reorder";
|
|
115
|
+
protocolVersion: number;
|
|
116
|
+
blockIds: string[];
|
|
117
|
+
}
|
|
118
|
+
interface RemoveMessage {
|
|
119
|
+
type: "cmssy:remove";
|
|
120
|
+
protocolVersion: number;
|
|
121
|
+
blockId: string;
|
|
122
|
+
}
|
|
123
|
+
interface DragOverMessage {
|
|
124
|
+
type: "cmssy:drag-over";
|
|
125
|
+
protocolVersion: number;
|
|
126
|
+
y: number;
|
|
127
|
+
}
|
|
128
|
+
interface DragEndMessage {
|
|
129
|
+
type: "cmssy:drag-end";
|
|
130
|
+
protocolVersion: number;
|
|
131
|
+
}
|
|
132
|
+
type EditorToAppMessage = SelectMessage | PatchMessage | ParentReadyMessage | InsertMessage | ReorderMessage | RemoveMessage | DragOverMessage | DragEndMessage;
|
|
133
|
+
declare function isProtocolCompatible(version: number): boolean;
|
|
134
|
+
|
|
10
135
|
declare const fields: {
|
|
11
136
|
text: (opts?: FieldControl) => FieldDefinition;
|
|
12
137
|
textarea: (opts?: FieldControl) => FieldDefinition;
|
|
@@ -107,10 +232,6 @@ declare function createCmssyClient(input: CmssyClientConfig): CmssyClient;
|
|
|
107
232
|
declare function collectFormIds(blocks: RawBlock[], locale: string, defaultLocale: string): string[];
|
|
108
233
|
declare function resolveForms(config: CmssyClientConfig, blocks: RawBlock[], locale: string, defaultLocale: string, options?: QueryScopedOptions): Promise<Record<string, CmssyFormDefinition>>;
|
|
109
234
|
|
|
110
|
-
interface CmssySiteLocales {
|
|
111
|
-
defaultLocale: string;
|
|
112
|
-
locales: string[];
|
|
113
|
-
}
|
|
114
235
|
declare function resolveSiteLocales(config: CmssyClientConfig, options?: GraphqlRequestOptions): Promise<CmssySiteLocales>;
|
|
115
236
|
declare function splitLocaleFromPath(path: string[] | undefined, siteLocales: CmssySiteLocales): {
|
|
116
237
|
locale: string;
|
|
@@ -153,4 +274,4 @@ interface UnknownBlockProps {
|
|
|
153
274
|
}
|
|
154
275
|
declare function UnknownBlock({ type }: UnknownBlockProps): react_jsx_runtime.JSX.Element;
|
|
155
276
|
|
|
156
|
-
export { AppToEditorMessage, BlockDefinition, BlockMap, CmssyBlock, CmssyBlockAuthContext, CmssyBlockContext, type CmssyBlockProps, CmssyBlockWorkspace, type CmssyClient,
|
|
277
|
+
export { type AppToEditorMessage, BlockDefinition, BlockMap, type BoundsMessage, type ClickMessage, CmssyBlock, CmssyBlockAuthContext, CmssyBlockContext, type CmssyBlockProps, CmssyBlockWorkspace, type CmssyClient, CmssyFormDefinition, CmssyLocaleContext, CmssyServerLayout, type CmssyServerLayoutProps, CmssyServerPage, type CmssyServerPageProps, DEFAULT_CMSSY_API_URL, type EditorToAppMessage, type FetchLike, type FetchLikeResponse, type FetchPageOptions, type GraphqlRequestOptions, PROTOCOL_VERSION, type ParentReadyMessage, type PatchMessage, type PostTarget, type QueryScopedOptions, type ReadyMessage, type SelectMessage, UnknownBlock, type UnknownBlockProps, buildLocaleSwitchHref, collectFormIds, createCmssyClient, fetchLayouts, fetchPage, fetchPageById, fetchPageMeta, fetchPages, fetchSiteConfig, fields, getBlockContentForLanguage, graphqlRequest, isProtocolCompatible, localizeHref, localizeHtmlLinks, normalizeOrigin, normalizeSlug, parseEditorMessage, postToEditor, resolveApiUrl, resolveForms, resolvePublicUrl, resolveSiteLocales, resolveWorkspaceId, splitLocaleFromPath };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,137 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { CmssyClientConfig, CmssyLayoutGroup, CmssyPageData, CmssyPageMeta, CmssyPageSummary, BlockRect, BlockSchema, BlockMeta, FieldControl, FieldDefinition, CmssySiteConfig, RawBlock, CmssySiteLocales } from '@cmssy/types';
|
|
2
|
+
export { BlockMeta, BlockRect, BlockSchema, CmssyBranding, CmssyClientConfig, CmssyLayoutGroup, CmssyLayoutSettings, CmssyLocalizedValue, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssySiteConfig, CmssySiteLocales, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldType, RawBlock, RawLayoutBlock, evaluateFieldConditionGroup } from '@cmssy/types';
|
|
3
|
+
import { B as BlockDefinition, C as CmssyFormDefinition, k as CmssyBlockAuthContext, l as CmssyBlockWorkspace, a as CmssyLocaleContext, m as BlockMap, n as CmssyBlockContext } from './commerce-queries-BJCoqTJW.js';
|
|
4
|
+
export { o as BuildBlockContextExtra, b as CmssyAddress, p as CmssyBlockMember, c as CmssyCart, f as CmssyCartDiscount, g as CmssyCartItem, h as CmssyCartItemSnapshot, q as CmssyFormField, r as CmssyFormSettings, s as CmssyFormSubmitResponse, t as CmssyModelDefinition, u as CmssyModelRecord, d as CmssyOrder, v as CmssyOrderDiscount, i as CmssyOrderItem, w as CmssyOrderTaxSummaryLine, x as CmssyPriceTier, e as CmssyProduct, j as CmssyProductVariant, y as CmssyRecordList, z as CmssyShippingMethod, A as CmssyTaxSummaryLine, F as FORM_QUERY, M as MODEL_DEFINITIONS_QUERY, D as MODEL_RECORDS_QUERY, S as SITE_CONFIG_QUERY, E as SUBMIT_FORM_MUTATION, G as SubmitFormInput, H as blocksToMeta, I as blocksToSchemas, J as buildBlockContext, K as buildBlockMap, L as defineBlock } from './commerce-queries-BJCoqTJW.js';
|
|
3
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
export { FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldType, evaluateFieldConditionGroup } from '@cmssy/types';
|
|
5
6
|
import 'react';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The cmssy cloud GraphQL delivery endpoint. It is the same for every workspace,
|
|
10
|
+
* so consumers never need to set it - `apiUrl` defaults to this. Self-hosted /
|
|
11
|
+
* staging deployments override it via config.
|
|
12
|
+
*/
|
|
13
|
+
declare const DEFAULT_CMSSY_API_URL = "https://api.cmssy.io/graphql";
|
|
14
|
+
declare function resolveApiUrl(apiUrl: string | undefined): string;
|
|
15
|
+
/**
|
|
16
|
+
* Public delivery endpoint for a workspace: the org-scoped path
|
|
17
|
+
* `{base}/public/{orgSlug}/{workspaceSlug}/graphql`. `apiUrl` is the GraphQL
|
|
18
|
+
* base (its trailing `/graphql` is stripped); the org path is what tells the
|
|
19
|
+
* backend which workspace to serve, so slugs only need to be unique per org.
|
|
20
|
+
*/
|
|
21
|
+
declare function resolvePublicUrl(config: CmssyClientConfig): string;
|
|
22
|
+
interface FetchLikeResponse {
|
|
23
|
+
ok: boolean;
|
|
24
|
+
status: number;
|
|
25
|
+
json: () => Promise<unknown>;
|
|
26
|
+
}
|
|
27
|
+
type FetchLike = (url: string, init: {
|
|
28
|
+
method: string;
|
|
29
|
+
headers: Record<string, string>;
|
|
30
|
+
body: string;
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
}) => Promise<FetchLikeResponse>;
|
|
33
|
+
interface FetchPageOptions {
|
|
34
|
+
previewSecret?: string;
|
|
35
|
+
devPreview?: boolean;
|
|
36
|
+
devToken?: string;
|
|
37
|
+
workspaceId?: string;
|
|
38
|
+
fetch?: FetchLike;
|
|
39
|
+
signal?: AbortSignal;
|
|
40
|
+
}
|
|
41
|
+
declare function normalizeSlug(path: string | string[] | undefined): string;
|
|
42
|
+
declare function fetchPage(config: CmssyClientConfig, path: string | string[] | undefined, options?: FetchPageOptions): Promise<CmssyPageData | null>;
|
|
43
|
+
declare function fetchPageById(config: CmssyClientConfig, pageId: string, options?: Pick<FetchPageOptions, "fetch" | "signal">): Promise<CmssyPageData | null>;
|
|
44
|
+
declare function fetchPages(config: CmssyClientConfig, options?: Pick<FetchPageOptions, "fetch" | "signal">): Promise<CmssyPageSummary[]>;
|
|
45
|
+
declare function fetchPageMeta(config: CmssyClientConfig, path: string | string[] | undefined, options?: Pick<FetchPageOptions, "fetch" | "signal">): Promise<CmssyPageMeta | null>;
|
|
46
|
+
declare function fetchLayouts(config: CmssyClientConfig, path: string | string[] | undefined, options?: FetchPageOptions): Promise<CmssyLayoutGroup[]>;
|
|
47
|
+
|
|
48
|
+
declare const PROTOCOL_VERSION = 2;
|
|
49
|
+
|
|
50
|
+
interface ReadyMessage {
|
|
51
|
+
type: "cmssy:ready";
|
|
52
|
+
protocolVersion: number;
|
|
53
|
+
blocks: Array<{
|
|
54
|
+
id: string;
|
|
55
|
+
type: string;
|
|
56
|
+
bounds: BlockRect;
|
|
57
|
+
layoutPosition?: string;
|
|
58
|
+
}>;
|
|
59
|
+
schemas: Record<string, BlockSchema>;
|
|
60
|
+
blockMeta?: Record<string, BlockMeta>;
|
|
61
|
+
}
|
|
62
|
+
interface BoundsMessage {
|
|
63
|
+
type: "cmssy:bounds";
|
|
64
|
+
blockId: string;
|
|
65
|
+
rect: BlockRect;
|
|
66
|
+
}
|
|
67
|
+
interface ClickMessage {
|
|
68
|
+
type: "cmssy:click";
|
|
69
|
+
blockId: string;
|
|
70
|
+
rect: BlockRect;
|
|
71
|
+
layoutPosition?: string;
|
|
72
|
+
}
|
|
73
|
+
interface MoveMessage {
|
|
74
|
+
type: "cmssy:move";
|
|
75
|
+
protocolVersion: number;
|
|
76
|
+
blockId: string;
|
|
77
|
+
index: number;
|
|
78
|
+
}
|
|
79
|
+
interface DragIndexMessage {
|
|
80
|
+
type: "cmssy:drag-index";
|
|
81
|
+
protocolVersion: number;
|
|
82
|
+
index: number;
|
|
83
|
+
}
|
|
84
|
+
type AppToEditorMessage = ReadyMessage | BoundsMessage | ClickMessage | MoveMessage | DragIndexMessage;
|
|
85
|
+
interface SelectMessage {
|
|
86
|
+
type: "cmssy:select";
|
|
87
|
+
protocolVersion: number;
|
|
88
|
+
blockId: string;
|
|
89
|
+
}
|
|
90
|
+
interface PatchMessage {
|
|
91
|
+
type: "cmssy:patch";
|
|
92
|
+
protocolVersion: number;
|
|
93
|
+
blockId: string;
|
|
94
|
+
content: Record<string, unknown>;
|
|
95
|
+
style?: Record<string, unknown>;
|
|
96
|
+
advanced?: Record<string, unknown>;
|
|
97
|
+
layoutPosition?: string;
|
|
98
|
+
}
|
|
99
|
+
interface ParentReadyMessage {
|
|
100
|
+
type: "cmssy:parent-ready";
|
|
101
|
+
protocolVersion: number;
|
|
102
|
+
}
|
|
103
|
+
interface InsertMessage {
|
|
104
|
+
type: "cmssy:insert";
|
|
105
|
+
protocolVersion: number;
|
|
106
|
+
blockId: string;
|
|
107
|
+
blockType: string;
|
|
108
|
+
content: Record<string, unknown>;
|
|
109
|
+
style?: Record<string, unknown>;
|
|
110
|
+
advanced?: Record<string, unknown>;
|
|
111
|
+
index: number;
|
|
112
|
+
}
|
|
113
|
+
interface ReorderMessage {
|
|
114
|
+
type: "cmssy:reorder";
|
|
115
|
+
protocolVersion: number;
|
|
116
|
+
blockIds: string[];
|
|
117
|
+
}
|
|
118
|
+
interface RemoveMessage {
|
|
119
|
+
type: "cmssy:remove";
|
|
120
|
+
protocolVersion: number;
|
|
121
|
+
blockId: string;
|
|
122
|
+
}
|
|
123
|
+
interface DragOverMessage {
|
|
124
|
+
type: "cmssy:drag-over";
|
|
125
|
+
protocolVersion: number;
|
|
126
|
+
y: number;
|
|
127
|
+
}
|
|
128
|
+
interface DragEndMessage {
|
|
129
|
+
type: "cmssy:drag-end";
|
|
130
|
+
protocolVersion: number;
|
|
131
|
+
}
|
|
132
|
+
type EditorToAppMessage = SelectMessage | PatchMessage | ParentReadyMessage | InsertMessage | ReorderMessage | RemoveMessage | DragOverMessage | DragEndMessage;
|
|
133
|
+
declare function isProtocolCompatible(version: number): boolean;
|
|
134
|
+
|
|
10
135
|
declare const fields: {
|
|
11
136
|
text: (opts?: FieldControl) => FieldDefinition;
|
|
12
137
|
textarea: (opts?: FieldControl) => FieldDefinition;
|
|
@@ -107,10 +232,6 @@ declare function createCmssyClient(input: CmssyClientConfig): CmssyClient;
|
|
|
107
232
|
declare function collectFormIds(blocks: RawBlock[], locale: string, defaultLocale: string): string[];
|
|
108
233
|
declare function resolveForms(config: CmssyClientConfig, blocks: RawBlock[], locale: string, defaultLocale: string, options?: QueryScopedOptions): Promise<Record<string, CmssyFormDefinition>>;
|
|
109
234
|
|
|
110
|
-
interface CmssySiteLocales {
|
|
111
|
-
defaultLocale: string;
|
|
112
|
-
locales: string[];
|
|
113
|
-
}
|
|
114
235
|
declare function resolveSiteLocales(config: CmssyClientConfig, options?: GraphqlRequestOptions): Promise<CmssySiteLocales>;
|
|
115
236
|
declare function splitLocaleFromPath(path: string[] | undefined, siteLocales: CmssySiteLocales): {
|
|
116
237
|
locale: string;
|
|
@@ -153,4 +274,4 @@ interface UnknownBlockProps {
|
|
|
153
274
|
}
|
|
154
275
|
declare function UnknownBlock({ type }: UnknownBlockProps): react_jsx_runtime.JSX.Element;
|
|
155
276
|
|
|
156
|
-
export { AppToEditorMessage, BlockDefinition, BlockMap, CmssyBlock, CmssyBlockAuthContext, CmssyBlockContext, type CmssyBlockProps, CmssyBlockWorkspace, type CmssyClient,
|
|
277
|
+
export { type AppToEditorMessage, BlockDefinition, BlockMap, type BoundsMessage, type ClickMessage, CmssyBlock, CmssyBlockAuthContext, CmssyBlockContext, type CmssyBlockProps, CmssyBlockWorkspace, type CmssyClient, CmssyFormDefinition, CmssyLocaleContext, CmssyServerLayout, type CmssyServerLayoutProps, CmssyServerPage, type CmssyServerPageProps, DEFAULT_CMSSY_API_URL, type EditorToAppMessage, type FetchLike, type FetchLikeResponse, type FetchPageOptions, type GraphqlRequestOptions, PROTOCOL_VERSION, type ParentReadyMessage, type PatchMessage, type PostTarget, type QueryScopedOptions, type ReadyMessage, type SelectMessage, UnknownBlock, type UnknownBlockProps, buildLocaleSwitchHref, collectFormIds, createCmssyClient, fetchLayouts, fetchPage, fetchPageById, fetchPageMeta, fetchPages, fetchSiteConfig, fields, getBlockContentForLanguage, graphqlRequest, isProtocolCompatible, localizeHref, localizeHtmlLinks, normalizeOrigin, normalizeSlug, parseEditorMessage, postToEditor, resolveApiUrl, resolveForms, resolvePublicUrl, resolveSiteLocales, resolveWorkspaceId, splitLocaleFromPath };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmssy/react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "React blocks, renderers, data client and editor bridge for cmssy headless sites",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cmssy",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"vitest": "^2.1.0"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@cmssy/types": "0.
|
|
59
|
+
"@cmssy/types": "0.24.0"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "tsup",
|