@odynn/awayz-core 0.10.23 → 0.10.26
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/cashUtils-DyxlHnod.js +41 -0
- package/dist/components/CashValue/CashValue.js +67 -54
- package/dist/hooks/useAwayzAuth/useAwayzAuth.js +1 -1
- package/dist/hooks/useWallet/useWallet.js +66 -62
- package/dist/lib/components/CashValue/CashValue.d.ts +8 -2
- package/package.json +1 -1
- package/dist/cashUtils-Dlce3Uj_.js +0 -40
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsxs as i, Fragment as m, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
const a = "USD", l = (r, t) => {
|
|
3
|
+
const n = t || a, e = new Intl.NumberFormat("en-US");
|
|
4
|
+
if (!r) return `${e.format(0)}${n}`;
|
|
5
|
+
const o = parseFloat(r.toString());
|
|
6
|
+
return /* @__PURE__ */ i(m, { children: [
|
|
7
|
+
e.format(isNaN(o) ? 0 : o),
|
|
8
|
+
" ",
|
|
9
|
+
/* @__PURE__ */ c("sub", { children: n })
|
|
10
|
+
] });
|
|
11
|
+
}, F = (r, t) => {
|
|
12
|
+
const n = t || a, e = new Intl.NumberFormat("en-US", {
|
|
13
|
+
maximumFractionDigits: 0
|
|
14
|
+
});
|
|
15
|
+
return /* @__PURE__ */ i(m, { children: [
|
|
16
|
+
e.format(isNaN(r) ? 0 : r),
|
|
17
|
+
" ",
|
|
18
|
+
/* @__PURE__ */ c("sub", { children: n })
|
|
19
|
+
] });
|
|
20
|
+
}, y = (r, t, n = 0, e = n) => {
|
|
21
|
+
const o = parseFloat((r == null ? void 0 : r.toString()) || "0"), s = t || a, u = new Intl.NumberFormat("en-US", {
|
|
22
|
+
minimumFractionDigits: e,
|
|
23
|
+
maximumFractionDigits: n
|
|
24
|
+
});
|
|
25
|
+
return /* @__PURE__ */ i(m, { children: [
|
|
26
|
+
u.format(isNaN(o) ? 0 : o),
|
|
27
|
+
" ",
|
|
28
|
+
/* @__PURE__ */ c("sub", { children: s })
|
|
29
|
+
] });
|
|
30
|
+
}, N = (r, t = "en") => 0 .toLocaleString(t, {
|
|
31
|
+
style: "currency",
|
|
32
|
+
currency: r,
|
|
33
|
+
minimumFractionDigits: 0,
|
|
34
|
+
maximumFractionDigits: 0
|
|
35
|
+
}).replace(/\d/g, "").trim();
|
|
36
|
+
export {
|
|
37
|
+
F as a,
|
|
38
|
+
l as b,
|
|
39
|
+
N as c,
|
|
40
|
+
y as g
|
|
41
|
+
};
|
|
@@ -1,56 +1,62 @@
|
|
|
1
1
|
import { jsx as r, jsxs as l } from "react/jsx-runtime";
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { g as
|
|
2
|
+
import { useQuery as _ } from "@tanstack/react-query";
|
|
3
|
+
import { g as u, a as S, b as f } from "../../cashUtils-DyxlHnod.js";
|
|
4
4
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
5
|
-
import { E as
|
|
6
|
-
import { useMemo as
|
|
7
|
-
import { a as
|
|
5
|
+
import { E as T } from "../../noRetryInstance-DNLgOg0E.js";
|
|
6
|
+
import { useMemo as I } from "react";
|
|
7
|
+
import { a as v } from "../../index-C8p5kinH.js";
|
|
8
8
|
import "react-i18next";
|
|
9
9
|
import '../../assets/_styles4.css';import '../../assets/_styles2.css';import '../../assets/_styles.css';import '../../assets/_styles3.css';/* empty css */
|
|
10
10
|
/* empty css */
|
|
11
11
|
/* empty css */
|
|
12
|
-
import { EInvalidAmountDisplayOption as t, EToolTipPosition as
|
|
13
|
-
import { useAwayzContext as
|
|
12
|
+
import { EInvalidAmountDisplayOption as t, EToolTipPosition as M } from "./CashValueTypes.js";
|
|
13
|
+
import { useAwayzContext as O } from "../../hooks/useAwayzContext.js";
|
|
14
14
|
import "../../configs/awayzClient.js";
|
|
15
15
|
/* empty css */
|
|
16
16
|
import "../../context/AwayzContext.js";
|
|
17
|
-
import { CurrencyService as
|
|
18
|
-
import { Tooltip as
|
|
19
|
-
const
|
|
17
|
+
import { CurrencyService as x } from "../../services/currency/CurrencyService.js";
|
|
18
|
+
import { Tooltip as D } from "../Tooltip/Tooltip.js";
|
|
19
|
+
const Y = 1e3 * 60 * 60, J = ({
|
|
20
20
|
amount: i,
|
|
21
21
|
currency: e,
|
|
22
|
-
position:
|
|
23
|
-
zeroDisplayOption:
|
|
24
|
-
customDisplay:
|
|
25
|
-
decimalPlaces:
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
position: A = M.RIGHT,
|
|
23
|
+
zeroDisplayOption: y = t.NA,
|
|
24
|
+
customDisplay: g,
|
|
25
|
+
decimalPlaces: s = 2,
|
|
26
|
+
minDecimalPlaces: d = s,
|
|
27
|
+
showConversion: E = !1,
|
|
28
|
+
showOriginal: R = !0
|
|
28
29
|
}) => {
|
|
29
|
-
var
|
|
30
|
-
const { user: o } =
|
|
31
|
-
queryKey: [
|
|
32
|
-
queryFn: () =>
|
|
30
|
+
var C, N;
|
|
31
|
+
const { user: o } = O(), n = ((C = o == null ? void 0 : o.preferences) == null ? void 0 : C.currency) ?? ((N = o == null ? void 0 : o.userRegion) == null ? void 0 : N.currency), c = n !== e, { data: a, isPending: m } = _({
|
|
32
|
+
queryKey: [T.CONVERT_CURRENCY, e, n],
|
|
33
|
+
queryFn: () => x.convertCurrency({
|
|
33
34
|
baseCurrency: e,
|
|
34
35
|
targetCurrency: n
|
|
35
36
|
}),
|
|
36
|
-
enabled:
|
|
37
|
-
staleTime:
|
|
38
|
-
}),
|
|
37
|
+
enabled: c && !!e && !!i,
|
|
38
|
+
staleTime: Y
|
|
39
|
+
}), p = I(() => {
|
|
39
40
|
if (!o)
|
|
40
41
|
return null;
|
|
41
|
-
let
|
|
42
|
-
if (
|
|
43
|
-
if (
|
|
44
|
-
|
|
42
|
+
let h = typeof i == "string" ? parseFloat(i) : i;
|
|
43
|
+
if (c) {
|
|
44
|
+
if (m || !a) return null;
|
|
45
|
+
h = h * a;
|
|
45
46
|
}
|
|
46
|
-
return
|
|
47
|
-
}, [i, o,
|
|
48
|
-
if (
|
|
49
|
-
return /* @__PURE__ */ r("span", { className: "currency-conversion", children:
|
|
50
|
-
|
|
47
|
+
return h;
|
|
48
|
+
}, [i, o, m, c, a]);
|
|
49
|
+
if (R)
|
|
50
|
+
return /* @__PURE__ */ r("span", { className: "currency-conversion", children: u(
|
|
51
|
+
i,
|
|
52
|
+
e,
|
|
53
|
+
s,
|
|
54
|
+
d
|
|
55
|
+
) });
|
|
56
|
+
if (m && c)
|
|
51
57
|
return /* @__PURE__ */ r("span", { className: "currency-conversion loading", children: i });
|
|
52
|
-
if (!n || !
|
|
53
|
-
switch (
|
|
58
|
+
if (!n || !p || p < 0)
|
|
59
|
+
switch (y) {
|
|
54
60
|
case t.NA:
|
|
55
61
|
return /* @__PURE__ */ r("span", { children: "N/A" });
|
|
56
62
|
case t.HIDDEN:
|
|
@@ -58,25 +64,26 @@ const x = 1e3 * 60 * 60, k = ({
|
|
|
58
64
|
case t.DISPLAY_AS_ZERO:
|
|
59
65
|
return /* @__PURE__ */ r("span", { children: "0" });
|
|
60
66
|
case t.DISPLAY_AS_ZERO_WITH_CURRENCY:
|
|
61
|
-
return /* @__PURE__ */ r("span", { children:
|
|
67
|
+
return /* @__PURE__ */ r("span", { children: f(0, n ?? e) });
|
|
62
68
|
case t.DISPLAY_AS_ZERO_WITH_CURRENCY_NO_DECIMAL:
|
|
63
|
-
return /* @__PURE__ */ r("span", { children:
|
|
69
|
+
return /* @__PURE__ */ r("span", { children: S(0, n ?? e) });
|
|
64
70
|
case t.CUSTOM:
|
|
65
|
-
return /* @__PURE__ */ r("span", { children:
|
|
71
|
+
return /* @__PURE__ */ r("span", { children: p == 0 ? g : "N/A" });
|
|
66
72
|
default:
|
|
67
73
|
return /* @__PURE__ */ r("span", { children: "N/A" });
|
|
68
74
|
}
|
|
69
75
|
return /* @__PURE__ */ l("span", { className: "currency-conversion", children: [
|
|
70
|
-
|
|
71
|
-
|
|
76
|
+
u(
|
|
77
|
+
p,
|
|
72
78
|
n,
|
|
73
|
-
|
|
79
|
+
s,
|
|
80
|
+
d
|
|
74
81
|
),
|
|
75
|
-
|
|
76
|
-
|
|
82
|
+
c && E && /* @__PURE__ */ r(
|
|
83
|
+
D,
|
|
77
84
|
{
|
|
78
|
-
trigger: /* @__PURE__ */ r("sup", { children: /* @__PURE__ */ r(
|
|
79
|
-
position:
|
|
85
|
+
trigger: /* @__PURE__ */ r("sup", { children: /* @__PURE__ */ r(v, {}) }),
|
|
86
|
+
position: A,
|
|
80
87
|
children: /* @__PURE__ */ l("div", { className: "currency-conversion-container", children: [
|
|
81
88
|
/* @__PURE__ */ l("p", { children: [
|
|
82
89
|
"Converted from ",
|
|
@@ -85,26 +92,32 @@ const x = 1e3 * 60 * 60, k = ({
|
|
|
85
92
|
n
|
|
86
93
|
] }),
|
|
87
94
|
/* @__PURE__ */ l("div", { className: "currency-conversion-amounts", children: [
|
|
88
|
-
/* @__PURE__ */ r("div", { children: /* @__PURE__ */ r("p", { children:
|
|
89
|
-
|
|
90
|
-
|
|
95
|
+
/* @__PURE__ */ r("div", { children: /* @__PURE__ */ r("p", { children: u(
|
|
96
|
+
i,
|
|
97
|
+
e,
|
|
98
|
+
s,
|
|
99
|
+
d
|
|
100
|
+
) }) }),
|
|
101
|
+
/* @__PURE__ */ r("div", { children: /* @__PURE__ */ r("p", { children: u(
|
|
102
|
+
p,
|
|
91
103
|
n,
|
|
92
|
-
|
|
104
|
+
s,
|
|
105
|
+
d
|
|
93
106
|
) }) }),
|
|
94
|
-
/* @__PURE__ */ r("span", { className: "conversion-icon", children: /* @__PURE__ */ r(
|
|
107
|
+
/* @__PURE__ */ r("span", { className: "conversion-icon", children: /* @__PURE__ */ r(v, {}) })
|
|
95
108
|
] }),
|
|
96
109
|
/* @__PURE__ */ r("div", { className: "currency-conversion-rate", children: /* @__PURE__ */ l("p", { children: [
|
|
97
110
|
"Current Rate:",
|
|
98
111
|
" ",
|
|
99
|
-
|
|
112
|
+
a ? (
|
|
100
113
|
// only leaving 2 decimal places for the conversion rate is
|
|
101
114
|
// not enough, can lead to confusion
|
|
102
115
|
// use Number constructor to strip unnecessary trailing zeros
|
|
103
|
-
`${Number((1 /
|
|
116
|
+
`${Number((1 / a).toFixed(5))} ${e}`
|
|
104
117
|
) : "N/A",
|
|
105
118
|
" ",
|
|
106
119
|
"≈ ",
|
|
107
|
-
|
|
120
|
+
f(1, n)
|
|
108
121
|
] }) })
|
|
109
122
|
] })
|
|
110
123
|
}
|
|
@@ -112,6 +125,6 @@ const x = 1e3 * 60 * 60, k = ({
|
|
|
112
125
|
] });
|
|
113
126
|
};
|
|
114
127
|
export {
|
|
115
|
-
|
|
116
|
-
|
|
128
|
+
J as CashValue,
|
|
129
|
+
Y as CurrencyCallStaleTimeMs
|
|
117
130
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as P } from "../../cashUtils-
|
|
1
|
+
import { c as P } from "../../cashUtils-DyxlHnod.js";
|
|
2
2
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
3
3
|
import { e as M, A as m, E as N } from "../../noRetryInstance-DNLgOg0E.js";
|
|
4
4
|
import { a as i } from "../../keys-BcBfU51M.js";
|
|
@@ -1,84 +1,88 @@
|
|
|
1
|
-
import { useQuery as
|
|
1
|
+
import { useQuery as s, useMutation as i } from "@tanstack/react-query";
|
|
2
2
|
import "react/jsx-runtime";
|
|
3
3
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
4
|
-
import { E as a, d as
|
|
4
|
+
import { E as a, d as l } from "../../noRetryInstance-DNLgOg0E.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import "react-i18next";
|
|
7
7
|
import '../../assets/_styles4.css';import '../../assets/_styles6.css';import '../../assets/_styles5.css';import '../../assets/_styles2.css';import '../../assets/_styles.css';import '../../assets/_styles3.css';/* empty css */
|
|
8
8
|
/* empty css */
|
|
9
9
|
/* empty css */
|
|
10
|
-
import { awayzClient as
|
|
10
|
+
import { awayzClient as d } from "../../configs/awayzClient.js";
|
|
11
11
|
/* empty css */
|
|
12
12
|
/* empty css */
|
|
13
13
|
import "../../index-Cv-wvFlM.js";
|
|
14
|
-
import { useAwayzContext as
|
|
14
|
+
import { useAwayzContext as h } from "../useAwayzContext.js";
|
|
15
15
|
/* empty css */
|
|
16
16
|
import "../../context/AwayzContext.js";
|
|
17
|
-
import { WalletService as
|
|
17
|
+
import { WalletService as n } from "../../services/wallet/WalletService.js";
|
|
18
18
|
const U = {
|
|
19
19
|
availablePoints: 0,
|
|
20
20
|
valuePerPoint: 0,
|
|
21
21
|
currency: ""
|
|
22
22
|
}, z = () => {
|
|
23
|
-
const { user: r } =
|
|
23
|
+
const { user: r, featureFlags: c, featureFlagsLoaded: y, isAuthenticated: o } = h(), { data: t = [] } = s({
|
|
24
24
|
queryKey: [a.PROGRAMS],
|
|
25
|
-
queryFn:
|
|
26
|
-
placeholderData: []
|
|
27
|
-
|
|
25
|
+
queryFn: n.getAwards,
|
|
26
|
+
placeholderData: [],
|
|
27
|
+
enabled: o
|
|
28
|
+
}), { data: A = [] } = s({
|
|
28
29
|
queryKey: [a.USER_PROGRAMS, r == null ? void 0 : r.id],
|
|
29
|
-
queryFn: () => r != null && r.id ?
|
|
30
|
+
queryFn: () => r != null && r.id ? n.getUserAwards(r.id) : [],
|
|
30
31
|
placeholderData: [],
|
|
31
|
-
enabled:
|
|
32
|
-
}), { data:
|
|
32
|
+
enabled: o
|
|
33
|
+
}), { data: S = [] } = s({
|
|
33
34
|
queryKey: [a.LINKED_USER_PROGRAMS, r == null ? void 0 : r.id],
|
|
34
|
-
queryFn: () => r != null && r.id ?
|
|
35
|
+
queryFn: () => r != null && r.id ? n.getLinkedUserAwards(r.id) : [],
|
|
35
36
|
placeholderData: [],
|
|
36
|
-
enabled:
|
|
37
|
-
}), { data:
|
|
37
|
+
enabled: o
|
|
38
|
+
}), { data: g = [] } = s({
|
|
38
39
|
queryKey: [a.BANKS],
|
|
39
|
-
queryFn:
|
|
40
|
-
placeholderData: []
|
|
41
|
-
|
|
40
|
+
queryFn: n.getBanks,
|
|
41
|
+
placeholderData: [],
|
|
42
|
+
enabled: o
|
|
43
|
+
}), { data: P = [] } = s({
|
|
42
44
|
queryKey: [a.CARDS],
|
|
43
|
-
queryFn:
|
|
44
|
-
placeholderData: []
|
|
45
|
-
|
|
45
|
+
queryFn: n.getCards,
|
|
46
|
+
placeholderData: [],
|
|
47
|
+
enabled: o
|
|
48
|
+
}), { data: R = [] } = s({
|
|
46
49
|
queryKey: [a.USER_CARDS],
|
|
47
|
-
queryFn:
|
|
48
|
-
placeholderData: []
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
queryFn: n.getUserCards,
|
|
51
|
+
placeholderData: [],
|
|
52
|
+
enabled: o
|
|
53
|
+
}), {
|
|
54
|
+
data: p = U,
|
|
55
|
+
isFetching: C
|
|
56
|
+
} = s({
|
|
53
57
|
queryKey: [a.POINTS_AS_CASH],
|
|
54
|
-
queryFn:
|
|
55
|
-
enabled:
|
|
58
|
+
queryFn: n.getPointsAsCash,
|
|
59
|
+
enabled: y && c.usePointsAsCashFeature && o,
|
|
56
60
|
retry: !1
|
|
57
|
-
}), { mutate:
|
|
61
|
+
}), { mutate: E } = i({
|
|
58
62
|
mutationFn: async (e) => {
|
|
59
|
-
const { mainProgram: m, awardsAmount:
|
|
60
|
-
await
|
|
63
|
+
const { mainProgram: m, awardsAmount: u } = typeof e == "string" ? { mainProgram: e, awardsAmount: 0 } : e;
|
|
64
|
+
await n.addAwardProgram(m, u);
|
|
61
65
|
},
|
|
62
66
|
onSuccess: () => {
|
|
63
|
-
|
|
67
|
+
d.invalidateQueries({
|
|
64
68
|
queryKey: [a.LINKED_USER_PROGRAMS]
|
|
65
69
|
});
|
|
66
70
|
}
|
|
67
|
-
}), { mutate:
|
|
71
|
+
}), { mutate: K } = i({
|
|
68
72
|
mutationFn: async (e) => {
|
|
69
|
-
await
|
|
73
|
+
await n.removeAwardProgram(e);
|
|
70
74
|
},
|
|
71
75
|
onSuccess: () => {
|
|
72
|
-
|
|
76
|
+
d.invalidateQueries({
|
|
73
77
|
queryKey: [a.LINKED_USER_PROGRAMS]
|
|
74
78
|
});
|
|
75
79
|
}
|
|
76
|
-
}), { mutateAsync:
|
|
80
|
+
}), { mutateAsync: f } = i({
|
|
77
81
|
mutationFn: async ({ mainProgram: e, awardsAmount: m }) => {
|
|
78
|
-
const
|
|
79
|
-
if (!
|
|
82
|
+
const u = t == null ? void 0 : t.find((q) => q.mainProgram === e);
|
|
83
|
+
if (!u)
|
|
80
84
|
throw new Error("Program not found");
|
|
81
|
-
return
|
|
85
|
+
return n.setAwardPoints(u.mainProgram, m);
|
|
82
86
|
},
|
|
83
87
|
onSuccess: () => {
|
|
84
88
|
[
|
|
@@ -86,20 +90,20 @@ const U = {
|
|
|
86
90
|
a.USER_PROGRAMS,
|
|
87
91
|
a.PROGRAMS
|
|
88
92
|
].forEach((e) => {
|
|
89
|
-
|
|
93
|
+
d.invalidateQueries({ queryKey: [e] });
|
|
90
94
|
});
|
|
91
95
|
}
|
|
92
|
-
}), { mutateAsync:
|
|
93
|
-
mutationFn: async (e) =>
|
|
96
|
+
}), { mutateAsync: F } = i({
|
|
97
|
+
mutationFn: async (e) => n.addCardsToWallet(e),
|
|
94
98
|
onSuccess: () => {
|
|
95
|
-
|
|
99
|
+
d.invalidateQueries({
|
|
96
100
|
queryKey: [a.USER_CARDS]
|
|
97
101
|
});
|
|
98
102
|
}
|
|
99
|
-
}), { mutateAsync:
|
|
100
|
-
mutationFn: async (e) =>
|
|
103
|
+
}), { mutateAsync: _ } = i({
|
|
104
|
+
mutationFn: async (e) => n.removeCardsFromWallet(e),
|
|
101
105
|
onSuccess: () => {
|
|
102
|
-
|
|
106
|
+
d.invalidateQueries({
|
|
103
107
|
queryKey: [a.USER_CARDS]
|
|
104
108
|
});
|
|
105
109
|
}
|
|
@@ -107,28 +111,28 @@ const U = {
|
|
|
107
111
|
return {
|
|
108
112
|
// Program Management
|
|
109
113
|
allPrograms: t || [],
|
|
110
|
-
userPrograms:
|
|
111
|
-
linkedUserPrograms:
|
|
114
|
+
userPrograms: A || [],
|
|
115
|
+
linkedUserPrograms: S || [],
|
|
112
116
|
hotelPrograms: (t == null ? void 0 : t.filter(
|
|
113
|
-
(e) => e.category.includes(
|
|
117
|
+
(e) => e.category.includes(l.HOTEL)
|
|
114
118
|
)) || [],
|
|
115
119
|
airlinePrograms: (t == null ? void 0 : t.filter(
|
|
116
|
-
(e) => e.category.includes(
|
|
120
|
+
(e) => e.category.includes(l.AIRLINE)
|
|
117
121
|
)) || [],
|
|
118
122
|
bankPrograms: (t == null ? void 0 : t.filter(
|
|
119
|
-
(e) => e.category.includes(
|
|
123
|
+
(e) => e.category.includes(l.BANK)
|
|
120
124
|
)) || [],
|
|
121
|
-
updatePoints:
|
|
122
|
-
addAwardProgram:
|
|
123
|
-
removeAwardProgram:
|
|
125
|
+
updatePoints: f,
|
|
126
|
+
addAwardProgram: E,
|
|
127
|
+
removeAwardProgram: K,
|
|
124
128
|
// Card Management
|
|
125
|
-
banks:
|
|
126
|
-
allCards:
|
|
127
|
-
userCards:
|
|
128
|
-
addCards:
|
|
129
|
-
removeCards:
|
|
130
|
-
pointsAsCash:
|
|
131
|
-
pointsAsCashLoading:
|
|
129
|
+
banks: g || [],
|
|
130
|
+
allCards: P || [],
|
|
131
|
+
userCards: R || [],
|
|
132
|
+
addCards: F,
|
|
133
|
+
removeCards: _,
|
|
134
|
+
pointsAsCash: p,
|
|
135
|
+
pointsAsCashLoading: C
|
|
132
136
|
};
|
|
133
137
|
};
|
|
134
138
|
export {
|
|
@@ -30,9 +30,15 @@ export interface ICashValueProps {
|
|
|
30
30
|
*/
|
|
31
31
|
customDisplay?: string;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* Maximum number of decimal places to display. Defaults to 0.
|
|
34
34
|
*/
|
|
35
35
|
decimalPlaces?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Minimum number of decimal places to display. Defaults to `decimalPlaces`.
|
|
38
|
+
* Useful when you want to pad small values (e.g. 0 → "0.00") while still
|
|
39
|
+
* allowing more precision when the value has it (e.g. 0.1245 → "0.1245").
|
|
40
|
+
*/
|
|
41
|
+
minDecimalPlaces?: number;
|
|
36
42
|
/**
|
|
37
43
|
* Whether to show the conversion tooltip.
|
|
38
44
|
* Defaults to true, but can be set to false to hide it.
|
|
@@ -51,4 +57,4 @@ export declare const CurrencyCallStaleTimeMs: number;
|
|
|
51
57
|
* If the original currency differs from the user's currency, it shows a conversion
|
|
52
58
|
* tooltip with details about the conversion rate and original amount.
|
|
53
59
|
*/
|
|
54
|
-
export declare const CashValue: ({ amount, currency, position, zeroDisplayOption, customDisplay, decimalPlaces, showConversion, showOriginal }: ICashValueProps) => import("react/jsx-runtime").JSX.Element;
|
|
60
|
+
export declare const CashValue: ({ amount, currency, position, zeroDisplayOption, customDisplay, decimalPlaces, minDecimalPlaces, showConversion, showOriginal }: ICashValueProps) => import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { jsxs as i, Fragment as c, jsx as m } from "react/jsx-runtime";
|
|
2
|
-
const a = "USD", g = (r, t) => {
|
|
3
|
-
const e = t || a, n = new Intl.NumberFormat("en-US");
|
|
4
|
-
if (!r) return `${n.format(0)}${e}`;
|
|
5
|
-
const o = parseFloat(r.toString());
|
|
6
|
-
return /* @__PURE__ */ i(c, { children: [
|
|
7
|
-
n.format(isNaN(o) ? 0 : o),
|
|
8
|
-
" ",
|
|
9
|
-
/* @__PURE__ */ m("sub", { children: e })
|
|
10
|
-
] });
|
|
11
|
-
}, l = (r, t) => {
|
|
12
|
-
const e = t || a, n = new Intl.NumberFormat("en-US", {
|
|
13
|
-
maximumFractionDigits: 0
|
|
14
|
-
});
|
|
15
|
-
return /* @__PURE__ */ i(c, { children: [
|
|
16
|
-
n.format(isNaN(r) ? 0 : r),
|
|
17
|
-
" ",
|
|
18
|
-
/* @__PURE__ */ m("sub", { children: e })
|
|
19
|
-
] });
|
|
20
|
-
}, y = (r, t, e = 0) => {
|
|
21
|
-
const n = parseFloat((r == null ? void 0 : r.toString()) || "0"), o = t || a, s = new Intl.NumberFormat("en-US", {
|
|
22
|
-
maximumFractionDigits: e
|
|
23
|
-
});
|
|
24
|
-
return /* @__PURE__ */ i(c, { children: [
|
|
25
|
-
s.format(isNaN(n) ? 0 : n),
|
|
26
|
-
" ",
|
|
27
|
-
/* @__PURE__ */ m("sub", { children: o })
|
|
28
|
-
] });
|
|
29
|
-
}, F = (r, t = "en") => 0 .toLocaleString(t, {
|
|
30
|
-
style: "currency",
|
|
31
|
-
currency: r,
|
|
32
|
-
minimumFractionDigits: 0,
|
|
33
|
-
maximumFractionDigits: 0
|
|
34
|
-
}).replace(/\d/g, "").trim();
|
|
35
|
-
export {
|
|
36
|
-
l as a,
|
|
37
|
-
g as b,
|
|
38
|
-
F as c,
|
|
39
|
-
y as g
|
|
40
|
-
};
|