kupos-ui-components-lib 10.4.52 → 10.4.53

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.
@@ -470,12 +470,11 @@ const PaymentSideBarDesktop = ({ serviceNameOnward, serviceNameReturn, metaData,
470
470
  justifyContent: "flex-end",
471
471
  } },
472
472
  currency ? currency : "",
473
- " ",
474
- CommonService.currency(isPeru
473
+ CommonService.currencyExact(isPeru
475
474
  ? Math.round((removeDiscountAtomValue ? 0 : netFare) * 100) /
476
475
  100
477
476
  : removeDiscountAtomValue
478
477
  ? 0
479
- : netFare, currencySign)))))));
478
+ : netFare)))))));
480
479
  };
481
480
  export default PaymentSideBarDesktop;
@@ -1,5 +1,6 @@
1
1
  declare const commonService: {
2
2
  currency(amount: number, currencySign?: string): string;
3
+ currencyExact: (amount: any) => string;
3
4
  currencyFixed(amount: number, currencySign?: string, decimals?: number): string;
4
5
  currencyRounded(amount: number, currencySign?: string): string;
5
6
  discountedCurrency(amount: number, currencySign?: string): string;
@@ -13,6 +13,14 @@ const commonService = {
13
13
  const sign = currencySign || "$";
14
14
  return sign + formattedAmount;
15
15
  },
16
+ currencyExact: (amount) => {
17
+ if (amount === null || amount === undefined || isNaN(amount))
18
+ return "S/0";
19
+ const rounded = Math.round(+amount * 100) / 100;
20
+ const parts = String(rounded).split(".");
21
+ parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".");
22
+ return "S/" + parts.join(".");
23
+ },
16
24
  currencyFixed(amount, currencySign, decimals = 2) {
17
25
  const formattedAmount = fixFloatPrecision(amount, decimals)
18
26
  .toString()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kupos-ui-components-lib",
3
- "version": "10.4.52",
3
+ "version": "10.4.53",
4
4
  "description": "A reusable UI components package",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -914,15 +914,15 @@ const PaymentSideBarDesktop: React.FC<PaymentSideBarProps> = ({
914
914
  justifyContent: "flex-end",
915
915
  }}
916
916
  >
917
- {currency ? currency : ""}{" "}
918
- {CommonService.currency(
917
+ {currency ? currency : ""}
918
+
919
+ {CommonService.currencyExact(
919
920
  isPeru
920
921
  ? Math.round((removeDiscountAtomValue ? 0 : netFare) * 100) /
921
922
  100
922
923
  : removeDiscountAtomValue
923
924
  ? 0
924
925
  : netFare,
925
- currencySign,
926
926
  )}
927
927
  </div>
928
928
  </div>
@@ -16,6 +16,14 @@ const commonService = {
16
16
  return sign + formattedAmount;
17
17
  },
18
18
 
19
+ currencyExact: (amount) => {
20
+ if (amount === null || amount === undefined || isNaN(amount)) return "S/0";
21
+ const rounded = Math.round(+amount * 100) / 100;
22
+ const parts = String(rounded).split(".");
23
+ parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".");
24
+ return "S/" + parts.join(".");
25
+ },
26
+
19
27
  currencyFixed(amount: number, currencySign?: string, decimals: number = 2) {
20
28
  const formattedAmount = fixFloatPrecision(amount, decimals)
21
29
  .toString()