@swell/apps-sdk 1.0.181 → 1.0.182

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.mjs CHANGED
@@ -888,7 +888,10 @@ var SwellStorefrontCollection = class _SwellStorefrontCollection extends SwellSt
888
888
  }
889
889
  return this._resolve().then(() => this.makeIterator());
890
890
  }
891
- makeIterator() {
891
+ async makeIterator() {
892
+ if (isLikePromise(this.results)) {
893
+ await this.results;
894
+ }
892
895
  return (this.results || []).values();
893
896
  }
894
897
  _clone(newProps) {
@@ -3640,11 +3643,11 @@ function arrayToObject(arr, key = "id") {
3640
3643
  );
3641
3644
  }
3642
3645
  function getCountryCodeFromLocale(locale) {
3643
- const split = locale.split(/-|_/);
3644
- const country = split.pop()?.toUpperCase();
3645
- const lang = split.join("-");
3646
- const code = country ? country : LANG_TO_COUNTRY_CODES[lang] || "";
3647
- return code.toLowerCase();
3646
+ const [lang, country] = locale.split(/-|_/);
3647
+ if (country) {
3648
+ return country.toLowerCase();
3649
+ }
3650
+ return (LANG_TO_COUNTRY_CODES[lang] || "").toLowerCase();
3648
3651
  }
3649
3652
  function getCountryByCurrency(currencyCode) {
3650
3653
  if (currencyCode in CURRENCY_COUNTRIES) {
@@ -10216,6 +10219,9 @@ function getLocalizedValue(value, locale) {
10216
10219
 
10217
10220
  // src/compatibility/shopify-fonts.ts
10218
10221
  function shopifyFontToThemeFront(shopifyFontSetting) {
10222
+ if (typeof shopifyFontSetting !== "string") {
10223
+ return null;
10224
+ }
10219
10225
  const pos = shopifyFontSetting.lastIndexOf("_");
10220
10226
  const familyId = shopifyFontSetting.substring(0, pos);
10221
10227
  const variantId = shopifyFontSetting.substring(pos + 1);
@@ -16079,19 +16085,12 @@ function bind45(_liquidSwell) {
16079
16085
  // src/liquid/filters/locale_flag.ts
16080
16086
  import { hasFlag } from "country-flag-icons";
16081
16087
  import * as flags from "country-flag-icons/string/1x1";
16082
- function getCountryCode(localCode) {
16083
- if (localCode.includes("-")) {
16084
- return localCode.split("-")[1].toUpperCase();
16085
- } else {
16086
- return localCode.toUpperCase();
16087
- }
16088
- }
16089
16088
  function bind46(_liquidSwell) {
16090
16089
  return (localeCode) => {
16091
16090
  if (typeof localeCode !== "string") {
16092
16091
  return flags.US;
16093
16092
  }
16094
- const countryCode = getCountryCode(localeCode);
16093
+ const countryCode = getCountryCodeFromLocale(localeCode).toUpperCase();
16095
16094
  return hasFlag(countryCode) ? flags[countryCode] : flags.US;
16096
16095
  };
16097
16096
  }
@@ -16299,7 +16298,7 @@ var item_count_for_variant_default = {
16299
16298
  // src/liquid/filters/shopify/payment_button.ts
16300
16299
  function bind60(_liquidSwell) {
16301
16300
  return (form) => {
16302
- return null;
16301
+ return `<button style="display: block; visibility: hidden;"></button>`;
16303
16302
  };
16304
16303
  }
16305
16304
 
@@ -18813,7 +18812,7 @@ function resolveSectionSettings(theme, sectionConfig, index) {
18813
18812
  let blocks = settings.section.blocks?.filter(
18814
18813
  (block) => block.disabled !== true
18815
18814
  );
18816
- blocks = blocks?.map((block) => ({
18815
+ blocks = blocks?.filter((block) => Boolean(block.type)).map((block) => ({
18817
18816
  ...block,
18818
18817
  ...getBlockAttributes(theme, block),
18819
18818
  settings: resolveThemeSettings(