@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 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: () => LiquidSwell30,
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: "date asc" },
4770
- { value: "date_desc", name: "Date, new to old", query: "date desc" },
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
- pageId,
5600
+ name,
5569
5601
  altTemplate
5570
5602
  );
5571
5603
  if (templateConfig) {
5572
- if (templateConfig.file_path.endsWith(".liquid")) {
5573
- return templateConfig.file_data;
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
- try {
5576
- return import_json53.default.parse(templateConfig.file_data);
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 import_liquidjs4 = require("liquidjs");
11556
+ var import_liquidjs5 = require("liquidjs");
11522
11557
 
11523
11558
  // src/compatibility/drops/image-src.ts
11524
- var import_liquidjs3 = require("liquidjs");
11525
- var ImageSrcDrop = class extends import_liquidjs3.Drop {
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 import_liquidjs4.Drop {
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(variant.orig_price)
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([product, variant], (product2, variant2) => {
11807
- let price = product2.price;
11808
- if (variant2.price !== null && variant2.price !== void 0) {
11809
- price = variant2.price;
11843
+ price: deferWith(
11844
+ [product, variant],
11845
+ (product2, variant2) => {
11846
+ return instance.toShopifyPrice(
11847
+ getPriceField(product2, variant2, "price")
11848
+ );
11810
11849
  }
11811
- return instance.toShopifyPrice(price);
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(() => instance.toShopifyPrice(variant.price)),
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) => Math.max(max2, variant.price),
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) => Math.min(min2, variant.price),
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 import_liquidjs5 = require("liquidjs");
13062
- var MoneyDrop = class extends import_liquidjs5.Drop {
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;
@@ -13443,10 +13498,13 @@ function ShopifyPredictiveSearch(instance, search) {
13443
13498
  if (search instanceof ShopifyResource) {
13444
13499
  return search.clone();
13445
13500
  }
13501
+ if (search instanceof StorefrontResource) {
13502
+ search = cloneStorefrontResource(search);
13503
+ }
13446
13504
  return new ShopifyResource({
13447
- performed: defer(() => search.performed),
13505
+ performed: deferWith(search, (search2) => search2.performed),
13448
13506
  resources: ShopifyPredictiveSearchResources(instance, search),
13449
- terms: defer(() => search.query),
13507
+ terms: deferWith(search, (search2) => search2.query),
13450
13508
  types: ["product"]
13451
13509
  });
13452
13510
  }
@@ -13517,6 +13575,9 @@ function ShopifySearch(instance, search) {
13517
13575
  if (search instanceof ShopifyResource) {
13518
13576
  return search.clone();
13519
13577
  }
13578
+ if (search instanceof StorefrontResource) {
13579
+ search = cloneStorefrontResource(search);
13580
+ }
13520
13581
  const resolveProducts = makeProductsCollectionResolve(
13521
13582
  instance,
13522
13583
  search,
@@ -13652,8 +13713,8 @@ function ShopifyShop(instance, store) {
13652
13713
  }
13653
13714
 
13654
13715
  // src/compatibility/drops/all_products.ts
13655
- var import_liquidjs6 = require("liquidjs");
13656
- var AllProductsDrop = class extends import_liquidjs6.Drop {
13716
+ var import_liquidjs7 = require("liquidjs");
13717
+ var AllProductsDrop = class extends import_liquidjs7.Drop {
13657
13718
  #instance;
13658
13719
  #map;
13659
13720
  constructor(instance) {
@@ -13695,8 +13756,8 @@ var AllProductsDrop = class extends import_liquidjs6.Drop {
13695
13756
  };
13696
13757
 
13697
13758
  // src/compatibility/drops/articles.ts
13698
- var import_liquidjs7 = require("liquidjs");
13699
- var ArticlesDrop = class extends import_liquidjs7.Drop {
13759
+ var import_liquidjs8 = require("liquidjs");
13760
+ var ArticlesDrop = class extends import_liquidjs8.Drop {
13700
13761
  #instance;
13701
13762
  #map;
13702
13763
  constructor(instance) {
@@ -13738,8 +13799,8 @@ var ArticlesDrop = class extends import_liquidjs7.Drop {
13738
13799
  };
13739
13800
 
13740
13801
  // src/compatibility/drops/blogs.ts
13741
- var import_liquidjs8 = require("liquidjs");
13742
- var BlogsDrop = class extends import_liquidjs8.Drop {
13802
+ var import_liquidjs9 = require("liquidjs");
13803
+ var BlogsDrop = class extends import_liquidjs9.Drop {
13743
13804
  #instance;
13744
13805
  #map;
13745
13806
  constructor(instance) {
@@ -13785,7 +13846,7 @@ var BlogsDrop = class extends import_liquidjs8.Drop {
13785
13846
  };
13786
13847
 
13787
13848
  // src/compatibility/drops/collections.ts
13788
- var import_liquidjs9 = require("liquidjs");
13849
+ var import_liquidjs10 = require("liquidjs");
13789
13850
  var AllCategoryResource = class extends StorefrontResource {
13790
13851
  constructor(instance) {
13791
13852
  super(() => {
@@ -13799,7 +13860,7 @@ var AllCategoryResource = class extends StorefrontResource {
13799
13860
  });
13800
13861
  }
13801
13862
  };
13802
- var CollectionsDrop = class extends import_liquidjs9.Drop {
13863
+ var CollectionsDrop = class extends import_liquidjs10.Drop {
13803
13864
  #instance;
13804
13865
  #map;
13805
13866
  constructor(instance) {
@@ -13916,8 +13977,8 @@ var SwellStorefrontProducts = class extends SwellStorefrontCollection {
13916
13977
  };
13917
13978
 
13918
13979
  // src/compatibility/drops/images.ts
13919
- var import_liquidjs10 = require("liquidjs");
13920
- var ImagesDrop = class extends import_liquidjs10.Drop {
13980
+ var import_liquidjs11 = require("liquidjs");
13981
+ var ImagesDrop = class extends import_liquidjs11.Drop {
13921
13982
  #instance;
13922
13983
  #map;
13923
13984
  constructor(instance) {
@@ -13971,8 +14032,8 @@ var SwellImage = class extends StorefrontResource {
13971
14032
  };
13972
14033
 
13973
14034
  // src/compatibility/drops/object-handles.ts
13974
- var import_liquidjs11 = require("liquidjs");
13975
- var ObjectHandlesDrop = class extends import_liquidjs11.Drop {
14035
+ var import_liquidjs12 = require("liquidjs");
14036
+ var ObjectHandlesDrop = class extends import_liquidjs12.Drop {
13976
14037
  #map;
13977
14038
  constructor(map) {
13978
14039
  super();
@@ -14012,8 +14073,8 @@ var ObjectHandlesDrop = class extends import_liquidjs11.Drop {
14012
14073
  };
14013
14074
 
14014
14075
  // src/compatibility/drops/pages.ts
14015
- var import_liquidjs12 = require("liquidjs");
14016
- var PagesDrop = class extends import_liquidjs12.Drop {
14076
+ var import_liquidjs13 = require("liquidjs");
14077
+ var PagesDrop = class extends import_liquidjs13.Drop {
14017
14078
  #instance;
14018
14079
  #map;
14019
14080
  constructor(instance) {
@@ -14712,29 +14773,6 @@ ${injects.join("\n")}</script>`;
14712
14773
  }
14713
14774
  };
14714
14775
 
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
14776
  // src/liquid/drops/render.ts
14739
14777
  var import_liquidjs14 = require("liquidjs");
14740
14778
  var import_lodash_es8 = require("lodash-es");
@@ -15393,12 +15431,12 @@ function bind11(liquidSwell) {
15393
15431
  });
15394
15432
  });
15395
15433
  if (output && schema && settings) {
15396
- const { shopify_compatibility: shopifyCompatibility } = liquidSwell.theme.globals;
15397
15434
  const tag = schema.tag || "div";
15398
- const id = `${shopifyCompatibility ? "shopify" : "swell"}-section-${settings.id || this.fileName}`;
15399
- const className = shopifyCompatibility ? "shopify-section" : "swell-section";
15435
+ const sectionClassName = liquidSwell.theme.getSectionClassName();
15436
+ const sectionIdPrefix = liquidSwell.theme.getSectionIdPrefix();
15437
+ const id = `${sectionIdPrefix}-${settings.id || this.fileName}`;
15400
15438
  emitter.write(
15401
- `<${tag} id="${id}" class="${className} ${schema.class || ""}">${output}</${tag}>`
15439
+ `<${tag} id="${id}" class="${sectionClassName} ${schema.class || ""}">${output}</${tag}>`
15402
15440
  );
15403
15441
  }
15404
15442
  }
@@ -15430,12 +15468,13 @@ function bind12(liquidSwell) {
15430
15468
  const sectionConfigs = yield liquidSwell.renderPageSections(
15431
15469
  sectionGroup
15432
15470
  );
15433
- const { shopify_compatibility: shopifyCompatibility } = liquidSwell.theme.globals;
15471
+ const sectionClassName = liquidSwell.theme.getSectionClassName();
15472
+ const sectionIdPrefix = liquidSwell.theme.getSectionIdPrefix();
15434
15473
  emitter.write(
15435
15474
  `<div id="swell-section-group__${this.fileName}">${sectionConfigs.map((section) => {
15436
15475
  const tag = section.tag || "div";
15437
- const id = `${shopifyCompatibility ? "shopify" : "swell"}-section-sections--${themeConfig.hash}__${section.id}`;
15438
- const className = shopifyCompatibility ? `shopify-section shopify-section-group-${this.fileName} section-${section.id}` : `swell-section swell-section-group-${this.fileName} section-${section.id}`;
15476
+ const id = `${sectionIdPrefix}-sections--${themeConfig.hash}__${section.id}`;
15477
+ const className = `${sectionClassName} ${sectionClassName}-group-${this.fileName} section-${section.id}`;
15439
15478
  return `<${tag} id="${id}" class="${className} ${section.class || ""}">${section.output}</${tag}>`;
15440
15479
  }).join("")}</div>`
15441
15480
  );
@@ -15620,7 +15659,7 @@ var tags = {
15620
15659
  };
15621
15660
  function bindTags(liquidSwell) {
15622
15661
  Object.entries(tags).forEach(
15623
- ([tag, bind65]) => liquidSwell.registerTag(tag, bind65(liquidSwell))
15662
+ ([tag, bind66]) => liquidSwell.registerTag(tag, bind66(liquidSwell))
15624
15663
  );
15625
15664
  }
15626
15665
 
@@ -16173,8 +16212,17 @@ function bind46(_liquidSwell) {
16173
16212
  };
16174
16213
  }
16175
16214
 
16215
+ // src/liquid/filters/minus.ts
16216
+ function bind47(_liquidSwell) {
16217
+ return (first, second) => {
16218
+ const firstValue = isNumber(first) ? first : 0;
16219
+ const secondValue = isNumber(second) ? second : 0;
16220
+ return firstValue - secondValue;
16221
+ };
16222
+ }
16223
+
16176
16224
  // src/liquid/filters/money.ts
16177
- function bind47(liquidSwell) {
16225
+ function bind48(liquidSwell) {
16178
16226
  return function filterMoney(value) {
16179
16227
  const amount = getMoneyAmount(liquidSwell, value);
16180
16228
  return liquidSwell.renderCurrency(amount);
@@ -16191,7 +16239,7 @@ function getMoneyAmount(liquidSwell, value) {
16191
16239
  }
16192
16240
 
16193
16241
  // src/liquid/filters/money_with_currency.ts
16194
- function bind48(liquidSwell) {
16242
+ function bind49(liquidSwell) {
16195
16243
  return function filterMoneyWithCurrency(value) {
16196
16244
  const { currency } = liquidSwell.theme.swell.getStorefrontLocalization();
16197
16245
  const amount = getMoneyAmount(liquidSwell, value);
@@ -16200,7 +16248,7 @@ function bind48(liquidSwell) {
16200
16248
  }
16201
16249
 
16202
16250
  // src/liquid/filters/money_without_currency.ts
16203
- function bind49(liquidSwell) {
16251
+ function bind50(liquidSwell) {
16204
16252
  return function filterMoneyWithoutCurrency(value) {
16205
16253
  const amount = getMoneyAmount(liquidSwell, value);
16206
16254
  return liquidSwell.renderCurrency(amount).replace(/[^0-9.,]/g, "");
@@ -16208,7 +16256,7 @@ function bind49(liquidSwell) {
16208
16256
  }
16209
16257
 
16210
16258
  // src/liquid/filters/money_without_trailing_zeros.ts
16211
- function bind50(liquidSwell) {
16259
+ function bind51(liquidSwell) {
16212
16260
  return function filterMoneyWithoutTrailingZeros(value) {
16213
16261
  const amount = getMoneyAmount(liquidSwell, value);
16214
16262
  return liquidSwell.renderCurrency(amount).split(".")[0].split(",")[0];
@@ -16216,21 +16264,21 @@ function bind50(liquidSwell) {
16216
16264
  }
16217
16265
 
16218
16266
  // src/liquid/filters/script_tag.ts
16219
- function bind51(_liquidSwell) {
16267
+ function bind52(_liquidSwell) {
16220
16268
  return function filterScriptTag(assetUrl) {
16221
16269
  return `<script src="${assetUrl}" type="text/javascript"></script>`;
16222
16270
  };
16223
16271
  }
16224
16272
 
16225
16273
  // src/liquid/filters/stylesheet_tag.ts
16226
- function bind52(_liquidSwell) {
16274
+ function bind53(_liquidSwell) {
16227
16275
  return function filterStyleSheetTag(assetUrl) {
16228
16276
  return `<link href="${assetUrl}" rel="stylesheet" type="text/css" media="all" />`;
16229
16277
  };
16230
16278
  }
16231
16279
 
16232
16280
  // src/liquid/filters/time_tag.ts
16233
- function bind53(_liquidSwell) {
16281
+ function bind54(_liquidSwell) {
16234
16282
  const dateFilter = bind33(_liquidSwell);
16235
16283
  return (dateValue, ...params) => {
16236
16284
  const date = ensureDate(dateValue);
@@ -16241,7 +16289,7 @@ function bind53(_liquidSwell) {
16241
16289
  }
16242
16290
 
16243
16291
  // src/liquid/filters/translate.ts
16244
- function bind54(liquidSwell) {
16292
+ function bind55(liquidSwell) {
16245
16293
  return async function filterTranslate(key, params) {
16246
16294
  const props = params && paramsToProps(params);
16247
16295
  const str = await liquidSwell.renderTranslation(key, props);
@@ -16250,7 +16298,7 @@ function bind54(liquidSwell) {
16250
16298
  }
16251
16299
 
16252
16300
  // src/liquid/filters/where.ts
16253
- function bind55(_liquidSwell) {
16301
+ function bind56(_liquidSwell) {
16254
16302
  return function* filterWhere(arr, property, expected) {
16255
16303
  const results = [];
16256
16304
  const list = yield resolveEnumerable(arr);
@@ -16304,7 +16352,7 @@ function getSizesFromParam(param) {
16304
16352
  height: height ? Number(height) : void 0
16305
16353
  };
16306
16354
  }
16307
- function bind56(liquidSwell) {
16355
+ function bind57(liquidSwell) {
16308
16356
  return async function filterAssetImgUrl(assetPath, size = "small") {
16309
16357
  const imageUrl = await liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
16310
16358
  const sizes = getSizesFromParam(size);
@@ -16320,14 +16368,14 @@ function bind56(liquidSwell) {
16320
16368
  }
16321
16369
 
16322
16370
  // src/liquid/filters/shopify/hex_to_rgba.ts
16323
- function bind57(_liquidSwell) {
16371
+ function bind58(_liquidSwell) {
16324
16372
  return (color, alpha) => {
16325
16373
  return ThemeColor.get(color).rgba(alpha || 1);
16326
16374
  };
16327
16375
  }
16328
16376
 
16329
16377
  // src/liquid/filters/shopify/img_url.ts
16330
- function bind58(_liquidSwell) {
16378
+ function bind59(_liquidSwell) {
16331
16379
  return function filterImgUrl(input, ...params) {
16332
16380
  if (!input) return "";
16333
16381
  let url;
@@ -16372,14 +16420,14 @@ var item_count_for_variant_default = {
16372
16420
  };
16373
16421
 
16374
16422
  // src/liquid/filters/shopify/payment_button.ts
16375
- function bind59(_liquidSwell) {
16423
+ function bind60(_liquidSwell) {
16376
16424
  return (form) => {
16377
16425
  return null;
16378
16426
  };
16379
16427
  }
16380
16428
 
16381
16429
  // src/liquid/filters/shopify/payment_terms.ts
16382
- function bind60(_liquidSwell) {
16430
+ function bind61(_liquidSwell) {
16383
16431
  return (form) => {
16384
16432
  return null;
16385
16433
  };
@@ -16481,7 +16529,7 @@ var svgs = {
16481
16529
  var placeholder_svgs_default = svgs;
16482
16530
 
16483
16531
  // src/liquid/filters/shopify/placeholder_svg_tag.ts
16484
- function bind61(_liquidSwell) {
16532
+ function bind62(_liquidSwell) {
16485
16533
  return function filterPlaceholderSvgTag(name, className) {
16486
16534
  const svg = placeholder_svgs_default[name];
16487
16535
  if (typeof svg === "object" && svg !== null) {
@@ -16492,7 +16540,7 @@ function bind61(_liquidSwell) {
16492
16540
  }
16493
16541
 
16494
16542
  // src/liquid/filters/shopify/shopify_asset_url.ts
16495
- function bind62(_liquidSwell) {
16543
+ function bind63(_liquidSwell) {
16496
16544
  return function filterShopifyAssetUrl(input) {
16497
16545
  if (typeof input === "string") {
16498
16546
  switch (input) {
@@ -16517,7 +16565,7 @@ function bind62(_liquidSwell) {
16517
16565
  }
16518
16566
 
16519
16567
  // src/liquid/filters/shopify/structured_data.ts
16520
- function bind63(_liquidSwell) {
16568
+ function bind64(_liquidSwell) {
16521
16569
  return async function filterStructuredData(input) {
16522
16570
  let value = input;
16523
16571
  if (value instanceof StorefrontResource) {
@@ -16595,7 +16643,7 @@ function convertToSchemaOrgProductGroup(product) {
16595
16643
  }
16596
16644
 
16597
16645
  // src/liquid/filters/inline_editable.ts
16598
- function bind64(_liquidSwell) {
16646
+ function bind65(_liquidSwell) {
16599
16647
  return (value, key) => {
16600
16648
  if (typeof value === "object" && "value" in value) {
16601
16649
  value = value.value;
@@ -16639,29 +16687,30 @@ var filters = {
16639
16687
  json: bind44,
16640
16688
  json_pretty: bind45,
16641
16689
  locale_flag: bind46,
16642
- money: bind47,
16643
- money_with_currency: bind48,
16644
- money_without_currency: bind49,
16645
- money_without_trailing_zeros: bind50,
16646
- script_tag: bind51,
16647
- stylesheet_tag: bind52,
16648
- time_tag: bind53,
16649
- translate: bind54,
16650
- t: bind54,
16690
+ minus: bind47,
16691
+ money: bind48,
16692
+ money_with_currency: bind49,
16693
+ money_without_currency: bind50,
16694
+ money_without_trailing_zeros: bind51,
16695
+ script_tag: bind52,
16696
+ stylesheet_tag: bind53,
16697
+ time_tag: bind54,
16698
+ translate: bind55,
16699
+ t: bind55,
16651
16700
  // alias
16652
- where: bind55,
16701
+ where: bind56,
16653
16702
  // Shopify compatibility only
16654
- asset_img_url: bind56,
16655
- hex_to_rgba: bind57,
16656
- img_url: bind58,
16703
+ asset_img_url: bind57,
16704
+ hex_to_rgba: bind58,
16705
+ img_url: bind59,
16657
16706
  item_count_for_variant: item_count_for_variant_default,
16658
- payment_button: bind59,
16659
- payment_terms: bind60,
16660
- placeholder_svg_tag: bind61,
16661
- shopify_asset_url: bind62,
16662
- structured_data: bind63,
16707
+ payment_button: bind60,
16708
+ payment_terms: bind61,
16709
+ placeholder_svg_tag: bind62,
16710
+ shopify_asset_url: bind63,
16711
+ structured_data: bind64,
16663
16712
  // Swell only
16664
- inline_editable: bind64
16713
+ inline_editable: bind65
16665
16714
  };
16666
16715
  function bindFilters(liquidSwell) {
16667
16716
  for (const [tag, handler] of Object.entries(filters)) {
@@ -16675,8 +16724,8 @@ function bindFilters(liquidSwell) {
16675
16724
  }
16676
16725
  }
16677
16726
  }
16678
- function bindWithResolvedProps(liquidSwell, bind65, resolve = []) {
16679
- const handler = bind65(liquidSwell);
16727
+ function bindWithResolvedProps(liquidSwell, bind66, resolve = []) {
16728
+ const handler = bind66(liquidSwell);
16680
16729
  if (!Array.isArray(resolve)) {
16681
16730
  return handler;
16682
16731
  }
@@ -16738,7 +16787,8 @@ var swellOperators = {
16738
16787
  if (isArray(l)) return l.some((i) => equal(i, r));
16739
16788
  if (isFunction(l?.indexOf)) return l.indexOf(toValue(r)) > -1;
16740
16789
  return false;
16741
- }
16790
+ },
16791
+ ",": (l, r) => `${l},${r}`
16742
16792
  };
16743
16793
  function equal(lhs, rhs) {
16744
16794
  if (isComparable(lhs)) return lhs.equals(rhs);
@@ -16893,7 +16943,7 @@ function isThemeColorLike(value) {
16893
16943
  }
16894
16944
 
16895
16945
  // src/liquid/index.ts
16896
- var LiquidSwell30 = class extends import_liquidjs34.Liquid {
16946
+ var LiquidSwell31 = class extends import_liquidjs34.Liquid {
16897
16947
  theme;
16898
16948
  getThemeConfig;
16899
16949
  getThemeTemplateConfigByType;
@@ -17567,7 +17617,7 @@ var SwellTheme3 = class {
17567
17617
  this.resources = resources;
17568
17618
  this.dynamicAssetUrl = dynamicAssetUrl;
17569
17619
  this.shopifyCompatibilityClass = shopifyCompatibilityClass || ShopifyCompatibility2;
17570
- this.liquidSwell = new LiquidSwell30({
17620
+ this.liquidSwell = new LiquidSwell31({
17571
17621
  theme: this,
17572
17622
  getThemeConfig: this.getThemeConfig.bind(this),
17573
17623
  getAssetUrl: this.getAssetUrl.bind(this),
@@ -18485,6 +18535,12 @@ ${content.slice(pos)}`;
18485
18535
  isShopify1HomePage(pageId, pageContent) {
18486
18536
  return Boolean(pageId === "index" && typeof pageContent === "string");
18487
18537
  }
18538
+ getSectionClassName() {
18539
+ return this.shopifyCompatibility ? "shopify-section" : "swell-section";
18540
+ }
18541
+ getSectionIdPrefix() {
18542
+ return this.shopifyCompatibility ? "shopify-section" : "swell-section";
18543
+ }
18488
18544
  async renderAllSections(sectionsIds, pageData) {
18489
18545
  const sections = typeof sectionsIds === "string" ? sectionsIds.split(/\s*,\s*/) : sectionsIds;
18490
18546
  const sectionsRendered = await Promise.all(
@@ -18492,18 +18548,14 @@ ${content.slice(pos)}`;
18492
18548
  return this.renderSection(sectionId, pageData);
18493
18549
  })
18494
18550
  );
18551
+ const sectionClassName = this.getSectionClassName();
18552
+ const sectionIdPrefix = this.getSectionIdPrefix();
18495
18553
  return sectionsRendered.reduce(
18496
18554
  (acc, section, index) => {
18497
18555
  const sectionId = sections[index];
18498
- if (this.shopifyCompatibility) {
18499
- acc[sectionId] = `
18500
- <div id="shopify-section-${sectionId}" class="shopify-section">${String(section)}</div>
18556
+ acc[sectionId] = `
18557
+ <div id="${sectionIdPrefix}-${sectionId}" class="${sectionClassName}">${String(section)}</div>
18501
18558
  `.trim();
18502
- } else {
18503
- acc[sectionId] = `
18504
- <div id="swell-section-${sectionId}" class="swell-section">${String(section)}</div>
18505
- `.trim();
18506
- }
18507
18559
  return acc;
18508
18560
  },
18509
18561
  {}