@swell/apps-sdk 1.0.172 → 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 +22 -0
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +22 -0
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +22 -0
- 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
|
@@ -12431,6 +12431,10 @@ function adjustProductVariants(instance, product) {
|
|
|
12431
12431
|
if (instance.supportsSwellVariants()) {
|
|
12432
12432
|
return;
|
|
12433
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
|
+
}
|
|
12434
12438
|
const hasVariants = Array.isArray(product.variants?.results) && product.variants.results.length > 0;
|
|
12435
12439
|
if (hasVariants) {
|
|
12436
12440
|
return;
|
|
@@ -12568,6 +12572,9 @@ function ShopifyLineItem(instance, item, cart, options = {}) {
|
|
|
12568
12572
|
}
|
|
12569
12573
|
return ShopifyVariant(instance, variant, item.product);
|
|
12570
12574
|
}),
|
|
12575
|
+
variant_id: deferWith([item.product, item.variant], (product, variant) => {
|
|
12576
|
+
return variant?.id || product?.id;
|
|
12577
|
+
}),
|
|
12571
12578
|
vendor: void 0
|
|
12572
12579
|
});
|
|
12573
12580
|
}
|
|
@@ -17057,6 +17064,13 @@ var ThemeLoader = class _ThemeLoader {
|
|
|
17057
17064
|
setConfigs(themeConfigs) {
|
|
17058
17065
|
this.configs = new Map(themeConfigs);
|
|
17059
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
|
+
}
|
|
17060
17074
|
/**
|
|
17061
17075
|
* Updates KV with file_data for provided theme configs (warmup path).
|
|
17062
17076
|
* Uses the new ThemeFileStorage abstraction for optimized operations.
|
|
@@ -17567,6 +17581,14 @@ var SwellTheme3 = class {
|
|
|
17567
17581
|
this.themeLoader.setConfigs(configs);
|
|
17568
17582
|
}
|
|
17569
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
|
+
}
|
|
17570
17592
|
getSwellAppThemeProps(swellConfig) {
|
|
17571
17593
|
return swellConfig?.storefront?.theme || {};
|
|
17572
17594
|
}
|