@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.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) {
@@ -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);
@@ -16098,19 +16104,12 @@ ${injects.join("\n")}<\/script>`;
16098
16104
  // src/liquid/filters/locale_flag.ts
16099
16105
  var import_country_flag_icons = __require("country-flag-icons");
16100
16106
  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
16107
  function bind46(_liquidSwell) {
16109
16108
  return (localeCode) => {
16110
16109
  if (typeof localeCode !== "string") {
16111
16110
  return flags.US;
16112
16111
  }
16113
- const countryCode = getCountryCode(localeCode);
16112
+ const countryCode = getCountryCodeFromLocale(localeCode).toUpperCase();
16114
16113
  return (0, import_country_flag_icons.hasFlag)(countryCode) ? flags[countryCode] : flags.US;
16115
16114
  };
16116
16115
  }
@@ -16318,7 +16317,7 @@ ${injects.join("\n")}<\/script>`;
16318
16317
  // src/liquid/filters/shopify/payment_button.ts
16319
16318
  function bind60(_liquidSwell) {
16320
16319
  return (form) => {
16321
- return null;
16320
+ return `<button style="display: block; visibility: hidden;"></button>`;
16322
16321
  };
16323
16322
  }
16324
16323
 
@@ -18832,7 +18831,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18832
18831
  let blocks = settings.section.blocks?.filter(
18833
18832
  (block) => block.disabled !== true
18834
18833
  );
18835
- blocks = blocks?.map((block) => ({
18834
+ blocks = blocks?.filter((block) => Boolean(block.type)).map((block) => ({
18836
18835
  ...block,
18837
18836
  ...getBlockAttributes(theme, block),
18838
18837
  settings: resolveThemeSettings(