@connectedxm/admin 6.1.10 → 6.1.11
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.cjs +25 -4
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +22 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -816,15 +816,30 @@ var ZERO_DECIMAL_CURRENCIES = [
|
|
|
816
816
|
"XPF"
|
|
817
817
|
// CFP Franc
|
|
818
818
|
];
|
|
819
|
+
var isZeroDecimalCurrency = (currencyCode) => {
|
|
820
|
+
return ZERO_DECIMAL_CURRENCIES.includes(currencyCode.toUpperCase());
|
|
821
|
+
};
|
|
822
|
+
var getCurrencySymbol = (currencyCode) => {
|
|
823
|
+
try {
|
|
824
|
+
const formatter = new Intl.NumberFormat("en-US", {
|
|
825
|
+
style: "currency",
|
|
826
|
+
currency: currencyCode,
|
|
827
|
+
minimumFractionDigits: 0,
|
|
828
|
+
maximumFractionDigits: 0
|
|
829
|
+
});
|
|
830
|
+
const parts = formatter.formatToParts(0);
|
|
831
|
+
const symbolPart = parts.find((part) => part.type === "currency");
|
|
832
|
+
return symbolPart?.value || currencyCode;
|
|
833
|
+
} catch {
|
|
834
|
+
return currencyCode;
|
|
835
|
+
}
|
|
836
|
+
};
|
|
819
837
|
var TransformPrice = (value, currency, freeText) => {
|
|
820
838
|
if (typeof value !== "number") return void 0;
|
|
821
|
-
const isZeroDecimal = ZERO_DECIMAL_CURRENCIES.includes(
|
|
822
|
-
currency.toUpperCase()
|
|
823
|
-
);
|
|
824
839
|
const formatter = new Intl.NumberFormat(void 0, {
|
|
825
840
|
style: "currency",
|
|
826
841
|
currency,
|
|
827
|
-
minimumFractionDigits:
|
|
842
|
+
minimumFractionDigits: isZeroDecimalCurrency(currency) ? 0 : 2,
|
|
828
843
|
maximumFractionDigits: 2
|
|
829
844
|
});
|
|
830
845
|
if (value === 0) return freeText || "--.--";
|
|
@@ -38437,7 +38452,10 @@ export {
|
|
|
38437
38452
|
VoidInvoice,
|
|
38438
38453
|
WidgetCategory,
|
|
38439
38454
|
WidgetType,
|
|
38455
|
+
ZERO_DECIMAL_CURRENCIES,
|
|
38456
|
+
getCurrencySymbol,
|
|
38440
38457
|
isUUID,
|
|
38458
|
+
isZeroDecimalCurrency,
|
|
38441
38459
|
setFirstPageData,
|
|
38442
38460
|
useAcceptGroupRequest,
|
|
38443
38461
|
useAddAccountFollower,
|