@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.cjs
CHANGED
|
@@ -50,7 +50,7 @@ __export(index_exports, {
|
|
|
50
50
|
GEO_DATA: () => GEO_DATA,
|
|
51
51
|
HtmlCache: () => HtmlCache,
|
|
52
52
|
LANG_TO_COUNTRY_CODES: () => LANG_TO_COUNTRY_CODES,
|
|
53
|
-
LiquidSwell: () =>
|
|
53
|
+
LiquidSwell: () => LiquidSwell31,
|
|
54
54
|
MAX_QUERY_PAGE_LIMIT: () => MAX_QUERY_PAGE_LIMIT,
|
|
55
55
|
MockRecordResource: () => MockRecordResource,
|
|
56
56
|
MockRecordSingleton: () => MockRecordSingleton,
|
|
@@ -4766,8 +4766,8 @@ var SORT_OPTIONS = Object.freeze([
|
|
|
4766
4766
|
{ value: "popularity", name: "Popularity", query: "popularity desc" },
|
|
4767
4767
|
{ value: "price_asc", name: "Price, low to high", query: "price asc" },
|
|
4768
4768
|
{ value: "price_desc", name: "Price, high to low", query: "price desc" },
|
|
4769
|
-
{ value: "date_asc", name: "Date, old to new", query: "
|
|
4770
|
-
{ value: "date_desc", name: "Date, new to old", query: "
|
|
4769
|
+
{ value: "date_asc", name: "Date, old to new", query: "date_created asc" },
|
|
4770
|
+
{ value: "date_desc", name: "Date, new to old", query: "date_created desc" },
|
|
4771
4771
|
{ value: "name_asc", name: "Product name, A-Z", query: "name asc" },
|
|
4772
4772
|
{ value: "name_desc", name: "Product name, Z-A", query: "name desc" }
|
|
4773
4773
|
]);
|
|
@@ -5560,23 +5560,58 @@ function getBlog(swell, id, query) {
|
|
|
5560
5560
|
// src/easyblocks/config.ts
|
|
5561
5561
|
var import_json53 = __toESM(require("json5"), 1);
|
|
5562
5562
|
var import_lodash_es4 = require("lodash-es");
|
|
5563
|
+
|
|
5564
|
+
// src/compatibility/drops/template.ts
|
|
5565
|
+
var import_liquidjs3 = require("liquidjs");
|
|
5566
|
+
var TemplateDrop = class extends import_liquidjs3.Drop {
|
|
5567
|
+
constructor(name, directory, suffix) {
|
|
5568
|
+
super();
|
|
5569
|
+
this.name = name;
|
|
5570
|
+
this.directory = directory;
|
|
5571
|
+
this.suffix = suffix;
|
|
5572
|
+
}
|
|
5573
|
+
valueOf() {
|
|
5574
|
+
return this.name;
|
|
5575
|
+
}
|
|
5576
|
+
};
|
|
5577
|
+
|
|
5578
|
+
// src/compatibility/shopify-objects/template.ts
|
|
5579
|
+
function ShopifyTemplate(instance, template) {
|
|
5580
|
+
return new TemplateDrop(
|
|
5581
|
+
instance.getPageType(template.name),
|
|
5582
|
+
template.path,
|
|
5583
|
+
template.alt_name
|
|
5584
|
+
);
|
|
5585
|
+
}
|
|
5586
|
+
|
|
5587
|
+
// src/easyblocks/config.ts
|
|
5563
5588
|
var NO_INLINE = true;
|
|
5564
5589
|
async function getEasyblocksPageTemplate(theme, pageId, altTemplate) {
|
|
5565
5590
|
let templateConfig = null;
|
|
5591
|
+
let templateData = {
|
|
5592
|
+
name: pageId
|
|
5593
|
+
};
|
|
5594
|
+
if (theme.shopifyCompatibility) {
|
|
5595
|
+
templateData = ShopifyTemplate(theme.shopifyCompatibility, templateData);
|
|
5596
|
+
}
|
|
5597
|
+
const { name } = templateData;
|
|
5566
5598
|
templateConfig = await theme.getThemeTemplateConfigByType(
|
|
5567
5599
|
"templates",
|
|
5568
|
-
|
|
5600
|
+
name,
|
|
5569
5601
|
altTemplate
|
|
5570
5602
|
);
|
|
5571
5603
|
if (templateConfig) {
|
|
5572
|
-
|
|
5573
|
-
|
|
5604
|
+
let result = templateConfig.file_data;
|
|
5605
|
+
if (!templateConfig.file_path.endsWith(".liquid")) {
|
|
5606
|
+
try {
|
|
5607
|
+
result = import_json53.default.parse(templateConfig.file_data);
|
|
5608
|
+
} catch {
|
|
5609
|
+
}
|
|
5574
5610
|
}
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
} catch {
|
|
5578
|
-
return templateConfig.file_data;
|
|
5611
|
+
if (result && typeof result === "object") {
|
|
5612
|
+
result.id = name;
|
|
5579
5613
|
}
|
|
5614
|
+
return result;
|
|
5580
5615
|
}
|
|
5581
5616
|
}
|
|
5582
5617
|
function getAcceptedLayoutSections(allSections, groupType) {
|
|
@@ -11518,11 +11553,11 @@ __export(shopify_objects_exports, {
|
|
|
11518
11553
|
});
|
|
11519
11554
|
|
|
11520
11555
|
// src/compatibility/drops/image.ts
|
|
11521
|
-
var
|
|
11556
|
+
var import_liquidjs5 = require("liquidjs");
|
|
11522
11557
|
|
|
11523
11558
|
// src/compatibility/drops/image-src.ts
|
|
11524
|
-
var
|
|
11525
|
-
var ImageSrcDrop = class extends
|
|
11559
|
+
var import_liquidjs4 = require("liquidjs");
|
|
11560
|
+
var ImageSrcDrop = class extends import_liquidjs4.Drop {
|
|
11526
11561
|
constructor(url, width, height) {
|
|
11527
11562
|
super();
|
|
11528
11563
|
this.url = url;
|
|
@@ -11545,7 +11580,7 @@ var ImageSrcDrop = class extends import_liquidjs3.Drop {
|
|
|
11545
11580
|
};
|
|
11546
11581
|
|
|
11547
11582
|
// src/compatibility/drops/image.ts
|
|
11548
|
-
var ImageDrop = class extends
|
|
11583
|
+
var ImageDrop = class extends import_liquidjs5.Drop {
|
|
11549
11584
|
id;
|
|
11550
11585
|
alt;
|
|
11551
11586
|
src;
|
|
@@ -11756,7 +11791,9 @@ function ShopifyVariant(instance, variant, productIn, depth = 0) {
|
|
|
11756
11791
|
),
|
|
11757
11792
|
barcode: void 0,
|
|
11758
11793
|
compare_at_price: defer(
|
|
11759
|
-
() => instance.toShopifyPrice(
|
|
11794
|
+
() => instance.toShopifyPrice(
|
|
11795
|
+
getPriceField(product, variant, "orig_price")
|
|
11796
|
+
)
|
|
11760
11797
|
),
|
|
11761
11798
|
featured_image: deferWith(
|
|
11762
11799
|
[product, variant],
|
|
@@ -11803,13 +11840,14 @@ function ShopifyVariant(instance, variant, productIn, depth = 0) {
|
|
|
11803
11840
|
// Deprecated by Shopify
|
|
11804
11841
|
option3: getOptionByIndex(product, variant, 2),
|
|
11805
11842
|
// Deprecated by Shopify
|
|
11806
|
-
price: deferWith(
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
|
|
11843
|
+
price: deferWith(
|
|
11844
|
+
[product, variant],
|
|
11845
|
+
(product2, variant2) => {
|
|
11846
|
+
return instance.toShopifyPrice(
|
|
11847
|
+
getPriceField(product2, variant2, "price")
|
|
11848
|
+
);
|
|
11810
11849
|
}
|
|
11811
|
-
|
|
11812
|
-
}),
|
|
11850
|
+
),
|
|
11813
11851
|
product: deferWith(product, (product2) => {
|
|
11814
11852
|
return ShopifyProduct(
|
|
11815
11853
|
instance,
|
|
@@ -11848,7 +11886,11 @@ function ShopifyVariant(instance, variant, productIn, depth = 0) {
|
|
|
11848
11886
|
store_availabilities: [],
|
|
11849
11887
|
taxable: true,
|
|
11850
11888
|
title: defer(() => variant.name),
|
|
11851
|
-
unit_price: defer(
|
|
11889
|
+
unit_price: defer(
|
|
11890
|
+
() => instance.toShopifyPrice(
|
|
11891
|
+
getPriceField(product, variant, "price")
|
|
11892
|
+
)
|
|
11893
|
+
),
|
|
11852
11894
|
unit_price_measurement: void 0,
|
|
11853
11895
|
url: defer(() => product.url),
|
|
11854
11896
|
weight: defer(() => variant.weight),
|
|
@@ -11872,6 +11914,9 @@ function getOptions(product, variant) {
|
|
|
11872
11914
|
return variant2.option_value_ids.map((id) => optionValuesById[id]).filter(Boolean);
|
|
11873
11915
|
});
|
|
11874
11916
|
}
|
|
11917
|
+
function getPriceField(product, variant, field) {
|
|
11918
|
+
return variant[field] ?? product[field];
|
|
11919
|
+
}
|
|
11875
11920
|
function getOptionByIndex(product, variant, index) {
|
|
11876
11921
|
return deferWith(
|
|
11877
11922
|
[product, variant],
|
|
@@ -12299,7 +12344,12 @@ function ShopifyProduct(instance, product, depth = 0) {
|
|
|
12299
12344
|
return instance.toShopifyPrice(product2.price);
|
|
12300
12345
|
}
|
|
12301
12346
|
const max = product2.variants.results.reduce(
|
|
12302
|
-
(max2, variant) =>
|
|
12347
|
+
(max2, variant) => {
|
|
12348
|
+
if (variant.price === void 0 || variant.price === null) {
|
|
12349
|
+
return max2;
|
|
12350
|
+
}
|
|
12351
|
+
return Math.max(max2, variant.price);
|
|
12352
|
+
},
|
|
12303
12353
|
0
|
|
12304
12354
|
);
|
|
12305
12355
|
return instance.toShopifyPrice(max);
|
|
@@ -12309,7 +12359,12 @@ function ShopifyProduct(instance, product, depth = 0) {
|
|
|
12309
12359
|
return instance.toShopifyPrice(product2.price);
|
|
12310
12360
|
}
|
|
12311
12361
|
const min = product2.variants.results.reduce(
|
|
12312
|
-
(min2, variant) =>
|
|
12362
|
+
(min2, variant) => {
|
|
12363
|
+
if (variant.price === void 0 || variant.price === null) {
|
|
12364
|
+
return min2;
|
|
12365
|
+
}
|
|
12366
|
+
return Math.min(min2, variant.price);
|
|
12367
|
+
},
|
|
12313
12368
|
Infinity
|
|
12314
12369
|
);
|
|
12315
12370
|
return instance.toShopifyPrice(min);
|
|
@@ -12319,7 +12374,7 @@ function ShopifyProduct(instance, product, depth = 0) {
|
|
|
12319
12374
|
return false;
|
|
12320
12375
|
}
|
|
12321
12376
|
return product2.variants.results.some(
|
|
12322
|
-
(variant) => variant.price !== product2.price
|
|
12377
|
+
(variant) => variant.price !== void 0 && variant.price !== null && variant.price !== product2.price
|
|
12323
12378
|
);
|
|
12324
12379
|
}),
|
|
12325
12380
|
published_at: deferWith(
|
|
@@ -13058,8 +13113,8 @@ function ShopifyShippingMethod(instance, order) {
|
|
|
13058
13113
|
}
|
|
13059
13114
|
|
|
13060
13115
|
// src/compatibility/drops/money.ts
|
|
13061
|
-
var
|
|
13062
|
-
var MoneyDrop = class extends
|
|
13116
|
+
var import_liquidjs6 = require("liquidjs");
|
|
13117
|
+
var MoneyDrop = class extends import_liquidjs6.Drop {
|
|
13063
13118
|
constructor(value, decimals, currency) {
|
|
13064
13119
|
super();
|
|
13065
13120
|
this.value = value;
|
|
@@ -13652,8 +13707,8 @@ function ShopifyShop(instance, store) {
|
|
|
13652
13707
|
}
|
|
13653
13708
|
|
|
13654
13709
|
// src/compatibility/drops/all_products.ts
|
|
13655
|
-
var
|
|
13656
|
-
var AllProductsDrop = class extends
|
|
13710
|
+
var import_liquidjs7 = require("liquidjs");
|
|
13711
|
+
var AllProductsDrop = class extends import_liquidjs7.Drop {
|
|
13657
13712
|
#instance;
|
|
13658
13713
|
#map;
|
|
13659
13714
|
constructor(instance) {
|
|
@@ -13695,8 +13750,8 @@ var AllProductsDrop = class extends import_liquidjs6.Drop {
|
|
|
13695
13750
|
};
|
|
13696
13751
|
|
|
13697
13752
|
// src/compatibility/drops/articles.ts
|
|
13698
|
-
var
|
|
13699
|
-
var ArticlesDrop = class extends
|
|
13753
|
+
var import_liquidjs8 = require("liquidjs");
|
|
13754
|
+
var ArticlesDrop = class extends import_liquidjs8.Drop {
|
|
13700
13755
|
#instance;
|
|
13701
13756
|
#map;
|
|
13702
13757
|
constructor(instance) {
|
|
@@ -13738,8 +13793,8 @@ var ArticlesDrop = class extends import_liquidjs7.Drop {
|
|
|
13738
13793
|
};
|
|
13739
13794
|
|
|
13740
13795
|
// src/compatibility/drops/blogs.ts
|
|
13741
|
-
var
|
|
13742
|
-
var BlogsDrop = class extends
|
|
13796
|
+
var import_liquidjs9 = require("liquidjs");
|
|
13797
|
+
var BlogsDrop = class extends import_liquidjs9.Drop {
|
|
13743
13798
|
#instance;
|
|
13744
13799
|
#map;
|
|
13745
13800
|
constructor(instance) {
|
|
@@ -13785,7 +13840,7 @@ var BlogsDrop = class extends import_liquidjs8.Drop {
|
|
|
13785
13840
|
};
|
|
13786
13841
|
|
|
13787
13842
|
// src/compatibility/drops/collections.ts
|
|
13788
|
-
var
|
|
13843
|
+
var import_liquidjs10 = require("liquidjs");
|
|
13789
13844
|
var AllCategoryResource = class extends StorefrontResource {
|
|
13790
13845
|
constructor(instance) {
|
|
13791
13846
|
super(() => {
|
|
@@ -13799,7 +13854,7 @@ var AllCategoryResource = class extends StorefrontResource {
|
|
|
13799
13854
|
});
|
|
13800
13855
|
}
|
|
13801
13856
|
};
|
|
13802
|
-
var CollectionsDrop = class extends
|
|
13857
|
+
var CollectionsDrop = class extends import_liquidjs10.Drop {
|
|
13803
13858
|
#instance;
|
|
13804
13859
|
#map;
|
|
13805
13860
|
constructor(instance) {
|
|
@@ -13916,8 +13971,8 @@ var SwellStorefrontProducts = class extends SwellStorefrontCollection {
|
|
|
13916
13971
|
};
|
|
13917
13972
|
|
|
13918
13973
|
// src/compatibility/drops/images.ts
|
|
13919
|
-
var
|
|
13920
|
-
var ImagesDrop = class extends
|
|
13974
|
+
var import_liquidjs11 = require("liquidjs");
|
|
13975
|
+
var ImagesDrop = class extends import_liquidjs11.Drop {
|
|
13921
13976
|
#instance;
|
|
13922
13977
|
#map;
|
|
13923
13978
|
constructor(instance) {
|
|
@@ -13971,8 +14026,8 @@ var SwellImage = class extends StorefrontResource {
|
|
|
13971
14026
|
};
|
|
13972
14027
|
|
|
13973
14028
|
// src/compatibility/drops/object-handles.ts
|
|
13974
|
-
var
|
|
13975
|
-
var ObjectHandlesDrop = class extends
|
|
14029
|
+
var import_liquidjs12 = require("liquidjs");
|
|
14030
|
+
var ObjectHandlesDrop = class extends import_liquidjs12.Drop {
|
|
13976
14031
|
#map;
|
|
13977
14032
|
constructor(map) {
|
|
13978
14033
|
super();
|
|
@@ -14012,8 +14067,8 @@ var ObjectHandlesDrop = class extends import_liquidjs11.Drop {
|
|
|
14012
14067
|
};
|
|
14013
14068
|
|
|
14014
14069
|
// src/compatibility/drops/pages.ts
|
|
14015
|
-
var
|
|
14016
|
-
var PagesDrop = class extends
|
|
14070
|
+
var import_liquidjs13 = require("liquidjs");
|
|
14071
|
+
var PagesDrop = class extends import_liquidjs13.Drop {
|
|
14017
14072
|
#instance;
|
|
14018
14073
|
#map;
|
|
14019
14074
|
constructor(instance) {
|
|
@@ -14712,29 +14767,6 @@ ${injects.join("\n")}</script>`;
|
|
|
14712
14767
|
}
|
|
14713
14768
|
};
|
|
14714
14769
|
|
|
14715
|
-
// src/compatibility/drops/template.ts
|
|
14716
|
-
var import_liquidjs13 = require("liquidjs");
|
|
14717
|
-
var TemplateDrop = class extends import_liquidjs13.Drop {
|
|
14718
|
-
constructor(name, directory, suffix) {
|
|
14719
|
-
super();
|
|
14720
|
-
this.name = name;
|
|
14721
|
-
this.directory = directory;
|
|
14722
|
-
this.suffix = suffix;
|
|
14723
|
-
}
|
|
14724
|
-
valueOf() {
|
|
14725
|
-
return this.name;
|
|
14726
|
-
}
|
|
14727
|
-
};
|
|
14728
|
-
|
|
14729
|
-
// src/compatibility/shopify-objects/template.ts
|
|
14730
|
-
function ShopifyTemplate(instance, template) {
|
|
14731
|
-
return new TemplateDrop(
|
|
14732
|
-
instance.getPageType(template.name),
|
|
14733
|
-
template.path,
|
|
14734
|
-
template.alt_name
|
|
14735
|
-
);
|
|
14736
|
-
}
|
|
14737
|
-
|
|
14738
14770
|
// src/liquid/drops/render.ts
|
|
14739
14771
|
var import_liquidjs14 = require("liquidjs");
|
|
14740
14772
|
var import_lodash_es8 = require("lodash-es");
|
|
@@ -15393,12 +15425,12 @@ function bind11(liquidSwell) {
|
|
|
15393
15425
|
});
|
|
15394
15426
|
});
|
|
15395
15427
|
if (output && schema && settings) {
|
|
15396
|
-
const { shopify_compatibility: shopifyCompatibility } = liquidSwell.theme.globals;
|
|
15397
15428
|
const tag = schema.tag || "div";
|
|
15398
|
-
const
|
|
15399
|
-
const
|
|
15429
|
+
const sectionClassName = liquidSwell.theme.getSectionClassName();
|
|
15430
|
+
const sectionIdPrefix = liquidSwell.theme.getSectionIdPrefix();
|
|
15431
|
+
const id = `${sectionIdPrefix}-${settings.id || this.fileName}`;
|
|
15400
15432
|
emitter.write(
|
|
15401
|
-
`<${tag} id="${id}" class="${
|
|
15433
|
+
`<${tag} id="${id}" class="${sectionClassName} ${schema.class || ""}">${output}</${tag}>`
|
|
15402
15434
|
);
|
|
15403
15435
|
}
|
|
15404
15436
|
}
|
|
@@ -15430,12 +15462,13 @@ function bind12(liquidSwell) {
|
|
|
15430
15462
|
const sectionConfigs = yield liquidSwell.renderPageSections(
|
|
15431
15463
|
sectionGroup
|
|
15432
15464
|
);
|
|
15433
|
-
const
|
|
15465
|
+
const sectionClassName = liquidSwell.theme.getSectionClassName();
|
|
15466
|
+
const sectionIdPrefix = liquidSwell.theme.getSectionIdPrefix();
|
|
15434
15467
|
emitter.write(
|
|
15435
15468
|
`<div id="swell-section-group__${this.fileName}">${sectionConfigs.map((section) => {
|
|
15436
15469
|
const tag = section.tag || "div";
|
|
15437
|
-
const id = `${
|
|
15438
|
-
const className =
|
|
15470
|
+
const id = `${sectionIdPrefix}-sections--${themeConfig.hash}__${section.id}`;
|
|
15471
|
+
const className = `${sectionClassName} ${sectionClassName}-group-${this.fileName} section-${section.id}`;
|
|
15439
15472
|
return `<${tag} id="${id}" class="${className} ${section.class || ""}">${section.output}</${tag}>`;
|
|
15440
15473
|
}).join("")}</div>`
|
|
15441
15474
|
);
|
|
@@ -15620,7 +15653,7 @@ var tags = {
|
|
|
15620
15653
|
};
|
|
15621
15654
|
function bindTags(liquidSwell) {
|
|
15622
15655
|
Object.entries(tags).forEach(
|
|
15623
|
-
([tag,
|
|
15656
|
+
([tag, bind66]) => liquidSwell.registerTag(tag, bind66(liquidSwell))
|
|
15624
15657
|
);
|
|
15625
15658
|
}
|
|
15626
15659
|
|
|
@@ -16173,8 +16206,17 @@ function bind46(_liquidSwell) {
|
|
|
16173
16206
|
};
|
|
16174
16207
|
}
|
|
16175
16208
|
|
|
16209
|
+
// src/liquid/filters/minus.ts
|
|
16210
|
+
function bind47(_liquidSwell) {
|
|
16211
|
+
return (first, second) => {
|
|
16212
|
+
const firstValue = isNumber(first) ? first : 0;
|
|
16213
|
+
const secondValue = isNumber(second) ? second : 0;
|
|
16214
|
+
return firstValue - secondValue;
|
|
16215
|
+
};
|
|
16216
|
+
}
|
|
16217
|
+
|
|
16176
16218
|
// src/liquid/filters/money.ts
|
|
16177
|
-
function
|
|
16219
|
+
function bind48(liquidSwell) {
|
|
16178
16220
|
return function filterMoney(value) {
|
|
16179
16221
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16180
16222
|
return liquidSwell.renderCurrency(amount);
|
|
@@ -16191,7 +16233,7 @@ function getMoneyAmount(liquidSwell, value) {
|
|
|
16191
16233
|
}
|
|
16192
16234
|
|
|
16193
16235
|
// src/liquid/filters/money_with_currency.ts
|
|
16194
|
-
function
|
|
16236
|
+
function bind49(liquidSwell) {
|
|
16195
16237
|
return function filterMoneyWithCurrency(value) {
|
|
16196
16238
|
const { currency } = liquidSwell.theme.swell.getStorefrontLocalization();
|
|
16197
16239
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
@@ -16200,7 +16242,7 @@ function bind48(liquidSwell) {
|
|
|
16200
16242
|
}
|
|
16201
16243
|
|
|
16202
16244
|
// src/liquid/filters/money_without_currency.ts
|
|
16203
|
-
function
|
|
16245
|
+
function bind50(liquidSwell) {
|
|
16204
16246
|
return function filterMoneyWithoutCurrency(value) {
|
|
16205
16247
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16206
16248
|
return liquidSwell.renderCurrency(amount).replace(/[^0-9.,]/g, "");
|
|
@@ -16208,7 +16250,7 @@ function bind49(liquidSwell) {
|
|
|
16208
16250
|
}
|
|
16209
16251
|
|
|
16210
16252
|
// src/liquid/filters/money_without_trailing_zeros.ts
|
|
16211
|
-
function
|
|
16253
|
+
function bind51(liquidSwell) {
|
|
16212
16254
|
return function filterMoneyWithoutTrailingZeros(value) {
|
|
16213
16255
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16214
16256
|
return liquidSwell.renderCurrency(amount).split(".")[0].split(",")[0];
|
|
@@ -16216,21 +16258,21 @@ function bind50(liquidSwell) {
|
|
|
16216
16258
|
}
|
|
16217
16259
|
|
|
16218
16260
|
// src/liquid/filters/script_tag.ts
|
|
16219
|
-
function
|
|
16261
|
+
function bind52(_liquidSwell) {
|
|
16220
16262
|
return function filterScriptTag(assetUrl) {
|
|
16221
16263
|
return `<script src="${assetUrl}" type="text/javascript"></script>`;
|
|
16222
16264
|
};
|
|
16223
16265
|
}
|
|
16224
16266
|
|
|
16225
16267
|
// src/liquid/filters/stylesheet_tag.ts
|
|
16226
|
-
function
|
|
16268
|
+
function bind53(_liquidSwell) {
|
|
16227
16269
|
return function filterStyleSheetTag(assetUrl) {
|
|
16228
16270
|
return `<link href="${assetUrl}" rel="stylesheet" type="text/css" media="all" />`;
|
|
16229
16271
|
};
|
|
16230
16272
|
}
|
|
16231
16273
|
|
|
16232
16274
|
// src/liquid/filters/time_tag.ts
|
|
16233
|
-
function
|
|
16275
|
+
function bind54(_liquidSwell) {
|
|
16234
16276
|
const dateFilter = bind33(_liquidSwell);
|
|
16235
16277
|
return (dateValue, ...params) => {
|
|
16236
16278
|
const date = ensureDate(dateValue);
|
|
@@ -16241,7 +16283,7 @@ function bind53(_liquidSwell) {
|
|
|
16241
16283
|
}
|
|
16242
16284
|
|
|
16243
16285
|
// src/liquid/filters/translate.ts
|
|
16244
|
-
function
|
|
16286
|
+
function bind55(liquidSwell) {
|
|
16245
16287
|
return async function filterTranslate(key, params) {
|
|
16246
16288
|
const props = params && paramsToProps(params);
|
|
16247
16289
|
const str = await liquidSwell.renderTranslation(key, props);
|
|
@@ -16250,7 +16292,7 @@ function bind54(liquidSwell) {
|
|
|
16250
16292
|
}
|
|
16251
16293
|
|
|
16252
16294
|
// src/liquid/filters/where.ts
|
|
16253
|
-
function
|
|
16295
|
+
function bind56(_liquidSwell) {
|
|
16254
16296
|
return function* filterWhere(arr, property, expected) {
|
|
16255
16297
|
const results = [];
|
|
16256
16298
|
const list = yield resolveEnumerable(arr);
|
|
@@ -16304,7 +16346,7 @@ function getSizesFromParam(param) {
|
|
|
16304
16346
|
height: height ? Number(height) : void 0
|
|
16305
16347
|
};
|
|
16306
16348
|
}
|
|
16307
|
-
function
|
|
16349
|
+
function bind57(liquidSwell) {
|
|
16308
16350
|
return async function filterAssetImgUrl(assetPath, size = "small") {
|
|
16309
16351
|
const imageUrl = await liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
|
|
16310
16352
|
const sizes = getSizesFromParam(size);
|
|
@@ -16320,14 +16362,14 @@ function bind56(liquidSwell) {
|
|
|
16320
16362
|
}
|
|
16321
16363
|
|
|
16322
16364
|
// src/liquid/filters/shopify/hex_to_rgba.ts
|
|
16323
|
-
function
|
|
16365
|
+
function bind58(_liquidSwell) {
|
|
16324
16366
|
return (color, alpha) => {
|
|
16325
16367
|
return ThemeColor.get(color).rgba(alpha || 1);
|
|
16326
16368
|
};
|
|
16327
16369
|
}
|
|
16328
16370
|
|
|
16329
16371
|
// src/liquid/filters/shopify/img_url.ts
|
|
16330
|
-
function
|
|
16372
|
+
function bind59(_liquidSwell) {
|
|
16331
16373
|
return function filterImgUrl(input, ...params) {
|
|
16332
16374
|
if (!input) return "";
|
|
16333
16375
|
let url;
|
|
@@ -16372,14 +16414,14 @@ var item_count_for_variant_default = {
|
|
|
16372
16414
|
};
|
|
16373
16415
|
|
|
16374
16416
|
// src/liquid/filters/shopify/payment_button.ts
|
|
16375
|
-
function
|
|
16417
|
+
function bind60(_liquidSwell) {
|
|
16376
16418
|
return (form) => {
|
|
16377
16419
|
return null;
|
|
16378
16420
|
};
|
|
16379
16421
|
}
|
|
16380
16422
|
|
|
16381
16423
|
// src/liquid/filters/shopify/payment_terms.ts
|
|
16382
|
-
function
|
|
16424
|
+
function bind61(_liquidSwell) {
|
|
16383
16425
|
return (form) => {
|
|
16384
16426
|
return null;
|
|
16385
16427
|
};
|
|
@@ -16481,7 +16523,7 @@ var svgs = {
|
|
|
16481
16523
|
var placeholder_svgs_default = svgs;
|
|
16482
16524
|
|
|
16483
16525
|
// src/liquid/filters/shopify/placeholder_svg_tag.ts
|
|
16484
|
-
function
|
|
16526
|
+
function bind62(_liquidSwell) {
|
|
16485
16527
|
return function filterPlaceholderSvgTag(name, className) {
|
|
16486
16528
|
const svg = placeholder_svgs_default[name];
|
|
16487
16529
|
if (typeof svg === "object" && svg !== null) {
|
|
@@ -16492,7 +16534,7 @@ function bind61(_liquidSwell) {
|
|
|
16492
16534
|
}
|
|
16493
16535
|
|
|
16494
16536
|
// src/liquid/filters/shopify/shopify_asset_url.ts
|
|
16495
|
-
function
|
|
16537
|
+
function bind63(_liquidSwell) {
|
|
16496
16538
|
return function filterShopifyAssetUrl(input) {
|
|
16497
16539
|
if (typeof input === "string") {
|
|
16498
16540
|
switch (input) {
|
|
@@ -16517,7 +16559,7 @@ function bind62(_liquidSwell) {
|
|
|
16517
16559
|
}
|
|
16518
16560
|
|
|
16519
16561
|
// src/liquid/filters/shopify/structured_data.ts
|
|
16520
|
-
function
|
|
16562
|
+
function bind64(_liquidSwell) {
|
|
16521
16563
|
return async function filterStructuredData(input) {
|
|
16522
16564
|
let value = input;
|
|
16523
16565
|
if (value instanceof StorefrontResource) {
|
|
@@ -16595,7 +16637,7 @@ function convertToSchemaOrgProductGroup(product) {
|
|
|
16595
16637
|
}
|
|
16596
16638
|
|
|
16597
16639
|
// src/liquid/filters/inline_editable.ts
|
|
16598
|
-
function
|
|
16640
|
+
function bind65(_liquidSwell) {
|
|
16599
16641
|
return (value, key) => {
|
|
16600
16642
|
if (typeof value === "object" && "value" in value) {
|
|
16601
16643
|
value = value.value;
|
|
@@ -16639,29 +16681,30 @@ var filters = {
|
|
|
16639
16681
|
json: bind44,
|
|
16640
16682
|
json_pretty: bind45,
|
|
16641
16683
|
locale_flag: bind46,
|
|
16642
|
-
|
|
16643
|
-
|
|
16644
|
-
|
|
16645
|
-
|
|
16646
|
-
|
|
16647
|
-
|
|
16648
|
-
|
|
16649
|
-
|
|
16650
|
-
|
|
16684
|
+
minus: bind47,
|
|
16685
|
+
money: bind48,
|
|
16686
|
+
money_with_currency: bind49,
|
|
16687
|
+
money_without_currency: bind50,
|
|
16688
|
+
money_without_trailing_zeros: bind51,
|
|
16689
|
+
script_tag: bind52,
|
|
16690
|
+
stylesheet_tag: bind53,
|
|
16691
|
+
time_tag: bind54,
|
|
16692
|
+
translate: bind55,
|
|
16693
|
+
t: bind55,
|
|
16651
16694
|
// alias
|
|
16652
|
-
where:
|
|
16695
|
+
where: bind56,
|
|
16653
16696
|
// Shopify compatibility only
|
|
16654
|
-
asset_img_url:
|
|
16655
|
-
hex_to_rgba:
|
|
16656
|
-
img_url:
|
|
16697
|
+
asset_img_url: bind57,
|
|
16698
|
+
hex_to_rgba: bind58,
|
|
16699
|
+
img_url: bind59,
|
|
16657
16700
|
item_count_for_variant: item_count_for_variant_default,
|
|
16658
|
-
payment_button:
|
|
16659
|
-
payment_terms:
|
|
16660
|
-
placeholder_svg_tag:
|
|
16661
|
-
shopify_asset_url:
|
|
16662
|
-
structured_data:
|
|
16701
|
+
payment_button: bind60,
|
|
16702
|
+
payment_terms: bind61,
|
|
16703
|
+
placeholder_svg_tag: bind62,
|
|
16704
|
+
shopify_asset_url: bind63,
|
|
16705
|
+
structured_data: bind64,
|
|
16663
16706
|
// Swell only
|
|
16664
|
-
inline_editable:
|
|
16707
|
+
inline_editable: bind65
|
|
16665
16708
|
};
|
|
16666
16709
|
function bindFilters(liquidSwell) {
|
|
16667
16710
|
for (const [tag, handler] of Object.entries(filters)) {
|
|
@@ -16675,8 +16718,8 @@ function bindFilters(liquidSwell) {
|
|
|
16675
16718
|
}
|
|
16676
16719
|
}
|
|
16677
16720
|
}
|
|
16678
|
-
function bindWithResolvedProps(liquidSwell,
|
|
16679
|
-
const handler =
|
|
16721
|
+
function bindWithResolvedProps(liquidSwell, bind66, resolve = []) {
|
|
16722
|
+
const handler = bind66(liquidSwell);
|
|
16680
16723
|
if (!Array.isArray(resolve)) {
|
|
16681
16724
|
return handler;
|
|
16682
16725
|
}
|
|
@@ -16738,7 +16781,8 @@ var swellOperators = {
|
|
|
16738
16781
|
if (isArray(l)) return l.some((i) => equal(i, r));
|
|
16739
16782
|
if (isFunction(l?.indexOf)) return l.indexOf(toValue(r)) > -1;
|
|
16740
16783
|
return false;
|
|
16741
|
-
}
|
|
16784
|
+
},
|
|
16785
|
+
",": (l, r) => `${l},${r}`
|
|
16742
16786
|
};
|
|
16743
16787
|
function equal(lhs, rhs) {
|
|
16744
16788
|
if (isComparable(lhs)) return lhs.equals(rhs);
|
|
@@ -16893,7 +16937,7 @@ function isThemeColorLike(value) {
|
|
|
16893
16937
|
}
|
|
16894
16938
|
|
|
16895
16939
|
// src/liquid/index.ts
|
|
16896
|
-
var
|
|
16940
|
+
var LiquidSwell31 = class extends import_liquidjs34.Liquid {
|
|
16897
16941
|
theme;
|
|
16898
16942
|
getThemeConfig;
|
|
16899
16943
|
getThemeTemplateConfigByType;
|
|
@@ -17567,7 +17611,7 @@ var SwellTheme3 = class {
|
|
|
17567
17611
|
this.resources = resources;
|
|
17568
17612
|
this.dynamicAssetUrl = dynamicAssetUrl;
|
|
17569
17613
|
this.shopifyCompatibilityClass = shopifyCompatibilityClass || ShopifyCompatibility2;
|
|
17570
|
-
this.liquidSwell = new
|
|
17614
|
+
this.liquidSwell = new LiquidSwell31({
|
|
17571
17615
|
theme: this,
|
|
17572
17616
|
getThemeConfig: this.getThemeConfig.bind(this),
|
|
17573
17617
|
getAssetUrl: this.getAssetUrl.bind(this),
|
|
@@ -18485,6 +18529,12 @@ ${content.slice(pos)}`;
|
|
|
18485
18529
|
isShopify1HomePage(pageId, pageContent) {
|
|
18486
18530
|
return Boolean(pageId === "index" && typeof pageContent === "string");
|
|
18487
18531
|
}
|
|
18532
|
+
getSectionClassName() {
|
|
18533
|
+
return this.shopifyCompatibility ? "shopify-section" : "swell-section";
|
|
18534
|
+
}
|
|
18535
|
+
getSectionIdPrefix() {
|
|
18536
|
+
return this.shopifyCompatibility ? "shopify-section" : "swell-section";
|
|
18537
|
+
}
|
|
18488
18538
|
async renderAllSections(sectionsIds, pageData) {
|
|
18489
18539
|
const sections = typeof sectionsIds === "string" ? sectionsIds.split(/\s*,\s*/) : sectionsIds;
|
|
18490
18540
|
const sectionsRendered = await Promise.all(
|
|
@@ -18492,18 +18542,14 @@ ${content.slice(pos)}`;
|
|
|
18492
18542
|
return this.renderSection(sectionId, pageData);
|
|
18493
18543
|
})
|
|
18494
18544
|
);
|
|
18545
|
+
const sectionClassName = this.getSectionClassName();
|
|
18546
|
+
const sectionIdPrefix = this.getSectionIdPrefix();
|
|
18495
18547
|
return sectionsRendered.reduce(
|
|
18496
18548
|
(acc, section, index) => {
|
|
18497
18549
|
const sectionId = sections[index];
|
|
18498
|
-
|
|
18499
|
-
|
|
18500
|
-
<div id="shopify-section-${sectionId}" class="shopify-section">${String(section)}</div>
|
|
18550
|
+
acc[sectionId] = `
|
|
18551
|
+
<div id="${sectionIdPrefix}-${sectionId}" class="${sectionClassName}">${String(section)}</div>
|
|
18501
18552
|
`.trim();
|
|
18502
|
-
} else {
|
|
18503
|
-
acc[sectionId] = `
|
|
18504
|
-
<div id="swell-section-${sectionId}" class="swell-section">${String(section)}</div>
|
|
18505
|
-
`.trim();
|
|
18506
|
-
}
|
|
18507
18553
|
return acc;
|
|
18508
18554
|
},
|
|
18509
18555
|
{}
|