@ancon/wildcat-utils 1.50.14 → 1.50.15
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/checkout/buildCheckoutRequestItem.js +1 -1
- package/checkout/buildCheckoutRequestItem.mjs +6 -5
- package/checkout/getCheckoutProductAddonModifications.js +1 -1
- package/checkout/getCheckoutProductAddonModifications.mjs +17 -10
- package/checkout/getCheckoutRequestItemFromCheckoutItem.js +1 -1
- package/checkout/getCheckoutRequestItemFromCheckoutItem.mjs +13 -13
- package/checkout/isCheckoutItemsAreEqual.js +1 -1
- package/checkout/isCheckoutItemsAreEqual.mjs +14 -11
- package/checkout/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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:
|
|
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:1})})}),{modifications:t,quantity:i.quantity,variantId:i.selectedVariantId,showingPrice:i.selectedVariantShowingPrice,addOnProducts:o,upsellGroupId:null,itemType:n.CheckoutItemType.SaleProduct}}module.exports=s;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModificationType as n, CheckoutItemType as
|
|
1
|
+
import { ModificationType as n, CheckoutItemType as c } from "@ancon/wildcat-types";
|
|
2
2
|
function f(t) {
|
|
3
3
|
const i = [], o = [];
|
|
4
4
|
return t.selectedIngredients.forEach((e) => {
|
|
@@ -11,7 +11,7 @@ function f(t) {
|
|
|
11
11
|
ingredientId: e.id
|
|
12
12
|
});
|
|
13
13
|
}), t.selectedAddons.forEach((e) => {
|
|
14
|
-
var
|
|
14
|
+
var r;
|
|
15
15
|
if (e.selectedIngredientId) {
|
|
16
16
|
i.push({
|
|
17
17
|
addOnGroupId: e.addonId,
|
|
@@ -30,13 +30,13 @@ function f(t) {
|
|
|
30
30
|
quantity: d.selectedCount,
|
|
31
31
|
freeAmount: d.freeAmount
|
|
32
32
|
});
|
|
33
|
-
}), (
|
|
33
|
+
}), (r = e.products) == null || r.forEach((d) => {
|
|
34
34
|
d.selectedCount && o.push({
|
|
35
35
|
variantId: d.selectedVariantId,
|
|
36
36
|
addOnGroupId: e.addonId,
|
|
37
37
|
quantity: d.selectedCount,
|
|
38
38
|
freeAmount: d.freeAmount,
|
|
39
|
-
unitQuantity:
|
|
39
|
+
unitQuantity: 1
|
|
40
40
|
});
|
|
41
41
|
});
|
|
42
42
|
}), {
|
|
@@ -45,7 +45,8 @@ function f(t) {
|
|
|
45
45
|
variantId: t.selectedVariantId,
|
|
46
46
|
showingPrice: t.selectedVariantShowingPrice,
|
|
47
47
|
addOnProducts: o,
|
|
48
|
-
|
|
48
|
+
upsellGroupId: null,
|
|
49
|
+
itemType: c.SaleProduct
|
|
49
50
|
// default type, this only changes for upsell items
|
|
50
51
|
};
|
|
51
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const i=require("./getCheckoutItemModifications.js");require("@ancon/wildcat-types");require("../currency/getFormattedCurrency.js");require("../currency/getFormattedCurrencyPostfix.js");function o(n){const{unitPrice:t,additionalPrice:e}=n.unitPriceInclTax;return{amount:t.amount+e.amount,currency:t.currency}}function r(n){return n.map(t=>({id:t.id,modificationText:i.getAddModificationText(t.product.name,t.quantity,t.addOnFreeAmount,o(t))}))}module.exports=r;
|
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
import { getAddModificationText as
|
|
1
|
+
import { getAddModificationText as i } from "./getCheckoutItemModifications.mjs";
|
|
2
2
|
import "@ancon/wildcat-types";
|
|
3
3
|
import "../currency/getFormattedCurrency.mjs";
|
|
4
4
|
import "../currency/getFormattedCurrencyPostfix.mjs";
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
function r(n) {
|
|
6
|
+
const { unitPrice: t, additionalPrice: o } = n.unitPriceInclTax;
|
|
7
|
+
return {
|
|
8
|
+
amount: t.amount + o.amount,
|
|
9
|
+
currency: t.currency
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function e(n) {
|
|
13
|
+
return n.map((t) => ({
|
|
14
|
+
id: t.id,
|
|
15
|
+
modificationText: i(
|
|
16
|
+
t.product.name,
|
|
17
|
+
t.quantity,
|
|
18
|
+
t.addOnFreeAmount,
|
|
19
|
+
r(t)
|
|
13
20
|
)
|
|
14
21
|
}));
|
|
15
22
|
}
|
|
16
23
|
export {
|
|
17
|
-
|
|
24
|
+
e as default
|
|
18
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const I=require("./isWalletTopUpCheckoutItem.js"),y=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(I(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(y(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,addOnGroupId:e.addOnGroupId,unitQuantity:1})))??[],upsellGroupId:c,itemType:p}}module.exports=i;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import y from "./isWalletTopUpCheckoutItem.mjs";
|
|
2
2
|
import i from "./isGiftCardCheckoutItem.mjs";
|
|
3
3
|
import "@ancon/wildcat-types";
|
|
4
4
|
function v(u, a) {
|
|
@@ -6,12 +6,12 @@ function v(u, a) {
|
|
|
6
6
|
product: r,
|
|
7
7
|
quantity: n,
|
|
8
8
|
modifications: l,
|
|
9
|
-
upsellGroupId:
|
|
10
|
-
totalPriceInclTax:
|
|
9
|
+
upsellGroupId: I,
|
|
10
|
+
totalPriceInclTax: s,
|
|
11
11
|
addOnProducts: p,
|
|
12
|
-
itemType:
|
|
12
|
+
itemType: d
|
|
13
13
|
} = u;
|
|
14
|
-
if (
|
|
14
|
+
if (y(u)) {
|
|
15
15
|
let e = null;
|
|
16
16
|
if (a) {
|
|
17
17
|
const t = a;
|
|
@@ -23,12 +23,12 @@ function v(u, a) {
|
|
|
23
23
|
return {
|
|
24
24
|
productType: r.productType,
|
|
25
25
|
variantType: r.variantType,
|
|
26
|
-
price: { unitPrice:
|
|
26
|
+
price: { unitPrice: s.amount },
|
|
27
27
|
metaData: e,
|
|
28
28
|
quantity: n,
|
|
29
29
|
modifications: [],
|
|
30
30
|
addOnProducts: [],
|
|
31
|
-
itemType:
|
|
31
|
+
itemType: d
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
if (i(u)) {
|
|
@@ -51,12 +51,12 @@ function v(u, a) {
|
|
|
51
51
|
return {
|
|
52
52
|
productType: r.productType,
|
|
53
53
|
variantType: r.variantType,
|
|
54
|
-
price: { unitPrice:
|
|
54
|
+
price: { unitPrice: s.amount },
|
|
55
55
|
metaData: e,
|
|
56
56
|
quantity: n,
|
|
57
57
|
modifications: [],
|
|
58
58
|
addOnProducts: [],
|
|
59
|
-
itemType:
|
|
59
|
+
itemType: d
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
return {
|
|
@@ -75,11 +75,11 @@ function v(u, a) {
|
|
|
75
75
|
quantity: e.quantity,
|
|
76
76
|
freeAmount: e.addOnFreeAmount,
|
|
77
77
|
variantId: e.product.variantId,
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
addOnGroupId: e.addOnGroupId,
|
|
79
|
+
unitQuantity: 1
|
|
80
80
|
}))) ?? [],
|
|
81
|
-
upsellGroupId:
|
|
82
|
-
itemType:
|
|
81
|
+
upsellGroupId: I,
|
|
82
|
+
itemType: d
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
85
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const e=require("../_baseIsEqual-ad544573.js");require("../_getTag-d4cd1660.js");require("../isObjectLike-963267e9.js");function n(r,d){return e.baseIsEqual(r,d)}function a(r){return Object.keys(r).forEach(d=>r[d]===void 0&&delete r[d]),r}function o(r,d){var u,s;return n({modifications:r.modifications.map(a),addOnProducts:((u=r.addOnProducts)==null?void 0:u.map(a))??[],variantId:r.variantId,upsellGroupId:r.upsellGroupId},{modifications:d.modifications.map(a),addOnProducts:((s=d.addOnProducts)==null?void 0:s.map(a))??[],variantId:d.variantId,upsellGroupId:d.upsellGroupId})}module.exports=o;
|
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import { b as
|
|
1
|
+
import { b as u } from "../_baseIsEqual-5e6adb07.mjs";
|
|
2
2
|
import "../_getTag-fcc5160b.mjs";
|
|
3
3
|
import "../isObjectLike-54341556.mjs";
|
|
4
|
-
function t(
|
|
5
|
-
return
|
|
4
|
+
function t(d, a) {
|
|
5
|
+
return u(d, a);
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
return Object.keys(
|
|
7
|
+
function r(d) {
|
|
8
|
+
return Object.keys(d).forEach((a) => d[a] === void 0 && delete d[a]), d;
|
|
9
9
|
}
|
|
10
|
-
function d
|
|
10
|
+
function p(d, a) {
|
|
11
|
+
var o, n;
|
|
11
12
|
return t(
|
|
12
13
|
{
|
|
13
|
-
modifications:
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
modifications: d.modifications.map(r),
|
|
15
|
+
addOnProducts: ((o = d.addOnProducts) == null ? void 0 : o.map(r)) ?? [],
|
|
16
|
+
variantId: d.variantId,
|
|
17
|
+
upsellGroupId: d.upsellGroupId
|
|
16
18
|
},
|
|
17
19
|
{
|
|
18
|
-
modifications: a.modifications.map(
|
|
20
|
+
modifications: a.modifications.map(r),
|
|
21
|
+
addOnProducts: ((n = a.addOnProducts) == null ? void 0 : n.map(r)) ?? [],
|
|
19
22
|
variantId: a.variantId,
|
|
20
23
|
upsellGroupId: a.upsellGroupId
|
|
21
24
|
}
|
|
22
25
|
);
|
|
23
26
|
}
|
|
24
27
|
export {
|
|
25
|
-
|
|
28
|
+
p as default
|
|
26
29
|
};
|
package/checkout/types.d.ts
CHANGED
|
@@ -28,4 +28,4 @@ export declare type CheckoutRequestItem = {
|
|
|
28
28
|
metaData?: string | null;
|
|
29
29
|
itemType?: CheckoutItemType;
|
|
30
30
|
};
|
|
31
|
-
export declare type CheckoutItemComparisonCandidate = Pick<CheckoutRequestItem, 'variantId' | 'modifications' | 'upsellGroupId'>;
|
|
31
|
+
export declare type CheckoutItemComparisonCandidate = Pick<CheckoutRequestItem, 'variantId' | 'modifications' | 'addOnProducts' | 'upsellGroupId'>;
|