@stokr/components-library 3.0.72-beta.6 → 3.0.72
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/components/Payment/PaymentDetailsCard.js +7 -3
- package/dist/components/Payment/PaymentDisplay.js +11 -3
- package/dist/components/Payment/PaymentPendingCard.js +3 -0
- package/dist/components/Payment/PaymentSuccessCard.js +6 -2
- package/dist/index.js +2 -1
- package/dist/static/images/currency/eur.svg +3 -2
- package/dist/static/images/currency/eur.svg.js +4 -0
- package/dist/static/images/currency/usd.svg +4 -0
- package/dist/static/images/currency/usd.svg.js +4 -0
- package/dist/utils/formatCurrencyValue.js +18 -0
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import styled from "styled-components";
|
|
|
4
4
|
import { colors } from "../../styles/colors.js";
|
|
5
5
|
import { InfoIcon } from "../InfoIcon/InfoIcon.js";
|
|
6
6
|
import { ArrowSimple } from "../icons/ArrowSimple.js";
|
|
7
|
-
import { getCurrencyConfig, getCurrencyIcon } from "../../utils/formatCurrencyValue.js";
|
|
7
|
+
import { getCurrencyConfig, getCurrencyIcon, formatAmountForDisplay } from "../../utils/formatCurrencyValue.js";
|
|
8
8
|
import externalLinkIcon from "../../static/images/external-link-icon.svg.js";
|
|
9
9
|
const CardContainer = styled.div`
|
|
10
10
|
background: ${colors.white};
|
|
@@ -48,11 +48,13 @@ const AmountSubtitle = styled.div`
|
|
|
48
48
|
const AmountDisplay = styled.div`
|
|
49
49
|
display: flex;
|
|
50
50
|
align-items: center;
|
|
51
|
+
flex-wrap: wrap;
|
|
51
52
|
gap: 16px;
|
|
52
53
|
`;
|
|
53
54
|
const AmountLeft = styled.div`
|
|
54
55
|
display: flex;
|
|
55
56
|
align-items: center;
|
|
57
|
+
flex-wrap: wrap;
|
|
56
58
|
gap: 12px;
|
|
57
59
|
flex: 1;
|
|
58
60
|
min-width: 0;
|
|
@@ -94,7 +96,9 @@ const AmountValue = styled.div`
|
|
|
94
96
|
text-transform: uppercase;
|
|
95
97
|
line-height: 40px;
|
|
96
98
|
letter-spacing: 1.5px;
|
|
97
|
-
|
|
99
|
+
max-width: 100%;
|
|
100
|
+
overflow-wrap: break-word;
|
|
101
|
+
word-break: break-word;
|
|
98
102
|
color: ${colors.futureBlack};
|
|
99
103
|
`;
|
|
100
104
|
const Separator = styled.hr`
|
|
@@ -282,7 +286,7 @@ const AmountBlock = ({ config }) => {
|
|
|
282
286
|
/* @__PURE__ */ jsxs(AmountDisplay, { children: [
|
|
283
287
|
/* @__PURE__ */ jsxs(AmountLeft, { children: [
|
|
284
288
|
renderCurrencyLogo(),
|
|
285
|
-
/* @__PURE__ */ jsx(AmountValue, { children: displayValue !== null ? displayValue : "-" })
|
|
289
|
+
/* @__PURE__ */ jsx(AmountValue, { children: displayValue !== null ? formatAmountForDisplay(displayValue) : "-" })
|
|
286
290
|
] }),
|
|
287
291
|
ticker && /* @__PURE__ */ jsx(CurrencyTicker, { children: ticker })
|
|
288
292
|
] }),
|
|
@@ -9,7 +9,7 @@ import { CopyToClipboardButton } from "../CryptoAddress/CryptoAddress.styles.js"
|
|
|
9
9
|
import stdin_default from "../QRCode/QRCode.js";
|
|
10
10
|
import { SectionTitle } from "../SectionTitle/SectionTitle.styles.js";
|
|
11
11
|
import { StatusDot } from "../StatusDot/StatusDot.js";
|
|
12
|
-
import { getCurrencyIcon } from "../../utils/formatCurrencyValue.js";
|
|
12
|
+
import { getCurrencyIcon, formatAmountForDisplay } from "../../utils/formatCurrencyValue.js";
|
|
13
13
|
const CodeWrapper = styled.div.withConfig({
|
|
14
14
|
shouldForwardProp: (props) => !["maxWidth"].includes(props)
|
|
15
15
|
})`
|
|
@@ -35,12 +35,18 @@ const AmountBlock = styled.div`
|
|
|
35
35
|
const AmountRow = styled.div`
|
|
36
36
|
display: flex;
|
|
37
37
|
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
flex-wrap: wrap;
|
|
38
40
|
gap: 10px;
|
|
41
|
+
width: 100%;
|
|
39
42
|
`;
|
|
40
43
|
const AmountValueGroup = styled.div`
|
|
41
44
|
display: flex;
|
|
42
45
|
align-items: center;
|
|
46
|
+
flex-wrap: wrap;
|
|
47
|
+
justify-content: center;
|
|
43
48
|
gap: 8px;
|
|
49
|
+
min-width: 0;
|
|
44
50
|
`;
|
|
45
51
|
const AmountValue = styled.p`
|
|
46
52
|
margin: 0;
|
|
@@ -50,7 +56,9 @@ const AmountValue = styled.p`
|
|
|
50
56
|
line-height: 40px;
|
|
51
57
|
letter-spacing: 1.5px;
|
|
52
58
|
color: ${colors.black};
|
|
53
|
-
|
|
59
|
+
max-width: 100%;
|
|
60
|
+
overflow-wrap: break-word;
|
|
61
|
+
word-break: break-word;
|
|
54
62
|
`;
|
|
55
63
|
const AmountCurrency = styled.p`
|
|
56
64
|
margin: 0;
|
|
@@ -169,7 +177,7 @@ const PaymentDisplay = ({
|
|
|
169
177
|
/* @__PURE__ */ jsxs(AmountRow, { style: amountSectionStyle, children: [
|
|
170
178
|
/* @__PURE__ */ jsxs(AmountValueGroup, { children: [
|
|
171
179
|
/* @__PURE__ */ jsx(AmountIcon, { src: getCurrencyIcon(currency, customCurrencyIcon), style: amountIconStyle, alt: currency }),
|
|
172
|
-
/* @__PURE__ */ jsx(AmountValue, { style: amountTextStyle, children: amount }),
|
|
180
|
+
/* @__PURE__ */ jsx(AmountValue, { style: amountTextStyle, children: formatAmountForDisplay(amount) }),
|
|
173
181
|
/* @__PURE__ */ jsx(AmountCurrency, { style: amountTextStyle, children: currency })
|
|
174
182
|
] }),
|
|
175
183
|
showCopyIcons && /* @__PURE__ */ jsx(
|
|
@@ -28,6 +28,7 @@ const TextBlock = styled.div`
|
|
|
28
28
|
`;
|
|
29
29
|
const Title = styled.h2`
|
|
30
30
|
margin: 0;
|
|
31
|
+
font-family: 'Open Sans', sans-serif;
|
|
31
32
|
font-size: 22px;
|
|
32
33
|
font-weight: 800;
|
|
33
34
|
line-height: 28px;
|
|
@@ -37,6 +38,7 @@ const Title = styled.h2`
|
|
|
37
38
|
`;
|
|
38
39
|
const Description = styled.p`
|
|
39
40
|
margin: 0;
|
|
41
|
+
font-family: 'Open Sans', sans-serif;
|
|
40
42
|
font-size: 16px;
|
|
41
43
|
font-weight: 300;
|
|
42
44
|
line-height: 24px;
|
|
@@ -45,6 +47,7 @@ const Description = styled.p`
|
|
|
45
47
|
`;
|
|
46
48
|
const FooterNote = styled.p`
|
|
47
49
|
margin: 0;
|
|
50
|
+
font-family: 'Open Sans', sans-serif;
|
|
48
51
|
font-size: 12px;
|
|
49
52
|
font-weight: 400;
|
|
50
53
|
line-height: 18px;
|
|
@@ -7,7 +7,7 @@ import { Button } from "../Button/Button.styles.js";
|
|
|
7
7
|
import { CodeWrapper, AmountIcon, AmountValue, AmountCurrency } from "./PaymentDisplay.js";
|
|
8
8
|
import { DetailsToggle } from "./DetailsToggle.js";
|
|
9
9
|
import { LottieAnimation } from "../Lottie/LottieAnimation.js";
|
|
10
|
-
import { getCurrencyIcon } from "../../utils/formatCurrencyValue.js";
|
|
10
|
+
import { getCurrencyIcon, formatAmountForDisplay } from "../../utils/formatCurrencyValue.js";
|
|
11
11
|
import externalLinkIcon from "../../static/images/external-link-icon.svg.js";
|
|
12
12
|
const IconCircle = styled.div`
|
|
13
13
|
flex-shrink: 0;
|
|
@@ -29,6 +29,7 @@ const TextBlock = styled.div`
|
|
|
29
29
|
`;
|
|
30
30
|
const Title = styled.h2`
|
|
31
31
|
margin: 0;
|
|
32
|
+
font-family: 'Open Sans';
|
|
32
33
|
font-size: 22px;
|
|
33
34
|
font-weight: 800;
|
|
34
35
|
line-height: 28px;
|
|
@@ -47,7 +48,10 @@ const Description = styled.p`
|
|
|
47
48
|
const AmountRow = styled.div`
|
|
48
49
|
display: flex;
|
|
49
50
|
align-items: center;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
flex-wrap: wrap;
|
|
50
53
|
gap: 8px;
|
|
54
|
+
max-width: 100%;
|
|
51
55
|
`;
|
|
52
56
|
const ActionsRow = styled.div`
|
|
53
57
|
display: flex;
|
|
@@ -102,7 +106,7 @@ const PaymentSuccessCard = ({
|
|
|
102
106
|
] }),
|
|
103
107
|
hasAmount && /* @__PURE__ */ jsxs(AmountRow, { children: [
|
|
104
108
|
currency && /* @__PURE__ */ jsx(AmountIcon, { src: getCurrencyIcon(currency, customCurrencyIcon), alt: currency }),
|
|
105
|
-
/* @__PURE__ */ jsx(AmountValue, { children: amount }),
|
|
109
|
+
/* @__PURE__ */ jsx(AmountValue, { children: formatAmountForDisplay(amount) }),
|
|
106
110
|
currency && /* @__PURE__ */ jsx(AmountCurrency, { children: currency })
|
|
107
111
|
] }),
|
|
108
112
|
rows.length > 0 && /* @__PURE__ */ jsx(DetailsToggle, { rows, defaultOpen: detailsDefaultOpen, showLabel: showDetailsLabel, hideLabel: hideDetailsLabel }),
|
package/dist/index.js
CHANGED
|
@@ -131,7 +131,7 @@ import { generateCoreChecklistTasks, getVerifyIdentityChecklist } from "./utils/
|
|
|
131
131
|
import { CopyToClipBoardTooltip, copyTextToClipboard, useCopyToClipboard, withCopyToClipboard } from "./utils/copyToClipboard.js";
|
|
132
132
|
import { cooldownHOC, useComponentVisible, useContainerSize, useCooldown, useMobileView, usePrevious } from "./utils/customHooks.js";
|
|
133
133
|
import { fixDecimals, formatDisplayNumber } from "./utils/fix-decimals.js";
|
|
134
|
-
import { CURRENCY_CONFIG, formatCurrencyValue, getCurrencyConfig, getCurrencyIcon, getCurrencySymbol, getLiquidAssetIcon, getProjectCurrencySign } from "./utils/formatCurrencyValue.js";
|
|
134
|
+
import { CURRENCY_CONFIG, formatAmountForDisplay, formatCurrencyValue, getCurrencyConfig, getCurrencyIcon, getCurrencySymbol, getLiquidAssetIcon, getProjectCurrencySign } from "./utils/formatCurrencyValue.js";
|
|
135
135
|
import { isUSInvestor, usCountries } from "./utils/isUSInvestor.js";
|
|
136
136
|
import { ENTROPY_MEDIUM, ENTROPY_WEAK, PASSWORD_MIN_LENGTH, PASSWORD_REQUIREMENTS_MESSAGE, getPasswordCriteria, getPasswordEntropy, isPasswordValid } from "./utils/password-validation.js";
|
|
137
137
|
import { km_ify } from "./utils/km_ify.js";
|
|
@@ -614,6 +614,7 @@ export {
|
|
|
614
614
|
flatten,
|
|
615
615
|
default2 as fontFaces,
|
|
616
616
|
format,
|
|
617
|
+
formatAmountForDisplay,
|
|
617
618
|
formatCurrencyValue,
|
|
618
619
|
formatDisplayNumber,
|
|
619
620
|
generateCoreChecklistTasks,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
<svg
|
|
2
|
-
<
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32">
|
|
2
|
+
<circle cx="16" cy="16" r="16" fill="#202020"/>
|
|
3
|
+
<text x="16" y="21.5" text-anchor="middle" font-family="Arial, Helvetica, sans-serif" font-size="16" font-weight="700" fill="#ffffff">€</text>
|
|
3
4
|
</svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const EURLogo = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiIgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIj4KICA8Y2lyY2xlIGN4PSIxNiIgY3k9IjE2IiByPSIxNiIgZmlsbD0iIzIwMjAyMCIvPgogIDx0ZXh0IHg9IjE2IiB5PSIyMS41IiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmb250LWZhbWlseT0iQXJpYWwsIEhlbHZldGljYSwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNiIgZm9udC13ZWlnaHQ9IjcwMCIgZmlsbD0iI2ZmZmZmZiI+JiM4MzY0OzwvdGV4dD4KPC9zdmc+Cg==";
|
|
2
|
+
export {
|
|
3
|
+
EURLogo as default
|
|
4
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32">
|
|
2
|
+
<circle cx="16" cy="16" r="16" fill="#202020"/>
|
|
3
|
+
<text x="16" y="22" text-anchor="middle" font-family="Arial, Helvetica, sans-serif" font-size="17" font-weight="700" fill="#ffffff">$</text>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const USDLogo = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiIgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIj4KICA8Y2lyY2xlIGN4PSIxNiIgY3k9IjE2IiByPSIxNiIgZmlsbD0iIzIwMjAyMCIvPgogIDx0ZXh0IHg9IjE2IiB5PSIyMiIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZm9udC1mYW1pbHk9IkFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMTciIGZvbnQtd2VpZ2h0PSI3MDAiIGZpbGw9IiNmZmZmZmYiPiQ8L3RleHQ+Cjwvc3ZnPgo=";
|
|
2
|
+
export {
|
|
3
|
+
USDLogo as default
|
|
4
|
+
};
|
|
@@ -4,6 +4,9 @@ import BitcoinLogo from "../static/images/currency/bitcoin-logo.png.js";
|
|
|
4
4
|
import BMN2Logo from "../static/images/currency/bmn2-logo.png.js";
|
|
5
5
|
import ETHLogo from "../static/images/currency/eth_logo.svg.js";
|
|
6
6
|
import USDTLogo from "../static/images/currency/usdt-logo.png.js";
|
|
7
|
+
import USDLogo from "../static/images/currency/usd.svg.js";
|
|
8
|
+
import EURLogo from "../static/images/currency/eur.svg.js";
|
|
9
|
+
import { formatDisplayNumber } from "./fix-decimals.js";
|
|
7
10
|
const CURRENCY_CONFIG = {
|
|
8
11
|
tether: ["USDT", 2],
|
|
9
12
|
gemini: ["GUSD", 2],
|
|
@@ -46,6 +49,14 @@ const formatCurrencyValue = (currency, value, tokenDecimals = 2, options = {}) =
|
|
|
46
49
|
const formattedValue = parseFloat(Math.abs(value)).toFixed(decimals);
|
|
47
50
|
return valueFirst ? `${formattedValue} ${symbol}` : `${symbol} ${formattedValue}`;
|
|
48
51
|
};
|
|
52
|
+
const formatAmountForDisplay = (amount) => {
|
|
53
|
+
if (amount === void 0 || amount === null || amount === "") return amount;
|
|
54
|
+
const plain = String(amount).replace(/,/g, "");
|
|
55
|
+
const decimalPart = plain.split(".")[1];
|
|
56
|
+
const digits = decimalPart ? decimalPart.length : 0;
|
|
57
|
+
const formatted = formatDisplayNumber(plain, { minimumFractionDigits: digits, maximumFractionDigits: digits });
|
|
58
|
+
return formatted || amount;
|
|
59
|
+
};
|
|
49
60
|
const getCurrencySymbol = (currencySelected) => {
|
|
50
61
|
const config = CURRENCY_CONFIG[currencySelected];
|
|
51
62
|
if (config) {
|
|
@@ -79,6 +90,12 @@ const getCurrencyIcon = (currency, customIcon) => {
|
|
|
79
90
|
case "eth":
|
|
80
91
|
case "eth-fb":
|
|
81
92
|
return ETHLogo;
|
|
93
|
+
case "usd":
|
|
94
|
+
case "usd-in-kind":
|
|
95
|
+
return USDLogo;
|
|
96
|
+
case "euro":
|
|
97
|
+
case "eur":
|
|
98
|
+
return EURLogo;
|
|
82
99
|
default:
|
|
83
100
|
return null;
|
|
84
101
|
}
|
|
@@ -94,6 +111,7 @@ const getLiquidAssetIcon = async (assetId) => {
|
|
|
94
111
|
};
|
|
95
112
|
export {
|
|
96
113
|
CURRENCY_CONFIG,
|
|
114
|
+
formatAmountForDisplay,
|
|
97
115
|
formatCurrencyValue,
|
|
98
116
|
getCurrencyConfig,
|
|
99
117
|
getCurrencyIcon,
|