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/index.d.ts CHANGED
@@ -46,6 +46,7 @@ interface Payout {
46
46
  interface BackTestingMapProps {
47
47
  mapAccessToken: string;
48
48
  apiAccessToken: string;
49
+ env: 'dev' | 'uat' | 'prod';
49
50
  location: {
50
51
  longitude: number;
51
52
  latitude: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "back-testing-react",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Parametric back testing application developed by NormanMax Insurance Solutions",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -1,7 +1,9 @@
1
1
  import { Point } from "geojson";
2
2
  import { PayoutRequest } from "./back-testing-map.types";
3
3
 
4
- const API_ROOT_URI='https://api-uat.nms3939.com'
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 url = API_ROOT_URI + AppConfig.endpoints.backTesting.payouts;
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;