@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.js CHANGED
@@ -915,7 +915,10 @@
915
915
  }
916
916
  return this._resolve().then(() => this.makeIterator());
917
917
  }
918
- makeIterator() {
918
+ async makeIterator() {
919
+ if (isLikePromise(this.results)) {
920
+ await this.results;
921
+ }
919
922
  return (this.results || []).values();
920
923
  }
921
924
  _clone(newProps) {
@@ -3667,11 +3670,11 @@
3667
3670
  );
3668
3671
  }
3669
3672
  function getCountryCodeFromLocale(locale) {
3670
- const split = locale.split(/-|_/);
3671
- const country = split.pop()?.toUpperCase();
3672
- const lang = split.join("-");
3673
- const code = country ? country : LANG_TO_COUNTRY_CODES[lang] || "";
3674
- return code.toLowerCase();
3673
+ const [lang, country] = locale.split(/-|_/);
3674
+ if (country) {
3675
+ return country.toLowerCase();
3676
+ }
3677
+ return (LANG_TO_COUNTRY_CODES[lang] || "").toLowerCase();
3675
3678
  }
3676
3679
  function getCountryByCurrency(currencyCode) {
3677
3680
  if (currencyCode in CURRENCY_COUNTRIES) {
@@ -6279,11 +6282,11 @@ ${formattedMessage}`;
6279
6282
  }
6280
6283
 
6281
6284
  // src/menus.ts
6282
- var import_lodash_es14 = __require("lodash-es");
6285
+ var import_lodash_es15 = __require("lodash-es");
6283
6286
 
6284
6287
  // src/theme.ts
6285
6288
  var import_json56 = __toESM(__require("json5"), 1);
6286
- var import_lodash_es13 = __require("lodash-es");
6289
+ var import_lodash_es14 = __require("lodash-es");
6287
6290
 
6288
6291
  // src/compatibility/shopify.ts
6289
6292
  var import_lodash_es7 = __require("lodash-es");
@@ -10243,6 +10246,9 @@ ${formattedMessage}`;
10243
10246
 
10244
10247
  // src/compatibility/shopify-fonts.ts
10245
10248
  function shopifyFontToThemeFront(shopifyFontSetting) {
10249
+ if (typeof shopifyFontSetting !== "string") {
10250
+ return null;
10251
+ }
10246
10252
  const pos = shopifyFontSetting.lastIndexOf("_");
10247
10253
  const familyId = shopifyFontSetting.substring(0, pos);
10248
10254
  const variantId = shopifyFontSetting.substring(pos + 1);
@@ -12670,7 +12676,7 @@ ${formattedMessage}`;
12670
12676
  );
12671
12677
  }),
12672
12678
  items_subtotal_price: defer(() => instance.toShopifyPrice(cart.sub_total)),
12673
- note: defer(() => cart.comments),
12679
+ note: deferWith(cart, (cart2) => cart2.comments),
12674
12680
  original_total_price: deferWith(
12675
12681
  cart,
12676
12682
  (cart2) => instance.toShopifyPrice(cart2.sub_total)
@@ -13755,15 +13761,10 @@ ${formattedMessage}`;
13755
13761
  switch (typeof key) {
13756
13762
  case "string": {
13757
13763
  if (key === "all") {
13758
- let resource = this.#map.get(key);
13759
- if (resource === void 0) {
13760
- resource = ShopifyCollection(
13761
- this.#instance,
13762
- new AllCategoryResource(this.#instance)
13763
- );
13764
- this.#map.set(key, resource);
13765
- }
13766
- return resource;
13764
+ return this.getAllCollection();
13765
+ }
13766
+ if (key === "size") {
13767
+ return this.getAllCollectionsSize();
13767
13768
  }
13768
13769
  return this.getCollection(key);
13769
13770
  }
@@ -13793,6 +13794,21 @@ ${formattedMessage}`;
13793
13794
  }
13794
13795
  return resource;
13795
13796
  }
13797
+ getAllCollection() {
13798
+ let resource = this.#map.get("all");
13799
+ if (resource === void 0) {
13800
+ resource = ShopifyCollection(
13801
+ this.#instance,
13802
+ new AllCategoryResource(this.#instance)
13803
+ );
13804
+ this.#map.set("all", resource);
13805
+ }
13806
+ return resource;
13807
+ }
13808
+ getAllCollectionsSize() {
13809
+ const count = this.#instance.theme.globals.shop?.collections_count;
13810
+ return count || 0;
13811
+ }
13796
13812
  };
13797
13813
  var Collections = class extends SwellStorefrontCollection {
13798
13814
  #drop;
@@ -15562,7 +15578,7 @@ ${injects.join("\n")}<\/script>`;
15562
15578
  };
15563
15579
  function bindTags(liquidSwell) {
15564
15580
  Object.entries(tags).forEach(
15565
- ([tag, bind66]) => liquidSwell.registerTag(tag, bind66(liquidSwell))
15581
+ ([tag, bind67]) => liquidSwell.registerTag(tag, bind67(liquidSwell))
15566
15582
  );
15567
15583
  }
15568
15584
 
@@ -15830,8 +15846,22 @@ ${injects.join("\n")}<\/script>`;
15830
15846
  };
15831
15847
  }
15832
15848
 
15833
- // src/liquid/filters/font_face.ts
15849
+ // src/liquid/filters/escape.ts
15850
+ var import_lodash_es11 = __require("lodash-es");
15834
15851
  function bind38(_liquidSwell) {
15852
+ return function escapeTag(input) {
15853
+ if (!input?.startsWith) {
15854
+ return input;
15855
+ }
15856
+ if (input.startsWith("<img") || input.startsWith("<video")) {
15857
+ return input;
15858
+ }
15859
+ return (0, import_lodash_es11.escape)(input);
15860
+ };
15861
+ }
15862
+
15863
+ // src/liquid/filters/font_face.ts
15864
+ function bind39(_liquidSwell) {
15835
15865
  return (fontSetting, ...params) => {
15836
15866
  if (!fontSetting) {
15837
15867
  return null;
@@ -15843,14 +15873,14 @@ ${injects.join("\n")}<\/script>`;
15843
15873
  }
15844
15874
 
15845
15875
  // src/liquid/filters/font_modify.ts
15846
- function bind39(_liquidSwell) {
15876
+ function bind40(_liquidSwell) {
15847
15877
  return (fontSetting, prop, value) => {
15848
15878
  return ThemeFont.clone(fontSetting).modify(prop, value);
15849
15879
  };
15850
15880
  }
15851
15881
 
15852
15882
  // src/liquid/filters/font_url.ts
15853
- function bind40(_liquidSwell) {
15883
+ function bind41(_liquidSwell) {
15854
15884
  return (fontSetting) => {
15855
15885
  return ThemeFont.get(fontSetting).url();
15856
15886
  };
@@ -15899,15 +15929,15 @@ ${injects.join("\n")}<\/script>`;
15899
15929
  };
15900
15930
 
15901
15931
  // src/liquid/filters/handleize.ts
15902
- var import_lodash_es11 = __require("lodash-es");
15903
- function bind41(_liquidSwell) {
15932
+ var import_lodash_es12 = __require("lodash-es");
15933
+ function bind42(_liquidSwell) {
15904
15934
  return function filterHandleize(handle) {
15905
- return (0, import_lodash_es11.kebabCase)(handle);
15935
+ return (0, import_lodash_es12.kebabCase)(handle);
15906
15936
  };
15907
15937
  }
15908
15938
 
15909
15939
  // src/liquid/filters/image_tag.ts
15910
- function bind42(_liquidSwell) {
15940
+ function bind43(_liquidSwell) {
15911
15941
  return function filterImageTag(imageUrl, ...params) {
15912
15942
  imageUrl = String(imageUrl || "");
15913
15943
  let {
@@ -16071,7 +16101,7 @@ ${injects.join("\n")}<\/script>`;
16071
16101
  var image_url_default = filterDefinition;
16072
16102
 
16073
16103
  // src/liquid/filters/inline_asset_content.ts
16074
- function bind43(liquidSwell) {
16104
+ function bind44(liquidSwell) {
16075
16105
  return async (assetPath) => {
16076
16106
  const config = await liquidSwell.theme.getThemeConfig(
16077
16107
  `theme/assets/${assetPath}`
@@ -16081,14 +16111,14 @@ ${injects.join("\n")}<\/script>`;
16081
16111
  }
16082
16112
 
16083
16113
  // src/liquid/filters/json.ts
16084
- function bind44(_liquidSwell) {
16114
+ function bind45(_liquidSwell) {
16085
16115
  return async function filterJson(input, space = 0) {
16086
16116
  return jsonStringifyAsync(input, space);
16087
16117
  };
16088
16118
  }
16089
16119
 
16090
16120
  // src/liquid/filters/json_pretty.ts
16091
- function bind45(_liquidSwell) {
16121
+ function bind46(_liquidSwell) {
16092
16122
  return async function filterJsonPretty(input, space = 2) {
16093
16123
  const output = await jsonStringifyAsync(input, space);
16094
16124
  return `<pre>${output}</pre>`;
@@ -16098,25 +16128,18 @@ ${injects.join("\n")}<\/script>`;
16098
16128
  // src/liquid/filters/locale_flag.ts
16099
16129
  var import_country_flag_icons = __require("country-flag-icons");
16100
16130
  var flags = __toESM(__require("country-flag-icons/string/1x1"), 1);
16101
- function getCountryCode(localCode) {
16102
- if (localCode.includes("-")) {
16103
- return localCode.split("-")[1].toUpperCase();
16104
- } else {
16105
- return localCode.toUpperCase();
16106
- }
16107
- }
16108
- function bind46(_liquidSwell) {
16131
+ function bind47(_liquidSwell) {
16109
16132
  return (localeCode) => {
16110
16133
  if (typeof localeCode !== "string") {
16111
16134
  return flags.US;
16112
16135
  }
16113
- const countryCode = getCountryCode(localeCode);
16136
+ const countryCode = getCountryCodeFromLocale(localeCode).toUpperCase();
16114
16137
  return (0, import_country_flag_icons.hasFlag)(countryCode) ? flags[countryCode] : flags.US;
16115
16138
  };
16116
16139
  }
16117
16140
 
16118
16141
  // src/liquid/filters/minus.ts
16119
- function bind47(_liquidSwell) {
16142
+ function bind48(_liquidSwell) {
16120
16143
  return (first, second) => {
16121
16144
  const firstValue = isNumber(first) ? first : 0;
16122
16145
  const secondValue = isNumber(second) ? second : 0;
@@ -16125,7 +16148,7 @@ ${injects.join("\n")}<\/script>`;
16125
16148
  }
16126
16149
 
16127
16150
  // src/liquid/filters/money.ts
16128
- function bind48(liquidSwell) {
16151
+ function bind49(liquidSwell) {
16129
16152
  return function filterMoney(value) {
16130
16153
  const amount = getMoneyAmount(liquidSwell, value);
16131
16154
  return liquidSwell.renderCurrency(amount);
@@ -16142,7 +16165,7 @@ ${injects.join("\n")}<\/script>`;
16142
16165
  }
16143
16166
 
16144
16167
  // src/liquid/filters/money_with_currency.ts
16145
- function bind49(liquidSwell) {
16168
+ function bind50(liquidSwell) {
16146
16169
  return function filterMoneyWithCurrency(value) {
16147
16170
  const { currency } = liquidSwell.theme.swell.getStorefrontLocalization();
16148
16171
  const amount = getMoneyAmount(liquidSwell, value);
@@ -16151,7 +16174,7 @@ ${injects.join("\n")}<\/script>`;
16151
16174
  }
16152
16175
 
16153
16176
  // src/liquid/filters/money_without_currency.ts
16154
- function bind50(liquidSwell) {
16177
+ function bind51(liquidSwell) {
16155
16178
  return function filterMoneyWithoutCurrency(value) {
16156
16179
  const amount = getMoneyAmount(liquidSwell, value);
16157
16180
  return liquidSwell.renderCurrency(amount).replace(/[^0-9.,]/g, "");
@@ -16159,7 +16182,7 @@ ${injects.join("\n")}<\/script>`;
16159
16182
  }
16160
16183
 
16161
16184
  // src/liquid/filters/money_without_trailing_zeros.ts
16162
- function bind51(liquidSwell) {
16185
+ function bind52(liquidSwell) {
16163
16186
  return function filterMoneyWithoutTrailingZeros(value) {
16164
16187
  const amount = getMoneyAmount(liquidSwell, value);
16165
16188
  return liquidSwell.renderCurrency(amount).split(".")[0].split(",")[0];
@@ -16167,21 +16190,21 @@ ${injects.join("\n")}<\/script>`;
16167
16190
  }
16168
16191
 
16169
16192
  // src/liquid/filters/script_tag.ts
16170
- function bind52(_liquidSwell) {
16193
+ function bind53(_liquidSwell) {
16171
16194
  return function filterScriptTag(assetUrl) {
16172
16195
  return `<script src="${assetUrl}" type="text/javascript"><\/script>`;
16173
16196
  };
16174
16197
  }
16175
16198
 
16176
16199
  // src/liquid/filters/stylesheet_tag.ts
16177
- function bind53(_liquidSwell) {
16200
+ function bind54(_liquidSwell) {
16178
16201
  return function filterStyleSheetTag(assetUrl) {
16179
16202
  return `<link href="${assetUrl}" rel="stylesheet" type="text/css" media="all" />`;
16180
16203
  };
16181
16204
  }
16182
16205
 
16183
16206
  // src/liquid/filters/time_tag.ts
16184
- function bind54(_liquidSwell) {
16207
+ function bind55(_liquidSwell) {
16185
16208
  const dateFilter = bind33(_liquidSwell);
16186
16209
  return (dateValue, ...params) => {
16187
16210
  const date = ensureDate(dateValue);
@@ -16192,7 +16215,7 @@ ${injects.join("\n")}<\/script>`;
16192
16215
  }
16193
16216
 
16194
16217
  // src/liquid/filters/translate.ts
16195
- function bind55(liquidSwell) {
16218
+ function bind56(liquidSwell) {
16196
16219
  return async function filterTranslate(key, params) {
16197
16220
  const props = params && paramsToProps(params);
16198
16221
  const str = await liquidSwell.renderTranslation(key, props);
@@ -16201,7 +16224,7 @@ ${injects.join("\n")}<\/script>`;
16201
16224
  }
16202
16225
 
16203
16226
  // src/liquid/filters/where.ts
16204
- function bind56(_liquidSwell) {
16227
+ function bind57(_liquidSwell) {
16205
16228
  return function* filterWhere(arr, property, expected) {
16206
16229
  const results = [];
16207
16230
  const list = yield resolveEnumerable(arr);
@@ -16255,7 +16278,7 @@ ${injects.join("\n")}<\/script>`;
16255
16278
  height: height ? Number(height) : void 0
16256
16279
  };
16257
16280
  }
16258
- function bind57(liquidSwell) {
16281
+ function bind58(liquidSwell) {
16259
16282
  return async function filterAssetImgUrl(assetPath, size = "small") {
16260
16283
  const imageUrl = await liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
16261
16284
  const sizes = getSizesFromParam(size);
@@ -16271,14 +16294,14 @@ ${injects.join("\n")}<\/script>`;
16271
16294
  }
16272
16295
 
16273
16296
  // src/liquid/filters/shopify/hex_to_rgba.ts
16274
- function bind58(_liquidSwell) {
16297
+ function bind59(_liquidSwell) {
16275
16298
  return (color, alpha) => {
16276
16299
  return ThemeColor.get(color).rgba(alpha || 1);
16277
16300
  };
16278
16301
  }
16279
16302
 
16280
16303
  // src/liquid/filters/shopify/img_url.ts
16281
- function bind59(liquidSwell) {
16304
+ function bind60(liquidSwell) {
16282
16305
  return async function filterImgUrl(input, ...params) {
16283
16306
  const url = await getImageUrlFromInput(input, liquidSwell);
16284
16307
  if (typeof url !== "string" || url === "") {
@@ -16316,14 +16339,14 @@ ${injects.join("\n")}<\/script>`;
16316
16339
  };
16317
16340
 
16318
16341
  // src/liquid/filters/shopify/payment_button.ts
16319
- function bind60(_liquidSwell) {
16342
+ function bind61(_liquidSwell) {
16320
16343
  return (form) => {
16321
- return null;
16344
+ return `<button style="display: block; visibility: hidden;"></button>`;
16322
16345
  };
16323
16346
  }
16324
16347
 
16325
16348
  // src/liquid/filters/shopify/payment_terms.ts
16326
- function bind61(_liquidSwell) {
16349
+ function bind62(_liquidSwell) {
16327
16350
  return (form) => {
16328
16351
  return null;
16329
16352
  };
@@ -16425,7 +16448,7 @@ ${injects.join("\n")}<\/script>`;
16425
16448
  var placeholder_svgs_default = svgs;
16426
16449
 
16427
16450
  // src/liquid/filters/shopify/placeholder_svg_tag.ts
16428
- function bind62(_liquidSwell) {
16451
+ function bind63(_liquidSwell) {
16429
16452
  return function filterPlaceholderSvgTag(name, className) {
16430
16453
  const svg = placeholder_svgs_default[name];
16431
16454
  if (typeof svg === "object" && svg !== null) {
@@ -16436,7 +16459,7 @@ ${injects.join("\n")}<\/script>`;
16436
16459
  }
16437
16460
 
16438
16461
  // src/liquid/filters/shopify/shopify_asset_url.ts
16439
- function bind63(_liquidSwell) {
16462
+ function bind64(_liquidSwell) {
16440
16463
  return function filterShopifyAssetUrl(input) {
16441
16464
  if (typeof input === "string") {
16442
16465
  switch (input) {
@@ -16461,7 +16484,7 @@ ${injects.join("\n")}<\/script>`;
16461
16484
  }
16462
16485
 
16463
16486
  // src/liquid/filters/shopify/structured_data.ts
16464
- function bind64(_liquidSwell) {
16487
+ function bind65(_liquidSwell) {
16465
16488
  return async function filterStructuredData(input) {
16466
16489
  let value = input;
16467
16490
  if (value instanceof StorefrontResource) {
@@ -16539,7 +16562,7 @@ ${injects.join("\n")}<\/script>`;
16539
16562
  }
16540
16563
 
16541
16564
  // src/liquid/filters/inline_editable.ts
16542
- function bind65(_liquidSwell) {
16565
+ function bind66(_liquidSwell) {
16543
16566
  return (value, key) => {
16544
16567
  if (typeof value === "object" && "value" in value) {
16545
16568
  value = value.value;
@@ -16570,43 +16593,44 @@ ${injects.join("\n")}<\/script>`;
16570
16593
  default_errors: bind35,
16571
16594
  divided_by: bind36,
16572
16595
  embedded_content: bind37,
16573
- font_face: bind38,
16574
- font_modify: bind39,
16575
- font_url: bind40,
16596
+ escape: bind38,
16597
+ font_face: bind39,
16598
+ font_modify: bind40,
16599
+ font_url: bind41,
16576
16600
  format_address: format_address_default,
16577
- handle: bind41,
16601
+ handle: bind42,
16578
16602
  // alias
16579
- handleize: bind41,
16580
- image_tag: bind42,
16603
+ handleize: bind42,
16604
+ image_tag: bind43,
16581
16605
  image_url: image_url_default,
16582
- inline_asset_content: bind43,
16583
- json: bind44,
16584
- json_pretty: bind45,
16585
- locale_flag: bind46,
16586
- minus: bind47,
16587
- money: bind48,
16588
- money_with_currency: bind49,
16589
- money_without_currency: bind50,
16590
- money_without_trailing_zeros: bind51,
16591
- script_tag: bind52,
16592
- stylesheet_tag: bind53,
16593
- time_tag: bind54,
16594
- translate: bind55,
16595
- t: bind55,
16606
+ inline_asset_content: bind44,
16607
+ json: bind45,
16608
+ json_pretty: bind46,
16609
+ locale_flag: bind47,
16610
+ minus: bind48,
16611
+ money: bind49,
16612
+ money_with_currency: bind50,
16613
+ money_without_currency: bind51,
16614
+ money_without_trailing_zeros: bind52,
16615
+ script_tag: bind53,
16616
+ stylesheet_tag: bind54,
16617
+ time_tag: bind55,
16618
+ translate: bind56,
16619
+ t: bind56,
16596
16620
  // alias
16597
- where: bind56,
16621
+ where: bind57,
16598
16622
  // Shopify compatibility only
16599
- asset_img_url: bind57,
16600
- hex_to_rgba: bind58,
16601
- img_url: bind59,
16623
+ asset_img_url: bind58,
16624
+ hex_to_rgba: bind59,
16625
+ img_url: bind60,
16602
16626
  item_count_for_variant: item_count_for_variant_default,
16603
- payment_button: bind60,
16604
- payment_terms: bind61,
16605
- placeholder_svg_tag: bind62,
16606
- shopify_asset_url: bind63,
16607
- structured_data: bind64,
16627
+ payment_button: bind61,
16628
+ payment_terms: bind62,
16629
+ placeholder_svg_tag: bind63,
16630
+ shopify_asset_url: bind64,
16631
+ structured_data: bind65,
16608
16632
  // Swell only
16609
- inline_editable: bind65
16633
+ inline_editable: bind66
16610
16634
  };
16611
16635
  function bindFilters(liquidSwell) {
16612
16636
  for (const [tag, handler] of Object.entries(filters)) {
@@ -16620,8 +16644,8 @@ ${injects.join("\n")}<\/script>`;
16620
16644
  }
16621
16645
  }
16622
16646
  }
16623
- function bindWithResolvedProps(liquidSwell, bind66, resolve = []) {
16624
- const handler = bind66(liquidSwell);
16647
+ function bindWithResolvedProps(liquidSwell, bind67, resolve = []) {
16648
+ const handler = bind67(liquidSwell);
16625
16649
  if (!Array.isArray(resolve)) {
16626
16650
  return handler;
16627
16651
  }
@@ -17323,7 +17347,7 @@ ${injects.join("\n")}<\/script>`;
17323
17347
  };
17324
17348
 
17325
17349
  // src/globals.ts
17326
- var import_lodash_es12 = __require("lodash-es");
17350
+ var import_lodash_es13 = __require("lodash-es");
17327
17351
 
17328
17352
  // src/compatibility/drops/robots-rule.ts
17329
17353
  var import_liquidjs35 = __require("liquidjs");
@@ -17423,7 +17447,7 @@ ${injects.join("\n")}<\/script>`;
17423
17447
  }).filter(Boolean).join("\n");
17424
17448
  }
17425
17449
  function getRobotsGlobals(canonicalUrl) {
17426
- const sitemapUrl = `${(0, import_lodash_es12.trimEnd)(canonicalUrl, "/")}/sitemap.xml`;
17450
+ const sitemapUrl = `${(0, import_lodash_es13.trimEnd)(canonicalUrl, "/")}/sitemap.xml`;
17427
17451
  const defaultRules = [
17428
17452
  { directive: "Disallow", value: "/admin" },
17429
17453
  { directive: "Disallow", value: "/cart" },
@@ -17918,7 +17942,7 @@ ${injects.join("\n")}<\/script>`;
17918
17942
  return languageConfig;
17919
17943
  }
17920
17944
  const localeShortCode = locale.split("-")[0];
17921
- return (0, import_lodash_es13.reduce)(
17945
+ return (0, import_lodash_es14.reduce)(
17922
17946
  languageConfig,
17923
17947
  (acc, value, key) => {
17924
17948
  if (isObject2(value)) {
@@ -17942,15 +17966,15 @@ ${injects.join("\n")}<\/script>`;
17942
17966
  const translationEnd = translationParts.pop();
17943
17967
  const translationPath = translationParts.join(".");
17944
17968
  const translationConfigGlobal = this.globals.language;
17945
- acc[key] = (0, import_lodash_es13.get)(
17969
+ acc[key] = (0, import_lodash_es14.get)(
17946
17970
  translationConfigGlobal,
17947
17971
  `${translationPath}.$locale.${locale}.${translationEnd}`
17948
- ) || (0, import_lodash_es13.get)(
17972
+ ) || (0, import_lodash_es14.get)(
17949
17973
  translationConfigGlobal,
17950
17974
  `${translationPath}.$locale.${localeShortCode}.${translationEnd}`
17951
- ) || (0, import_lodash_es13.get)(translationConfigGlobal, translationKey) || value;
17975
+ ) || (0, import_lodash_es14.get)(translationConfigGlobal, translationKey) || value;
17952
17976
  } else {
17953
- acc[key] = (0, import_lodash_es13.get)(languageConfig, `$locale.${locale}.${key}`) || (0, import_lodash_es13.get)(languageConfig, `$locale.${localeShortCode}.${key}`) || value;
17977
+ acc[key] = (0, import_lodash_es14.get)(languageConfig, `$locale.${locale}.${key}`) || (0, import_lodash_es14.get)(languageConfig, `$locale.${localeShortCode}.${key}`) || value;
17954
17978
  }
17955
17979
  }
17956
17980
  return acc;
@@ -18786,8 +18810,8 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18786
18810
  const keyParts = key?.split(".") || [];
18787
18811
  const keyName = keyParts.pop() || "";
18788
18812
  const keyPath = keyParts.join(".");
18789
- const langObject = (0, import_lodash_es13.get)(langConfig, keyPath);
18790
- let localeValue = (0, import_lodash_es13.get)(langObject?.[localeCode], keyName) || (0, import_lodash_es13.get)(langObject?.[localeCode.split("-")[0]], keyName) || langObject?.[keyName];
18813
+ const langObject = (0, import_lodash_es14.get)(langConfig, keyPath);
18814
+ let localeValue = (0, import_lodash_es14.get)(langObject?.[localeCode], keyName) || (0, import_lodash_es14.get)(langObject?.[localeCode.split("-")[0]], keyName) || langObject?.[keyName];
18791
18815
  if (data?.count !== void 0 && localeValue?.one) {
18792
18816
  localeValue = data.count === 1 ? localeValue.one : localeValue.other;
18793
18817
  }
@@ -18832,7 +18856,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18832
18856
  let blocks = settings.section.blocks?.filter(
18833
18857
  (block) => block.disabled !== true
18834
18858
  );
18835
- blocks = blocks?.map((block) => ({
18859
+ blocks = blocks?.filter((block) => Boolean(block.type)).map((block) => ({
18836
18860
  ...block,
18837
18861
  ...getBlockAttributes(theme, block),
18838
18862
  settings: resolveThemeSettings(
@@ -18867,7 +18891,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18867
18891
  }
18868
18892
  }
18869
18893
  function resolveThemeSettings(theme, themeSettings, editorSchemaSettings) {
18870
- const settings = (0, import_lodash_es13.cloneDeep)(themeSettings);
18894
+ const settings = (0, import_lodash_es14.cloneDeep)(themeSettings);
18871
18895
  if (settings.$locale) {
18872
18896
  const { locale } = theme.swell.getStorefrontLocalization();
18873
18897
  const localeConfig = settings.$locale[locale] || {};
@@ -18877,16 +18901,16 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18877
18901
  }
18878
18902
  }
18879
18903
  }
18880
- (0, import_lodash_es13.each)(settings, (value, key) => {
18904
+ (0, import_lodash_es14.each)(settings, (value, key) => {
18881
18905
  const setting = (editorSchemaSettings && findEditorSetting(editorSchemaSettings, key)) ?? null;
18882
18906
  if (isObject2(value) && !(value instanceof StorefrontResource)) {
18883
18907
  switch (setting?.type) {
18884
18908
  case "color_scheme_group": {
18885
- (0, import_lodash_es13.each)(value, (scheme, schemeId) => {
18909
+ (0, import_lodash_es14.each)(value, (scheme, schemeId) => {
18886
18910
  if (isObject2(scheme) && typeof scheme.settings === "object" && scheme.settings) {
18887
18911
  const settings2 = scheme.settings;
18888
- (0, import_lodash_es13.each)(settings2, (colorValue, colorId) => {
18889
- const fieldDef = (0, import_lodash_es13.find)(setting.fields, { id: colorId });
18912
+ (0, import_lodash_es14.each)(settings2, (colorValue, colorId) => {
18913
+ const fieldDef = (0, import_lodash_es14.find)(setting.fields, { id: colorId });
18890
18914
  if (fieldDef?.type === "color" && colorValue) {
18891
18915
  scheme.id = schemeId;
18892
18916
  settings2[colorId] = new ThemeColor(colorValue);
@@ -18937,7 +18961,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18937
18961
  }
18938
18962
  function findThemeSettingsByType(type, themeSettings, editorSchemaSettings) {
18939
18963
  const foundSettings = [];
18940
- (0, import_lodash_es13.each)(themeSettings, (value, key) => {
18964
+ (0, import_lodash_es14.each)(themeSettings, (value, key) => {
18941
18965
  if (isObject2(value) && !(value instanceof ThemeFont) && !(value instanceof StorefrontResource)) {
18942
18966
  foundSettings.push(
18943
18967
  ...findThemeSettingsByType(type, value, editorSchemaSettings)
@@ -19111,7 +19135,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
19111
19135
  }
19112
19136
  function getMenuItemValueId(value) {
19113
19137
  const fallback = typeof value === "string" ? value : "";
19114
- const slug = (0, import_lodash_es14.get)(value, "id", (0, import_lodash_es14.get)(value, "slug", fallback)) || "";
19138
+ const slug = (0, import_lodash_es15.get)(value, "id", (0, import_lodash_es15.get)(value, "slug", fallback)) || "";
19115
19139
  return slug;
19116
19140
  }
19117
19141
  async function getMenuItemUrlAndResource(theme, menuItem) {