@swell/apps-sdk 1.0.187 → 1.0.188
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 +8 -3
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +8 -3
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +8 -3
- package/dist/index.mjs.map +2 -2
- package/dist/src/resources/swell_types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4983,12 +4983,17 @@ function transformSwellVariant(params, product, variant) {
|
|
|
4983
4983
|
var SwellVariant = class extends SwellStorefrontRecord {
|
|
4984
4984
|
product;
|
|
4985
4985
|
constructor(swell, product, id, query) {
|
|
4986
|
+
const params = swell.queryParams;
|
|
4986
4987
|
super(swell, "products:variants", id, query, async function() {
|
|
4987
4988
|
const variant = await this._swell.get(
|
|
4988
|
-
"/products:variants
|
|
4989
|
-
{ id: this._id }
|
|
4989
|
+
"/products:variants/:last",
|
|
4990
|
+
{ $or: [{ id: this._id }, { sku: this._id }] }
|
|
4991
|
+
);
|
|
4992
|
+
return transformSwellVariant(
|
|
4993
|
+
params,
|
|
4994
|
+
product instanceof SwellStorefrontRecord ? await product.resolve() : product,
|
|
4995
|
+
variant
|
|
4990
4996
|
);
|
|
4991
|
-
return variant ?? null;
|
|
4992
4997
|
});
|
|
4993
4998
|
this.product = product;
|
|
4994
4999
|
}
|