@swell/apps-sdk 1.0.175 → 1.0.176
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 +168 -122
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +167 -121
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +168 -122
- package/dist/index.mjs.map +4 -4
- package/dist/src/liquid/filters/index.d.ts +2 -0
- package/dist/src/liquid/filters/minus.d.ts +2 -0
- package/dist/src/liquid/operators.d.ts +7 -1
- package/dist/src/theme.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4644,8 +4644,8 @@
|
|
|
4644
4644
|
{ value: "popularity", name: "Popularity", query: "popularity desc" },
|
|
4645
4645
|
{ value: "price_asc", name: "Price, low to high", query: "price asc" },
|
|
4646
4646
|
{ value: "price_desc", name: "Price, high to low", query: "price desc" },
|
|
4647
|
-
{ value: "date_asc", name: "Date, old to new", query: "
|
|
4648
|
-
{ value: "date_desc", name: "Date, new to old", query: "
|
|
4647
|
+
{ value: "date_asc", name: "Date, old to new", query: "date_created asc" },
|
|
4648
|
+
{ value: "date_desc", name: "Date, new to old", query: "date_created desc" },
|
|
4649
4649
|
{ value: "name_asc", name: "Product name, A-Z", query: "name asc" },
|
|
4650
4650
|
{ value: "name_desc", name: "Product name, Z-A", query: "name desc" }
|
|
4651
4651
|
]);
|
|
@@ -5438,23 +5438,58 @@ ${formattedMessage}`;
|
|
|
5438
5438
|
// src/easyblocks/config.ts
|
|
5439
5439
|
var import_json53 = __toESM(__require("json5"), 1);
|
|
5440
5440
|
var import_lodash_es4 = __require("lodash-es");
|
|
5441
|
+
|
|
5442
|
+
// src/compatibility/drops/template.ts
|
|
5443
|
+
var import_liquidjs3 = __require("liquidjs");
|
|
5444
|
+
var TemplateDrop = class extends import_liquidjs3.Drop {
|
|
5445
|
+
constructor(name, directory, suffix) {
|
|
5446
|
+
super();
|
|
5447
|
+
this.name = name;
|
|
5448
|
+
this.directory = directory;
|
|
5449
|
+
this.suffix = suffix;
|
|
5450
|
+
}
|
|
5451
|
+
valueOf() {
|
|
5452
|
+
return this.name;
|
|
5453
|
+
}
|
|
5454
|
+
};
|
|
5455
|
+
|
|
5456
|
+
// src/compatibility/shopify-objects/template.ts
|
|
5457
|
+
function ShopifyTemplate(instance, template) {
|
|
5458
|
+
return new TemplateDrop(
|
|
5459
|
+
instance.getPageType(template.name),
|
|
5460
|
+
template.path,
|
|
5461
|
+
template.alt_name
|
|
5462
|
+
);
|
|
5463
|
+
}
|
|
5464
|
+
|
|
5465
|
+
// src/easyblocks/config.ts
|
|
5441
5466
|
var NO_INLINE = true;
|
|
5442
5467
|
async function getEasyblocksPageTemplate(theme, pageId, altTemplate) {
|
|
5443
5468
|
let templateConfig = null;
|
|
5469
|
+
let templateData = {
|
|
5470
|
+
name: pageId
|
|
5471
|
+
};
|
|
5472
|
+
if (theme.shopifyCompatibility) {
|
|
5473
|
+
templateData = ShopifyTemplate(theme.shopifyCompatibility, templateData);
|
|
5474
|
+
}
|
|
5475
|
+
const { name } = templateData;
|
|
5444
5476
|
templateConfig = await theme.getThemeTemplateConfigByType(
|
|
5445
5477
|
"templates",
|
|
5446
|
-
|
|
5478
|
+
name,
|
|
5447
5479
|
altTemplate
|
|
5448
5480
|
);
|
|
5449
5481
|
if (templateConfig) {
|
|
5450
|
-
|
|
5451
|
-
|
|
5482
|
+
let result = templateConfig.file_data;
|
|
5483
|
+
if (!templateConfig.file_path.endsWith(".liquid")) {
|
|
5484
|
+
try {
|
|
5485
|
+
result = import_json53.default.parse(templateConfig.file_data);
|
|
5486
|
+
} catch {
|
|
5487
|
+
}
|
|
5452
5488
|
}
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
} catch {
|
|
5456
|
-
return templateConfig.file_data;
|
|
5489
|
+
if (result && typeof result === "object") {
|
|
5490
|
+
result.id = name;
|
|
5457
5491
|
}
|
|
5492
|
+
return result;
|
|
5458
5493
|
}
|
|
5459
5494
|
}
|
|
5460
5495
|
function getAcceptedLayoutSections(allSections, groupType) {
|
|
@@ -11396,11 +11431,11 @@ ${formattedMessage}`;
|
|
|
11396
11431
|
});
|
|
11397
11432
|
|
|
11398
11433
|
// src/compatibility/drops/image.ts
|
|
11399
|
-
var
|
|
11434
|
+
var import_liquidjs5 = __require("liquidjs");
|
|
11400
11435
|
|
|
11401
11436
|
// src/compatibility/drops/image-src.ts
|
|
11402
|
-
var
|
|
11403
|
-
var ImageSrcDrop = class extends
|
|
11437
|
+
var import_liquidjs4 = __require("liquidjs");
|
|
11438
|
+
var ImageSrcDrop = class extends import_liquidjs4.Drop {
|
|
11404
11439
|
constructor(url, width, height) {
|
|
11405
11440
|
super();
|
|
11406
11441
|
this.url = url;
|
|
@@ -11423,7 +11458,7 @@ ${formattedMessage}`;
|
|
|
11423
11458
|
};
|
|
11424
11459
|
|
|
11425
11460
|
// src/compatibility/drops/image.ts
|
|
11426
|
-
var ImageDrop = class extends
|
|
11461
|
+
var ImageDrop = class extends import_liquidjs5.Drop {
|
|
11427
11462
|
id;
|
|
11428
11463
|
alt;
|
|
11429
11464
|
src;
|
|
@@ -11634,7 +11669,9 @@ ${formattedMessage}`;
|
|
|
11634
11669
|
),
|
|
11635
11670
|
barcode: void 0,
|
|
11636
11671
|
compare_at_price: defer(
|
|
11637
|
-
() => instance.toShopifyPrice(
|
|
11672
|
+
() => instance.toShopifyPrice(
|
|
11673
|
+
getPriceField(product, variant, "orig_price")
|
|
11674
|
+
)
|
|
11638
11675
|
),
|
|
11639
11676
|
featured_image: deferWith(
|
|
11640
11677
|
[product, variant],
|
|
@@ -11681,13 +11718,14 @@ ${formattedMessage}`;
|
|
|
11681
11718
|
// Deprecated by Shopify
|
|
11682
11719
|
option3: getOptionByIndex(product, variant, 2),
|
|
11683
11720
|
// Deprecated by Shopify
|
|
11684
|
-
price: deferWith(
|
|
11685
|
-
|
|
11686
|
-
|
|
11687
|
-
|
|
11721
|
+
price: deferWith(
|
|
11722
|
+
[product, variant],
|
|
11723
|
+
(product2, variant2) => {
|
|
11724
|
+
return instance.toShopifyPrice(
|
|
11725
|
+
getPriceField(product2, variant2, "price")
|
|
11726
|
+
);
|
|
11688
11727
|
}
|
|
11689
|
-
|
|
11690
|
-
}),
|
|
11728
|
+
),
|
|
11691
11729
|
product: deferWith(product, (product2) => {
|
|
11692
11730
|
return ShopifyProduct(
|
|
11693
11731
|
instance,
|
|
@@ -11726,7 +11764,11 @@ ${formattedMessage}`;
|
|
|
11726
11764
|
store_availabilities: [],
|
|
11727
11765
|
taxable: true,
|
|
11728
11766
|
title: defer(() => variant.name),
|
|
11729
|
-
unit_price: defer(
|
|
11767
|
+
unit_price: defer(
|
|
11768
|
+
() => instance.toShopifyPrice(
|
|
11769
|
+
getPriceField(product, variant, "price")
|
|
11770
|
+
)
|
|
11771
|
+
),
|
|
11730
11772
|
unit_price_measurement: void 0,
|
|
11731
11773
|
url: defer(() => product.url),
|
|
11732
11774
|
weight: defer(() => variant.weight),
|
|
@@ -11750,6 +11792,9 @@ ${formattedMessage}`;
|
|
|
11750
11792
|
return variant2.option_value_ids.map((id) => optionValuesById[id]).filter(Boolean);
|
|
11751
11793
|
});
|
|
11752
11794
|
}
|
|
11795
|
+
function getPriceField(product, variant, field) {
|
|
11796
|
+
return variant[field] ?? product[field];
|
|
11797
|
+
}
|
|
11753
11798
|
function getOptionByIndex(product, variant, index) {
|
|
11754
11799
|
return deferWith(
|
|
11755
11800
|
[product, variant],
|
|
@@ -12177,7 +12222,12 @@ ${formattedMessage}`;
|
|
|
12177
12222
|
return instance.toShopifyPrice(product2.price);
|
|
12178
12223
|
}
|
|
12179
12224
|
const max = product2.variants.results.reduce(
|
|
12180
|
-
(max2, variant) =>
|
|
12225
|
+
(max2, variant) => {
|
|
12226
|
+
if (variant.price === void 0 || variant.price === null) {
|
|
12227
|
+
return max2;
|
|
12228
|
+
}
|
|
12229
|
+
return Math.max(max2, variant.price);
|
|
12230
|
+
},
|
|
12181
12231
|
0
|
|
12182
12232
|
);
|
|
12183
12233
|
return instance.toShopifyPrice(max);
|
|
@@ -12187,7 +12237,12 @@ ${formattedMessage}`;
|
|
|
12187
12237
|
return instance.toShopifyPrice(product2.price);
|
|
12188
12238
|
}
|
|
12189
12239
|
const min = product2.variants.results.reduce(
|
|
12190
|
-
(min2, variant) =>
|
|
12240
|
+
(min2, variant) => {
|
|
12241
|
+
if (variant.price === void 0 || variant.price === null) {
|
|
12242
|
+
return min2;
|
|
12243
|
+
}
|
|
12244
|
+
return Math.min(min2, variant.price);
|
|
12245
|
+
},
|
|
12191
12246
|
Infinity
|
|
12192
12247
|
);
|
|
12193
12248
|
return instance.toShopifyPrice(min);
|
|
@@ -12197,7 +12252,7 @@ ${formattedMessage}`;
|
|
|
12197
12252
|
return false;
|
|
12198
12253
|
}
|
|
12199
12254
|
return product2.variants.results.some(
|
|
12200
|
-
(variant) => variant.price !== product2.price
|
|
12255
|
+
(variant) => variant.price !== void 0 && variant.price !== null && variant.price !== product2.price
|
|
12201
12256
|
);
|
|
12202
12257
|
}),
|
|
12203
12258
|
published_at: deferWith(
|
|
@@ -12936,8 +12991,8 @@ ${formattedMessage}`;
|
|
|
12936
12991
|
}
|
|
12937
12992
|
|
|
12938
12993
|
// src/compatibility/drops/money.ts
|
|
12939
|
-
var
|
|
12940
|
-
var MoneyDrop = class extends
|
|
12994
|
+
var import_liquidjs6 = __require("liquidjs");
|
|
12995
|
+
var MoneyDrop = class extends import_liquidjs6.Drop {
|
|
12941
12996
|
constructor(value, decimals, currency) {
|
|
12942
12997
|
super();
|
|
12943
12998
|
this.value = value;
|
|
@@ -13530,8 +13585,8 @@ ${formattedMessage}`;
|
|
|
13530
13585
|
}
|
|
13531
13586
|
|
|
13532
13587
|
// src/compatibility/drops/all_products.ts
|
|
13533
|
-
var
|
|
13534
|
-
var AllProductsDrop = class extends
|
|
13588
|
+
var import_liquidjs7 = __require("liquidjs");
|
|
13589
|
+
var AllProductsDrop = class extends import_liquidjs7.Drop {
|
|
13535
13590
|
#instance;
|
|
13536
13591
|
#map;
|
|
13537
13592
|
constructor(instance) {
|
|
@@ -13573,8 +13628,8 @@ ${formattedMessage}`;
|
|
|
13573
13628
|
};
|
|
13574
13629
|
|
|
13575
13630
|
// src/compatibility/drops/articles.ts
|
|
13576
|
-
var
|
|
13577
|
-
var ArticlesDrop = class extends
|
|
13631
|
+
var import_liquidjs8 = __require("liquidjs");
|
|
13632
|
+
var ArticlesDrop = class extends import_liquidjs8.Drop {
|
|
13578
13633
|
#instance;
|
|
13579
13634
|
#map;
|
|
13580
13635
|
constructor(instance) {
|
|
@@ -13616,8 +13671,8 @@ ${formattedMessage}`;
|
|
|
13616
13671
|
};
|
|
13617
13672
|
|
|
13618
13673
|
// src/compatibility/drops/blogs.ts
|
|
13619
|
-
var
|
|
13620
|
-
var BlogsDrop = class extends
|
|
13674
|
+
var import_liquidjs9 = __require("liquidjs");
|
|
13675
|
+
var BlogsDrop = class extends import_liquidjs9.Drop {
|
|
13621
13676
|
#instance;
|
|
13622
13677
|
#map;
|
|
13623
13678
|
constructor(instance) {
|
|
@@ -13663,7 +13718,7 @@ ${formattedMessage}`;
|
|
|
13663
13718
|
};
|
|
13664
13719
|
|
|
13665
13720
|
// src/compatibility/drops/collections.ts
|
|
13666
|
-
var
|
|
13721
|
+
var import_liquidjs10 = __require("liquidjs");
|
|
13667
13722
|
var AllCategoryResource = class extends StorefrontResource {
|
|
13668
13723
|
constructor(instance) {
|
|
13669
13724
|
super(() => {
|
|
@@ -13677,7 +13732,7 @@ ${formattedMessage}`;
|
|
|
13677
13732
|
});
|
|
13678
13733
|
}
|
|
13679
13734
|
};
|
|
13680
|
-
var CollectionsDrop = class extends
|
|
13735
|
+
var CollectionsDrop = class extends import_liquidjs10.Drop {
|
|
13681
13736
|
#instance;
|
|
13682
13737
|
#map;
|
|
13683
13738
|
constructor(instance) {
|
|
@@ -13794,8 +13849,8 @@ ${formattedMessage}`;
|
|
|
13794
13849
|
};
|
|
13795
13850
|
|
|
13796
13851
|
// src/compatibility/drops/images.ts
|
|
13797
|
-
var
|
|
13798
|
-
var ImagesDrop = class extends
|
|
13852
|
+
var import_liquidjs11 = __require("liquidjs");
|
|
13853
|
+
var ImagesDrop = class extends import_liquidjs11.Drop {
|
|
13799
13854
|
#instance;
|
|
13800
13855
|
#map;
|
|
13801
13856
|
constructor(instance) {
|
|
@@ -13849,8 +13904,8 @@ ${formattedMessage}`;
|
|
|
13849
13904
|
};
|
|
13850
13905
|
|
|
13851
13906
|
// src/compatibility/drops/object-handles.ts
|
|
13852
|
-
var
|
|
13853
|
-
var ObjectHandlesDrop = class extends
|
|
13907
|
+
var import_liquidjs12 = __require("liquidjs");
|
|
13908
|
+
var ObjectHandlesDrop = class extends import_liquidjs12.Drop {
|
|
13854
13909
|
#map;
|
|
13855
13910
|
constructor(map) {
|
|
13856
13911
|
super();
|
|
@@ -13890,8 +13945,8 @@ ${formattedMessage}`;
|
|
|
13890
13945
|
};
|
|
13891
13946
|
|
|
13892
13947
|
// src/compatibility/drops/pages.ts
|
|
13893
|
-
var
|
|
13894
|
-
var PagesDrop = class extends
|
|
13948
|
+
var import_liquidjs13 = __require("liquidjs");
|
|
13949
|
+
var PagesDrop = class extends import_liquidjs13.Drop {
|
|
13895
13950
|
#instance;
|
|
13896
13951
|
#map;
|
|
13897
13952
|
constructor(instance) {
|
|
@@ -14590,29 +14645,6 @@ ${injects.join("\n")}<\/script>`;
|
|
|
14590
14645
|
}
|
|
14591
14646
|
};
|
|
14592
14647
|
|
|
14593
|
-
// src/compatibility/drops/template.ts
|
|
14594
|
-
var import_liquidjs13 = __require("liquidjs");
|
|
14595
|
-
var TemplateDrop = class extends import_liquidjs13.Drop {
|
|
14596
|
-
constructor(name, directory, suffix) {
|
|
14597
|
-
super();
|
|
14598
|
-
this.name = name;
|
|
14599
|
-
this.directory = directory;
|
|
14600
|
-
this.suffix = suffix;
|
|
14601
|
-
}
|
|
14602
|
-
valueOf() {
|
|
14603
|
-
return this.name;
|
|
14604
|
-
}
|
|
14605
|
-
};
|
|
14606
|
-
|
|
14607
|
-
// src/compatibility/shopify-objects/template.ts
|
|
14608
|
-
function ShopifyTemplate(instance, template) {
|
|
14609
|
-
return new TemplateDrop(
|
|
14610
|
-
instance.getPageType(template.name),
|
|
14611
|
-
template.path,
|
|
14612
|
-
template.alt_name
|
|
14613
|
-
);
|
|
14614
|
-
}
|
|
14615
|
-
|
|
14616
14648
|
// src/liquid/drops/render.ts
|
|
14617
14649
|
var import_liquidjs14 = __require("liquidjs");
|
|
14618
14650
|
var import_lodash_es8 = __require("lodash-es");
|
|
@@ -15271,12 +15303,12 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15271
15303
|
});
|
|
15272
15304
|
});
|
|
15273
15305
|
if (output && schema && settings) {
|
|
15274
|
-
const { shopify_compatibility: shopifyCompatibility } = liquidSwell.theme.globals;
|
|
15275
15306
|
const tag = schema.tag || "div";
|
|
15276
|
-
const
|
|
15277
|
-
const
|
|
15307
|
+
const sectionClassName = liquidSwell.theme.getSectionClassName();
|
|
15308
|
+
const sectionIdPrefix = liquidSwell.theme.getSectionIdPrefix();
|
|
15309
|
+
const id = `${sectionIdPrefix}-${settings.id || this.fileName}`;
|
|
15278
15310
|
emitter.write(
|
|
15279
|
-
`<${tag} id="${id}" class="${
|
|
15311
|
+
`<${tag} id="${id}" class="${sectionClassName} ${schema.class || ""}">${output}</${tag}>`
|
|
15280
15312
|
);
|
|
15281
15313
|
}
|
|
15282
15314
|
}
|
|
@@ -15308,12 +15340,13 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15308
15340
|
const sectionConfigs = yield liquidSwell.renderPageSections(
|
|
15309
15341
|
sectionGroup
|
|
15310
15342
|
);
|
|
15311
|
-
const
|
|
15343
|
+
const sectionClassName = liquidSwell.theme.getSectionClassName();
|
|
15344
|
+
const sectionIdPrefix = liquidSwell.theme.getSectionIdPrefix();
|
|
15312
15345
|
emitter.write(
|
|
15313
15346
|
`<div id="swell-section-group__${this.fileName}">${sectionConfigs.map((section) => {
|
|
15314
15347
|
const tag = section.tag || "div";
|
|
15315
|
-
const id = `${
|
|
15316
|
-
const className =
|
|
15348
|
+
const id = `${sectionIdPrefix}-sections--${themeConfig.hash}__${section.id}`;
|
|
15349
|
+
const className = `${sectionClassName} ${sectionClassName}-group-${this.fileName} section-${section.id}`;
|
|
15317
15350
|
return `<${tag} id="${id}" class="${className} ${section.class || ""}">${section.output}</${tag}>`;
|
|
15318
15351
|
}).join("")}</div>`
|
|
15319
15352
|
);
|
|
@@ -15498,7 +15531,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15498
15531
|
};
|
|
15499
15532
|
function bindTags(liquidSwell) {
|
|
15500
15533
|
Object.entries(tags).forEach(
|
|
15501
|
-
([tag,
|
|
15534
|
+
([tag, bind66]) => liquidSwell.registerTag(tag, bind66(liquidSwell))
|
|
15502
15535
|
);
|
|
15503
15536
|
}
|
|
15504
15537
|
|
|
@@ -16051,8 +16084,17 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16051
16084
|
};
|
|
16052
16085
|
}
|
|
16053
16086
|
|
|
16087
|
+
// src/liquid/filters/minus.ts
|
|
16088
|
+
function bind47(_liquidSwell) {
|
|
16089
|
+
return (first, second) => {
|
|
16090
|
+
const firstValue = isNumber(first) ? first : 0;
|
|
16091
|
+
const secondValue = isNumber(second) ? second : 0;
|
|
16092
|
+
return firstValue - secondValue;
|
|
16093
|
+
};
|
|
16094
|
+
}
|
|
16095
|
+
|
|
16054
16096
|
// src/liquid/filters/money.ts
|
|
16055
|
-
function
|
|
16097
|
+
function bind48(liquidSwell) {
|
|
16056
16098
|
return function filterMoney(value) {
|
|
16057
16099
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16058
16100
|
return liquidSwell.renderCurrency(amount);
|
|
@@ -16069,7 +16111,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16069
16111
|
}
|
|
16070
16112
|
|
|
16071
16113
|
// src/liquid/filters/money_with_currency.ts
|
|
16072
|
-
function
|
|
16114
|
+
function bind49(liquidSwell) {
|
|
16073
16115
|
return function filterMoneyWithCurrency(value) {
|
|
16074
16116
|
const { currency } = liquidSwell.theme.swell.getStorefrontLocalization();
|
|
16075
16117
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
@@ -16078,7 +16120,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16078
16120
|
}
|
|
16079
16121
|
|
|
16080
16122
|
// src/liquid/filters/money_without_currency.ts
|
|
16081
|
-
function
|
|
16123
|
+
function bind50(liquidSwell) {
|
|
16082
16124
|
return function filterMoneyWithoutCurrency(value) {
|
|
16083
16125
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16084
16126
|
return liquidSwell.renderCurrency(amount).replace(/[^0-9.,]/g, "");
|
|
@@ -16086,7 +16128,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16086
16128
|
}
|
|
16087
16129
|
|
|
16088
16130
|
// src/liquid/filters/money_without_trailing_zeros.ts
|
|
16089
|
-
function
|
|
16131
|
+
function bind51(liquidSwell) {
|
|
16090
16132
|
return function filterMoneyWithoutTrailingZeros(value) {
|
|
16091
16133
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16092
16134
|
return liquidSwell.renderCurrency(amount).split(".")[0].split(",")[0];
|
|
@@ -16094,21 +16136,21 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16094
16136
|
}
|
|
16095
16137
|
|
|
16096
16138
|
// src/liquid/filters/script_tag.ts
|
|
16097
|
-
function
|
|
16139
|
+
function bind52(_liquidSwell) {
|
|
16098
16140
|
return function filterScriptTag(assetUrl) {
|
|
16099
16141
|
return `<script src="${assetUrl}" type="text/javascript"><\/script>`;
|
|
16100
16142
|
};
|
|
16101
16143
|
}
|
|
16102
16144
|
|
|
16103
16145
|
// src/liquid/filters/stylesheet_tag.ts
|
|
16104
|
-
function
|
|
16146
|
+
function bind53(_liquidSwell) {
|
|
16105
16147
|
return function filterStyleSheetTag(assetUrl) {
|
|
16106
16148
|
return `<link href="${assetUrl}" rel="stylesheet" type="text/css" media="all" />`;
|
|
16107
16149
|
};
|
|
16108
16150
|
}
|
|
16109
16151
|
|
|
16110
16152
|
// src/liquid/filters/time_tag.ts
|
|
16111
|
-
function
|
|
16153
|
+
function bind54(_liquidSwell) {
|
|
16112
16154
|
const dateFilter = bind33(_liquidSwell);
|
|
16113
16155
|
return (dateValue, ...params) => {
|
|
16114
16156
|
const date = ensureDate(dateValue);
|
|
@@ -16119,7 +16161,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16119
16161
|
}
|
|
16120
16162
|
|
|
16121
16163
|
// src/liquid/filters/translate.ts
|
|
16122
|
-
function
|
|
16164
|
+
function bind55(liquidSwell) {
|
|
16123
16165
|
return async function filterTranslate(key, params) {
|
|
16124
16166
|
const props = params && paramsToProps(params);
|
|
16125
16167
|
const str = await liquidSwell.renderTranslation(key, props);
|
|
@@ -16128,7 +16170,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16128
16170
|
}
|
|
16129
16171
|
|
|
16130
16172
|
// src/liquid/filters/where.ts
|
|
16131
|
-
function
|
|
16173
|
+
function bind56(_liquidSwell) {
|
|
16132
16174
|
return function* filterWhere(arr, property, expected) {
|
|
16133
16175
|
const results = [];
|
|
16134
16176
|
const list = yield resolveEnumerable(arr);
|
|
@@ -16182,7 +16224,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16182
16224
|
height: height ? Number(height) : void 0
|
|
16183
16225
|
};
|
|
16184
16226
|
}
|
|
16185
|
-
function
|
|
16227
|
+
function bind57(liquidSwell) {
|
|
16186
16228
|
return async function filterAssetImgUrl(assetPath, size = "small") {
|
|
16187
16229
|
const imageUrl = await liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
|
|
16188
16230
|
const sizes = getSizesFromParam(size);
|
|
@@ -16198,14 +16240,14 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16198
16240
|
}
|
|
16199
16241
|
|
|
16200
16242
|
// src/liquid/filters/shopify/hex_to_rgba.ts
|
|
16201
|
-
function
|
|
16243
|
+
function bind58(_liquidSwell) {
|
|
16202
16244
|
return (color, alpha) => {
|
|
16203
16245
|
return ThemeColor.get(color).rgba(alpha || 1);
|
|
16204
16246
|
};
|
|
16205
16247
|
}
|
|
16206
16248
|
|
|
16207
16249
|
// src/liquid/filters/shopify/img_url.ts
|
|
16208
|
-
function
|
|
16250
|
+
function bind59(_liquidSwell) {
|
|
16209
16251
|
return function filterImgUrl(input, ...params) {
|
|
16210
16252
|
if (!input) return "";
|
|
16211
16253
|
let url;
|
|
@@ -16250,14 +16292,14 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16250
16292
|
};
|
|
16251
16293
|
|
|
16252
16294
|
// src/liquid/filters/shopify/payment_button.ts
|
|
16253
|
-
function
|
|
16295
|
+
function bind60(_liquidSwell) {
|
|
16254
16296
|
return (form) => {
|
|
16255
16297
|
return null;
|
|
16256
16298
|
};
|
|
16257
16299
|
}
|
|
16258
16300
|
|
|
16259
16301
|
// src/liquid/filters/shopify/payment_terms.ts
|
|
16260
|
-
function
|
|
16302
|
+
function bind61(_liquidSwell) {
|
|
16261
16303
|
return (form) => {
|
|
16262
16304
|
return null;
|
|
16263
16305
|
};
|
|
@@ -16359,7 +16401,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16359
16401
|
var placeholder_svgs_default = svgs;
|
|
16360
16402
|
|
|
16361
16403
|
// src/liquid/filters/shopify/placeholder_svg_tag.ts
|
|
16362
|
-
function
|
|
16404
|
+
function bind62(_liquidSwell) {
|
|
16363
16405
|
return function filterPlaceholderSvgTag(name, className) {
|
|
16364
16406
|
const svg = placeholder_svgs_default[name];
|
|
16365
16407
|
if (typeof svg === "object" && svg !== null) {
|
|
@@ -16370,7 +16412,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16370
16412
|
}
|
|
16371
16413
|
|
|
16372
16414
|
// src/liquid/filters/shopify/shopify_asset_url.ts
|
|
16373
|
-
function
|
|
16415
|
+
function bind63(_liquidSwell) {
|
|
16374
16416
|
return function filterShopifyAssetUrl(input) {
|
|
16375
16417
|
if (typeof input === "string") {
|
|
16376
16418
|
switch (input) {
|
|
@@ -16395,7 +16437,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16395
16437
|
}
|
|
16396
16438
|
|
|
16397
16439
|
// src/liquid/filters/shopify/structured_data.ts
|
|
16398
|
-
function
|
|
16440
|
+
function bind64(_liquidSwell) {
|
|
16399
16441
|
return async function filterStructuredData(input) {
|
|
16400
16442
|
let value = input;
|
|
16401
16443
|
if (value instanceof StorefrontResource) {
|
|
@@ -16473,7 +16515,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16473
16515
|
}
|
|
16474
16516
|
|
|
16475
16517
|
// src/liquid/filters/inline_editable.ts
|
|
16476
|
-
function
|
|
16518
|
+
function bind65(_liquidSwell) {
|
|
16477
16519
|
return (value, key) => {
|
|
16478
16520
|
if (typeof value === "object" && "value" in value) {
|
|
16479
16521
|
value = value.value;
|
|
@@ -16517,29 +16559,30 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16517
16559
|
json: bind44,
|
|
16518
16560
|
json_pretty: bind45,
|
|
16519
16561
|
locale_flag: bind46,
|
|
16520
|
-
|
|
16521
|
-
|
|
16522
|
-
|
|
16523
|
-
|
|
16524
|
-
|
|
16525
|
-
|
|
16526
|
-
|
|
16527
|
-
|
|
16528
|
-
|
|
16562
|
+
minus: bind47,
|
|
16563
|
+
money: bind48,
|
|
16564
|
+
money_with_currency: bind49,
|
|
16565
|
+
money_without_currency: bind50,
|
|
16566
|
+
money_without_trailing_zeros: bind51,
|
|
16567
|
+
script_tag: bind52,
|
|
16568
|
+
stylesheet_tag: bind53,
|
|
16569
|
+
time_tag: bind54,
|
|
16570
|
+
translate: bind55,
|
|
16571
|
+
t: bind55,
|
|
16529
16572
|
// alias
|
|
16530
|
-
where:
|
|
16573
|
+
where: bind56,
|
|
16531
16574
|
// Shopify compatibility only
|
|
16532
|
-
asset_img_url:
|
|
16533
|
-
hex_to_rgba:
|
|
16534
|
-
img_url:
|
|
16575
|
+
asset_img_url: bind57,
|
|
16576
|
+
hex_to_rgba: bind58,
|
|
16577
|
+
img_url: bind59,
|
|
16535
16578
|
item_count_for_variant: item_count_for_variant_default,
|
|
16536
|
-
payment_button:
|
|
16537
|
-
payment_terms:
|
|
16538
|
-
placeholder_svg_tag:
|
|
16539
|
-
shopify_asset_url:
|
|
16540
|
-
structured_data:
|
|
16579
|
+
payment_button: bind60,
|
|
16580
|
+
payment_terms: bind61,
|
|
16581
|
+
placeholder_svg_tag: bind62,
|
|
16582
|
+
shopify_asset_url: bind63,
|
|
16583
|
+
structured_data: bind64,
|
|
16541
16584
|
// Swell only
|
|
16542
|
-
inline_editable:
|
|
16585
|
+
inline_editable: bind65
|
|
16543
16586
|
};
|
|
16544
16587
|
function bindFilters(liquidSwell) {
|
|
16545
16588
|
for (const [tag, handler] of Object.entries(filters)) {
|
|
@@ -16553,8 +16596,8 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16553
16596
|
}
|
|
16554
16597
|
}
|
|
16555
16598
|
}
|
|
16556
|
-
function bindWithResolvedProps(liquidSwell,
|
|
16557
|
-
const handler =
|
|
16599
|
+
function bindWithResolvedProps(liquidSwell, bind66, resolve = []) {
|
|
16600
|
+
const handler = bind66(liquidSwell);
|
|
16558
16601
|
if (!Array.isArray(resolve)) {
|
|
16559
16602
|
return handler;
|
|
16560
16603
|
}
|
|
@@ -16616,7 +16659,8 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16616
16659
|
if (isArray(l)) return l.some((i) => equal(i, r));
|
|
16617
16660
|
if (isFunction(l?.indexOf)) return l.indexOf(toValue(r)) > -1;
|
|
16618
16661
|
return false;
|
|
16619
|
-
}
|
|
16662
|
+
},
|
|
16663
|
+
",": (l, r) => `${l},${r}`
|
|
16620
16664
|
};
|
|
16621
16665
|
function equal(lhs, rhs) {
|
|
16622
16666
|
if (isComparable(lhs)) return lhs.equals(rhs);
|
|
@@ -16771,7 +16815,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16771
16815
|
}
|
|
16772
16816
|
|
|
16773
16817
|
// src/liquid/index.ts
|
|
16774
|
-
var
|
|
16818
|
+
var LiquidSwell31 = class extends import_liquidjs34.Liquid {
|
|
16775
16819
|
theme;
|
|
16776
16820
|
getThemeConfig;
|
|
16777
16821
|
getThemeTemplateConfigByType;
|
|
@@ -17445,7 +17489,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17445
17489
|
this.resources = resources;
|
|
17446
17490
|
this.dynamicAssetUrl = dynamicAssetUrl;
|
|
17447
17491
|
this.shopifyCompatibilityClass = shopifyCompatibilityClass || ShopifyCompatibility2;
|
|
17448
|
-
this.liquidSwell = new
|
|
17492
|
+
this.liquidSwell = new LiquidSwell31({
|
|
17449
17493
|
theme: this,
|
|
17450
17494
|
getThemeConfig: this.getThemeConfig.bind(this),
|
|
17451
17495
|
getAssetUrl: this.getAssetUrl.bind(this),
|
|
@@ -18363,6 +18407,12 @@ ${content.slice(pos)}`;
|
|
|
18363
18407
|
isShopify1HomePage(pageId, pageContent) {
|
|
18364
18408
|
return Boolean(pageId === "index" && typeof pageContent === "string");
|
|
18365
18409
|
}
|
|
18410
|
+
getSectionClassName() {
|
|
18411
|
+
return this.shopifyCompatibility ? "shopify-section" : "swell-section";
|
|
18412
|
+
}
|
|
18413
|
+
getSectionIdPrefix() {
|
|
18414
|
+
return this.shopifyCompatibility ? "shopify-section" : "swell-section";
|
|
18415
|
+
}
|
|
18366
18416
|
async renderAllSections(sectionsIds, pageData) {
|
|
18367
18417
|
const sections = typeof sectionsIds === "string" ? sectionsIds.split(/\s*,\s*/) : sectionsIds;
|
|
18368
18418
|
const sectionsRendered = await Promise.all(
|
|
@@ -18370,18 +18420,14 @@ ${content.slice(pos)}`;
|
|
|
18370
18420
|
return this.renderSection(sectionId, pageData);
|
|
18371
18421
|
})
|
|
18372
18422
|
);
|
|
18423
|
+
const sectionClassName = this.getSectionClassName();
|
|
18424
|
+
const sectionIdPrefix = this.getSectionIdPrefix();
|
|
18373
18425
|
return sectionsRendered.reduce(
|
|
18374
18426
|
(acc, section, index) => {
|
|
18375
18427
|
const sectionId = sections[index];
|
|
18376
|
-
|
|
18377
|
-
|
|
18378
|
-
<div id="shopify-section-${sectionId}" class="shopify-section">${String(section)}</div>
|
|
18428
|
+
acc[sectionId] = `
|
|
18429
|
+
<div id="${sectionIdPrefix}-${sectionId}" class="${sectionClassName}">${String(section)}</div>
|
|
18379
18430
|
`.trim();
|
|
18380
|
-
} else {
|
|
18381
|
-
acc[sectionId] = `
|
|
18382
|
-
<div id="swell-section-${sectionId}" class="swell-section">${String(section)}</div>
|
|
18383
|
-
`.trim();
|
|
18384
|
-
}
|
|
18385
18431
|
return acc;
|
|
18386
18432
|
},
|
|
18387
18433
|
{}
|