@swell/apps-sdk 1.0.177 → 1.0.178
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/index.cjs +22 -3
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +22 -3
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +22 -3
- package/dist/index.mjs.map +2 -2
- package/dist/types/swell.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3241,13 +3241,20 @@ function getSectionSettingsFromProps(props, sectionSchema) {
|
|
|
3241
3241
|
blocks: props.Blocks?.filter(
|
|
3242
3242
|
(propBlock) => Boolean(propBlock.props.compiled?._component)
|
|
3243
3243
|
).map((propBlock) => {
|
|
3244
|
-
const
|
|
3245
|
-
|
|
3244
|
+
const {
|
|
3245
|
+
_id: id,
|
|
3246
|
+
_component: component,
|
|
3247
|
+
disabled: isDisabled,
|
|
3248
|
+
props: blockProps
|
|
3249
|
+
} = propBlock.props.compiled;
|
|
3250
|
+
const blockType = component.split("__")[2];
|
|
3246
3251
|
const blockSchema = sectionSchema.blocks?.find(
|
|
3247
3252
|
(block) => block.type === blockType
|
|
3248
3253
|
);
|
|
3249
3254
|
return {
|
|
3255
|
+
id,
|
|
3250
3256
|
type: blockType,
|
|
3257
|
+
disabled: isDisabled,
|
|
3251
3258
|
settings: blockSchema?.fields?.reduce(
|
|
3252
3259
|
(acc, field) => {
|
|
3253
3260
|
if (field?.id) {
|
|
@@ -14767,7 +14774,7 @@ function bind2(liquidSwell) {
|
|
|
14767
14774
|
const value = yield evalToken(valueToken, ctx, ctx.opts.lenientIf);
|
|
14768
14775
|
if (target === value) {
|
|
14769
14776
|
const blockOutput = yield r.renderTemplates(branch.templates, ctx);
|
|
14770
|
-
output +=
|
|
14777
|
+
output += blockOutput;
|
|
14771
14778
|
branchHit = true;
|
|
14772
14779
|
break;
|
|
14773
14780
|
}
|
|
@@ -18797,6 +18804,7 @@ function resolveSectionSettings(theme, sectionConfig, index) {
|
|
|
18797
18804
|
);
|
|
18798
18805
|
blocks = blocks?.map((block) => ({
|
|
18799
18806
|
...block,
|
|
18807
|
+
...getBlockAttributes(theme, block),
|
|
18800
18808
|
settings: resolveThemeSettings(
|
|
18801
18809
|
theme,
|
|
18802
18810
|
block.settings,
|
|
@@ -18938,6 +18946,17 @@ function findEditorSetting(editorSchemaSettings, key) {
|
|
|
18938
18946
|
}
|
|
18939
18947
|
return null;
|
|
18940
18948
|
}
|
|
18949
|
+
function getBlockAttributes(theme, block) {
|
|
18950
|
+
if (!theme.swell.isEditor) {
|
|
18951
|
+
return;
|
|
18952
|
+
}
|
|
18953
|
+
const { id } = block;
|
|
18954
|
+
const attributes = `data-editor-block="${JSON.stringify({ id }).replaceAll('"', """)}"`;
|
|
18955
|
+
return {
|
|
18956
|
+
swell_attributes: attributes,
|
|
18957
|
+
shopify_attributes: attributes
|
|
18958
|
+
};
|
|
18959
|
+
}
|
|
18941
18960
|
function parseJsonConfig(config) {
|
|
18942
18961
|
try {
|
|
18943
18962
|
return JSON56.parse(config?.file_data || "{}");
|