@ancon/wildcat-utils 1.50.8 → 1.50.10
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
|
|
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:p,upsellGroupId:l,totalPriceInclTax:d,addOnProducts:c,itemType:s}=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:s}}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:s}}return{variantId:r.variantId,quantity:n,modifications:p.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:c.map(e=>({quantity:e.quantity,freeAmount:e.addOnFreeAmount,variantId:e.product.variantId,unitQuantity:e.quantity,addOnGroupId:e.addOnGroupId})),upsellGroupId:l,itemType:s}}module.exports=i;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import I from "./isWalletTopUpCheckoutItem.mjs";
|
|
2
|
-
import
|
|
2
|
+
import i from "./isGiftCardCheckoutItem.mjs";
|
|
3
3
|
import "@ancon/wildcat-types";
|
|
4
4
|
function v(u, a) {
|
|
5
|
-
const {
|
|
5
|
+
const {
|
|
6
|
+
product: r,
|
|
7
|
+
quantity: n,
|
|
8
|
+
modifications: s,
|
|
9
|
+
upsellGroupId: l,
|
|
10
|
+
totalPriceInclTax: d,
|
|
11
|
+
addOnProducts: y,
|
|
12
|
+
itemType: p
|
|
13
|
+
} = u;
|
|
6
14
|
if (I(u)) {
|
|
7
15
|
let e = null;
|
|
8
16
|
if (a) {
|
|
@@ -19,10 +27,11 @@ function v(u, a) {
|
|
|
19
27
|
metaData: e,
|
|
20
28
|
quantity: n,
|
|
21
29
|
modifications: [],
|
|
22
|
-
addOnProducts: []
|
|
30
|
+
addOnProducts: [],
|
|
31
|
+
itemType: p
|
|
23
32
|
};
|
|
24
33
|
}
|
|
25
|
-
if (
|
|
34
|
+
if (i(u)) {
|
|
26
35
|
let e = null;
|
|
27
36
|
if (a) {
|
|
28
37
|
const t = a;
|
|
@@ -30,6 +39,7 @@ function v(u, a) {
|
|
|
30
39
|
draftGiftCardId: t.draftGiftCardId,
|
|
31
40
|
amount: t.amount,
|
|
32
41
|
email: t.email,
|
|
42
|
+
externalPurchase: t.externalPurchase,
|
|
33
43
|
greetingMessage: t.greetingMessage,
|
|
34
44
|
id: t.id,
|
|
35
45
|
receivedBy: t.receivedBy,
|
|
@@ -45,13 +55,14 @@ function v(u, a) {
|
|
|
45
55
|
metaData: e,
|
|
46
56
|
quantity: n,
|
|
47
57
|
modifications: [],
|
|
48
|
-
addOnProducts: []
|
|
58
|
+
addOnProducts: [],
|
|
59
|
+
itemType: p
|
|
49
60
|
};
|
|
50
61
|
}
|
|
51
62
|
return {
|
|
52
63
|
variantId: r.variantId,
|
|
53
64
|
quantity: n,
|
|
54
|
-
modifications:
|
|
65
|
+
modifications: s.map((e) => ({
|
|
55
66
|
modification: e.modification,
|
|
56
67
|
ingredientId: e.ingredientId,
|
|
57
68
|
quantity: e == null ? void 0 : e.quantity,
|
|
@@ -60,14 +71,15 @@ function v(u, a) {
|
|
|
60
71
|
replaceId: e.replaceId || void 0,
|
|
61
72
|
description: e == null ? void 0 : e.description
|
|
62
73
|
})),
|
|
63
|
-
addOnProducts:
|
|
74
|
+
addOnProducts: y.map((e) => ({
|
|
64
75
|
quantity: e.quantity,
|
|
65
76
|
freeAmount: e.addOnFreeAmount,
|
|
66
77
|
variantId: e.product.variantId,
|
|
67
78
|
unitQuantity: e.quantity,
|
|
68
79
|
addOnGroupId: e.addOnGroupId
|
|
69
80
|
})),
|
|
70
|
-
upsellGroupId:
|
|
81
|
+
upsellGroupId: l,
|
|
82
|
+
itemType: p
|
|
71
83
|
};
|
|
72
84
|
}
|
|
73
85
|
export {
|