@cmssy/react 2.4.0 → 2.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
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';
2
+ import { BlockSchema, BlockMeta, CmssyPageData, CmssyFormDefinition, CmssyLayoutGroup, CmssyLocaleContext, CmssyAuthUser, CmssyAuthActionResult, CmssyCart, CmssyAddToCartOptions, CmssyCheckoutInput, CmssyOrder, CmssyProduct, UseCmssyOrderOptions, UseCmssyOrdersOptions } from '@cmssy/types';
3
+ export { CmssyAddToCartOptions, CmssyAuthActionResult, CmssyAuthUser, CmssyCart, CmssyCartDiscount, CmssyCartItem, CmssyCartItemSnapshot, CmssyCheckoutInput, CmssyOrder, CmssyOrderItem, CmssyProduct, CmssyProductVariant, UseCmssyOrderOptions, UseCmssyOrdersOptions } from '@cmssy/types';
4
+ import { B as BlockDefinition } from './registry-DBPEDxug.cjs';
5
5
  import { ReactNode } from 'react';
6
6
 
7
7
  interface EditBridgeConfig {
@@ -99,14 +99,6 @@ declare function CmssyLocaleProvider({ value, children, }: CmssyLocaleProviderPr
99
99
  /** Reads the active locale; returns null when no provider is mounted. */
100
100
  declare function useCmssyLocale(): CmssyLocaleContext | null;
101
101
 
102
- interface CmssyAuthUser {
103
- recordId: string;
104
- email: string;
105
- }
106
- interface CmssyAuthActionResult {
107
- ok: boolean;
108
- message?: string;
109
- }
110
102
  interface CmssyAuthState {
111
103
  user: CmssyAuthUser | null;
112
104
  loading: boolean;
@@ -123,16 +115,6 @@ interface CmssyAuthProviderProps {
123
115
  declare function CmssyAuthProvider({ children, basePath, initialUser, }: CmssyAuthProviderProps): react_jsx_runtime.JSX.Element;
124
116
  declare function useCmssyUser(): CmssyAuthState;
125
117
 
126
- interface CmssyAddToCartOptions {
127
- variantSelections?: Record<string, string>;
128
- notes?: string;
129
- }
130
- interface CmssyCheckoutInput {
131
- customerEmail: string;
132
- poNumber?: string | null;
133
- customerNote?: string | null;
134
- shippingAddress?: CmssyAddress | null;
135
- }
136
118
  interface CmssyCommerceState {
137
119
  cart: CmssyCart | null;
138
120
  loading: boolean;
@@ -170,11 +152,6 @@ interface CmssyOrdersState {
170
152
  error: string | null;
171
153
  refresh(): Promise<void>;
172
154
  }
173
- interface UseCmssyOrdersOptions {
174
- basePath?: string;
175
- skip?: number;
176
- limit?: number;
177
- }
178
155
  declare function useCmssyOrders(options?: UseCmssyOrdersOptions): CmssyOrdersState;
179
156
  interface CmssyOrderState {
180
157
  order: CmssyOrder | null;
@@ -182,9 +159,6 @@ interface CmssyOrderState {
182
159
  error: string | null;
183
160
  refresh(): Promise<void>;
184
161
  }
185
- interface UseCmssyOrderOptions {
186
- basePath?: string;
187
- }
188
162
  declare function useCmssyOrder(id: string | null | undefined, options?: UseCmssyOrderOptions): CmssyOrderState;
189
163
 
190
164
  declare function fractionDigits(currency: string): number;
@@ -192,4 +166,4 @@ declare function fromMinorUnits(minor: number, currency: string): number;
192
166
  declare function toMinorUnits(amount: number, currency: string): number;
193
167
  declare function formatPrice(minor: number, currency: string | null | undefined): string;
194
168
 
195
- export { type CmssyAddToCartOptions, type CmssyAuthActionResult, CmssyAuthProvider, type CmssyAuthProviderProps, type CmssyAuthState, type CmssyAuthUser, CmssyCart, type CmssyCheckoutInput, CmssyCommerceProvider, type CmssyCommerceProviderProps, type CmssyCommerceState, CmssyEditableLayout, type CmssyEditableLayoutProps, CmssyEditablePage, type CmssyEditablePageProps, CmssyLazyEditor, type CmssyLazyEditorProps, CmssyLazyLayout, type CmssyLazyLayoutProps, CmssyLocaleProvider, type CmssyLocaleProviderProps, CmssyOrder, type CmssyOrderState, type CmssyOrdersState, CmssyProduct, type EditBridgeConfig, type EditBridgeState, type PatchMap, type UseCmssyOrderOptions, type UseCmssyOrdersOptions, cartBlock, checkoutBlock, formatPrice, fractionDigits, fromMinorUnits, productBlock, toMinorUnits, useCart, useCmssyLocale, useCmssyOrder, useCmssyOrders, useCmssyUser, useEditBridge };
169
+ export { CmssyAuthProvider, type CmssyAuthProviderProps, type CmssyAuthState, CmssyCommerceProvider, type CmssyCommerceProviderProps, type CmssyCommerceState, CmssyEditableLayout, type CmssyEditableLayoutProps, CmssyEditablePage, type CmssyEditablePageProps, CmssyLazyEditor, type CmssyLazyEditorProps, CmssyLazyLayout, type CmssyLazyLayoutProps, CmssyLocaleProvider, type CmssyLocaleProviderProps, type CmssyOrderState, type CmssyOrdersState, type EditBridgeConfig, type EditBridgeState, type PatchMap, cartBlock, checkoutBlock, formatPrice, fractionDigits, fromMinorUnits, productBlock, toMinorUnits, useCart, useCmssyLocale, useCmssyOrder, useCmssyOrders, useCmssyUser, useEditBridge };
package/dist/client.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
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';
2
+ import { BlockSchema, BlockMeta, CmssyPageData, CmssyFormDefinition, CmssyLayoutGroup, CmssyLocaleContext, CmssyAuthUser, CmssyAuthActionResult, CmssyCart, CmssyAddToCartOptions, CmssyCheckoutInput, CmssyOrder, CmssyProduct, UseCmssyOrderOptions, UseCmssyOrdersOptions } from '@cmssy/types';
3
+ export { CmssyAddToCartOptions, CmssyAuthActionResult, CmssyAuthUser, CmssyCart, CmssyCartDiscount, CmssyCartItem, CmssyCartItemSnapshot, CmssyCheckoutInput, CmssyOrder, CmssyOrderItem, CmssyProduct, CmssyProductVariant, UseCmssyOrderOptions, UseCmssyOrdersOptions } from '@cmssy/types';
4
+ import { B as BlockDefinition } from './registry-DBPEDxug.js';
5
5
  import { ReactNode } from 'react';
6
6
 
7
7
  interface EditBridgeConfig {
@@ -99,14 +99,6 @@ declare function CmssyLocaleProvider({ value, children, }: CmssyLocaleProviderPr
99
99
  /** Reads the active locale; returns null when no provider is mounted. */
100
100
  declare function useCmssyLocale(): CmssyLocaleContext | null;
101
101
 
102
- interface CmssyAuthUser {
103
- recordId: string;
104
- email: string;
105
- }
106
- interface CmssyAuthActionResult {
107
- ok: boolean;
108
- message?: string;
109
- }
110
102
  interface CmssyAuthState {
111
103
  user: CmssyAuthUser | null;
112
104
  loading: boolean;
@@ -123,16 +115,6 @@ interface CmssyAuthProviderProps {
123
115
  declare function CmssyAuthProvider({ children, basePath, initialUser, }: CmssyAuthProviderProps): react_jsx_runtime.JSX.Element;
124
116
  declare function useCmssyUser(): CmssyAuthState;
125
117
 
126
- interface CmssyAddToCartOptions {
127
- variantSelections?: Record<string, string>;
128
- notes?: string;
129
- }
130
- interface CmssyCheckoutInput {
131
- customerEmail: string;
132
- poNumber?: string | null;
133
- customerNote?: string | null;
134
- shippingAddress?: CmssyAddress | null;
135
- }
136
118
  interface CmssyCommerceState {
137
119
  cart: CmssyCart | null;
138
120
  loading: boolean;
@@ -170,11 +152,6 @@ interface CmssyOrdersState {
170
152
  error: string | null;
171
153
  refresh(): Promise<void>;
172
154
  }
173
- interface UseCmssyOrdersOptions {
174
- basePath?: string;
175
- skip?: number;
176
- limit?: number;
177
- }
178
155
  declare function useCmssyOrders(options?: UseCmssyOrdersOptions): CmssyOrdersState;
179
156
  interface CmssyOrderState {
180
157
  order: CmssyOrder | null;
@@ -182,9 +159,6 @@ interface CmssyOrderState {
182
159
  error: string | null;
183
160
  refresh(): Promise<void>;
184
161
  }
185
- interface UseCmssyOrderOptions {
186
- basePath?: string;
187
- }
188
162
  declare function useCmssyOrder(id: string | null | undefined, options?: UseCmssyOrderOptions): CmssyOrderState;
189
163
 
190
164
  declare function fractionDigits(currency: string): number;
@@ -192,4 +166,4 @@ declare function fromMinorUnits(minor: number, currency: string): number;
192
166
  declare function toMinorUnits(amount: number, currency: string): number;
193
167
  declare function formatPrice(minor: number, currency: string | null | undefined): string;
194
168
 
195
- export { type CmssyAddToCartOptions, type CmssyAuthActionResult, CmssyAuthProvider, type CmssyAuthProviderProps, type CmssyAuthState, type CmssyAuthUser, CmssyCart, type CmssyCheckoutInput, CmssyCommerceProvider, type CmssyCommerceProviderProps, type CmssyCommerceState, CmssyEditableLayout, type CmssyEditableLayoutProps, CmssyEditablePage, type CmssyEditablePageProps, CmssyLazyEditor, type CmssyLazyEditorProps, CmssyLazyLayout, type CmssyLazyLayoutProps, CmssyLocaleProvider, type CmssyLocaleProviderProps, CmssyOrder, type CmssyOrderState, type CmssyOrdersState, CmssyProduct, type EditBridgeConfig, type EditBridgeState, type PatchMap, type UseCmssyOrderOptions, type UseCmssyOrdersOptions, cartBlock, checkoutBlock, formatPrice, fractionDigits, fromMinorUnits, productBlock, toMinorUnits, useCart, useCmssyLocale, useCmssyOrder, useCmssyOrders, useCmssyUser, useEditBridge };
169
+ export { CmssyAuthProvider, type CmssyAuthProviderProps, type CmssyAuthState, CmssyCommerceProvider, type CmssyCommerceProviderProps, type CmssyCommerceState, CmssyEditableLayout, type CmssyEditableLayoutProps, CmssyEditablePage, type CmssyEditablePageProps, CmssyLazyEditor, type CmssyLazyEditorProps, CmssyLazyLayout, type CmssyLazyLayoutProps, CmssyLocaleProvider, type CmssyLocaleProviderProps, type CmssyOrderState, type CmssyOrdersState, type EditBridgeConfig, type EditBridgeState, type PatchMap, cartBlock, checkoutBlock, formatPrice, fractionDigits, fromMinorUnits, productBlock, toMinorUnits, useCart, useCmssyLocale, useCmssyOrder, useCmssyOrders, useCmssyUser, useEditBridge };
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
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';
1
+ import { CmssyClientConfig, CmssyLayoutGroup, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyFormDefinition, BuildBlockContextExtra, CmssyBlockContext, BlockRect, BlockSchema, BlockMeta, FieldControl, FieldDefinition, CmssyBlockAuthContext, CmssyBlockWorkspace, CmssySiteConfig, RawBlock, CmssySiteLocales, CmssyLocaleContext } from '@cmssy/types';
2
+ export { BlockMeta, BlockRect, BlockSchema, BuildBlockContextExtra, CmssyAddress, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockWorkspace, CmssyBranding, CmssyCart, CmssyCartDiscount, CmssyCartItem, CmssyCartItemSnapshot, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLayoutSettings, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyOrder, CmssyOrderDiscount, CmssyOrderItem, CmssyOrderTaxSummaryLine, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyPriceTier, CmssyProduct, CmssyProductVariant, CmssyRecordList, CmssyShippingMethod, CmssySiteConfig, CmssySiteLocales, CmssyTaxSummaryLine, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldType, RawBlock, RawLayoutBlock, SubmitFormInput, evaluateFieldConditionGroup } from '@cmssy/types';
3
+ import { B as BlockDefinition, a as BlockMap } from './registry-DBPEDxug.cjs';
4
+ export { b as blocksToMeta, c as blocksToSchemas, d as buildBlockMap, e as defineBlock } from './registry-DBPEDxug.cjs';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import 'react';
7
7
 
@@ -45,6 +45,14 @@ declare function fetchPages(config: CmssyClientConfig, options?: Pick<FetchPageO
45
45
  declare function fetchPageMeta(config: CmssyClientConfig, path: string | string[] | undefined, options?: Pick<FetchPageOptions, "fetch" | "signal">): Promise<CmssyPageMeta | null>;
46
46
  declare function fetchLayouts(config: CmssyClientConfig, path: string | string[] | undefined, options?: FetchPageOptions): Promise<CmssyLayoutGroup[]>;
47
47
 
48
+ 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}";
49
+ declare const MODEL_DEFINITIONS_QUERY = "query PublicModelDefinitions($workspaceId: String!) {\n public {\n model {\n definitions(workspaceId: $workspaceId) {\n id name slug description icon color displayField recordCount\n }\n }\n }\n}";
50
+ declare const MODEL_RECORDS_QUERY = "query PublicModelRecords($workspaceId: String!, $modelSlug: String!, $filter: JSON, $sort: String, $limit: Int, $offset: Int, $populate: [String!]) {\n public {\n model {\n records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, sort: $sort, limit: $limit, offset: $offset, populate: $populate) {\n items { id modelId data status createdAt updatedAt }\n total\n hasMore\n }\n }\n }\n}";
51
+ declare const FORM_QUERY = "query PublicForm($formId: ID!) {\n public {\n form {\n get(formId: $formId) {\n id\n name\n slug\n description\n fields {\n id name fieldType label placeholder helpText\n defaultValue width order showWhen requiredWhen\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 }\n }\n}";
52
+ declare const SUBMIT_FORM_MUTATION = "mutation SubmitForm($formId: ID!, $input: SubmitFormInput!) {\n public {\n form {\n submit(formId: $formId, input: $input) {\n success message submissionId redirectUrl accessToken customer\n }\n }\n }\n}";
53
+
54
+ declare function buildBlockContext(locale: string, defaultLocale: string, enabledLocales?: string[], isPreview?: boolean, forms?: Record<string, CmssyFormDefinition>, extra?: BuildBlockContextExtra): CmssyBlockContext;
55
+
48
56
  declare const PROTOCOL_VERSION = 2;
49
57
 
50
58
  interface ReadyMessage {
@@ -274,4 +282,4 @@ interface UnknownBlockProps {
274
282
  }
275
283
  declare function UnknownBlock({ type }: UnknownBlockProps): react_jsx_runtime.JSX.Element;
276
284
 
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 };
285
+ export { type AppToEditorMessage, BlockDefinition, BlockMap, type BoundsMessage, type ClickMessage, CmssyBlock, type CmssyBlockProps, type CmssyClient, CmssyServerLayout, type CmssyServerLayoutProps, CmssyServerPage, type CmssyServerPageProps, DEFAULT_CMSSY_API_URL, type EditorToAppMessage, FORM_QUERY, type FetchLike, type FetchLikeResponse, type FetchPageOptions, type GraphqlRequestOptions, MODEL_DEFINITIONS_QUERY, MODEL_RECORDS_QUERY, PROTOCOL_VERSION, type ParentReadyMessage, type PatchMessage, type PostTarget, type QueryScopedOptions, type ReadyMessage, SITE_CONFIG_QUERY, SUBMIT_FORM_MUTATION, type SelectMessage, UnknownBlock, type UnknownBlockProps, buildBlockContext, 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,7 +1,7 @@
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';
1
+ import { CmssyClientConfig, CmssyLayoutGroup, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyFormDefinition, BuildBlockContextExtra, CmssyBlockContext, BlockRect, BlockSchema, BlockMeta, FieldControl, FieldDefinition, CmssyBlockAuthContext, CmssyBlockWorkspace, CmssySiteConfig, RawBlock, CmssySiteLocales, CmssyLocaleContext } from '@cmssy/types';
2
+ export { BlockMeta, BlockRect, BlockSchema, BuildBlockContextExtra, CmssyAddress, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockWorkspace, CmssyBranding, CmssyCart, CmssyCartDiscount, CmssyCartItem, CmssyCartItemSnapshot, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLayoutSettings, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyOrder, CmssyOrderDiscount, CmssyOrderItem, CmssyOrderTaxSummaryLine, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyPriceTier, CmssyProduct, CmssyProductVariant, CmssyRecordList, CmssyShippingMethod, CmssySiteConfig, CmssySiteLocales, CmssyTaxSummaryLine, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldType, RawBlock, RawLayoutBlock, SubmitFormInput, evaluateFieldConditionGroup } from '@cmssy/types';
3
+ import { B as BlockDefinition, a as BlockMap } from './registry-DBPEDxug.js';
4
+ export { b as blocksToMeta, c as blocksToSchemas, d as buildBlockMap, e as defineBlock } from './registry-DBPEDxug.js';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import 'react';
7
7
 
@@ -45,6 +45,14 @@ declare function fetchPages(config: CmssyClientConfig, options?: Pick<FetchPageO
45
45
  declare function fetchPageMeta(config: CmssyClientConfig, path: string | string[] | undefined, options?: Pick<FetchPageOptions, "fetch" | "signal">): Promise<CmssyPageMeta | null>;
46
46
  declare function fetchLayouts(config: CmssyClientConfig, path: string | string[] | undefined, options?: FetchPageOptions): Promise<CmssyLayoutGroup[]>;
47
47
 
48
+ 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}";
49
+ declare const MODEL_DEFINITIONS_QUERY = "query PublicModelDefinitions($workspaceId: String!) {\n public {\n model {\n definitions(workspaceId: $workspaceId) {\n id name slug description icon color displayField recordCount\n }\n }\n }\n}";
50
+ declare const MODEL_RECORDS_QUERY = "query PublicModelRecords($workspaceId: String!, $modelSlug: String!, $filter: JSON, $sort: String, $limit: Int, $offset: Int, $populate: [String!]) {\n public {\n model {\n records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, sort: $sort, limit: $limit, offset: $offset, populate: $populate) {\n items { id modelId data status createdAt updatedAt }\n total\n hasMore\n }\n }\n }\n}";
51
+ declare const FORM_QUERY = "query PublicForm($formId: ID!) {\n public {\n form {\n get(formId: $formId) {\n id\n name\n slug\n description\n fields {\n id name fieldType label placeholder helpText\n defaultValue width order showWhen requiredWhen\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 }\n }\n}";
52
+ declare const SUBMIT_FORM_MUTATION = "mutation SubmitForm($formId: ID!, $input: SubmitFormInput!) {\n public {\n form {\n submit(formId: $formId, input: $input) {\n success message submissionId redirectUrl accessToken customer\n }\n }\n }\n}";
53
+
54
+ declare function buildBlockContext(locale: string, defaultLocale: string, enabledLocales?: string[], isPreview?: boolean, forms?: Record<string, CmssyFormDefinition>, extra?: BuildBlockContextExtra): CmssyBlockContext;
55
+
48
56
  declare const PROTOCOL_VERSION = 2;
49
57
 
50
58
  interface ReadyMessage {
@@ -274,4 +282,4 @@ interface UnknownBlockProps {
274
282
  }
275
283
  declare function UnknownBlock({ type }: UnknownBlockProps): react_jsx_runtime.JSX.Element;
276
284
 
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 };
285
+ export { type AppToEditorMessage, BlockDefinition, BlockMap, type BoundsMessage, type ClickMessage, CmssyBlock, type CmssyBlockProps, type CmssyClient, CmssyServerLayout, type CmssyServerLayoutProps, CmssyServerPage, type CmssyServerPageProps, DEFAULT_CMSSY_API_URL, type EditorToAppMessage, FORM_QUERY, type FetchLike, type FetchLikeResponse, type FetchPageOptions, type GraphqlRequestOptions, MODEL_DEFINITIONS_QUERY, MODEL_RECORDS_QUERY, PROTOCOL_VERSION, type ParentReadyMessage, type PatchMessage, type PostTarget, type QueryScopedOptions, type ReadyMessage, SITE_CONFIG_QUERY, SUBMIT_FORM_MUTATION, type SelectMessage, UnknownBlock, type UnknownBlockProps, buildBlockContext, 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 };
@@ -0,0 +1,72 @@
1
+ import { ComponentType } from 'react';
2
+ import { FieldDefinition, CmssyBlockContext, BlockMeta, BlockSchema } from '@cmssy/types';
3
+
4
+ interface BlockLoaderArgs {
5
+ content: Record<string, unknown>;
6
+ context?: CmssyBlockContext;
7
+ }
8
+ type BlockLoader = (args: BlockLoaderArgs) => Promise<unknown> | unknown;
9
+ interface BlockDefinition {
10
+ type: string;
11
+ label?: string;
12
+ category?: string;
13
+ icon?: string;
14
+ layoutPositions?: string[];
15
+ /**
16
+ * One-line semantic description of what the block is and when it belongs on a
17
+ * page. Surfaced to the AI page composer to guide block selection and order.
18
+ */
19
+ description?: string;
20
+ props: Record<string, FieldDefinition>;
21
+ /**
22
+ * Optional server-side data loader. Run by CmssyServerPage during SSR; its
23
+ * result is passed to the component as the `data` prop. Not run in the
24
+ * editor (the component receives `data: undefined` there).
25
+ *
26
+ * The result crosses the server→client boundary when the block component is a
27
+ * Client Component, so it must be RSC-serializable (plain objects, arrays and
28
+ * primitives - no functions, class instances, etc.).
29
+ */
30
+ loader?: BlockLoader;
31
+ component: ComponentType<{
32
+ content: Record<string, unknown>;
33
+ style?: Record<string, unknown>;
34
+ advanced?: Record<string, unknown>;
35
+ context?: CmssyBlockContext;
36
+ data?: unknown;
37
+ }>;
38
+ }
39
+ declare function defineBlock<C extends Record<string, unknown>, D = unknown, S extends Record<string, unknown> = Record<string, unknown>, A extends Record<string, unknown> = Record<string, unknown>>(def: {
40
+ type: string;
41
+ label?: string;
42
+ category?: string;
43
+ icon?: string;
44
+ layoutPositions?: string[];
45
+ description?: string;
46
+ props: Record<string, FieldDefinition>;
47
+ loader?: (args: {
48
+ content: C;
49
+ context?: CmssyBlockContext;
50
+ }) => Promise<D> | D;
51
+ component: ComponentType<{
52
+ content: C;
53
+ style?: S;
54
+ advanced?: A;
55
+ context?: CmssyBlockContext;
56
+ data?: D;
57
+ }>;
58
+ }): BlockDefinition;
59
+ type BlockMap = Record<string, ComponentType<{
60
+ content: Record<string, unknown>;
61
+ style?: Record<string, unknown>;
62
+ advanced?: Record<string, unknown>;
63
+ context?: CmssyBlockContext;
64
+ data?: unknown;
65
+ }>>;
66
+ declare function buildBlockMap(blocks: BlockDefinition[]): BlockMap;
67
+ declare function blocksToSchemas(blocks: BlockDefinition[]): Record<string, BlockSchema>;
68
+ declare function blocksToMeta(blocks: BlockDefinition[], defaults?: {
69
+ category?: string;
70
+ }): Record<string, BlockMeta>;
71
+
72
+ export { type BlockDefinition as B, type BlockMap as a, blocksToMeta as b, blocksToSchemas as c, buildBlockMap as d, defineBlock as e };
@@ -0,0 +1,72 @@
1
+ import { ComponentType } from 'react';
2
+ import { FieldDefinition, CmssyBlockContext, BlockMeta, BlockSchema } from '@cmssy/types';
3
+
4
+ interface BlockLoaderArgs {
5
+ content: Record<string, unknown>;
6
+ context?: CmssyBlockContext;
7
+ }
8
+ type BlockLoader = (args: BlockLoaderArgs) => Promise<unknown> | unknown;
9
+ interface BlockDefinition {
10
+ type: string;
11
+ label?: string;
12
+ category?: string;
13
+ icon?: string;
14
+ layoutPositions?: string[];
15
+ /**
16
+ * One-line semantic description of what the block is and when it belongs on a
17
+ * page. Surfaced to the AI page composer to guide block selection and order.
18
+ */
19
+ description?: string;
20
+ props: Record<string, FieldDefinition>;
21
+ /**
22
+ * Optional server-side data loader. Run by CmssyServerPage during SSR; its
23
+ * result is passed to the component as the `data` prop. Not run in the
24
+ * editor (the component receives `data: undefined` there).
25
+ *
26
+ * The result crosses the server→client boundary when the block component is a
27
+ * Client Component, so it must be RSC-serializable (plain objects, arrays and
28
+ * primitives - no functions, class instances, etc.).
29
+ */
30
+ loader?: BlockLoader;
31
+ component: ComponentType<{
32
+ content: Record<string, unknown>;
33
+ style?: Record<string, unknown>;
34
+ advanced?: Record<string, unknown>;
35
+ context?: CmssyBlockContext;
36
+ data?: unknown;
37
+ }>;
38
+ }
39
+ declare function defineBlock<C extends Record<string, unknown>, D = unknown, S extends Record<string, unknown> = Record<string, unknown>, A extends Record<string, unknown> = Record<string, unknown>>(def: {
40
+ type: string;
41
+ label?: string;
42
+ category?: string;
43
+ icon?: string;
44
+ layoutPositions?: string[];
45
+ description?: string;
46
+ props: Record<string, FieldDefinition>;
47
+ loader?: (args: {
48
+ content: C;
49
+ context?: CmssyBlockContext;
50
+ }) => Promise<D> | D;
51
+ component: ComponentType<{
52
+ content: C;
53
+ style?: S;
54
+ advanced?: A;
55
+ context?: CmssyBlockContext;
56
+ data?: D;
57
+ }>;
58
+ }): BlockDefinition;
59
+ type BlockMap = Record<string, ComponentType<{
60
+ content: Record<string, unknown>;
61
+ style?: Record<string, unknown>;
62
+ advanced?: Record<string, unknown>;
63
+ context?: CmssyBlockContext;
64
+ data?: unknown;
65
+ }>>;
66
+ declare function buildBlockMap(blocks: BlockDefinition[]): BlockMap;
67
+ declare function blocksToSchemas(blocks: BlockDefinition[]): Record<string, BlockSchema>;
68
+ declare function blocksToMeta(blocks: BlockDefinition[], defaults?: {
69
+ category?: string;
70
+ }): Record<string, BlockMeta>;
71
+
72
+ export { type BlockDefinition as B, type BlockMap as a, blocksToMeta as b, blocksToSchemas as c, buildBlockMap as d, defineBlock as e };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/react",
3
- "version": "2.4.0",
3
+ "version": "2.6.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.24.0"
59
+ "@cmssy/types": "0.26.0"
60
60
  },
61
61
  "scripts": {
62
62
  "build": "tsup",
@@ -1,326 +0,0 @@
1
- import { ComponentType } from 'react';
2
- import { FieldConditionGroup, FieldDefinition, BlockMeta, BlockSchema } from '@cmssy/types';
3
-
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}";
5
- interface CmssyModelDefinition {
6
- id: string;
7
- name: string;
8
- slug: string;
9
- description: string | null;
10
- icon: string | null;
11
- color: string | null;
12
- displayField: string | null;
13
- recordCount: number | null;
14
- }
15
- interface CmssyModelRecord {
16
- id: string;
17
- modelId: string;
18
- data: Record<string, unknown>;
19
- status: string | null;
20
- createdAt: string | null;
21
- updatedAt: string | null;
22
- }
23
- interface CmssyRecordList {
24
- items: CmssyModelRecord[];
25
- total: number;
26
- hasMore: boolean;
27
- }
28
- declare const MODEL_DEFINITIONS_QUERY = "query PublicModelDefinitions($workspaceId: String!) {\n public {\n model {\n definitions(workspaceId: $workspaceId) {\n id name slug description icon color displayField recordCount\n }\n }\n }\n}";
29
- declare const MODEL_RECORDS_QUERY = "query PublicModelRecords($workspaceId: String!, $modelSlug: String!, $filter: JSON, $sort: String, $limit: Int, $offset: Int, $populate: [String!]) {\n public {\n model {\n records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, sort: $sort, limit: $limit, offset: $offset, populate: $populate) {\n items { id modelId data status createdAt updatedAt }\n total\n hasMore\n }\n }\n }\n}";
30
- interface CmssyFormField {
31
- id: string;
32
- name: string;
33
- fieldType: string;
34
- label: string | null;
35
- placeholder: string | null;
36
- helpText: string | null;
37
- defaultValue: unknown;
38
- options: unknown;
39
- validation: unknown;
40
- width: string | null;
41
- order: number | null;
42
- showWhen: FieldConditionGroup | null;
43
- requiredWhen: FieldConditionGroup | null;
44
- }
45
- interface CmssyFormSettings {
46
- actionType: string | null;
47
- submitButtonLabel: unknown;
48
- successMessage: unknown;
49
- errorMessage: unknown;
50
- redirectUrl: string | null;
51
- requireLogin: boolean | null;
52
- enableCaptcha: boolean | null;
53
- }
54
- interface CmssyFormDefinition {
55
- id: string;
56
- name: string;
57
- slug: string | null;
58
- description: string | null;
59
- fields: CmssyFormField[];
60
- settings: CmssyFormSettings | null;
61
- }
62
- interface CmssyFormSubmitResponse {
63
- success: boolean;
64
- message: string | null;
65
- submissionId: string | null;
66
- redirectUrl: string | null;
67
- accessToken: string | null;
68
- customer: unknown;
69
- }
70
- interface SubmitFormInput {
71
- data: Record<string, unknown>;
72
- website?: string;
73
- }
74
- declare const FORM_QUERY = "query PublicForm($formId: ID!) {\n public {\n form {\n get(formId: $formId) {\n id\n name\n slug\n description\n fields {\n id name fieldType label placeholder helpText\n defaultValue width order showWhen requiredWhen\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 }\n }\n}";
75
- declare const SUBMIT_FORM_MUTATION = "mutation SubmitForm($formId: ID!, $input: SubmitFormInput!) {\n public {\n form {\n submit(formId: $formId, input: $input) {\n success message submissionId redirectUrl accessToken customer\n }\n }\n }\n}";
76
-
77
- interface CmssyLocaleContext {
78
- current: string;
79
- default: string;
80
- enabled: string[];
81
- }
82
- interface CmssyBlockMember {
83
- recordId: string;
84
- email: string;
85
- }
86
- interface CmssyBlockAuthContext {
87
- isAuthenticated: boolean;
88
- member: CmssyBlockMember | null;
89
- }
90
- interface CmssyBlockWorkspace {
91
- id: string;
92
- slug: string;
93
- }
94
- interface CmssyBlockContext {
95
- locale: CmssyLocaleContext;
96
- isPreview: boolean;
97
- forms?: Record<string, CmssyFormDefinition>;
98
- auth?: CmssyBlockAuthContext;
99
- workspace?: CmssyBlockWorkspace;
100
- }
101
- interface BuildBlockContextExtra {
102
- auth?: CmssyBlockAuthContext;
103
- workspace?: CmssyBlockWorkspace;
104
- }
105
- declare function buildBlockContext(locale: string, defaultLocale: string, enabledLocales?: string[], isPreview?: boolean, forms?: Record<string, CmssyFormDefinition>, extra?: BuildBlockContextExtra): CmssyBlockContext;
106
-
107
- interface BlockLoaderArgs {
108
- content: Record<string, unknown>;
109
- context?: CmssyBlockContext;
110
- }
111
- type BlockLoader = (args: BlockLoaderArgs) => Promise<unknown> | unknown;
112
- interface BlockDefinition {
113
- type: string;
114
- label?: string;
115
- category?: string;
116
- icon?: string;
117
- layoutPositions?: string[];
118
- /**
119
- * One-line semantic description of what the block is and when it belongs on a
120
- * page. Surfaced to the AI page composer to guide block selection and order.
121
- */
122
- description?: string;
123
- props: Record<string, FieldDefinition>;
124
- /**
125
- * Optional server-side data loader. Run by CmssyServerPage during SSR; its
126
- * result is passed to the component as the `data` prop. Not run in the
127
- * editor (the component receives `data: undefined` there).
128
- *
129
- * The result crosses the server→client boundary when the block component is a
130
- * Client Component, so it must be RSC-serializable (plain objects, arrays and
131
- * primitives - no functions, class instances, etc.).
132
- */
133
- loader?: BlockLoader;
134
- component: ComponentType<{
135
- content: Record<string, unknown>;
136
- style?: Record<string, unknown>;
137
- advanced?: Record<string, unknown>;
138
- context?: CmssyBlockContext;
139
- data?: unknown;
140
- }>;
141
- }
142
- declare function defineBlock<C extends Record<string, unknown>, D = unknown, S extends Record<string, unknown> = Record<string, unknown>, A extends Record<string, unknown> = Record<string, unknown>>(def: {
143
- type: string;
144
- label?: string;
145
- category?: string;
146
- icon?: string;
147
- layoutPositions?: string[];
148
- description?: string;
149
- props: Record<string, FieldDefinition>;
150
- loader?: (args: {
151
- content: C;
152
- context?: CmssyBlockContext;
153
- }) => Promise<D> | D;
154
- component: ComponentType<{
155
- content: C;
156
- style?: S;
157
- advanced?: A;
158
- context?: CmssyBlockContext;
159
- data?: D;
160
- }>;
161
- }): BlockDefinition;
162
- type BlockMap = Record<string, ComponentType<{
163
- content: Record<string, unknown>;
164
- style?: Record<string, unknown>;
165
- advanced?: Record<string, unknown>;
166
- context?: CmssyBlockContext;
167
- data?: unknown;
168
- }>>;
169
- declare function buildBlockMap(blocks: BlockDefinition[]): BlockMap;
170
- declare function blocksToSchemas(blocks: BlockDefinition[]): Record<string, BlockSchema>;
171
- declare function blocksToMeta(blocks: BlockDefinition[], defaults?: {
172
- category?: string;
173
- }): Record<string, BlockMeta>;
174
-
175
- interface CmssyPriceTier {
176
- minQty: number;
177
- price: number;
178
- }
179
- interface CmssyCartItemSnapshot {
180
- name: string;
181
- price: number;
182
- currency: string;
183
- imageUrl: string | null;
184
- sku: string | null;
185
- tiers: CmssyPriceTier[];
186
- }
187
- interface CmssyCartItem {
188
- id: string;
189
- recordId: string;
190
- quantity: number;
191
- variantSelections: Record<string, string> | null;
192
- snapshot: CmssyCartItemSnapshot;
193
- unitPrice: number;
194
- currentPrice: number | null;
195
- priceMismatch: boolean;
196
- }
197
- interface CmssyShippingMethod {
198
- id: string;
199
- label: string;
200
- price: number;
201
- etaLabel: string | null;
202
- }
203
- interface CmssyTaxSummaryLine {
204
- rateId: string | null;
205
- name: string | null;
206
- rate: number;
207
- base: number;
208
- amount: number;
209
- }
210
- interface CmssyAddress {
211
- name: string;
212
- company?: string | null;
213
- line1: string;
214
- line2?: string | null;
215
- postalCode: string;
216
- city: string;
217
- region?: string | null;
218
- country: string;
219
- phone?: string | null;
220
- vatId?: string | null;
221
- }
222
- interface CmssyCartDiscount {
223
- code: string;
224
- type: string;
225
- value: number;
226
- computedAmount: number;
227
- }
228
- interface CmssyCart {
229
- id: string;
230
- status: string;
231
- items: CmssyCartItem[];
232
- itemCount: number;
233
- subtotal: number;
234
- currency: string | null;
235
- appliedDiscount: CmssyCartDiscount | null;
236
- discountedTotal: number;
237
- tax: number;
238
- taxSummary: CmssyTaxSummaryLine[];
239
- totalGross: number;
240
- pricesIncludeTax: boolean;
241
- shippingMethod: CmssyShippingMethod | null;
242
- shippingTotal: number;
243
- availableShippingMethods: CmssyShippingMethod[];
244
- }
245
- interface CmssyProductVariant {
246
- id: string;
247
- sku: string | null;
248
- price: number;
249
- inventory: number | null;
250
- selectedOptions: Array<{
251
- name: string;
252
- value: string;
253
- }>;
254
- tiers: CmssyPriceTier[];
255
- }
256
- interface CmssyProduct {
257
- id: string;
258
- data: Record<string, unknown>;
259
- variants: CmssyProductVariant[];
260
- priceTiers: CmssyPriceTier[];
261
- }
262
- interface CmssyOrderItem {
263
- name: string;
264
- price: number;
265
- listPrice?: number | null;
266
- tierMinQty?: number | null;
267
- currency: string;
268
- quantity: number;
269
- sku: string | null;
270
- }
271
- interface CmssyOrderPayment {
272
- amount: number;
273
- reference: string;
274
- provider: string | null;
275
- at: string;
276
- }
277
- type CmssyOrderTaxSummaryLine = CmssyTaxSummaryLine;
278
- interface CmssyOrderDiscount {
279
- code: string;
280
- type: string;
281
- value: number;
282
- amount: number;
283
- }
284
- interface CmssyOrder {
285
- id: string;
286
- status: string;
287
- subtotal: number;
288
- discount?: number;
289
- appliedDiscount?: CmssyOrderDiscount | null;
290
- total: number;
291
- currency: string;
292
- customerEmail: string;
293
- tax?: number;
294
- pricesIncludeTax?: boolean;
295
- taxSummary?: CmssyOrderTaxSummaryLine[];
296
- refundedAmount?: number;
297
- items?: CmssyOrderItem[];
298
- paymentProvider?: string | null;
299
- paymentStatus?: string;
300
- fulfillmentStatus?: string;
301
- amountPaid?: number;
302
- balanceDue?: number;
303
- paymentReference?: string | null;
304
- trackingNumber?: string | null;
305
- trackingCarrier?: string | null;
306
- invoiceNumber?: string | null;
307
- invoiceUrl?: string | null;
308
- invoiceProvider?: string | null;
309
- payments?: CmssyOrderPayment[];
310
- paidAt?: string | null;
311
- fulfilledAt?: string | null;
312
- createdAt?: string;
313
- orderNumber?: number | null;
314
- poNumber?: string | null;
315
- customerNote?: string | null;
316
- shippingAddress?: CmssyAddress | null;
317
- shippingMethod?: {
318
- id: string;
319
- label: string;
320
- price: number;
321
- } | null;
322
- shippingTotal?: number;
323
- accessToken?: string | null;
324
- }
325
-
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,326 +0,0 @@
1
- import { ComponentType } from 'react';
2
- import { FieldConditionGroup, FieldDefinition, BlockMeta, BlockSchema } from '@cmssy/types';
3
-
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}";
5
- interface CmssyModelDefinition {
6
- id: string;
7
- name: string;
8
- slug: string;
9
- description: string | null;
10
- icon: string | null;
11
- color: string | null;
12
- displayField: string | null;
13
- recordCount: number | null;
14
- }
15
- interface CmssyModelRecord {
16
- id: string;
17
- modelId: string;
18
- data: Record<string, unknown>;
19
- status: string | null;
20
- createdAt: string | null;
21
- updatedAt: string | null;
22
- }
23
- interface CmssyRecordList {
24
- items: CmssyModelRecord[];
25
- total: number;
26
- hasMore: boolean;
27
- }
28
- declare const MODEL_DEFINITIONS_QUERY = "query PublicModelDefinitions($workspaceId: String!) {\n public {\n model {\n definitions(workspaceId: $workspaceId) {\n id name slug description icon color displayField recordCount\n }\n }\n }\n}";
29
- declare const MODEL_RECORDS_QUERY = "query PublicModelRecords($workspaceId: String!, $modelSlug: String!, $filter: JSON, $sort: String, $limit: Int, $offset: Int, $populate: [String!]) {\n public {\n model {\n records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, sort: $sort, limit: $limit, offset: $offset, populate: $populate) {\n items { id modelId data status createdAt updatedAt }\n total\n hasMore\n }\n }\n }\n}";
30
- interface CmssyFormField {
31
- id: string;
32
- name: string;
33
- fieldType: string;
34
- label: string | null;
35
- placeholder: string | null;
36
- helpText: string | null;
37
- defaultValue: unknown;
38
- options: unknown;
39
- validation: unknown;
40
- width: string | null;
41
- order: number | null;
42
- showWhen: FieldConditionGroup | null;
43
- requiredWhen: FieldConditionGroup | null;
44
- }
45
- interface CmssyFormSettings {
46
- actionType: string | null;
47
- submitButtonLabel: unknown;
48
- successMessage: unknown;
49
- errorMessage: unknown;
50
- redirectUrl: string | null;
51
- requireLogin: boolean | null;
52
- enableCaptcha: boolean | null;
53
- }
54
- interface CmssyFormDefinition {
55
- id: string;
56
- name: string;
57
- slug: string | null;
58
- description: string | null;
59
- fields: CmssyFormField[];
60
- settings: CmssyFormSettings | null;
61
- }
62
- interface CmssyFormSubmitResponse {
63
- success: boolean;
64
- message: string | null;
65
- submissionId: string | null;
66
- redirectUrl: string | null;
67
- accessToken: string | null;
68
- customer: unknown;
69
- }
70
- interface SubmitFormInput {
71
- data: Record<string, unknown>;
72
- website?: string;
73
- }
74
- declare const FORM_QUERY = "query PublicForm($formId: ID!) {\n public {\n form {\n get(formId: $formId) {\n id\n name\n slug\n description\n fields {\n id name fieldType label placeholder helpText\n defaultValue width order showWhen requiredWhen\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 }\n }\n}";
75
- declare const SUBMIT_FORM_MUTATION = "mutation SubmitForm($formId: ID!, $input: SubmitFormInput!) {\n public {\n form {\n submit(formId: $formId, input: $input) {\n success message submissionId redirectUrl accessToken customer\n }\n }\n }\n}";
76
-
77
- interface CmssyLocaleContext {
78
- current: string;
79
- default: string;
80
- enabled: string[];
81
- }
82
- interface CmssyBlockMember {
83
- recordId: string;
84
- email: string;
85
- }
86
- interface CmssyBlockAuthContext {
87
- isAuthenticated: boolean;
88
- member: CmssyBlockMember | null;
89
- }
90
- interface CmssyBlockWorkspace {
91
- id: string;
92
- slug: string;
93
- }
94
- interface CmssyBlockContext {
95
- locale: CmssyLocaleContext;
96
- isPreview: boolean;
97
- forms?: Record<string, CmssyFormDefinition>;
98
- auth?: CmssyBlockAuthContext;
99
- workspace?: CmssyBlockWorkspace;
100
- }
101
- interface BuildBlockContextExtra {
102
- auth?: CmssyBlockAuthContext;
103
- workspace?: CmssyBlockWorkspace;
104
- }
105
- declare function buildBlockContext(locale: string, defaultLocale: string, enabledLocales?: string[], isPreview?: boolean, forms?: Record<string, CmssyFormDefinition>, extra?: BuildBlockContextExtra): CmssyBlockContext;
106
-
107
- interface BlockLoaderArgs {
108
- content: Record<string, unknown>;
109
- context?: CmssyBlockContext;
110
- }
111
- type BlockLoader = (args: BlockLoaderArgs) => Promise<unknown> | unknown;
112
- interface BlockDefinition {
113
- type: string;
114
- label?: string;
115
- category?: string;
116
- icon?: string;
117
- layoutPositions?: string[];
118
- /**
119
- * One-line semantic description of what the block is and when it belongs on a
120
- * page. Surfaced to the AI page composer to guide block selection and order.
121
- */
122
- description?: string;
123
- props: Record<string, FieldDefinition>;
124
- /**
125
- * Optional server-side data loader. Run by CmssyServerPage during SSR; its
126
- * result is passed to the component as the `data` prop. Not run in the
127
- * editor (the component receives `data: undefined` there).
128
- *
129
- * The result crosses the server→client boundary when the block component is a
130
- * Client Component, so it must be RSC-serializable (plain objects, arrays and
131
- * primitives - no functions, class instances, etc.).
132
- */
133
- loader?: BlockLoader;
134
- component: ComponentType<{
135
- content: Record<string, unknown>;
136
- style?: Record<string, unknown>;
137
- advanced?: Record<string, unknown>;
138
- context?: CmssyBlockContext;
139
- data?: unknown;
140
- }>;
141
- }
142
- declare function defineBlock<C extends Record<string, unknown>, D = unknown, S extends Record<string, unknown> = Record<string, unknown>, A extends Record<string, unknown> = Record<string, unknown>>(def: {
143
- type: string;
144
- label?: string;
145
- category?: string;
146
- icon?: string;
147
- layoutPositions?: string[];
148
- description?: string;
149
- props: Record<string, FieldDefinition>;
150
- loader?: (args: {
151
- content: C;
152
- context?: CmssyBlockContext;
153
- }) => Promise<D> | D;
154
- component: ComponentType<{
155
- content: C;
156
- style?: S;
157
- advanced?: A;
158
- context?: CmssyBlockContext;
159
- data?: D;
160
- }>;
161
- }): BlockDefinition;
162
- type BlockMap = Record<string, ComponentType<{
163
- content: Record<string, unknown>;
164
- style?: Record<string, unknown>;
165
- advanced?: Record<string, unknown>;
166
- context?: CmssyBlockContext;
167
- data?: unknown;
168
- }>>;
169
- declare function buildBlockMap(blocks: BlockDefinition[]): BlockMap;
170
- declare function blocksToSchemas(blocks: BlockDefinition[]): Record<string, BlockSchema>;
171
- declare function blocksToMeta(blocks: BlockDefinition[], defaults?: {
172
- category?: string;
173
- }): Record<string, BlockMeta>;
174
-
175
- interface CmssyPriceTier {
176
- minQty: number;
177
- price: number;
178
- }
179
- interface CmssyCartItemSnapshot {
180
- name: string;
181
- price: number;
182
- currency: string;
183
- imageUrl: string | null;
184
- sku: string | null;
185
- tiers: CmssyPriceTier[];
186
- }
187
- interface CmssyCartItem {
188
- id: string;
189
- recordId: string;
190
- quantity: number;
191
- variantSelections: Record<string, string> | null;
192
- snapshot: CmssyCartItemSnapshot;
193
- unitPrice: number;
194
- currentPrice: number | null;
195
- priceMismatch: boolean;
196
- }
197
- interface CmssyShippingMethod {
198
- id: string;
199
- label: string;
200
- price: number;
201
- etaLabel: string | null;
202
- }
203
- interface CmssyTaxSummaryLine {
204
- rateId: string | null;
205
- name: string | null;
206
- rate: number;
207
- base: number;
208
- amount: number;
209
- }
210
- interface CmssyAddress {
211
- name: string;
212
- company?: string | null;
213
- line1: string;
214
- line2?: string | null;
215
- postalCode: string;
216
- city: string;
217
- region?: string | null;
218
- country: string;
219
- phone?: string | null;
220
- vatId?: string | null;
221
- }
222
- interface CmssyCartDiscount {
223
- code: string;
224
- type: string;
225
- value: number;
226
- computedAmount: number;
227
- }
228
- interface CmssyCart {
229
- id: string;
230
- status: string;
231
- items: CmssyCartItem[];
232
- itemCount: number;
233
- subtotal: number;
234
- currency: string | null;
235
- appliedDiscount: CmssyCartDiscount | null;
236
- discountedTotal: number;
237
- tax: number;
238
- taxSummary: CmssyTaxSummaryLine[];
239
- totalGross: number;
240
- pricesIncludeTax: boolean;
241
- shippingMethod: CmssyShippingMethod | null;
242
- shippingTotal: number;
243
- availableShippingMethods: CmssyShippingMethod[];
244
- }
245
- interface CmssyProductVariant {
246
- id: string;
247
- sku: string | null;
248
- price: number;
249
- inventory: number | null;
250
- selectedOptions: Array<{
251
- name: string;
252
- value: string;
253
- }>;
254
- tiers: CmssyPriceTier[];
255
- }
256
- interface CmssyProduct {
257
- id: string;
258
- data: Record<string, unknown>;
259
- variants: CmssyProductVariant[];
260
- priceTiers: CmssyPriceTier[];
261
- }
262
- interface CmssyOrderItem {
263
- name: string;
264
- price: number;
265
- listPrice?: number | null;
266
- tierMinQty?: number | null;
267
- currency: string;
268
- quantity: number;
269
- sku: string | null;
270
- }
271
- interface CmssyOrderPayment {
272
- amount: number;
273
- reference: string;
274
- provider: string | null;
275
- at: string;
276
- }
277
- type CmssyOrderTaxSummaryLine = CmssyTaxSummaryLine;
278
- interface CmssyOrderDiscount {
279
- code: string;
280
- type: string;
281
- value: number;
282
- amount: number;
283
- }
284
- interface CmssyOrder {
285
- id: string;
286
- status: string;
287
- subtotal: number;
288
- discount?: number;
289
- appliedDiscount?: CmssyOrderDiscount | null;
290
- total: number;
291
- currency: string;
292
- customerEmail: string;
293
- tax?: number;
294
- pricesIncludeTax?: boolean;
295
- taxSummary?: CmssyOrderTaxSummaryLine[];
296
- refundedAmount?: number;
297
- items?: CmssyOrderItem[];
298
- paymentProvider?: string | null;
299
- paymentStatus?: string;
300
- fulfillmentStatus?: string;
301
- amountPaid?: number;
302
- balanceDue?: number;
303
- paymentReference?: string | null;
304
- trackingNumber?: string | null;
305
- trackingCarrier?: string | null;
306
- invoiceNumber?: string | null;
307
- invoiceUrl?: string | null;
308
- invoiceProvider?: string | null;
309
- payments?: CmssyOrderPayment[];
310
- paidAt?: string | null;
311
- fulfilledAt?: string | null;
312
- createdAt?: string;
313
- orderNumber?: number | null;
314
- poNumber?: string | null;
315
- customerNote?: string | null;
316
- shippingAddress?: CmssyAddress | null;
317
- shippingMethod?: {
318
- id: string;
319
- label: string;
320
- price: number;
321
- } | null;
322
- shippingTotal?: number;
323
- accessToken?: string | null;
324
- }
325
-
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 };