@connectedxm/admin 2.2.2 → 2.2.3

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
@@ -18546,18 +18546,18 @@ function MergeInfinitePages(data) {
18546
18546
  }
18547
18547
 
18548
18548
  // src/utilities/TransformPrice.ts
18549
- var TransformPrice = (value, withDollar = false, freeText = "FREE") => {
18549
+ var TransformPrice = (value, currency) => {
18550
18550
  if (typeof value !== "number") return void 0;
18551
- const dollarUSLocale = Intl.NumberFormat("en-US", {
18551
+ const formatter = new Intl.NumberFormat(void 0, {
18552
+ style: "currency",
18553
+ currency,
18552
18554
  minimumFractionDigits: 2,
18553
18555
  maximumFractionDigits: 2
18554
18556
  });
18555
- if (value === 0) return freeText;
18556
- if (withDollar) {
18557
- return "$" + dollarUSLocale.format(value / 100);
18558
- } else {
18559
- return dollarUSLocale.format(value / 100);
18560
- }
18557
+ if (value === 0) return "--.--";
18558
+ if (value < 0)
18559
+ return formatter.format(-value / 100).replace(currency, `-${currency}`);
18560
+ return formatter.format(value / 100);
18561
18561
  };
18562
18562
 
18563
18563
  // src/queries/threads/useGetThreadMessages.ts
package/dist/index.d.cts CHANGED
@@ -1313,6 +1313,7 @@ interface BaseOrganization {
1313
1313
  icon: BaseImage | null;
1314
1314
  domain: string | null;
1315
1315
  locale: string;
1316
+ currency: string;
1316
1317
  }
1317
1318
  interface Organization extends BaseOrganization {
1318
1319
  email: string | null;
@@ -1326,7 +1327,6 @@ interface Organization extends BaseOrganization {
1326
1327
  zip: string | null;
1327
1328
  primaryColor: string | null;
1328
1329
  secondaryColor: string | null;
1329
- currency: string | null;
1330
1330
  facebook: string | null;
1331
1331
  twitter: string | null;
1332
1332
  instagram: string | null;
@@ -5070,7 +5070,7 @@ declare const isUUID: (id: string) => boolean;
5070
5070
 
5071
5071
  declare function MergeInfinitePages<TData>(data: InfiniteData<ConnectedXMResponse<TData[]>>): TData[];
5072
5072
 
5073
- declare const TransformPrice: (value: number, withDollar?: boolean, freeText?: string) => string | undefined;
5073
+ declare const TransformPrice: (value: number, currency: string) => string | undefined;
5074
5074
 
5075
5075
  interface AdminApiParams {
5076
5076
  apiUrl: "https://admin-api.connected.dev" | "https://staging-admin-api.connected.dev" | "http://localhost:4001";
package/dist/index.d.ts CHANGED
@@ -1313,6 +1313,7 @@ interface BaseOrganization {
1313
1313
  icon: BaseImage | null;
1314
1314
  domain: string | null;
1315
1315
  locale: string;
1316
+ currency: string;
1316
1317
  }
1317
1318
  interface Organization extends BaseOrganization {
1318
1319
  email: string | null;
@@ -1326,7 +1327,6 @@ interface Organization extends BaseOrganization {
1326
1327
  zip: string | null;
1327
1328
  primaryColor: string | null;
1328
1329
  secondaryColor: string | null;
1329
- currency: string | null;
1330
1330
  facebook: string | null;
1331
1331
  twitter: string | null;
1332
1332
  instagram: string | null;
@@ -5070,7 +5070,7 @@ declare const isUUID: (id: string) => boolean;
5070
5070
 
5071
5071
  declare function MergeInfinitePages<TData>(data: InfiniteData<ConnectedXMResponse<TData[]>>): TData[];
5072
5072
 
5073
- declare const TransformPrice: (value: number, withDollar?: boolean, freeText?: string) => string | undefined;
5073
+ declare const TransformPrice: (value: number, currency: string) => string | undefined;
5074
5074
 
5075
5075
  interface AdminApiParams {
5076
5076
  apiUrl: "https://admin-api.connected.dev" | "https://staging-admin-api.connected.dev" | "http://localhost:4001";
package/dist/index.js CHANGED
@@ -15843,18 +15843,18 @@ function MergeInfinitePages(data) {
15843
15843
  }
15844
15844
 
15845
15845
  // src/utilities/TransformPrice.ts
15846
- var TransformPrice = (value, withDollar = false, freeText = "FREE") => {
15846
+ var TransformPrice = (value, currency) => {
15847
15847
  if (typeof value !== "number") return void 0;
15848
- const dollarUSLocale = Intl.NumberFormat("en-US", {
15848
+ const formatter = new Intl.NumberFormat(void 0, {
15849
+ style: "currency",
15850
+ currency,
15849
15851
  minimumFractionDigits: 2,
15850
15852
  maximumFractionDigits: 2
15851
15853
  });
15852
- if (value === 0) return freeText;
15853
- if (withDollar) {
15854
- return "$" + dollarUSLocale.format(value / 100);
15855
- } else {
15856
- return dollarUSLocale.format(value / 100);
15857
- }
15854
+ if (value === 0) return "--.--";
15855
+ if (value < 0)
15856
+ return formatter.format(-value / 100).replace(currency, `-${currency}`);
15857
+ return formatter.format(value / 100);
15858
15858
  };
15859
15859
 
15860
15860
  // src/queries/threads/useGetThreadMessages.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@connectedxm/admin",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "Admin API javascript SDK",
5
5
  "author": "ConnectedXM Inc.",
6
6
  "type": "module",