@lancom/shared 0.0.445 → 0.0.447
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.
|
@@ -154,8 +154,8 @@ export default {
|
|
|
154
154
|
this.suburb = suburb;
|
|
155
155
|
this.calculateShipping();
|
|
156
156
|
},
|
|
157
|
-
buildSignature() {
|
|
158
|
-
return JSON.stringify((this.usedSimpleProducts || []).map(({ _id, amount }) => ({ _id, amount })));
|
|
157
|
+
buildSignature(usedSimpleProducts) {
|
|
158
|
+
return JSON.stringify((usedSimpleProducts || this.usedSimpleProducts || []).map(({ _id, amount }) => ({ _id, amount })));
|
|
159
159
|
},
|
|
160
160
|
async calculateShipping() {
|
|
161
161
|
if (!this.hasSelection) {
|
|
@@ -175,7 +175,8 @@ export default {
|
|
|
175
175
|
usedSimpleProducts = usedSimpleProducts.filter(c => c.size._id === this.value?.size?._id);
|
|
176
176
|
}
|
|
177
177
|
const simpleProduct = usedSimpleProducts[0] || this.usedSimpleProducts[0] || this.defaultSimpleProduct;
|
|
178
|
-
|
|
178
|
+
const amount = this.value?.quantity || simpleProduct.amount || 1;
|
|
179
|
+
usedSimpleProducts = simpleProduct ? [{ ...simpleProduct, amount }] : [];
|
|
179
180
|
}
|
|
180
181
|
const entities = getProductsForCalculatePricing(this.product, usedSimpleProducts);
|
|
181
182
|
const payload = {
|
|
@@ -185,7 +186,7 @@ export default {
|
|
|
185
186
|
currency: this.currency?._id
|
|
186
187
|
};
|
|
187
188
|
this.pricing = await api.calculateProductPrice(payload, this.shop._id);
|
|
188
|
-
this.lastUsedSimpleProductsSignature = this.buildSignature();
|
|
189
|
+
this.lastUsedSimpleProductsSignature = this.buildSignature(usedSimpleProducts);
|
|
189
190
|
} catch (e) {
|
|
190
191
|
this.pricing = null;
|
|
191
192
|
} finally {
|