@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/index.js CHANGED
@@ -989,50 +989,22 @@ var $6741b883ab744742$export$2e2bcd8739ae039 = {
989
989
 
990
990
  const $d122f0ec366574ef$export$7dfd6b97707a3d55 = {
991
991
  "staging": {
992
- URL: process.env.NEXT_PUBLIC_STAGING_TRAUND_BACKEND_URL,
993
- HEADERS: {},
994
- FIREBASE: {
995
- apiKey: process.env.NEXT_PUBLIC_STAGING_FIREBASE_API_KEY,
996
- authDomain: process.env.NEXT_PUBLIC_STAGING_FIREBASE_AUTH_DOMAIN,
997
- projectId: process.env.NEXT_PUBLIC_STAGING_FIREBASE_PROJECT_ID,
998
- storageBucket: process.env.NEXT_PUBLIC_STAGING_FIREBASE_STORAGE_BUCKET,
999
- messagingSenderId: process.env.NEXT_PUBLIC_STAGING_FIREBASE_MESSAGING_SENDER_ID,
1000
- appId: process.env.NEXT_PUBLIC_STAGING_FIREBASE_APP_ID,
1001
- measurementId: process.env.NEXT_PUBLIC_STAGING_FIREBASE_MEASUREMENT_ID
1002
- }
992
+ URL: process.env.NEXT_PUBLIC_STAGING_TRAUND_BACKEND_URL
1003
993
  },
1004
994
  "beta": {
1005
- URL: process.env.NEXT_PUBLIC_BETA_TRAUND_BACKEND_URL,
1006
- HEADERS: {},
1007
- FIREBASE: {
1008
- apiKey: process.env.NEXT_PUBLIC_BETA_FIREBASE_API_KEY,
1009
- authDomain: process.env.NEXT_PUBLIC_BETA_FIREBASE_AUTH_DOMAIN,
1010
- projectId: process.env.NEXT_PUBLIC_BETA_FIREBASE_PROJECT_ID,
1011
- storageBucket: process.env.NEXT_PUBLIC_BETA_FIREBASE_STORAGE_BUCKET,
1012
- messagingSenderId: process.env.NEXT_PUBLIC_BETA_FIREBASE_MESSAGING_SENDER_ID,
1013
- appId: process.env.NEXT_PUBLIC_BETA_FIREBASE_APP_ID,
1014
- measurementId: process.env.NEXT_PUBLIC_BETA_FIREBASE_MEASUREMENT_ID
1015
- }
995
+ URL: process.env.NEXT_PUBLIC_BETA_TRAUND_BACKEND_URL
1016
996
  },
1017
997
  "production": {
1018
- URL: process.env.NEXT_PUBLIC_PROD_TRAUND_BACKEND_URL,
1019
- HEADERS: {},
1020
- FIREBASE: {
1021
- apiKey: process.env.NEXT_PUBLIC_PROD_FIREBASE_API_KEY,
1022
- authDomain: process.env.NEXT_PUBLIC_PROD_FIREBASE_AUTH_DOMAIN,
1023
- projectId: process.env.NEXT_PUBLIC_PROD_FIREBASE_PROJECT_ID,
1024
- storageBucket: process.env.NEXT_PUBLIC_PROD_FIREBASE_STORAGE_BUCKET,
1025
- messagingSenderId: process.env.NEXT_PUBLIC_PROD_FIREBASE_MESSAGING_SENDER_ID,
1026
- appId: process.env.NEXT_PUBLIC_PROD_FIREBASE_APP_ID,
1027
- measurementId: process.env.NEXT_PUBLIC_PROD_FIREBASE_MEASUREMENT_ID
1028
- }
998
+ URL: process.env.NEXT_PUBLIC_PROD_TRAUND_BACKEND_URL
1029
999
  }
1030
1000
  };
1031
1001
 
1032
1002
 
1033
- const $9a120cc4db7b0570$var$loadFirebaseDB = (testMode = 'production')=>{
1003
+ const $9a120cc4db7b0570$var$loadFirebaseDB = (testMode = 'production', externalConfig = null)=>{
1034
1004
  try {
1035
- var firebaseConfig = (0, $d122f0ec366574ef$export$7dfd6b97707a3d55)[testMode].FIREBASE;
1005
+ let firebaseConfig;
1006
+ if (externalConfig && externalConfig.provider) firebaseConfig = externalConfig.provider;
1007
+ else firebaseConfig = (0, $d122f0ec366574ef$export$7dfd6b97707a3d55)[testMode].FIREBASE;
1036
1008
  if ((0, ($parcel$interopDefault($gXNCa$firebaseapp))).apps.length === 0) (0, ($parcel$interopDefault($gXNCa$firebaseapp))).initializeApp(firebaseConfig);
1037
1009
  } catch (error) {
1038
1010
  if (!/already exist/.test(error.message)) console.error('Firebase initialization error', error.stack);
@@ -2516,6 +2488,7 @@ function $7960feb2a8e3e0c6$export$3db7bf9691bf4b62(method, url, body = null, api
2516
2488
 
2517
2489
  class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
2518
2490
  state = {
2491
+ config: this.props.config,
2519
2492
  testMode: this.props.testMode,
2520
2493
  sendValue: 100.0,
2521
2494
  sendValueUSD: 100.0,
@@ -2579,7 +2552,7 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
2579
2552
  }
2580
2553
  async componentDidMount() {
2581
2554
  //if (db) db.clearPersistence();
2582
- const firebase = await (0, $9a120cc4db7b0570$export$2e2bcd8739ae039)(this.state.testMode);
2555
+ const firebase = await (0, $9a120cc4db7b0570$export$2e2bcd8739ae039)(this.state.testMode, this.state.config);
2583
2556
  const db = firebase.firestore();
2584
2557
  this.subscribeCalculatorConfig(db);
2585
2558
  if (!sessionStorage.getItem(`storeId`) || sessionStorage.getItem(`storeId`) == null || sessionStorage.getItem(`storeId`) == undefined || sessionStorage.getItem(`storeId`) == "") await this.createTransaction(db);
@@ -3071,7 +3044,6 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
3071
3044
  const url = this.ENDPOINTS.TRANSACTION.calculate_v2(this.state.storeId || sessionStorage.getItem('storeId'), "from");
3072
3045
  const res = await (0, ($parcel$interopDefault($gXNCa$axios))).post(url, model, {
3073
3046
  headers: {
3074
- ...this.ENDPOINTS.HEADERS,
3075
3047
  "x-api-access-sig": (0, $7960feb2a8e3e0c6$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference)
3076
3048
  }
3077
3049
  });
@@ -3113,7 +3085,6 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
3113
3085
  const url = this.ENDPOINTS.TRANSACTION.calculate_v2(this.state.storeId, source);
3114
3086
  const res = await (0, ($parcel$interopDefault($gXNCa$axios))).post(url, model, {
3115
3087
  headers: {
3116
- ...this.ENDPOINTS.HEADERS,
3117
3088
  "x-api-access-sig": (0, $7960feb2a8e3e0c6$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference)
3118
3089
  }
3119
3090
  });
@@ -3350,7 +3321,6 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
3350
3321
  try {
3351
3322
  const response = await (0, ($parcel$interopDefault($gXNCa$axios))).get(url, {
3352
3323
  headers: {
3353
- ...this.ENDPOINTS.HEADERS,
3354
3324
  "x-api-access-sig": (0, $7960feb2a8e3e0c6$export$3db7bf9691bf4b62)('GET', url, null, this.state.reference)
3355
3325
  }
3356
3326
  });
@@ -5512,7 +5482,6 @@ class $c0c7909cfff012a2$var$OperationsHelper {
5512
5482
  const url = this.endpoints.OPERATIONS.calculate(storeId, source);
5513
5483
  return await (0, ($parcel$interopDefault($gXNCa$axios))).post(url, body, {
5514
5484
  headers: {
5515
- ...this.endpoints.HEADERS,
5516
5485
  "x-api-access-sig": (0, $7960feb2a8e3e0c6$export$3db7bf9691bf4b62)('POST', url, body, this.reference)
5517
5486
  }
5518
5487
  });
@@ -7098,7 +7067,7 @@ function $d3c2b8c012a239f6$var$Simulator(props) {
7098
7067
  const __ENDPOINTS = new (0, $a67ff3d39107eba0$export$2e2bcd8739ae039)(props.testMode);
7099
7068
  const __calculateHelper = new (0, $fe71048abacacae0$export$2e2bcd8739ae039)(props.testMode);
7100
7069
  const __operationsHelper = new (0, $c0c7909cfff012a2$export$2e2bcd8739ae039)(props.testMode, props.reference);
7101
- const __firebase = (0, $9a120cc4db7b0570$export$2e2bcd8739ae039)(props.testMode);
7070
+ const __firebase = (0, $9a120cc4db7b0570$export$2e2bcd8739ae039)(props.testMode, props.config);
7102
7071
  const [simulatorMode, setSimulatorMode] = (0, $gXNCa$react.useState)((0, $ee1f0011b010ab9b$export$e3d7a3ffb08d3f7a).SEND);
7103
7072
  const [suscribedGlobalOptions, setSuscribedGlobalOptions] = (0, $gXNCa$react.useState)(false);
7104
7073
  const [globalTransferOptions, setGlobalTransferOptions] = (0, $gXNCa$react.useState)(null);
@@ -8033,7 +8002,8 @@ function $4fa36e821943b400$export$d75554d0168fcedc(props) {
8033
8002
  startUrl: props.startUrl,
8034
8003
  onlyView: props.onlyView ?? false,
8035
8004
  initialCountryTo: props.initialCountryTo ?? "PE-USD",
8036
- reference: props.reference || ""
8005
+ reference: props.reference || "",
8006
+ config: props.config
8037
8007
  });
8038
8008
  }
8039
8009
  function $4fa36e821943b400$export$896df779a8e2818(props) {
@@ -8043,7 +8013,8 @@ function $4fa36e821943b400$export$896df779a8e2818(props) {
8043
8013
  startUrl: props.startUrl,
8044
8014
  couponCode: props.couponCode || "",
8045
8015
  onlySimulation: props.onlySimulation ?? false,
8046
- reference: props.reference || ""
8016
+ reference: props.reference || "",
8017
+ config: props.config
8047
8018
  });
8048
8019
  }
8049
8020