@cmssy/react 0.7.7 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.cjs +17 -13
- package/dist/client.d.cts +3 -2
- package/dist/client.d.ts +3 -2
- package/dist/client.js +17 -13
- package/dist/{commerce-queries-BSTuurfl.d.cts → commerce-queries-Da7vBV3S.d.cts} +7 -5
- package/dist/{commerce-queries-BSTuurfl.d.ts → commerce-queries-Da7vBV3S.d.ts} +7 -5
- package/dist/index.cjs +11 -7
- package/dist/index.d.cts +12 -7
- package/dist/index.d.ts +12 -7
- package/dist/index.js +11 -7
- package/package.json +4 -1
package/dist/client.cjs
CHANGED
|
@@ -40,7 +40,7 @@ function blocksToMeta(blocks, defaults = {}) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
// src/bridge/protocol.ts
|
|
43
|
-
var PROTOCOL_VERSION =
|
|
43
|
+
var PROTOCOL_VERSION = 2;
|
|
44
44
|
|
|
45
45
|
// src/bridge/messages.ts
|
|
46
46
|
function normalizeOrigin(origin) {
|
|
@@ -1020,17 +1020,21 @@ function control(type) {
|
|
|
1020
1020
|
});
|
|
1021
1021
|
}
|
|
1022
1022
|
var fields = {
|
|
1023
|
-
|
|
1024
|
-
|
|
1023
|
+
text: control("text"),
|
|
1024
|
+
textarea: control("textarea"),
|
|
1025
1025
|
richText: control("richText"),
|
|
1026
|
-
|
|
1026
|
+
number: control("number"),
|
|
1027
1027
|
date: control("date"),
|
|
1028
|
+
datetime: control("datetime"),
|
|
1029
|
+
boolean: control("boolean"),
|
|
1030
|
+
color: control("color"),
|
|
1028
1031
|
media: control("media"),
|
|
1029
1032
|
link: control("link"),
|
|
1033
|
+
url: control("url"),
|
|
1034
|
+
email: control("email"),
|
|
1030
1035
|
select: control("select"),
|
|
1031
1036
|
multiselect: control("multiselect"),
|
|
1032
|
-
|
|
1033
|
-
color: control("color"),
|
|
1037
|
+
radio: control("radio"),
|
|
1034
1038
|
repeater: control("repeater")
|
|
1035
1039
|
};
|
|
1036
1040
|
|
|
@@ -1217,12 +1221,12 @@ var productBlock = defineBlock({
|
|
|
1217
1221
|
label: "Product",
|
|
1218
1222
|
category: "Commerce",
|
|
1219
1223
|
props: {
|
|
1220
|
-
modelSlug: fields.
|
|
1221
|
-
slugField: fields.
|
|
1222
|
-
slug: fields.
|
|
1223
|
-
nameField: fields.
|
|
1224
|
-
priceField: fields.
|
|
1225
|
-
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" })
|
|
1226
1230
|
},
|
|
1227
1231
|
component: ProductComponent
|
|
1228
1232
|
});
|
|
@@ -1416,7 +1420,7 @@ var checkoutBlock = defineBlock({
|
|
|
1416
1420
|
label: "Checkout",
|
|
1417
1421
|
category: "Commerce",
|
|
1418
1422
|
props: {
|
|
1419
|
-
successMessage: fields.
|
|
1423
|
+
successMessage: fields.text({ label: "Success message" })
|
|
1420
1424
|
},
|
|
1421
1425
|
component: CheckoutComponent
|
|
1422
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-Da7vBV3S.cjs';
|
|
3
|
+
export { i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, l as CmssyOrderItem, m as CmssyProductVariant } from './commerce-queries-Da7vBV3S.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-Da7vBV3S.js';
|
|
3
|
+
export { i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, l as CmssyOrderItem, m as CmssyProductVariant } from './commerce-queries-Da7vBV3S.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
|
@@ -38,7 +38,7 @@ function blocksToMeta(blocks, defaults = {}) {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
// src/bridge/protocol.ts
|
|
41
|
-
var PROTOCOL_VERSION =
|
|
41
|
+
var PROTOCOL_VERSION = 2;
|
|
42
42
|
|
|
43
43
|
// src/bridge/messages.ts
|
|
44
44
|
function normalizeOrigin(origin) {
|
|
@@ -1018,17 +1018,21 @@ function control(type) {
|
|
|
1018
1018
|
});
|
|
1019
1019
|
}
|
|
1020
1020
|
var fields = {
|
|
1021
|
-
|
|
1022
|
-
|
|
1021
|
+
text: control("text"),
|
|
1022
|
+
textarea: control("textarea"),
|
|
1023
1023
|
richText: control("richText"),
|
|
1024
|
-
|
|
1024
|
+
number: control("number"),
|
|
1025
1025
|
date: control("date"),
|
|
1026
|
+
datetime: control("datetime"),
|
|
1027
|
+
boolean: control("boolean"),
|
|
1028
|
+
color: control("color"),
|
|
1026
1029
|
media: control("media"),
|
|
1027
1030
|
link: control("link"),
|
|
1031
|
+
url: control("url"),
|
|
1032
|
+
email: control("email"),
|
|
1028
1033
|
select: control("select"),
|
|
1029
1034
|
multiselect: control("multiselect"),
|
|
1030
|
-
|
|
1031
|
-
color: control("color"),
|
|
1035
|
+
radio: control("radio"),
|
|
1032
1036
|
repeater: control("repeater")
|
|
1033
1037
|
};
|
|
1034
1038
|
|
|
@@ -1215,12 +1219,12 @@ var productBlock = defineBlock({
|
|
|
1215
1219
|
label: "Product",
|
|
1216
1220
|
category: "Commerce",
|
|
1217
1221
|
props: {
|
|
1218
|
-
modelSlug: fields.
|
|
1219
|
-
slugField: fields.
|
|
1220
|
-
slug: fields.
|
|
1221
|
-
nameField: fields.
|
|
1222
|
-
priceField: fields.
|
|
1223
|
-
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" })
|
|
1224
1228
|
},
|
|
1225
1229
|
component: ProductComponent
|
|
1226
1230
|
});
|
|
@@ -1414,7 +1418,7 @@ var checkoutBlock = defineBlock({
|
|
|
1414
1418
|
label: "Checkout",
|
|
1415
1419
|
category: "Commerce",
|
|
1416
1420
|
props: {
|
|
1417
|
-
successMessage: fields.
|
|
1421
|
+
successMessage: fields.text({ label: "Success message" })
|
|
1418
1422
|
},
|
|
1419
1423
|
component: CheckoutComponent
|
|
1420
1424
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
|
+
import { ShowWhenCondition, FieldType } from '@cmssy/types';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* The cmssy cloud GraphQL delivery endpoint. It is the same for every workspace,
|
|
@@ -127,7 +128,7 @@ interface CmssyFormField {
|
|
|
127
128
|
validation: unknown;
|
|
128
129
|
width: string | null;
|
|
129
130
|
order: number | null;
|
|
130
|
-
|
|
131
|
+
showWhen: ShowWhenCondition | null;
|
|
131
132
|
}
|
|
132
133
|
interface CmssyFormSettings {
|
|
133
134
|
actionType: string | null;
|
|
@@ -158,7 +159,7 @@ interface SubmitFormInput {
|
|
|
158
159
|
data: Record<string, unknown>;
|
|
159
160
|
website?: string;
|
|
160
161
|
}
|
|
161
|
-
declare const FORM_QUERY = "query PublicForm($formId: ID!) {\n publicForm(formId: $formId) {\n id\n name\n slug\n description\n fields {\n id name fieldType label placeholder helpText\n defaultValue width order
|
|
162
|
+
declare const FORM_QUERY = "query PublicForm($formId: ID!) {\n publicForm(formId: $formId) {\n id\n name\n slug\n description\n fields {\n id name fieldType label placeholder helpText\n defaultValue width order showWhen\n options { value label disabled }\n validation { required minLength maxLength minValue maxValue pattern customMessage }\n }\n settings {\n actionType submitButtonLabel successMessage errorMessage\n redirectUrl requireLogin enableCaptcha\n }\n }\n}";
|
|
162
163
|
declare const SUBMIT_FORM_MUTATION = "mutation SubmitForm($formId: ID!, $input: SubmitFormInput!) {\n submitForm(formId: $formId, input: $input) {\n success message submissionId redirectUrl accessToken customer\n }\n}";
|
|
163
164
|
|
|
164
165
|
interface CmssyLocaleContext {
|
|
@@ -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;
|
|
@@ -462,4 +464,4 @@ interface CmssyOrder {
|
|
|
462
464
|
createdAt?: string;
|
|
463
465
|
}
|
|
464
466
|
|
|
465
|
-
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 { ShowWhenCondition, FieldType } from '@cmssy/types';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* The cmssy cloud GraphQL delivery endpoint. It is the same for every workspace,
|
|
@@ -127,7 +128,7 @@ interface CmssyFormField {
|
|
|
127
128
|
validation: unknown;
|
|
128
129
|
width: string | null;
|
|
129
130
|
order: number | null;
|
|
130
|
-
|
|
131
|
+
showWhen: ShowWhenCondition | null;
|
|
131
132
|
}
|
|
132
133
|
interface CmssyFormSettings {
|
|
133
134
|
actionType: string | null;
|
|
@@ -158,7 +159,7 @@ interface SubmitFormInput {
|
|
|
158
159
|
data: Record<string, unknown>;
|
|
159
160
|
website?: string;
|
|
160
161
|
}
|
|
161
|
-
declare const FORM_QUERY = "query PublicForm($formId: ID!) {\n publicForm(formId: $formId) {\n id\n name\n slug\n description\n fields {\n id name fieldType label placeholder helpText\n defaultValue width order
|
|
162
|
+
declare const FORM_QUERY = "query PublicForm($formId: ID!) {\n publicForm(formId: $formId) {\n id\n name\n slug\n description\n fields {\n id name fieldType label placeholder helpText\n defaultValue width order showWhen\n options { value label disabled }\n validation { required minLength maxLength minValue maxValue pattern customMessage }\n }\n settings {\n actionType submitButtonLabel successMessage errorMessage\n redirectUrl requireLogin enableCaptcha\n }\n }\n}";
|
|
162
163
|
declare const SUBMIT_FORM_MUTATION = "mutation SubmitForm($formId: ID!, $input: SubmitFormInput!) {\n submitForm(formId: $formId, input: $input) {\n success message submissionId redirectUrl accessToken customer\n }\n}";
|
|
163
164
|
|
|
164
165
|
interface CmssyLocaleContext {
|
|
@@ -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;
|
|
@@ -462,4 +464,4 @@ interface CmssyOrder {
|
|
|
462
464
|
createdAt?: string;
|
|
463
465
|
}
|
|
464
466
|
|
|
465
|
-
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
|
|
|
@@ -213,7 +217,7 @@ function CmssyServerLayout({
|
|
|
213
217
|
}
|
|
214
218
|
|
|
215
219
|
// src/bridge/protocol.ts
|
|
216
|
-
var PROTOCOL_VERSION =
|
|
220
|
+
var PROTOCOL_VERSION = 2;
|
|
217
221
|
function isProtocolCompatible(version) {
|
|
218
222
|
return version === PROTOCOL_VERSION;
|
|
219
223
|
}
|
|
@@ -635,7 +639,7 @@ var FORM_QUERY = `query PublicForm($formId: ID!) {
|
|
|
635
639
|
description
|
|
636
640
|
fields {
|
|
637
641
|
id name fieldType label placeholder helpText
|
|
638
|
-
defaultValue width order
|
|
642
|
+
defaultValue width order showWhen
|
|
639
643
|
options { value label disabled }
|
|
640
644
|
validation { required minLength maxLength minValue maxValue pattern customMessage }
|
|
641
645
|
}
|
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-Da7vBV3S.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-Da7vBV3S.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-Da7vBV3S.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-Da7vBV3S.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
|
|
|
@@ -211,7 +215,7 @@ function CmssyServerLayout({
|
|
|
211
215
|
}
|
|
212
216
|
|
|
213
217
|
// src/bridge/protocol.ts
|
|
214
|
-
var PROTOCOL_VERSION =
|
|
218
|
+
var PROTOCOL_VERSION = 2;
|
|
215
219
|
function isProtocolCompatible(version) {
|
|
216
220
|
return version === PROTOCOL_VERSION;
|
|
217
221
|
}
|
|
@@ -633,7 +637,7 @@ var FORM_QUERY = `query PublicForm($formId: ID!) {
|
|
|
633
637
|
description
|
|
634
638
|
fields {
|
|
635
639
|
id name fieldType label placeholder helpText
|
|
636
|
-
defaultValue width order
|
|
640
|
+
defaultValue width order showWhen
|
|
637
641
|
options { value label disabled }
|
|
638
642
|
validation { required minLength maxLength minValue maxValue pattern customMessage }
|
|
639
643
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmssy/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
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",
|