@ancon/wildcat-utils 1.52.1 → 1.52.3
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/getCheckoutRequestItemFromCheckoutItem.d.ts +1 -1
- package/checkout/getCheckoutRequestItemFromCheckoutItem.js +1 -1
- package/checkout/getCheckoutRequestItemFromCheckoutItem.mjs +15 -12
- package/package.json +1 -1
- package/string/base64Encode.d.ts +1 -1
- package/string/base64Encode.js +1 -1
- package/string/base64Encode.mjs +4 -4
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CheckoutItem, CheckoutMetaDataItemData } from '@ancon/wildcat-types';
|
|
2
2
|
import { CheckoutRequestItem } from './types';
|
|
3
|
-
export default function getCheckoutRequestItemFromCheckoutItem(item: CheckoutItem, meta?: CheckoutMetaDataItemData): CheckoutRequestItem;
|
|
3
|
+
export default function getCheckoutRequestItemFromCheckoutItem(item: CheckoutItem, meta?: CheckoutMetaDataItemData, v2?: boolean): CheckoutRequestItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const y=require("./isWalletTopUpCheckoutItem.js"),g=require("./isGiftCardCheckoutItem.js");require("@ancon/wildcat-types");function v(u,a,l){const{product:r,quantity:n,modifications:c,upsellGroupId:I,totalPriceInclTax:d,addOnProducts:s,itemType:p,unitPriceInclTax:i}=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(g(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:l?i.unitPrice.amount:d.amount},metaData:e,quantity:n,modifications:[],addOnProducts:[],itemType:p}}return{variantId:r.variantId,quantity:n,modifications:c.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:I,itemType:p}}module.exports=v;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import c from "./isWalletTopUpCheckoutItem.mjs";
|
|
2
|
+
import g from "./isGiftCardCheckoutItem.mjs";
|
|
3
3
|
import "@ancon/wildcat-types";
|
|
4
|
-
function
|
|
4
|
+
function o(u, a, l) {
|
|
5
5
|
const {
|
|
6
6
|
product: r,
|
|
7
7
|
quantity: n,
|
|
8
|
-
modifications:
|
|
9
|
-
upsellGroupId:
|
|
8
|
+
modifications: I,
|
|
9
|
+
upsellGroupId: i,
|
|
10
10
|
totalPriceInclTax: s,
|
|
11
11
|
addOnProducts: p,
|
|
12
|
-
itemType: d
|
|
12
|
+
itemType: d,
|
|
13
|
+
unitPriceInclTax: y
|
|
13
14
|
} = u;
|
|
14
|
-
if (
|
|
15
|
+
if (c(u)) {
|
|
15
16
|
let e = null;
|
|
16
17
|
if (a) {
|
|
17
18
|
const t = a;
|
|
@@ -31,7 +32,7 @@ function v(u, a) {
|
|
|
31
32
|
itemType: d
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
|
-
if (
|
|
35
|
+
if (g(u)) {
|
|
35
36
|
let e = null;
|
|
36
37
|
if (a) {
|
|
37
38
|
const t = a;
|
|
@@ -51,7 +52,9 @@ function v(u, a) {
|
|
|
51
52
|
return {
|
|
52
53
|
productType: r.productType,
|
|
53
54
|
variantType: r.variantType,
|
|
54
|
-
price: {
|
|
55
|
+
price: {
|
|
56
|
+
unitPrice: l ? y.unitPrice.amount : s.amount
|
|
57
|
+
},
|
|
55
58
|
metaData: e,
|
|
56
59
|
quantity: n,
|
|
57
60
|
modifications: [],
|
|
@@ -62,7 +65,7 @@ function v(u, a) {
|
|
|
62
65
|
return {
|
|
63
66
|
variantId: r.variantId,
|
|
64
67
|
quantity: n,
|
|
65
|
-
modifications:
|
|
68
|
+
modifications: I.map((e) => ({
|
|
66
69
|
modification: e.modification,
|
|
67
70
|
ingredientId: e.ingredientId,
|
|
68
71
|
quantity: e == null ? void 0 : e.quantity,
|
|
@@ -78,10 +81,10 @@ function v(u, a) {
|
|
|
78
81
|
addOnGroupId: e.addOnGroupId,
|
|
79
82
|
unitQuantity: 1
|
|
80
83
|
}))) ?? [],
|
|
81
|
-
upsellGroupId:
|
|
84
|
+
upsellGroupId: i,
|
|
82
85
|
itemType: d
|
|
83
86
|
};
|
|
84
87
|
}
|
|
85
88
|
export {
|
|
86
|
-
|
|
89
|
+
o as default
|
|
87
90
|
};
|
package/package.json
CHANGED
package/string/base64Encode.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function base64Encode(str: string): string;
|
|
1
|
+
export default function base64Encode(str: string, urlSafe?: boolean): string;
|
package/string/base64Encode.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function
|
|
1
|
+
"use strict";function c(n,t=!1){const r=new TextEncoder().encode(n),o=String.fromCodePoint(...r),e=btoa(o);return t?e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):e}module.exports=c;
|
package/string/base64Encode.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
function
|
|
2
|
-
const
|
|
3
|
-
return
|
|
1
|
+
function c(n, t = !1) {
|
|
2
|
+
const o = new TextEncoder().encode(n), r = String.fromCodePoint(...o), e = btoa(r);
|
|
3
|
+
return t ? e.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "") : e;
|
|
4
4
|
}
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
c as default
|
|
7
7
|
};
|