@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.cjs
CHANGED
|
@@ -2152,7 +2152,10 @@ __export(index_exports, {
|
|
|
2152
2152
|
VoidInvoice: () => VoidInvoice,
|
|
2153
2153
|
WidgetCategory: () => WidgetCategory,
|
|
2154
2154
|
WidgetType: () => WidgetType,
|
|
2155
|
+
ZERO_DECIMAL_CURRENCIES: () => ZERO_DECIMAL_CURRENCIES,
|
|
2156
|
+
getCurrencySymbol: () => getCurrencySymbol,
|
|
2155
2157
|
isUUID: () => isUUID,
|
|
2158
|
+
isZeroDecimalCurrency: () => isZeroDecimalCurrency,
|
|
2156
2159
|
setFirstPageData: () => setFirstPageData,
|
|
2157
2160
|
useAcceptGroupRequest: () => useAcceptGroupRequest,
|
|
2158
2161
|
useAddAccountFollower: () => useAddAccountFollower,
|
|
@@ -4080,15 +4083,30 @@ var ZERO_DECIMAL_CURRENCIES = [
|
|
|
4080
4083
|
"XPF"
|
|
4081
4084
|
// CFP Franc
|
|
4082
4085
|
];
|
|
4086
|
+
var isZeroDecimalCurrency = (currencyCode) => {
|
|
4087
|
+
return ZERO_DECIMAL_CURRENCIES.includes(currencyCode.toUpperCase());
|
|
4088
|
+
};
|
|
4089
|
+
var getCurrencySymbol = (currencyCode) => {
|
|
4090
|
+
try {
|
|
4091
|
+
const formatter = new Intl.NumberFormat("en-US", {
|
|
4092
|
+
style: "currency",
|
|
4093
|
+
currency: currencyCode,
|
|
4094
|
+
minimumFractionDigits: 0,
|
|
4095
|
+
maximumFractionDigits: 0
|
|
4096
|
+
});
|
|
4097
|
+
const parts = formatter.formatToParts(0);
|
|
4098
|
+
const symbolPart = parts.find((part) => part.type === "currency");
|
|
4099
|
+
return symbolPart?.value || currencyCode;
|
|
4100
|
+
} catch {
|
|
4101
|
+
return currencyCode;
|
|
4102
|
+
}
|
|
4103
|
+
};
|
|
4083
4104
|
var TransformPrice = (value, currency, freeText) => {
|
|
4084
4105
|
if (typeof value !== "number") return void 0;
|
|
4085
|
-
const isZeroDecimal = ZERO_DECIMAL_CURRENCIES.includes(
|
|
4086
|
-
currency.toUpperCase()
|
|
4087
|
-
);
|
|
4088
4106
|
const formatter = new Intl.NumberFormat(void 0, {
|
|
4089
4107
|
style: "currency",
|
|
4090
4108
|
currency,
|
|
4091
|
-
minimumFractionDigits:
|
|
4109
|
+
minimumFractionDigits: isZeroDecimalCurrency(currency) ? 0 : 2,
|
|
4092
4110
|
maximumFractionDigits: 2
|
|
4093
4111
|
});
|
|
4094
4112
|
if (value === 0) return freeText || "--.--";
|
|
@@ -41695,7 +41713,10 @@ var useUploadVideoCaptions = (options = {}) => {
|
|
|
41695
41713
|
VoidInvoice,
|
|
41696
41714
|
WidgetCategory,
|
|
41697
41715
|
WidgetType,
|
|
41716
|
+
ZERO_DECIMAL_CURRENCIES,
|
|
41717
|
+
getCurrencySymbol,
|
|
41698
41718
|
isUUID,
|
|
41719
|
+
isZeroDecimalCurrency,
|
|
41699
41720
|
setFirstPageData,
|
|
41700
41721
|
useAcceptGroupRequest,
|
|
41701
41722
|
useAddAccountFollower,
|