@ancon/wildcat-utils 1.50.13 → 1.50.14
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 y=require("./isWalletTopUpCheckoutItem.js"),I=require("./isGiftCardCheckoutItem.js");require("@ancon/wildcat-types");function i(u,a){const{product:r,quantity:n,modifications:
|
|
1
|
+
"use strict";const y=require("./isWalletTopUpCheckoutItem.js"),I=require("./isGiftCardCheckoutItem.js");require("@ancon/wildcat-types");function i(u,a){const{product:r,quantity:n,modifications:l,upsellGroupId:c,totalPriceInclTax:d,addOnProducts:s,itemType:p}=u;if(y(u)){let e=null;if(a){const t=a;e=JSON.stringify({id:t.id,prepaidWalletNumber:t.prepaidWalletNumber})}return{productType:r.productType,variantType:r.variantType,price:{unitPrice:d.amount},metaData:e,quantity:n,modifications:[],addOnProducts:[],itemType:p}}if(I(u)){let e=null;if(a){const t=a;e=JSON.stringify({draftGiftCardId:t.draftGiftCardId,amount:t.amount,email:t.email,externalPurchase:t.externalPurchase,greetingMessage:t.greetingMessage,id:t.id,receivedBy:t.receivedBy,senderEmail:t.senderEmail,sendingBy:t.sendingBy,sms:t.sms})}return{productType:r.productType,variantType:r.variantType,price:{unitPrice:d.amount},metaData:e,quantity:n,modifications:[],addOnProducts:[],itemType:p}}return{variantId:r.variantId,quantity:n,modifications:l.map(e=>({modification:e.modification,ingredientId:e.ingredientId,quantity:e==null?void 0:e.quantity,freeAmount:e==null?void 0:e.freeAmount,addOnGroupId:(e==null?void 0:e.groupId)||void 0,replaceId:e.replaceId||void 0,description:e==null?void 0:e.description})),addOnProducts:(s==null?void 0:s.map(e=>({quantity:e.quantity,freeAmount:e.addOnFreeAmount,variantId:e.product.variantId,unitQuantity:e.quantity,addOnGroupId:e.addOnGroupId})))??[],upsellGroupId:c,itemType:p}}module.exports=i;
|
|
@@ -5,11 +5,11 @@ function v(u, a) {
|
|
|
5
5
|
const {
|
|
6
6
|
product: r,
|
|
7
7
|
quantity: n,
|
|
8
|
-
modifications:
|
|
9
|
-
upsellGroupId:
|
|
8
|
+
modifications: l,
|
|
9
|
+
upsellGroupId: y,
|
|
10
10
|
totalPriceInclTax: d,
|
|
11
|
-
addOnProducts:
|
|
12
|
-
itemType:
|
|
11
|
+
addOnProducts: p,
|
|
12
|
+
itemType: s
|
|
13
13
|
} = u;
|
|
14
14
|
if (I(u)) {
|
|
15
15
|
let e = null;
|
|
@@ -28,7 +28,7 @@ function v(u, a) {
|
|
|
28
28
|
quantity: n,
|
|
29
29
|
modifications: [],
|
|
30
30
|
addOnProducts: [],
|
|
31
|
-
itemType:
|
|
31
|
+
itemType: s
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
if (i(u)) {
|
|
@@ -56,13 +56,13 @@ function v(u, a) {
|
|
|
56
56
|
quantity: n,
|
|
57
57
|
modifications: [],
|
|
58
58
|
addOnProducts: [],
|
|
59
|
-
itemType:
|
|
59
|
+
itemType: s
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
return {
|
|
63
63
|
variantId: r.variantId,
|
|
64
64
|
quantity: n,
|
|
65
|
-
modifications:
|
|
65
|
+
modifications: l.map((e) => ({
|
|
66
66
|
modification: e.modification,
|
|
67
67
|
ingredientId: e.ingredientId,
|
|
68
68
|
quantity: e == null ? void 0 : e.quantity,
|
|
@@ -71,15 +71,15 @@ function v(u, a) {
|
|
|
71
71
|
replaceId: e.replaceId || void 0,
|
|
72
72
|
description: e == null ? void 0 : e.description
|
|
73
73
|
})),
|
|
74
|
-
addOnProducts:
|
|
74
|
+
addOnProducts: (p == null ? void 0 : p.map((e) => ({
|
|
75
75
|
quantity: e.quantity,
|
|
76
76
|
freeAmount: e.addOnFreeAmount,
|
|
77
77
|
variantId: e.product.variantId,
|
|
78
78
|
unitQuantity: e.quantity,
|
|
79
79
|
addOnGroupId: e.addOnGroupId
|
|
80
|
-
})),
|
|
81
|
-
upsellGroupId:
|
|
82
|
-
itemType:
|
|
80
|
+
}))) ?? [],
|
|
81
|
+
upsellGroupId: y,
|
|
82
|
+
itemType: s
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
85
|
export {
|