@cmssy/react 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.cjs +9 -9
- package/dist/client.d.cts +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/client.js +9 -9
- package/dist/{commerce-queries-ClCU8FZN.d.cts → commerce-queries-D5duQ6QF.d.cts} +7 -1
- package/dist/{commerce-queries-ClCU8FZN.d.ts → commerce-queries-D5duQ6QF.d.ts} +7 -1
- package/dist/index.cjs +17 -12
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +17 -12
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -485,12 +485,8 @@ function getBlockContentForLanguage(content, locale, defaultLocale = "en", avail
|
|
|
485
485
|
const chosen = localeMap[locale] ?? localeMap[defaultLocale] ?? localeMap[fallbackKey];
|
|
486
486
|
return { ...nonTranslatable, ...chosen };
|
|
487
487
|
}
|
|
488
|
-
function
|
|
489
|
-
return {
|
|
490
|
-
...content,
|
|
491
|
-
...isPlainObject(style) ? style : {},
|
|
492
|
-
...isPlainObject(advanced) ? advanced : {}
|
|
493
|
-
};
|
|
488
|
+
function asBucket(value) {
|
|
489
|
+
return isPlainObject(value) ? value : {};
|
|
494
490
|
}
|
|
495
491
|
var WARN_CAP = 256;
|
|
496
492
|
var warned = /* @__PURE__ */ new Set();
|
|
@@ -514,8 +510,7 @@ function CmssyBlock({
|
|
|
514
510
|
}) {
|
|
515
511
|
const Component = Object.hasOwn(blockMap, block.type) ? blockMap[block.type] : void 0;
|
|
516
512
|
const base = getBlockContentForLanguage(block.content, locale, defaultLocale);
|
|
517
|
-
const
|
|
518
|
-
const content = mergeBlockValues(resolved, block.style, block.advanced);
|
|
513
|
+
const content = patchedContent ? { ...base, ...patchedContent } : base;
|
|
519
514
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
520
515
|
"div",
|
|
521
516
|
{
|
|
@@ -524,7 +519,12 @@ function CmssyBlock({
|
|
|
524
519
|
"data-layout-position": layoutPosition,
|
|
525
520
|
draggable: editable || void 0,
|
|
526
521
|
style: Component ? void 0 : { display: "none" },
|
|
527
|
-
children: Component ? react.createElement(Component, {
|
|
522
|
+
children: Component ? react.createElement(Component, {
|
|
523
|
+
content,
|
|
524
|
+
style: asBucket(block.style),
|
|
525
|
+
advanced: asBucket(block.advanced),
|
|
526
|
+
context
|
|
527
|
+
}) : /* @__PURE__ */ jsxRuntime.jsx(UnknownBlock, { type: block.type })
|
|
528
528
|
}
|
|
529
529
|
);
|
|
530
530
|
}
|
package/dist/client.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-D5duQ6QF.cjs';
|
|
3
|
+
export { i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, l as CmssyOrderItem, m as CmssyProductVariant } from './commerce-queries-D5duQ6QF.cjs';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
import '@cmssy/types';
|
|
6
6
|
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-D5duQ6QF.js';
|
|
3
|
+
export { i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, l as CmssyOrderItem, m as CmssyProductVariant } from './commerce-queries-D5duQ6QF.js';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
import '@cmssy/types';
|
|
6
6
|
|
package/dist/client.js
CHANGED
|
@@ -483,12 +483,8 @@ function getBlockContentForLanguage(content, locale, defaultLocale = "en", avail
|
|
|
483
483
|
const chosen = localeMap[locale] ?? localeMap[defaultLocale] ?? localeMap[fallbackKey];
|
|
484
484
|
return { ...nonTranslatable, ...chosen };
|
|
485
485
|
}
|
|
486
|
-
function
|
|
487
|
-
return {
|
|
488
|
-
...content,
|
|
489
|
-
...isPlainObject(style) ? style : {},
|
|
490
|
-
...isPlainObject(advanced) ? advanced : {}
|
|
491
|
-
};
|
|
486
|
+
function asBucket(value) {
|
|
487
|
+
return isPlainObject(value) ? value : {};
|
|
492
488
|
}
|
|
493
489
|
var WARN_CAP = 256;
|
|
494
490
|
var warned = /* @__PURE__ */ new Set();
|
|
@@ -512,8 +508,7 @@ function CmssyBlock({
|
|
|
512
508
|
}) {
|
|
513
509
|
const Component = Object.hasOwn(blockMap, block.type) ? blockMap[block.type] : void 0;
|
|
514
510
|
const base = getBlockContentForLanguage(block.content, locale, defaultLocale);
|
|
515
|
-
const
|
|
516
|
-
const content = mergeBlockValues(resolved, block.style, block.advanced);
|
|
511
|
+
const content = patchedContent ? { ...base, ...patchedContent } : base;
|
|
517
512
|
return /* @__PURE__ */ jsx(
|
|
518
513
|
"div",
|
|
519
514
|
{
|
|
@@ -522,7 +517,12 @@ function CmssyBlock({
|
|
|
522
517
|
"data-layout-position": layoutPosition,
|
|
523
518
|
draggable: editable || void 0,
|
|
524
519
|
style: Component ? void 0 : { display: "none" },
|
|
525
|
-
children: Component ? createElement(Component, {
|
|
520
|
+
children: Component ? createElement(Component, {
|
|
521
|
+
content,
|
|
522
|
+
style: asBucket(block.style),
|
|
523
|
+
advanced: asBucket(block.advanced),
|
|
524
|
+
context
|
|
525
|
+
}) : /* @__PURE__ */ jsx(UnknownBlock, { type: block.type })
|
|
526
526
|
}
|
|
527
527
|
);
|
|
528
528
|
}
|
|
@@ -340,11 +340,13 @@ interface BlockDefinition {
|
|
|
340
340
|
loader?: BlockLoader;
|
|
341
341
|
component: ComponentType<{
|
|
342
342
|
content: Record<string, unknown>;
|
|
343
|
+
style?: Record<string, unknown>;
|
|
344
|
+
advanced?: Record<string, unknown>;
|
|
343
345
|
context?: CmssyBlockContext;
|
|
344
346
|
data?: unknown;
|
|
345
347
|
}>;
|
|
346
348
|
}
|
|
347
|
-
declare function defineBlock<C extends Record<string, unknown>, D = unknown>(def: {
|
|
349
|
+
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: {
|
|
348
350
|
type: string;
|
|
349
351
|
label?: string;
|
|
350
352
|
category?: string;
|
|
@@ -358,12 +360,16 @@ declare function defineBlock<C extends Record<string, unknown>, D = unknown>(def
|
|
|
358
360
|
}) => Promise<D> | D;
|
|
359
361
|
component: ComponentType<{
|
|
360
362
|
content: C;
|
|
363
|
+
style?: S;
|
|
364
|
+
advanced?: A;
|
|
361
365
|
context?: CmssyBlockContext;
|
|
362
366
|
data?: D;
|
|
363
367
|
}>;
|
|
364
368
|
}): BlockDefinition;
|
|
365
369
|
type BlockMap = Record<string, ComponentType<{
|
|
366
370
|
content: Record<string, unknown>;
|
|
371
|
+
style?: Record<string, unknown>;
|
|
372
|
+
advanced?: Record<string, unknown>;
|
|
367
373
|
context?: CmssyBlockContext;
|
|
368
374
|
data?: unknown;
|
|
369
375
|
}>>;
|
|
@@ -340,11 +340,13 @@ interface BlockDefinition {
|
|
|
340
340
|
loader?: BlockLoader;
|
|
341
341
|
component: ComponentType<{
|
|
342
342
|
content: Record<string, unknown>;
|
|
343
|
+
style?: Record<string, unknown>;
|
|
344
|
+
advanced?: Record<string, unknown>;
|
|
343
345
|
context?: CmssyBlockContext;
|
|
344
346
|
data?: unknown;
|
|
345
347
|
}>;
|
|
346
348
|
}
|
|
347
|
-
declare function defineBlock<C extends Record<string, unknown>, D = unknown>(def: {
|
|
349
|
+
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: {
|
|
348
350
|
type: string;
|
|
349
351
|
label?: string;
|
|
350
352
|
category?: string;
|
|
@@ -358,12 +360,16 @@ declare function defineBlock<C extends Record<string, unknown>, D = unknown>(def
|
|
|
358
360
|
}) => Promise<D> | D;
|
|
359
361
|
component: ComponentType<{
|
|
360
362
|
content: C;
|
|
363
|
+
style?: S;
|
|
364
|
+
advanced?: A;
|
|
361
365
|
context?: CmssyBlockContext;
|
|
362
366
|
data?: D;
|
|
363
367
|
}>;
|
|
364
368
|
}): BlockDefinition;
|
|
365
369
|
type BlockMap = Record<string, ComponentType<{
|
|
366
370
|
content: Record<string, unknown>;
|
|
371
|
+
style?: Record<string, unknown>;
|
|
372
|
+
advanced?: Record<string, unknown>;
|
|
367
373
|
context?: CmssyBlockContext;
|
|
368
374
|
data?: unknown;
|
|
369
375
|
}>>;
|
package/dist/index.cjs
CHANGED
|
@@ -101,12 +101,8 @@ function getBlockContentForLanguage(content, locale, defaultLocale = "en", avail
|
|
|
101
101
|
const chosen = localeMap[locale] ?? localeMap[defaultLocale] ?? localeMap[fallbackKey];
|
|
102
102
|
return { ...nonTranslatable, ...chosen };
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
return {
|
|
106
|
-
...content,
|
|
107
|
-
...isPlainObject(style) ? style : {},
|
|
108
|
-
...isPlainObject(advanced) ? advanced : {}
|
|
109
|
-
};
|
|
104
|
+
function asBucket(value) {
|
|
105
|
+
return isPlainObject(value) ? value : {};
|
|
110
106
|
}
|
|
111
107
|
|
|
112
108
|
// src/components/block-context.ts
|
|
@@ -136,20 +132,25 @@ function UnknownBlock({ type }) {
|
|
|
136
132
|
function renderResolvedBlock(block, map, locale, defaultLocale, options = {}) {
|
|
137
133
|
const { context, data, resolvedContent, enabledLocales } = options;
|
|
138
134
|
const Component = Object.hasOwn(map, block.type) ? map[block.type] : void 0;
|
|
139
|
-
const
|
|
135
|
+
const content = resolvedContent ?? getBlockContentForLanguage(
|
|
140
136
|
block.content,
|
|
141
137
|
locale,
|
|
142
138
|
defaultLocale,
|
|
143
139
|
enabledLocales?.length ? enabledLocales : void 0
|
|
144
140
|
);
|
|
145
|
-
const content = mergeBlockValues(resolved, block.style, block.advanced);
|
|
146
141
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
147
142
|
"div",
|
|
148
143
|
{
|
|
149
144
|
"data-block-id": block.id,
|
|
150
145
|
"data-block-type": block.type,
|
|
151
146
|
style: Component ? void 0 : { display: "none" },
|
|
152
|
-
children: Component ? react.createElement(Component, {
|
|
147
|
+
children: Component ? react.createElement(Component, {
|
|
148
|
+
content,
|
|
149
|
+
style: asBucket(block.style),
|
|
150
|
+
advanced: asBucket(block.advanced),
|
|
151
|
+
context,
|
|
152
|
+
data
|
|
153
|
+
}) : /* @__PURE__ */ jsxRuntime.jsx(UnknownBlock, { type: block.type })
|
|
153
154
|
},
|
|
154
155
|
block.id
|
|
155
156
|
);
|
|
@@ -897,8 +898,7 @@ function CmssyBlock({
|
|
|
897
898
|
}) {
|
|
898
899
|
const Component = Object.hasOwn(blockMap, block.type) ? blockMap[block.type] : void 0;
|
|
899
900
|
const base = getBlockContentForLanguage(block.content, locale, defaultLocale);
|
|
900
|
-
const
|
|
901
|
-
const content = mergeBlockValues(resolved, block.style, block.advanced);
|
|
901
|
+
const content = patchedContent ? { ...base, ...patchedContent } : base;
|
|
902
902
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
903
903
|
"div",
|
|
904
904
|
{
|
|
@@ -907,7 +907,12 @@ function CmssyBlock({
|
|
|
907
907
|
"data-layout-position": layoutPosition,
|
|
908
908
|
draggable: editable || void 0,
|
|
909
909
|
style: Component ? void 0 : { display: "none" },
|
|
910
|
-
children: Component ? react.createElement(Component, {
|
|
910
|
+
children: Component ? react.createElement(Component, {
|
|
911
|
+
content,
|
|
912
|
+
style: asBucket(block.style),
|
|
913
|
+
advanced: asBucket(block.advanced),
|
|
914
|
+
context
|
|
915
|
+
}) : /* @__PURE__ */ jsxRuntime.jsx(UnknownBlock, { type: block.type })
|
|
911
916
|
}
|
|
912
917
|
);
|
|
913
918
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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 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-
|
|
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-D5duQ6QF.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-D5duQ6QF.cjs';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
export { FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldType, evaluateFieldConditionGroup } from '@cmssy/types';
|
|
5
5
|
import 'react';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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 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-
|
|
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-D5duQ6QF.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-D5duQ6QF.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
export { FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldType, evaluateFieldConditionGroup } from '@cmssy/types';
|
|
5
5
|
import 'react';
|
package/dist/index.js
CHANGED
|
@@ -99,12 +99,8 @@ function getBlockContentForLanguage(content, locale, defaultLocale = "en", avail
|
|
|
99
99
|
const chosen = localeMap[locale] ?? localeMap[defaultLocale] ?? localeMap[fallbackKey];
|
|
100
100
|
return { ...nonTranslatable, ...chosen };
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
return {
|
|
104
|
-
...content,
|
|
105
|
-
...isPlainObject(style) ? style : {},
|
|
106
|
-
...isPlainObject(advanced) ? advanced : {}
|
|
107
|
-
};
|
|
102
|
+
function asBucket(value) {
|
|
103
|
+
return isPlainObject(value) ? value : {};
|
|
108
104
|
}
|
|
109
105
|
|
|
110
106
|
// src/components/block-context.ts
|
|
@@ -134,20 +130,25 @@ function UnknownBlock({ type }) {
|
|
|
134
130
|
function renderResolvedBlock(block, map, locale, defaultLocale, options = {}) {
|
|
135
131
|
const { context, data, resolvedContent, enabledLocales } = options;
|
|
136
132
|
const Component = Object.hasOwn(map, block.type) ? map[block.type] : void 0;
|
|
137
|
-
const
|
|
133
|
+
const content = resolvedContent ?? getBlockContentForLanguage(
|
|
138
134
|
block.content,
|
|
139
135
|
locale,
|
|
140
136
|
defaultLocale,
|
|
141
137
|
enabledLocales?.length ? enabledLocales : void 0
|
|
142
138
|
);
|
|
143
|
-
const content = mergeBlockValues(resolved, block.style, block.advanced);
|
|
144
139
|
return /* @__PURE__ */ jsx(
|
|
145
140
|
"div",
|
|
146
141
|
{
|
|
147
142
|
"data-block-id": block.id,
|
|
148
143
|
"data-block-type": block.type,
|
|
149
144
|
style: Component ? void 0 : { display: "none" },
|
|
150
|
-
children: Component ? createElement(Component, {
|
|
145
|
+
children: Component ? createElement(Component, {
|
|
146
|
+
content,
|
|
147
|
+
style: asBucket(block.style),
|
|
148
|
+
advanced: asBucket(block.advanced),
|
|
149
|
+
context,
|
|
150
|
+
data
|
|
151
|
+
}) : /* @__PURE__ */ jsx(UnknownBlock, { type: block.type })
|
|
151
152
|
},
|
|
152
153
|
block.id
|
|
153
154
|
);
|
|
@@ -895,8 +896,7 @@ function CmssyBlock({
|
|
|
895
896
|
}) {
|
|
896
897
|
const Component = Object.hasOwn(blockMap, block.type) ? blockMap[block.type] : void 0;
|
|
897
898
|
const base = getBlockContentForLanguage(block.content, locale, defaultLocale);
|
|
898
|
-
const
|
|
899
|
-
const content = mergeBlockValues(resolved, block.style, block.advanced);
|
|
899
|
+
const content = patchedContent ? { ...base, ...patchedContent } : base;
|
|
900
900
|
return /* @__PURE__ */ jsx(
|
|
901
901
|
"div",
|
|
902
902
|
{
|
|
@@ -905,7 +905,12 @@ function CmssyBlock({
|
|
|
905
905
|
"data-layout-position": layoutPosition,
|
|
906
906
|
draggable: editable || void 0,
|
|
907
907
|
style: Component ? void 0 : { display: "none" },
|
|
908
|
-
children: Component ? createElement(Component, {
|
|
908
|
+
children: Component ? createElement(Component, {
|
|
909
|
+
content,
|
|
910
|
+
style: asBucket(block.style),
|
|
911
|
+
advanced: asBucket(block.advanced),
|
|
912
|
+
context
|
|
913
|
+
}) : /* @__PURE__ */ jsx(UnknownBlock, { type: block.type })
|
|
909
914
|
}
|
|
910
915
|
);
|
|
911
916
|
}
|