@traund/orquezta-widget-calculator 1.1.0 → 1.1.2
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 +244 -196
- package/dist/index.js.map +1 -1
- package/dist/module.js +245 -197
- package/dist/module.js.map +1 -1
- package/package.json +4 -3
- package/src/{calculatorV2.js → calculator.js} +31 -32
- package/src/components/disclaimers.jsx +2 -1
- package/src/components/fees.jsx +2 -1
- package/src/components/inputAmount.js +9 -15
- package/src/components/paymentMethodSelector.jsx +3 -1
- package/src/components/simulatorStyles.js +3 -3
- package/src/data/countries.js +2 -1
- package/src/helpers/flagsHelpers.js +1 -1
- package/src/index.js +1 -1
- package/src/simulator.js +5 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@traund/orquezta-widget-calculator",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Calculator React component",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.js",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"@babel/preset-react": "^7.24.1",
|
|
27
27
|
"@emotion/react": "^11.11.3",
|
|
28
28
|
"@emotion/styled": "^11.11.0",
|
|
29
|
-
"@mui/material": "^6.1.0",
|
|
30
29
|
"@mui/icons-material": "^6.1.0",
|
|
31
30
|
"@mui/lab": "^6.0.0-alpha.173",
|
|
31
|
+
"@mui/material": "^6.1.0",
|
|
32
32
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
33
33
|
"axios": "^0.21.1",
|
|
34
34
|
"dayjs": "^1.11.10",
|
|
@@ -49,9 +49,10 @@
|
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@emotion/react": "^11.11.3",
|
|
51
51
|
"@emotion/styled": "^11.11.0",
|
|
52
|
-
"@mui/material": "^6.1.0",
|
|
53
52
|
"@mui/icons-material": "^6.1.0",
|
|
54
53
|
"@mui/lab": "^6.0.0-alpha.173",
|
|
54
|
+
"@mui/material": "^6.1.0",
|
|
55
|
+
"@mui/styles": "^6.4.12",
|
|
55
56
|
"aws-sdk": "^2.1555.0",
|
|
56
57
|
"axios": "^0.21.1",
|
|
57
58
|
"crypto-js": "^4.2.0",
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import React, { Component, Fragment } from "react";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Box
|
|
18
|
-
} from '@mui/material';
|
|
2
|
+
import Autocomplete from '@mui/material/Autocomplete';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import Button from '@mui/material/Button';
|
|
5
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
|
6
|
+
import Divider from '@mui/material/Divider';
|
|
7
|
+
import FormControl from '@mui/material/FormControl';
|
|
8
|
+
import FormHelperText from '@mui/material/FormHelperText';
|
|
9
|
+
import InputAdornment from '@mui/material/InputAdornment';
|
|
10
|
+
import InputBase from '@mui/material/InputBase';
|
|
11
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
12
|
+
import Paper from '@mui/material/Paper';
|
|
13
|
+
import Select from '@mui/material/Select';
|
|
14
|
+
import TextField from '@mui/material/TextField';
|
|
15
|
+
import Tooltip from '@mui/material/Tooltip';
|
|
16
|
+
import Typography from '@mui/material/Typography';
|
|
19
17
|
import Grid from '@mui/material/Grid2';
|
|
20
18
|
import { HighlightOffOutlined as HighlightOffOutlinedIcon } from '@mui/icons-material';
|
|
21
19
|
import { matchSorter } from "match-sorter";
|
|
@@ -28,7 +26,7 @@ import Timer from "./countdown/index";
|
|
|
28
26
|
import Endpoints from "./core/endpoints";
|
|
29
27
|
import FlagsHelpers from "./helpers/flagsHelpers";
|
|
30
28
|
import { applyTaxDiscount } from "./helpers/taxDiscount";
|
|
31
|
-
import { getSignatureHeader } from "
|
|
29
|
+
import { getSignatureHeader } from "./core/signature";
|
|
32
30
|
class Calculator extends Component {
|
|
33
31
|
state = {
|
|
34
32
|
config: this.props.config ,
|
|
@@ -241,7 +239,7 @@ class Calculator extends Component {
|
|
|
241
239
|
fromExchangeRate: from.exchangeRate,
|
|
242
240
|
fromCurrencyValue: from.currency,
|
|
243
241
|
toCurrencyValue: to.currency,
|
|
244
|
-
fromCountryValue: from.country === "TR" ? "
|
|
242
|
+
fromCountryValue: from.country === "TR" ? "WLT" : from.country,
|
|
245
243
|
toCountryValue: to.country,
|
|
246
244
|
coupon: data.coupon,
|
|
247
245
|
plus: data.coupon ? data.promo : 0,
|
|
@@ -333,7 +331,7 @@ class Calculator extends Component {
|
|
|
333
331
|
"US",
|
|
334
332
|
"VE",
|
|
335
333
|
"ES",
|
|
336
|
-
"
|
|
334
|
+
"WLT"
|
|
337
335
|
];
|
|
338
336
|
|
|
339
337
|
const rates = {};
|
|
@@ -354,7 +352,7 @@ class Calculator extends Component {
|
|
|
354
352
|
let usdRate = "";
|
|
355
353
|
|
|
356
354
|
if (!rates.hasOwnProperty(c)) {
|
|
357
|
-
let forceUSD = (c == "USDT" || c == "
|
|
355
|
+
let forceUSD = (c == "USDT" || c == "WLT");
|
|
358
356
|
currency = countries.find(
|
|
359
357
|
(country) => country.code == (forceUSD ? "US" : c)
|
|
360
358
|
).currency;
|
|
@@ -513,7 +511,7 @@ class Calculator extends Component {
|
|
|
513
511
|
|
|
514
512
|
updateLimits = (selectedMethod) => {
|
|
515
513
|
|
|
516
|
-
const countryData = this.state.calculator[this.state.fromCountryValue == "TR" ? "
|
|
514
|
+
const countryData = this.state.calculator[this.state.fromCountryValue == "TR" ? "WLT" : this.state.fromCountryValue];
|
|
517
515
|
let { countryMin, countryMax, usdBuy } = countryData;
|
|
518
516
|
let { usdSell } = countryData.countryTo[this.state.toCountryValue || "US"];
|
|
519
517
|
if (
|
|
@@ -713,13 +711,13 @@ class Calculator extends Component {
|
|
|
713
711
|
|
|
714
712
|
let {
|
|
715
713
|
newAmountSender,
|
|
716
|
-
} = applyTaxDiscount(this.state.fromCountryValue === "
|
|
714
|
+
} = applyTaxDiscount(this.state.fromCountryValue === "WLT" ? "TR" : this.state.fromCountryValue, this.state.toCountryValue, this.state.sendValue, this.state.receivedValue);
|
|
717
715
|
|
|
718
716
|
let model = {
|
|
719
717
|
coupon: this.state.couponValue,
|
|
720
718
|
from: {
|
|
721
719
|
amount: newAmountSender,
|
|
722
|
-
country: this.state.fromCountryValue === "
|
|
720
|
+
country: this.state.fromCountryValue === "WLT" ? "TR" : this.state.fromCountryValue,
|
|
723
721
|
currency: this.state.fromCurrencyValue,
|
|
724
722
|
},
|
|
725
723
|
to: {
|
|
@@ -1187,7 +1185,8 @@ class Calculator extends Component {
|
|
|
1187
1185
|
fontWeight: 500,
|
|
1188
1186
|
fontSize: "16px",
|
|
1189
1187
|
lineHeight: "20px",
|
|
1190
|
-
color: "#000F37"
|
|
1188
|
+
color: "#000F37",
|
|
1189
|
+
marginTop:"25px"
|
|
1191
1190
|
},
|
|
1192
1191
|
inputAmount: {
|
|
1193
1192
|
background: "#C7CDD7",
|
|
@@ -1393,7 +1392,7 @@ class Calculator extends Component {
|
|
|
1393
1392
|
sx={classes.inputAmountText}
|
|
1394
1393
|
required
|
|
1395
1394
|
value={sendValue}
|
|
1396
|
-
type="number"
|
|
1395
|
+
//type="number"
|
|
1397
1396
|
disabled={loadingFrom || loadingTo}
|
|
1398
1397
|
startAdornment={
|
|
1399
1398
|
<InputAdornment
|
|
@@ -1441,7 +1440,7 @@ class Calculator extends Component {
|
|
|
1441
1440
|
<span style={{ marginRight: "5px" }}>
|
|
1442
1441
|
<FlagsHelpers code={option.code == "PE-USD" ? "PE" : option.code} />
|
|
1443
1442
|
</span>
|
|
1444
|
-
{option.currency}
|
|
1443
|
+
{option.code === "WLT" ? "WLT" : option.code === "USDT"? "USDT" : option.currency}
|
|
1445
1444
|
</Box>
|
|
1446
1445
|
)}
|
|
1447
1446
|
disableClearable
|
|
@@ -1589,7 +1588,7 @@ class Calculator extends Component {
|
|
|
1589
1588
|
</Grid>
|
|
1590
1589
|
}
|
|
1591
1590
|
<Grid size={{ xs: 10}}>
|
|
1592
|
-
<Divider
|
|
1591
|
+
<Divider ></Divider>
|
|
1593
1592
|
</Grid>
|
|
1594
1593
|
{taxSender > 0 &&
|
|
1595
1594
|
<>
|
|
@@ -1849,7 +1848,7 @@ class Calculator extends Component {
|
|
|
1849
1848
|
</Grid>
|
|
1850
1849
|
}
|
|
1851
1850
|
<br></br>
|
|
1852
|
-
<Grid container direction="column"
|
|
1851
|
+
<Grid container direction="column" >
|
|
1853
1852
|
<Grid>
|
|
1854
1853
|
<Typography
|
|
1855
1854
|
sx={classes.labelAmount}
|
|
@@ -1867,7 +1866,7 @@ class Calculator extends Component {
|
|
|
1867
1866
|
<InputBase
|
|
1868
1867
|
id="receiver"
|
|
1869
1868
|
sx={classes.inputAmountText}
|
|
1870
|
-
type="number"
|
|
1869
|
+
//type="number"
|
|
1871
1870
|
required
|
|
1872
1871
|
value={receivedValue}
|
|
1873
1872
|
disabled={true}
|
|
@@ -1937,7 +1936,7 @@ class Calculator extends Component {
|
|
|
1937
1936
|
)[0]
|
|
1938
1937
|
}
|
|
1939
1938
|
autoHighlight
|
|
1940
|
-
|
|
1939
|
+
getOptionLabel={(option) => `${option.currency}`}
|
|
1941
1940
|
renderOption={(props, option) => (
|
|
1942
1941
|
<Box component="li" {...props}>
|
|
1943
1942
|
<span style={{ marginRight: "5px" }}>
|
|
@@ -2024,7 +2023,7 @@ class Calculator extends Component {
|
|
|
2024
2023
|
{this.state.hasValidCoupon && (plus != null && plus != 'undefined' && plus != 0) &&
|
|
2025
2024
|
<Grid>
|
|
2026
2025
|
<p
|
|
2027
|
-
|
|
2026
|
+
sx={{
|
|
2028
2027
|
textAlign: "center",
|
|
2029
2028
|
}}
|
|
2030
2029
|
>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import en from "../locale/en";
|
|
2
2
|
import es from "../locale/es";
|
|
3
|
-
import
|
|
3
|
+
import Alert from '@mui/material/Alert';
|
|
4
|
+
import Typography from '@mui/material/Typography';
|
|
4
5
|
import Grid from '@mui/material/Grid2';
|
|
5
6
|
import { useEffect, useState } from "react";
|
|
6
7
|
import { SimulatorMode, TransferType } from "../model/enums";
|
package/src/components/fees.jsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Divider from '@mui/material/Divider';
|
|
2
|
+
import Typography from '@mui/material/Typography';
|
|
2
3
|
import Grid from '@mui/material/Grid2';
|
|
3
4
|
import { SimulatorMode } from "../model/enums";
|
|
4
5
|
import { useEffect, useState } from "react";
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
CircularProgress,
|
|
11
|
-
InputAdornment,
|
|
12
|
-
TextField,
|
|
13
|
-
FormHelperText,
|
|
14
|
-
Autocomplete
|
|
15
|
-
} from '@mui/material';
|
|
1
|
+
import Autocomplete from '@mui/material/Autocomplete';
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
|
4
|
+
import FormHelperText from '@mui/material/FormHelperText';
|
|
5
|
+
import InputAdornment from '@mui/material/InputAdornment';
|
|
6
|
+
import InputBase from '@mui/material/InputBase';
|
|
7
|
+
import Paper from '@mui/material/Paper';
|
|
8
|
+
import TextField from '@mui/material/TextField';
|
|
9
|
+
import Typography from '@mui/material/Typography';
|
|
16
10
|
import Grid from '@mui/material/Grid2';
|
|
17
11
|
import FlagsHelpers from "./../helpers/flagsHelpers";
|
|
18
12
|
import { matchSorter } from "match-sorter";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { makeStyles } from '@mui/styles';
|
|
2
2
|
import { createTheme } from '@mui/material/styles';
|
|
3
3
|
|
|
4
|
-
// Crear un tema para usar con makeStyles
|
|
5
4
|
const theme = createTheme();
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
export const simulatorStyles = makeStyles(() => ({
|
|
7
7
|
// 'input[type=number]::-webkit-outer-spin-button': {
|
|
8
8
|
// '-webkit-appearance': 'none',
|
|
9
9
|
// margin: 0
|
package/src/data/countries.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const countries = [
|
|
2
|
-
{ code: "
|
|
2
|
+
{ code: "WLT", label: "WALLET", prefix: "+1", currency: "USDT" },
|
|
3
3
|
{ code: "PAYPAL", label: "PAYPAL", prefix: "+1", currency: "USD" },
|
|
4
|
+
{ code: "USDT",label: "USDT",prefix: "+1", currency: "USDT" },
|
|
4
5
|
{ code: "AD", label: "Andorra", prefix: "+376" },
|
|
5
6
|
{ code: "AE", label: "United Arab Emirates", prefix: "+971" },
|
|
6
7
|
{ code: "AF", label: "Afghanistan", prefix: "+93" },
|
|
@@ -6,7 +6,7 @@ const FlagsHelpers = (props) => {
|
|
|
6
6
|
if (code == "ach") code = "us";
|
|
7
7
|
|
|
8
8
|
let url = {
|
|
9
|
-
'
|
|
9
|
+
'wlt': 'https://images-traund.s3.amazonaws.com/payment-methods/Traund.svg',
|
|
10
10
|
'paypal': 'https://images-traund.s3.amazonaws.com/payment-methods/paypal.svg',
|
|
11
11
|
'usdt': 'https://images-traund.s3.amazonaws.com/payment-methods/Tether.svg',
|
|
12
12
|
'wise': 'https://images-traund.s3.amazonaws.com/payment-methods/Wise.svg',
|
package/src/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { ThemeProvider } from '@mui/material/styles';
|
|
3
3
|
import CssBaseline from '@mui/material/CssBaseline';
|
|
4
4
|
import theme from './theme';
|
|
5
|
-
import Calculator from "./
|
|
5
|
+
import Calculator from "./calculator";
|
|
6
6
|
import Simulator from "./simulator";
|
|
7
7
|
//import ModernCalculator from './calculate';
|
|
8
8
|
// Componente de orden superior para proveer el tema
|
package/src/simulator.js
CHANGED
|
@@ -1,23 +1,9 @@
|
|
|
1
1
|
import React, { useState, useEffect, useCallback, useRef, Fragment } from "react";
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Box,
|
|
8
|
-
Alert,
|
|
9
|
-
Paper,
|
|
10
|
-
InputBase,
|
|
11
|
-
CircularProgress,
|
|
12
|
-
InputAdornment,
|
|
13
|
-
TextField,
|
|
14
|
-
FormHelperText,
|
|
15
|
-
NativeSelect,
|
|
16
|
-
Tooltip,
|
|
17
|
-
Divider,
|
|
18
|
-
Chip,
|
|
19
|
-
Autocomplete
|
|
20
|
-
} from '@mui/material';
|
|
2
|
+
import Button from '@mui/material/Button';
|
|
3
|
+
import Typography from '@mui/material/Typography';
|
|
4
|
+
import Paper from '@mui/material/Paper';
|
|
5
|
+
import Divider from '@mui/material/Divider';
|
|
6
|
+
import Chip from '@mui/material/Chip';
|
|
21
7
|
import Grid from '@mui/material/Grid2';
|
|
22
8
|
import en from "./locale/en";
|
|
23
9
|
import es from "./locale/es";
|