@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.cjs
CHANGED
|
@@ -3390,13 +3390,20 @@ function getSectionSettingsFromProps(props, sectionSchema) {
|
|
|
3390
3390
|
blocks: props.Blocks?.filter(
|
|
3391
3391
|
(propBlock) => Boolean(propBlock.props.compiled?._component)
|
|
3392
3392
|
).map((propBlock) => {
|
|
3393
|
-
const
|
|
3394
|
-
|
|
3393
|
+
const {
|
|
3394
|
+
_id: id,
|
|
3395
|
+
_component: component,
|
|
3396
|
+
disabled: isDisabled,
|
|
3397
|
+
props: blockProps
|
|
3398
|
+
} = propBlock.props.compiled;
|
|
3399
|
+
const blockType = component.split("__")[2];
|
|
3395
3400
|
const blockSchema = sectionSchema.blocks?.find(
|
|
3396
3401
|
(block) => block.type === blockType
|
|
3397
3402
|
);
|
|
3398
3403
|
return {
|
|
3404
|
+
id,
|
|
3399
3405
|
type: blockType,
|
|
3406
|
+
disabled: isDisabled,
|
|
3400
3407
|
settings: blockSchema?.fields?.reduce(
|
|
3401
3408
|
(acc, field) => {
|
|
3402
3409
|
if (field?.id) {
|
|
@@ -14913,7 +14920,7 @@ function bind2(liquidSwell) {
|
|
|
14913
14920
|
const value = yield (0, import_liquidjs16.evalToken)(valueToken, ctx, ctx.opts.lenientIf);
|
|
14914
14921
|
if (target === value) {
|
|
14915
14922
|
const blockOutput = yield r.renderTemplates(branch.templates, ctx);
|
|
14916
|
-
output +=
|
|
14923
|
+
output += blockOutput;
|
|
14917
14924
|
branchHit = true;
|
|
14918
14925
|
break;
|
|
14919
14926
|
}
|
|
@@ -18938,6 +18945,7 @@ function resolveSectionSettings(theme, sectionConfig, index) {
|
|
|
18938
18945
|
);
|
|
18939
18946
|
blocks = blocks?.map((block) => ({
|
|
18940
18947
|
...block,
|
|
18948
|
+
...getBlockAttributes(theme, block),
|
|
18941
18949
|
settings: resolveThemeSettings(
|
|
18942
18950
|
theme,
|
|
18943
18951
|
block.settings,
|
|
@@ -19079,6 +19087,17 @@ function findEditorSetting(editorSchemaSettings, key) {
|
|
|
19079
19087
|
}
|
|
19080
19088
|
return null;
|
|
19081
19089
|
}
|
|
19090
|
+
function getBlockAttributes(theme, block) {
|
|
19091
|
+
if (!theme.swell.isEditor) {
|
|
19092
|
+
return;
|
|
19093
|
+
}
|
|
19094
|
+
const { id } = block;
|
|
19095
|
+
const attributes = `data-editor-block="${JSON.stringify({ id }).replaceAll('"', """)}"`;
|
|
19096
|
+
return {
|
|
19097
|
+
swell_attributes: attributes,
|
|
19098
|
+
shopify_attributes: attributes
|
|
19099
|
+
};
|
|
19100
|
+
}
|
|
19082
19101
|
function parseJsonConfig(config) {
|
|
19083
19102
|
try {
|
|
19084
19103
|
return import_json56.default.parse(config?.file_data || "{}");
|