@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.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;
|
|
@@ -13503,8 +13558,8 @@ function ShopifyShop(instance, store) {
|
|
|
13503
13558
|
}
|
|
13504
13559
|
|
|
13505
13560
|
// src/compatibility/drops/all_products.ts
|
|
13506
|
-
import { Drop as
|
|
13507
|
-
var AllProductsDrop = class extends
|
|
13561
|
+
import { Drop as Drop7 } from "liquidjs";
|
|
13562
|
+
var AllProductsDrop = class extends Drop7 {
|
|
13508
13563
|
#instance;
|
|
13509
13564
|
#map;
|
|
13510
13565
|
constructor(instance) {
|
|
@@ -13546,8 +13601,8 @@ var AllProductsDrop = class extends Drop6 {
|
|
|
13546
13601
|
};
|
|
13547
13602
|
|
|
13548
13603
|
// src/compatibility/drops/articles.ts
|
|
13549
|
-
import { Drop as
|
|
13550
|
-
var ArticlesDrop = class extends
|
|
13604
|
+
import { Drop as Drop8 } from "liquidjs";
|
|
13605
|
+
var ArticlesDrop = class extends Drop8 {
|
|
13551
13606
|
#instance;
|
|
13552
13607
|
#map;
|
|
13553
13608
|
constructor(instance) {
|
|
@@ -13589,8 +13644,8 @@ var ArticlesDrop = class extends Drop7 {
|
|
|
13589
13644
|
};
|
|
13590
13645
|
|
|
13591
13646
|
// src/compatibility/drops/blogs.ts
|
|
13592
|
-
import { Drop as
|
|
13593
|
-
var BlogsDrop = class extends
|
|
13647
|
+
import { Drop as Drop9 } from "liquidjs";
|
|
13648
|
+
var BlogsDrop = class extends Drop9 {
|
|
13594
13649
|
#instance;
|
|
13595
13650
|
#map;
|
|
13596
13651
|
constructor(instance) {
|
|
@@ -13636,7 +13691,7 @@ var BlogsDrop = class extends Drop8 {
|
|
|
13636
13691
|
};
|
|
13637
13692
|
|
|
13638
13693
|
// src/compatibility/drops/collections.ts
|
|
13639
|
-
import { Drop as
|
|
13694
|
+
import { Drop as Drop10 } from "liquidjs";
|
|
13640
13695
|
var AllCategoryResource = class extends StorefrontResource {
|
|
13641
13696
|
constructor(instance) {
|
|
13642
13697
|
super(() => {
|
|
@@ -13650,7 +13705,7 @@ var AllCategoryResource = class extends StorefrontResource {
|
|
|
13650
13705
|
});
|
|
13651
13706
|
}
|
|
13652
13707
|
};
|
|
13653
|
-
var CollectionsDrop = class extends
|
|
13708
|
+
var CollectionsDrop = class extends Drop10 {
|
|
13654
13709
|
#instance;
|
|
13655
13710
|
#map;
|
|
13656
13711
|
constructor(instance) {
|
|
@@ -13767,8 +13822,8 @@ var SwellStorefrontProducts = class extends SwellStorefrontCollection {
|
|
|
13767
13822
|
};
|
|
13768
13823
|
|
|
13769
13824
|
// src/compatibility/drops/images.ts
|
|
13770
|
-
import { Drop as
|
|
13771
|
-
var ImagesDrop = class extends
|
|
13825
|
+
import { Drop as Drop11 } from "liquidjs";
|
|
13826
|
+
var ImagesDrop = class extends Drop11 {
|
|
13772
13827
|
#instance;
|
|
13773
13828
|
#map;
|
|
13774
13829
|
constructor(instance) {
|
|
@@ -13822,8 +13877,8 @@ var SwellImage = class extends StorefrontResource {
|
|
|
13822
13877
|
};
|
|
13823
13878
|
|
|
13824
13879
|
// src/compatibility/drops/object-handles.ts
|
|
13825
|
-
import { Drop as
|
|
13826
|
-
var ObjectHandlesDrop = class extends
|
|
13880
|
+
import { Drop as Drop12 } from "liquidjs";
|
|
13881
|
+
var ObjectHandlesDrop = class extends Drop12 {
|
|
13827
13882
|
#map;
|
|
13828
13883
|
constructor(map) {
|
|
13829
13884
|
super();
|
|
@@ -13863,8 +13918,8 @@ var ObjectHandlesDrop = class extends Drop11 {
|
|
|
13863
13918
|
};
|
|
13864
13919
|
|
|
13865
13920
|
// src/compatibility/drops/pages.ts
|
|
13866
|
-
import { Drop as
|
|
13867
|
-
var PagesDrop = class extends
|
|
13921
|
+
import { Drop as Drop13 } from "liquidjs";
|
|
13922
|
+
var PagesDrop = class extends Drop13 {
|
|
13868
13923
|
#instance;
|
|
13869
13924
|
#map;
|
|
13870
13925
|
constructor(instance) {
|
|
@@ -14563,29 +14618,6 @@ ${injects.join("\n")}</script>`;
|
|
|
14563
14618
|
}
|
|
14564
14619
|
};
|
|
14565
14620
|
|
|
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
14621
|
// src/liquid/drops/render.ts
|
|
14590
14622
|
import { Drop as Drop14 } from "liquidjs";
|
|
14591
14623
|
import { noop as noop2 } from "lodash-es";
|
|
@@ -15252,12 +15284,12 @@ function bind11(liquidSwell) {
|
|
|
15252
15284
|
});
|
|
15253
15285
|
});
|
|
15254
15286
|
if (output && schema && settings) {
|
|
15255
|
-
const { shopify_compatibility: shopifyCompatibility } = liquidSwell.theme.globals;
|
|
15256
15287
|
const tag = schema.tag || "div";
|
|
15257
|
-
const
|
|
15258
|
-
const
|
|
15288
|
+
const sectionClassName = liquidSwell.theme.getSectionClassName();
|
|
15289
|
+
const sectionIdPrefix = liquidSwell.theme.getSectionIdPrefix();
|
|
15290
|
+
const id = `${sectionIdPrefix}-${settings.id || this.fileName}`;
|
|
15259
15291
|
emitter.write(
|
|
15260
|
-
`<${tag} id="${id}" class="${
|
|
15292
|
+
`<${tag} id="${id}" class="${sectionClassName} ${schema.class || ""}">${output}</${tag}>`
|
|
15261
15293
|
);
|
|
15262
15294
|
}
|
|
15263
15295
|
}
|
|
@@ -15289,12 +15321,13 @@ function bind12(liquidSwell) {
|
|
|
15289
15321
|
const sectionConfigs = yield liquidSwell.renderPageSections(
|
|
15290
15322
|
sectionGroup
|
|
15291
15323
|
);
|
|
15292
|
-
const
|
|
15324
|
+
const sectionClassName = liquidSwell.theme.getSectionClassName();
|
|
15325
|
+
const sectionIdPrefix = liquidSwell.theme.getSectionIdPrefix();
|
|
15293
15326
|
emitter.write(
|
|
15294
15327
|
`<div id="swell-section-group__${this.fileName}">${sectionConfigs.map((section) => {
|
|
15295
15328
|
const tag = section.tag || "div";
|
|
15296
|
-
const id = `${
|
|
15297
|
-
const className =
|
|
15329
|
+
const id = `${sectionIdPrefix}-sections--${themeConfig.hash}__${section.id}`;
|
|
15330
|
+
const className = `${sectionClassName} ${sectionClassName}-group-${this.fileName} section-${section.id}`;
|
|
15298
15331
|
return `<${tag} id="${id}" class="${className} ${section.class || ""}">${section.output}</${tag}>`;
|
|
15299
15332
|
}).join("")}</div>`
|
|
15300
15333
|
);
|
|
@@ -15479,7 +15512,7 @@ var tags = {
|
|
|
15479
15512
|
};
|
|
15480
15513
|
function bindTags(liquidSwell) {
|
|
15481
15514
|
Object.entries(tags).forEach(
|
|
15482
|
-
([tag,
|
|
15515
|
+
([tag, bind66]) => liquidSwell.registerTag(tag, bind66(liquidSwell))
|
|
15483
15516
|
);
|
|
15484
15517
|
}
|
|
15485
15518
|
|
|
@@ -16032,8 +16065,17 @@ function bind46(_liquidSwell) {
|
|
|
16032
16065
|
};
|
|
16033
16066
|
}
|
|
16034
16067
|
|
|
16068
|
+
// src/liquid/filters/minus.ts
|
|
16069
|
+
function bind47(_liquidSwell) {
|
|
16070
|
+
return (first, second) => {
|
|
16071
|
+
const firstValue = isNumber(first) ? first : 0;
|
|
16072
|
+
const secondValue = isNumber(second) ? second : 0;
|
|
16073
|
+
return firstValue - secondValue;
|
|
16074
|
+
};
|
|
16075
|
+
}
|
|
16076
|
+
|
|
16035
16077
|
// src/liquid/filters/money.ts
|
|
16036
|
-
function
|
|
16078
|
+
function bind48(liquidSwell) {
|
|
16037
16079
|
return function filterMoney(value) {
|
|
16038
16080
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16039
16081
|
return liquidSwell.renderCurrency(amount);
|
|
@@ -16050,7 +16092,7 @@ function getMoneyAmount(liquidSwell, value) {
|
|
|
16050
16092
|
}
|
|
16051
16093
|
|
|
16052
16094
|
// src/liquid/filters/money_with_currency.ts
|
|
16053
|
-
function
|
|
16095
|
+
function bind49(liquidSwell) {
|
|
16054
16096
|
return function filterMoneyWithCurrency(value) {
|
|
16055
16097
|
const { currency } = liquidSwell.theme.swell.getStorefrontLocalization();
|
|
16056
16098
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
@@ -16059,7 +16101,7 @@ function bind48(liquidSwell) {
|
|
|
16059
16101
|
}
|
|
16060
16102
|
|
|
16061
16103
|
// src/liquid/filters/money_without_currency.ts
|
|
16062
|
-
function
|
|
16104
|
+
function bind50(liquidSwell) {
|
|
16063
16105
|
return function filterMoneyWithoutCurrency(value) {
|
|
16064
16106
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16065
16107
|
return liquidSwell.renderCurrency(amount).replace(/[^0-9.,]/g, "");
|
|
@@ -16067,7 +16109,7 @@ function bind49(liquidSwell) {
|
|
|
16067
16109
|
}
|
|
16068
16110
|
|
|
16069
16111
|
// src/liquid/filters/money_without_trailing_zeros.ts
|
|
16070
|
-
function
|
|
16112
|
+
function bind51(liquidSwell) {
|
|
16071
16113
|
return function filterMoneyWithoutTrailingZeros(value) {
|
|
16072
16114
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16073
16115
|
return liquidSwell.renderCurrency(amount).split(".")[0].split(",")[0];
|
|
@@ -16075,21 +16117,21 @@ function bind50(liquidSwell) {
|
|
|
16075
16117
|
}
|
|
16076
16118
|
|
|
16077
16119
|
// src/liquid/filters/script_tag.ts
|
|
16078
|
-
function
|
|
16120
|
+
function bind52(_liquidSwell) {
|
|
16079
16121
|
return function filterScriptTag(assetUrl) {
|
|
16080
16122
|
return `<script src="${assetUrl}" type="text/javascript"></script>`;
|
|
16081
16123
|
};
|
|
16082
16124
|
}
|
|
16083
16125
|
|
|
16084
16126
|
// src/liquid/filters/stylesheet_tag.ts
|
|
16085
|
-
function
|
|
16127
|
+
function bind53(_liquidSwell) {
|
|
16086
16128
|
return function filterStyleSheetTag(assetUrl) {
|
|
16087
16129
|
return `<link href="${assetUrl}" rel="stylesheet" type="text/css" media="all" />`;
|
|
16088
16130
|
};
|
|
16089
16131
|
}
|
|
16090
16132
|
|
|
16091
16133
|
// src/liquid/filters/time_tag.ts
|
|
16092
|
-
function
|
|
16134
|
+
function bind54(_liquidSwell) {
|
|
16093
16135
|
const dateFilter = bind33(_liquidSwell);
|
|
16094
16136
|
return (dateValue, ...params) => {
|
|
16095
16137
|
const date = ensureDate(dateValue);
|
|
@@ -16100,7 +16142,7 @@ function bind53(_liquidSwell) {
|
|
|
16100
16142
|
}
|
|
16101
16143
|
|
|
16102
16144
|
// src/liquid/filters/translate.ts
|
|
16103
|
-
function
|
|
16145
|
+
function bind55(liquidSwell) {
|
|
16104
16146
|
return async function filterTranslate(key, params) {
|
|
16105
16147
|
const props = params && paramsToProps(params);
|
|
16106
16148
|
const str = await liquidSwell.renderTranslation(key, props);
|
|
@@ -16109,7 +16151,7 @@ function bind54(liquidSwell) {
|
|
|
16109
16151
|
}
|
|
16110
16152
|
|
|
16111
16153
|
// src/liquid/filters/where.ts
|
|
16112
|
-
function
|
|
16154
|
+
function bind56(_liquidSwell) {
|
|
16113
16155
|
return function* filterWhere(arr, property, expected) {
|
|
16114
16156
|
const results = [];
|
|
16115
16157
|
const list = yield resolveEnumerable(arr);
|
|
@@ -16163,7 +16205,7 @@ function getSizesFromParam(param) {
|
|
|
16163
16205
|
height: height ? Number(height) : void 0
|
|
16164
16206
|
};
|
|
16165
16207
|
}
|
|
16166
|
-
function
|
|
16208
|
+
function bind57(liquidSwell) {
|
|
16167
16209
|
return async function filterAssetImgUrl(assetPath, size = "small") {
|
|
16168
16210
|
const imageUrl = await liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
|
|
16169
16211
|
const sizes = getSizesFromParam(size);
|
|
@@ -16179,14 +16221,14 @@ function bind56(liquidSwell) {
|
|
|
16179
16221
|
}
|
|
16180
16222
|
|
|
16181
16223
|
// src/liquid/filters/shopify/hex_to_rgba.ts
|
|
16182
|
-
function
|
|
16224
|
+
function bind58(_liquidSwell) {
|
|
16183
16225
|
return (color, alpha) => {
|
|
16184
16226
|
return ThemeColor.get(color).rgba(alpha || 1);
|
|
16185
16227
|
};
|
|
16186
16228
|
}
|
|
16187
16229
|
|
|
16188
16230
|
// src/liquid/filters/shopify/img_url.ts
|
|
16189
|
-
function
|
|
16231
|
+
function bind59(_liquidSwell) {
|
|
16190
16232
|
return function filterImgUrl(input, ...params) {
|
|
16191
16233
|
if (!input) return "";
|
|
16192
16234
|
let url;
|
|
@@ -16231,14 +16273,14 @@ var item_count_for_variant_default = {
|
|
|
16231
16273
|
};
|
|
16232
16274
|
|
|
16233
16275
|
// src/liquid/filters/shopify/payment_button.ts
|
|
16234
|
-
function
|
|
16276
|
+
function bind60(_liquidSwell) {
|
|
16235
16277
|
return (form) => {
|
|
16236
16278
|
return null;
|
|
16237
16279
|
};
|
|
16238
16280
|
}
|
|
16239
16281
|
|
|
16240
16282
|
// src/liquid/filters/shopify/payment_terms.ts
|
|
16241
|
-
function
|
|
16283
|
+
function bind61(_liquidSwell) {
|
|
16242
16284
|
return (form) => {
|
|
16243
16285
|
return null;
|
|
16244
16286
|
};
|
|
@@ -16340,7 +16382,7 @@ var svgs = {
|
|
|
16340
16382
|
var placeholder_svgs_default = svgs;
|
|
16341
16383
|
|
|
16342
16384
|
// src/liquid/filters/shopify/placeholder_svg_tag.ts
|
|
16343
|
-
function
|
|
16385
|
+
function bind62(_liquidSwell) {
|
|
16344
16386
|
return function filterPlaceholderSvgTag(name, className) {
|
|
16345
16387
|
const svg = placeholder_svgs_default[name];
|
|
16346
16388
|
if (typeof svg === "object" && svg !== null) {
|
|
@@ -16351,7 +16393,7 @@ function bind61(_liquidSwell) {
|
|
|
16351
16393
|
}
|
|
16352
16394
|
|
|
16353
16395
|
// src/liquid/filters/shopify/shopify_asset_url.ts
|
|
16354
|
-
function
|
|
16396
|
+
function bind63(_liquidSwell) {
|
|
16355
16397
|
return function filterShopifyAssetUrl(input) {
|
|
16356
16398
|
if (typeof input === "string") {
|
|
16357
16399
|
switch (input) {
|
|
@@ -16376,7 +16418,7 @@ function bind62(_liquidSwell) {
|
|
|
16376
16418
|
}
|
|
16377
16419
|
|
|
16378
16420
|
// src/liquid/filters/shopify/structured_data.ts
|
|
16379
|
-
function
|
|
16421
|
+
function bind64(_liquidSwell) {
|
|
16380
16422
|
return async function filterStructuredData(input) {
|
|
16381
16423
|
let value = input;
|
|
16382
16424
|
if (value instanceof StorefrontResource) {
|
|
@@ -16454,7 +16496,7 @@ function convertToSchemaOrgProductGroup(product) {
|
|
|
16454
16496
|
}
|
|
16455
16497
|
|
|
16456
16498
|
// src/liquid/filters/inline_editable.ts
|
|
16457
|
-
function
|
|
16499
|
+
function bind65(_liquidSwell) {
|
|
16458
16500
|
return (value, key) => {
|
|
16459
16501
|
if (typeof value === "object" && "value" in value) {
|
|
16460
16502
|
value = value.value;
|
|
@@ -16498,29 +16540,30 @@ var filters = {
|
|
|
16498
16540
|
json: bind44,
|
|
16499
16541
|
json_pretty: bind45,
|
|
16500
16542
|
locale_flag: bind46,
|
|
16501
|
-
|
|
16502
|
-
|
|
16503
|
-
|
|
16504
|
-
|
|
16505
|
-
|
|
16506
|
-
|
|
16507
|
-
|
|
16508
|
-
|
|
16509
|
-
|
|
16543
|
+
minus: bind47,
|
|
16544
|
+
money: bind48,
|
|
16545
|
+
money_with_currency: bind49,
|
|
16546
|
+
money_without_currency: bind50,
|
|
16547
|
+
money_without_trailing_zeros: bind51,
|
|
16548
|
+
script_tag: bind52,
|
|
16549
|
+
stylesheet_tag: bind53,
|
|
16550
|
+
time_tag: bind54,
|
|
16551
|
+
translate: bind55,
|
|
16552
|
+
t: bind55,
|
|
16510
16553
|
// alias
|
|
16511
|
-
where:
|
|
16554
|
+
where: bind56,
|
|
16512
16555
|
// Shopify compatibility only
|
|
16513
|
-
asset_img_url:
|
|
16514
|
-
hex_to_rgba:
|
|
16515
|
-
img_url:
|
|
16556
|
+
asset_img_url: bind57,
|
|
16557
|
+
hex_to_rgba: bind58,
|
|
16558
|
+
img_url: bind59,
|
|
16516
16559
|
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:
|
|
16560
|
+
payment_button: bind60,
|
|
16561
|
+
payment_terms: bind61,
|
|
16562
|
+
placeholder_svg_tag: bind62,
|
|
16563
|
+
shopify_asset_url: bind63,
|
|
16564
|
+
structured_data: bind64,
|
|
16522
16565
|
// Swell only
|
|
16523
|
-
inline_editable:
|
|
16566
|
+
inline_editable: bind65
|
|
16524
16567
|
};
|
|
16525
16568
|
function bindFilters(liquidSwell) {
|
|
16526
16569
|
for (const [tag, handler] of Object.entries(filters)) {
|
|
@@ -16534,8 +16577,8 @@ function bindFilters(liquidSwell) {
|
|
|
16534
16577
|
}
|
|
16535
16578
|
}
|
|
16536
16579
|
}
|
|
16537
|
-
function bindWithResolvedProps(liquidSwell,
|
|
16538
|
-
const handler =
|
|
16580
|
+
function bindWithResolvedProps(liquidSwell, bind66, resolve = []) {
|
|
16581
|
+
const handler = bind66(liquidSwell);
|
|
16539
16582
|
if (!Array.isArray(resolve)) {
|
|
16540
16583
|
return handler;
|
|
16541
16584
|
}
|
|
@@ -16597,7 +16640,8 @@ var swellOperators = {
|
|
|
16597
16640
|
if (isArray(l)) return l.some((i) => equal(i, r));
|
|
16598
16641
|
if (isFunction(l?.indexOf)) return l.indexOf(toValue(r)) > -1;
|
|
16599
16642
|
return false;
|
|
16600
|
-
}
|
|
16643
|
+
},
|
|
16644
|
+
",": (l, r) => `${l},${r}`
|
|
16601
16645
|
};
|
|
16602
16646
|
function equal(lhs, rhs) {
|
|
16603
16647
|
if (isComparable(lhs)) return lhs.equals(rhs);
|
|
@@ -16752,7 +16796,7 @@ function isThemeColorLike(value) {
|
|
|
16752
16796
|
}
|
|
16753
16797
|
|
|
16754
16798
|
// src/liquid/index.ts
|
|
16755
|
-
var
|
|
16799
|
+
var LiquidSwell31 = class extends Liquid3 {
|
|
16756
16800
|
theme;
|
|
16757
16801
|
getThemeConfig;
|
|
16758
16802
|
getThemeTemplateConfigByType;
|
|
@@ -17426,7 +17470,7 @@ var SwellTheme3 = class {
|
|
|
17426
17470
|
this.resources = resources;
|
|
17427
17471
|
this.dynamicAssetUrl = dynamicAssetUrl;
|
|
17428
17472
|
this.shopifyCompatibilityClass = shopifyCompatibilityClass || ShopifyCompatibility2;
|
|
17429
|
-
this.liquidSwell = new
|
|
17473
|
+
this.liquidSwell = new LiquidSwell31({
|
|
17430
17474
|
theme: this,
|
|
17431
17475
|
getThemeConfig: this.getThemeConfig.bind(this),
|
|
17432
17476
|
getAssetUrl: this.getAssetUrl.bind(this),
|
|
@@ -18344,6 +18388,12 @@ ${content.slice(pos)}`;
|
|
|
18344
18388
|
isShopify1HomePage(pageId, pageContent) {
|
|
18345
18389
|
return Boolean(pageId === "index" && typeof pageContent === "string");
|
|
18346
18390
|
}
|
|
18391
|
+
getSectionClassName() {
|
|
18392
|
+
return this.shopifyCompatibility ? "shopify-section" : "swell-section";
|
|
18393
|
+
}
|
|
18394
|
+
getSectionIdPrefix() {
|
|
18395
|
+
return this.shopifyCompatibility ? "shopify-section" : "swell-section";
|
|
18396
|
+
}
|
|
18347
18397
|
async renderAllSections(sectionsIds, pageData) {
|
|
18348
18398
|
const sections = typeof sectionsIds === "string" ? sectionsIds.split(/\s*,\s*/) : sectionsIds;
|
|
18349
18399
|
const sectionsRendered = await Promise.all(
|
|
@@ -18351,18 +18401,14 @@ ${content.slice(pos)}`;
|
|
|
18351
18401
|
return this.renderSection(sectionId, pageData);
|
|
18352
18402
|
})
|
|
18353
18403
|
);
|
|
18404
|
+
const sectionClassName = this.getSectionClassName();
|
|
18405
|
+
const sectionIdPrefix = this.getSectionIdPrefix();
|
|
18354
18406
|
return sectionsRendered.reduce(
|
|
18355
18407
|
(acc, section, index) => {
|
|
18356
18408
|
const sectionId = sections[index];
|
|
18357
|
-
|
|
18358
|
-
|
|
18359
|
-
<div id="shopify-section-${sectionId}" class="shopify-section">${String(section)}</div>
|
|
18409
|
+
acc[sectionId] = `
|
|
18410
|
+
<div id="${sectionIdPrefix}-${sectionId}" class="${sectionClassName}">${String(section)}</div>
|
|
18360
18411
|
`.trim();
|
|
18361
|
-
} else {
|
|
18362
|
-
acc[sectionId] = `
|
|
18363
|
-
<div id="swell-section-${sectionId}" class="swell-section">${String(section)}</div>
|
|
18364
|
-
`.trim();
|
|
18365
|
-
}
|
|
18366
18412
|
return acc;
|
|
18367
18413
|
},
|
|
18368
18414
|
{}
|
|
@@ -19879,7 +19925,7 @@ export {
|
|
|
19879
19925
|
GEO_DATA,
|
|
19880
19926
|
HtmlCache,
|
|
19881
19927
|
LANG_TO_COUNTRY_CODES,
|
|
19882
|
-
|
|
19928
|
+
LiquidSwell31 as LiquidSwell,
|
|
19883
19929
|
MAX_QUERY_PAGE_LIMIT,
|
|
19884
19930
|
MockRecordResource,
|
|
19885
19931
|
MockRecordSingleton,
|