@traund/orquezta-widget-calculator 1.0.1 → 1.0.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.js +35 -69
- package/dist/index.js.map +1 -1
- package/dist/module.js +35 -73
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
- package/src/calculatorV2.js +7 -7
- package/src/core/endpoints.js +21 -17
- package/src/firebase.config.js +1 -1
- package/src/simulator.js +2 -2
- package/src/utils/operationsHelper.js +4 -3
- package/src/utils/rateHelper.js +3 -3
- package/src/core/endpointsv2.js +0 -44
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ var $gXNCa$reactcircleflags = require("react-circle-flags");
|
|
|
23
23
|
var $gXNCa$cryptojs = require("crypto-js");
|
|
24
24
|
var $gXNCa$materialuicoreChip = require("@material-ui/core/Chip");
|
|
25
25
|
var $gXNCa$moment = require("moment");
|
|
26
|
+
require("aws-sdk");
|
|
26
27
|
var $gXNCa$dayjs = require("dayjs");
|
|
27
28
|
var $gXNCa$dayjsbusinesstime = require("dayjs-business-time");
|
|
28
29
|
require("dayjs/plugin/utc");
|
|
@@ -1004,7 +1005,7 @@ const $9a120cc4db7b0570$var$loadFirebaseDB = (testMode = 'production', externalC
|
|
|
1004
1005
|
try {
|
|
1005
1006
|
let firebaseConfig;
|
|
1006
1007
|
if (externalConfig && externalConfig.provider) firebaseConfig = externalConfig.provider;
|
|
1007
|
-
else
|
|
1008
|
+
else return console.error('No Firebase configuration provided');
|
|
1008
1009
|
if ((0, ($parcel$interopDefault($gXNCa$firebaseapp))).apps.length === 0) (0, ($parcel$interopDefault($gXNCa$firebaseapp))).initializeApp(firebaseConfig);
|
|
1009
1010
|
} catch (error) {
|
|
1010
1011
|
if (!/already exist/.test(error.message)) console.error('Firebase initialization error', error.stack);
|
|
@@ -2332,38 +2333,41 @@ const $3641e36ddb9c1c48$var$Timer = (props)=>{
|
|
|
2332
2333
|
var $3641e36ddb9c1c48$export$2e2bcd8739ae039 = $3641e36ddb9c1c48$var$Timer;
|
|
2333
2334
|
|
|
2334
2335
|
|
|
2335
|
-
var $df8d2892fe6558f0$exports = {};
|
|
2336
2336
|
|
|
2337
2337
|
class $df8d2892fe6558f0$var$EndPoints {
|
|
2338
|
-
constructor(testMode = 'production'){
|
|
2338
|
+
constructor(testMode = 'production', externalConfig = null){
|
|
2339
2339
|
this._testMode = testMode;
|
|
2340
|
-
this.baseUrl =
|
|
2340
|
+
this.baseUrl = externalConfig && externalConfig.backendUrl;
|
|
2341
2341
|
this.path_managment_operations = `${this.baseUrl}/handle-operations`;
|
|
2342
2342
|
}
|
|
2343
|
-
get
|
|
2344
|
-
return this.baseUrl = (0, $d122f0ec366574ef$export$7dfd6b97707a3d55)[this._testMode].HEADERS;
|
|
2345
|
-
}
|
|
2346
|
-
get COUPON() {
|
|
2343
|
+
get CALLBACK() {
|
|
2347
2344
|
return {
|
|
2348
|
-
|
|
2345
|
+
landing_transfer: (baseUrl, locale)=>`${baseUrl}/${locale}/send`,
|
|
2346
|
+
landing_receive: (baseUrl, locale)=>`${baseUrl}/${locale}/receive`,
|
|
2347
|
+
landing_wallet: (baseUrl, locale)=>`${baseUrl}/${locale}/wallet`,
|
|
2348
|
+
referral_transfer: (baseUrl, locale, storeId)=>`${baseUrl}/${locale}/login?referral=operation&type=transfer&reference=${storeId}`,
|
|
2349
|
+
referral_receive: (baseUrl, locale, storeId)=>`${baseUrl}/${locale}/login?referral=operation&type=pay&reference=${storeId}`,
|
|
2350
|
+
referral_recharge: (baseUrl, locale, storeId)=>`${baseUrl}/${locale}/login?referral=operation&type=recharge&reference=${storeId}`
|
|
2349
2351
|
};
|
|
2350
2352
|
}
|
|
2351
|
-
get
|
|
2353
|
+
get OPERATIONS() {
|
|
2352
2354
|
return {
|
|
2353
|
-
calculate:
|
|
2354
|
-
|
|
2355
|
+
calculate: (storeId, source)=>`${this.path_managment_operations}/calculate/v1/update/${storeId}/${source}`,
|
|
2356
|
+
validateCoupon: `${this.path_managment_operations}/coupon/v1/validate`
|
|
2355
2357
|
};
|
|
2356
2358
|
}
|
|
2357
|
-
get
|
|
2359
|
+
get EXCHANGE() {
|
|
2358
2360
|
return {
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2361
|
+
getRate: (currencyFrom, currencyTo)=>`https://api.exchangerate.host/convert?from=${currencyFrom}&to=${currencyTo}`,
|
|
2362
|
+
getRate_bk_1: (currencyFrom, currencyTo)=>`https://api-us.exchangerate.host/convert?from=${currencyFrom}&to=${currencyTo}`,
|
|
2363
|
+
getRate_bk_2: (currencyFrom, currencyTo)=>`https://api-eu.exchangerate.host/convert?from=${currencyFrom}&to=${currencyTo}`,
|
|
2364
|
+
getRate_v2: (currencyFrom)=>`https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/${currencyFrom.toLowerCase()}.json`,
|
|
2365
|
+
getRate_v3: (currencyFrom, currencyTo)=>`https://cdnhlp-staging.traund.xyz/rates/v1/${currencyFrom}/${currencyTo}`,
|
|
2366
|
+
getUSDBlueRate: `https://api.bluelytics.com.ar/v2/latest`
|
|
2363
2367
|
};
|
|
2364
2368
|
}
|
|
2365
2369
|
}
|
|
2366
|
-
$df8d2892fe6558f0$
|
|
2370
|
+
var $df8d2892fe6558f0$export$2e2bcd8739ae039 = $df8d2892fe6558f0$var$EndPoints;
|
|
2367
2371
|
|
|
2368
2372
|
|
|
2369
2373
|
|
|
@@ -2545,7 +2549,7 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
|
|
|
2545
2549
|
taxSender: 0.00,
|
|
2546
2550
|
taxReceiver: 0.00
|
|
2547
2551
|
};
|
|
2548
|
-
ENDPOINTS = new (0,
|
|
2552
|
+
ENDPOINTS = new (0, $df8d2892fe6558f0$export$2e2bcd8739ae039)(this.state.testMode, this.state.config);
|
|
2549
2553
|
constructor(props){
|
|
2550
2554
|
super(props);
|
|
2551
2555
|
this.unsubscribe = [];
|
|
@@ -2708,14 +2712,14 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
|
|
|
2708
2712
|
_convertAmount = async (currency)=>{
|
|
2709
2713
|
try {
|
|
2710
2714
|
if (currency == "ARS") {
|
|
2711
|
-
const { data: data } = await (0, ($parcel$interopDefault($gXNCa$axios))).get(`${this.ENDPOINTS.
|
|
2715
|
+
const { data: data } = await (0, ($parcel$interopDefault($gXNCa$axios))).get(`${this.ENDPOINTS.EXCHANGE.getUSDBlueRate}`);
|
|
2712
2716
|
let blueRate = await JSON.parse(JSON.stringify(data));
|
|
2713
2717
|
blueRate = {
|
|
2714
2718
|
result: blueRate.blue.value_sell
|
|
2715
2719
|
};
|
|
2716
2720
|
return blueRate;
|
|
2717
2721
|
} else {
|
|
2718
|
-
const { data: data } = await (0, ($parcel$interopDefault($gXNCa$axios))).get(`${this.ENDPOINTS.
|
|
2722
|
+
const { data: data } = await (0, ($parcel$interopDefault($gXNCa$axios))).get(`${this.ENDPOINTS.EXCHANGE.getRate_v2(currency)}`);
|
|
2719
2723
|
return {
|
|
2720
2724
|
result: parseFloat(data['usd'][currency.toLowerCase()].toFixed(2))
|
|
2721
2725
|
};
|
|
@@ -3041,7 +3045,7 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
|
|
|
3041
3045
|
}
|
|
3042
3046
|
};
|
|
3043
3047
|
if (source == "initial" || source == "end") {
|
|
3044
|
-
const url = this.ENDPOINTS.
|
|
3048
|
+
const url = this.ENDPOINTS.OPERATIONS.calculate(this.state.storeId || sessionStorage.getItem('storeId'), "from");
|
|
3045
3049
|
const res = await (0, ($parcel$interopDefault($gXNCa$axios))).post(url, model, {
|
|
3046
3050
|
headers: {
|
|
3047
3051
|
"x-api-access-sig": (0, $7960feb2a8e3e0c6$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference)
|
|
@@ -3082,7 +3086,7 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
|
|
|
3082
3086
|
if (source == "to") this.setState({
|
|
3083
3087
|
sendValue: ""
|
|
3084
3088
|
});
|
|
3085
|
-
const url = this.ENDPOINTS.
|
|
3089
|
+
const url = this.ENDPOINTS.OPERATIONS.calculate(this.state.storeId, source);
|
|
3086
3090
|
const res = await (0, ($parcel$interopDefault($gXNCa$axios))).post(url, model, {
|
|
3087
3091
|
headers: {
|
|
3088
3092
|
"x-api-access-sig": (0, $7960feb2a8e3e0c6$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference)
|
|
@@ -3269,7 +3273,7 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
|
|
|
3269
3273
|
plus: 0
|
|
3270
3274
|
});
|
|
3271
3275
|
//if (db) db.clearPersistence();
|
|
3272
|
-
const firebase = await (0, $9a120cc4db7b0570$export$2e2bcd8739ae039)(this.state.testMode);
|
|
3276
|
+
const firebase = await (0, $9a120cc4db7b0570$export$2e2bcd8739ae039)(this.state.testMode, this.state.config);
|
|
3273
3277
|
const db = firebase.firestore();
|
|
3274
3278
|
if (this.state.couponRedeemed && this.state.couponValue != "") try {
|
|
3275
3279
|
const userFS = await db.collection("transactions").doc(this.state.storeId).update({
|
|
@@ -3317,7 +3321,7 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
|
|
|
3317
3321
|
return valid;
|
|
3318
3322
|
};
|
|
3319
3323
|
validateCoupon = async (cupon)=>{
|
|
3320
|
-
const url = `${this.ENDPOINTS.
|
|
3324
|
+
const url = `${this.ENDPOINTS.OPERATIONS.validateCoupon}/${cupon}`;
|
|
3321
3325
|
try {
|
|
3322
3326
|
const response = await (0, ($parcel$interopDefault($gXNCa$axios))).get(url, {
|
|
3323
3327
|
headers: {
|
|
@@ -4683,45 +4687,6 @@ var $c530beedeaeedc25$export$2e2bcd8739ae039 = $c530beedeaeedc25$var$Calculator;
|
|
|
4683
4687
|
|
|
4684
4688
|
|
|
4685
4689
|
|
|
4686
|
-
class $a67ff3d39107eba0$var$EndPoints {
|
|
4687
|
-
constructor(testMode = 'production'){
|
|
4688
|
-
this._testMode = testMode;
|
|
4689
|
-
this.baseUrl = (0, $d122f0ec366574ef$export$7dfd6b97707a3d55)[this._testMode].URL;
|
|
4690
|
-
this.path_managment_operations = `${this.baseUrl}/handle-operations`;
|
|
4691
|
-
}
|
|
4692
|
-
get HEADERS() {
|
|
4693
|
-
return this.baseUrl = (0, $d122f0ec366574ef$export$7dfd6b97707a3d55)[this._testMode].HEADERS;
|
|
4694
|
-
}
|
|
4695
|
-
get CALLBACK() {
|
|
4696
|
-
return {
|
|
4697
|
-
landing_transfer: (baseUrl, locale)=>`${baseUrl}/${locale}/send`,
|
|
4698
|
-
landing_receive: (baseUrl, locale)=>`${baseUrl}/${locale}/receive`,
|
|
4699
|
-
landing_wallet: (baseUrl, locale)=>`${baseUrl}/${locale}/wallet`,
|
|
4700
|
-
referral_transfer: (baseUrl, locale, storeId)=>`${baseUrl}/${locale}/login?referral=operation&type=transfer&reference=${storeId}`,
|
|
4701
|
-
referral_receive: (baseUrl, locale, storeId)=>`${baseUrl}/${locale}/login?referral=operation&type=pay&reference=${storeId}`,
|
|
4702
|
-
referral_recharge: (baseUrl, locale, storeId)=>`${baseUrl}/${locale}/login?referral=operation&type=recharge&reference=${storeId}`
|
|
4703
|
-
};
|
|
4704
|
-
}
|
|
4705
|
-
get OPERATIONS() {
|
|
4706
|
-
return {
|
|
4707
|
-
calculate: (storeId, source)=>`${this.path_managment_operations}/calculate/v1/update/${storeId}/${source}`,
|
|
4708
|
-
validateCoupon: `${this.path_managment_operations}/coupon/v1/validate`
|
|
4709
|
-
};
|
|
4710
|
-
}
|
|
4711
|
-
get EXCHANGE() {
|
|
4712
|
-
return {
|
|
4713
|
-
getRate: (currencyFrom, currencyTo)=>`https://api.exchangerate.host/convert?from=${currencyFrom}&to=${currencyTo}`,
|
|
4714
|
-
getRate_bk_1: (currencyFrom, currencyTo)=>`https://api-us.exchangerate.host/convert?from=${currencyFrom}&to=${currencyTo}`,
|
|
4715
|
-
getRate_bk_2: (currencyFrom, currencyTo)=>`https://api-eu.exchangerate.host/convert?from=${currencyFrom}&to=${currencyTo}`,
|
|
4716
|
-
getRate_v2: (currencyFrom)=>`https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/${currencyFrom.toLowerCase()}.json`,
|
|
4717
|
-
getRate_v3: (currencyFrom, currencyTo)=>`https://cdnhlp-staging.traund.xyz/rates/v1/${currencyFrom}/${currencyTo}`,
|
|
4718
|
-
getUSDBlueRate: `https://api.bluelytics.com.ar/v2/latest`
|
|
4719
|
-
};
|
|
4720
|
-
}
|
|
4721
|
-
}
|
|
4722
|
-
var $a67ff3d39107eba0$export$2e2bcd8739ae039 = $a67ff3d39107eba0$var$EndPoints;
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
4690
|
const $ee1f0011b010ab9b$export$1b5eb083c754a86b = Object.freeze({
|
|
4726
4691
|
COUNTRY: "country",
|
|
4727
4692
|
WALLET: "wallet",
|
|
@@ -4851,8 +4816,8 @@ var $038472bfc14c3e81$export$2e2bcd8739ae039 = $038472bfc14c3e81$var$TransferUse
|
|
|
4851
4816
|
|
|
4852
4817
|
|
|
4853
4818
|
class $6e789b3bd17f4496$var$RateHelper {
|
|
4854
|
-
constructor(testMode = 'production'){
|
|
4855
|
-
this.endpoints = new (0, $
|
|
4819
|
+
constructor(testMode = 'production', externalConfig = null){
|
|
4820
|
+
this.endpoints = new (0, $df8d2892fe6558f0$export$2e2bcd8739ae039)(testMode, externalConfig.backendUrl);
|
|
4856
4821
|
}
|
|
4857
4822
|
async getExchangeRate(currencyFrom, currencyTo) {
|
|
4858
4823
|
try {
|
|
@@ -5451,9 +5416,10 @@ function $5d6e781e59e50d37$export$354ffc3468f9d23e(calculateType, day) {
|
|
|
5451
5416
|
|
|
5452
5417
|
|
|
5453
5418
|
|
|
5419
|
+
|
|
5454
5420
|
class $c0c7909cfff012a2$var$OperationsHelper {
|
|
5455
|
-
constructor(testMode = 'production', secretKey = null){
|
|
5456
|
-
this.endpoints = new (0, $
|
|
5421
|
+
constructor(testMode = 'production', secretKey = null, config = null){
|
|
5422
|
+
this.endpoints = new (0, $df8d2892fe6558f0$export$2e2bcd8739ae039)(testMode, config.backendUrl);
|
|
5457
5423
|
this.reference = secretKey;
|
|
5458
5424
|
this.FEES = {
|
|
5459
5425
|
"ach": {
|
|
@@ -7064,7 +7030,7 @@ function $d3c2b8c012a239f6$var$Simulator(props) {
|
|
|
7064
7030
|
*/ const { locale: locale, pathname: pathname, locales: locales } = props;
|
|
7065
7031
|
const content = locale === "es" ? (0, $6741b883ab744742$export$2e2bcd8739ae039) : (0, $d439b0ecd58343d0$export$2e2bcd8739ae039);
|
|
7066
7032
|
const classes = $d3c2b8c012a239f6$var$useStyles();
|
|
7067
|
-
const __ENDPOINTS = new (0, $
|
|
7033
|
+
const __ENDPOINTS = new (0, $df8d2892fe6558f0$export$2e2bcd8739ae039)(props.testMode, props.config?.backendUrl);
|
|
7068
7034
|
const __calculateHelper = new (0, $fe71048abacacae0$export$2e2bcd8739ae039)(props.testMode);
|
|
7069
7035
|
const __operationsHelper = new (0, $c0c7909cfff012a2$export$2e2bcd8739ae039)(props.testMode, props.reference);
|
|
7070
7036
|
const __firebase = (0, $9a120cc4db7b0570$export$2e2bcd8739ae039)(props.testMode, props.config);
|