@connectedxm/admin 6.1.9 → 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 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,
@@ -4046,15 +4049,69 @@ function MergeInfinitePages(data) {
4046
4049
  }
4047
4050
 
4048
4051
  // src/utilities/TransformPrice.ts
4049
- var TransformPrice = (value, currency) => {
4052
+ var ZERO_DECIMAL_CURRENCIES = [
4053
+ "BIF",
4054
+ // Burundian Franc
4055
+ "CLP",
4056
+ // Chilean Peso
4057
+ "DJF",
4058
+ // Djiboutian Franc
4059
+ "GNF",
4060
+ // Guinean Franc
4061
+ "JPY",
4062
+ // Japanese Yen
4063
+ "KMF",
4064
+ // Comorian Franc
4065
+ "KRW",
4066
+ // South Korean Won
4067
+ "MGA",
4068
+ // Malagasy Ariary
4069
+ "PYG",
4070
+ // Paraguayan Guaraní
4071
+ "RWF",
4072
+ // Rwandan Franc
4073
+ "UGX",
4074
+ // Ugandan Shilling
4075
+ "VND",
4076
+ // Vietnamese Dong
4077
+ "VUV",
4078
+ // Vanuatu Vatu
4079
+ "XAF",
4080
+ // Central African CFA Franc
4081
+ "XOF",
4082
+ // West African CFA Franc
4083
+ "XPF"
4084
+ // CFP Franc
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
+ };
4104
+ var TransformPrice = (value, currency, freeText) => {
4050
4105
  if (typeof value !== "number") return void 0;
4051
4106
  const formatter = new Intl.NumberFormat(void 0, {
4052
4107
  style: "currency",
4053
4108
  currency,
4054
- minimumFractionDigits: 2,
4109
+ minimumFractionDigits: isZeroDecimalCurrency(currency) ? 0 : 2,
4055
4110
  maximumFractionDigits: 2
4056
4111
  });
4057
- if (value === 0) return "--.--";
4112
+ if (value === 0) return freeText || "--.--";
4113
+ if (value < 0)
4114
+ return formatter.format(-value / 100).replace(currency, `-${currency}`);
4058
4115
  return formatter.format(value / 100);
4059
4116
  };
4060
4117
 
@@ -41656,7 +41713,10 @@ var useUploadVideoCaptions = (options = {}) => {
41656
41713
  VoidInvoice,
41657
41714
  WidgetCategory,
41658
41715
  WidgetType,
41716
+ ZERO_DECIMAL_CURRENCIES,
41717
+ getCurrencySymbol,
41659
41718
  isUUID,
41719
+ isZeroDecimalCurrency,
41660
41720
  setFirstPageData,
41661
41721
  useAcceptGroupRequest,
41662
41722
  useAddAccountFollower,