@cmssy/react 2.3.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.cts +3 -3
- package/dist/client.d.ts +3 -3
- package/dist/commerce-queries-CfjwkgfE.d.cts +223 -0
- package/dist/commerce-queries-CfjwkgfE.d.ts +223 -0
- package/dist/index.d.cts +140 -11
- package/dist/index.d.ts +140 -11
- package/package.json +2 -2
- package/dist/commerce-queries-CQgJBHMK.d.cts +0 -557
- package/dist/commerce-queries-CQgJBHMK.d.ts +0 -557
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,145 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
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, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockWorkspace, CmssyBranding, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLayoutSettings, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssySiteConfig, CmssySiteLocales, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldType, RawBlock, RawLayoutBlock, SubmitFormInput, evaluateFieldConditionGroup } from '@cmssy/types';
|
|
3
|
+
import { B as BlockDefinition, i as BlockMap } from './commerce-queries-CfjwkgfE.js';
|
|
4
|
+
export { C as CmssyAddress, a as CmssyCart, d as CmssyCartDiscount, e as CmssyCartItem, f as CmssyCartItemSnapshot, b as CmssyOrder, j as CmssyOrderDiscount, g as CmssyOrderItem, k as CmssyOrderTaxSummaryLine, l as CmssyPriceTier, c as CmssyProduct, h as CmssyProductVariant, m as CmssyShippingMethod, n as CmssyTaxSummaryLine, o as blocksToMeta, p as blocksToSchemas, q as buildBlockMap, r as defineBlock } from './commerce-queries-CfjwkgfE.js';
|
|
3
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
export { FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldType, evaluateFieldConditionGroup } from '@cmssy/types';
|
|
5
6
|
import 'react';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The cmssy cloud GraphQL delivery endpoint. It is the same for every workspace,
|
|
10
|
+
* so consumers never need to set it - `apiUrl` defaults to this. Self-hosted /
|
|
11
|
+
* staging deployments override it via config.
|
|
12
|
+
*/
|
|
13
|
+
declare const DEFAULT_CMSSY_API_URL = "https://api.cmssy.io/graphql";
|
|
14
|
+
declare function resolveApiUrl(apiUrl: string | undefined): string;
|
|
15
|
+
/**
|
|
16
|
+
* Public delivery endpoint for a workspace: the org-scoped path
|
|
17
|
+
* `{base}/public/{orgSlug}/{workspaceSlug}/graphql`. `apiUrl` is the GraphQL
|
|
18
|
+
* base (its trailing `/graphql` is stripped); the org path is what tells the
|
|
19
|
+
* backend which workspace to serve, so slugs only need to be unique per org.
|
|
20
|
+
*/
|
|
21
|
+
declare function resolvePublicUrl(config: CmssyClientConfig): string;
|
|
22
|
+
interface FetchLikeResponse {
|
|
23
|
+
ok: boolean;
|
|
24
|
+
status: number;
|
|
25
|
+
json: () => Promise<unknown>;
|
|
26
|
+
}
|
|
27
|
+
type FetchLike = (url: string, init: {
|
|
28
|
+
method: string;
|
|
29
|
+
headers: Record<string, string>;
|
|
30
|
+
body: string;
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
}) => Promise<FetchLikeResponse>;
|
|
33
|
+
interface FetchPageOptions {
|
|
34
|
+
previewSecret?: string;
|
|
35
|
+
devPreview?: boolean;
|
|
36
|
+
devToken?: string;
|
|
37
|
+
workspaceId?: string;
|
|
38
|
+
fetch?: FetchLike;
|
|
39
|
+
signal?: AbortSignal;
|
|
40
|
+
}
|
|
41
|
+
declare function normalizeSlug(path: string | string[] | undefined): string;
|
|
42
|
+
declare function fetchPage(config: CmssyClientConfig, path: string | string[] | undefined, options?: FetchPageOptions): Promise<CmssyPageData | null>;
|
|
43
|
+
declare function fetchPageById(config: CmssyClientConfig, pageId: string, options?: Pick<FetchPageOptions, "fetch" | "signal">): Promise<CmssyPageData | null>;
|
|
44
|
+
declare function fetchPages(config: CmssyClientConfig, options?: Pick<FetchPageOptions, "fetch" | "signal">): Promise<CmssyPageSummary[]>;
|
|
45
|
+
declare function fetchPageMeta(config: CmssyClientConfig, path: string | string[] | undefined, options?: Pick<FetchPageOptions, "fetch" | "signal">): Promise<CmssyPageMeta | null>;
|
|
46
|
+
declare function fetchLayouts(config: CmssyClientConfig, path: string | string[] | undefined, options?: FetchPageOptions): Promise<CmssyLayoutGroup[]>;
|
|
47
|
+
|
|
48
|
+
declare const 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
|
+
|
|
56
|
+
declare const PROTOCOL_VERSION = 2;
|
|
57
|
+
|
|
58
|
+
interface ReadyMessage {
|
|
59
|
+
type: "cmssy:ready";
|
|
60
|
+
protocolVersion: number;
|
|
61
|
+
blocks: Array<{
|
|
62
|
+
id: string;
|
|
63
|
+
type: string;
|
|
64
|
+
bounds: BlockRect;
|
|
65
|
+
layoutPosition?: string;
|
|
66
|
+
}>;
|
|
67
|
+
schemas: Record<string, BlockSchema>;
|
|
68
|
+
blockMeta?: Record<string, BlockMeta>;
|
|
69
|
+
}
|
|
70
|
+
interface BoundsMessage {
|
|
71
|
+
type: "cmssy:bounds";
|
|
72
|
+
blockId: string;
|
|
73
|
+
rect: BlockRect;
|
|
74
|
+
}
|
|
75
|
+
interface ClickMessage {
|
|
76
|
+
type: "cmssy:click";
|
|
77
|
+
blockId: string;
|
|
78
|
+
rect: BlockRect;
|
|
79
|
+
layoutPosition?: string;
|
|
80
|
+
}
|
|
81
|
+
interface MoveMessage {
|
|
82
|
+
type: "cmssy:move";
|
|
83
|
+
protocolVersion: number;
|
|
84
|
+
blockId: string;
|
|
85
|
+
index: number;
|
|
86
|
+
}
|
|
87
|
+
interface DragIndexMessage {
|
|
88
|
+
type: "cmssy:drag-index";
|
|
89
|
+
protocolVersion: number;
|
|
90
|
+
index: number;
|
|
91
|
+
}
|
|
92
|
+
type AppToEditorMessage = ReadyMessage | BoundsMessage | ClickMessage | MoveMessage | DragIndexMessage;
|
|
93
|
+
interface SelectMessage {
|
|
94
|
+
type: "cmssy:select";
|
|
95
|
+
protocolVersion: number;
|
|
96
|
+
blockId: string;
|
|
97
|
+
}
|
|
98
|
+
interface PatchMessage {
|
|
99
|
+
type: "cmssy:patch";
|
|
100
|
+
protocolVersion: number;
|
|
101
|
+
blockId: string;
|
|
102
|
+
content: Record<string, unknown>;
|
|
103
|
+
style?: Record<string, unknown>;
|
|
104
|
+
advanced?: Record<string, unknown>;
|
|
105
|
+
layoutPosition?: string;
|
|
106
|
+
}
|
|
107
|
+
interface ParentReadyMessage {
|
|
108
|
+
type: "cmssy:parent-ready";
|
|
109
|
+
protocolVersion: number;
|
|
110
|
+
}
|
|
111
|
+
interface InsertMessage {
|
|
112
|
+
type: "cmssy:insert";
|
|
113
|
+
protocolVersion: number;
|
|
114
|
+
blockId: string;
|
|
115
|
+
blockType: string;
|
|
116
|
+
content: Record<string, unknown>;
|
|
117
|
+
style?: Record<string, unknown>;
|
|
118
|
+
advanced?: Record<string, unknown>;
|
|
119
|
+
index: number;
|
|
120
|
+
}
|
|
121
|
+
interface ReorderMessage {
|
|
122
|
+
type: "cmssy:reorder";
|
|
123
|
+
protocolVersion: number;
|
|
124
|
+
blockIds: string[];
|
|
125
|
+
}
|
|
126
|
+
interface RemoveMessage {
|
|
127
|
+
type: "cmssy:remove";
|
|
128
|
+
protocolVersion: number;
|
|
129
|
+
blockId: string;
|
|
130
|
+
}
|
|
131
|
+
interface DragOverMessage {
|
|
132
|
+
type: "cmssy:drag-over";
|
|
133
|
+
protocolVersion: number;
|
|
134
|
+
y: number;
|
|
135
|
+
}
|
|
136
|
+
interface DragEndMessage {
|
|
137
|
+
type: "cmssy:drag-end";
|
|
138
|
+
protocolVersion: number;
|
|
139
|
+
}
|
|
140
|
+
type EditorToAppMessage = SelectMessage | PatchMessage | ParentReadyMessage | InsertMessage | ReorderMessage | RemoveMessage | DragOverMessage | DragEndMessage;
|
|
141
|
+
declare function isProtocolCompatible(version: number): boolean;
|
|
142
|
+
|
|
10
143
|
declare const fields: {
|
|
11
144
|
text: (opts?: FieldControl) => FieldDefinition;
|
|
12
145
|
textarea: (opts?: FieldControl) => FieldDefinition;
|
|
@@ -107,10 +240,6 @@ declare function createCmssyClient(input: CmssyClientConfig): CmssyClient;
|
|
|
107
240
|
declare function collectFormIds(blocks: RawBlock[], locale: string, defaultLocale: string): string[];
|
|
108
241
|
declare function resolveForms(config: CmssyClientConfig, blocks: RawBlock[], locale: string, defaultLocale: string, options?: QueryScopedOptions): Promise<Record<string, CmssyFormDefinition>>;
|
|
109
242
|
|
|
110
|
-
interface CmssySiteLocales {
|
|
111
|
-
defaultLocale: string;
|
|
112
|
-
locales: string[];
|
|
113
|
-
}
|
|
114
243
|
declare function resolveSiteLocales(config: CmssyClientConfig, options?: GraphqlRequestOptions): Promise<CmssySiteLocales>;
|
|
115
244
|
declare function splitLocaleFromPath(path: string[] | undefined, siteLocales: CmssySiteLocales): {
|
|
116
245
|
locale: string;
|
|
@@ -153,4 +282,4 @@ interface UnknownBlockProps {
|
|
|
153
282
|
}
|
|
154
283
|
declare function UnknownBlock({ type }: UnknownBlockProps): react_jsx_runtime.JSX.Element;
|
|
155
284
|
|
|
156
|
-
export { AppToEditorMessage, BlockDefinition, BlockMap,
|
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmssy/react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "React blocks, renderers, data client and editor bridge for cmssy headless sites",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cmssy",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"vitest": "^2.1.0"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@cmssy/types": "0.
|
|
59
|
+
"@cmssy/types": "0.25.0"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "tsup",
|