@swell/apps-sdk 1.0.175 → 1.0.177
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 +176 -124
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +175 -123
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +176 -124
- package/dist/index.mjs.map +4 -4
- 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/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;
|
|
@@ -13321,10 +13376,13 @@ ${formattedMessage}`;
|
|
|
13321
13376
|
if (search instanceof ShopifyResource) {
|
|
13322
13377
|
return search.clone();
|
|
13323
13378
|
}
|
|
13379
|
+
if (search instanceof StorefrontResource) {
|
|
13380
|
+
search = cloneStorefrontResource(search);
|
|
13381
|
+
}
|
|
13324
13382
|
return new ShopifyResource({
|
|
13325
|
-
performed:
|
|
13383
|
+
performed: deferWith(search, (search2) => search2.performed),
|
|
13326
13384
|
resources: ShopifyPredictiveSearchResources(instance, search),
|
|
13327
|
-
terms:
|
|
13385
|
+
terms: deferWith(search, (search2) => search2.query),
|
|
13328
13386
|
types: ["product"]
|
|
13329
13387
|
});
|
|
13330
13388
|
}
|
|
@@ -13395,6 +13453,9 @@ ${formattedMessage}`;
|
|
|
13395
13453
|
if (search instanceof ShopifyResource) {
|
|
13396
13454
|
return search.clone();
|
|
13397
13455
|
}
|
|
13456
|
+
if (search instanceof StorefrontResource) {
|
|
13457
|
+
search = cloneStorefrontResource(search);
|
|
13458
|
+
}
|
|
13398
13459
|
const resolveProducts = makeProductsCollectionResolve(
|
|
13399
13460
|
instance,
|
|
13400
13461
|
search,
|
|
@@ -13530,8 +13591,8 @@ ${formattedMessage}`;
|
|
|
13530
13591
|
}
|
|
13531
13592
|
|
|
13532
13593
|
// src/compatibility/drops/all_products.ts
|
|
13533
|
-
var
|
|
13534
|
-
var AllProductsDrop = class extends
|
|
13594
|
+
var import_liquidjs7 = __require("liquidjs");
|
|
13595
|
+
var AllProductsDrop = class extends import_liquidjs7.Drop {
|
|
13535
13596
|
#instance;
|
|
13536
13597
|
#map;
|
|
13537
13598
|
constructor(instance) {
|
|
@@ -13573,8 +13634,8 @@ ${formattedMessage}`;
|
|
|
13573
13634
|
};
|
|
13574
13635
|
|
|
13575
13636
|
// src/compatibility/drops/articles.ts
|
|
13576
|
-
var
|
|
13577
|
-
var ArticlesDrop = class extends
|
|
13637
|
+
var import_liquidjs8 = __require("liquidjs");
|
|
13638
|
+
var ArticlesDrop = class extends import_liquidjs8.Drop {
|
|
13578
13639
|
#instance;
|
|
13579
13640
|
#map;
|
|
13580
13641
|
constructor(instance) {
|
|
@@ -13616,8 +13677,8 @@ ${formattedMessage}`;
|
|
|
13616
13677
|
};
|
|
13617
13678
|
|
|
13618
13679
|
// src/compatibility/drops/blogs.ts
|
|
13619
|
-
var
|
|
13620
|
-
var BlogsDrop = class extends
|
|
13680
|
+
var import_liquidjs9 = __require("liquidjs");
|
|
13681
|
+
var BlogsDrop = class extends import_liquidjs9.Drop {
|
|
13621
13682
|
#instance;
|
|
13622
13683
|
#map;
|
|
13623
13684
|
constructor(instance) {
|
|
@@ -13663,7 +13724,7 @@ ${formattedMessage}`;
|
|
|
13663
13724
|
};
|
|
13664
13725
|
|
|
13665
13726
|
// src/compatibility/drops/collections.ts
|
|
13666
|
-
var
|
|
13727
|
+
var import_liquidjs10 = __require("liquidjs");
|
|
13667
13728
|
var AllCategoryResource = class extends StorefrontResource {
|
|
13668
13729
|
constructor(instance) {
|
|
13669
13730
|
super(() => {
|
|
@@ -13677,7 +13738,7 @@ ${formattedMessage}`;
|
|
|
13677
13738
|
});
|
|
13678
13739
|
}
|
|
13679
13740
|
};
|
|
13680
|
-
var CollectionsDrop = class extends
|
|
13741
|
+
var CollectionsDrop = class extends import_liquidjs10.Drop {
|
|
13681
13742
|
#instance;
|
|
13682
13743
|
#map;
|
|
13683
13744
|
constructor(instance) {
|
|
@@ -13794,8 +13855,8 @@ ${formattedMessage}`;
|
|
|
13794
13855
|
};
|
|
13795
13856
|
|
|
13796
13857
|
// src/compatibility/drops/images.ts
|
|
13797
|
-
var
|
|
13798
|
-
var ImagesDrop = class extends
|
|
13858
|
+
var import_liquidjs11 = __require("liquidjs");
|
|
13859
|
+
var ImagesDrop = class extends import_liquidjs11.Drop {
|
|
13799
13860
|
#instance;
|
|
13800
13861
|
#map;
|
|
13801
13862
|
constructor(instance) {
|
|
@@ -13849,8 +13910,8 @@ ${formattedMessage}`;
|
|
|
13849
13910
|
};
|
|
13850
13911
|
|
|
13851
13912
|
// src/compatibility/drops/object-handles.ts
|
|
13852
|
-
var
|
|
13853
|
-
var ObjectHandlesDrop = class extends
|
|
13913
|
+
var import_liquidjs12 = __require("liquidjs");
|
|
13914
|
+
var ObjectHandlesDrop = class extends import_liquidjs12.Drop {
|
|
13854
13915
|
#map;
|
|
13855
13916
|
constructor(map) {
|
|
13856
13917
|
super();
|
|
@@ -13890,8 +13951,8 @@ ${formattedMessage}`;
|
|
|
13890
13951
|
};
|
|
13891
13952
|
|
|
13892
13953
|
// src/compatibility/drops/pages.ts
|
|
13893
|
-
var
|
|
13894
|
-
var PagesDrop = class extends
|
|
13954
|
+
var import_liquidjs13 = __require("liquidjs");
|
|
13955
|
+
var PagesDrop = class extends import_liquidjs13.Drop {
|
|
13895
13956
|
#instance;
|
|
13896
13957
|
#map;
|
|
13897
13958
|
constructor(instance) {
|
|
@@ -14590,29 +14651,6 @@ ${injects.join("\n")}<\/script>`;
|
|
|
14590
14651
|
}
|
|
14591
14652
|
};
|
|
14592
14653
|
|
|
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
14654
|
// src/liquid/drops/render.ts
|
|
14617
14655
|
var import_liquidjs14 = __require("liquidjs");
|
|
14618
14656
|
var import_lodash_es8 = __require("lodash-es");
|
|
@@ -15271,12 +15309,12 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15271
15309
|
});
|
|
15272
15310
|
});
|
|
15273
15311
|
if (output && schema && settings) {
|
|
15274
|
-
const { shopify_compatibility: shopifyCompatibility } = liquidSwell.theme.globals;
|
|
15275
15312
|
const tag = schema.tag || "div";
|
|
15276
|
-
const
|
|
15277
|
-
const
|
|
15313
|
+
const sectionClassName = liquidSwell.theme.getSectionClassName();
|
|
15314
|
+
const sectionIdPrefix = liquidSwell.theme.getSectionIdPrefix();
|
|
15315
|
+
const id = `${sectionIdPrefix}-${settings.id || this.fileName}`;
|
|
15278
15316
|
emitter.write(
|
|
15279
|
-
`<${tag} id="${id}" class="${
|
|
15317
|
+
`<${tag} id="${id}" class="${sectionClassName} ${schema.class || ""}">${output}</${tag}>`
|
|
15280
15318
|
);
|
|
15281
15319
|
}
|
|
15282
15320
|
}
|
|
@@ -15308,12 +15346,13 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15308
15346
|
const sectionConfigs = yield liquidSwell.renderPageSections(
|
|
15309
15347
|
sectionGroup
|
|
15310
15348
|
);
|
|
15311
|
-
const
|
|
15349
|
+
const sectionClassName = liquidSwell.theme.getSectionClassName();
|
|
15350
|
+
const sectionIdPrefix = liquidSwell.theme.getSectionIdPrefix();
|
|
15312
15351
|
emitter.write(
|
|
15313
15352
|
`<div id="swell-section-group__${this.fileName}">${sectionConfigs.map((section) => {
|
|
15314
15353
|
const tag = section.tag || "div";
|
|
15315
|
-
const id = `${
|
|
15316
|
-
const className =
|
|
15354
|
+
const id = `${sectionIdPrefix}-sections--${themeConfig.hash}__${section.id}`;
|
|
15355
|
+
const className = `${sectionClassName} ${sectionClassName}-group-${this.fileName} section-${section.id}`;
|
|
15317
15356
|
return `<${tag} id="${id}" class="${className} ${section.class || ""}">${section.output}</${tag}>`;
|
|
15318
15357
|
}).join("")}</div>`
|
|
15319
15358
|
);
|
|
@@ -15498,7 +15537,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15498
15537
|
};
|
|
15499
15538
|
function bindTags(liquidSwell) {
|
|
15500
15539
|
Object.entries(tags).forEach(
|
|
15501
|
-
([tag,
|
|
15540
|
+
([tag, bind66]) => liquidSwell.registerTag(tag, bind66(liquidSwell))
|
|
15502
15541
|
);
|
|
15503
15542
|
}
|
|
15504
15543
|
|
|
@@ -16051,8 +16090,17 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16051
16090
|
};
|
|
16052
16091
|
}
|
|
16053
16092
|
|
|
16093
|
+
// src/liquid/filters/minus.ts
|
|
16094
|
+
function bind47(_liquidSwell) {
|
|
16095
|
+
return (first, second) => {
|
|
16096
|
+
const firstValue = isNumber(first) ? first : 0;
|
|
16097
|
+
const secondValue = isNumber(second) ? second : 0;
|
|
16098
|
+
return firstValue - secondValue;
|
|
16099
|
+
};
|
|
16100
|
+
}
|
|
16101
|
+
|
|
16054
16102
|
// src/liquid/filters/money.ts
|
|
16055
|
-
function
|
|
16103
|
+
function bind48(liquidSwell) {
|
|
16056
16104
|
return function filterMoney(value) {
|
|
16057
16105
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16058
16106
|
return liquidSwell.renderCurrency(amount);
|
|
@@ -16069,7 +16117,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16069
16117
|
}
|
|
16070
16118
|
|
|
16071
16119
|
// src/liquid/filters/money_with_currency.ts
|
|
16072
|
-
function
|
|
16120
|
+
function bind49(liquidSwell) {
|
|
16073
16121
|
return function filterMoneyWithCurrency(value) {
|
|
16074
16122
|
const { currency } = liquidSwell.theme.swell.getStorefrontLocalization();
|
|
16075
16123
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
@@ -16078,7 +16126,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16078
16126
|
}
|
|
16079
16127
|
|
|
16080
16128
|
// src/liquid/filters/money_without_currency.ts
|
|
16081
|
-
function
|
|
16129
|
+
function bind50(liquidSwell) {
|
|
16082
16130
|
return function filterMoneyWithoutCurrency(value) {
|
|
16083
16131
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16084
16132
|
return liquidSwell.renderCurrency(amount).replace(/[^0-9.,]/g, "");
|
|
@@ -16086,7 +16134,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16086
16134
|
}
|
|
16087
16135
|
|
|
16088
16136
|
// src/liquid/filters/money_without_trailing_zeros.ts
|
|
16089
|
-
function
|
|
16137
|
+
function bind51(liquidSwell) {
|
|
16090
16138
|
return function filterMoneyWithoutTrailingZeros(value) {
|
|
16091
16139
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16092
16140
|
return liquidSwell.renderCurrency(amount).split(".")[0].split(",")[0];
|
|
@@ -16094,21 +16142,21 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16094
16142
|
}
|
|
16095
16143
|
|
|
16096
16144
|
// src/liquid/filters/script_tag.ts
|
|
16097
|
-
function
|
|
16145
|
+
function bind52(_liquidSwell) {
|
|
16098
16146
|
return function filterScriptTag(assetUrl) {
|
|
16099
16147
|
return `<script src="${assetUrl}" type="text/javascript"><\/script>`;
|
|
16100
16148
|
};
|
|
16101
16149
|
}
|
|
16102
16150
|
|
|
16103
16151
|
// src/liquid/filters/stylesheet_tag.ts
|
|
16104
|
-
function
|
|
16152
|
+
function bind53(_liquidSwell) {
|
|
16105
16153
|
return function filterStyleSheetTag(assetUrl) {
|
|
16106
16154
|
return `<link href="${assetUrl}" rel="stylesheet" type="text/css" media="all" />`;
|
|
16107
16155
|
};
|
|
16108
16156
|
}
|
|
16109
16157
|
|
|
16110
16158
|
// src/liquid/filters/time_tag.ts
|
|
16111
|
-
function
|
|
16159
|
+
function bind54(_liquidSwell) {
|
|
16112
16160
|
const dateFilter = bind33(_liquidSwell);
|
|
16113
16161
|
return (dateValue, ...params) => {
|
|
16114
16162
|
const date = ensureDate(dateValue);
|
|
@@ -16119,7 +16167,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16119
16167
|
}
|
|
16120
16168
|
|
|
16121
16169
|
// src/liquid/filters/translate.ts
|
|
16122
|
-
function
|
|
16170
|
+
function bind55(liquidSwell) {
|
|
16123
16171
|
return async function filterTranslate(key, params) {
|
|
16124
16172
|
const props = params && paramsToProps(params);
|
|
16125
16173
|
const str = await liquidSwell.renderTranslation(key, props);
|
|
@@ -16128,7 +16176,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16128
16176
|
}
|
|
16129
16177
|
|
|
16130
16178
|
// src/liquid/filters/where.ts
|
|
16131
|
-
function
|
|
16179
|
+
function bind56(_liquidSwell) {
|
|
16132
16180
|
return function* filterWhere(arr, property, expected) {
|
|
16133
16181
|
const results = [];
|
|
16134
16182
|
const list = yield resolveEnumerable(arr);
|
|
@@ -16182,7 +16230,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16182
16230
|
height: height ? Number(height) : void 0
|
|
16183
16231
|
};
|
|
16184
16232
|
}
|
|
16185
|
-
function
|
|
16233
|
+
function bind57(liquidSwell) {
|
|
16186
16234
|
return async function filterAssetImgUrl(assetPath, size = "small") {
|
|
16187
16235
|
const imageUrl = await liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
|
|
16188
16236
|
const sizes = getSizesFromParam(size);
|
|
@@ -16198,14 +16246,14 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16198
16246
|
}
|
|
16199
16247
|
|
|
16200
16248
|
// src/liquid/filters/shopify/hex_to_rgba.ts
|
|
16201
|
-
function
|
|
16249
|
+
function bind58(_liquidSwell) {
|
|
16202
16250
|
return (color, alpha) => {
|
|
16203
16251
|
return ThemeColor.get(color).rgba(alpha || 1);
|
|
16204
16252
|
};
|
|
16205
16253
|
}
|
|
16206
16254
|
|
|
16207
16255
|
// src/liquid/filters/shopify/img_url.ts
|
|
16208
|
-
function
|
|
16256
|
+
function bind59(_liquidSwell) {
|
|
16209
16257
|
return function filterImgUrl(input, ...params) {
|
|
16210
16258
|
if (!input) return "";
|
|
16211
16259
|
let url;
|
|
@@ -16250,14 +16298,14 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16250
16298
|
};
|
|
16251
16299
|
|
|
16252
16300
|
// src/liquid/filters/shopify/payment_button.ts
|
|
16253
|
-
function
|
|
16301
|
+
function bind60(_liquidSwell) {
|
|
16254
16302
|
return (form) => {
|
|
16255
16303
|
return null;
|
|
16256
16304
|
};
|
|
16257
16305
|
}
|
|
16258
16306
|
|
|
16259
16307
|
// src/liquid/filters/shopify/payment_terms.ts
|
|
16260
|
-
function
|
|
16308
|
+
function bind61(_liquidSwell) {
|
|
16261
16309
|
return (form) => {
|
|
16262
16310
|
return null;
|
|
16263
16311
|
};
|
|
@@ -16359,7 +16407,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16359
16407
|
var placeholder_svgs_default = svgs;
|
|
16360
16408
|
|
|
16361
16409
|
// src/liquid/filters/shopify/placeholder_svg_tag.ts
|
|
16362
|
-
function
|
|
16410
|
+
function bind62(_liquidSwell) {
|
|
16363
16411
|
return function filterPlaceholderSvgTag(name, className) {
|
|
16364
16412
|
const svg = placeholder_svgs_default[name];
|
|
16365
16413
|
if (typeof svg === "object" && svg !== null) {
|
|
@@ -16370,7 +16418,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16370
16418
|
}
|
|
16371
16419
|
|
|
16372
16420
|
// src/liquid/filters/shopify/shopify_asset_url.ts
|
|
16373
|
-
function
|
|
16421
|
+
function bind63(_liquidSwell) {
|
|
16374
16422
|
return function filterShopifyAssetUrl(input) {
|
|
16375
16423
|
if (typeof input === "string") {
|
|
16376
16424
|
switch (input) {
|
|
@@ -16395,7 +16443,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16395
16443
|
}
|
|
16396
16444
|
|
|
16397
16445
|
// src/liquid/filters/shopify/structured_data.ts
|
|
16398
|
-
function
|
|
16446
|
+
function bind64(_liquidSwell) {
|
|
16399
16447
|
return async function filterStructuredData(input) {
|
|
16400
16448
|
let value = input;
|
|
16401
16449
|
if (value instanceof StorefrontResource) {
|
|
@@ -16473,7 +16521,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16473
16521
|
}
|
|
16474
16522
|
|
|
16475
16523
|
// src/liquid/filters/inline_editable.ts
|
|
16476
|
-
function
|
|
16524
|
+
function bind65(_liquidSwell) {
|
|
16477
16525
|
return (value, key) => {
|
|
16478
16526
|
if (typeof value === "object" && "value" in value) {
|
|
16479
16527
|
value = value.value;
|
|
@@ -16517,29 +16565,30 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16517
16565
|
json: bind44,
|
|
16518
16566
|
json_pretty: bind45,
|
|
16519
16567
|
locale_flag: bind46,
|
|
16520
|
-
|
|
16521
|
-
|
|
16522
|
-
|
|
16523
|
-
|
|
16524
|
-
|
|
16525
|
-
|
|
16526
|
-
|
|
16527
|
-
|
|
16528
|
-
|
|
16568
|
+
minus: bind47,
|
|
16569
|
+
money: bind48,
|
|
16570
|
+
money_with_currency: bind49,
|
|
16571
|
+
money_without_currency: bind50,
|
|
16572
|
+
money_without_trailing_zeros: bind51,
|
|
16573
|
+
script_tag: bind52,
|
|
16574
|
+
stylesheet_tag: bind53,
|
|
16575
|
+
time_tag: bind54,
|
|
16576
|
+
translate: bind55,
|
|
16577
|
+
t: bind55,
|
|
16529
16578
|
// alias
|
|
16530
|
-
where:
|
|
16579
|
+
where: bind56,
|
|
16531
16580
|
// Shopify compatibility only
|
|
16532
|
-
asset_img_url:
|
|
16533
|
-
hex_to_rgba:
|
|
16534
|
-
img_url:
|
|
16581
|
+
asset_img_url: bind57,
|
|
16582
|
+
hex_to_rgba: bind58,
|
|
16583
|
+
img_url: bind59,
|
|
16535
16584
|
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:
|
|
16585
|
+
payment_button: bind60,
|
|
16586
|
+
payment_terms: bind61,
|
|
16587
|
+
placeholder_svg_tag: bind62,
|
|
16588
|
+
shopify_asset_url: bind63,
|
|
16589
|
+
structured_data: bind64,
|
|
16541
16590
|
// Swell only
|
|
16542
|
-
inline_editable:
|
|
16591
|
+
inline_editable: bind65
|
|
16543
16592
|
};
|
|
16544
16593
|
function bindFilters(liquidSwell) {
|
|
16545
16594
|
for (const [tag, handler] of Object.entries(filters)) {
|
|
@@ -16553,8 +16602,8 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16553
16602
|
}
|
|
16554
16603
|
}
|
|
16555
16604
|
}
|
|
16556
|
-
function bindWithResolvedProps(liquidSwell,
|
|
16557
|
-
const handler =
|
|
16605
|
+
function bindWithResolvedProps(liquidSwell, bind66, resolve = []) {
|
|
16606
|
+
const handler = bind66(liquidSwell);
|
|
16558
16607
|
if (!Array.isArray(resolve)) {
|
|
16559
16608
|
return handler;
|
|
16560
16609
|
}
|
|
@@ -16616,7 +16665,8 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16616
16665
|
if (isArray(l)) return l.some((i) => equal(i, r));
|
|
16617
16666
|
if (isFunction(l?.indexOf)) return l.indexOf(toValue(r)) > -1;
|
|
16618
16667
|
return false;
|
|
16619
|
-
}
|
|
16668
|
+
},
|
|
16669
|
+
",": (l, r) => `${l},${r}`
|
|
16620
16670
|
};
|
|
16621
16671
|
function equal(lhs, rhs) {
|
|
16622
16672
|
if (isComparable(lhs)) return lhs.equals(rhs);
|
|
@@ -16771,7 +16821,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16771
16821
|
}
|
|
16772
16822
|
|
|
16773
16823
|
// src/liquid/index.ts
|
|
16774
|
-
var
|
|
16824
|
+
var LiquidSwell31 = class extends import_liquidjs34.Liquid {
|
|
16775
16825
|
theme;
|
|
16776
16826
|
getThemeConfig;
|
|
16777
16827
|
getThemeTemplateConfigByType;
|
|
@@ -17445,7 +17495,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17445
17495
|
this.resources = resources;
|
|
17446
17496
|
this.dynamicAssetUrl = dynamicAssetUrl;
|
|
17447
17497
|
this.shopifyCompatibilityClass = shopifyCompatibilityClass || ShopifyCompatibility2;
|
|
17448
|
-
this.liquidSwell = new
|
|
17498
|
+
this.liquidSwell = new LiquidSwell31({
|
|
17449
17499
|
theme: this,
|
|
17450
17500
|
getThemeConfig: this.getThemeConfig.bind(this),
|
|
17451
17501
|
getAssetUrl: this.getAssetUrl.bind(this),
|
|
@@ -18363,6 +18413,12 @@ ${content.slice(pos)}`;
|
|
|
18363
18413
|
isShopify1HomePage(pageId, pageContent) {
|
|
18364
18414
|
return Boolean(pageId === "index" && typeof pageContent === "string");
|
|
18365
18415
|
}
|
|
18416
|
+
getSectionClassName() {
|
|
18417
|
+
return this.shopifyCompatibility ? "shopify-section" : "swell-section";
|
|
18418
|
+
}
|
|
18419
|
+
getSectionIdPrefix() {
|
|
18420
|
+
return this.shopifyCompatibility ? "shopify-section" : "swell-section";
|
|
18421
|
+
}
|
|
18366
18422
|
async renderAllSections(sectionsIds, pageData) {
|
|
18367
18423
|
const sections = typeof sectionsIds === "string" ? sectionsIds.split(/\s*,\s*/) : sectionsIds;
|
|
18368
18424
|
const sectionsRendered = await Promise.all(
|
|
@@ -18370,18 +18426,14 @@ ${content.slice(pos)}`;
|
|
|
18370
18426
|
return this.renderSection(sectionId, pageData);
|
|
18371
18427
|
})
|
|
18372
18428
|
);
|
|
18429
|
+
const sectionClassName = this.getSectionClassName();
|
|
18430
|
+
const sectionIdPrefix = this.getSectionIdPrefix();
|
|
18373
18431
|
return sectionsRendered.reduce(
|
|
18374
18432
|
(acc, section, index) => {
|
|
18375
18433
|
const sectionId = sections[index];
|
|
18376
|
-
|
|
18377
|
-
|
|
18378
|
-
<div id="shopify-section-${sectionId}" class="shopify-section">${String(section)}</div>
|
|
18434
|
+
acc[sectionId] = `
|
|
18435
|
+
<div id="${sectionIdPrefix}-${sectionId}" class="${sectionClassName}">${String(section)}</div>
|
|
18379
18436
|
`.trim();
|
|
18380
|
-
} else {
|
|
18381
|
-
acc[sectionId] = `
|
|
18382
|
-
<div id="swell-section-${sectionId}" class="swell-section">${String(section)}</div>
|
|
18383
|
-
`.trim();
|
|
18384
|
-
}
|
|
18385
18437
|
return acc;
|
|
18386
18438
|
},
|
|
18387
18439
|
{}
|