@traund/orquezta-widget-calculator 1.0.3 → 1.0.5

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
@@ -2326,7 +2326,7 @@ var $49f826b4fff6422b$export$2e2bcd8739ae039 = $49f826b4fff6422b$var$Timer;
2326
2326
  class $6f87a65d2d16a22f$var$EndPoints {
2327
2327
  constructor(testMode = 'production', externalConfig = null){
2328
2328
  this._testMode = testMode;
2329
- this.baseUrl = externalConfig && externalConfig.backendUrl;
2329
+ this.baseUrl = externalConfig?.backendUrl;
2330
2330
  this.path_managment_operations = `${this.baseUrl}/handle-operations`;
2331
2331
  }
2332
2332
  get CALLBACK() {
@@ -2466,9 +2466,8 @@ function $be7f9e5745d99d09$export$2afc3ae66aac801c(secretKey, params) {
2466
2466
  timestamp: timestamp
2467
2467
  };
2468
2468
  }
2469
- function $be7f9e5745d99d09$export$3db7bf9691bf4b62(method, url, body = null, apikey = null) {
2469
+ function $be7f9e5745d99d09$export$3db7bf9691bf4b62(method, url, body = null, apikey = null, secretKey = null) {
2470
2470
  const referenceApiKey = apikey;
2471
- const secretKey = process.env.NEXT_PUBLIC_STAGING_APIKEY;
2472
2471
  const signatureParams = {
2473
2472
  method: method,
2474
2473
  url: url,
@@ -2535,6 +2534,7 @@ class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
2535
2534
  isCountryFromPayPal: false,
2536
2535
  onlySimulation: this.props.onlySimulation,
2537
2536
  reference: this.props.reference,
2537
+ secretKey: this.props.secretKey,
2538
2538
  taxSender: 0.00,
2539
2539
  taxReceiver: 0.00
2540
2540
  };
@@ -2772,7 +2772,8 @@ class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
2772
2772
  sell: 0
2773
2773
  };
2774
2774
  }
2775
- if (usdRate != "") rates[c].buy = rates[c].sell = parseFloat(c == "SV" ? usdRate.result : usdRate.result.toFixed(2));
2775
+ if (usdRate && typeof usdRate.result === "number") rates[c].buy = rates[c].sell = parseFloat(c == "SV" ? usdRate.result : usdRate.result.toFixed(2));
2776
+ else rates[c].buy = rates[c].sell = 1;
2776
2777
  if (body[country].countryTo[c]) {
2777
2778
  body[country].countryTo[c].usdBuy = rates[c].buy;
2778
2779
  body[country].countryTo[c].usdSell = rates[c].sell;
@@ -3016,6 +3017,7 @@ class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
3016
3017
  couponValue: this.state.couponValue,
3017
3018
  couponRedeemed: false,
3018
3019
  reference: this.state.reference,
3020
+ secretKey: this.state.secretKey,
3019
3021
  plus: 0
3020
3022
  });
3021
3023
  if (this.state.recalc) clearTimeout(this.state.recalc);
@@ -3037,7 +3039,7 @@ class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
3037
3039
  const url = this.ENDPOINTS.OPERATIONS.calculate(this.state.storeId || sessionStorage.getItem('storeId'), "from");
3038
3040
  const res = await (0, $5OpyM$axios).post(url, model, {
3039
3041
  headers: {
3040
- "x-api-access-sig": (0, $be7f9e5745d99d09$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference)
3042
+ "x-api-access-sig": (0, $be7f9e5745d99d09$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference, this.state.secretKey)
3041
3043
  }
3042
3044
  });
3043
3045
  if (res) await this.setState({
@@ -3078,7 +3080,7 @@ class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
3078
3080
  const url = this.ENDPOINTS.OPERATIONS.calculate(this.state.storeId, source);
3079
3081
  const res = await (0, $5OpyM$axios).post(url, model, {
3080
3082
  headers: {
3081
- "x-api-access-sig": (0, $be7f9e5745d99d09$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference)
3083
+ "x-api-access-sig": (0, $be7f9e5745d99d09$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference, this.state.secretKey)
3082
3084
  }
3083
3085
  });
3084
3086
  if (res) await this.setState({
@@ -3314,7 +3316,7 @@ class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
3314
3316
  try {
3315
3317
  const response = await (0, $5OpyM$axios).get(url, {
3316
3318
  headers: {
3317
- "x-api-access-sig": (0, $be7f9e5745d99d09$export$3db7bf9691bf4b62)('GET', url, null, this.state.reference)
3319
+ "x-api-access-sig": (0, $be7f9e5745d99d09$export$3db7bf9691bf4b62)('GET', url, null, this.state.reference, this.state.secretKey)
3318
3320
  }
3319
3321
  });
3320
3322
  return response;
@@ -4806,7 +4808,7 @@ var $ee6357194386215f$export$2e2bcd8739ae039 = $ee6357194386215f$var$TransferUse
4806
4808
 
4807
4809
  class $9ac168cb9a22c932$var$RateHelper {
4808
4810
  constructor(testMode = 'production', externalConfig = null){
4809
- this.endpoints = new (0, $6f87a65d2d16a22f$export$2e2bcd8739ae039)(testMode, externalConfig.backendUrl);
4811
+ this.endpoints = new (0, $6f87a65d2d16a22f$export$2e2bcd8739ae039)(testMode, externalConfig);
4810
4812
  }
4811
4813
  async getExchangeRate(currencyFrom, currencyTo) {
4812
4814
  try {
@@ -4839,11 +4841,12 @@ var $9ac168cb9a22c932$export$2e2bcd8739ae039 = $9ac168cb9a22c932$var$RateHelper;
4839
4841
 
4840
4842
 
4841
4843
  class $006ea4d50140482f$var$CalculateHelper {
4842
- constructor(testMode = 'production'){
4844
+ constructor(testMode = 'production', config = null){
4843
4845
  this._testMode = testMode;
4846
+ this.config = config;
4844
4847
  }
4845
4848
  async getCaculateRates(countriesData) {
4846
- const rateHelper = new (0, $9ac168cb9a22c932$export$2e2bcd8739ae039)(this._testMode);
4849
+ const rateHelper = new (0, $9ac168cb9a22c932$export$2e2bcd8739ae039)(this._testMode, this.config);
4847
4850
  const middleCurrency = "USD";
4848
4851
  for(var key in countriesData)if (countriesData.hasOwnProperty(key)) {
4849
4852
  let itemCountry = countriesData[key];
@@ -5407,9 +5410,10 @@ function $6bf8ac1124443ad4$export$354ffc3468f9d23e(calculateType, day) {
5407
5410
 
5408
5411
 
5409
5412
  class $aeba0491dead64b0$var$OperationsHelper {
5410
- constructor(testMode = 'production', secretKey = null, config = null){
5411
- this.endpoints = new (0, $6f87a65d2d16a22f$export$2e2bcd8739ae039)(testMode, config.backendUrl);
5412
- this.reference = secretKey;
5413
+ constructor(testMode = 'production', apiKey = null, config = null, secretKey = null){
5414
+ this.endpoints = new (0, $6f87a65d2d16a22f$export$2e2bcd8739ae039)(testMode, config);
5415
+ this.reference = apiKey;
5416
+ this.secretKey = secretKey;
5413
5417
  this.FEES = {
5414
5418
  "ach": {
5415
5419
  type: "A",
@@ -5437,7 +5441,7 @@ class $aeba0491dead64b0$var$OperationsHelper {
5437
5441
  const url = this.endpoints.OPERATIONS.calculate(storeId, source);
5438
5442
  return await (0, $5OpyM$axios).post(url, body, {
5439
5443
  headers: {
5440
- "x-api-access-sig": (0, $be7f9e5745d99d09$export$3db7bf9691bf4b62)('POST', url, body, this.reference)
5444
+ "x-api-access-sig": (0, $be7f9e5745d99d09$export$3db7bf9691bf4b62)('POST', url, body, this.reference, this.secretKey)
5441
5445
  }
5442
5446
  });
5443
5447
  }
@@ -7019,9 +7023,9 @@ function $c4ee7a827d19e0d2$var$Simulator(props) {
7019
7023
  */ const { locale: locale, pathname: pathname, locales: locales } = props;
7020
7024
  const content = locale === "es" ? (0, $af3f68c5ac2f1e3c$export$2e2bcd8739ae039) : (0, $18d8bd1c5cecbd36$export$2e2bcd8739ae039);
7021
7025
  const classes = $c4ee7a827d19e0d2$var$useStyles();
7022
- const __ENDPOINTS = new (0, $6f87a65d2d16a22f$export$2e2bcd8739ae039)(props.testMode, props.config?.backendUrl);
7023
- const __calculateHelper = new (0, $006ea4d50140482f$export$2e2bcd8739ae039)(props.testMode);
7024
- const __operationsHelper = new (0, $aeba0491dead64b0$export$2e2bcd8739ae039)(props.testMode, props.reference);
7026
+ const __ENDPOINTS = new (0, $6f87a65d2d16a22f$export$2e2bcd8739ae039)(props.testMode, props.config);
7027
+ const __calculateHelper = new (0, $006ea4d50140482f$export$2e2bcd8739ae039)(props.testMode, props.config);
7028
+ const __operationsHelper = new (0, $aeba0491dead64b0$export$2e2bcd8739ae039)(props.testMode, props.reference, props.config, props.secretKey);
7025
7029
  const __firebase = (0, $9ea2f2608ea58c4b$export$2e2bcd8739ae039)(props.testMode, props.config);
7026
7030
  const [simulatorMode, setSimulatorMode] = (0, $5OpyM$useState)((0, $3217af864b2b4eed$export$e3d7a3ffb08d3f7a).SEND);
7027
7031
  const [suscribedGlobalOptions, setSuscribedGlobalOptions] = (0, $5OpyM$useState)(false);
@@ -7958,6 +7962,7 @@ function $cf838c15c8b009ba$export$d75554d0168fcedc(props) {
7958
7962
  onlyView: props.onlyView ?? false,
7959
7963
  initialCountryTo: props.initialCountryTo ?? "PE-USD",
7960
7964
  reference: props.reference || "",
7965
+ secretKey: props.secretKey || "",
7961
7966
  config: props.config
7962
7967
  });
7963
7968
  }
@@ -7969,6 +7974,7 @@ function $cf838c15c8b009ba$export$896df779a8e2818(props) {
7969
7974
  couponCode: props.couponCode || "",
7970
7975
  onlySimulation: props.onlySimulation ?? false,
7971
7976
  reference: props.reference || "",
7977
+ secretKey: props.secretKey || "",
7972
7978
  config: props.config
7973
7979
  });
7974
7980
  }