diff --git a/app/client/src/components/providers.tsx b/app/client/src/components/providers.tsx index 495e4cc6..02d078ca 100644 --- a/app/client/src/components/providers.tsx +++ b/app/client/src/components/providers.tsx @@ -8,7 +8,7 @@ import { RebateYearProvider } from "@/contexts/rebateYear"; declare global { interface Window { - csb: any; + csb?: { toggleReactQueryDevtools: () => void }; } } @@ -22,11 +22,12 @@ export function Providers(props: { children: ReactNode }) { const { children } = props; const [queryClient] = useState(() => new QueryClient()); - const [devtoolsDisplayed, setDevtoolsDisplayed] = useState(false); + const [reactQueryDevtoolsShown, setReactQueryDevtoolsShown] = useState(false); useEffect(() => { - window.csb ??= {}; - window.csb.toggleDevtools = () => setDevtoolsDisplayed((value) => !value); + window.csb ??= { + toggleReactQueryDevtools: () => setReactQueryDevtoolsShown((val) => !val), + }; }); return ( @@ -37,7 +38,7 @@ export function Providers(props: { children: ReactNode }) { - {devtoolsDisplayed && ( + {reactQueryDevtoolsShown && ( diff --git a/app/client/src/routes/crf2022.tsx b/app/client/src/routes/crf2022.tsx index 63da1ca5..86597dfe 100644 --- a/app/client/src/routes/crf2022.tsx +++ b/app/client/src/routes/crf2022.tsx @@ -63,7 +63,10 @@ function useFormioSubmissionQueryAndMutation(rebateId: string | undefined) { * https://github.com/formio/formio.js/blob/master/src/providers/storage/s3.js#L5 * https://github.com/formio/formio.js/blob/master/src/providers/storage/xhr.js#L90 */ - Formio.Providers.providers.storage.s3 = function (formio: any) { + Formio.Providers.providers.storage.s3 = function (formio: { + formUrl: string; + [field: string]: unknown; + }) { const s3Formio = cloneDeep(formio); s3Formio.formUrl = `${serverUrl}/api/formio/2022/s3/crf/${mongoId}/${comboKey}`; return s3(s3Formio); diff --git a/app/client/src/routes/frf2022.tsx b/app/client/src/routes/frf2022.tsx index c628b028..1c72d84d 100644 --- a/app/client/src/routes/frf2022.tsx +++ b/app/client/src/routes/frf2022.tsx @@ -63,7 +63,10 @@ function useFormioSubmissionQueryAndMutation(mongoId: string | undefined) { * https://github.com/formio/formio.js/blob/master/src/providers/storage/s3.js#L5 * https://github.com/formio/formio.js/blob/master/src/providers/storage/xhr.js#L90 */ - Formio.Providers.providers.storage.s3 = function (formio: any) { + Formio.Providers.providers.storage.s3 = function (formio: { + formUrl: string; + [field: string]: unknown; + }) { const s3Formio = cloneDeep(formio); s3Formio.formUrl = `${serverUrl}/api/formio/2022/s3/frf/${mongoId}/${comboKey}`; return s3(s3Formio); diff --git a/app/client/src/routes/frf2023.tsx b/app/client/src/routes/frf2023.tsx index fa13aca5..5226cbb8 100644 --- a/app/client/src/routes/frf2023.tsx +++ b/app/client/src/routes/frf2023.tsx @@ -62,7 +62,10 @@ function useFormioSubmissionQueryAndMutation(mongoId: string | undefined) { * https://github.com/formio/formio.js/blob/master/src/providers/storage/s3.js#L5 * https://github.com/formio/formio.js/blob/master/src/providers/storage/xhr.js#L90 */ - Formio.Providers.providers.storage.s3 = function (formio: any) { + Formio.Providers.providers.storage.s3 = function (formio: { + formUrl: string; + [field: string]: unknown; + }) { const s3Formio = cloneDeep(formio); s3Formio.formUrl = `${serverUrl}/api/formio/2023/s3/frf/${mongoId}/${comboKey}`; return s3(s3Formio); diff --git a/app/client/src/routes/prf2022.tsx b/app/client/src/routes/prf2022.tsx index c597142b..a7502314 100644 --- a/app/client/src/routes/prf2022.tsx +++ b/app/client/src/routes/prf2022.tsx @@ -63,7 +63,10 @@ function useFormioSubmissionQueryAndMutation(rebateId: string | undefined) { * https://github.com/formio/formio.js/blob/master/src/providers/storage/s3.js#L5 * https://github.com/formio/formio.js/blob/master/src/providers/storage/xhr.js#L90 */ - Formio.Providers.providers.storage.s3 = function (formio: any) { + Formio.Providers.providers.storage.s3 = function (formio: { + formUrl: string; + [field: string]: unknown; + }) { const s3Formio = cloneDeep(formio); s3Formio.formUrl = `${serverUrl}/api/formio/2022/s3/prf/${mongoId}/${comboKey}`; return s3(s3Formio); diff --git a/app/client/src/utilities.ts b/app/client/src/utilities.ts index c90058d9..6c7fa015 100644 --- a/app/client/src/utilities.ts +++ b/app/client/src/utilities.ts @@ -236,7 +236,7 @@ export type Rebate = }; }; -async function fetchData(url: string, options: RequestInit) { +async function fetchData(url: string, options: RequestInit) { try { const response = await fetch(url, options); const contentType = response.headers.get("content-type"); @@ -253,7 +253,7 @@ async function fetchData(url: string, options: RequestInit) { * Fetches data and returns a promise containing JSON fetched from a provided * web service URL or handles any other OK response returned from the server */ -export function getData(url: string) { +export function getData(url: string) { return fetchData(url, { method: "GET", credentials: "include" as const, @@ -264,7 +264,7 @@ export function getData(url: string) { * Posts JSON data and returns a promise containing JSON fetched from a provided * web service URL or handles any other OK response returned from the server */ -export function postData(url: string, data: object) { +export function postData(url: string, data: object) { return fetchData(url, { method: "POST", credentials: "include" as const,