@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.cjs +15 -16
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +15 -16
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +15 -16
- package/dist/index.mjs.map +2 -2
- package/dist/src/compatibility/shopify-fonts.d.ts +1 -1
- package/dist/src/liquid/filters/shopify/payment_button.d.ts +1 -1
- package/dist/src/resources.d.ts +2 -2
- package/package.json +1 -1
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
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
return
|
|
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) {
|
|
@@ -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);
|
|
@@ -16221,19 +16227,12 @@ function bind45(_liquidSwell) {
|
|
|
16221
16227
|
// src/liquid/filters/locale_flag.ts
|
|
16222
16228
|
var import_country_flag_icons = require("country-flag-icons");
|
|
16223
16229
|
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
16230
|
function bind46(_liquidSwell) {
|
|
16232
16231
|
return (localeCode) => {
|
|
16233
16232
|
if (typeof localeCode !== "string") {
|
|
16234
16233
|
return flags.US;
|
|
16235
16234
|
}
|
|
16236
|
-
const countryCode =
|
|
16235
|
+
const countryCode = getCountryCodeFromLocale(localeCode).toUpperCase();
|
|
16237
16236
|
return (0, import_country_flag_icons.hasFlag)(countryCode) ? flags[countryCode] : flags.US;
|
|
16238
16237
|
};
|
|
16239
16238
|
}
|
|
@@ -16441,7 +16440,7 @@ var item_count_for_variant_default = {
|
|
|
16441
16440
|
// src/liquid/filters/shopify/payment_button.ts
|
|
16442
16441
|
function bind60(_liquidSwell) {
|
|
16443
16442
|
return (form) => {
|
|
16444
|
-
return
|
|
16443
|
+
return `<button style="display: block; visibility: hidden;"></button>`;
|
|
16445
16444
|
};
|
|
16446
16445
|
}
|
|
16447
16446
|
|
|
@@ -18955,7 +18954,7 @@ function resolveSectionSettings(theme, sectionConfig, index) {
|
|
|
18955
18954
|
let blocks = settings.section.blocks?.filter(
|
|
18956
18955
|
(block) => block.disabled !== true
|
|
18957
18956
|
);
|
|
18958
|
-
blocks = blocks?.map((block) => ({
|
|
18957
|
+
blocks = blocks?.filter((block) => Boolean(block.type)).map((block) => ({
|
|
18959
18958
|
...block,
|
|
18960
18959
|
...getBlockAttributes(theme, block),
|
|
18961
18960
|
settings: resolveThemeSettings(
|