@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/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
|
-
|
|
1005
|
+
let firebaseConfig;
|
|
1006
|
+
if (externalConfig && externalConfig.provider) firebaseConfig = externalConfig.provider;
|
|
1007
|
+
else return console.error('No Firebase configuration provided');
|
|
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);
|
|
@@ -2363,15 +2335,14 @@ var $3641e36ddb9c1c48$export$2e2bcd8739ae039 = $3641e36ddb9c1c48$var$Timer;
|
|
|
2363
2335
|
var $df8d2892fe6558f0$exports = {};
|
|
2364
2336
|
|
|
2365
2337
|
class $df8d2892fe6558f0$var$EndPoints {
|
|
2366
|
-
constructor(testMode = 'production'){
|
|
2338
|
+
constructor(testMode = 'production', externalConfig = null){
|
|
2367
2339
|
this._testMode = testMode;
|
|
2368
|
-
this.baseUrl =
|
|
2340
|
+
this.baseUrl = externalConfig && externalConfig.url;
|
|
2369
2341
|
this.path_managment_operations = `${this.baseUrl}/handle-operations`;
|
|
2370
2342
|
}
|
|
2371
|
-
get HEADERS() {
|
|
2372
|
-
return this.baseUrl =
|
|
2373
|
-
}
|
|
2374
|
-
get COUPON() {
|
|
2343
|
+
/*get HEADERS() {
|
|
2344
|
+
return this.baseUrl = BACKEND_SETTINGS[this._testMode].HEADERS;
|
|
2345
|
+
};*/ get COUPON() {
|
|
2375
2346
|
return {
|
|
2376
2347
|
validate: `${this.path_managment_operations}/coupon/v1/validate`
|
|
2377
2348
|
};
|
|
@@ -2516,6 +2487,7 @@ function $7960feb2a8e3e0c6$export$3db7bf9691bf4b62(method, url, body = null, api
|
|
|
2516
2487
|
|
|
2517
2488
|
class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
|
|
2518
2489
|
state = {
|
|
2490
|
+
config: this.props.config,
|
|
2519
2491
|
testMode: this.props.testMode,
|
|
2520
2492
|
sendValue: 100.0,
|
|
2521
2493
|
sendValueUSD: 100.0,
|
|
@@ -2572,14 +2544,14 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
|
|
|
2572
2544
|
taxSender: 0.00,
|
|
2573
2545
|
taxReceiver: 0.00
|
|
2574
2546
|
};
|
|
2575
|
-
ENDPOINTS = new (0, (/*@__PURE__*/$parcel$interopDefault($df8d2892fe6558f0$exports)))(this.state.testMode);
|
|
2547
|
+
ENDPOINTS = new (0, (/*@__PURE__*/$parcel$interopDefault($df8d2892fe6558f0$exports)))(this.state.testMode, this.state.config);
|
|
2576
2548
|
constructor(props){
|
|
2577
2549
|
super(props);
|
|
2578
2550
|
this.unsubscribe = [];
|
|
2579
2551
|
}
|
|
2580
2552
|
async componentDidMount() {
|
|
2581
2553
|
//if (db) db.clearPersistence();
|
|
2582
|
-
const firebase = await (0, $9a120cc4db7b0570$export$2e2bcd8739ae039)(this.state.testMode);
|
|
2554
|
+
const firebase = await (0, $9a120cc4db7b0570$export$2e2bcd8739ae039)(this.state.testMode, this.state.config);
|
|
2583
2555
|
const db = firebase.firestore();
|
|
2584
2556
|
this.subscribeCalculatorConfig(db);
|
|
2585
2557
|
if (!sessionStorage.getItem(`storeId`) || sessionStorage.getItem(`storeId`) == null || sessionStorage.getItem(`storeId`) == undefined || sessionStorage.getItem(`storeId`) == "") await this.createTransaction(db);
|
|
@@ -3071,7 +3043,6 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
|
|
|
3071
3043
|
const url = this.ENDPOINTS.TRANSACTION.calculate_v2(this.state.storeId || sessionStorage.getItem('storeId'), "from");
|
|
3072
3044
|
const res = await (0, ($parcel$interopDefault($gXNCa$axios))).post(url, model, {
|
|
3073
3045
|
headers: {
|
|
3074
|
-
...this.ENDPOINTS.HEADERS,
|
|
3075
3046
|
"x-api-access-sig": (0, $7960feb2a8e3e0c6$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference)
|
|
3076
3047
|
}
|
|
3077
3048
|
});
|
|
@@ -3113,7 +3084,6 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
|
|
|
3113
3084
|
const url = this.ENDPOINTS.TRANSACTION.calculate_v2(this.state.storeId, source);
|
|
3114
3085
|
const res = await (0, ($parcel$interopDefault($gXNCa$axios))).post(url, model, {
|
|
3115
3086
|
headers: {
|
|
3116
|
-
...this.ENDPOINTS.HEADERS,
|
|
3117
3087
|
"x-api-access-sig": (0, $7960feb2a8e3e0c6$export$3db7bf9691bf4b62)('POST', url, model, this.state.reference)
|
|
3118
3088
|
}
|
|
3119
3089
|
});
|
|
@@ -3350,7 +3320,6 @@ class $c530beedeaeedc25$var$Calculator extends (0, $gXNCa$react.Component) {
|
|
|
3350
3320
|
try {
|
|
3351
3321
|
const response = await (0, ($parcel$interopDefault($gXNCa$axios))).get(url, {
|
|
3352
3322
|
headers: {
|
|
3353
|
-
...this.ENDPOINTS.HEADERS,
|
|
3354
3323
|
"x-api-access-sig": (0, $7960feb2a8e3e0c6$export$3db7bf9691bf4b62)('GET', url, null, this.state.reference)
|
|
3355
3324
|
}
|
|
3356
3325
|
});
|
|
@@ -5512,7 +5481,6 @@ class $c0c7909cfff012a2$var$OperationsHelper {
|
|
|
5512
5481
|
const url = this.endpoints.OPERATIONS.calculate(storeId, source);
|
|
5513
5482
|
return await (0, ($parcel$interopDefault($gXNCa$axios))).post(url, body, {
|
|
5514
5483
|
headers: {
|
|
5515
|
-
...this.endpoints.HEADERS,
|
|
5516
5484
|
"x-api-access-sig": (0, $7960feb2a8e3e0c6$export$3db7bf9691bf4b62)('POST', url, body, this.reference)
|
|
5517
5485
|
}
|
|
5518
5486
|
});
|
|
@@ -7098,7 +7066,7 @@ function $d3c2b8c012a239f6$var$Simulator(props) {
|
|
|
7098
7066
|
const __ENDPOINTS = new (0, $a67ff3d39107eba0$export$2e2bcd8739ae039)(props.testMode);
|
|
7099
7067
|
const __calculateHelper = new (0, $fe71048abacacae0$export$2e2bcd8739ae039)(props.testMode);
|
|
7100
7068
|
const __operationsHelper = new (0, $c0c7909cfff012a2$export$2e2bcd8739ae039)(props.testMode, props.reference);
|
|
7101
|
-
const __firebase = (0, $9a120cc4db7b0570$export$2e2bcd8739ae039)(props.testMode);
|
|
7069
|
+
const __firebase = (0, $9a120cc4db7b0570$export$2e2bcd8739ae039)(props.testMode, props.config);
|
|
7102
7070
|
const [simulatorMode, setSimulatorMode] = (0, $gXNCa$react.useState)((0, $ee1f0011b010ab9b$export$e3d7a3ffb08d3f7a).SEND);
|
|
7103
7071
|
const [suscribedGlobalOptions, setSuscribedGlobalOptions] = (0, $gXNCa$react.useState)(false);
|
|
7104
7072
|
const [globalTransferOptions, setGlobalTransferOptions] = (0, $gXNCa$react.useState)(null);
|
|
@@ -8033,7 +8001,8 @@ function $4fa36e821943b400$export$d75554d0168fcedc(props) {
|
|
|
8033
8001
|
startUrl: props.startUrl,
|
|
8034
8002
|
onlyView: props.onlyView ?? false,
|
|
8035
8003
|
initialCountryTo: props.initialCountryTo ?? "PE-USD",
|
|
8036
|
-
reference: props.reference || ""
|
|
8004
|
+
reference: props.reference || "",
|
|
8005
|
+
config: props.config
|
|
8037
8006
|
});
|
|
8038
8007
|
}
|
|
8039
8008
|
function $4fa36e821943b400$export$896df779a8e2818(props) {
|
|
@@ -8043,7 +8012,8 @@ function $4fa36e821943b400$export$896df779a8e2818(props) {
|
|
|
8043
8012
|
startUrl: props.startUrl,
|
|
8044
8013
|
couponCode: props.couponCode || "",
|
|
8045
8014
|
onlySimulation: props.onlySimulation ?? false,
|
|
8046
|
-
reference: props.reference || ""
|
|
8015
|
+
reference: props.reference || "",
|
|
8016
|
+
config: props.config
|
|
8047
8017
|
});
|
|
8048
8018
|
}
|
|
8049
8019
|
|