back-testing-react 1.0.6 → 1.0.7
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/cjs/index.js +19 -19
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +19 -19
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/back-testing-map/back-testing-map.service.ts +19 -4
- package/src/components/back-testing-map/back-testing-map.tsx +1 -1
- package/src/components/back-testing-map/back-testing-map.types.ts +1 -0
- package/src/components/back-testing-wizard/back-testing-wizard.stories.tsx +1 -0
- package/src/components/back-testing-wizard/back-testing-wizard.tsx +1 -0
- package/src/components/back-testing-wizard/back-testing-wizard.types.ts +1 -0
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Point } from "geojson";
|
|
2
2
|
import { PayoutRequest } from "./back-testing-map.types";
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const DEV_API_ROOT_URI='https://api-dev.nms3939.com'
|
|
5
|
+
const UAT_API_ROOT_URI='https://api-uat.nms3939.com'
|
|
6
|
+
const PROD_API_ROOT_URI='https://api-prod.nms3939.com'
|
|
5
7
|
|
|
6
8
|
export class AppConfig {
|
|
7
9
|
public static readonly endpoints = {
|
|
@@ -61,8 +63,9 @@ export interface PayoutResponse {
|
|
|
61
63
|
payouts: StormPayout[];
|
|
62
64
|
}
|
|
63
65
|
|
|
64
|
-
export const fetchPayouts = async (request: PayoutRequest, apiKey: string) => {
|
|
65
|
-
const
|
|
66
|
+
export const fetchPayouts = async (request: PayoutRequest, apiKey: string, env: 'dev' | 'uat' | 'prod') => {
|
|
67
|
+
const rootURI = selectRootURI(env);
|
|
68
|
+
const url = rootURI + AppConfig.endpoints.backTesting.payouts;
|
|
66
69
|
|
|
67
70
|
const response = await fetch(url, {
|
|
68
71
|
method: "POST",
|
|
@@ -76,4 +79,16 @@ export const fetchPayouts = async (request: PayoutRequest, apiKey: string) => {
|
|
|
76
79
|
const result: PayoutResponse = await response.json();
|
|
77
80
|
return result;
|
|
78
81
|
|
|
79
|
-
};
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
function selectRootURI( env: 'dev' | 'uat' | 'prod'){
|
|
85
|
+
let rootURI = '';
|
|
86
|
+
if(env == 'dev'){
|
|
87
|
+
rootURI = DEV_API_ROOT_URI;
|
|
88
|
+
} else if (env == 'uat'){
|
|
89
|
+
rootURI = UAT_API_ROOT_URI;
|
|
90
|
+
} else {
|
|
91
|
+
rootURI = PROD_API_ROOT_URI;
|
|
92
|
+
}
|
|
93
|
+
return rootURI;
|
|
94
|
+
}
|
|
@@ -59,7 +59,7 @@ const BackTestingMap = forwardRef<BackTestingActions, BackTestingMapProps>((prop
|
|
|
59
59
|
ciac: ciac
|
|
60
60
|
}
|
|
61
61
|
props.onAppStatusChange('loading')
|
|
62
|
-
fetchPayouts(request, props.apiAccessToken).then((data) => {
|
|
62
|
+
fetchPayouts(request, props.apiAccessToken,props.env).then((data) => {
|
|
63
63
|
let storms = data.payouts.map((storm,index) => { storm.color = randomColor(index); return storm})
|
|
64
64
|
if(props.onCalculatePayouts != undefined){
|
|
65
65
|
props.onCalculatePayouts(storms);
|
|
@@ -50,6 +50,7 @@ export interface PayoutRequest {
|
|
|
50
50
|
export interface BackTestingMapProps {
|
|
51
51
|
mapAccessToken: string,
|
|
52
52
|
apiAccessToken: string,
|
|
53
|
+
env: 'dev'|'uat'|'prod',
|
|
53
54
|
location: {longitude: number, latitude: number } | undefined | null,
|
|
54
55
|
limit: number | undefined | null,
|
|
55
56
|
ciacRadius: number | undefined | null,
|
|
@@ -12,6 +12,7 @@ export const BackTestingWizardTest = Template.bind({});
|
|
|
12
12
|
BackTestingWizardTest.args = {
|
|
13
13
|
mapAccessToken: "",
|
|
14
14
|
apiAccessToken: "",
|
|
15
|
+
env:'uat',
|
|
15
16
|
selectedProxyPayoutOptionIndex:0,
|
|
16
17
|
proxyPayoutOptions: [
|
|
17
18
|
{key:'74 - 119 Standard Payout', value:payoutTable_74_119()},
|
|
@@ -73,6 +73,7 @@ function BackTestingWizard(props: BackTestingWizardProps){
|
|
|
73
73
|
<BackTestingMap
|
|
74
74
|
apiAccessToken={props.apiAccessToken}
|
|
75
75
|
mapAccessToken={props.mapAccessToken}
|
|
76
|
+
env={props.env}
|
|
76
77
|
appStatus={appStatus}
|
|
77
78
|
onAppStatusChange={setAppStatus}
|
|
78
79
|
location={payoutRequest.longitude && payoutRequest.latitude ? {longitude: payoutRequest.longitude, latitude:payoutRequest.latitude} : undefined}
|
|
@@ -3,6 +3,7 @@ import { Payout } from "../back-testing-map/back-testing-map.types";
|
|
|
3
3
|
export interface BackTestingWizardProps {
|
|
4
4
|
apiAccessToken:string,
|
|
5
5
|
mapAccessToken:string,
|
|
6
|
+
env: 'dev'|'uat'|'prod',
|
|
6
7
|
selectedProxyPayoutOptionIndex:number;
|
|
7
8
|
proxyPayoutOptions: {key:string,value: Payout[]}[],
|
|
8
9
|
selectedAnemometerPayoutOptionIndex:number;
|