@swell/apps-sdk 1.0.177 → 1.0.179
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 +26 -5
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +26 -5
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +26 -5
- package/dist/index.mjs.map +2 -2
- package/dist/types/swell.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3268,13 +3268,20 @@
|
|
|
3268
3268
|
blocks: props.Blocks?.filter(
|
|
3269
3269
|
(propBlock) => Boolean(propBlock.props.compiled?._component)
|
|
3270
3270
|
).map((propBlock) => {
|
|
3271
|
-
const
|
|
3272
|
-
|
|
3271
|
+
const {
|
|
3272
|
+
_id: id,
|
|
3273
|
+
_component: component,
|
|
3274
|
+
disabled: isDisabled,
|
|
3275
|
+
props: blockProps
|
|
3276
|
+
} = propBlock.props.compiled;
|
|
3277
|
+
const blockType = component.split("__")[2];
|
|
3273
3278
|
const blockSchema = sectionSchema.blocks?.find(
|
|
3274
3279
|
(block) => block.type === blockType
|
|
3275
3280
|
);
|
|
3276
3281
|
return {
|
|
3282
|
+
id,
|
|
3277
3283
|
type: blockType,
|
|
3284
|
+
disabled: isDisabled,
|
|
3278
3285
|
settings: blockSchema?.fields?.reduce(
|
|
3279
3286
|
(acc, field) => {
|
|
3280
3287
|
if (field?.id) {
|
|
@@ -13031,7 +13038,7 @@ ${formattedMessage}`;
|
|
|
13031
13038
|
accepts_marketing: defer(() => account.email_optin),
|
|
13032
13039
|
addresses: deferWith(
|
|
13033
13040
|
account.addresses,
|
|
13034
|
-
(addresses) => addresses
|
|
13041
|
+
(addresses) => (addresses?.results || []).map(
|
|
13035
13042
|
(address) => ShopifyAddress(instance, address)
|
|
13036
13043
|
)
|
|
13037
13044
|
),
|
|
@@ -13067,7 +13074,9 @@ ${formattedMessage}`;
|
|
|
13067
13074
|
name: defer(() => account.name),
|
|
13068
13075
|
orders: deferWith(
|
|
13069
13076
|
account.orders,
|
|
13070
|
-
(orders) => orders
|
|
13077
|
+
(orders) => (orders?.results || []).map(
|
|
13078
|
+
(order) => ShopifyOrder(instance, order)
|
|
13079
|
+
)
|
|
13071
13080
|
),
|
|
13072
13081
|
orders_count: defer(() => account.order_count),
|
|
13073
13082
|
payment_methods: [],
|
|
@@ -14791,7 +14800,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
14791
14800
|
const value = yield (0, import_liquidjs16.evalToken)(valueToken, ctx, ctx.opts.lenientIf);
|
|
14792
14801
|
if (target === value) {
|
|
14793
14802
|
const blockOutput = yield r.renderTemplates(branch.templates, ctx);
|
|
14794
|
-
output +=
|
|
14803
|
+
output += blockOutput;
|
|
14795
14804
|
branchHit = true;
|
|
14796
14805
|
break;
|
|
14797
14806
|
}
|
|
@@ -18816,6 +18825,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
18816
18825
|
);
|
|
18817
18826
|
blocks = blocks?.map((block) => ({
|
|
18818
18827
|
...block,
|
|
18828
|
+
...getBlockAttributes(theme, block),
|
|
18819
18829
|
settings: resolveThemeSettings(
|
|
18820
18830
|
theme,
|
|
18821
18831
|
block.settings,
|
|
@@ -18957,6 +18967,17 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
18957
18967
|
}
|
|
18958
18968
|
return null;
|
|
18959
18969
|
}
|
|
18970
|
+
function getBlockAttributes(theme, block) {
|
|
18971
|
+
if (!theme.swell.isEditor) {
|
|
18972
|
+
return;
|
|
18973
|
+
}
|
|
18974
|
+
const { id } = block;
|
|
18975
|
+
const attributes = `data-editor-block="${JSON.stringify({ id }).replaceAll('"', """)}"`;
|
|
18976
|
+
return {
|
|
18977
|
+
swell_attributes: attributes,
|
|
18978
|
+
shopify_attributes: attributes
|
|
18979
|
+
};
|
|
18980
|
+
}
|
|
18960
18981
|
function parseJsonConfig(config) {
|
|
18961
18982
|
try {
|
|
18962
18983
|
return import_json56.default.parse(config?.file_data || "{}");
|