@cmssy/react 0.1.8 → 0.2.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.
@@ -312,4 +312,60 @@ declare function blocksToMeta(blocks: BlockDefinition[], defaults?: {
312
312
  category?: string;
313
313
  }): Record<string, BlockMeta>;
314
314
 
315
- export { type AppToEditorMessage as A, type BlockSchema as B, type CmssyPageData as C, type PatchMessage as D, type EditorToAppMessage as E, type FieldDefinition as F, type RawLayoutBlock as G, type ReadyMessage as H, SUBMIT_FORM_MUTATION as I, type SelectMessage as J, type SubmitFormInput as K, blocksToMeta as L, MODEL_DEFINITIONS_QUERY as M, blocksToSchemas as N, buildBlockContext as O, PROTOCOL_VERSION as P, buildBlockMap as Q, type RawBlock as R, SITE_CONFIG_QUERY as S, defineBlock as T, fetchLayouts as U, fetchPage as V, isProtocolCompatible as W, normalizeSlug as X, type BlockMeta as a, type BlockDefinition as b, type CmssyFormDefinition as c, type CmssyLayoutGroup as d, type FetchLike as e, type CmssyClientConfig as f, type BlockMap as g, type CmssyBlockContext as h, type BlockRect as i, type BoundsMessage as j, type ClickMessage as k, type CmssyBranding as l, type CmssyFormField as m, type CmssyFormSettings as n, type CmssyFormSubmitResponse as o, type CmssyLocaleContext as p, type CmssyModelDefinition as q, type CmssyModelRecord as r, type CmssyRecordList as s, type CmssySiteConfig as t, FORM_QUERY as u, type FetchLikeResponse as v, type FetchPageOptions as w, type FieldType as x, MODEL_RECORDS_QUERY as y, type ParentReadyMessage as z };
315
+ interface CmssyCartItemSnapshot {
316
+ name: string;
317
+ price: number;
318
+ currency: string;
319
+ imageUrl: string | null;
320
+ sku: string | null;
321
+ }
322
+ interface CmssyCartItem {
323
+ id: string;
324
+ recordId: string;
325
+ quantity: number;
326
+ variantSelections: Record<string, string> | null;
327
+ snapshot: CmssyCartItemSnapshot;
328
+ currentPrice: number | null;
329
+ priceMismatch: boolean;
330
+ }
331
+ interface CmssyCartDiscount {
332
+ code: string;
333
+ type: string;
334
+ value: number;
335
+ computedAmount: number;
336
+ }
337
+ interface CmssyCart {
338
+ id: string;
339
+ status: string;
340
+ items: CmssyCartItem[];
341
+ itemCount: number;
342
+ subtotal: number;
343
+ currency: string | null;
344
+ appliedDiscount: CmssyCartDiscount | null;
345
+ discountedTotal: number;
346
+ }
347
+ interface CmssyProductVariant {
348
+ id: string;
349
+ sku: string | null;
350
+ price: number;
351
+ inventory: number | null;
352
+ selectedOptions: Array<{
353
+ name: string;
354
+ value: string;
355
+ }>;
356
+ }
357
+ interface CmssyProduct {
358
+ id: string;
359
+ data: Record<string, unknown>;
360
+ variants: CmssyProductVariant[];
361
+ }
362
+ interface CmssyOrder {
363
+ id: string;
364
+ status: string;
365
+ subtotal: number;
366
+ total: number;
367
+ currency: string;
368
+ customerEmail: string;
369
+ }
370
+
371
+ export { fetchLayouts as $, type AppToEditorMessage as A, type BlockSchema as B, type CmssyPageData as C, type CmssySiteConfig as D, type EditorToAppMessage as E, type FieldDefinition as F, FORM_QUERY as G, type FetchLikeResponse as H, type FetchPageOptions as I, type FieldType as J, MODEL_RECORDS_QUERY as K, type ParentReadyMessage as L, MODEL_DEFINITIONS_QUERY as M, type PatchMessage as N, type RawLayoutBlock as O, PROTOCOL_VERSION as P, type ReadyMessage as Q, type RawBlock as R, SITE_CONFIG_QUERY as S, SUBMIT_FORM_MUTATION as T, type SelectMessage as U, type SubmitFormInput as V, blocksToMeta as W, blocksToSchemas as X, buildBlockContext as Y, buildBlockMap as Z, defineBlock as _, type BlockMeta as a, fetchPage as a0, isProtocolCompatible as a1, normalizeSlug as a2, type BlockDefinition as b, type CmssyFormDefinition as c, type CmssyLayoutGroup as d, type CmssyCart as e, type CmssyOrder as f, type CmssyProduct as g, type CmssyCartDiscount as h, type CmssyCartItem as i, type CmssyCartItemSnapshot as j, type CmssyProductVariant as k, type FetchLike as l, type CmssyClientConfig as m, type BlockMap as n, type CmssyBlockContext as o, type BlockRect as p, type BoundsMessage as q, type ClickMessage as r, type CmssyBranding as s, type CmssyFormField as t, type CmssyFormSettings as u, type CmssyFormSubmitResponse as v, type CmssyLocaleContext as w, type CmssyModelDefinition as x, type CmssyModelRecord as y, type CmssyRecordList as z };
@@ -312,4 +312,60 @@ declare function blocksToMeta(blocks: BlockDefinition[], defaults?: {
312
312
  category?: string;
313
313
  }): Record<string, BlockMeta>;
314
314
 
315
- export { type AppToEditorMessage as A, type BlockSchema as B, type CmssyPageData as C, type PatchMessage as D, type EditorToAppMessage as E, type FieldDefinition as F, type RawLayoutBlock as G, type ReadyMessage as H, SUBMIT_FORM_MUTATION as I, type SelectMessage as J, type SubmitFormInput as K, blocksToMeta as L, MODEL_DEFINITIONS_QUERY as M, blocksToSchemas as N, buildBlockContext as O, PROTOCOL_VERSION as P, buildBlockMap as Q, type RawBlock as R, SITE_CONFIG_QUERY as S, defineBlock as T, fetchLayouts as U, fetchPage as V, isProtocolCompatible as W, normalizeSlug as X, type BlockMeta as a, type BlockDefinition as b, type CmssyFormDefinition as c, type CmssyLayoutGroup as d, type FetchLike as e, type CmssyClientConfig as f, type BlockMap as g, type CmssyBlockContext as h, type BlockRect as i, type BoundsMessage as j, type ClickMessage as k, type CmssyBranding as l, type CmssyFormField as m, type CmssyFormSettings as n, type CmssyFormSubmitResponse as o, type CmssyLocaleContext as p, type CmssyModelDefinition as q, type CmssyModelRecord as r, type CmssyRecordList as s, type CmssySiteConfig as t, FORM_QUERY as u, type FetchLikeResponse as v, type FetchPageOptions as w, type FieldType as x, MODEL_RECORDS_QUERY as y, type ParentReadyMessage as z };
315
+ interface CmssyCartItemSnapshot {
316
+ name: string;
317
+ price: number;
318
+ currency: string;
319
+ imageUrl: string | null;
320
+ sku: string | null;
321
+ }
322
+ interface CmssyCartItem {
323
+ id: string;
324
+ recordId: string;
325
+ quantity: number;
326
+ variantSelections: Record<string, string> | null;
327
+ snapshot: CmssyCartItemSnapshot;
328
+ currentPrice: number | null;
329
+ priceMismatch: boolean;
330
+ }
331
+ interface CmssyCartDiscount {
332
+ code: string;
333
+ type: string;
334
+ value: number;
335
+ computedAmount: number;
336
+ }
337
+ interface CmssyCart {
338
+ id: string;
339
+ status: string;
340
+ items: CmssyCartItem[];
341
+ itemCount: number;
342
+ subtotal: number;
343
+ currency: string | null;
344
+ appliedDiscount: CmssyCartDiscount | null;
345
+ discountedTotal: number;
346
+ }
347
+ interface CmssyProductVariant {
348
+ id: string;
349
+ sku: string | null;
350
+ price: number;
351
+ inventory: number | null;
352
+ selectedOptions: Array<{
353
+ name: string;
354
+ value: string;
355
+ }>;
356
+ }
357
+ interface CmssyProduct {
358
+ id: string;
359
+ data: Record<string, unknown>;
360
+ variants: CmssyProductVariant[];
361
+ }
362
+ interface CmssyOrder {
363
+ id: string;
364
+ status: string;
365
+ subtotal: number;
366
+ total: number;
367
+ currency: string;
368
+ customerEmail: string;
369
+ }
370
+
371
+ export { fetchLayouts as $, type AppToEditorMessage as A, type BlockSchema as B, type CmssyPageData as C, type CmssySiteConfig as D, type EditorToAppMessage as E, type FieldDefinition as F, FORM_QUERY as G, type FetchLikeResponse as H, type FetchPageOptions as I, type FieldType as J, MODEL_RECORDS_QUERY as K, type ParentReadyMessage as L, MODEL_DEFINITIONS_QUERY as M, type PatchMessage as N, type RawLayoutBlock as O, PROTOCOL_VERSION as P, type ReadyMessage as Q, type RawBlock as R, SITE_CONFIG_QUERY as S, SUBMIT_FORM_MUTATION as T, type SelectMessage as U, type SubmitFormInput as V, blocksToMeta as W, blocksToSchemas as X, buildBlockContext as Y, buildBlockMap as Z, defineBlock as _, type BlockMeta as a, fetchPage as a0, isProtocolCompatible as a1, normalizeSlug as a2, type BlockDefinition as b, type CmssyFormDefinition as c, type CmssyLayoutGroup as d, type CmssyCart as e, type CmssyOrder as f, type CmssyProduct as g, type CmssyCartDiscount as h, type CmssyCartItem as i, type CmssyCartItemSnapshot as j, type CmssyProductVariant as k, type FetchLike as l, type CmssyClientConfig as m, type BlockMap as n, type CmssyBlockContext as o, type BlockRect as p, type BoundsMessage as q, type ClickMessage as r, type CmssyBranding as s, type CmssyFormField as t, type CmssyFormSettings as u, type CmssyFormSubmitResponse as v, type CmssyLocaleContext as w, type CmssyModelDefinition as x, type CmssyModelRecord as y, type CmssyRecordList as z };
package/dist/index.cjs CHANGED
@@ -685,4 +685,5 @@ exports.parseEditorMessage = parseEditorMessage;
685
685
  exports.postToEditor = postToEditor;
686
686
  exports.resolveForms = resolveForms;
687
687
  exports.resolveSiteLocales = resolveSiteLocales;
688
+ exports.resolveWorkspaceId = resolveWorkspaceId;
688
689
  exports.splitLocaleFromPath = splitLocaleFromPath;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FieldDefinition, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, E as EditorToAppMessage, A as AppToEditorMessage, e as FetchLike, f as CmssyClientConfig, R as RawBlock, g as BlockMap, h as CmssyBlockContext } from './registry-e3O4s_bN.cjs';
2
- export { a as BlockMeta, i as BlockRect, B as BlockSchema, j as BoundsMessage, k as ClickMessage, l as CmssyBranding, m as CmssyFormField, n as CmssyFormSettings, o as CmssyFormSubmitResponse, p as CmssyLocaleContext, q as CmssyModelDefinition, r as CmssyModelRecord, s as CmssyRecordList, t as CmssySiteConfig, u as FORM_QUERY, v as FetchLikeResponse, w as FetchPageOptions, x as FieldType, M as MODEL_DEFINITIONS_QUERY, y as MODEL_RECORDS_QUERY, P as PROTOCOL_VERSION, z as ParentReadyMessage, D as PatchMessage, G as RawLayoutBlock, H as ReadyMessage, S as SITE_CONFIG_QUERY, I as SUBMIT_FORM_MUTATION, J as SelectMessage, K as SubmitFormInput, L as blocksToMeta, N as blocksToSchemas, O as buildBlockContext, Q as buildBlockMap, T as defineBlock, U as fetchLayouts, V as fetchPage, W as isProtocolCompatible, X as normalizeSlug } from './registry-e3O4s_bN.cjs';
1
+ import { F as FieldDefinition, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, E as EditorToAppMessage, A as AppToEditorMessage, l as FetchLike, m as CmssyClientConfig, R as RawBlock, n as BlockMap, o as CmssyBlockContext } from './commerce-queries-DV7PZlKS.cjs';
2
+ export { a as BlockMeta, p as BlockRect, B as BlockSchema, q as BoundsMessage, r as ClickMessage, s as CmssyBranding, e as CmssyCart, h as CmssyCartDiscount, i as CmssyCartItem, j as CmssyCartItemSnapshot, t as CmssyFormField, u as CmssyFormSettings, v as CmssyFormSubmitResponse, w as CmssyLocaleContext, x as CmssyModelDefinition, y as CmssyModelRecord, f as CmssyOrder, g as CmssyProduct, k as CmssyProductVariant, z as CmssyRecordList, D as CmssySiteConfig, G as FORM_QUERY, H as FetchLikeResponse, I as FetchPageOptions, J as FieldType, M as MODEL_DEFINITIONS_QUERY, K as MODEL_RECORDS_QUERY, P as PROTOCOL_VERSION, L as ParentReadyMessage, N as PatchMessage, O as RawLayoutBlock, Q as ReadyMessage, S as SITE_CONFIG_QUERY, T as SUBMIT_FORM_MUTATION, U as SelectMessage, V as SubmitFormInput, W as blocksToMeta, X as blocksToSchemas, Y as buildBlockContext, Z as buildBlockMap, _ as defineBlock, $ as fetchLayouts, a0 as fetchPage, a1 as isProtocolCompatible, a2 as normalizeSlug } from './commerce-queries-DV7PZlKS.cjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import 'react';
5
5
 
@@ -65,6 +65,8 @@ interface GraphqlRequestOptions {
65
65
  }
66
66
  declare function graphqlRequest<T>(config: CmssyClientConfig, query: string, variables: Record<string, unknown>, options?: GraphqlRequestOptions, label?: string): Promise<T>;
67
67
 
68
+ declare function resolveWorkspaceId(config: CmssyClientConfig, options?: GraphqlRequestOptions): Promise<string>;
69
+
68
70
  interface QueryScopedOptions extends GraphqlRequestOptions {
69
71
  workspaceId?: string;
70
72
  }
@@ -106,4 +108,4 @@ interface UnknownBlockProps {
106
108
  }
107
109
  declare function UnknownBlock({ type }: UnknownBlockProps): react_jsx_runtime.JSX.Element;
108
110
 
109
- export { AppToEditorMessage, BlockDefinition, BlockMap, CmssyBlock, CmssyBlockContext, type CmssyBlockProps, type CmssyClient, CmssyClientConfig, CmssyFormDefinition, CmssyLayoutGroup, CmssyPageData, CmssyServerLayout, type CmssyServerLayoutProps, CmssyServerPage, type CmssyServerPageProps, type CmssySiteLocales, EditorToAppMessage, FetchLike, type FieldControl, FieldDefinition, type GraphqlRequestOptions, type PostTarget, type QueryScopedOptions, RawBlock, UnknownBlock, type UnknownBlockProps, collectFormIds, createCmssyClient, fields, getBlockContentForLanguage, graphqlRequest, normalizeOrigin, parseEditorMessage, postToEditor, resolveForms, resolveSiteLocales, splitLocaleFromPath };
111
+ export { AppToEditorMessage, BlockDefinition, BlockMap, CmssyBlock, CmssyBlockContext, type CmssyBlockProps, type CmssyClient, CmssyClientConfig, CmssyFormDefinition, CmssyLayoutGroup, CmssyPageData, CmssyServerLayout, type CmssyServerLayoutProps, CmssyServerPage, type CmssyServerPageProps, type CmssySiteLocales, EditorToAppMessage, FetchLike, type FieldControl, FieldDefinition, type GraphqlRequestOptions, type PostTarget, type QueryScopedOptions, RawBlock, UnknownBlock, type UnknownBlockProps, collectFormIds, createCmssyClient, fields, getBlockContentForLanguage, graphqlRequest, normalizeOrigin, parseEditorMessage, postToEditor, resolveForms, resolveSiteLocales, resolveWorkspaceId, splitLocaleFromPath };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FieldDefinition, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, E as EditorToAppMessage, A as AppToEditorMessage, e as FetchLike, f as CmssyClientConfig, R as RawBlock, g as BlockMap, h as CmssyBlockContext } from './registry-e3O4s_bN.js';
2
- export { a as BlockMeta, i as BlockRect, B as BlockSchema, j as BoundsMessage, k as ClickMessage, l as CmssyBranding, m as CmssyFormField, n as CmssyFormSettings, o as CmssyFormSubmitResponse, p as CmssyLocaleContext, q as CmssyModelDefinition, r as CmssyModelRecord, s as CmssyRecordList, t as CmssySiteConfig, u as FORM_QUERY, v as FetchLikeResponse, w as FetchPageOptions, x as FieldType, M as MODEL_DEFINITIONS_QUERY, y as MODEL_RECORDS_QUERY, P as PROTOCOL_VERSION, z as ParentReadyMessage, D as PatchMessage, G as RawLayoutBlock, H as ReadyMessage, S as SITE_CONFIG_QUERY, I as SUBMIT_FORM_MUTATION, J as SelectMessage, K as SubmitFormInput, L as blocksToMeta, N as blocksToSchemas, O as buildBlockContext, Q as buildBlockMap, T as defineBlock, U as fetchLayouts, V as fetchPage, W as isProtocolCompatible, X as normalizeSlug } from './registry-e3O4s_bN.js';
1
+ import { F as FieldDefinition, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, E as EditorToAppMessage, A as AppToEditorMessage, l as FetchLike, m as CmssyClientConfig, R as RawBlock, n as BlockMap, o as CmssyBlockContext } from './commerce-queries-DV7PZlKS.js';
2
+ export { a as BlockMeta, p as BlockRect, B as BlockSchema, q as BoundsMessage, r as ClickMessage, s as CmssyBranding, e as CmssyCart, h as CmssyCartDiscount, i as CmssyCartItem, j as CmssyCartItemSnapshot, t as CmssyFormField, u as CmssyFormSettings, v as CmssyFormSubmitResponse, w as CmssyLocaleContext, x as CmssyModelDefinition, y as CmssyModelRecord, f as CmssyOrder, g as CmssyProduct, k as CmssyProductVariant, z as CmssyRecordList, D as CmssySiteConfig, G as FORM_QUERY, H as FetchLikeResponse, I as FetchPageOptions, J as FieldType, M as MODEL_DEFINITIONS_QUERY, K as MODEL_RECORDS_QUERY, P as PROTOCOL_VERSION, L as ParentReadyMessage, N as PatchMessage, O as RawLayoutBlock, Q as ReadyMessage, S as SITE_CONFIG_QUERY, T as SUBMIT_FORM_MUTATION, U as SelectMessage, V as SubmitFormInput, W as blocksToMeta, X as blocksToSchemas, Y as buildBlockContext, Z as buildBlockMap, _ as defineBlock, $ as fetchLayouts, a0 as fetchPage, a1 as isProtocolCompatible, a2 as normalizeSlug } from './commerce-queries-DV7PZlKS.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import 'react';
5
5
 
@@ -65,6 +65,8 @@ interface GraphqlRequestOptions {
65
65
  }
66
66
  declare function graphqlRequest<T>(config: CmssyClientConfig, query: string, variables: Record<string, unknown>, options?: GraphqlRequestOptions, label?: string): Promise<T>;
67
67
 
68
+ declare function resolveWorkspaceId(config: CmssyClientConfig, options?: GraphqlRequestOptions): Promise<string>;
69
+
68
70
  interface QueryScopedOptions extends GraphqlRequestOptions {
69
71
  workspaceId?: string;
70
72
  }
@@ -106,4 +108,4 @@ interface UnknownBlockProps {
106
108
  }
107
109
  declare function UnknownBlock({ type }: UnknownBlockProps): react_jsx_runtime.JSX.Element;
108
110
 
109
- export { AppToEditorMessage, BlockDefinition, BlockMap, CmssyBlock, CmssyBlockContext, type CmssyBlockProps, type CmssyClient, CmssyClientConfig, CmssyFormDefinition, CmssyLayoutGroup, CmssyPageData, CmssyServerLayout, type CmssyServerLayoutProps, CmssyServerPage, type CmssyServerPageProps, type CmssySiteLocales, EditorToAppMessage, FetchLike, type FieldControl, FieldDefinition, type GraphqlRequestOptions, type PostTarget, type QueryScopedOptions, RawBlock, UnknownBlock, type UnknownBlockProps, collectFormIds, createCmssyClient, fields, getBlockContentForLanguage, graphqlRequest, normalizeOrigin, parseEditorMessage, postToEditor, resolveForms, resolveSiteLocales, splitLocaleFromPath };
111
+ export { AppToEditorMessage, BlockDefinition, BlockMap, CmssyBlock, CmssyBlockContext, type CmssyBlockProps, type CmssyClient, CmssyClientConfig, CmssyFormDefinition, CmssyLayoutGroup, CmssyPageData, CmssyServerLayout, type CmssyServerLayoutProps, CmssyServerPage, type CmssyServerPageProps, type CmssySiteLocales, EditorToAppMessage, FetchLike, type FieldControl, FieldDefinition, type GraphqlRequestOptions, type PostTarget, type QueryScopedOptions, RawBlock, UnknownBlock, type UnknownBlockProps, collectFormIds, createCmssyClient, fields, getBlockContentForLanguage, graphqlRequest, normalizeOrigin, parseEditorMessage, postToEditor, resolveForms, resolveSiteLocales, resolveWorkspaceId, splitLocaleFromPath };
package/dist/index.js CHANGED
@@ -654,4 +654,4 @@ function CmssyBlock({
654
654
  );
655
655
  }
656
656
 
657
- export { CmssyBlock, CmssyServerLayout, CmssyServerPage, FORM_QUERY, MODEL_DEFINITIONS_QUERY, MODEL_RECORDS_QUERY, PROTOCOL_VERSION, SITE_CONFIG_QUERY, SUBMIT_FORM_MUTATION, UnknownBlock, blocksToMeta, blocksToSchemas, buildBlockContext, buildBlockMap, collectFormIds, createCmssyClient, defineBlock, fetchLayouts, fetchPage, fields, getBlockContentForLanguage, graphqlRequest, isProtocolCompatible, normalizeOrigin, normalizeSlug, parseEditorMessage, postToEditor, resolveForms, resolveSiteLocales, splitLocaleFromPath };
657
+ export { CmssyBlock, CmssyServerLayout, CmssyServerPage, FORM_QUERY, MODEL_DEFINITIONS_QUERY, MODEL_RECORDS_QUERY, PROTOCOL_VERSION, SITE_CONFIG_QUERY, SUBMIT_FORM_MUTATION, UnknownBlock, blocksToMeta, blocksToSchemas, buildBlockContext, buildBlockMap, collectFormIds, createCmssyClient, defineBlock, fetchLayouts, fetchPage, fields, getBlockContentForLanguage, graphqlRequest, isProtocolCompatible, normalizeOrigin, normalizeSlug, parseEditorMessage, postToEditor, resolveForms, resolveSiteLocales, resolveWorkspaceId, splitLocaleFromPath };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/react",
3
- "version": "0.1.8",
3
+ "version": "0.2.0",
4
4
  "description": "React blocks, renderers, data client and editor bridge for cmssy headless sites",
5
5
  "keywords": [
6
6
  "cmssy",