@swell/apps-sdk 1.0.171 → 1.0.173
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 +24 -1
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +24 -1
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +24 -1
- package/dist/index.mjs.map +2 -2
- package/dist/src/theme/theme-loader.d.ts +5 -0
- package/dist/src/theme.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -10046,6 +10046,7 @@ var ThemeFormErrors = class {
|
|
|
10046
10046
|
var SHOPIFY_TO_SWELL_SORTING = {
|
|
10047
10047
|
"best-selling": "popularity",
|
|
10048
10048
|
"title-ascending": "name_asc",
|
|
10049
|
+
"title-descending": "name_desc",
|
|
10049
10050
|
"price-ascending": "price_asc",
|
|
10050
10051
|
"price-descending": "price_desc",
|
|
10051
10052
|
"created-ascending": "date_asc",
|
|
@@ -12430,6 +12431,10 @@ function adjustProductVariants(instance, product) {
|
|
|
12430
12431
|
if (instance.supportsSwellVariants()) {
|
|
12431
12432
|
return;
|
|
12432
12433
|
}
|
|
12434
|
+
const hasOptions = Array.isArray(product.options) && product.options.length > 0;
|
|
12435
|
+
if (hasOptions) {
|
|
12436
|
+
product.options = product.options?.filter((option) => option.variant);
|
|
12437
|
+
}
|
|
12433
12438
|
const hasVariants = Array.isArray(product.variants?.results) && product.variants.results.length > 0;
|
|
12434
12439
|
if (hasVariants) {
|
|
12435
12440
|
return;
|
|
@@ -12567,6 +12572,9 @@ function ShopifyLineItem(instance, item, cart, options = {}) {
|
|
|
12567
12572
|
}
|
|
12568
12573
|
return ShopifyVariant(instance, variant, item.product);
|
|
12569
12574
|
}),
|
|
12575
|
+
variant_id: deferWith([item.product, item.variant], (product, variant) => {
|
|
12576
|
+
return variant?.id || product?.id;
|
|
12577
|
+
}),
|
|
12570
12578
|
vendor: void 0
|
|
12571
12579
|
});
|
|
12572
12580
|
}
|
|
@@ -14622,7 +14630,7 @@ ${injects.join("\n")}</script>`;
|
|
|
14622
14630
|
return param === "sort_by";
|
|
14623
14631
|
},
|
|
14624
14632
|
to(_param, value) {
|
|
14625
|
-
return { sort: SHOPIFY_TO_SWELL_SORTING[value] || "" };
|
|
14633
|
+
return { sort: SHOPIFY_TO_SWELL_SORTING[value] ?? (value || "") };
|
|
14626
14634
|
}
|
|
14627
14635
|
},
|
|
14628
14636
|
{
|
|
@@ -17056,6 +17064,13 @@ var ThemeLoader = class _ThemeLoader {
|
|
|
17056
17064
|
setConfigs(themeConfigs) {
|
|
17057
17065
|
this.configs = new Map(themeConfigs);
|
|
17058
17066
|
}
|
|
17067
|
+
/**
|
|
17068
|
+
* Load theme record from internal data, typically in the editor.
|
|
17069
|
+
* Used when theme record is provided externally (e.g., from editor).
|
|
17070
|
+
*/
|
|
17071
|
+
setThemeRecord(themeRecord) {
|
|
17072
|
+
this.themeRecord = themeRecord;
|
|
17073
|
+
}
|
|
17059
17074
|
/**
|
|
17060
17075
|
* Updates KV with file_data for provided theme configs (warmup path).
|
|
17061
17076
|
* Uses the new ThemeFileStorage abstraction for optimized operations.
|
|
@@ -17566,6 +17581,14 @@ var SwellTheme3 = class {
|
|
|
17566
17581
|
this.themeLoader.setConfigs(configs);
|
|
17567
17582
|
}
|
|
17568
17583
|
}
|
|
17584
|
+
/**
|
|
17585
|
+
* Setter for theme record - directly sets theme record in the loader.
|
|
17586
|
+
*/
|
|
17587
|
+
set themeRecord(themeRecord) {
|
|
17588
|
+
if (themeRecord) {
|
|
17589
|
+
this.themeLoader.setThemeRecord(themeRecord);
|
|
17590
|
+
}
|
|
17591
|
+
}
|
|
17569
17592
|
getSwellAppThemeProps(swellConfig) {
|
|
17570
17593
|
return swellConfig?.storefront?.theme || {};
|
|
17571
17594
|
}
|