@traund/orquezta-widget-calculator 1.0.2 → 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 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");
@@ -2332,37 +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
2338
  constructor(testMode = 'production', externalConfig = null){
2339
2339
  this._testMode = testMode;
2340
- this.baseUrl = externalConfig && externalConfig.url;
2340
+ this.baseUrl = externalConfig && externalConfig.backendUrl;
2341
2341
  this.path_managment_operations = `${this.baseUrl}/handle-operations`;
2342
2342
  }
2343
- /*get HEADERS() {
2344
- return this.baseUrl = BACKEND_SETTINGS[this._testMode].HEADERS;
2345
- };*/ get COUPON() {
2343
+ get CALLBACK() {
2346
2344
  return {
2347
- validate: `${this.path_managment_operations}/coupon/v1/validate`
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}`
2348
2351
  };
2349
2352
  }
2350
- get TRANSACTION() {
2353
+ get OPERATIONS() {
2351
2354
  return {
2352
- calculate: `${this.path_managment_operations}/transaction/v1/calculate`,
2353
- calculate_v2: (storeId, source)=>`${this.path_managment_operations}/calculate/v1/update/${storeId}/${source}`
2355
+ calculate: (storeId, source)=>`${this.path_managment_operations}/calculate/v1/update/${storeId}/${source}`,
2356
+ validateCoupon: `${this.path_managment_operations}/coupon/v1/validate`
2354
2357
  };
2355
2358
  }
2356
- get CALCULATOR() {
2359
+ get EXCHANGE() {
2357
2360
  return {
2358
- exchangeRate: `https://api.exchangerate.host/convert?from=USD&to=`,
2359
- exchangeRatev2: 'https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/usd.json',
2360
- exchangeBlue: `https://api.bluelytics.com.ar/v2/latest`,
2361
- convert: `https://api.exchangerate.host/convert?from=USD&to=`
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`
2362
2367
  };
2363
2368
  }
2364
2369
  }
2365
- $df8d2892fe6558f0$exports = $df8d2892fe6558f0$var$EndPoints;
2370
+ var $df8d2892fe6558f0$export$2e2bcd8739ae039 = $df8d2892fe6558f0$var$EndPoints;
2366
2371
 
2367
2372
 
2368
2373
 
@@ -2544,7 +2549,7 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
2544
2549
  taxSender: 0.00,
2545
2550
  taxReceiver: 0.00
2546
2551
  };
2547
- ENDPOINTS = new (0, (/*@__PURE__*/$parcel$interopDefault($df8d2892fe6558f0$exports)))(this.state.testMode, this.state.config);
2552
+ ENDPOINTS = new (0, $df8d2892fe6558f0$export$2e2bcd8739ae039)(this.state.testMode, this.state.config);
2548
2553
  constructor(props){
2549
2554
  super(props);
2550
2555
  this.unsubscribe = [];
@@ -2707,14 +2712,14 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
2707
2712
  _convertAmount = async (currency)=>{
2708
2713
  try {
2709
2714
  if (currency == "ARS") {
2710
- const { data: data } = await (0, ($parcel$interopDefault($gXNCa$axios))).get(`${this.ENDPOINTS.CALCULATOR.exchangeBlue}`);
2715
+ const { data: data } = await (0, ($parcel$interopDefault($gXNCa$axios))).get(`${this.ENDPOINTS.EXCHANGE.getUSDBlueRate}`);
2711
2716
  let blueRate = await JSON.parse(JSON.stringify(data));
2712
2717
  blueRate = {
2713
2718
  result: blueRate.blue.value_sell
2714
2719
  };
2715
2720
  return blueRate;
2716
2721
  } else {
2717
- const { data: data } = await (0, ($parcel$interopDefault($gXNCa$axios))).get(`${this.ENDPOINTS.CALCULATOR.exchangeRatev2}`);
2722
+ const { data: data } = await (0, ($parcel$interopDefault($gXNCa$axios))).get(`${this.ENDPOINTS.EXCHANGE.getRate_v2(currency)}`);
2718
2723
  return {
2719
2724
  result: parseFloat(data['usd'][currency.toLowerCase()].toFixed(2))
2720
2725
  };
@@ -3040,7 +3045,7 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
3040
3045
  }
3041
3046
  };
3042
3047
  if (source == "initial" || source == "end") {
3043
- const url = this.ENDPOINTS.TRANSACTION.calculate_v2(this.state.storeId || sessionStorage.getItem('storeId'), "from");
3048
+ const url = this.ENDPOINTS.OPERATIONS.calculate(this.state.storeId || sessionStorage.getItem('storeId'), "from");
3044
3049
  const res = await (0, ($parcel$interopDefault($gXNCa$axios))).post(url, model, {
3045
3050
  headers: {
3046
3051
  "x-api-access-sig": (0, $7960feb2a8e3e0c6$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference)
@@ -3081,7 +3086,7 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
3081
3086
  if (source == "to") this.setState({
3082
3087
  sendValue: ""
3083
3088
  });
3084
- const url = this.ENDPOINTS.TRANSACTION.calculate_v2(this.state.storeId, source);
3089
+ const url = this.ENDPOINTS.OPERATIONS.calculate(this.state.storeId, source);
3085
3090
  const res = await (0, ($parcel$interopDefault($gXNCa$axios))).post(url, model, {
3086
3091
  headers: {
3087
3092
  "x-api-access-sig": (0, $7960feb2a8e3e0c6$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference)
@@ -3268,7 +3273,7 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
3268
3273
  plus: 0
3269
3274
  });
3270
3275
  //if (db) db.clearPersistence();
3271
- const firebase = await (0, $9a120cc4db7b0570$export$2e2bcd8739ae039)(this.state.testMode);
3276
+ const firebase = await (0, $9a120cc4db7b0570$export$2e2bcd8739ae039)(this.state.testMode, this.state.config);
3272
3277
  const db = firebase.firestore();
3273
3278
  if (this.state.couponRedeemed && this.state.couponValue != "") try {
3274
3279
  const userFS = await db.collection("transactions").doc(this.state.storeId).update({
@@ -3316,7 +3321,7 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
3316
3321
  return valid;
3317
3322
  };
3318
3323
  validateCoupon = async (cupon)=>{
3319
- const url = `${this.ENDPOINTS.COUPON.validate}/${cupon}`;
3324
+ const url = `${this.ENDPOINTS.OPERATIONS.validateCoupon}/${cupon}`;
3320
3325
  try {
3321
3326
  const response = await (0, ($parcel$interopDefault($gXNCa$axios))).get(url, {
3322
3327
  headers: {
@@ -4682,45 +4687,6 @@ var $c530beedeaeedc25$export$2e2bcd8739ae039 = $c530beedeaeedc25$var$Calculator;
4682
4687
 
4683
4688
 
4684
4689
 
4685
- class $a67ff3d39107eba0$var$EndPoints {
4686
- constructor(testMode = 'production'){
4687
- this._testMode = testMode;
4688
- this.baseUrl = (0, $d122f0ec366574ef$export$7dfd6b97707a3d55)[this._testMode].URL;
4689
- this.path_managment_operations = `${this.baseUrl}/handle-operations`;
4690
- }
4691
- get HEADERS() {
4692
- return this.baseUrl = (0, $d122f0ec366574ef$export$7dfd6b97707a3d55)[this._testMode].HEADERS;
4693
- }
4694
- get CALLBACK() {
4695
- return {
4696
- landing_transfer: (baseUrl, locale)=>`${baseUrl}/${locale}/send`,
4697
- landing_receive: (baseUrl, locale)=>`${baseUrl}/${locale}/receive`,
4698
- landing_wallet: (baseUrl, locale)=>`${baseUrl}/${locale}/wallet`,
4699
- referral_transfer: (baseUrl, locale, storeId)=>`${baseUrl}/${locale}/login?referral=operation&type=transfer&reference=${storeId}`,
4700
- referral_receive: (baseUrl, locale, storeId)=>`${baseUrl}/${locale}/login?referral=operation&type=pay&reference=${storeId}`,
4701
- referral_recharge: (baseUrl, locale, storeId)=>`${baseUrl}/${locale}/login?referral=operation&type=recharge&reference=${storeId}`
4702
- };
4703
- }
4704
- get OPERATIONS() {
4705
- return {
4706
- calculate: (storeId, source)=>`${this.path_managment_operations}/calculate/v1/update/${storeId}/${source}`,
4707
- validateCoupon: `${this.path_managment_operations}/coupon/v1/validate`
4708
- };
4709
- }
4710
- get EXCHANGE() {
4711
- return {
4712
- getRate: (currencyFrom, currencyTo)=>`https://api.exchangerate.host/convert?from=${currencyFrom}&to=${currencyTo}`,
4713
- getRate_bk_1: (currencyFrom, currencyTo)=>`https://api-us.exchangerate.host/convert?from=${currencyFrom}&to=${currencyTo}`,
4714
- getRate_bk_2: (currencyFrom, currencyTo)=>`https://api-eu.exchangerate.host/convert?from=${currencyFrom}&to=${currencyTo}`,
4715
- getRate_v2: (currencyFrom)=>`https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/${currencyFrom.toLowerCase()}.json`,
4716
- getRate_v3: (currencyFrom, currencyTo)=>`https://cdnhlp-staging.traund.xyz/rates/v1/${currencyFrom}/${currencyTo}`,
4717
- getUSDBlueRate: `https://api.bluelytics.com.ar/v2/latest`
4718
- };
4719
- }
4720
- }
4721
- var $a67ff3d39107eba0$export$2e2bcd8739ae039 = $a67ff3d39107eba0$var$EndPoints;
4722
-
4723
-
4724
4690
  const $ee1f0011b010ab9b$export$1b5eb083c754a86b = Object.freeze({
4725
4691
  COUNTRY: "country",
4726
4692
  WALLET: "wallet",
@@ -4850,8 +4816,8 @@ var $038472bfc14c3e81$export$2e2bcd8739ae039 = $038472bfc14c3e81$var$TransferUse
4850
4816
 
4851
4817
 
4852
4818
  class $6e789b3bd17f4496$var$RateHelper {
4853
- constructor(testMode = 'production'){
4854
- this.endpoints = new (0, $a67ff3d39107eba0$export$2e2bcd8739ae039)(testMode);
4819
+ constructor(testMode = 'production', externalConfig = null){
4820
+ this.endpoints = new (0, $df8d2892fe6558f0$export$2e2bcd8739ae039)(testMode, externalConfig.backendUrl);
4855
4821
  }
4856
4822
  async getExchangeRate(currencyFrom, currencyTo) {
4857
4823
  try {
@@ -5450,9 +5416,10 @@ function $5d6e781e59e50d37$export$354ffc3468f9d23e(calculateType, day) {
5450
5416
 
5451
5417
 
5452
5418
 
5419
+
5453
5420
  class $c0c7909cfff012a2$var$OperationsHelper {
5454
- constructor(testMode = 'production', secretKey = null){
5455
- this.endpoints = new (0, $a67ff3d39107eba0$export$2e2bcd8739ae039)(testMode);
5421
+ constructor(testMode = 'production', secretKey = null, config = null){
5422
+ this.endpoints = new (0, $df8d2892fe6558f0$export$2e2bcd8739ae039)(testMode, config.backendUrl);
5456
5423
  this.reference = secretKey;
5457
5424
  this.FEES = {
5458
5425
  "ach": {
@@ -7063,7 +7030,7 @@ function $d3c2b8c012a239f6$var$Simulator(props) {
7063
7030
  */ const { locale: locale, pathname: pathname, locales: locales } = props;
7064
7031
  const content = locale === "es" ? (0, $6741b883ab744742$export$2e2bcd8739ae039) : (0, $d439b0ecd58343d0$export$2e2bcd8739ae039);
7065
7032
  const classes = $d3c2b8c012a239f6$var$useStyles();
7066
- const __ENDPOINTS = new (0, $a67ff3d39107eba0$export$2e2bcd8739ae039)(props.testMode);
7033
+ const __ENDPOINTS = new (0, $df8d2892fe6558f0$export$2e2bcd8739ae039)(props.testMode, props.config?.backendUrl);
7067
7034
  const __calculateHelper = new (0, $fe71048abacacae0$export$2e2bcd8739ae039)(props.testMode);
7068
7035
  const __operationsHelper = new (0, $c0c7909cfff012a2$export$2e2bcd8739ae039)(props.testMode, props.reference);
7069
7036
  const __firebase = (0, $9a120cc4db7b0570$export$2e2bcd8739ae039)(props.testMode, props.config);