@ancon/wildcat-utils 1.50.7 → 1.50.8
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("@ancon/wildcat-types");function s(i){const t=[],o=[];return i.selectedIngredients.forEach(e=>{e.selected?e.replacementId&&t.push({modification:n.ModificationType.Replace,ingredientId:e.id,replaceId:e.replacementId}):t.push({modification:n.ModificationType.Remove,ingredientId:e.id})}),i.selectedAddons.forEach(e=>{var c;if(e.selectedIngredientId){t.push({addOnGroupId:e.addonId,modification:n.ModificationType.Add,ingredientId:e.selectedIngredientId,quantity:1,freeAmount:e.ingredients.some(d=>d.freeAmount===1)?1:0});return}e.ingredients.forEach(d=>{d.selectedCount&&t.push({addOnGroupId:e.addonId,modification:n.ModificationType.Add,ingredientId:d.id,quantity:d.selectedCount,freeAmount:d.freeAmount})}),(c=e.products)==null||c.forEach(d=>{d.selectedCount&&o.push({variantId:d.selectedVariantId,addOnGroupId:e.addonId,quantity:d.selectedCount,freeAmount:d.freeAmount,unitQuantity:d.selectedCount})})}),{modifications:t,quantity:i.quantity,variantId:i.selectedVariantId,showingPrice:i.selectedVariantShowingPrice,addOnProducts:o}}module.exports=s;
|
|
1
|
+
"use strict";const n=require("@ancon/wildcat-types");function s(i){const t=[],o=[];return i.selectedIngredients.forEach(e=>{e.selected?e.replacementId&&t.push({modification:n.ModificationType.Replace,ingredientId:e.id,replaceId:e.replacementId}):t.push({modification:n.ModificationType.Remove,ingredientId:e.id})}),i.selectedAddons.forEach(e=>{var c;if(e.selectedIngredientId){t.push({addOnGroupId:e.addonId,modification:n.ModificationType.Add,ingredientId:e.selectedIngredientId,quantity:1,freeAmount:e.ingredients.some(d=>d.freeAmount===1)?1:0});return}e.ingredients.forEach(d=>{d.selectedCount&&t.push({addOnGroupId:e.addonId,modification:n.ModificationType.Add,ingredientId:d.id,quantity:d.selectedCount,freeAmount:d.freeAmount})}),(c=e.products)==null||c.forEach(d=>{d.selectedCount&&o.push({variantId:d.selectedVariantId,addOnGroupId:e.addonId,quantity:d.selectedCount,freeAmount:d.freeAmount,unitQuantity:d.selectedCount})})}),{modifications:t,quantity:i.quantity,variantId:i.selectedVariantId,showingPrice:i.selectedVariantShowingPrice,addOnProducts:o,itemType:n.CheckoutItemType.SaleProduct}}module.exports=s;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ModificationType as n } from "@ancon/wildcat-types";
|
|
2
|
-
function
|
|
1
|
+
import { ModificationType as n, CheckoutItemType as s } from "@ancon/wildcat-types";
|
|
2
|
+
function f(t) {
|
|
3
3
|
const i = [], o = [];
|
|
4
4
|
return t.selectedIngredients.forEach((e) => {
|
|
5
5
|
e.selected ? e.replacementId && i.push({
|
|
@@ -11,7 +11,7 @@ function r(t) {
|
|
|
11
11
|
ingredientId: e.id
|
|
12
12
|
});
|
|
13
13
|
}), t.selectedAddons.forEach((e) => {
|
|
14
|
-
var
|
|
14
|
+
var c;
|
|
15
15
|
if (e.selectedIngredientId) {
|
|
16
16
|
i.push({
|
|
17
17
|
addOnGroupId: e.addonId,
|
|
@@ -30,7 +30,7 @@ function r(t) {
|
|
|
30
30
|
quantity: d.selectedCount,
|
|
31
31
|
freeAmount: d.freeAmount
|
|
32
32
|
});
|
|
33
|
-
}), (
|
|
33
|
+
}), (c = e.products) == null || c.forEach((d) => {
|
|
34
34
|
d.selectedCount && o.push({
|
|
35
35
|
variantId: d.selectedVariantId,
|
|
36
36
|
addOnGroupId: e.addonId,
|
|
@@ -44,9 +44,11 @@ function r(t) {
|
|
|
44
44
|
quantity: t.quantity,
|
|
45
45
|
variantId: t.selectedVariantId,
|
|
46
46
|
showingPrice: t.selectedVariantShowingPrice,
|
|
47
|
-
addOnProducts: o
|
|
47
|
+
addOnProducts: o,
|
|
48
|
+
itemType: s.SaleProduct
|
|
49
|
+
// default type, this only changes for upsell items
|
|
48
50
|
};
|
|
49
51
|
}
|
|
50
52
|
export {
|
|
51
|
-
|
|
53
|
+
f as default
|
|
52
54
|
};
|
package/checkout/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CheckoutRequestItemUnitPrice, ModificationType, ProductType, VariantType } from '@ancon/wildcat-types';
|
|
1
|
+
import { CheckoutItemType, CheckoutRequestItemUnitPrice, ModificationType, ProductType, VariantType } from '@ancon/wildcat-types';
|
|
2
2
|
export declare type CheckoutRequestItemModification = {
|
|
3
3
|
modification: ModificationType;
|
|
4
4
|
ingredientId: string;
|
|
@@ -26,5 +26,6 @@ export declare type CheckoutRequestItem = {
|
|
|
26
26
|
showingPrice?: number;
|
|
27
27
|
price?: CheckoutRequestItemUnitPrice;
|
|
28
28
|
metaData?: string | null;
|
|
29
|
+
itemType?: CheckoutItemType;
|
|
29
30
|
};
|
|
30
31
|
export declare type CheckoutItemComparisonCandidate = Pick<CheckoutRequestItem, 'variantId' | 'modifications' | 'upsellGroupId'>;
|