@traund/orquezta-widget-calculator 1.0.2 → 1.0.4

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/module.js CHANGED
@@ -23,16 +23,13 @@ import {CircleFlag as $5OpyM$CircleFlag} from "react-circle-flags";
23
23
  import $5OpyM$cryptojs from "crypto-js";
24
24
  import $5OpyM$materialuicoreChip from "@material-ui/core/Chip";
25
25
  import $5OpyM$moment from "moment";
26
+ import "aws-sdk";
26
27
  import {extend as $5OpyM$extend} from "dayjs";
27
28
  import * as $5OpyM$dayjsbusinesstime from "dayjs-business-time";
28
29
  import "dayjs/plugin/utc";
29
30
  import $5OpyM$materialuicoreMenuItem from "@material-ui/core/MenuItem";
30
31
 
31
32
 
32
- function $parcel$interopDefault(a) {
33
- return a && a.__esModule ? a.default : a;
34
- }
35
-
36
33
 
37
34
 
38
35
 
@@ -2325,37 +2322,41 @@ const $49f826b4fff6422b$var$Timer = (props)=>{
2325
2322
  var $49f826b4fff6422b$export$2e2bcd8739ae039 = $49f826b4fff6422b$var$Timer;
2326
2323
 
2327
2324
 
2328
- var $6f87a65d2d16a22f$exports = {};
2329
2325
 
2330
2326
  class $6f87a65d2d16a22f$var$EndPoints {
2331
2327
  constructor(testMode = 'production', externalConfig = null){
2332
2328
  this._testMode = testMode;
2333
- this.baseUrl = externalConfig && externalConfig.url;
2329
+ this.baseUrl = externalConfig?.backendUrl;
2334
2330
  this.path_managment_operations = `${this.baseUrl}/handle-operations`;
2335
2331
  }
2336
- /*get HEADERS() {
2337
- return this.baseUrl = BACKEND_SETTINGS[this._testMode].HEADERS;
2338
- };*/ get COUPON() {
2332
+ get CALLBACK() {
2339
2333
  return {
2340
- validate: `${this.path_managment_operations}/coupon/v1/validate`
2334
+ landing_transfer: (baseUrl, locale)=>`${baseUrl}/${locale}/send`,
2335
+ landing_receive: (baseUrl, locale)=>`${baseUrl}/${locale}/receive`,
2336
+ landing_wallet: (baseUrl, locale)=>`${baseUrl}/${locale}/wallet`,
2337
+ referral_transfer: (baseUrl, locale, storeId)=>`${baseUrl}/${locale}/login?referral=operation&type=transfer&reference=${storeId}`,
2338
+ referral_receive: (baseUrl, locale, storeId)=>`${baseUrl}/${locale}/login?referral=operation&type=pay&reference=${storeId}`,
2339
+ referral_recharge: (baseUrl, locale, storeId)=>`${baseUrl}/${locale}/login?referral=operation&type=recharge&reference=${storeId}`
2341
2340
  };
2342
2341
  }
2343
- get TRANSACTION() {
2342
+ get OPERATIONS() {
2344
2343
  return {
2345
- calculate: `${this.path_managment_operations}/transaction/v1/calculate`,
2346
- calculate_v2: (storeId, source)=>`${this.path_managment_operations}/calculate/v1/update/${storeId}/${source}`
2344
+ calculate: (storeId, source)=>`${this.path_managment_operations}/calculate/v1/update/${storeId}/${source}`,
2345
+ validateCoupon: `${this.path_managment_operations}/coupon/v1/validate`
2347
2346
  };
2348
2347
  }
2349
- get CALCULATOR() {
2348
+ get EXCHANGE() {
2350
2349
  return {
2351
- exchangeRate: `https://api.exchangerate.host/convert?from=USD&to=`,
2352
- exchangeRatev2: 'https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/usd.json',
2353
- exchangeBlue: `https://api.bluelytics.com.ar/v2/latest`,
2354
- convert: `https://api.exchangerate.host/convert?from=USD&to=`
2350
+ getRate: (currencyFrom, currencyTo)=>`https://api.exchangerate.host/convert?from=${currencyFrom}&to=${currencyTo}`,
2351
+ getRate_bk_1: (currencyFrom, currencyTo)=>`https://api-us.exchangerate.host/convert?from=${currencyFrom}&to=${currencyTo}`,
2352
+ getRate_bk_2: (currencyFrom, currencyTo)=>`https://api-eu.exchangerate.host/convert?from=${currencyFrom}&to=${currencyTo}`,
2353
+ getRate_v2: (currencyFrom)=>`https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/${currencyFrom.toLowerCase()}.json`,
2354
+ getRate_v3: (currencyFrom, currencyTo)=>`https://cdnhlp-staging.traund.xyz/rates/v1/${currencyFrom}/${currencyTo}`,
2355
+ getUSDBlueRate: `https://api.bluelytics.com.ar/v2/latest`
2355
2356
  };
2356
2357
  }
2357
2358
  }
2358
- $6f87a65d2d16a22f$exports = $6f87a65d2d16a22f$var$EndPoints;
2359
+ var $6f87a65d2d16a22f$export$2e2bcd8739ae039 = $6f87a65d2d16a22f$var$EndPoints;
2359
2360
 
2360
2361
 
2361
2362
 
@@ -2537,7 +2538,7 @@ class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
2537
2538
  taxSender: 0.00,
2538
2539
  taxReceiver: 0.00
2539
2540
  };
2540
- ENDPOINTS = new (0, (/*@__PURE__*/$parcel$interopDefault($6f87a65d2d16a22f$exports)))(this.state.testMode, this.state.config);
2541
+ ENDPOINTS = new (0, $6f87a65d2d16a22f$export$2e2bcd8739ae039)(this.state.testMode, this.state.config);
2541
2542
  constructor(props){
2542
2543
  super(props);
2543
2544
  this.unsubscribe = [];
@@ -2700,14 +2701,14 @@ class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
2700
2701
  _convertAmount = async (currency)=>{
2701
2702
  try {
2702
2703
  if (currency == "ARS") {
2703
- const { data: data } = await (0, $5OpyM$axios).get(`${this.ENDPOINTS.CALCULATOR.exchangeBlue}`);
2704
+ const { data: data } = await (0, $5OpyM$axios).get(`${this.ENDPOINTS.EXCHANGE.getUSDBlueRate}`);
2704
2705
  let blueRate = await JSON.parse(JSON.stringify(data));
2705
2706
  blueRate = {
2706
2707
  result: blueRate.blue.value_sell
2707
2708
  };
2708
2709
  return blueRate;
2709
2710
  } else {
2710
- const { data: data } = await (0, $5OpyM$axios).get(`${this.ENDPOINTS.CALCULATOR.exchangeRatev2}`);
2711
+ const { data: data } = await (0, $5OpyM$axios).get(`${this.ENDPOINTS.EXCHANGE.getRate_v2(currency)}`);
2711
2712
  return {
2712
2713
  result: parseFloat(data['usd'][currency.toLowerCase()].toFixed(2))
2713
2714
  };
@@ -3033,7 +3034,7 @@ class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
3033
3034
  }
3034
3035
  };
3035
3036
  if (source == "initial" || source == "end") {
3036
- const url = this.ENDPOINTS.TRANSACTION.calculate_v2(this.state.storeId || sessionStorage.getItem('storeId'), "from");
3037
+ const url = this.ENDPOINTS.OPERATIONS.calculate(this.state.storeId || sessionStorage.getItem('storeId'), "from");
3037
3038
  const res = await (0, $5OpyM$axios).post(url, model, {
3038
3039
  headers: {
3039
3040
  "x-api-access-sig": (0, $be7f9e5745d99d09$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference)
@@ -3074,7 +3075,7 @@ class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
3074
3075
  if (source == "to") this.setState({
3075
3076
  sendValue: ""
3076
3077
  });
3077
- const url = this.ENDPOINTS.TRANSACTION.calculate_v2(this.state.storeId, source);
3078
+ const url = this.ENDPOINTS.OPERATIONS.calculate(this.state.storeId, source);
3078
3079
  const res = await (0, $5OpyM$axios).post(url, model, {
3079
3080
  headers: {
3080
3081
  "x-api-access-sig": (0, $be7f9e5745d99d09$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference)
@@ -3261,7 +3262,7 @@ class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
3261
3262
  plus: 0
3262
3263
  });
3263
3264
  //if (db) db.clearPersistence();
3264
- const firebase = await (0, $9ea2f2608ea58c4b$export$2e2bcd8739ae039)(this.state.testMode);
3265
+ const firebase = await (0, $9ea2f2608ea58c4b$export$2e2bcd8739ae039)(this.state.testMode, this.state.config);
3265
3266
  const db = firebase.firestore();
3266
3267
  if (this.state.couponRedeemed && this.state.couponValue != "") try {
3267
3268
  const userFS = await db.collection("transactions").doc(this.state.storeId).update({
@@ -3309,7 +3310,7 @@ class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
3309
3310
  return valid;
3310
3311
  };
3311
3312
  validateCoupon = async (cupon)=>{
3312
- const url = `${this.ENDPOINTS.COUPON.validate}/${cupon}`;
3313
+ const url = `${this.ENDPOINTS.OPERATIONS.validateCoupon}/${cupon}`;
3313
3314
  try {
3314
3315
  const response = await (0, $5OpyM$axios).get(url, {
3315
3316
  headers: {
@@ -4675,45 +4676,6 @@ var $e8a8a43586c972c2$export$2e2bcd8739ae039 = $e8a8a43586c972c2$var$Calculator;
4675
4676
 
4676
4677
 
4677
4678
 
4678
- class $c2624340fd589f7f$var$EndPoints {
4679
- constructor(testMode = 'production'){
4680
- this._testMode = testMode;
4681
- this.baseUrl = (0, $c8082d1fff4ed783$export$7dfd6b97707a3d55)[this._testMode].URL;
4682
- this.path_managment_operations = `${this.baseUrl}/handle-operations`;
4683
- }
4684
- get HEADERS() {
4685
- return this.baseUrl = (0, $c8082d1fff4ed783$export$7dfd6b97707a3d55)[this._testMode].HEADERS;
4686
- }
4687
- get CALLBACK() {
4688
- return {
4689
- landing_transfer: (baseUrl, locale)=>`${baseUrl}/${locale}/send`,
4690
- landing_receive: (baseUrl, locale)=>`${baseUrl}/${locale}/receive`,
4691
- landing_wallet: (baseUrl, locale)=>`${baseUrl}/${locale}/wallet`,
4692
- referral_transfer: (baseUrl, locale, storeId)=>`${baseUrl}/${locale}/login?referral=operation&type=transfer&reference=${storeId}`,
4693
- referral_receive: (baseUrl, locale, storeId)=>`${baseUrl}/${locale}/login?referral=operation&type=pay&reference=${storeId}`,
4694
- referral_recharge: (baseUrl, locale, storeId)=>`${baseUrl}/${locale}/login?referral=operation&type=recharge&reference=${storeId}`
4695
- };
4696
- }
4697
- get OPERATIONS() {
4698
- return {
4699
- calculate: (storeId, source)=>`${this.path_managment_operations}/calculate/v1/update/${storeId}/${source}`,
4700
- validateCoupon: `${this.path_managment_operations}/coupon/v1/validate`
4701
- };
4702
- }
4703
- get EXCHANGE() {
4704
- return {
4705
- getRate: (currencyFrom, currencyTo)=>`https://api.exchangerate.host/convert?from=${currencyFrom}&to=${currencyTo}`,
4706
- getRate_bk_1: (currencyFrom, currencyTo)=>`https://api-us.exchangerate.host/convert?from=${currencyFrom}&to=${currencyTo}`,
4707
- getRate_bk_2: (currencyFrom, currencyTo)=>`https://api-eu.exchangerate.host/convert?from=${currencyFrom}&to=${currencyTo}`,
4708
- getRate_v2: (currencyFrom)=>`https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/${currencyFrom.toLowerCase()}.json`,
4709
- getRate_v3: (currencyFrom, currencyTo)=>`https://cdnhlp-staging.traund.xyz/rates/v1/${currencyFrom}/${currencyTo}`,
4710
- getUSDBlueRate: `https://api.bluelytics.com.ar/v2/latest`
4711
- };
4712
- }
4713
- }
4714
- var $c2624340fd589f7f$export$2e2bcd8739ae039 = $c2624340fd589f7f$var$EndPoints;
4715
-
4716
-
4717
4679
  const $3217af864b2b4eed$export$1b5eb083c754a86b = Object.freeze({
4718
4680
  COUNTRY: "country",
4719
4681
  WALLET: "wallet",
@@ -4843,8 +4805,8 @@ var $ee6357194386215f$export$2e2bcd8739ae039 = $ee6357194386215f$var$TransferUse
4843
4805
 
4844
4806
 
4845
4807
  class $9ac168cb9a22c932$var$RateHelper {
4846
- constructor(testMode = 'production'){
4847
- this.endpoints = new (0, $c2624340fd589f7f$export$2e2bcd8739ae039)(testMode);
4808
+ constructor(testMode = 'production', externalConfig = null){
4809
+ this.endpoints = new (0, $6f87a65d2d16a22f$export$2e2bcd8739ae039)(testMode, externalConfig);
4848
4810
  }
4849
4811
  async getExchangeRate(currencyFrom, currencyTo) {
4850
4812
  try {
@@ -4877,11 +4839,12 @@ var $9ac168cb9a22c932$export$2e2bcd8739ae039 = $9ac168cb9a22c932$var$RateHelper;
4877
4839
 
4878
4840
 
4879
4841
  class $006ea4d50140482f$var$CalculateHelper {
4880
- constructor(testMode = 'production'){
4842
+ constructor(testMode = 'production', config = null){
4881
4843
  this._testMode = testMode;
4844
+ this.config = config;
4882
4845
  }
4883
4846
  async getCaculateRates(countriesData) {
4884
- const rateHelper = new (0, $9ac168cb9a22c932$export$2e2bcd8739ae039)(this._testMode);
4847
+ const rateHelper = new (0, $9ac168cb9a22c932$export$2e2bcd8739ae039)(this._testMode, this.config);
4885
4848
  const middleCurrency = "USD";
4886
4849
  for(var key in countriesData)if (countriesData.hasOwnProperty(key)) {
4887
4850
  let itemCountry = countriesData[key];
@@ -5443,9 +5406,10 @@ function $6bf8ac1124443ad4$export$354ffc3468f9d23e(calculateType, day) {
5443
5406
 
5444
5407
 
5445
5408
 
5409
+
5446
5410
  class $aeba0491dead64b0$var$OperationsHelper {
5447
- constructor(testMode = 'production', secretKey = null){
5448
- this.endpoints = new (0, $c2624340fd589f7f$export$2e2bcd8739ae039)(testMode);
5411
+ constructor(testMode = 'production', secretKey = null, config = null){
5412
+ this.endpoints = new (0, $6f87a65d2d16a22f$export$2e2bcd8739ae039)(testMode, config);
5449
5413
  this.reference = secretKey;
5450
5414
  this.FEES = {
5451
5415
  "ach": {
@@ -7056,9 +7020,9 @@ function $c4ee7a827d19e0d2$var$Simulator(props) {
7056
7020
  */ const { locale: locale, pathname: pathname, locales: locales } = props;
7057
7021
  const content = locale === "es" ? (0, $af3f68c5ac2f1e3c$export$2e2bcd8739ae039) : (0, $18d8bd1c5cecbd36$export$2e2bcd8739ae039);
7058
7022
  const classes = $c4ee7a827d19e0d2$var$useStyles();
7059
- const __ENDPOINTS = new (0, $c2624340fd589f7f$export$2e2bcd8739ae039)(props.testMode);
7060
- const __calculateHelper = new (0, $006ea4d50140482f$export$2e2bcd8739ae039)(props.testMode);
7061
- const __operationsHelper = new (0, $aeba0491dead64b0$export$2e2bcd8739ae039)(props.testMode, props.reference);
7023
+ const __ENDPOINTS = new (0, $6f87a65d2d16a22f$export$2e2bcd8739ae039)(props.testMode, props.config);
7024
+ const __calculateHelper = new (0, $006ea4d50140482f$export$2e2bcd8739ae039)(props.testMode, props.config);
7025
+ const __operationsHelper = new (0, $aeba0491dead64b0$export$2e2bcd8739ae039)(props.testMode, props.reference, props.config);
7062
7026
  const __firebase = (0, $9ea2f2608ea58c4b$export$2e2bcd8739ae039)(props.testMode, props.config);
7063
7027
  const [simulatorMode, setSimulatorMode] = (0, $5OpyM$useState)((0, $3217af864b2b4eed$export$e3d7a3ffb08d3f7a).SEND);
7064
7028
  const [suscribedGlobalOptions, setSuscribedGlobalOptions] = (0, $5OpyM$useState)(false);