@swell/apps-sdk 1.0.181 → 1.0.183

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
@@ -1038,7 +1038,10 @@ var SwellStorefrontCollection = class _SwellStorefrontCollection extends SwellSt
1038
1038
  }
1039
1039
  return this._resolve().then(() => this.makeIterator());
1040
1040
  }
1041
- makeIterator() {
1041
+ async makeIterator() {
1042
+ if (isLikePromise(this.results)) {
1043
+ await this.results;
1044
+ }
1042
1045
  return (this.results || []).values();
1043
1046
  }
1044
1047
  _clone(newProps) {
@@ -3790,11 +3793,11 @@ function arrayToObject(arr, key = "id") {
3790
3793
  );
3791
3794
  }
3792
3795
  function getCountryCodeFromLocale(locale) {
3793
- const split = locale.split(/-|_/);
3794
- const country = split.pop()?.toUpperCase();
3795
- const lang = split.join("-");
3796
- const code = country ? country : LANG_TO_COUNTRY_CODES[lang] || "";
3797
- return code.toLowerCase();
3796
+ const [lang, country] = locale.split(/-|_/);
3797
+ if (country) {
3798
+ return country.toLowerCase();
3799
+ }
3800
+ return (LANG_TO_COUNTRY_CODES[lang] || "").toLowerCase();
3798
3801
  }
3799
3802
  function getCountryByCurrency(currencyCode) {
3800
3803
  if (currencyCode in CURRENCY_COUNTRIES) {
@@ -6402,11 +6405,11 @@ function getRandomId() {
6402
6405
  }
6403
6406
 
6404
6407
  // src/menus.ts
6405
- var import_lodash_es14 = require("lodash-es");
6408
+ var import_lodash_es15 = require("lodash-es");
6406
6409
 
6407
6410
  // src/theme.ts
6408
6411
  var import_json56 = __toESM(require("json5"), 1);
6409
- var import_lodash_es13 = require("lodash-es");
6412
+ var import_lodash_es14 = require("lodash-es");
6410
6413
 
6411
6414
  // src/compatibility/shopify.ts
6412
6415
  var import_lodash_es7 = require("lodash-es");
@@ -10366,6 +10369,9 @@ function getLocalizedValue(value, locale) {
10366
10369
 
10367
10370
  // src/compatibility/shopify-fonts.ts
10368
10371
  function shopifyFontToThemeFront(shopifyFontSetting) {
10372
+ if (typeof shopifyFontSetting !== "string") {
10373
+ return null;
10374
+ }
10369
10375
  const pos = shopifyFontSetting.lastIndexOf("_");
10370
10376
  const familyId = shopifyFontSetting.substring(0, pos);
10371
10377
  const variantId = shopifyFontSetting.substring(pos + 1);
@@ -12793,7 +12799,7 @@ function ShopifyCart(instance, cart) {
12793
12799
  );
12794
12800
  }),
12795
12801
  items_subtotal_price: defer(() => instance.toShopifyPrice(cart.sub_total)),
12796
- note: defer(() => cart.comments),
12802
+ note: deferWith(cart, (cart2) => cart2.comments),
12797
12803
  original_total_price: deferWith(
12798
12804
  cart,
12799
12805
  (cart2) => instance.toShopifyPrice(cart2.sub_total)
@@ -13878,15 +13884,10 @@ var CollectionsDrop = class extends import_liquidjs10.Drop {
13878
13884
  switch (typeof key) {
13879
13885
  case "string": {
13880
13886
  if (key === "all") {
13881
- let resource = this.#map.get(key);
13882
- if (resource === void 0) {
13883
- resource = ShopifyCollection(
13884
- this.#instance,
13885
- new AllCategoryResource(this.#instance)
13886
- );
13887
- this.#map.set(key, resource);
13888
- }
13889
- return resource;
13887
+ return this.getAllCollection();
13888
+ }
13889
+ if (key === "size") {
13890
+ return this.getAllCollectionsSize();
13890
13891
  }
13891
13892
  return this.getCollection(key);
13892
13893
  }
@@ -13916,6 +13917,21 @@ var CollectionsDrop = class extends import_liquidjs10.Drop {
13916
13917
  }
13917
13918
  return resource;
13918
13919
  }
13920
+ getAllCollection() {
13921
+ let resource = this.#map.get("all");
13922
+ if (resource === void 0) {
13923
+ resource = ShopifyCollection(
13924
+ this.#instance,
13925
+ new AllCategoryResource(this.#instance)
13926
+ );
13927
+ this.#map.set("all", resource);
13928
+ }
13929
+ return resource;
13930
+ }
13931
+ getAllCollectionsSize() {
13932
+ const count = this.#instance.theme.globals.shop?.collections_count;
13933
+ return count || 0;
13934
+ }
13919
13935
  };
13920
13936
  var Collections = class extends SwellStorefrontCollection {
13921
13937
  #drop;
@@ -15685,7 +15701,7 @@ var tags = {
15685
15701
  };
15686
15702
  function bindTags(liquidSwell) {
15687
15703
  Object.entries(tags).forEach(
15688
- ([tag, bind66]) => liquidSwell.registerTag(tag, bind66(liquidSwell))
15704
+ ([tag, bind67]) => liquidSwell.registerTag(tag, bind67(liquidSwell))
15689
15705
  );
15690
15706
  }
15691
15707
 
@@ -15953,8 +15969,22 @@ function bind37(_liquidSwell) {
15953
15969
  };
15954
15970
  }
15955
15971
 
15956
- // src/liquid/filters/font_face.ts
15972
+ // src/liquid/filters/escape.ts
15973
+ var import_lodash_es11 = require("lodash-es");
15957
15974
  function bind38(_liquidSwell) {
15975
+ return function escapeTag(input) {
15976
+ if (!input?.startsWith) {
15977
+ return input;
15978
+ }
15979
+ if (input.startsWith("<img") || input.startsWith("<video")) {
15980
+ return input;
15981
+ }
15982
+ return (0, import_lodash_es11.escape)(input);
15983
+ };
15984
+ }
15985
+
15986
+ // src/liquid/filters/font_face.ts
15987
+ function bind39(_liquidSwell) {
15958
15988
  return (fontSetting, ...params) => {
15959
15989
  if (!fontSetting) {
15960
15990
  return null;
@@ -15966,14 +15996,14 @@ function bind38(_liquidSwell) {
15966
15996
  }
15967
15997
 
15968
15998
  // src/liquid/filters/font_modify.ts
15969
- function bind39(_liquidSwell) {
15999
+ function bind40(_liquidSwell) {
15970
16000
  return (fontSetting, prop, value) => {
15971
16001
  return ThemeFont.clone(fontSetting).modify(prop, value);
15972
16002
  };
15973
16003
  }
15974
16004
 
15975
16005
  // src/liquid/filters/font_url.ts
15976
- function bind40(_liquidSwell) {
16006
+ function bind41(_liquidSwell) {
15977
16007
  return (fontSetting) => {
15978
16008
  return ThemeFont.get(fontSetting).url();
15979
16009
  };
@@ -16022,15 +16052,15 @@ var format_address_default = {
16022
16052
  };
16023
16053
 
16024
16054
  // src/liquid/filters/handleize.ts
16025
- var import_lodash_es11 = require("lodash-es");
16026
- function bind41(_liquidSwell) {
16055
+ var import_lodash_es12 = require("lodash-es");
16056
+ function bind42(_liquidSwell) {
16027
16057
  return function filterHandleize(handle) {
16028
- return (0, import_lodash_es11.kebabCase)(handle);
16058
+ return (0, import_lodash_es12.kebabCase)(handle);
16029
16059
  };
16030
16060
  }
16031
16061
 
16032
16062
  // src/liquid/filters/image_tag.ts
16033
- function bind42(_liquidSwell) {
16063
+ function bind43(_liquidSwell) {
16034
16064
  return function filterImageTag(imageUrl, ...params) {
16035
16065
  imageUrl = String(imageUrl || "");
16036
16066
  let {
@@ -16194,7 +16224,7 @@ var filterDefinition = {
16194
16224
  var image_url_default = filterDefinition;
16195
16225
 
16196
16226
  // src/liquid/filters/inline_asset_content.ts
16197
- function bind43(liquidSwell) {
16227
+ function bind44(liquidSwell) {
16198
16228
  return async (assetPath) => {
16199
16229
  const config = await liquidSwell.theme.getThemeConfig(
16200
16230
  `theme/assets/${assetPath}`
@@ -16204,14 +16234,14 @@ function bind43(liquidSwell) {
16204
16234
  }
16205
16235
 
16206
16236
  // src/liquid/filters/json.ts
16207
- function bind44(_liquidSwell) {
16237
+ function bind45(_liquidSwell) {
16208
16238
  return async function filterJson(input, space = 0) {
16209
16239
  return jsonStringifyAsync(input, space);
16210
16240
  };
16211
16241
  }
16212
16242
 
16213
16243
  // src/liquid/filters/json_pretty.ts
16214
- function bind45(_liquidSwell) {
16244
+ function bind46(_liquidSwell) {
16215
16245
  return async function filterJsonPretty(input, space = 2) {
16216
16246
  const output = await jsonStringifyAsync(input, space);
16217
16247
  return `<pre>${output}</pre>`;
@@ -16221,25 +16251,18 @@ function bind45(_liquidSwell) {
16221
16251
  // src/liquid/filters/locale_flag.ts
16222
16252
  var import_country_flag_icons = require("country-flag-icons");
16223
16253
  var flags = __toESM(require("country-flag-icons/string/1x1"), 1);
16224
- function getCountryCode(localCode) {
16225
- if (localCode.includes("-")) {
16226
- return localCode.split("-")[1].toUpperCase();
16227
- } else {
16228
- return localCode.toUpperCase();
16229
- }
16230
- }
16231
- function bind46(_liquidSwell) {
16254
+ function bind47(_liquidSwell) {
16232
16255
  return (localeCode) => {
16233
16256
  if (typeof localeCode !== "string") {
16234
16257
  return flags.US;
16235
16258
  }
16236
- const countryCode = getCountryCode(localeCode);
16259
+ const countryCode = getCountryCodeFromLocale(localeCode).toUpperCase();
16237
16260
  return (0, import_country_flag_icons.hasFlag)(countryCode) ? flags[countryCode] : flags.US;
16238
16261
  };
16239
16262
  }
16240
16263
 
16241
16264
  // src/liquid/filters/minus.ts
16242
- function bind47(_liquidSwell) {
16265
+ function bind48(_liquidSwell) {
16243
16266
  return (first, second) => {
16244
16267
  const firstValue = isNumber(first) ? first : 0;
16245
16268
  const secondValue = isNumber(second) ? second : 0;
@@ -16248,7 +16271,7 @@ function bind47(_liquidSwell) {
16248
16271
  }
16249
16272
 
16250
16273
  // src/liquid/filters/money.ts
16251
- function bind48(liquidSwell) {
16274
+ function bind49(liquidSwell) {
16252
16275
  return function filterMoney(value) {
16253
16276
  const amount = getMoneyAmount(liquidSwell, value);
16254
16277
  return liquidSwell.renderCurrency(amount);
@@ -16265,7 +16288,7 @@ function getMoneyAmount(liquidSwell, value) {
16265
16288
  }
16266
16289
 
16267
16290
  // src/liquid/filters/money_with_currency.ts
16268
- function bind49(liquidSwell) {
16291
+ function bind50(liquidSwell) {
16269
16292
  return function filterMoneyWithCurrency(value) {
16270
16293
  const { currency } = liquidSwell.theme.swell.getStorefrontLocalization();
16271
16294
  const amount = getMoneyAmount(liquidSwell, value);
@@ -16274,7 +16297,7 @@ function bind49(liquidSwell) {
16274
16297
  }
16275
16298
 
16276
16299
  // src/liquid/filters/money_without_currency.ts
16277
- function bind50(liquidSwell) {
16300
+ function bind51(liquidSwell) {
16278
16301
  return function filterMoneyWithoutCurrency(value) {
16279
16302
  const amount = getMoneyAmount(liquidSwell, value);
16280
16303
  return liquidSwell.renderCurrency(amount).replace(/[^0-9.,]/g, "");
@@ -16282,7 +16305,7 @@ function bind50(liquidSwell) {
16282
16305
  }
16283
16306
 
16284
16307
  // src/liquid/filters/money_without_trailing_zeros.ts
16285
- function bind51(liquidSwell) {
16308
+ function bind52(liquidSwell) {
16286
16309
  return function filterMoneyWithoutTrailingZeros(value) {
16287
16310
  const amount = getMoneyAmount(liquidSwell, value);
16288
16311
  return liquidSwell.renderCurrency(amount).split(".")[0].split(",")[0];
@@ -16290,21 +16313,21 @@ function bind51(liquidSwell) {
16290
16313
  }
16291
16314
 
16292
16315
  // src/liquid/filters/script_tag.ts
16293
- function bind52(_liquidSwell) {
16316
+ function bind53(_liquidSwell) {
16294
16317
  return function filterScriptTag(assetUrl) {
16295
16318
  return `<script src="${assetUrl}" type="text/javascript"></script>`;
16296
16319
  };
16297
16320
  }
16298
16321
 
16299
16322
  // src/liquid/filters/stylesheet_tag.ts
16300
- function bind53(_liquidSwell) {
16323
+ function bind54(_liquidSwell) {
16301
16324
  return function filterStyleSheetTag(assetUrl) {
16302
16325
  return `<link href="${assetUrl}" rel="stylesheet" type="text/css" media="all" />`;
16303
16326
  };
16304
16327
  }
16305
16328
 
16306
16329
  // src/liquid/filters/time_tag.ts
16307
- function bind54(_liquidSwell) {
16330
+ function bind55(_liquidSwell) {
16308
16331
  const dateFilter = bind33(_liquidSwell);
16309
16332
  return (dateValue, ...params) => {
16310
16333
  const date = ensureDate(dateValue);
@@ -16315,7 +16338,7 @@ function bind54(_liquidSwell) {
16315
16338
  }
16316
16339
 
16317
16340
  // src/liquid/filters/translate.ts
16318
- function bind55(liquidSwell) {
16341
+ function bind56(liquidSwell) {
16319
16342
  return async function filterTranslate(key, params) {
16320
16343
  const props = params && paramsToProps(params);
16321
16344
  const str = await liquidSwell.renderTranslation(key, props);
@@ -16324,7 +16347,7 @@ function bind55(liquidSwell) {
16324
16347
  }
16325
16348
 
16326
16349
  // src/liquid/filters/where.ts
16327
- function bind56(_liquidSwell) {
16350
+ function bind57(_liquidSwell) {
16328
16351
  return function* filterWhere(arr, property, expected) {
16329
16352
  const results = [];
16330
16353
  const list = yield resolveEnumerable(arr);
@@ -16378,7 +16401,7 @@ function getSizesFromParam(param) {
16378
16401
  height: height ? Number(height) : void 0
16379
16402
  };
16380
16403
  }
16381
- function bind57(liquidSwell) {
16404
+ function bind58(liquidSwell) {
16382
16405
  return async function filterAssetImgUrl(assetPath, size = "small") {
16383
16406
  const imageUrl = await liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
16384
16407
  const sizes = getSizesFromParam(size);
@@ -16394,14 +16417,14 @@ function bind57(liquidSwell) {
16394
16417
  }
16395
16418
 
16396
16419
  // src/liquid/filters/shopify/hex_to_rgba.ts
16397
- function bind58(_liquidSwell) {
16420
+ function bind59(_liquidSwell) {
16398
16421
  return (color, alpha) => {
16399
16422
  return ThemeColor.get(color).rgba(alpha || 1);
16400
16423
  };
16401
16424
  }
16402
16425
 
16403
16426
  // src/liquid/filters/shopify/img_url.ts
16404
- function bind59(liquidSwell) {
16427
+ function bind60(liquidSwell) {
16405
16428
  return async function filterImgUrl(input, ...params) {
16406
16429
  const url = await getImageUrlFromInput(input, liquidSwell);
16407
16430
  if (typeof url !== "string" || url === "") {
@@ -16439,14 +16462,14 @@ var item_count_for_variant_default = {
16439
16462
  };
16440
16463
 
16441
16464
  // src/liquid/filters/shopify/payment_button.ts
16442
- function bind60(_liquidSwell) {
16465
+ function bind61(_liquidSwell) {
16443
16466
  return (form) => {
16444
- return null;
16467
+ return `<button style="display: block; visibility: hidden;"></button>`;
16445
16468
  };
16446
16469
  }
16447
16470
 
16448
16471
  // src/liquid/filters/shopify/payment_terms.ts
16449
- function bind61(_liquidSwell) {
16472
+ function bind62(_liquidSwell) {
16450
16473
  return (form) => {
16451
16474
  return null;
16452
16475
  };
@@ -16548,7 +16571,7 @@ var svgs = {
16548
16571
  var placeholder_svgs_default = svgs;
16549
16572
 
16550
16573
  // src/liquid/filters/shopify/placeholder_svg_tag.ts
16551
- function bind62(_liquidSwell) {
16574
+ function bind63(_liquidSwell) {
16552
16575
  return function filterPlaceholderSvgTag(name, className) {
16553
16576
  const svg = placeholder_svgs_default[name];
16554
16577
  if (typeof svg === "object" && svg !== null) {
@@ -16559,7 +16582,7 @@ function bind62(_liquidSwell) {
16559
16582
  }
16560
16583
 
16561
16584
  // src/liquid/filters/shopify/shopify_asset_url.ts
16562
- function bind63(_liquidSwell) {
16585
+ function bind64(_liquidSwell) {
16563
16586
  return function filterShopifyAssetUrl(input) {
16564
16587
  if (typeof input === "string") {
16565
16588
  switch (input) {
@@ -16584,7 +16607,7 @@ function bind63(_liquidSwell) {
16584
16607
  }
16585
16608
 
16586
16609
  // src/liquid/filters/shopify/structured_data.ts
16587
- function bind64(_liquidSwell) {
16610
+ function bind65(_liquidSwell) {
16588
16611
  return async function filterStructuredData(input) {
16589
16612
  let value = input;
16590
16613
  if (value instanceof StorefrontResource) {
@@ -16662,7 +16685,7 @@ function convertToSchemaOrgProductGroup(product) {
16662
16685
  }
16663
16686
 
16664
16687
  // src/liquid/filters/inline_editable.ts
16665
- function bind65(_liquidSwell) {
16688
+ function bind66(_liquidSwell) {
16666
16689
  return (value, key) => {
16667
16690
  if (typeof value === "object" && "value" in value) {
16668
16691
  value = value.value;
@@ -16693,43 +16716,44 @@ var filters = {
16693
16716
  default_errors: bind35,
16694
16717
  divided_by: bind36,
16695
16718
  embedded_content: bind37,
16696
- font_face: bind38,
16697
- font_modify: bind39,
16698
- font_url: bind40,
16719
+ escape: bind38,
16720
+ font_face: bind39,
16721
+ font_modify: bind40,
16722
+ font_url: bind41,
16699
16723
  format_address: format_address_default,
16700
- handle: bind41,
16724
+ handle: bind42,
16701
16725
  // alias
16702
- handleize: bind41,
16703
- image_tag: bind42,
16726
+ handleize: bind42,
16727
+ image_tag: bind43,
16704
16728
  image_url: image_url_default,
16705
- inline_asset_content: bind43,
16706
- json: bind44,
16707
- json_pretty: bind45,
16708
- locale_flag: bind46,
16709
- minus: bind47,
16710
- money: bind48,
16711
- money_with_currency: bind49,
16712
- money_without_currency: bind50,
16713
- money_without_trailing_zeros: bind51,
16714
- script_tag: bind52,
16715
- stylesheet_tag: bind53,
16716
- time_tag: bind54,
16717
- translate: bind55,
16718
- t: bind55,
16729
+ inline_asset_content: bind44,
16730
+ json: bind45,
16731
+ json_pretty: bind46,
16732
+ locale_flag: bind47,
16733
+ minus: bind48,
16734
+ money: bind49,
16735
+ money_with_currency: bind50,
16736
+ money_without_currency: bind51,
16737
+ money_without_trailing_zeros: bind52,
16738
+ script_tag: bind53,
16739
+ stylesheet_tag: bind54,
16740
+ time_tag: bind55,
16741
+ translate: bind56,
16742
+ t: bind56,
16719
16743
  // alias
16720
- where: bind56,
16744
+ where: bind57,
16721
16745
  // Shopify compatibility only
16722
- asset_img_url: bind57,
16723
- hex_to_rgba: bind58,
16724
- img_url: bind59,
16746
+ asset_img_url: bind58,
16747
+ hex_to_rgba: bind59,
16748
+ img_url: bind60,
16725
16749
  item_count_for_variant: item_count_for_variant_default,
16726
- payment_button: bind60,
16727
- payment_terms: bind61,
16728
- placeholder_svg_tag: bind62,
16729
- shopify_asset_url: bind63,
16730
- structured_data: bind64,
16750
+ payment_button: bind61,
16751
+ payment_terms: bind62,
16752
+ placeholder_svg_tag: bind63,
16753
+ shopify_asset_url: bind64,
16754
+ structured_data: bind65,
16731
16755
  // Swell only
16732
- inline_editable: bind65
16756
+ inline_editable: bind66
16733
16757
  };
16734
16758
  function bindFilters(liquidSwell) {
16735
16759
  for (const [tag, handler] of Object.entries(filters)) {
@@ -16743,8 +16767,8 @@ function bindFilters(liquidSwell) {
16743
16767
  }
16744
16768
  }
16745
16769
  }
16746
- function bindWithResolvedProps(liquidSwell, bind66, resolve = []) {
16747
- const handler = bind66(liquidSwell);
16770
+ function bindWithResolvedProps(liquidSwell, bind67, resolve = []) {
16771
+ const handler = bind67(liquidSwell);
16748
16772
  if (!Array.isArray(resolve)) {
16749
16773
  return handler;
16750
16774
  }
@@ -17446,7 +17470,7 @@ var ThemeLoader = class _ThemeLoader {
17446
17470
  };
17447
17471
 
17448
17472
  // src/globals.ts
17449
- var import_lodash_es12 = require("lodash-es");
17473
+ var import_lodash_es13 = require("lodash-es");
17450
17474
 
17451
17475
  // src/compatibility/drops/robots-rule.ts
17452
17476
  var import_liquidjs35 = require("liquidjs");
@@ -17546,7 +17570,7 @@ function getAllCountryOptionTags(geoSettings) {
17546
17570
  }).filter(Boolean).join("\n");
17547
17571
  }
17548
17572
  function getRobotsGlobals(canonicalUrl) {
17549
- const sitemapUrl = `${(0, import_lodash_es12.trimEnd)(canonicalUrl, "/")}/sitemap.xml`;
17573
+ const sitemapUrl = `${(0, import_lodash_es13.trimEnd)(canonicalUrl, "/")}/sitemap.xml`;
17550
17574
  const defaultRules = [
17551
17575
  { directive: "Disallow", value: "/admin" },
17552
17576
  { directive: "Disallow", value: "/cart" },
@@ -18041,7 +18065,7 @@ var SwellTheme3 = class {
18041
18065
  return languageConfig;
18042
18066
  }
18043
18067
  const localeShortCode = locale.split("-")[0];
18044
- return (0, import_lodash_es13.reduce)(
18068
+ return (0, import_lodash_es14.reduce)(
18045
18069
  languageConfig,
18046
18070
  (acc, value, key) => {
18047
18071
  if (isObject2(value)) {
@@ -18065,15 +18089,15 @@ var SwellTheme3 = class {
18065
18089
  const translationEnd = translationParts.pop();
18066
18090
  const translationPath = translationParts.join(".");
18067
18091
  const translationConfigGlobal = this.globals.language;
18068
- acc[key] = (0, import_lodash_es13.get)(
18092
+ acc[key] = (0, import_lodash_es14.get)(
18069
18093
  translationConfigGlobal,
18070
18094
  `${translationPath}.$locale.${locale}.${translationEnd}`
18071
- ) || (0, import_lodash_es13.get)(
18095
+ ) || (0, import_lodash_es14.get)(
18072
18096
  translationConfigGlobal,
18073
18097
  `${translationPath}.$locale.${localeShortCode}.${translationEnd}`
18074
- ) || (0, import_lodash_es13.get)(translationConfigGlobal, translationKey) || value;
18098
+ ) || (0, import_lodash_es14.get)(translationConfigGlobal, translationKey) || value;
18075
18099
  } else {
18076
- acc[key] = (0, import_lodash_es13.get)(languageConfig, `$locale.${locale}.${key}`) || (0, import_lodash_es13.get)(languageConfig, `$locale.${localeShortCode}.${key}`) || value;
18100
+ acc[key] = (0, import_lodash_es14.get)(languageConfig, `$locale.${locale}.${key}`) || (0, import_lodash_es14.get)(languageConfig, `$locale.${localeShortCode}.${key}`) || value;
18077
18101
  }
18078
18102
  }
18079
18103
  return acc;
@@ -18909,8 +18933,8 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18909
18933
  const keyParts = key?.split(".") || [];
18910
18934
  const keyName = keyParts.pop() || "";
18911
18935
  const keyPath = keyParts.join(".");
18912
- const langObject = (0, import_lodash_es13.get)(langConfig, keyPath);
18913
- let localeValue = (0, import_lodash_es13.get)(langObject?.[localeCode], keyName) || (0, import_lodash_es13.get)(langObject?.[localeCode.split("-")[0]], keyName) || langObject?.[keyName];
18936
+ const langObject = (0, import_lodash_es14.get)(langConfig, keyPath);
18937
+ let localeValue = (0, import_lodash_es14.get)(langObject?.[localeCode], keyName) || (0, import_lodash_es14.get)(langObject?.[localeCode.split("-")[0]], keyName) || langObject?.[keyName];
18914
18938
  if (data?.count !== void 0 && localeValue?.one) {
18915
18939
  localeValue = data.count === 1 ? localeValue.one : localeValue.other;
18916
18940
  }
@@ -18955,7 +18979,7 @@ function resolveSectionSettings(theme, sectionConfig, index) {
18955
18979
  let blocks = settings.section.blocks?.filter(
18956
18980
  (block) => block.disabled !== true
18957
18981
  );
18958
- blocks = blocks?.map((block) => ({
18982
+ blocks = blocks?.filter((block) => Boolean(block.type)).map((block) => ({
18959
18983
  ...block,
18960
18984
  ...getBlockAttributes(theme, block),
18961
18985
  settings: resolveThemeSettings(
@@ -18990,7 +19014,7 @@ function fillDefaultThemeSettings(themeSettings, editorSchemaSettings) {
18990
19014
  }
18991
19015
  }
18992
19016
  function resolveThemeSettings(theme, themeSettings, editorSchemaSettings) {
18993
- const settings = (0, import_lodash_es13.cloneDeep)(themeSettings);
19017
+ const settings = (0, import_lodash_es14.cloneDeep)(themeSettings);
18994
19018
  if (settings.$locale) {
18995
19019
  const { locale } = theme.swell.getStorefrontLocalization();
18996
19020
  const localeConfig = settings.$locale[locale] || {};
@@ -19000,16 +19024,16 @@ function resolveThemeSettings(theme, themeSettings, editorSchemaSettings) {
19000
19024
  }
19001
19025
  }
19002
19026
  }
19003
- (0, import_lodash_es13.each)(settings, (value, key) => {
19027
+ (0, import_lodash_es14.each)(settings, (value, key) => {
19004
19028
  const setting = (editorSchemaSettings && findEditorSetting(editorSchemaSettings, key)) ?? null;
19005
19029
  if (isObject2(value) && !(value instanceof StorefrontResource)) {
19006
19030
  switch (setting?.type) {
19007
19031
  case "color_scheme_group": {
19008
- (0, import_lodash_es13.each)(value, (scheme, schemeId) => {
19032
+ (0, import_lodash_es14.each)(value, (scheme, schemeId) => {
19009
19033
  if (isObject2(scheme) && typeof scheme.settings === "object" && scheme.settings) {
19010
19034
  const settings2 = scheme.settings;
19011
- (0, import_lodash_es13.each)(settings2, (colorValue, colorId) => {
19012
- const fieldDef = (0, import_lodash_es13.find)(setting.fields, { id: colorId });
19035
+ (0, import_lodash_es14.each)(settings2, (colorValue, colorId) => {
19036
+ const fieldDef = (0, import_lodash_es14.find)(setting.fields, { id: colorId });
19013
19037
  if (fieldDef?.type === "color" && colorValue) {
19014
19038
  scheme.id = schemeId;
19015
19039
  settings2[colorId] = new ThemeColor(colorValue);
@@ -19060,7 +19084,7 @@ function resolveThemeSettings(theme, themeSettings, editorSchemaSettings) {
19060
19084
  }
19061
19085
  function findThemeSettingsByType(type, themeSettings, editorSchemaSettings) {
19062
19086
  const foundSettings = [];
19063
- (0, import_lodash_es13.each)(themeSettings, (value, key) => {
19087
+ (0, import_lodash_es14.each)(themeSettings, (value, key) => {
19064
19088
  if (isObject2(value) && !(value instanceof ThemeFont) && !(value instanceof StorefrontResource)) {
19065
19089
  foundSettings.push(
19066
19090
  ...findThemeSettingsByType(type, value, editorSchemaSettings)
@@ -19234,7 +19258,7 @@ function isChildItemActive(items) {
19234
19258
  }
19235
19259
  function getMenuItemValueId(value) {
19236
19260
  const fallback = typeof value === "string" ? value : "";
19237
- const slug = (0, import_lodash_es14.get)(value, "id", (0, import_lodash_es14.get)(value, "slug", fallback)) || "";
19261
+ const slug = (0, import_lodash_es15.get)(value, "id", (0, import_lodash_es15.get)(value, "slug", fallback)) || "";
19238
19262
  return slug;
19239
19263
  }
19240
19264
  async function getMenuItemUrlAndResource(theme, menuItem) {