@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.mjs
CHANGED
|
@@ -4617,8 +4617,8 @@ var SORT_OPTIONS = Object.freeze([
|
|
|
4617
4617
|
{ value: "popularity", name: "Popularity", query: "popularity desc" },
|
|
4618
4618
|
{ value: "price_asc", name: "Price, low to high", query: "price asc" },
|
|
4619
4619
|
{ value: "price_desc", name: "Price, high to low", query: "price desc" },
|
|
4620
|
-
{ value: "date_asc", name: "Date, old to new", query: "
|
|
4621
|
-
{ value: "date_desc", name: "Date, new to old", query: "
|
|
4620
|
+
{ value: "date_asc", name: "Date, old to new", query: "date_created asc" },
|
|
4621
|
+
{ value: "date_desc", name: "Date, new to old", query: "date_created desc" },
|
|
4622
4622
|
{ value: "name_asc", name: "Product name, A-Z", query: "name asc" },
|
|
4623
4623
|
{ value: "name_desc", name: "Product name, Z-A", query: "name desc" }
|
|
4624
4624
|
]);
|
|
@@ -5411,23 +5411,58 @@ function getBlog(swell, id, query) {
|
|
|
5411
5411
|
// src/easyblocks/config.ts
|
|
5412
5412
|
import JSON53 from "json5";
|
|
5413
5413
|
import { reduce as reduce2 } from "lodash-es";
|
|
5414
|
+
|
|
5415
|
+
// src/compatibility/drops/template.ts
|
|
5416
|
+
import { Drop as Drop3 } from "liquidjs";
|
|
5417
|
+
var TemplateDrop = class extends Drop3 {
|
|
5418
|
+
constructor(name, directory, suffix) {
|
|
5419
|
+
super();
|
|
5420
|
+
this.name = name;
|
|
5421
|
+
this.directory = directory;
|
|
5422
|
+
this.suffix = suffix;
|
|
5423
|
+
}
|
|
5424
|
+
valueOf() {
|
|
5425
|
+
return this.name;
|
|
5426
|
+
}
|
|
5427
|
+
};
|
|
5428
|
+
|
|
5429
|
+
// src/compatibility/shopify-objects/template.ts
|
|
5430
|
+
function ShopifyTemplate(instance, template) {
|
|
5431
|
+
return new TemplateDrop(
|
|
5432
|
+
instance.getPageType(template.name),
|
|
5433
|
+
template.path,
|
|
5434
|
+
template.alt_name
|
|
5435
|
+
);
|
|
5436
|
+
}
|
|
5437
|
+
|
|
5438
|
+
// src/easyblocks/config.ts
|
|
5414
5439
|
var NO_INLINE = true;
|
|
5415
5440
|
async function getEasyblocksPageTemplate(theme, pageId, altTemplate) {
|
|
5416
5441
|
let templateConfig = null;
|
|
5442
|
+
let templateData = {
|
|
5443
|
+
name: pageId
|
|
5444
|
+
};
|
|
5445
|
+
if (theme.shopifyCompatibility) {
|
|
5446
|
+
templateData = ShopifyTemplate(theme.shopifyCompatibility, templateData);
|
|
5447
|
+
}
|
|
5448
|
+
const { name } = templateData;
|
|
5417
5449
|
templateConfig = await theme.getThemeTemplateConfigByType(
|
|
5418
5450
|
"templates",
|
|
5419
|
-
|
|
5451
|
+
name,
|
|
5420
5452
|
altTemplate
|
|
5421
5453
|
);
|
|
5422
5454
|
if (templateConfig) {
|
|
5423
|
-
|
|
5424
|
-
|
|
5455
|
+
let result = templateConfig.file_data;
|
|
5456
|
+
if (!templateConfig.file_path.endsWith(".liquid")) {
|
|
5457
|
+
try {
|
|
5458
|
+
result = JSON53.parse(templateConfig.file_data);
|
|
5459
|
+
} catch {
|
|
5460
|
+
}
|
|
5425
5461
|
}
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
} catch {
|
|
5429
|
-
return templateConfig.file_data;
|
|
5462
|
+
if (result && typeof result === "object") {
|
|
5463
|
+
result.id = name;
|
|
5430
5464
|
}
|
|
5465
|
+
return result;
|
|
5431
5466
|
}
|
|
5432
5467
|
}
|
|
5433
5468
|
function getAcceptedLayoutSections(allSections, groupType) {
|
|
@@ -11369,11 +11404,11 @@ __export(shopify_objects_exports, {
|
|
|
11369
11404
|
});
|
|
11370
11405
|
|
|
11371
11406
|
// src/compatibility/drops/image.ts
|
|
11372
|
-
import { Drop as
|
|
11407
|
+
import { Drop as Drop5 } from "liquidjs";
|
|
11373
11408
|
|
|
11374
11409
|
// src/compatibility/drops/image-src.ts
|
|
11375
|
-
import { Drop as
|
|
11376
|
-
var ImageSrcDrop = class extends
|
|
11410
|
+
import { Drop as Drop4 } from "liquidjs";
|
|
11411
|
+
var ImageSrcDrop = class extends Drop4 {
|
|
11377
11412
|
constructor(url, width, height) {
|
|
11378
11413
|
super();
|
|
11379
11414
|
this.url = url;
|
|
@@ -11396,7 +11431,7 @@ var ImageSrcDrop = class extends Drop3 {
|
|
|
11396
11431
|
};
|
|
11397
11432
|
|
|
11398
11433
|
// src/compatibility/drops/image.ts
|
|
11399
|
-
var ImageDrop = class extends
|
|
11434
|
+
var ImageDrop = class extends Drop5 {
|
|
11400
11435
|
id;
|
|
11401
11436
|
alt;
|
|
11402
11437
|
src;
|
|
@@ -11607,7 +11642,9 @@ function ShopifyVariant(instance, variant, productIn, depth = 0) {
|
|
|
11607
11642
|
),
|
|
11608
11643
|
barcode: void 0,
|
|
11609
11644
|
compare_at_price: defer(
|
|
11610
|
-
() => instance.toShopifyPrice(
|
|
11645
|
+
() => instance.toShopifyPrice(
|
|
11646
|
+
getPriceField(product, variant, "orig_price")
|
|
11647
|
+
)
|
|
11611
11648
|
),
|
|
11612
11649
|
featured_image: deferWith(
|
|
11613
11650
|
[product, variant],
|
|
@@ -11654,13 +11691,14 @@ function ShopifyVariant(instance, variant, productIn, depth = 0) {
|
|
|
11654
11691
|
// Deprecated by Shopify
|
|
11655
11692
|
option3: getOptionByIndex(product, variant, 2),
|
|
11656
11693
|
// Deprecated by Shopify
|
|
11657
|
-
price: deferWith(
|
|
11658
|
-
|
|
11659
|
-
|
|
11660
|
-
|
|
11694
|
+
price: deferWith(
|
|
11695
|
+
[product, variant],
|
|
11696
|
+
(product2, variant2) => {
|
|
11697
|
+
return instance.toShopifyPrice(
|
|
11698
|
+
getPriceField(product2, variant2, "price")
|
|
11699
|
+
);
|
|
11661
11700
|
}
|
|
11662
|
-
|
|
11663
|
-
}),
|
|
11701
|
+
),
|
|
11664
11702
|
product: deferWith(product, (product2) => {
|
|
11665
11703
|
return ShopifyProduct(
|
|
11666
11704
|
instance,
|
|
@@ -11699,7 +11737,11 @@ function ShopifyVariant(instance, variant, productIn, depth = 0) {
|
|
|
11699
11737
|
store_availabilities: [],
|
|
11700
11738
|
taxable: true,
|
|
11701
11739
|
title: defer(() => variant.name),
|
|
11702
|
-
unit_price: defer(
|
|
11740
|
+
unit_price: defer(
|
|
11741
|
+
() => instance.toShopifyPrice(
|
|
11742
|
+
getPriceField(product, variant, "price")
|
|
11743
|
+
)
|
|
11744
|
+
),
|
|
11703
11745
|
unit_price_measurement: void 0,
|
|
11704
11746
|
url: defer(() => product.url),
|
|
11705
11747
|
weight: defer(() => variant.weight),
|
|
@@ -11723,6 +11765,9 @@ function getOptions(product, variant) {
|
|
|
11723
11765
|
return variant2.option_value_ids.map((id) => optionValuesById[id]).filter(Boolean);
|
|
11724
11766
|
});
|
|
11725
11767
|
}
|
|
11768
|
+
function getPriceField(product, variant, field) {
|
|
11769
|
+
return variant[field] ?? product[field];
|
|
11770
|
+
}
|
|
11726
11771
|
function getOptionByIndex(product, variant, index) {
|
|
11727
11772
|
return deferWith(
|
|
11728
11773
|
[product, variant],
|
|
@@ -12150,7 +12195,12 @@ function ShopifyProduct(instance, product, depth = 0) {
|
|
|
12150
12195
|
return instance.toShopifyPrice(product2.price);
|
|
12151
12196
|
}
|
|
12152
12197
|
const max = product2.variants.results.reduce(
|
|
12153
|
-
(max2, variant) =>
|
|
12198
|
+
(max2, variant) => {
|
|
12199
|
+
if (variant.price === void 0 || variant.price === null) {
|
|
12200
|
+
return max2;
|
|
12201
|
+
}
|
|
12202
|
+
return Math.max(max2, variant.price);
|
|
12203
|
+
},
|
|
12154
12204
|
0
|
|
12155
12205
|
);
|
|
12156
12206
|
return instance.toShopifyPrice(max);
|
|
@@ -12160,7 +12210,12 @@ function ShopifyProduct(instance, product, depth = 0) {
|
|
|
12160
12210
|
return instance.toShopifyPrice(product2.price);
|
|
12161
12211
|
}
|
|
12162
12212
|
const min = product2.variants.results.reduce(
|
|
12163
|
-
(min2, variant) =>
|
|
12213
|
+
(min2, variant) => {
|
|
12214
|
+
if (variant.price === void 0 || variant.price === null) {
|
|
12215
|
+
return min2;
|
|
12216
|
+
}
|
|
12217
|
+
return Math.min(min2, variant.price);
|
|
12218
|
+
},
|
|
12164
12219
|
Infinity
|
|
12165
12220
|
);
|
|
12166
12221
|
return instance.toShopifyPrice(min);
|
|
@@ -12170,7 +12225,7 @@ function ShopifyProduct(instance, product, depth = 0) {
|
|
|
12170
12225
|
return false;
|
|
12171
12226
|
}
|
|
12172
12227
|
return product2.variants.results.some(
|
|
12173
|
-
(variant) => variant.price !== product2.price
|
|
12228
|
+
(variant) => variant.price !== void 0 && variant.price !== null && variant.price !== product2.price
|
|
12174
12229
|
);
|
|
12175
12230
|
}),
|
|
12176
12231
|
published_at: deferWith(
|
|
@@ -12909,8 +12964,8 @@ function ShopifyShippingMethod(instance, order) {
|
|
|
12909
12964
|
}
|
|
12910
12965
|
|
|
12911
12966
|
// src/compatibility/drops/money.ts
|
|
12912
|
-
import { Drop as
|
|
12913
|
-
var MoneyDrop = class extends
|
|
12967
|
+
import { Drop as Drop6 } from "liquidjs";
|
|
12968
|
+
var MoneyDrop = class extends Drop6 {
|
|
12914
12969
|
constructor(value, decimals, currency) {
|
|
12915
12970
|
super();
|
|
12916
12971
|
this.value = value;
|
|
@@ -13294,10 +13349,13 @@ function ShopifyPredictiveSearch(instance, search) {
|
|
|
13294
13349
|
if (search instanceof ShopifyResource) {
|
|
13295
13350
|
return search.clone();
|
|
13296
13351
|
}
|
|
13352
|
+
if (search instanceof StorefrontResource) {
|
|
13353
|
+
search = cloneStorefrontResource(search);
|
|
13354
|
+
}
|
|
13297
13355
|
return new ShopifyResource({
|
|
13298
|
-
performed:
|
|
13356
|
+
performed: deferWith(search, (search2) => search2.performed),
|
|
13299
13357
|
resources: ShopifyPredictiveSearchResources(instance, search),
|
|
13300
|
-
terms:
|
|
13358
|
+
terms: deferWith(search, (search2) => search2.query),
|
|
13301
13359
|
types: ["product"]
|
|
13302
13360
|
});
|
|
13303
13361
|
}
|
|
@@ -13368,6 +13426,9 @@ function ShopifySearch(instance, search) {
|
|
|
13368
13426
|
if (search instanceof ShopifyResource) {
|
|
13369
13427
|
return search.clone();
|
|
13370
13428
|
}
|
|
13429
|
+
if (search instanceof StorefrontResource) {
|
|
13430
|
+
search = cloneStorefrontResource(search);
|
|
13431
|
+
}
|
|
13371
13432
|
const resolveProducts = makeProductsCollectionResolve(
|
|
13372
13433
|
instance,
|
|
13373
13434
|
search,
|
|
@@ -13503,8 +13564,8 @@ function ShopifyShop(instance, store) {
|
|
|
13503
13564
|
}
|
|
13504
13565
|
|
|
13505
13566
|
// src/compatibility/drops/all_products.ts
|
|
13506
|
-
import { Drop as
|
|
13507
|
-
var AllProductsDrop = class extends
|
|
13567
|
+
import { Drop as Drop7 } from "liquidjs";
|
|
13568
|
+
var AllProductsDrop = class extends Drop7 {
|
|
13508
13569
|
#instance;
|
|
13509
13570
|
#map;
|
|
13510
13571
|
constructor(instance) {
|
|
@@ -13546,8 +13607,8 @@ var AllProductsDrop = class extends Drop6 {
|
|
|
13546
13607
|
};
|
|
13547
13608
|
|
|
13548
13609
|
// src/compatibility/drops/articles.ts
|
|
13549
|
-
import { Drop as
|
|
13550
|
-
var ArticlesDrop = class extends
|
|
13610
|
+
import { Drop as Drop8 } from "liquidjs";
|
|
13611
|
+
var ArticlesDrop = class extends Drop8 {
|
|
13551
13612
|
#instance;
|
|
13552
13613
|
#map;
|
|
13553
13614
|
constructor(instance) {
|
|
@@ -13589,8 +13650,8 @@ var ArticlesDrop = class extends Drop7 {
|
|
|
13589
13650
|
};
|
|
13590
13651
|
|
|
13591
13652
|
// src/compatibility/drops/blogs.ts
|
|
13592
|
-
import { Drop as
|
|
13593
|
-
var BlogsDrop = class extends
|
|
13653
|
+
import { Drop as Drop9 } from "liquidjs";
|
|
13654
|
+
var BlogsDrop = class extends Drop9 {
|
|
13594
13655
|
#instance;
|
|
13595
13656
|
#map;
|
|
13596
13657
|
constructor(instance) {
|
|
@@ -13636,7 +13697,7 @@ var BlogsDrop = class extends Drop8 {
|
|
|
13636
13697
|
};
|
|
13637
13698
|
|
|
13638
13699
|
// src/compatibility/drops/collections.ts
|
|
13639
|
-
import { Drop as
|
|
13700
|
+
import { Drop as Drop10 } from "liquidjs";
|
|
13640
13701
|
var AllCategoryResource = class extends StorefrontResource {
|
|
13641
13702
|
constructor(instance) {
|
|
13642
13703
|
super(() => {
|
|
@@ -13650,7 +13711,7 @@ var AllCategoryResource = class extends StorefrontResource {
|
|
|
13650
13711
|
});
|
|
13651
13712
|
}
|
|
13652
13713
|
};
|
|
13653
|
-
var CollectionsDrop = class extends
|
|
13714
|
+
var CollectionsDrop = class extends Drop10 {
|
|
13654
13715
|
#instance;
|
|
13655
13716
|
#map;
|
|
13656
13717
|
constructor(instance) {
|
|
@@ -13767,8 +13828,8 @@ var SwellStorefrontProducts = class extends SwellStorefrontCollection {
|
|
|
13767
13828
|
};
|
|
13768
13829
|
|
|
13769
13830
|
// src/compatibility/drops/images.ts
|
|
13770
|
-
import { Drop as
|
|
13771
|
-
var ImagesDrop = class extends
|
|
13831
|
+
import { Drop as Drop11 } from "liquidjs";
|
|
13832
|
+
var ImagesDrop = class extends Drop11 {
|
|
13772
13833
|
#instance;
|
|
13773
13834
|
#map;
|
|
13774
13835
|
constructor(instance) {
|
|
@@ -13822,8 +13883,8 @@ var SwellImage = class extends StorefrontResource {
|
|
|
13822
13883
|
};
|
|
13823
13884
|
|
|
13824
13885
|
// src/compatibility/drops/object-handles.ts
|
|
13825
|
-
import { Drop as
|
|
13826
|
-
var ObjectHandlesDrop = class extends
|
|
13886
|
+
import { Drop as Drop12 } from "liquidjs";
|
|
13887
|
+
var ObjectHandlesDrop = class extends Drop12 {
|
|
13827
13888
|
#map;
|
|
13828
13889
|
constructor(map) {
|
|
13829
13890
|
super();
|
|
@@ -13863,8 +13924,8 @@ var ObjectHandlesDrop = class extends Drop11 {
|
|
|
13863
13924
|
};
|
|
13864
13925
|
|
|
13865
13926
|
// src/compatibility/drops/pages.ts
|
|
13866
|
-
import { Drop as
|
|
13867
|
-
var PagesDrop = class extends
|
|
13927
|
+
import { Drop as Drop13 } from "liquidjs";
|
|
13928
|
+
var PagesDrop = class extends Drop13 {
|
|
13868
13929
|
#instance;
|
|
13869
13930
|
#map;
|
|
13870
13931
|
constructor(instance) {
|
|
@@ -14563,29 +14624,6 @@ ${injects.join("\n")}</script>`;
|
|
|
14563
14624
|
}
|
|
14564
14625
|
};
|
|
14565
14626
|
|
|
14566
|
-
// src/compatibility/drops/template.ts
|
|
14567
|
-
import { Drop as Drop13 } from "liquidjs";
|
|
14568
|
-
var TemplateDrop = class extends Drop13 {
|
|
14569
|
-
constructor(name, directory, suffix) {
|
|
14570
|
-
super();
|
|
14571
|
-
this.name = name;
|
|
14572
|
-
this.directory = directory;
|
|
14573
|
-
this.suffix = suffix;
|
|
14574
|
-
}
|
|
14575
|
-
valueOf() {
|
|
14576
|
-
return this.name;
|
|
14577
|
-
}
|
|
14578
|
-
};
|
|
14579
|
-
|
|
14580
|
-
// src/compatibility/shopify-objects/template.ts
|
|
14581
|
-
function ShopifyTemplate(instance, template) {
|
|
14582
|
-
return new TemplateDrop(
|
|
14583
|
-
instance.getPageType(template.name),
|
|
14584
|
-
template.path,
|
|
14585
|
-
template.alt_name
|
|
14586
|
-
);
|
|
14587
|
-
}
|
|
14588
|
-
|
|
14589
14627
|
// src/liquid/drops/render.ts
|
|
14590
14628
|
import { Drop as Drop14 } from "liquidjs";
|
|
14591
14629
|
import { noop as noop2 } from "lodash-es";
|
|
@@ -15252,12 +15290,12 @@ function bind11(liquidSwell) {
|
|
|
15252
15290
|
});
|
|
15253
15291
|
});
|
|
15254
15292
|
if (output && schema && settings) {
|
|
15255
|
-
const { shopify_compatibility: shopifyCompatibility } = liquidSwell.theme.globals;
|
|
15256
15293
|
const tag = schema.tag || "div";
|
|
15257
|
-
const
|
|
15258
|
-
const
|
|
15294
|
+
const sectionClassName = liquidSwell.theme.getSectionClassName();
|
|
15295
|
+
const sectionIdPrefix = liquidSwell.theme.getSectionIdPrefix();
|
|
15296
|
+
const id = `${sectionIdPrefix}-${settings.id || this.fileName}`;
|
|
15259
15297
|
emitter.write(
|
|
15260
|
-
`<${tag} id="${id}" class="${
|
|
15298
|
+
`<${tag} id="${id}" class="${sectionClassName} ${schema.class || ""}">${output}</${tag}>`
|
|
15261
15299
|
);
|
|
15262
15300
|
}
|
|
15263
15301
|
}
|
|
@@ -15289,12 +15327,13 @@ function bind12(liquidSwell) {
|
|
|
15289
15327
|
const sectionConfigs = yield liquidSwell.renderPageSections(
|
|
15290
15328
|
sectionGroup
|
|
15291
15329
|
);
|
|
15292
|
-
const
|
|
15330
|
+
const sectionClassName = liquidSwell.theme.getSectionClassName();
|
|
15331
|
+
const sectionIdPrefix = liquidSwell.theme.getSectionIdPrefix();
|
|
15293
15332
|
emitter.write(
|
|
15294
15333
|
`<div id="swell-section-group__${this.fileName}">${sectionConfigs.map((section) => {
|
|
15295
15334
|
const tag = section.tag || "div";
|
|
15296
|
-
const id = `${
|
|
15297
|
-
const className =
|
|
15335
|
+
const id = `${sectionIdPrefix}-sections--${themeConfig.hash}__${section.id}`;
|
|
15336
|
+
const className = `${sectionClassName} ${sectionClassName}-group-${this.fileName} section-${section.id}`;
|
|
15298
15337
|
return `<${tag} id="${id}" class="${className} ${section.class || ""}">${section.output}</${tag}>`;
|
|
15299
15338
|
}).join("")}</div>`
|
|
15300
15339
|
);
|
|
@@ -15479,7 +15518,7 @@ var tags = {
|
|
|
15479
15518
|
};
|
|
15480
15519
|
function bindTags(liquidSwell) {
|
|
15481
15520
|
Object.entries(tags).forEach(
|
|
15482
|
-
([tag,
|
|
15521
|
+
([tag, bind66]) => liquidSwell.registerTag(tag, bind66(liquidSwell))
|
|
15483
15522
|
);
|
|
15484
15523
|
}
|
|
15485
15524
|
|
|
@@ -16032,8 +16071,17 @@ function bind46(_liquidSwell) {
|
|
|
16032
16071
|
};
|
|
16033
16072
|
}
|
|
16034
16073
|
|
|
16074
|
+
// src/liquid/filters/minus.ts
|
|
16075
|
+
function bind47(_liquidSwell) {
|
|
16076
|
+
return (first, second) => {
|
|
16077
|
+
const firstValue = isNumber(first) ? first : 0;
|
|
16078
|
+
const secondValue = isNumber(second) ? second : 0;
|
|
16079
|
+
return firstValue - secondValue;
|
|
16080
|
+
};
|
|
16081
|
+
}
|
|
16082
|
+
|
|
16035
16083
|
// src/liquid/filters/money.ts
|
|
16036
|
-
function
|
|
16084
|
+
function bind48(liquidSwell) {
|
|
16037
16085
|
return function filterMoney(value) {
|
|
16038
16086
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16039
16087
|
return liquidSwell.renderCurrency(amount);
|
|
@@ -16050,7 +16098,7 @@ function getMoneyAmount(liquidSwell, value) {
|
|
|
16050
16098
|
}
|
|
16051
16099
|
|
|
16052
16100
|
// src/liquid/filters/money_with_currency.ts
|
|
16053
|
-
function
|
|
16101
|
+
function bind49(liquidSwell) {
|
|
16054
16102
|
return function filterMoneyWithCurrency(value) {
|
|
16055
16103
|
const { currency } = liquidSwell.theme.swell.getStorefrontLocalization();
|
|
16056
16104
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
@@ -16059,7 +16107,7 @@ function bind48(liquidSwell) {
|
|
|
16059
16107
|
}
|
|
16060
16108
|
|
|
16061
16109
|
// src/liquid/filters/money_without_currency.ts
|
|
16062
|
-
function
|
|
16110
|
+
function bind50(liquidSwell) {
|
|
16063
16111
|
return function filterMoneyWithoutCurrency(value) {
|
|
16064
16112
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16065
16113
|
return liquidSwell.renderCurrency(amount).replace(/[^0-9.,]/g, "");
|
|
@@ -16067,7 +16115,7 @@ function bind49(liquidSwell) {
|
|
|
16067
16115
|
}
|
|
16068
16116
|
|
|
16069
16117
|
// src/liquid/filters/money_without_trailing_zeros.ts
|
|
16070
|
-
function
|
|
16118
|
+
function bind51(liquidSwell) {
|
|
16071
16119
|
return function filterMoneyWithoutTrailingZeros(value) {
|
|
16072
16120
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16073
16121
|
return liquidSwell.renderCurrency(amount).split(".")[0].split(",")[0];
|
|
@@ -16075,21 +16123,21 @@ function bind50(liquidSwell) {
|
|
|
16075
16123
|
}
|
|
16076
16124
|
|
|
16077
16125
|
// src/liquid/filters/script_tag.ts
|
|
16078
|
-
function
|
|
16126
|
+
function bind52(_liquidSwell) {
|
|
16079
16127
|
return function filterScriptTag(assetUrl) {
|
|
16080
16128
|
return `<script src="${assetUrl}" type="text/javascript"></script>`;
|
|
16081
16129
|
};
|
|
16082
16130
|
}
|
|
16083
16131
|
|
|
16084
16132
|
// src/liquid/filters/stylesheet_tag.ts
|
|
16085
|
-
function
|
|
16133
|
+
function bind53(_liquidSwell) {
|
|
16086
16134
|
return function filterStyleSheetTag(assetUrl) {
|
|
16087
16135
|
return `<link href="${assetUrl}" rel="stylesheet" type="text/css" media="all" />`;
|
|
16088
16136
|
};
|
|
16089
16137
|
}
|
|
16090
16138
|
|
|
16091
16139
|
// src/liquid/filters/time_tag.ts
|
|
16092
|
-
function
|
|
16140
|
+
function bind54(_liquidSwell) {
|
|
16093
16141
|
const dateFilter = bind33(_liquidSwell);
|
|
16094
16142
|
return (dateValue, ...params) => {
|
|
16095
16143
|
const date = ensureDate(dateValue);
|
|
@@ -16100,7 +16148,7 @@ function bind53(_liquidSwell) {
|
|
|
16100
16148
|
}
|
|
16101
16149
|
|
|
16102
16150
|
// src/liquid/filters/translate.ts
|
|
16103
|
-
function
|
|
16151
|
+
function bind55(liquidSwell) {
|
|
16104
16152
|
return async function filterTranslate(key, params) {
|
|
16105
16153
|
const props = params && paramsToProps(params);
|
|
16106
16154
|
const str = await liquidSwell.renderTranslation(key, props);
|
|
@@ -16109,7 +16157,7 @@ function bind54(liquidSwell) {
|
|
|
16109
16157
|
}
|
|
16110
16158
|
|
|
16111
16159
|
// src/liquid/filters/where.ts
|
|
16112
|
-
function
|
|
16160
|
+
function bind56(_liquidSwell) {
|
|
16113
16161
|
return function* filterWhere(arr, property, expected) {
|
|
16114
16162
|
const results = [];
|
|
16115
16163
|
const list = yield resolveEnumerable(arr);
|
|
@@ -16163,7 +16211,7 @@ function getSizesFromParam(param) {
|
|
|
16163
16211
|
height: height ? Number(height) : void 0
|
|
16164
16212
|
};
|
|
16165
16213
|
}
|
|
16166
|
-
function
|
|
16214
|
+
function bind57(liquidSwell) {
|
|
16167
16215
|
return async function filterAssetImgUrl(assetPath, size = "small") {
|
|
16168
16216
|
const imageUrl = await liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
|
|
16169
16217
|
const sizes = getSizesFromParam(size);
|
|
@@ -16179,14 +16227,14 @@ function bind56(liquidSwell) {
|
|
|
16179
16227
|
}
|
|
16180
16228
|
|
|
16181
16229
|
// src/liquid/filters/shopify/hex_to_rgba.ts
|
|
16182
|
-
function
|
|
16230
|
+
function bind58(_liquidSwell) {
|
|
16183
16231
|
return (color, alpha) => {
|
|
16184
16232
|
return ThemeColor.get(color).rgba(alpha || 1);
|
|
16185
16233
|
};
|
|
16186
16234
|
}
|
|
16187
16235
|
|
|
16188
16236
|
// src/liquid/filters/shopify/img_url.ts
|
|
16189
|
-
function
|
|
16237
|
+
function bind59(_liquidSwell) {
|
|
16190
16238
|
return function filterImgUrl(input, ...params) {
|
|
16191
16239
|
if (!input) return "";
|
|
16192
16240
|
let url;
|
|
@@ -16231,14 +16279,14 @@ var item_count_for_variant_default = {
|
|
|
16231
16279
|
};
|
|
16232
16280
|
|
|
16233
16281
|
// src/liquid/filters/shopify/payment_button.ts
|
|
16234
|
-
function
|
|
16282
|
+
function bind60(_liquidSwell) {
|
|
16235
16283
|
return (form) => {
|
|
16236
16284
|
return null;
|
|
16237
16285
|
};
|
|
16238
16286
|
}
|
|
16239
16287
|
|
|
16240
16288
|
// src/liquid/filters/shopify/payment_terms.ts
|
|
16241
|
-
function
|
|
16289
|
+
function bind61(_liquidSwell) {
|
|
16242
16290
|
return (form) => {
|
|
16243
16291
|
return null;
|
|
16244
16292
|
};
|
|
@@ -16340,7 +16388,7 @@ var svgs = {
|
|
|
16340
16388
|
var placeholder_svgs_default = svgs;
|
|
16341
16389
|
|
|
16342
16390
|
// src/liquid/filters/shopify/placeholder_svg_tag.ts
|
|
16343
|
-
function
|
|
16391
|
+
function bind62(_liquidSwell) {
|
|
16344
16392
|
return function filterPlaceholderSvgTag(name, className) {
|
|
16345
16393
|
const svg = placeholder_svgs_default[name];
|
|
16346
16394
|
if (typeof svg === "object" && svg !== null) {
|
|
@@ -16351,7 +16399,7 @@ function bind61(_liquidSwell) {
|
|
|
16351
16399
|
}
|
|
16352
16400
|
|
|
16353
16401
|
// src/liquid/filters/shopify/shopify_asset_url.ts
|
|
16354
|
-
function
|
|
16402
|
+
function bind63(_liquidSwell) {
|
|
16355
16403
|
return function filterShopifyAssetUrl(input) {
|
|
16356
16404
|
if (typeof input === "string") {
|
|
16357
16405
|
switch (input) {
|
|
@@ -16376,7 +16424,7 @@ function bind62(_liquidSwell) {
|
|
|
16376
16424
|
}
|
|
16377
16425
|
|
|
16378
16426
|
// src/liquid/filters/shopify/structured_data.ts
|
|
16379
|
-
function
|
|
16427
|
+
function bind64(_liquidSwell) {
|
|
16380
16428
|
return async function filterStructuredData(input) {
|
|
16381
16429
|
let value = input;
|
|
16382
16430
|
if (value instanceof StorefrontResource) {
|
|
@@ -16454,7 +16502,7 @@ function convertToSchemaOrgProductGroup(product) {
|
|
|
16454
16502
|
}
|
|
16455
16503
|
|
|
16456
16504
|
// src/liquid/filters/inline_editable.ts
|
|
16457
|
-
function
|
|
16505
|
+
function bind65(_liquidSwell) {
|
|
16458
16506
|
return (value, key) => {
|
|
16459
16507
|
if (typeof value === "object" && "value" in value) {
|
|
16460
16508
|
value = value.value;
|
|
@@ -16498,29 +16546,30 @@ var filters = {
|
|
|
16498
16546
|
json: bind44,
|
|
16499
16547
|
json_pretty: bind45,
|
|
16500
16548
|
locale_flag: bind46,
|
|
16501
|
-
|
|
16502
|
-
|
|
16503
|
-
|
|
16504
|
-
|
|
16505
|
-
|
|
16506
|
-
|
|
16507
|
-
|
|
16508
|
-
|
|
16509
|
-
|
|
16549
|
+
minus: bind47,
|
|
16550
|
+
money: bind48,
|
|
16551
|
+
money_with_currency: bind49,
|
|
16552
|
+
money_without_currency: bind50,
|
|
16553
|
+
money_without_trailing_zeros: bind51,
|
|
16554
|
+
script_tag: bind52,
|
|
16555
|
+
stylesheet_tag: bind53,
|
|
16556
|
+
time_tag: bind54,
|
|
16557
|
+
translate: bind55,
|
|
16558
|
+
t: bind55,
|
|
16510
16559
|
// alias
|
|
16511
|
-
where:
|
|
16560
|
+
where: bind56,
|
|
16512
16561
|
// Shopify compatibility only
|
|
16513
|
-
asset_img_url:
|
|
16514
|
-
hex_to_rgba:
|
|
16515
|
-
img_url:
|
|
16562
|
+
asset_img_url: bind57,
|
|
16563
|
+
hex_to_rgba: bind58,
|
|
16564
|
+
img_url: bind59,
|
|
16516
16565
|
item_count_for_variant: item_count_for_variant_default,
|
|
16517
|
-
payment_button:
|
|
16518
|
-
payment_terms:
|
|
16519
|
-
placeholder_svg_tag:
|
|
16520
|
-
shopify_asset_url:
|
|
16521
|
-
structured_data:
|
|
16566
|
+
payment_button: bind60,
|
|
16567
|
+
payment_terms: bind61,
|
|
16568
|
+
placeholder_svg_tag: bind62,
|
|
16569
|
+
shopify_asset_url: bind63,
|
|
16570
|
+
structured_data: bind64,
|
|
16522
16571
|
// Swell only
|
|
16523
|
-
inline_editable:
|
|
16572
|
+
inline_editable: bind65
|
|
16524
16573
|
};
|
|
16525
16574
|
function bindFilters(liquidSwell) {
|
|
16526
16575
|
for (const [tag, handler] of Object.entries(filters)) {
|
|
@@ -16534,8 +16583,8 @@ function bindFilters(liquidSwell) {
|
|
|
16534
16583
|
}
|
|
16535
16584
|
}
|
|
16536
16585
|
}
|
|
16537
|
-
function bindWithResolvedProps(liquidSwell,
|
|
16538
|
-
const handler =
|
|
16586
|
+
function bindWithResolvedProps(liquidSwell, bind66, resolve = []) {
|
|
16587
|
+
const handler = bind66(liquidSwell);
|
|
16539
16588
|
if (!Array.isArray(resolve)) {
|
|
16540
16589
|
return handler;
|
|
16541
16590
|
}
|
|
@@ -16597,7 +16646,8 @@ var swellOperators = {
|
|
|
16597
16646
|
if (isArray(l)) return l.some((i) => equal(i, r));
|
|
16598
16647
|
if (isFunction(l?.indexOf)) return l.indexOf(toValue(r)) > -1;
|
|
16599
16648
|
return false;
|
|
16600
|
-
}
|
|
16649
|
+
},
|
|
16650
|
+
",": (l, r) => `${l},${r}`
|
|
16601
16651
|
};
|
|
16602
16652
|
function equal(lhs, rhs) {
|
|
16603
16653
|
if (isComparable(lhs)) return lhs.equals(rhs);
|
|
@@ -16752,7 +16802,7 @@ function isThemeColorLike(value) {
|
|
|
16752
16802
|
}
|
|
16753
16803
|
|
|
16754
16804
|
// src/liquid/index.ts
|
|
16755
|
-
var
|
|
16805
|
+
var LiquidSwell31 = class extends Liquid3 {
|
|
16756
16806
|
theme;
|
|
16757
16807
|
getThemeConfig;
|
|
16758
16808
|
getThemeTemplateConfigByType;
|
|
@@ -17426,7 +17476,7 @@ var SwellTheme3 = class {
|
|
|
17426
17476
|
this.resources = resources;
|
|
17427
17477
|
this.dynamicAssetUrl = dynamicAssetUrl;
|
|
17428
17478
|
this.shopifyCompatibilityClass = shopifyCompatibilityClass || ShopifyCompatibility2;
|
|
17429
|
-
this.liquidSwell = new
|
|
17479
|
+
this.liquidSwell = new LiquidSwell31({
|
|
17430
17480
|
theme: this,
|
|
17431
17481
|
getThemeConfig: this.getThemeConfig.bind(this),
|
|
17432
17482
|
getAssetUrl: this.getAssetUrl.bind(this),
|
|
@@ -18344,6 +18394,12 @@ ${content.slice(pos)}`;
|
|
|
18344
18394
|
isShopify1HomePage(pageId, pageContent) {
|
|
18345
18395
|
return Boolean(pageId === "index" && typeof pageContent === "string");
|
|
18346
18396
|
}
|
|
18397
|
+
getSectionClassName() {
|
|
18398
|
+
return this.shopifyCompatibility ? "shopify-section" : "swell-section";
|
|
18399
|
+
}
|
|
18400
|
+
getSectionIdPrefix() {
|
|
18401
|
+
return this.shopifyCompatibility ? "shopify-section" : "swell-section";
|
|
18402
|
+
}
|
|
18347
18403
|
async renderAllSections(sectionsIds, pageData) {
|
|
18348
18404
|
const sections = typeof sectionsIds === "string" ? sectionsIds.split(/\s*,\s*/) : sectionsIds;
|
|
18349
18405
|
const sectionsRendered = await Promise.all(
|
|
@@ -18351,18 +18407,14 @@ ${content.slice(pos)}`;
|
|
|
18351
18407
|
return this.renderSection(sectionId, pageData);
|
|
18352
18408
|
})
|
|
18353
18409
|
);
|
|
18410
|
+
const sectionClassName = this.getSectionClassName();
|
|
18411
|
+
const sectionIdPrefix = this.getSectionIdPrefix();
|
|
18354
18412
|
return sectionsRendered.reduce(
|
|
18355
18413
|
(acc, section, index) => {
|
|
18356
18414
|
const sectionId = sections[index];
|
|
18357
|
-
|
|
18358
|
-
|
|
18359
|
-
<div id="shopify-section-${sectionId}" class="shopify-section">${String(section)}</div>
|
|
18415
|
+
acc[sectionId] = `
|
|
18416
|
+
<div id="${sectionIdPrefix}-${sectionId}" class="${sectionClassName}">${String(section)}</div>
|
|
18360
18417
|
`.trim();
|
|
18361
|
-
} else {
|
|
18362
|
-
acc[sectionId] = `
|
|
18363
|
-
<div id="swell-section-${sectionId}" class="swell-section">${String(section)}</div>
|
|
18364
|
-
`.trim();
|
|
18365
|
-
}
|
|
18366
18418
|
return acc;
|
|
18367
18419
|
},
|
|
18368
18420
|
{}
|
|
@@ -19879,7 +19931,7 @@ export {
|
|
|
19879
19931
|
GEO_DATA,
|
|
19880
19932
|
HtmlCache,
|
|
19881
19933
|
LANG_TO_COUNTRY_CODES,
|
|
19882
|
-
|
|
19934
|
+
LiquidSwell31 as LiquidSwell,
|
|
19883
19935
|
MAX_QUERY_PAGE_LIMIT,
|
|
19884
19936
|
MockRecordResource,
|
|
19885
19937
|
MockRecordSingleton,
|