@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/index.js CHANGED
@@ -2477,9 +2477,8 @@ function $7960feb2a8e3e0c6$export$2afc3ae66aac801c(secretKey, params) {
2477
2477
  timestamp: timestamp
2478
2478
  };
2479
2479
  }
2480
- function $7960feb2a8e3e0c6$export$3db7bf9691bf4b62(method, url, body = null, apikey = null) {
2480
+ function $7960feb2a8e3e0c6$export$3db7bf9691bf4b62(method, url, body = null, apikey = null, secretKey = null) {
2481
2481
  const referenceApiKey = apikey;
2482
- const secretKey = process.env.NEXT_PUBLIC_STAGING_APIKEY;
2483
2482
  const signatureParams = {
2484
2483
  method: method,
2485
2484
  url: url,
@@ -2546,6 +2545,7 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
2546
2545
  isCountryFromPayPal: false,
2547
2546
  onlySimulation: this.props.onlySimulation,
2548
2547
  reference: this.props.reference,
2548
+ secretKey: this.props.secretKey,
2549
2549
  taxSender: 0.00,
2550
2550
  taxReceiver: 0.00
2551
2551
  };
@@ -2783,7 +2783,8 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
2783
2783
  sell: 0
2784
2784
  };
2785
2785
  }
2786
- if (usdRate != "") rates[c].buy = rates[c].sell = parseFloat(c == "SV" ? usdRate.result : usdRate.result.toFixed(2));
2786
+ if (usdRate && typeof usdRate.result === "number") rates[c].buy = rates[c].sell = parseFloat(c == "SV" ? usdRate.result : usdRate.result.toFixed(2));
2787
+ else rates[c].buy = rates[c].sell = 1;
2787
2788
  if (body[country].countryTo[c]) {
2788
2789
  body[country].countryTo[c].usdBuy = rates[c].buy;
2789
2790
  body[country].countryTo[c].usdSell = rates[c].sell;
@@ -3027,6 +3028,7 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
3027
3028
  couponValue: this.state.couponValue,
3028
3029
  couponRedeemed: false,
3029
3030
  reference: this.state.reference,
3031
+ secretKey: this.state.secretKey,
3030
3032
  plus: 0
3031
3033
  });
3032
3034
  if (this.state.recalc) clearTimeout(this.state.recalc);
@@ -3048,7 +3050,7 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
3048
3050
  const url = this.ENDPOINTS.OPERATIONS.calculate(this.state.storeId || sessionStorage.getItem('storeId'), "from");
3049
3051
  const res = await (0, ($parcel$interopDefault($gXNCa$axios))).post(url, model, {
3050
3052
  headers: {
3051
- "x-api-access-sig": (0, $7960feb2a8e3e0c6$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference)
3053
+ "x-api-access-sig": (0, $7960feb2a8e3e0c6$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference, this.state.secretKey)
3052
3054
  }
3053
3055
  });
3054
3056
  if (res) await this.setState({
@@ -3089,7 +3091,7 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
3089
3091
  const url = this.ENDPOINTS.OPERATIONS.calculate(this.state.storeId, source);
3090
3092
  const res = await (0, ($parcel$interopDefault($gXNCa$axios))).post(url, model, {
3091
3093
  headers: {
3092
- "x-api-access-sig": (0, $7960feb2a8e3e0c6$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference)
3094
+ "x-api-access-sig": (0, $7960feb2a8e3e0c6$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference, this.state.secretKey)
3093
3095
  }
3094
3096
  });
3095
3097
  if (res) await this.setState({
@@ -3325,7 +3327,7 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
3325
3327
  try {
3326
3328
  const response = await (0, ($parcel$interopDefault($gXNCa$axios))).get(url, {
3327
3329
  headers: {
3328
- "x-api-access-sig": (0, $7960feb2a8e3e0c6$export$3db7bf9691bf4b62)('GET', url, null, this.state.reference)
3330
+ "x-api-access-sig": (0, $7960feb2a8e3e0c6$export$3db7bf9691bf4b62)('GET', url, null, this.state.reference, this.state.secretKey)
3329
3331
  }
3330
3332
  });
3331
3333
  return response;
@@ -5419,9 +5421,10 @@ function $5d6e781e59e50d37$export$354ffc3468f9d23e(calculateType, day) {
5419
5421
 
5420
5422
 
5421
5423
  class $c0c7909cfff012a2$var$OperationsHelper {
5422
- constructor(testMode = 'production', secretKey = null, config = null){
5424
+ constructor(testMode = 'production', apiKey = null, config = null, secretKey = null){
5423
5425
  this.endpoints = new (0, $df8d2892fe6558f0$export$2e2bcd8739ae039)(testMode, config);
5424
- this.reference = secretKey;
5426
+ this.reference = apiKey;
5427
+ this.secretKey = secretKey;
5425
5428
  this.FEES = {
5426
5429
  "ach": {
5427
5430
  type: "A",
@@ -5449,7 +5452,7 @@ class $c0c7909cfff012a2$var$OperationsHelper {
5449
5452
  const url = this.endpoints.OPERATIONS.calculate(storeId, source);
5450
5453
  return await (0, ($parcel$interopDefault($gXNCa$axios))).post(url, body, {
5451
5454
  headers: {
5452
- "x-api-access-sig": (0, $7960feb2a8e3e0c6$export$3db7bf9691bf4b62)('POST', url, body, this.reference)
5455
+ "x-api-access-sig": (0, $7960feb2a8e3e0c6$export$3db7bf9691bf4b62)('POST', url, body, this.reference, this.secretKey)
5453
5456
  }
5454
5457
  });
5455
5458
  }
@@ -7033,7 +7036,7 @@ function $d3c2b8c012a239f6$var$Simulator(props) {
7033
7036
  const classes = $d3c2b8c012a239f6$var$useStyles();
7034
7037
  const __ENDPOINTS = new (0, $df8d2892fe6558f0$export$2e2bcd8739ae039)(props.testMode, props.config);
7035
7038
  const __calculateHelper = new (0, $fe71048abacacae0$export$2e2bcd8739ae039)(props.testMode, props.config);
7036
- const __operationsHelper = new (0, $c0c7909cfff012a2$export$2e2bcd8739ae039)(props.testMode, props.reference, props.config);
7039
+ const __operationsHelper = new (0, $c0c7909cfff012a2$export$2e2bcd8739ae039)(props.testMode, props.reference, props.config, props.secretKey);
7037
7040
  const __firebase = (0, $9a120cc4db7b0570$export$2e2bcd8739ae039)(props.testMode, props.config);
7038
7041
  const [simulatorMode, setSimulatorMode] = (0, $gXNCa$react.useState)((0, $ee1f0011b010ab9b$export$e3d7a3ffb08d3f7a).SEND);
7039
7042
  const [suscribedGlobalOptions, setSuscribedGlobalOptions] = (0, $gXNCa$react.useState)(false);
@@ -7970,6 +7973,7 @@ function $4fa36e821943b400$export$d75554d0168fcedc(props) {
7970
7973
  onlyView: props.onlyView ?? false,
7971
7974
  initialCountryTo: props.initialCountryTo ?? "PE-USD",
7972
7975
  reference: props.reference || "",
7976
+ secretKey: props.secretKey || "",
7973
7977
  config: props.config
7974
7978
  });
7975
7979
  }
@@ -7981,6 +7985,7 @@ function $4fa36e821943b400$export$896df779a8e2818(props) {
7981
7985
  couponCode: props.couponCode || "",
7982
7986
  onlySimulation: props.onlySimulation ?? false,
7983
7987
  reference: props.reference || "",
7988
+ secretKey: props.secretKey || "",
7984
7989
  config: props.config
7985
7990
  });
7986
7991
  }