@traund/orquezta-widget-calculator 1.0.0 → 1.0.2
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 +20 -50
- package/dist/index.js.map +1 -1
- package/dist/module.js +20 -50
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
- package/src/calculatorV2.js +3 -5
- package/src/core/backend-settings.js +3 -36
- package/src/core/endpoints.js +4 -4
- package/src/firebase.config.js +9 -2
- package/src/index.js +2 -0
- package/src/simulator.js +1 -1
- package/src/utils/operationsHelper.js +0 -1
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
|
-
|
|
998
|
+
let firebaseConfig;
|
|
999
|
+
if (externalConfig && externalConfig.provider) firebaseConfig = externalConfig.provider;
|
|
1000
|
+
else return console.error('No Firebase configuration provided');
|
|
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);
|
|
@@ -2356,15 +2328,14 @@ var $49f826b4fff6422b$export$2e2bcd8739ae039 = $49f826b4fff6422b$var$Timer;
|
|
|
2356
2328
|
var $6f87a65d2d16a22f$exports = {};
|
|
2357
2329
|
|
|
2358
2330
|
class $6f87a65d2d16a22f$var$EndPoints {
|
|
2359
|
-
constructor(testMode = 'production'){
|
|
2331
|
+
constructor(testMode = 'production', externalConfig = null){
|
|
2360
2332
|
this._testMode = testMode;
|
|
2361
|
-
this.baseUrl =
|
|
2333
|
+
this.baseUrl = externalConfig && externalConfig.url;
|
|
2362
2334
|
this.path_managment_operations = `${this.baseUrl}/handle-operations`;
|
|
2363
2335
|
}
|
|
2364
|
-
get HEADERS() {
|
|
2365
|
-
return this.baseUrl =
|
|
2366
|
-
}
|
|
2367
|
-
get COUPON() {
|
|
2336
|
+
/*get HEADERS() {
|
|
2337
|
+
return this.baseUrl = BACKEND_SETTINGS[this._testMode].HEADERS;
|
|
2338
|
+
};*/ get COUPON() {
|
|
2368
2339
|
return {
|
|
2369
2340
|
validate: `${this.path_managment_operations}/coupon/v1/validate`
|
|
2370
2341
|
};
|
|
@@ -2509,6 +2480,7 @@ function $be7f9e5745d99d09$export$3db7bf9691bf4b62(method, url, body = null, api
|
|
|
2509
2480
|
|
|
2510
2481
|
class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
|
|
2511
2482
|
state = {
|
|
2483
|
+
config: this.props.config,
|
|
2512
2484
|
testMode: this.props.testMode,
|
|
2513
2485
|
sendValue: 100.0,
|
|
2514
2486
|
sendValueUSD: 100.0,
|
|
@@ -2565,14 +2537,14 @@ class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
|
|
|
2565
2537
|
taxSender: 0.00,
|
|
2566
2538
|
taxReceiver: 0.00
|
|
2567
2539
|
};
|
|
2568
|
-
ENDPOINTS = new (0, (/*@__PURE__*/$parcel$interopDefault($6f87a65d2d16a22f$exports)))(this.state.testMode);
|
|
2540
|
+
ENDPOINTS = new (0, (/*@__PURE__*/$parcel$interopDefault($6f87a65d2d16a22f$exports)))(this.state.testMode, this.state.config);
|
|
2569
2541
|
constructor(props){
|
|
2570
2542
|
super(props);
|
|
2571
2543
|
this.unsubscribe = [];
|
|
2572
2544
|
}
|
|
2573
2545
|
async componentDidMount() {
|
|
2574
2546
|
//if (db) db.clearPersistence();
|
|
2575
|
-
const firebase = await (0, $9ea2f2608ea58c4b$export$2e2bcd8739ae039)(this.state.testMode);
|
|
2547
|
+
const firebase = await (0, $9ea2f2608ea58c4b$export$2e2bcd8739ae039)(this.state.testMode, this.state.config);
|
|
2576
2548
|
const db = firebase.firestore();
|
|
2577
2549
|
this.subscribeCalculatorConfig(db);
|
|
2578
2550
|
if (!sessionStorage.getItem(`storeId`) || sessionStorage.getItem(`storeId`) == null || sessionStorage.getItem(`storeId`) == undefined || sessionStorage.getItem(`storeId`) == "") await this.createTransaction(db);
|
|
@@ -3064,7 +3036,6 @@ class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
|
|
|
3064
3036
|
const url = this.ENDPOINTS.TRANSACTION.calculate_v2(this.state.storeId || sessionStorage.getItem('storeId'), "from");
|
|
3065
3037
|
const res = await (0, $5OpyM$axios).post(url, model, {
|
|
3066
3038
|
headers: {
|
|
3067
|
-
...this.ENDPOINTS.HEADERS,
|
|
3068
3039
|
"x-api-access-sig": (0, $be7f9e5745d99d09$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference)
|
|
3069
3040
|
}
|
|
3070
3041
|
});
|
|
@@ -3106,7 +3077,6 @@ class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
|
|
|
3106
3077
|
const url = this.ENDPOINTS.TRANSACTION.calculate_v2(this.state.storeId, source);
|
|
3107
3078
|
const res = await (0, $5OpyM$axios).post(url, model, {
|
|
3108
3079
|
headers: {
|
|
3109
|
-
...this.ENDPOINTS.HEADERS,
|
|
3110
3080
|
"x-api-access-sig": (0, $be7f9e5745d99d09$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference)
|
|
3111
3081
|
}
|
|
3112
3082
|
});
|
|
@@ -3343,7 +3313,6 @@ class $e8a8a43586c972c2$var$Calculator extends (0, $5OpyM$Component) {
|
|
|
3343
3313
|
try {
|
|
3344
3314
|
const response = await (0, $5OpyM$axios).get(url, {
|
|
3345
3315
|
headers: {
|
|
3346
|
-
...this.ENDPOINTS.HEADERS,
|
|
3347
3316
|
"x-api-access-sig": (0, $be7f9e5745d99d09$export$3db7bf9691bf4b62)('GET', url, null, this.state.reference)
|
|
3348
3317
|
}
|
|
3349
3318
|
});
|
|
@@ -5505,7 +5474,6 @@ class $aeba0491dead64b0$var$OperationsHelper {
|
|
|
5505
5474
|
const url = this.endpoints.OPERATIONS.calculate(storeId, source);
|
|
5506
5475
|
return await (0, $5OpyM$axios).post(url, body, {
|
|
5507
5476
|
headers: {
|
|
5508
|
-
...this.endpoints.HEADERS,
|
|
5509
5477
|
"x-api-access-sig": (0, $be7f9e5745d99d09$export$3db7bf9691bf4b62)('POST', url, body, this.reference)
|
|
5510
5478
|
}
|
|
5511
5479
|
});
|
|
@@ -7091,7 +7059,7 @@ function $c4ee7a827d19e0d2$var$Simulator(props) {
|
|
|
7091
7059
|
const __ENDPOINTS = new (0, $c2624340fd589f7f$export$2e2bcd8739ae039)(props.testMode);
|
|
7092
7060
|
const __calculateHelper = new (0, $006ea4d50140482f$export$2e2bcd8739ae039)(props.testMode);
|
|
7093
7061
|
const __operationsHelper = new (0, $aeba0491dead64b0$export$2e2bcd8739ae039)(props.testMode, props.reference);
|
|
7094
|
-
const __firebase = (0, $9ea2f2608ea58c4b$export$2e2bcd8739ae039)(props.testMode);
|
|
7062
|
+
const __firebase = (0, $9ea2f2608ea58c4b$export$2e2bcd8739ae039)(props.testMode, props.config);
|
|
7095
7063
|
const [simulatorMode, setSimulatorMode] = (0, $5OpyM$useState)((0, $3217af864b2b4eed$export$e3d7a3ffb08d3f7a).SEND);
|
|
7096
7064
|
const [suscribedGlobalOptions, setSuscribedGlobalOptions] = (0, $5OpyM$useState)(false);
|
|
7097
7065
|
const [globalTransferOptions, setGlobalTransferOptions] = (0, $5OpyM$useState)(null);
|
|
@@ -8026,7 +7994,8 @@ function $cf838c15c8b009ba$export$d75554d0168fcedc(props) {
|
|
|
8026
7994
|
startUrl: props.startUrl,
|
|
8027
7995
|
onlyView: props.onlyView ?? false,
|
|
8028
7996
|
initialCountryTo: props.initialCountryTo ?? "PE-USD",
|
|
8029
|
-
reference: props.reference || ""
|
|
7997
|
+
reference: props.reference || "",
|
|
7998
|
+
config: props.config
|
|
8030
7999
|
});
|
|
8031
8000
|
}
|
|
8032
8001
|
function $cf838c15c8b009ba$export$896df779a8e2818(props) {
|
|
@@ -8036,7 +8005,8 @@ function $cf838c15c8b009ba$export$896df779a8e2818(props) {
|
|
|
8036
8005
|
startUrl: props.startUrl,
|
|
8037
8006
|
couponCode: props.couponCode || "",
|
|
8038
8007
|
onlySimulation: props.onlySimulation ?? false,
|
|
8039
|
-
reference: props.reference || ""
|
|
8008
|
+
reference: props.reference || "",
|
|
8009
|
+
config: props.config
|
|
8040
8010
|
});
|
|
8041
8011
|
}
|
|
8042
8012
|
|