- {kasp_enabled && (
+ {careConfig.kasp.enabled && (
- {kasp_string}
+
+ {careConfig.kasp.string}
+
- o ? `Show ${kasp_string}` : `Show Non ${kasp_string}`
+ o
+ ? `Show ${careConfig.kasp.string}`
+ : `Show Non ${careConfig.kasp.string}`
}
value={filterState.is_kasp}
onChange={(v) => setFilterState({ ...filterState, is_kasp: v })}
diff --git a/src/Components/Patient/PatientInfoCard.tsx b/src/Components/Patient/PatientInfoCard.tsx
index 005c93521d6..f301db6333e 100644
--- a/src/Components/Patient/PatientInfoCard.tsx
+++ b/src/Components/Patient/PatientInfoCard.tsx
@@ -12,7 +12,6 @@ import { Switch, MenuItem, Field, Label } from "@headlessui/react";
import { Link, navigate } from "raviger";
import { useState } from "react";
import CareIcon from "../../CAREUI/icons/CareIcon.js";
-import useConfig from "../../Common/hooks/useConfig.js";
import dayjs from "../../Utils/dayjs.js";
import {
classNames,
@@ -43,6 +42,7 @@ import useQuery from "../../Utils/request/useQuery.js";
import FetchRecordsModal from "../ABDM/FetchRecordsModal.js";
import { SkillModel } from "../Users/models.js";
import { AuthorizedForConsultationRelatedActions } from "../../CAREUI/misc/AuthorizedChild.js";
+import careConfig from "@careConfig";
const formatSkills = (arr: SkillModel[]) => {
const skills = arr.map((skill) => skill.skill_object.name);
@@ -73,8 +73,6 @@ export default function PatientInfoCard(props: {
const [openDischargeSummaryDialog, setOpenDischargeSummaryDialog] =
useState(false);
const [openDischargeDialog, setOpenDischargeDialog] = useState(false);
-
- const { enable_hcx, enable_abdm } = useConfig();
const [showLinkCareContext, setShowLinkCareContext] = useState(false);
const patient = props.patient;
@@ -665,7 +663,7 @@ export default function PatientInfoCard(props: {
],
]
.concat(
- enable_hcx
+ careConfig.hcx.enabled
? [
[
`/facility/${patient.facility}/patient/${patient.id}/consultation/${consultation?.id}/claims`,
@@ -735,7 +733,7 @@ export default function PatientInfoCard(props: {
- {enable_abdm &&
+ {careConfig.abdm.enabled &&
(patient.abha_number ? (
<>
- {enable_abdm && (
+ {careConfig.abdm.enabled && (
ABHA Details
diff --git a/src/Components/Patient/ShiftCreate.tsx b/src/Components/Patient/ShiftCreate.tsx
index 7307727d372..c3b01ad189d 100644
--- a/src/Components/Patient/ShiftCreate.tsx
+++ b/src/Components/Patient/ShiftCreate.tsx
@@ -20,7 +20,6 @@ import { navigate } from "raviger";
import { parsePhoneNumber } from "../../Utils/utils.js";
import { phonePreg } from "../../Common/validation";
import useAppHistory from "../../Common/hooks/useAppHistory";
-import useConfig from "../../Common/hooks/useConfig";
import { useTranslation } from "react-i18next";
import Page from "../Common/components/Page.js";
import Card from "../../CAREUI/display/Card.js";
@@ -30,6 +29,7 @@ import { PhoneNumberValidator } from "../Form/FieldValidators.js";
import useQuery from "../../Utils/request/useQuery.js";
import routes from "../../Redux/api.js";
import request from "../../Utils/request/request.js";
+import careConfig from "@careConfig";
const Loading = lazy(() => import("../Common/Loading"));
@@ -44,7 +44,6 @@ export const ShiftCreate = (props: patientShiftProps) => {
const [isLoading, setIsLoading] = useState(false);
const [patientCategory, setPatientCategory] = useState();
const { t } = useTranslation();
- const { wartime_shifting } = useConfig();
const initForm: any = {
shifting_approving_facility: null,
@@ -79,7 +78,7 @@ export const ShiftCreate = (props: patientShiftProps) => {
},
};
- if (wartime_shifting) {
+ if (careConfig.wartimeShifting) {
requiredFields = {
...requiredFields,
shifting_approving_facility: {
@@ -200,7 +199,7 @@ export const ShiftCreate = (props: patientShiftProps) => {
setIsLoading(true);
const data = {
- status: wartime_shifting ? "PENDING" : "APPROVED",
+ status: careConfig.wartimeShifting ? "PENDING" : "APPROVED",
origin_facility: props.facilityId,
shifting_approving_facility: state.form.shifting_approving_facility?.id,
assigned_facility: state.form?.assigned_facility?.id,
@@ -282,7 +281,7 @@ export const ShiftCreate = (props: patientShiftProps) => {
types={["mobile", "landline"]}
/>
- {wartime_shifting && (
+ {careConfig.wartimeShifting && (
Name of shifting approving facility
@@ -336,7 +335,7 @@ export const ShiftCreate = (props: patientShiftProps) => {
label="Patient Category"
/>
- {wartime_shifting && (
+ {careConfig.wartimeShifting && (
<>
= ({ form, onFormUpdate }) => {
- const { enable_scribe } = useConfig();
const [open, setOpen] = useState(false);
const [_progress, setProgress] = useState(0);
const [stage, setStage] = useState("start");
@@ -545,7 +544,7 @@ export const Scribe: React.FC = ({ form, onFormUpdate }) => {
}
}
- if (!enable_scribe) return null;
+ if (!careConfig.scribe.enabled) return null;
return (
diff --git a/src/Components/Shifting/BoardView.tsx b/src/Components/Shifting/BoardView.tsx
index a974e0da79f..f4fb45093aa 100644
--- a/src/Components/Shifting/BoardView.tsx
+++ b/src/Components/Shifting/BoardView.tsx
@@ -12,7 +12,6 @@ import { downloadShiftRequests } from "../../Redux/actions";
import { formatFilter } from "./Commons";
import { navigate } from "raviger";
-import useConfig from "../../Common/hooks/useConfig";
import useFilters from "../../Common/hooks/useFilters";
import { lazy, useLayoutEffect, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
@@ -21,6 +20,7 @@ import ButtonV2 from "../Common/components/ButtonV2";
import { AdvancedFilterButton } from "../../CAREUI/interactive/FiltersSlideover";
import CareIcon from "../../CAREUI/icons/CareIcon";
import Tabs from "../Common/components/Tabs";
+import careConfig from "@careConfig";
const Loading = lazy(() => import("../Common/Loading"));
const PageTitle = lazy(() => import("../Common/PageTitle"));
@@ -31,13 +31,12 @@ export default function BoardView() {
limit: -1,
cacheBlacklist: ["patient_name"],
});
- const { wartime_shifting } = useConfig();
- const shiftStatusOptions = wartime_shifting
+ const shiftStatusOptions = careConfig.wartimeShifting
? SHIFTING_CHOICES_WARTIME
: SHIFTING_CHOICES_PEACETIME;
- const COMPLETED = wartime_shifting
+ const COMPLETED = careConfig.wartimeShifting
? [
"COMPLETED",
"REJECTED",
diff --git a/src/Components/Shifting/ListFilter.tsx b/src/Components/Shifting/ListFilter.tsx
index 12bb17db09c..17692ac8f35 100644
--- a/src/Components/Shifting/ListFilter.tsx
+++ b/src/Components/Shifting/ListFilter.tsx
@@ -17,7 +17,6 @@ import DateRangeFormField from "../Form/FormFields/DateRangeFormField";
import FiltersSlideover from "../../CAREUI/interactive/FiltersSlideover";
import { SelectFormField } from "../Form/FormFields/SelectFormField";
import PhoneNumberFormField from "../Form/FormFields/PhoneNumberFormField";
-import useConfig from "../../Common/hooks/useConfig";
import useMergeState from "../../Common/hooks/useMergeState";
import { useTranslation } from "react-i18next";
@@ -26,18 +25,20 @@ import { dateQueryString, parsePhoneNumber } from "../../Utils/utils";
import dayjs from "dayjs";
import useQuery from "../../Utils/request/useQuery";
import routes from "../../Redux/api";
+import careConfig from "@careConfig";
const getDate = (value: any) =>
value && dayjs(value).isValid() && dayjs(value).toDate();
export default function ListFilter(props: any) {
- const { kasp_enabled, kasp_string, wartime_shifting } = useConfig();
const { filter, onChange, closeFilter, removeFilters } = props;
const { t } = useTranslation();
const shiftStatusOptions = (
- wartime_shifting ? SHIFTING_CHOICES_WARTIME : SHIFTING_CHOICES_PEACETIME
+ careConfig.wartimeShifting
+ ? SHIFTING_CHOICES_WARTIME
+ : SHIFTING_CHOICES_PEACETIME
).map((option) => option.text);
const [filterState, setFilterState] = useMergeState({
@@ -227,7 +228,7 @@ export default function ListFilter(props: any) {
- {wartime_shifting && (
+ {careConfig.wartimeShifting && (
{t("shifting_approving_facility")}
@@ -308,12 +309,12 @@ export default function ListFilter(props: any) {
errorClassName="hidden"
/>
- {kasp_enabled && (
+ {careConfig.kasp.enabled && (
option}
diff --git a/src/Components/Shifting/ListView.tsx b/src/Components/Shifting/ListView.tsx
index cfffcef7377..b05795f934d 100644
--- a/src/Components/Shifting/ListView.tsx
+++ b/src/Components/Shifting/ListView.tsx
@@ -11,11 +11,7 @@ import SearchInput from "../Form/SearchInput";
import { formatDateTime, formatPatientAge } from "../../Utils/utils";
import { formatFilter } from "./Commons";
import { navigate } from "raviger";
-
-import useConfig from "../../Common/hooks/useConfig";
-
import useFilters from "../../Common/hooks/useFilters";
-
import { useTranslation } from "react-i18next";
import { AdvancedFilterButton } from "../../CAREUI/interactive/FiltersSlideover";
import CareIcon from "../../CAREUI/icons/CareIcon";
@@ -24,11 +20,11 @@ import useAuthUser from "../../Common/hooks/useAuthUser";
import request from "../../Utils/request/request";
import routes from "../../Redux/api";
import useQuery from "../../Utils/request/useQuery";
+import careConfig from "@careConfig";
const Loading = lazy(() => import("../Common/Loading"));
export default function ListView() {
- const { wartime_shifting } = useConfig();
const {
qParams,
updateQuery,
@@ -127,7 +123,7 @@ export default function ListView() {
- {wartime_shifting && (
+ {careConfig.wartimeShifting && (
import("../Common/Loading"));
export default function ShiftDetails(props: { id: string }) {
- const { header_logo, kasp_full_string, wartime_shifting, kasp_enabled } =
- useConfig();
-
const [isPrintMode, setIsPrintMode] = useState(false);
const [isCopied, setIsCopied] = useState(false);
const [openDeleteShiftDialog, setOpenDeleteShiftDialog] = useState(false);
const { t } = useTranslation();
- const shiftStatusOptions = wartime_shifting
+ const shiftStatusOptions = careConfig.wartimeShifting
? SHIFTING_CHOICES_WARTIME
: SHIFTING_CHOICES_PEACETIME;
@@ -113,7 +110,7 @@ export default function ShiftDetails(props: { id: string }) {
t("reason") +
":" +
data?.reason;
- if (wartime_shifting) {
+ if (careConfig.wartimeShifting) {
formattedText +=
t("facility_preference") + ": " + data?.assigned_facility_type + "\n";
}
@@ -304,7 +301,9 @@ export default function ShiftDetails(props: { id: string }) {
return (
-
{data.is_kasp &&
}
+
+ {data.is_kasp &&
}
+
@@ -571,7 +570,7 @@ export default function ShiftDetails(props: { id: string }) {
{data?.origin_facility_object?.name || "--"}
- {wartime_shifting && (
+ {careConfig.wartimeShifting && (
{t("shifting_approving_facility")}:{" "}
@@ -635,10 +634,10 @@ export default function ShiftDetails(props: { id: string }) {
data?.patient_object.last_consultation?.category}
- {kasp_enabled && (
+ {careConfig.kasp.enabled && (
- {kasp_full_string}:{" "}
+ {careConfig.kasp.fullString}:{" "}
{" "}
@@ -646,11 +645,11 @@ export default function ShiftDetails(props: { id: string }) {
)}
- {wartime_shifting && (
+ {careConfig.wartimeShifting && (
<>
- {kasp_full_string}:{" "}
+ {careConfig.kasp.fullString}:{" "}
{" "}
@@ -813,7 +812,7 @@ export default function ShiftDetails(props: { id: string }) {
{showFacilityCard(data?.assigned_facility_object)}
)}
- {wartime_shifting && (
+ {careConfig.wartimeShifting && (
{t("details_of_shifting_approving_facility")}
diff --git a/src/Components/Shifting/ShiftDetailsUpdate.tsx b/src/Components/Shifting/ShiftDetailsUpdate.tsx
index 37adecaedcd..8e6fb582906 100644
--- a/src/Components/Shifting/ShiftDetailsUpdate.tsx
+++ b/src/Components/Shifting/ShiftDetailsUpdate.tsx
@@ -11,7 +11,6 @@ import {
USER_TYPES,
} from "../../Common/constants";
import { Cancel, Submit } from "../Common/components/ButtonV2";
-
import { navigate, useQueryParams } from "raviger";
import { lazy, useReducer, useState } from "react";
import { ConsultationModel } from "../Facility/models.js";
@@ -26,8 +25,6 @@ import TextAreaFormField from "../Form/FormFields/TextAreaFormField";
import TextFormField from "../Form/FormFields/TextFormField";
import { parsePhoneNumber } from "../../Utils/utils.js";
import useAppHistory from "../../Common/hooks/useAppHistory";
-import useConfig from "../../Common/hooks/useConfig";
-
import { useTranslation } from "react-i18next";
import CircularProgress from "../Common/components/CircularProgress.js";
import Card from "../../CAREUI/display/Card";
@@ -41,6 +38,7 @@ import { IShift } from "./models.js";
import request from "../../Utils/request/request.js";
import { PatientModel } from "../Patient/models.js";
import useAuthUser from "../../Common/hooks/useAuthUser.js";
+import careConfig from "@careConfig";
const Loading = lazy(() => import("../Common/Loading"));
@@ -51,9 +49,6 @@ interface patientShiftProps {
export const ShiftDetailsUpdate = (props: patientShiftProps) => {
const { goBack } = useAppHistory();
const { user_type, home_facility } = useAuthUser();
-
- const { kasp_full_string, kasp_enabled, wartime_shifting } = useConfig();
-
const [qParams, _] = useQueryParams();
const [isLoading, setIsLoading] = useState(true);
@@ -137,7 +132,7 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => {
},
};
- if (wartime_shifting) {
+ if (careConfig.wartimeShifting) {
requiredFields = {
...requiredFields,
shifting_approving_facility_object: {
@@ -336,7 +331,7 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => {
label={t("status")}
required
options={
- wartime_shifting
+ careConfig.wartimeShifting
? SHIFTING_CHOICES_WARTIME
: SHIFTING_CHOICES_PEACETIME
}
@@ -355,7 +350,7 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => {
className="w-full bg-white md:col-span-1 md:leading-5"
/>
- {wartime_shifting &&
+ {careConfig.wartimeShifting &&
(assignedUserLoading ? (
) : (
@@ -369,7 +364,7 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => {
/>
))}
- {wartime_shifting && (
+ {careConfig.wartimeShifting && (
{t("name_of_shifting_approving_facility")}
@@ -429,11 +424,11 @@ export const ShiftDetailsUpdate = (props: patientShiftProps) => {
optionValue={(option) => option.value}
/>
- {kasp_enabled && (
+ {careConfig.kasp.enabled && (
{
error={state.errors.patient_category}
/>
- {wartime_shifting && (
+ {careConfig.wartimeShifting && (
<>
{
- const { wartime_shifting } = useConfig();
const [modalFor, setModalFor] = useState({
externalId: undefined,
loading: false,
@@ -110,7 +108,7 @@ const ShiftCard = ({ shift, filter }: any) => {
- {wartime_shifting && (
+ {careConfig.wartimeShifting && (
{
plausible("pageview");
});
@@ -17,11 +15,11 @@ export default function Plausible() {
return (
);
}
diff --git a/src/Integrations/Sentry.tsx b/src/Integrations/Sentry.tsx
index 466f93487c4..90a8e78f3a9 100644
--- a/src/Integrations/Sentry.tsx
+++ b/src/Integrations/Sentry.tsx
@@ -1,25 +1,20 @@
+import careConfig from "@careConfig";
import { useEffect } from "react";
-import useConfig from "../Common/hooks/useConfig";
interface Props {
disabled?: boolean;
}
export default function Sentry({ disabled }: Props) {
- const { sentry_dsn, sentry_environment } = useConfig();
-
useEffect(() => {
- if (disabled || !sentry_dsn) {
+ if (disabled || !careConfig.sentry.dsn) {
return;
}
import("@sentry/browser").then((Sentry) => {
- Sentry.init({
- environment: sentry_environment,
- dsn: sentry_dsn,
- });
+ Sentry.init(careConfig.sentry);
});
- }, [sentry_dsn, sentry_environment, disabled]);
+ }, [disabled]);
return null;
}
diff --git a/src/Providers/AppConfigProvider.tsx b/src/Providers/AppConfigProvider.tsx
deleted file mode 100644
index 7492a83c126..00000000000
--- a/src/Providers/AppConfigProvider.tsx
+++ /dev/null
@@ -1,25 +0,0 @@
-import { AppConfigContext } from "../Common/hooks/useConfig";
-import Loading from "../Components/Common/Loading";
-import routes from "../Redux/api";
-import useQuery from "../Utils/request/useQuery";
-
-interface Props {
- children: React.ReactNode;
-}
-
-export default function AppConfigProvider({ children }: Props) {
- const { data, loading } = useQuery(routes.config, {
- refetchOnWindowFocus: false,
- prefetch: true,
- });
-
- if (loading || data === undefined) {
- return ;
- }
-
- return (
-
- {children}
-
- );
-}
diff --git a/src/Providers/AuthUserProvider.tsx b/src/Providers/AuthUserProvider.tsx
index c3e15b670cc..df2997abe2e 100644
--- a/src/Providers/AuthUserProvider.tsx
+++ b/src/Providers/AuthUserProvider.tsx
@@ -5,8 +5,8 @@ import routes from "../Redux/api";
import useQuery from "../Utils/request/useQuery";
import { LocalStorageKeys } from "../Common/constants";
import request from "../Utils/request/request";
-import useConfig from "../Common/hooks/useConfig";
import { navigate } from "raviger";
+import careConfig from "@careConfig";
interface Props {
children: React.ReactNode;
@@ -14,9 +14,6 @@ interface Props {
}
export default function AuthUserProvider({ children, unauthorized }: Props) {
- const { jwt_token_refresh_interval } = useConfig();
- const tokenRefreshInterval = jwt_token_refresh_interval ?? 5 * 60 * 1000;
-
const {
res,
data: user,
@@ -30,8 +27,11 @@ export default function AuthUserProvider({ children, unauthorized }: Props) {
}
updateRefreshToken(true);
- setInterval(() => updateRefreshToken(), tokenRefreshInterval);
- }, [user, tokenRefreshInterval]);
+ setInterval(
+ () => updateRefreshToken(),
+ careConfig.auth.tokenRefreshInterval,
+ );
+ }, [user]);
const signIn = useCallback(
async (creds: { username: string; password: string }) => {
diff --git a/src/Providers/index.tsx b/src/Providers/index.tsx
deleted file mode 100644
index 728ee9e1f91..00000000000
--- a/src/Providers/index.tsx
+++ /dev/null
@@ -1,5 +0,0 @@
-import AppConfigProvider from "./AppConfigProvider";
-import AuthUserProvider from "./AuthUserProvider";
-import HistoryAPIProvider from "./HistoryAPIProvider";
-
-export { AppConfigProvider, AuthUserProvider, HistoryAPIProvider };
diff --git a/src/Redux/Reducer.tsx b/src/Redux/Reducer.tsx
index 2c5335e6d7c..c7d4698b694 100644
--- a/src/Redux/Reducer.tsx
+++ b/src/Redux/Reducer.tsx
@@ -1,26 +1,6 @@
-import { IConfig } from "../Common/hooks/useConfig";
import { actions } from "./fireRequest";
-export const getCachedConfig = () => {
- const localConfig = localStorage.getItem("config");
- if (localConfig) {
- try {
- const config = JSON.parse(localConfig) as IConfig;
- return config;
- } catch (_) {
- return undefined;
- }
- }
-};
-
-const cachedConfig = getCachedConfig();
-
-const reducer = (
- state = {
- config: cachedConfig,
- },
- changeAction: any,
-) => {
+const reducer = (state = {}, changeAction: any) => {
switch (changeAction.type) {
case actions.FETCH_REQUEST: {
const obj: any = Object.assign({}, state);
diff --git a/src/Redux/api.tsx b/src/Redux/api.tsx
index b03faf07e5a..e72f7766bbe 100644
--- a/src/Redux/api.tsx
+++ b/src/Redux/api.tsx
@@ -1,4 +1,3 @@
-import { IConfig } from "../Common/hooks/useConfig";
import {
ConsentRequestModel,
CreateConsentTBody,
@@ -132,13 +131,6 @@ export interface LoginCredentials {
}
const routes = {
- config: {
- path: import.meta.env.REACT_APP_CONFIG ?? "/config.json",
- method: "GET",
- noAuth: true,
- TRes: Type(),
- },
-
createScribe: {
path: "/api/care_scribe/scribe/",
method: "POST",
diff --git a/src/Redux/fireRequest.tsx b/src/Redux/fireRequest.tsx
index fb1a7746167..fe72b2af0d2 100644
--- a/src/Redux/fireRequest.tsx
+++ b/src/Redux/fireRequest.tsx
@@ -3,6 +3,7 @@ import * as Notification from "../Utils/Notifications.js";
import { LocalStorageKeys } from "../Common/constants";
import api from "./api";
import axios from "axios";
+import careConfig from "@careConfig";
const requestMap: any = api;
export const actions = {
@@ -90,6 +91,7 @@ export const fireRequest = (
// set authorization header in the request header
const config: any = {
headers: {},
+ baseURL: careConfig.apiUrl,
};
if (!request.noAuth) {
const access_token = localStorage.getItem(LocalStorageKeys.accessToken);
diff --git a/src/Routers/AppRouter.tsx b/src/Routers/AppRouter.tsx
index bba3bd04899..60e0f9411d5 100644
--- a/src/Routers/AppRouter.tsx
+++ b/src/Routers/AppRouter.tsx
@@ -11,7 +11,6 @@ import {
SidebarShrinkContext,
} from "../Components/Common/Sidebar/Sidebar";
import { BLACKLISTED_PATHS } from "../Common/constants";
-import useConfig from "../Common/hooks/useConfig";
import SessionExpired from "../Components/ErrorPages/SessionExpired";
import HealthInformation from "../Components/ABDM/HealthInformation";
import ABDMFacilityRecords from "../Components/ABDM/ABDMFacilityRecords";
@@ -28,6 +27,7 @@ import ResourceRoutes from "./routes/ResourceRoutes";
import ExternalResultRoutes from "./routes/ExternalResultRoutes";
import { DetailRoute } from "./types";
import useAuthUser from "../Common/hooks/useAuthUser";
+import careConfig from "@careConfig";
const Routes = {
"/": () => ,
@@ -59,11 +59,10 @@ const Routes = {
export default function AppRouter() {
const authUser = useAuthUser();
- const { main_logo, enable_hcx } = useConfig();
let routes = Routes;
- if (enable_hcx) {
+ if (careConfig.hcx.enabled) {
routes = { ...routes, ...HCXRoutes };
}
@@ -144,7 +143,7 @@ export default function AppRouter() {
>
diff --git a/src/Utils/request/request.ts b/src/Utils/request/request.ts
index 9dd803148bb..151cc30c460 100644
--- a/src/Utils/request/request.ts
+++ b/src/Utils/request/request.ts
@@ -1,3 +1,4 @@
+import careConfig from "@careConfig";
import handleResponse from "./handleResponse";
import { RequestOptions, RequestResult, Route } from "./types";
import { makeHeaders, makeUrl } from "./utils";
@@ -34,7 +35,7 @@ export default async function request(
}
const signal = controller?.signal ?? controllerRef?.current?.signal;
- const url = makeUrl(path, query, pathParams);
+ const url = `${careConfig.apiUrl}${makeUrl(path, query, pathParams)}`;
const options: RequestInit = { method, signal };
diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts
index c899d453626..b290add72f9 100644
--- a/src/vite-env.d.ts
+++ b/src/vite-env.d.ts
@@ -1,14 +1,43 @@
///
///
interface ImportMetaEnv {
+ readonly CARE_CDN_URL?: string;
+
readonly REACT_APP_TITLE: string;
readonly REACT_APP_META_DESCRIPTION: string;
readonly REACT_APP_COVER_IMAGE: string;
readonly REACT_APP_COVER_IMAGE_ALT: string;
- readonly REACT_APP_CONFIG: string | undefined;
readonly REACT_PUBLIC_URL: string;
- readonly REACT_APP_SITE_URL: string;
- readonly REACT_APP_ANALYTICS_SERVER_URL: string;
+ readonly REACT_CARE_API_URL: string;
+ readonly REACT_DASHBOARD_URL?: string;
+ readonly REACT_GITHUB_URL?: string;
+ readonly REACT_OHCN_URL?: string;
+ readonly REACT_HEADER_LOGO?: string;
+ readonly REACT_MAIN_LOGO?: string;
+ readonly REACT_STATE_LOGO?: string;
+ readonly REACT_CUSTOM_LOGO?: string;
+ readonly REACT_CUSTOM_LOGO_ALT?: string;
+ readonly REACT_CUSTOM_DESCRIPTION?: string;
+ readonly REACT_GMAPS_API_KEY?: string;
+ readonly REACT_GOV_DATA_API_KEY?: string;
+ readonly REACT_RECAPTCHA_SITE_KEY?: string;
+ readonly REACT_KASP_ENABLED?: string;
+ readonly REACT_KASP_STRING?: string;
+ readonly REACT_KASP_FULL_STRING?: string;
+ readonly REACT_SAMPLE_FORMAT_ASSET_IMPORT?: string;
+ readonly REACT_SAMPLE_FORMAT_EXTERNAL_RESULT_IMPORT?: string;
+ readonly REACT_WARTIME_SHIFTING?: string;
+ readonly REACT_JWT_TOKEN_REFRESH_INTERVAL?: string;
+ readonly REACT_MIN_ENCOUNTER_DATE?: string;
+
+ // Plugins related envs...
+ readonly REACT_PLAUSIBLE_SERVER_URL?: string;
+ readonly REACT_PLAUSIBLE_SITE_DOMAIN?: string;
+ readonly REACT_SENTRY_DSN?: string;
+ readonly REACT_SENTRY_ENVIRONMENT?: string;
+ readonly REACT_ENABLE_HCX?: string;
+ readonly REACT_ENABLE_ABDM?: string;
+ readonly REACT_ENABLE_SCRIBE?: string;
}
interface ImportMeta {
diff --git a/tsconfig.json b/tsconfig.json
index 23f7ab14d4a..61e8476b152 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -15,10 +15,11 @@
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
- "types": ["vite/client", "vite-plugin-pwa/client"]
+ "types": ["vite/client", "vite-plugin-pwa/client"],
+ "paths": {
+ "@careConfig": ["./care.config.ts"]
+ }
},
- "include": ["src"],
- "exclude": [
- "src/**/*.gen.tsx"
- ]
+ "include": ["src", "care.config.ts"],
+ "exclude": ["src/**/*.gen.tsx"]
}
diff --git a/vite.config.mts b/vite.config.mts
index a8f946c3e75..39ff4b4e99e 100644
--- a/vite.config.mts
+++ b/vite.config.mts
@@ -84,6 +84,11 @@ export default {
},
}),
],
+ resolve: {
+ alias: {
+ "@careConfig": path.resolve(__dirname, "./care.config.ts"),
+ },
+ },
build: {
outDir: "build",
assetsDir: "bundle",
@@ -100,12 +105,6 @@ export default {
},
server: {
port: 4000,
- proxy: {
- "/api": {
- target: process.env.CARE_API ?? "https://careapi.ohc.network",
- changeOrigin: true,
- },
- },
},
preview: {
headers: {
@@ -117,11 +116,5 @@ export default {
object-src 'self' ${cdnUrls};`,
},
port: 4000,
- proxy: {
- "/api": {
- target: process.env.CARE_API ?? "https://careapi.ohc.network",
- changeOrigin: true,
- },
- },
},
};