@traund/orquezta-widget-calculator 1.0.4 → 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
@@ -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;
@@ -5408,9 +5410,10 @@ function $6bf8ac1124443ad4$export$354ffc3468f9d23e(calculateType, day) {
5408
5410
 
5409
5411
 
5410
5412
  class $aeba0491dead64b0$var$OperationsHelper {
5411
- constructor(testMode = 'production', secretKey = null, config = null){
5413
+ constructor(testMode = 'production', apiKey = null, config = null, secretKey = null){
5412
5414
  this.endpoints = new (0, $6f87a65d2d16a22f$export$2e2bcd8739ae039)(testMode, config);
5413
- this.reference = secretKey;
5415
+ this.reference = apiKey;
5416
+ this.secretKey = secretKey;
5414
5417
  this.FEES = {
5415
5418
  "ach": {
5416
5419
  type: "A",
@@ -5438,7 +5441,7 @@ class $aeba0491dead64b0$var$OperationsHelper {
5438
5441
  const url = this.endpoints.OPERATIONS.calculate(storeId, source);
5439
5442
  return await (0, $5OpyM$axios).post(url, body, {
5440
5443
  headers: {
5441
- "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)
5442
5445
  }
5443
5446
  });
5444
5447
  }
@@ -7022,7 +7025,7 @@ function $c4ee7a827d19e0d2$var$Simulator(props) {
7022
7025
  const classes = $c4ee7a827d19e0d2$var$useStyles();
7023
7026
  const __ENDPOINTS = new (0, $6f87a65d2d16a22f$export$2e2bcd8739ae039)(props.testMode, props.config);
7024
7027
  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);
7028
+ const __operationsHelper = new (0, $aeba0491dead64b0$export$2e2bcd8739ae039)(props.testMode, props.reference, props.config, props.secretKey);
7026
7029
  const __firebase = (0, $9ea2f2608ea58c4b$export$2e2bcd8739ae039)(props.testMode, props.config);
7027
7030
  const [simulatorMode, setSimulatorMode] = (0, $5OpyM$useState)((0, $3217af864b2b4eed$export$e3d7a3ffb08d3f7a).SEND);
7028
7031
  const [suscribedGlobalOptions, setSuscribedGlobalOptions] = (0, $5OpyM$useState)(false);
@@ -7959,6 +7962,7 @@ function $cf838c15c8b009ba$export$d75554d0168fcedc(props) {
7959
7962
  onlyView: props.onlyView ?? false,
7960
7963
  initialCountryTo: props.initialCountryTo ?? "PE-USD",
7961
7964
  reference: props.reference || "",
7965
+ secretKey: props.secretKey || "",
7962
7966
  config: props.config
7963
7967
  });
7964
7968
  }
@@ -7970,6 +7974,7 @@ function $cf838c15c8b009ba$export$896df779a8e2818(props) {
7970
7974
  couponCode: props.couponCode || "",
7971
7975
  onlySimulation: props.onlySimulation ?? false,
7972
7976
  reference: props.reference || "",
7977
+ secretKey: props.secretKey || "",
7973
7978
  config: props.config
7974
7979
  });
7975
7980
  }