@cmssy/react 0.7.6 → 0.8.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.cjs +19 -14
- package/dist/client.d.cts +3 -2
- package/dist/client.d.ts +3 -2
- package/dist/client.js +19 -14
- package/dist/{commerce-queries-CA8_5lMX.d.cts → commerce-queries-Ch7QldF7.d.cts} +13 -3
- package/dist/{commerce-queries-CA8_5lMX.d.ts → commerce-queries-Ch7QldF7.d.ts} +13 -3
- package/dist/index.cjs +12 -7
- package/dist/index.d.cts +12 -7
- package/dist/index.d.ts +12 -7
- package/dist/index.js +12 -7
- package/package.json +4 -1
package/dist/client.cjs
CHANGED
|
@@ -32,14 +32,15 @@ function blocksToMeta(blocks, defaults = {}) {
|
|
|
32
32
|
label: block.label ?? block.type,
|
|
33
33
|
...category ? { category } : {},
|
|
34
34
|
...block.icon ? { icon: block.icon } : {},
|
|
35
|
-
...block.layoutPositions ? { layoutPositions: block.layoutPositions } : {}
|
|
35
|
+
...block.layoutPositions ? { layoutPositions: block.layoutPositions } : {},
|
|
36
|
+
...block.description ? { description: block.description } : {}
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
39
|
return out;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
// src/bridge/protocol.ts
|
|
42
|
-
var PROTOCOL_VERSION =
|
|
43
|
+
var PROTOCOL_VERSION = 2;
|
|
43
44
|
|
|
44
45
|
// src/bridge/messages.ts
|
|
45
46
|
function normalizeOrigin(origin) {
|
|
@@ -1019,17 +1020,21 @@ function control(type) {
|
|
|
1019
1020
|
});
|
|
1020
1021
|
}
|
|
1021
1022
|
var fields = {
|
|
1022
|
-
|
|
1023
|
-
|
|
1023
|
+
text: control("text"),
|
|
1024
|
+
textarea: control("textarea"),
|
|
1024
1025
|
richText: control("richText"),
|
|
1025
|
-
|
|
1026
|
+
number: control("number"),
|
|
1026
1027
|
date: control("date"),
|
|
1028
|
+
datetime: control("datetime"),
|
|
1029
|
+
boolean: control("boolean"),
|
|
1030
|
+
color: control("color"),
|
|
1027
1031
|
media: control("media"),
|
|
1028
1032
|
link: control("link"),
|
|
1033
|
+
url: control("url"),
|
|
1034
|
+
email: control("email"),
|
|
1029
1035
|
select: control("select"),
|
|
1030
1036
|
multiselect: control("multiselect"),
|
|
1031
|
-
|
|
1032
|
-
color: control("color"),
|
|
1037
|
+
radio: control("radio"),
|
|
1033
1038
|
repeater: control("repeater")
|
|
1034
1039
|
};
|
|
1035
1040
|
|
|
@@ -1216,12 +1221,12 @@ var productBlock = defineBlock({
|
|
|
1216
1221
|
label: "Product",
|
|
1217
1222
|
category: "Commerce",
|
|
1218
1223
|
props: {
|
|
1219
|
-
modelSlug: fields.
|
|
1220
|
-
slugField: fields.
|
|
1221
|
-
slug: fields.
|
|
1222
|
-
nameField: fields.
|
|
1223
|
-
priceField: fields.
|
|
1224
|
-
imageField: fields.
|
|
1224
|
+
modelSlug: fields.text({ label: "Model slug" }),
|
|
1225
|
+
slugField: fields.text({ label: "Slug field" }),
|
|
1226
|
+
slug: fields.text({ label: "Product slug" }),
|
|
1227
|
+
nameField: fields.text({ label: "Name field" }),
|
|
1228
|
+
priceField: fields.text({ label: "Price field" }),
|
|
1229
|
+
imageField: fields.text({ label: "Image field" })
|
|
1225
1230
|
},
|
|
1226
1231
|
component: ProductComponent
|
|
1227
1232
|
});
|
|
@@ -1415,7 +1420,7 @@ var checkoutBlock = defineBlock({
|
|
|
1415
1420
|
label: "Checkout",
|
|
1416
1421
|
category: "Commerce",
|
|
1417
1422
|
props: {
|
|
1418
|
-
successMessage: fields.
|
|
1423
|
+
successMessage: fields.text({ label: "Success message" })
|
|
1419
1424
|
},
|
|
1420
1425
|
component: CheckoutComponent
|
|
1421
1426
|
});
|
package/dist/client.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
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-Ch7QldF7.cjs';
|
|
3
|
+
export { i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, l as CmssyOrderItem, m as CmssyProductVariant } from './commerce-queries-Ch7QldF7.cjs';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
|
+
import '@cmssy/types';
|
|
5
6
|
|
|
6
7
|
interface EditBridgeConfig {
|
|
7
8
|
editorOrigin: string;
|
package/dist/client.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
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-Ch7QldF7.js';
|
|
3
|
+
export { i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, l as CmssyOrderItem, m as CmssyProductVariant } from './commerce-queries-Ch7QldF7.js';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
|
+
import '@cmssy/types';
|
|
5
6
|
|
|
6
7
|
interface EditBridgeConfig {
|
|
7
8
|
editorOrigin: string;
|
package/dist/client.js
CHANGED
|
@@ -30,14 +30,15 @@ function blocksToMeta(blocks, defaults = {}) {
|
|
|
30
30
|
label: block.label ?? block.type,
|
|
31
31
|
...category ? { category } : {},
|
|
32
32
|
...block.icon ? { icon: block.icon } : {},
|
|
33
|
-
...block.layoutPositions ? { layoutPositions: block.layoutPositions } : {}
|
|
33
|
+
...block.layoutPositions ? { layoutPositions: block.layoutPositions } : {},
|
|
34
|
+
...block.description ? { description: block.description } : {}
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
37
|
return out;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
// src/bridge/protocol.ts
|
|
40
|
-
var PROTOCOL_VERSION =
|
|
41
|
+
var PROTOCOL_VERSION = 2;
|
|
41
42
|
|
|
42
43
|
// src/bridge/messages.ts
|
|
43
44
|
function normalizeOrigin(origin) {
|
|
@@ -1017,17 +1018,21 @@ function control(type) {
|
|
|
1017
1018
|
});
|
|
1018
1019
|
}
|
|
1019
1020
|
var fields = {
|
|
1020
|
-
|
|
1021
|
-
|
|
1021
|
+
text: control("text"),
|
|
1022
|
+
textarea: control("textarea"),
|
|
1022
1023
|
richText: control("richText"),
|
|
1023
|
-
|
|
1024
|
+
number: control("number"),
|
|
1024
1025
|
date: control("date"),
|
|
1026
|
+
datetime: control("datetime"),
|
|
1027
|
+
boolean: control("boolean"),
|
|
1028
|
+
color: control("color"),
|
|
1025
1029
|
media: control("media"),
|
|
1026
1030
|
link: control("link"),
|
|
1031
|
+
url: control("url"),
|
|
1032
|
+
email: control("email"),
|
|
1027
1033
|
select: control("select"),
|
|
1028
1034
|
multiselect: control("multiselect"),
|
|
1029
|
-
|
|
1030
|
-
color: control("color"),
|
|
1035
|
+
radio: control("radio"),
|
|
1031
1036
|
repeater: control("repeater")
|
|
1032
1037
|
};
|
|
1033
1038
|
|
|
@@ -1214,12 +1219,12 @@ var productBlock = defineBlock({
|
|
|
1214
1219
|
label: "Product",
|
|
1215
1220
|
category: "Commerce",
|
|
1216
1221
|
props: {
|
|
1217
|
-
modelSlug: fields.
|
|
1218
|
-
slugField: fields.
|
|
1219
|
-
slug: fields.
|
|
1220
|
-
nameField: fields.
|
|
1221
|
-
priceField: fields.
|
|
1222
|
-
imageField: fields.
|
|
1222
|
+
modelSlug: fields.text({ label: "Model slug" }),
|
|
1223
|
+
slugField: fields.text({ label: "Slug field" }),
|
|
1224
|
+
slug: fields.text({ label: "Product slug" }),
|
|
1225
|
+
nameField: fields.text({ label: "Name field" }),
|
|
1226
|
+
priceField: fields.text({ label: "Price field" }),
|
|
1227
|
+
imageField: fields.text({ label: "Image field" })
|
|
1223
1228
|
},
|
|
1224
1229
|
component: ProductComponent
|
|
1225
1230
|
});
|
|
@@ -1413,7 +1418,7 @@ var checkoutBlock = defineBlock({
|
|
|
1413
1418
|
label: "Checkout",
|
|
1414
1419
|
category: "Commerce",
|
|
1415
1420
|
props: {
|
|
1416
|
-
successMessage: fields.
|
|
1421
|
+
successMessage: fields.text({ label: "Success message" })
|
|
1417
1422
|
},
|
|
1418
1423
|
component: CheckoutComponent
|
|
1419
1424
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
|
+
import { FieldType } from '@cmssy/types';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* The cmssy cloud GraphQL delivery endpoint. It is the same for every workspace,
|
|
@@ -191,8 +192,8 @@ interface BuildBlockContextExtra {
|
|
|
191
192
|
}
|
|
192
193
|
declare function buildBlockContext(locale: string, defaultLocale: string, enabledLocales?: string[], isPreview?: boolean, forms?: Record<string, CmssyFormDefinition>, extra?: BuildBlockContextExtra): CmssyBlockContext;
|
|
193
194
|
|
|
194
|
-
declare const PROTOCOL_VERSION =
|
|
195
|
-
|
|
195
|
+
declare const PROTOCOL_VERSION = 2;
|
|
196
|
+
|
|
196
197
|
interface FieldDefinition {
|
|
197
198
|
type: FieldType;
|
|
198
199
|
label: string;
|
|
@@ -200,6 +201,7 @@ interface FieldDefinition {
|
|
|
200
201
|
helperText?: string;
|
|
201
202
|
required?: boolean;
|
|
202
203
|
placeholder?: string;
|
|
204
|
+
tab?: string;
|
|
203
205
|
options?: string[];
|
|
204
206
|
itemSchema?: Record<string, FieldDefinition>;
|
|
205
207
|
itemLabel?: string;
|
|
@@ -214,6 +216,8 @@ interface BlockMeta {
|
|
|
214
216
|
category?: string;
|
|
215
217
|
icon?: string;
|
|
216
218
|
layoutPositions?: string[];
|
|
219
|
+
/** One-line block description; surfaced to the AI page composer. */
|
|
220
|
+
description?: string;
|
|
217
221
|
}
|
|
218
222
|
interface BlockRect {
|
|
219
223
|
x: number;
|
|
@@ -313,6 +317,11 @@ interface BlockDefinition {
|
|
|
313
317
|
category?: string;
|
|
314
318
|
icon?: string;
|
|
315
319
|
layoutPositions?: string[];
|
|
320
|
+
/**
|
|
321
|
+
* One-line semantic description of what the block is and when it belongs on a
|
|
322
|
+
* page. Surfaced to the AI page composer to guide block selection and order.
|
|
323
|
+
*/
|
|
324
|
+
description?: string;
|
|
316
325
|
props: Record<string, FieldDefinition>;
|
|
317
326
|
/**
|
|
318
327
|
* Optional server-side data loader. Run by CmssyServerPage during SSR; its
|
|
@@ -336,6 +345,7 @@ declare function defineBlock<C extends Record<string, unknown>, D = unknown>(def
|
|
|
336
345
|
category?: string;
|
|
337
346
|
icon?: string;
|
|
338
347
|
layoutPositions?: string[];
|
|
348
|
+
description?: string;
|
|
339
349
|
props: Record<string, FieldDefinition>;
|
|
340
350
|
loader?: (args: {
|
|
341
351
|
content: C;
|
|
@@ -454,4 +464,4 @@ interface CmssyOrder {
|
|
|
454
464
|
createdAt?: string;
|
|
455
465
|
}
|
|
456
466
|
|
|
457
|
-
export {
|
|
467
|
+
export { SUBMIT_FORM_MUTATION 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, MODEL_DEFINITIONS_QUERY as T, MODEL_RECORDS_QUERY as U, PROTOCOL_VERSION as V, type ParentReadyMessage as W, type PatchMessage as X, type RawLayoutBlock as Y, type ReadyMessage as Z, SITE_CONFIG_QUERY as _, type BlockMeta as a, type SelectMessage as a0, type SubmitFormInput as a1, blocksToMeta as a2, blocksToSchemas as a3, buildBlockContext as a4, buildBlockMap as a5, defineBlock as a6, fetchLayouts as a7, fetchPage as a8, fetchPageById as a9, fetchPageMeta as aa, fetchPages as ab, isProtocolCompatible as ac, normalizeSlug as ad, resolveApiUrl as ae, 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,4 +1,5 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
|
+
import { FieldType } from '@cmssy/types';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* The cmssy cloud GraphQL delivery endpoint. It is the same for every workspace,
|
|
@@ -191,8 +192,8 @@ interface BuildBlockContextExtra {
|
|
|
191
192
|
}
|
|
192
193
|
declare function buildBlockContext(locale: string, defaultLocale: string, enabledLocales?: string[], isPreview?: boolean, forms?: Record<string, CmssyFormDefinition>, extra?: BuildBlockContextExtra): CmssyBlockContext;
|
|
193
194
|
|
|
194
|
-
declare const PROTOCOL_VERSION =
|
|
195
|
-
|
|
195
|
+
declare const PROTOCOL_VERSION = 2;
|
|
196
|
+
|
|
196
197
|
interface FieldDefinition {
|
|
197
198
|
type: FieldType;
|
|
198
199
|
label: string;
|
|
@@ -200,6 +201,7 @@ interface FieldDefinition {
|
|
|
200
201
|
helperText?: string;
|
|
201
202
|
required?: boolean;
|
|
202
203
|
placeholder?: string;
|
|
204
|
+
tab?: string;
|
|
203
205
|
options?: string[];
|
|
204
206
|
itemSchema?: Record<string, FieldDefinition>;
|
|
205
207
|
itemLabel?: string;
|
|
@@ -214,6 +216,8 @@ interface BlockMeta {
|
|
|
214
216
|
category?: string;
|
|
215
217
|
icon?: string;
|
|
216
218
|
layoutPositions?: string[];
|
|
219
|
+
/** One-line block description; surfaced to the AI page composer. */
|
|
220
|
+
description?: string;
|
|
217
221
|
}
|
|
218
222
|
interface BlockRect {
|
|
219
223
|
x: number;
|
|
@@ -313,6 +317,11 @@ interface BlockDefinition {
|
|
|
313
317
|
category?: string;
|
|
314
318
|
icon?: string;
|
|
315
319
|
layoutPositions?: string[];
|
|
320
|
+
/**
|
|
321
|
+
* One-line semantic description of what the block is and when it belongs on a
|
|
322
|
+
* page. Surfaced to the AI page composer to guide block selection and order.
|
|
323
|
+
*/
|
|
324
|
+
description?: string;
|
|
316
325
|
props: Record<string, FieldDefinition>;
|
|
317
326
|
/**
|
|
318
327
|
* Optional server-side data loader. Run by CmssyServerPage during SSR; its
|
|
@@ -336,6 +345,7 @@ declare function defineBlock<C extends Record<string, unknown>, D = unknown>(def
|
|
|
336
345
|
category?: string;
|
|
337
346
|
icon?: string;
|
|
338
347
|
layoutPositions?: string[];
|
|
348
|
+
description?: string;
|
|
339
349
|
props: Record<string, FieldDefinition>;
|
|
340
350
|
loader?: (args: {
|
|
341
351
|
content: C;
|
|
@@ -454,4 +464,4 @@ interface CmssyOrder {
|
|
|
454
464
|
createdAt?: string;
|
|
455
465
|
}
|
|
456
466
|
|
|
457
|
-
export {
|
|
467
|
+
export { SUBMIT_FORM_MUTATION 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, MODEL_DEFINITIONS_QUERY as T, MODEL_RECORDS_QUERY as U, PROTOCOL_VERSION as V, type ParentReadyMessage as W, type PatchMessage as X, type RawLayoutBlock as Y, type ReadyMessage as Z, SITE_CONFIG_QUERY as _, type BlockMeta as a, type SelectMessage as a0, type SubmitFormInput as a1, blocksToMeta as a2, blocksToSchemas as a3, buildBlockContext as a4, buildBlockMap as a5, defineBlock as a6, fetchLayouts as a7, fetchPage as a8, fetchPageById as a9, fetchPageMeta as aa, fetchPages as ab, isProtocolCompatible as ac, normalizeSlug as ad, resolveApiUrl as ae, 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
|
@@ -12,17 +12,21 @@ function control(type) {
|
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
var fields = {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
text: control("text"),
|
|
16
|
+
textarea: control("textarea"),
|
|
17
17
|
richText: control("richText"),
|
|
18
|
-
|
|
18
|
+
number: control("number"),
|
|
19
19
|
date: control("date"),
|
|
20
|
+
datetime: control("datetime"),
|
|
21
|
+
boolean: control("boolean"),
|
|
22
|
+
color: control("color"),
|
|
20
23
|
media: control("media"),
|
|
21
24
|
link: control("link"),
|
|
25
|
+
url: control("url"),
|
|
26
|
+
email: control("email"),
|
|
22
27
|
select: control("select"),
|
|
23
28
|
multiselect: control("multiselect"),
|
|
24
|
-
|
|
25
|
-
color: control("color"),
|
|
29
|
+
radio: control("radio"),
|
|
26
30
|
repeater: control("repeater")
|
|
27
31
|
};
|
|
28
32
|
|
|
@@ -61,7 +65,8 @@ function blocksToMeta(blocks, defaults = {}) {
|
|
|
61
65
|
label: block.label ?? block.type,
|
|
62
66
|
...category ? { category } : {},
|
|
63
67
|
...block.icon ? { icon: block.icon } : {},
|
|
64
|
-
...block.layoutPositions ? { layoutPositions: block.layoutPositions } : {}
|
|
68
|
+
...block.layoutPositions ? { layoutPositions: block.layoutPositions } : {},
|
|
69
|
+
...block.description ? { description: block.description } : {}
|
|
65
70
|
};
|
|
66
71
|
}
|
|
67
72
|
return out;
|
|
@@ -212,7 +217,7 @@ function CmssyServerLayout({
|
|
|
212
217
|
}
|
|
213
218
|
|
|
214
219
|
// src/bridge/protocol.ts
|
|
215
|
-
var PROTOCOL_VERSION =
|
|
220
|
+
var PROTOCOL_VERSION = 2;
|
|
216
221
|
function isProtocolCompatible(version) {
|
|
217
222
|
return version === PROTOCOL_VERSION;
|
|
218
223
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
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-
|
|
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
|
|
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-Ch7QldF7.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 MODEL_DEFINITIONS_QUERY, U as MODEL_RECORDS_QUERY, V as PROTOCOL_VERSION, W as ParentReadyMessage, X as PatchMessage, Y as RawLayoutBlock, Z as ReadyMessage, _ as SITE_CONFIG_QUERY, $ as SUBMIT_FORM_MUTATION, a0 as SelectMessage, a1 as SubmitFormInput, a2 as blocksToMeta, a3 as blocksToSchemas, a4 as buildBlockContext, a5 as buildBlockMap, a6 as defineBlock, a7 as fetchLayouts, a8 as fetchPage, a9 as fetchPageById, aa as fetchPageMeta, ab as fetchPages, ac as isProtocolCompatible, ad as normalizeSlug, ae as resolveApiUrl } from './commerce-queries-Ch7QldF7.cjs';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
export { FieldType } from '@cmssy/types';
|
|
4
5
|
import 'react';
|
|
5
6
|
|
|
6
7
|
type FieldControl = Omit<FieldDefinition, "type" | "label"> & {
|
|
7
8
|
label?: string;
|
|
8
9
|
};
|
|
9
10
|
declare const fields: {
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
text: (opts?: FieldControl) => FieldDefinition;
|
|
12
|
+
textarea: (opts?: FieldControl) => FieldDefinition;
|
|
12
13
|
richText: (opts?: FieldControl) => FieldDefinition;
|
|
13
|
-
|
|
14
|
+
number: (opts?: FieldControl) => FieldDefinition;
|
|
14
15
|
date: (opts?: FieldControl) => FieldDefinition;
|
|
16
|
+
datetime: (opts?: FieldControl) => FieldDefinition;
|
|
17
|
+
boolean: (opts?: FieldControl) => FieldDefinition;
|
|
18
|
+
color: (opts?: FieldControl) => FieldDefinition;
|
|
15
19
|
media: (opts?: FieldControl) => FieldDefinition;
|
|
16
20
|
link: (opts?: FieldControl) => FieldDefinition;
|
|
21
|
+
url: (opts?: FieldControl) => FieldDefinition;
|
|
22
|
+
email: (opts?: FieldControl) => FieldDefinition;
|
|
17
23
|
select: (opts?: FieldControl) => FieldDefinition;
|
|
18
24
|
multiselect: (opts?: FieldControl) => FieldDefinition;
|
|
19
|
-
|
|
20
|
-
color: (opts?: FieldControl) => FieldDefinition;
|
|
25
|
+
radio: (opts?: FieldControl) => FieldDefinition;
|
|
21
26
|
repeater: (opts?: FieldControl) => FieldDefinition;
|
|
22
27
|
};
|
|
23
28
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
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-
|
|
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
|
|
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-Ch7QldF7.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 MODEL_DEFINITIONS_QUERY, U as MODEL_RECORDS_QUERY, V as PROTOCOL_VERSION, W as ParentReadyMessage, X as PatchMessage, Y as RawLayoutBlock, Z as ReadyMessage, _ as SITE_CONFIG_QUERY, $ as SUBMIT_FORM_MUTATION, a0 as SelectMessage, a1 as SubmitFormInput, a2 as blocksToMeta, a3 as blocksToSchemas, a4 as buildBlockContext, a5 as buildBlockMap, a6 as defineBlock, a7 as fetchLayouts, a8 as fetchPage, a9 as fetchPageById, aa as fetchPageMeta, ab as fetchPages, ac as isProtocolCompatible, ad as normalizeSlug, ae as resolveApiUrl } from './commerce-queries-Ch7QldF7.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
export { FieldType } from '@cmssy/types';
|
|
4
5
|
import 'react';
|
|
5
6
|
|
|
6
7
|
type FieldControl = Omit<FieldDefinition, "type" | "label"> & {
|
|
7
8
|
label?: string;
|
|
8
9
|
};
|
|
9
10
|
declare const fields: {
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
text: (opts?: FieldControl) => FieldDefinition;
|
|
12
|
+
textarea: (opts?: FieldControl) => FieldDefinition;
|
|
12
13
|
richText: (opts?: FieldControl) => FieldDefinition;
|
|
13
|
-
|
|
14
|
+
number: (opts?: FieldControl) => FieldDefinition;
|
|
14
15
|
date: (opts?: FieldControl) => FieldDefinition;
|
|
16
|
+
datetime: (opts?: FieldControl) => FieldDefinition;
|
|
17
|
+
boolean: (opts?: FieldControl) => FieldDefinition;
|
|
18
|
+
color: (opts?: FieldControl) => FieldDefinition;
|
|
15
19
|
media: (opts?: FieldControl) => FieldDefinition;
|
|
16
20
|
link: (opts?: FieldControl) => FieldDefinition;
|
|
21
|
+
url: (opts?: FieldControl) => FieldDefinition;
|
|
22
|
+
email: (opts?: FieldControl) => FieldDefinition;
|
|
17
23
|
select: (opts?: FieldControl) => FieldDefinition;
|
|
18
24
|
multiselect: (opts?: FieldControl) => FieldDefinition;
|
|
19
|
-
|
|
20
|
-
color: (opts?: FieldControl) => FieldDefinition;
|
|
25
|
+
radio: (opts?: FieldControl) => FieldDefinition;
|
|
21
26
|
repeater: (opts?: FieldControl) => FieldDefinition;
|
|
22
27
|
};
|
|
23
28
|
|
package/dist/index.js
CHANGED
|
@@ -10,17 +10,21 @@ function control(type) {
|
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
var fields = {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
text: control("text"),
|
|
14
|
+
textarea: control("textarea"),
|
|
15
15
|
richText: control("richText"),
|
|
16
|
-
|
|
16
|
+
number: control("number"),
|
|
17
17
|
date: control("date"),
|
|
18
|
+
datetime: control("datetime"),
|
|
19
|
+
boolean: control("boolean"),
|
|
20
|
+
color: control("color"),
|
|
18
21
|
media: control("media"),
|
|
19
22
|
link: control("link"),
|
|
23
|
+
url: control("url"),
|
|
24
|
+
email: control("email"),
|
|
20
25
|
select: control("select"),
|
|
21
26
|
multiselect: control("multiselect"),
|
|
22
|
-
|
|
23
|
-
color: control("color"),
|
|
27
|
+
radio: control("radio"),
|
|
24
28
|
repeater: control("repeater")
|
|
25
29
|
};
|
|
26
30
|
|
|
@@ -59,7 +63,8 @@ function blocksToMeta(blocks, defaults = {}) {
|
|
|
59
63
|
label: block.label ?? block.type,
|
|
60
64
|
...category ? { category } : {},
|
|
61
65
|
...block.icon ? { icon: block.icon } : {},
|
|
62
|
-
...block.layoutPositions ? { layoutPositions: block.layoutPositions } : {}
|
|
66
|
+
...block.layoutPositions ? { layoutPositions: block.layoutPositions } : {},
|
|
67
|
+
...block.description ? { description: block.description } : {}
|
|
63
68
|
};
|
|
64
69
|
}
|
|
65
70
|
return out;
|
|
@@ -210,7 +215,7 @@ function CmssyServerLayout({
|
|
|
210
215
|
}
|
|
211
216
|
|
|
212
217
|
// src/bridge/protocol.ts
|
|
213
|
-
var PROTOCOL_VERSION =
|
|
218
|
+
var PROTOCOL_VERSION = 2;
|
|
214
219
|
function isProtocolCompatible(version) {
|
|
215
220
|
return version === PROTOCOL_VERSION;
|
|
216
221
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmssy/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "React blocks, renderers, data client and editor bridge for cmssy headless sites",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cmssy",
|
|
@@ -54,6 +54,9 @@
|
|
|
54
54
|
"typescript": "^5.6.0",
|
|
55
55
|
"vitest": "^2.1.0"
|
|
56
56
|
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"@cmssy/types": "^0.17.0"
|
|
59
|
+
},
|
|
57
60
|
"scripts": {
|
|
58
61
|
"build": "tsup",
|
|
59
62
|
"test": "vitest run",
|