From 6dde3ac671e491b24577270299c9033dac0c3f83 Mon Sep 17 00:00:00 2001 From: Courtney Myers Date: Tue, 10 Dec 2024 18:03:47 -0500 Subject: [PATCH] Update overriding of s3 function's formUrl (used by File component) to use function exported by @formio/js instead of old formiojs package --- app/client/src/routes/crf2022.tsx | 8 ++------ app/client/src/routes/frf2022.tsx | 8 ++------ app/client/src/routes/frf2023.tsx | 8 ++------ app/client/src/routes/frf2024.tsx | 8 ++------ app/client/src/routes/helpdesk.tsx | 8 ++------ app/client/src/routes/prf2022.tsx | 8 ++------ app/client/src/routes/prf2023.tsx | 8 ++------ app/client/src/routes/prf2024.tsx | 8 ++------ app/client/src/vite-env.d.ts | 1 - 9 files changed, 16 insertions(+), 49 deletions(-) diff --git a/app/client/src/routes/crf2022.tsx b/app/client/src/routes/crf2022.tsx index 10a5be3a..fd7ac708 100644 --- a/app/client/src/routes/crf2022.tsx +++ b/app/client/src/routes/crf2022.tsx @@ -2,8 +2,8 @@ import { useEffect, useMemo, useRef } from "react"; import { useNavigate, useOutletContext, useParams } from "react-router-dom"; import { useQueryClient, useQuery, useMutation } from "@tanstack/react-query"; import { Dialog } from "@headlessui/react"; +import { Providers } from "@formio/js"; import { Formio, Form } from "@formio/react"; -import s3 from "formiojs/providers/storage/s3"; import clsx from "clsx"; import { cloneDeep, isEqual } from "lodash"; import icons from "uswds/img/sprite.svg"; @@ -54,10 +54,6 @@ function useFormioSubmissionQueryAndMutation(rebateId: string | undefined) { /** * Change the formUrl the File component's `uploadFile` uses, so the s3 * upload PUT request is routed through the server app. - * - * https://github.com/formio/formio.js/blob/master/src/components/file/File.js#L760 - * 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: { formUrl: string; @@ -65,7 +61,7 @@ function useFormioSubmissionQueryAndMutation(rebateId: string | undefined) { }) { const s3Formio = cloneDeep(formio); s3Formio.formUrl = `${serverUrl}/api/formio/2022/s3/crf/${mongoId}/${comboKey}`; - return s3(s3Formio); + return Providers.providers.storage.s3(s3Formio); }; return Promise.resolve(res); diff --git a/app/client/src/routes/frf2022.tsx b/app/client/src/routes/frf2022.tsx index a0f9c72e..ab37313b 100644 --- a/app/client/src/routes/frf2022.tsx +++ b/app/client/src/routes/frf2022.tsx @@ -2,8 +2,8 @@ import { useEffect, useMemo, useRef } from "react"; import { useNavigate, useOutletContext, useParams } from "react-router-dom"; import { useQueryClient, useQuery, useMutation } from "@tanstack/react-query"; import { Dialog } from "@headlessui/react"; +import { Providers } from "@formio/js"; import { Formio, Form } from "@formio/react"; -import s3 from "formiojs/providers/storage/s3"; import clsx from "clsx"; import { cloneDeep, isEqual } from "lodash"; import icons from "uswds/img/sprite.svg"; @@ -54,10 +54,6 @@ function useFormioSubmissionQueryAndMutation(mongoId: string | undefined) { /** * Change the formUrl the File component's `uploadFile` uses, so the s3 * upload PUT request is routed through the server app. - * - * https://github.com/formio/formio.js/blob/master/src/components/file/File.js#L760 - * 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: { formUrl: string; @@ -65,7 +61,7 @@ function useFormioSubmissionQueryAndMutation(mongoId: string | undefined) { }) { const s3Formio = cloneDeep(formio); s3Formio.formUrl = `${serverUrl}/api/formio/2022/s3/frf/${mongoId}/${comboKey}`; - return s3(s3Formio); + return Providers.providers.storage.s3(s3Formio); }; const data = { ...res.submission?.data }; diff --git a/app/client/src/routes/frf2023.tsx b/app/client/src/routes/frf2023.tsx index 9683e325..21fc4401 100644 --- a/app/client/src/routes/frf2023.tsx +++ b/app/client/src/routes/frf2023.tsx @@ -2,8 +2,8 @@ import { useEffect, useMemo, useRef } from "react"; import { useNavigate, useOutletContext, useParams } from "react-router-dom"; import { useQueryClient, useQuery, useMutation } from "@tanstack/react-query"; import { Dialog } from "@headlessui/react"; +import { Providers } from "@formio/js"; import { Formio, Form } from "@formio/react"; -import s3 from "formiojs/providers/storage/s3"; import clsx from "clsx"; import { cloneDeep, isEqual } from "lodash"; import icons from "uswds/img/sprite.svg"; @@ -54,10 +54,6 @@ function useFormioSubmissionQueryAndMutation(mongoId: string | undefined) { /** * Change the formUrl the File component's `uploadFile` uses, so the s3 * upload PUT request is routed through the server app. - * - * https://github.com/formio/formio.js/blob/master/src/components/file/File.js#L760 - * 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: { formUrl: string; @@ -65,7 +61,7 @@ function useFormioSubmissionQueryAndMutation(mongoId: string | undefined) { }) { const s3Formio = cloneDeep(formio); s3Formio.formUrl = `${serverUrl}/api/formio/2023/s3/frf/${mongoId}/${comboKey}`; - return s3(s3Formio); + return Providers.providers.storage.s3(s3Formio); }; return Promise.resolve(res); diff --git a/app/client/src/routes/frf2024.tsx b/app/client/src/routes/frf2024.tsx index c34d8425..3c3ff9ea 100644 --- a/app/client/src/routes/frf2024.tsx +++ b/app/client/src/routes/frf2024.tsx @@ -2,8 +2,8 @@ import { useEffect, useMemo, useRef } from "react"; import { useNavigate, useOutletContext, useParams } from "react-router-dom"; import { useQueryClient, useQuery, useMutation } from "@tanstack/react-query"; import { Dialog } from "@headlessui/react"; +import { Providers } from "@formio/js"; import { Formio, Form } from "@formio/react"; -import s3 from "formiojs/providers/storage/s3"; import clsx from "clsx"; import { cloneDeep, isEqual } from "lodash"; import icons from "uswds/img/sprite.svg"; @@ -54,10 +54,6 @@ function useFormioSubmissionQueryAndMutation(mongoId: string | undefined) { /** * Change the formUrl the File component's `uploadFile` uses, so the s3 * upload PUT request is routed through the server app. - * - * https://github.com/formio/formio.js/blob/master/src/components/file/File.js#L760 - * 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: { formUrl: string; @@ -65,7 +61,7 @@ function useFormioSubmissionQueryAndMutation(mongoId: string | undefined) { }) { const s3Formio = cloneDeep(formio); s3Formio.formUrl = `${serverUrl}/api/formio/2024/s3/frf/${mongoId}/${comboKey}`; - return s3(s3Formio); + return Providers.providers.storage.s3(s3Formio); }; return Promise.resolve(res); diff --git a/app/client/src/routes/helpdesk.tsx b/app/client/src/routes/helpdesk.tsx index 457727b1..be88fefc 100644 --- a/app/client/src/routes/helpdesk.tsx +++ b/app/client/src/routes/helpdesk.tsx @@ -6,8 +6,8 @@ import { useQuery, useMutation, } from "@tanstack/react-query"; +import { Providers } from "@formio/js"; import { Formio, Form } from "@formio/react"; -import s3 from "formiojs/providers/storage/s3"; import clsx from "clsx"; import { cloneDeep } from "lodash"; import icon from "uswds/img/usa-icons-bg/search--white.svg"; @@ -405,10 +405,6 @@ export function Helpdesk() { /** * Change the formUrl the File component's `uploadFile` uses, so the s3 * upload PUT request is routed through the server app. - * - * https://github.com/formio/formio.js/blob/master/src/components/file/File.js#L760 - * 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: { formUrl: string; @@ -416,7 +412,7 @@ export function Helpdesk() { }) { const s3Formio = cloneDeep(formio); s3Formio.formUrl = `${serverUrl}/api/help/formio/s3/${rebateYear}/${formType}`; - return s3(s3Formio); + return Providers.providers.storage.s3(s3Formio); }; return Promise.resolve(res); diff --git a/app/client/src/routes/prf2022.tsx b/app/client/src/routes/prf2022.tsx index 05921b2c..d2753e5b 100644 --- a/app/client/src/routes/prf2022.tsx +++ b/app/client/src/routes/prf2022.tsx @@ -2,8 +2,8 @@ import { useEffect, useMemo, useRef } from "react"; import { useNavigate, useOutletContext, useParams } from "react-router-dom"; import { useQueryClient, useQuery, useMutation } from "@tanstack/react-query"; import { Dialog } from "@headlessui/react"; +import { Providers } from "@formio/js"; import { Formio, Form } from "@formio/react"; -import s3 from "formiojs/providers/storage/s3"; import clsx from "clsx"; import { cloneDeep, isEqual } from "lodash"; import icons from "uswds/img/sprite.svg"; @@ -54,10 +54,6 @@ function useFormioSubmissionQueryAndMutation(rebateId: string | undefined) { /** * Change the formUrl the File component's `uploadFile` uses, so the s3 * upload PUT request is routed through the server app. - * - * https://github.com/formio/formio.js/blob/master/src/components/file/File.js#L760 - * 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: { formUrl: string; @@ -65,7 +61,7 @@ function useFormioSubmissionQueryAndMutation(rebateId: string | undefined) { }) { const s3Formio = cloneDeep(formio); s3Formio.formUrl = `${serverUrl}/api/formio/2022/s3/prf/${mongoId}/${comboKey}`; - return s3(s3Formio); + return Providers.providers.storage.s3(s3Formio); }; return Promise.resolve(res); diff --git a/app/client/src/routes/prf2023.tsx b/app/client/src/routes/prf2023.tsx index a8a34267..33fa5e44 100644 --- a/app/client/src/routes/prf2023.tsx +++ b/app/client/src/routes/prf2023.tsx @@ -2,8 +2,8 @@ import { useEffect, useMemo, useRef } from "react"; import { useNavigate, useOutletContext, useParams } from "react-router-dom"; import { useQueryClient, useQuery, useMutation } from "@tanstack/react-query"; import { Dialog } from "@headlessui/react"; +import { Providers } from "@formio/js"; import { Formio, Form } from "@formio/react"; -import s3 from "formiojs/providers/storage/s3"; import clsx from "clsx"; import { cloneDeep, isEqual } from "lodash"; import icons from "uswds/img/sprite.svg"; @@ -54,10 +54,6 @@ function useFormioSubmissionQueryAndMutation(rebateId: string | undefined) { /** * Change the formUrl the File component's `uploadFile` uses, so the s3 * upload PUT request is routed through the server app. - * - * https://github.com/formio/formio.js/blob/master/src/components/file/File.js#L760 - * 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: { formUrl: string; @@ -65,7 +61,7 @@ function useFormioSubmissionQueryAndMutation(rebateId: string | undefined) { }) { const s3Formio = cloneDeep(formio); s3Formio.formUrl = `${serverUrl}/api/formio/2023/s3/prf/${mongoId}/${comboKey}`; - return s3(s3Formio); + return Providers.providers.storage.s3(s3Formio); }; return Promise.resolve(res); diff --git a/app/client/src/routes/prf2024.tsx b/app/client/src/routes/prf2024.tsx index 52e9e251..42a64e4d 100644 --- a/app/client/src/routes/prf2024.tsx +++ b/app/client/src/routes/prf2024.tsx @@ -2,8 +2,8 @@ import { useEffect, useMemo, useRef } from "react"; import { useNavigate, useOutletContext, useParams } from "react-router-dom"; import { useQueryClient, useQuery, useMutation } from "@tanstack/react-query"; import { Dialog } from "@headlessui/react"; +import { Providers } from "@formio/js"; import { Formio, Form } from "@formio/react"; -import s3 from "formiojs/providers/storage/s3"; import clsx from "clsx"; import { cloneDeep, isEqual } from "lodash"; import icons from "uswds/img/sprite.svg"; @@ -54,10 +54,6 @@ function useFormioSubmissionQueryAndMutation(rebateId: string | undefined) { /** * Change the formUrl the File component's `uploadFile` uses, so the s3 * upload PUT request is routed through the server app. - * - * https://github.com/formio/formio.js/blob/master/src/components/file/File.js#L760 - * 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: { formUrl: string; @@ -65,7 +61,7 @@ function useFormioSubmissionQueryAndMutation(rebateId: string | undefined) { }) { const s3Formio = cloneDeep(formio); s3Formio.formUrl = `${serverUrl}/api/formio/2024/s3/prf/${mongoId}/${comboKey}`; - return s3(s3Formio); + return Providers.providers.storage.s3(s3Formio); }; return Promise.resolve(res); diff --git a/app/client/src/vite-env.d.ts b/app/client/src/vite-env.d.ts index 61098606..ec93094c 100644 --- a/app/client/src/vite-env.d.ts +++ b/app/client/src/vite-env.d.ts @@ -1,4 +1,3 @@ /// -declare module "formiojs/providers/storage/s3"; declare module "@formio/react";