@agrada_digital/pbm 0.0.116 → 0.0.117

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/dist/index.d.ts CHANGED
@@ -45,18 +45,18 @@ interface usePBMTypes {
45
45
  cardID?: string | number;
46
46
  }
47
47
  interface TargetProduct {
48
- id: number;
49
- ean: number;
50
- requestedQuantity: number;
51
- listPrice: number;
52
- netPrice: number;
48
+ id: string;
49
+ ean: string;
50
+ requestedQuantity: string;
51
+ listPrice: string;
52
+ netPrice: string;
53
53
  }
54
54
  interface IProduct {
55
- id: number;
56
- ean: number;
57
- listPrice: number;
58
- netPrice: number;
59
- authorizedQuantity: number;
55
+ id: string;
56
+ ean: string;
57
+ listPrice: string;
58
+ netPrice: string;
59
+ authorizedQuantity: string;
60
60
  discountValue: string;
61
61
  suggestedPriceValue: string;
62
62
  discountPercentual: string;
package/dist/index.js CHANGED
@@ -119,10 +119,14 @@ var transformPorcent = (porcent) => {
119
119
  const pre = porcent.slice(0, -2) || "0";
120
120
  return Number(`${pre}.${post}`);
121
121
  };
122
+ function priceToInteger(value) {
123
+ return value.replace(/[.,]/g, "");
124
+ }
122
125
  var formaters = {
123
126
  phone: (value) => formatPhone(value),
124
127
  cep: (value) => formatCEP(value),
125
128
  cpf: (value) => maskCPF(value),
129
+ priceToInteger: (value) => priceToInteger(value),
126
130
  price: (price) => formatPrice(price),
127
131
  transformPrice: (price) => transformPrice(price),
128
132
  transformPorcent: (porcent) => transformPorcent(porcent)
@@ -2661,9 +2665,9 @@ var useAppStartup = (props) => {
2661
2665
  }
2662
2666
  setTargetProduct({
2663
2667
  ...response.product[0],
2664
- requestedQuantity: 1,
2665
- listPrice: props.target_product.listPrice,
2666
- netPrice: props.target_product.netPrice
2668
+ requestedQuantity: "1",
2669
+ listPrice: formaters.priceToInteger(props.target_product.listPrice),
2670
+ netPrice: formaters.priceToInteger(props.target_product.netPrice)
2667
2671
  });
2668
2672
  setBenefitsList(
2669
2673
  response.product.map((prod) => ({