@traund/orquezta-widget-calculator 1.0.0 → 1.0.1

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
@@ -982,50 +982,22 @@ var $af3f68c5ac2f1e3c$export$2e2bcd8739ae039 = {
982
982
 
983
983
  const $c8082d1fff4ed783$export$7dfd6b97707a3d55 = {
984
984
  "staging": {
985
- URL: process.env.NEXT_PUBLIC_STAGING_TRAUND_BACKEND_URL,
986
- HEADERS: {},
987
- FIREBASE: {
988
- apiKey: process.env.NEXT_PUBLIC_STAGING_FIREBASE_API_KEY,
989
- authDomain: process.env.NEXT_PUBLIC_STAGING_FIREBASE_AUTH_DOMAIN,
990
- projectId: process.env.NEXT_PUBLIC_STAGING_FIREBASE_PROJECT_ID,
991
- storageBucket: process.env.NEXT_PUBLIC_STAGING_FIREBASE_STORAGE_BUCKET,
992
- messagingSenderId: process.env.NEXT_PUBLIC_STAGING_FIREBASE_MESSAGING_SENDER_ID,
993
- appId: process.env.NEXT_PUBLIC_STAGING_FIREBASE_APP_ID,
994
- measurementId: process.env.NEXT_PUBLIC_STAGING_FIREBASE_MEASUREMENT_ID
995
- }
985
+ URL: process.env.NEXT_PUBLIC_STAGING_TRAUND_BACKEND_URL
996
986
  },
997
987
  "beta": {
998
- URL: process.env.NEXT_PUBLIC_BETA_TRAUND_BACKEND_URL,
999
- HEADERS: {},
1000
- FIREBASE: {
1001
- apiKey: process.env.NEXT_PUBLIC_BETA_FIREBASE_API_KEY,
1002
- authDomain: process.env.NEXT_PUBLIC_BETA_FIREBASE_AUTH_DOMAIN,
1003
- projectId: process.env.NEXT_PUBLIC_BETA_FIREBASE_PROJECT_ID,
1004
- storageBucket: process.env.NEXT_PUBLIC_BETA_FIREBASE_STORAGE_BUCKET,
1005
- messagingSenderId: process.env.NEXT_PUBLIC_BETA_FIREBASE_MESSAGING_SENDER_ID,
1006
- appId: process.env.NEXT_PUBLIC_BETA_FIREBASE_APP_ID,
1007
- measurementId: process.env.NEXT_PUBLIC_BETA_FIREBASE_MEASUREMENT_ID
1008
- }
988
+ URL: process.env.NEXT_PUBLIC_BETA_TRAUND_BACKEND_URL
1009
989
  },
1010
990
  "production": {
1011
- URL: process.env.NEXT_PUBLIC_PROD_TRAUND_BACKEND_URL,
1012
- HEADERS: {},
1013
- FIREBASE: {
1014
- apiKey: process.env.NEXT_PUBLIC_PROD_FIREBASE_API_KEY,
1015
- authDomain: process.env.NEXT_PUBLIC_PROD_FIREBASE_AUTH_DOMAIN,
1016
- projectId: process.env.NEXT_PUBLIC_PROD_FIREBASE_PROJECT_ID,
1017
- storageBucket: process.env.NEXT_PUBLIC_PROD_FIREBASE_STORAGE_BUCKET,
1018
- messagingSenderId: process.env.NEXT_PUBLIC_PROD_FIREBASE_MESSAGING_SENDER_ID,
1019
- appId: process.env.NEXT_PUBLIC_PROD_FIREBASE_APP_ID,
1020
- measurementId: process.env.NEXT_PUBLIC_PROD_FIREBASE_MEASUREMENT_ID
1021
- }
991
+ URL: process.env.NEXT_PUBLIC_PROD_TRAUND_BACKEND_URL
1022
992
  }
1023
993
  };
1024
994
 
1025
995
 
1026
- const $9ea2f2608ea58c4b$var$loadFirebaseDB = (testMode = 'production')=>{
996
+ const $9ea2f2608ea58c4b$var$loadFirebaseDB = (testMode = 'production', externalConfig = null)=>{
1027
997
  try {
1028
- var firebaseConfig = (0, $c8082d1fff4ed783$export$7dfd6b97707a3d55)[testMode].FIREBASE;
998
+ let firebaseConfig;
999
+ if (externalConfig && externalConfig.provider) firebaseConfig = externalConfig.provider;
1000
+ else firebaseConfig = (0, $c8082d1fff4ed783$export$7dfd6b97707a3d55)[testMode].FIREBASE;
1029
1001
  if ((0, $5OpyM$firebaseapp).apps.length === 0) (0, $5OpyM$firebaseapp).initializeApp(firebaseConfig);
1030
1002
  } catch (error) {
1031
1003
  if (!/already exist/.test(error.message)) console.error('Firebase initialization error', error.stack);
@@ -2509,6 +2481,7 @@ function $be7f9e5745d99d09$export$3db7bf9691bf4b62(method, url, body = null, api
2509
2481
 
2510
2482
  class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
2511
2483
  state = {
2484
+ config: this.props.config,
2512
2485
  testMode: this.props.testMode,
2513
2486
  sendValue: 100.0,
2514
2487
  sendValueUSD: 100.0,
@@ -2572,7 +2545,7 @@ class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
2572
2545
  }
2573
2546
  async componentDidMount() {
2574
2547
  //if (db) db.clearPersistence();
2575
- const firebase = await (0, $9ea2f2608ea58c4b$export$2e2bcd8739ae039)(this.state.testMode);
2548
+ const firebase = await (0, $9ea2f2608ea58c4b$export$2e2bcd8739ae039)(this.state.testMode, this.state.config);
2576
2549
  const db = firebase.firestore();
2577
2550
  this.subscribeCalculatorConfig(db);
2578
2551
  if (!sessionStorage.getItem(`storeId`) || sessionStorage.getItem(`storeId`) == null || sessionStorage.getItem(`storeId`) == undefined || sessionStorage.getItem(`storeId`) == "") await this.createTransaction(db);
@@ -3064,7 +3037,6 @@ class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
3064
3037
  const url = this.ENDPOINTS.TRANSACTION.calculate_v2(this.state.storeId || sessionStorage.getItem('storeId'), "from");
3065
3038
  const res = await (0, $5OpyM$axios).post(url, model, {
3066
3039
  headers: {
3067
- ...this.ENDPOINTS.HEADERS,
3068
3040
  "x-api-access-sig": (0, $be7f9e5745d99d09$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference)
3069
3041
  }
3070
3042
  });
@@ -3106,7 +3078,6 @@ class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
3106
3078
  const url = this.ENDPOINTS.TRANSACTION.calculate_v2(this.state.storeId, source);
3107
3079
  const res = await (0, $5OpyM$axios).post(url, model, {
3108
3080
  headers: {
3109
- ...this.ENDPOINTS.HEADERS,
3110
3081
  "x-api-access-sig": (0, $be7f9e5745d99d09$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference)
3111
3082
  }
3112
3083
  });
@@ -3343,7 +3314,6 @@ class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
3343
3314
  try {
3344
3315
  const response = await (0, $5OpyM$axios).get(url, {
3345
3316
  headers: {
3346
- ...this.ENDPOINTS.HEADERS,
3347
3317
  "x-api-access-sig": (0, $be7f9e5745d99d09$export$3db7bf9691bf4b62)('GET', url, null, this.state.reference)
3348
3318
  }
3349
3319
  });
@@ -5505,7 +5475,6 @@ class $aeba0491dead64b0$var$OperationsHelper {
5505
5475
  const url = this.endpoints.OPERATIONS.calculate(storeId, source);
5506
5476
  return await (0, $5OpyM$axios).post(url, body, {
5507
5477
  headers: {
5508
- ...this.endpoints.HEADERS,
5509
5478
  "x-api-access-sig": (0, $be7f9e5745d99d09$export$3db7bf9691bf4b62)('POST', url, body, this.reference)
5510
5479
  }
5511
5480
  });
@@ -7091,7 +7060,7 @@ function $c4ee7a827d19e0d2$var$Simulator(props) {
7091
7060
  const __ENDPOINTS = new (0, $c2624340fd589f7f$export$2e2bcd8739ae039)(props.testMode);
7092
7061
  const __calculateHelper = new (0, $006ea4d50140482f$export$2e2bcd8739ae039)(props.testMode);
7093
7062
  const __operationsHelper = new (0, $aeba0491dead64b0$export$2e2bcd8739ae039)(props.testMode, props.reference);
7094
- const __firebase = (0, $9ea2f2608ea58c4b$export$2e2bcd8739ae039)(props.testMode);
7063
+ const __firebase = (0, $9ea2f2608ea58c4b$export$2e2bcd8739ae039)(props.testMode, props.config);
7095
7064
  const [simulatorMode, setSimulatorMode] = (0, $5OpyM$useState)((0, $3217af864b2b4eed$export$e3d7a3ffb08d3f7a).SEND);
7096
7065
  const [suscribedGlobalOptions, setSuscribedGlobalOptions] = (0, $5OpyM$useState)(false);
7097
7066
  const [globalTransferOptions, setGlobalTransferOptions] = (0, $5OpyM$useState)(null);
@@ -8026,7 +7995,8 @@ function $cf838c15c8b009ba$export$d75554d0168fcedc(props) {
8026
7995
  startUrl: props.startUrl,
8027
7996
  onlyView: props.onlyView ?? false,
8028
7997
  initialCountryTo: props.initialCountryTo ?? "PE-USD",
8029
- reference: props.reference || ""
7998
+ reference: props.reference || "",
7999
+ config: props.config
8030
8000
  });
8031
8001
  }
8032
8002
  function $cf838c15c8b009ba$export$896df779a8e2818(props) {
@@ -8036,7 +8006,8 @@ function $cf838c15c8b009ba$export$896df779a8e2818(props) {
8036
8006
  startUrl: props.startUrl,
8037
8007
  couponCode: props.couponCode || "",
8038
8008
  onlySimulation: props.onlySimulation ?? false,
8039
- reference: props.reference || ""
8009
+ reference: props.reference || "",
8010
+ config: props.config
8040
8011
  });
8041
8012
  }
8042
8013