@swell/apps-sdk 1.0.176 → 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 +30 -5
- package/dist/index.cjs.map +3 -3
- package/dist/index.js +30 -5
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +30 -5
- package/dist/index.mjs.map +3 -3
- package/dist/src/compatibility/shopify-objects/predictive_search.d.ts +1 -1
- package/dist/src/compatibility/shopify-objects/search.d.ts +1 -1
- 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) {
|
|
@@ -13498,10 +13505,13 @@ function ShopifyPredictiveSearch(instance, search) {
|
|
|
13498
13505
|
if (search instanceof ShopifyResource) {
|
|
13499
13506
|
return search.clone();
|
|
13500
13507
|
}
|
|
13508
|
+
if (search instanceof StorefrontResource) {
|
|
13509
|
+
search = cloneStorefrontResource(search);
|
|
13510
|
+
}
|
|
13501
13511
|
return new ShopifyResource({
|
|
13502
|
-
performed:
|
|
13512
|
+
performed: deferWith(search, (search2) => search2.performed),
|
|
13503
13513
|
resources: ShopifyPredictiveSearchResources(instance, search),
|
|
13504
|
-
terms:
|
|
13514
|
+
terms: deferWith(search, (search2) => search2.query),
|
|
13505
13515
|
types: ["product"]
|
|
13506
13516
|
});
|
|
13507
13517
|
}
|
|
@@ -13572,6 +13582,9 @@ function ShopifySearch(instance, search) {
|
|
|
13572
13582
|
if (search instanceof ShopifyResource) {
|
|
13573
13583
|
return search.clone();
|
|
13574
13584
|
}
|
|
13585
|
+
if (search instanceof StorefrontResource) {
|
|
13586
|
+
search = cloneStorefrontResource(search);
|
|
13587
|
+
}
|
|
13575
13588
|
const resolveProducts = makeProductsCollectionResolve(
|
|
13576
13589
|
instance,
|
|
13577
13590
|
search,
|
|
@@ -14907,7 +14920,7 @@ function bind2(liquidSwell) {
|
|
|
14907
14920
|
const value = yield (0, import_liquidjs16.evalToken)(valueToken, ctx, ctx.opts.lenientIf);
|
|
14908
14921
|
if (target === value) {
|
|
14909
14922
|
const blockOutput = yield r.renderTemplates(branch.templates, ctx);
|
|
14910
|
-
output +=
|
|
14923
|
+
output += blockOutput;
|
|
14911
14924
|
branchHit = true;
|
|
14912
14925
|
break;
|
|
14913
14926
|
}
|
|
@@ -18932,6 +18945,7 @@ function resolveSectionSettings(theme, sectionConfig, index) {
|
|
|
18932
18945
|
);
|
|
18933
18946
|
blocks = blocks?.map((block) => ({
|
|
18934
18947
|
...block,
|
|
18948
|
+
...getBlockAttributes(theme, block),
|
|
18935
18949
|
settings: resolveThemeSettings(
|
|
18936
18950
|
theme,
|
|
18937
18951
|
block.settings,
|
|
@@ -19073,6 +19087,17 @@ function findEditorSetting(editorSchemaSettings, key) {
|
|
|
19073
19087
|
}
|
|
19074
19088
|
return null;
|
|
19075
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
|
+
}
|
|
19076
19101
|
function parseJsonConfig(config) {
|
|
19077
19102
|
try {
|
|
19078
19103
|
return import_json56.default.parse(config?.file_data || "{}");
|