@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.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) {
|
|
@@ -13004,7 +13011,7 @@ function ShopifyCustomer(instance, account) {
|
|
|
13004
13011
|
accepts_marketing: defer(() => account.email_optin),
|
|
13005
13012
|
addresses: deferWith(
|
|
13006
13013
|
account.addresses,
|
|
13007
|
-
(addresses) => addresses
|
|
13014
|
+
(addresses) => (addresses?.results || []).map(
|
|
13008
13015
|
(address) => ShopifyAddress(instance, address)
|
|
13009
13016
|
)
|
|
13010
13017
|
),
|
|
@@ -13040,7 +13047,9 @@ function ShopifyCustomer(instance, account) {
|
|
|
13040
13047
|
name: defer(() => account.name),
|
|
13041
13048
|
orders: deferWith(
|
|
13042
13049
|
account.orders,
|
|
13043
|
-
(orders) => orders
|
|
13050
|
+
(orders) => (orders?.results || []).map(
|
|
13051
|
+
(order) => ShopifyOrder(instance, order)
|
|
13052
|
+
)
|
|
13044
13053
|
),
|
|
13045
13054
|
orders_count: defer(() => account.order_count),
|
|
13046
13055
|
payment_methods: [],
|
|
@@ -14767,7 +14776,7 @@ function bind2(liquidSwell) {
|
|
|
14767
14776
|
const value = yield evalToken(valueToken, ctx, ctx.opts.lenientIf);
|
|
14768
14777
|
if (target === value) {
|
|
14769
14778
|
const blockOutput = yield r.renderTemplates(branch.templates, ctx);
|
|
14770
|
-
output +=
|
|
14779
|
+
output += blockOutput;
|
|
14771
14780
|
branchHit = true;
|
|
14772
14781
|
break;
|
|
14773
14782
|
}
|
|
@@ -18797,6 +18806,7 @@ function resolveSectionSettings(theme, sectionConfig, index) {
|
|
|
18797
18806
|
);
|
|
18798
18807
|
blocks = blocks?.map((block) => ({
|
|
18799
18808
|
...block,
|
|
18809
|
+
...getBlockAttributes(theme, block),
|
|
18800
18810
|
settings: resolveThemeSettings(
|
|
18801
18811
|
theme,
|
|
18802
18812
|
block.settings,
|
|
@@ -18938,6 +18948,17 @@ function findEditorSetting(editorSchemaSettings, key) {
|
|
|
18938
18948
|
}
|
|
18939
18949
|
return null;
|
|
18940
18950
|
}
|
|
18951
|
+
function getBlockAttributes(theme, block) {
|
|
18952
|
+
if (!theme.swell.isEditor) {
|
|
18953
|
+
return;
|
|
18954
|
+
}
|
|
18955
|
+
const { id } = block;
|
|
18956
|
+
const attributes = `data-editor-block="${JSON.stringify({ id }).replaceAll('"', """)}"`;
|
|
18957
|
+
return {
|
|
18958
|
+
swell_attributes: attributes,
|
|
18959
|
+
shopify_attributes: attributes
|
|
18960
|
+
};
|
|
18961
|
+
}
|
|
18941
18962
|
function parseJsonConfig(config) {
|
|
18942
18963
|
try {
|
|
18943
18964
|
return JSON56.parse(config?.file_data || "{}");
|