@unifold/connect-react 0.1.13 → 0.1.14

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.js CHANGED
@@ -10863,9 +10863,24 @@ function DepositDetailContent({ execution }) {
10863
10863
  }
10864
10864
  };
10865
10865
  const formatAmount = (baseUnitAmount, decimals = 6) => {
10866
+ if (!baseUnitAmount) return "\u2014";
10866
10867
  try {
10867
- const amount = Number(baseUnitAmount) / Math.pow(10, decimals);
10868
- return amount.toFixed(2);
10868
+ const value = Number(baseUnitAmount) / Math.pow(10, decimals);
10869
+ if (value === 0) {
10870
+ return "0.00";
10871
+ }
10872
+ if (value >= 1) {
10873
+ return value.toLocaleString("en-US", {
10874
+ minimumFractionDigits: 2,
10875
+ maximumFractionDigits: 2
10876
+ });
10877
+ }
10878
+ return value.toLocaleString("en-US", {
10879
+ minimumFractionDigits: 2,
10880
+ maximumFractionDigits: 8,
10881
+ minimumSignificantDigits: 2,
10882
+ maximumSignificantDigits: 6
10883
+ });
10869
10884
  } catch {
10870
10885
  return "0.00";
10871
10886
  }
@@ -10971,7 +10986,7 @@ function DepositDetailContent({ execution }) {
10971
10986
  /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "uf-flex uf-justify-between uf-items-center uf-px-4 uf-py-3 uf-border-b uf-border-border/50", children: [
10972
10987
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "uf-text-muted-foreground uf-text-sm", children: "Amount Sent" }),
10973
10988
  /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "uf-text-foreground uf-font-medium", children: [
10974
- formatAmount(execution.source_amount_base_unit),
10989
+ formatAmount(execution.source_amount_base_unit, execution.source_token_metadata?.decimals),
10975
10990
  " ",
10976
10991
  formatCurrency(execution.source_currency)
10977
10992
  ] })
@@ -10979,7 +10994,7 @@ function DepositDetailContent({ execution }) {
10979
10994
  /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "uf-flex uf-justify-between uf-items-center uf-px-4 uf-py-3 uf-border-b uf-border-border/50", children: [
10980
10995
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "uf-text-muted-foreground uf-text-sm", children: "Amount Received" }),
10981
10996
  /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "uf-text-foreground uf-font-medium", children: [
10982
- formatAmount(execution.destination_amount_base_unit),
10997
+ formatAmount(execution.destination_amount_base_unit, execution.destination_token_metadata?.decimals),
10983
10998
  " ",
10984
10999
  formatCurrency(execution.destination_currency)
10985
11000
  ] })
package/dist/index.mjs CHANGED
@@ -10840,9 +10840,24 @@ function DepositDetailContent({ execution }) {
10840
10840
  }
10841
10841
  };
10842
10842
  const formatAmount = (baseUnitAmount, decimals = 6) => {
10843
+ if (!baseUnitAmount) return "\u2014";
10843
10844
  try {
10844
- const amount = Number(baseUnitAmount) / Math.pow(10, decimals);
10845
- return amount.toFixed(2);
10845
+ const value = Number(baseUnitAmount) / Math.pow(10, decimals);
10846
+ if (value === 0) {
10847
+ return "0.00";
10848
+ }
10849
+ if (value >= 1) {
10850
+ return value.toLocaleString("en-US", {
10851
+ minimumFractionDigits: 2,
10852
+ maximumFractionDigits: 2
10853
+ });
10854
+ }
10855
+ return value.toLocaleString("en-US", {
10856
+ minimumFractionDigits: 2,
10857
+ maximumFractionDigits: 8,
10858
+ minimumSignificantDigits: 2,
10859
+ maximumSignificantDigits: 6
10860
+ });
10846
10861
  } catch {
10847
10862
  return "0.00";
10848
10863
  }
@@ -10948,7 +10963,7 @@ function DepositDetailContent({ execution }) {
10948
10963
  /* @__PURE__ */ jsxs42("div", { className: "uf-flex uf-justify-between uf-items-center uf-px-4 uf-py-3 uf-border-b uf-border-border/50", children: [
10949
10964
  /* @__PURE__ */ jsx62("span", { className: "uf-text-muted-foreground uf-text-sm", children: "Amount Sent" }),
10950
10965
  /* @__PURE__ */ jsxs42("span", { className: "uf-text-foreground uf-font-medium", children: [
10951
- formatAmount(execution.source_amount_base_unit),
10966
+ formatAmount(execution.source_amount_base_unit, execution.source_token_metadata?.decimals),
10952
10967
  " ",
10953
10968
  formatCurrency(execution.source_currency)
10954
10969
  ] })
@@ -10956,7 +10971,7 @@ function DepositDetailContent({ execution }) {
10956
10971
  /* @__PURE__ */ jsxs42("div", { className: "uf-flex uf-justify-between uf-items-center uf-px-4 uf-py-3 uf-border-b uf-border-border/50", children: [
10957
10972
  /* @__PURE__ */ jsx62("span", { className: "uf-text-muted-foreground uf-text-sm", children: "Amount Received" }),
10958
10973
  /* @__PURE__ */ jsxs42("span", { className: "uf-text-foreground uf-font-medium", children: [
10959
- formatAmount(execution.destination_amount_base_unit),
10974
+ formatAmount(execution.destination_amount_base_unit, execution.destination_token_metadata?.decimals),
10960
10975
  " ",
10961
10976
  formatCurrency(execution.destination_currency)
10962
10977
  ] })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unifold/connect-react",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Unifold Connect React - Complete React SDK with UI components for crypto deposits",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -24,9 +24,9 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@tanstack/react-query": "^5.62.15",
27
- "@unifold/core": "0.1.13",
28
- "@unifold/react-provider": "0.1.13",
29
- "@unifold/ui-react": "0.1.13"
27
+ "@unifold/core": "0.1.14",
28
+ "@unifold/react-provider": "0.1.14",
29
+ "@unifold/ui-react": "0.1.14"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/react": "^19.0.0",