@ancon/wildcat-utils 1.52.0 → 1.52.2

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,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 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
+ "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 y from "./isWalletTopUpCheckoutItem.mjs";
2
- import i from "./isGiftCardCheckoutItem.mjs";
1
+ import c from "./isWalletTopUpCheckoutItem.mjs";
2
+ import g from "./isGiftCardCheckoutItem.mjs";
3
3
  import "@ancon/wildcat-types";
4
- function v(u, a) {
4
+ function o(u, a, l) {
5
5
  const {
6
6
  product: r,
7
7
  quantity: n,
8
- modifications: l,
9
- upsellGroupId: I,
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 (y(u)) {
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 (i(u)) {
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: { unitPrice: s.amount },
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: l.map((e) => ({
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: I,
84
+ upsellGroupId: i,
82
85
  itemType: d
83
86
  };
84
87
  }
85
88
  export {
86
- v as default
89
+ o as default
87
90
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ancon/wildcat-utils",
3
- "version": "1.52.0",
3
+ "version": "1.52.2",
4
4
  "main": "index.js",
5
5
  "module": "index.mjs",
6
6
  "types": "index.d.ts",
@@ -1 +1 @@
1
- "use strict";function n(e){const t=atob(e),r=Uint8Array.from(t,o=>o.charCodeAt(0));return new TextDecoder().decode(r)}module.exports=n;
1
+ "use strict";function e(r){const o=atob(r),n=Uint8Array.from(o,t=>t.charCodeAt(0));return decodeURIComponent(Array.from(n).map(t=>`%${t.toString(16).padStart(2,"0")}`).join(""))}module.exports=e;
@@ -1,7 +1,9 @@
1
- function n(e) {
2
- const t = atob(e), o = Uint8Array.from(t, (r) => r.charCodeAt(0));
3
- return new TextDecoder().decode(o);
1
+ function a(o) {
2
+ const r = atob(o), n = Uint8Array.from(r, (t) => t.charCodeAt(0));
3
+ return decodeURIComponent(
4
+ Array.from(n).map((t) => `%${t.toString(16).padStart(2, "0")}`).join("")
5
+ );
4
6
  }
5
7
  export {
6
- n as default
8
+ a as default
7
9
  };