Skip to content

Commit

Permalink
Merge pull request #513 from USEPA/feature/update-formiojs
Browse files Browse the repository at this point in the history
Feature/update formiojs
  • Loading branch information
courtneymyers authored Dec 11, 2024
2 parents 2602b4d + 915edc7 commit 4c00bc3
Show file tree
Hide file tree
Showing 12 changed files with 719 additions and 1,193 deletions.
1,843 changes: 701 additions & 1,142 deletions app/client/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"vite": "6.0.2"
},
"dependencies": {
"@formio/js": "5.0.0",
"@formio/premium": "1.18.4",
"@formio/react": "5.2.3",
"@formio/uswds": "2.4.8",
Expand All @@ -46,7 +47,6 @@
"@tanstack/react-query": "4.35.0",
"@tanstack/react-query-devtools": "4.35.0",
"bootstrap": "5.3.3",
"formiojs": "4.14.5",
"lodash": "4.17.21",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion app/client/src/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import "bootstrap/dist/css/bootstrap-grid.min.css";
import "@formio/uswds/dist/uswds.min.css";
import "@formio/choices.js/public/assets/styles/choices.min.css";
import "@formio/premium/dist/premium.css";
import "formiojs/dist/formio.full.min.css";
import "@formio/js/dist/formio.full.min.css";
// ---
import { serverBasePath, serverUrl, cloudSpace, messages } from "@/config";
import {
Expand Down
8 changes: 2 additions & 6 deletions app/client/src/routes/crf2022.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -54,18 +54,14 @@ 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;
[field: string]: unknown;
}) {
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);
Expand Down
8 changes: 2 additions & 6 deletions app/client/src/routes/frf2022.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -54,18 +54,14 @@ 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;
[field: string]: unknown;
}) {
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 };
Expand Down
8 changes: 2 additions & 6 deletions app/client/src/routes/frf2023.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -54,18 +54,14 @@ 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;
[field: string]: unknown;
}) {
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);
Expand Down
8 changes: 2 additions & 6 deletions app/client/src/routes/frf2024.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -54,18 +54,14 @@ 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;
[field: string]: unknown;
}) {
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);
Expand Down
8 changes: 2 additions & 6 deletions app/client/src/routes/helpdesk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -405,18 +405,14 @@ 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;
[field: string]: unknown;
}) {
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);
Expand Down
8 changes: 2 additions & 6 deletions app/client/src/routes/prf2022.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -54,18 +54,14 @@ 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;
[field: string]: unknown;
}) {
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);
Expand Down
8 changes: 2 additions & 6 deletions app/client/src/routes/prf2023.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -54,18 +54,14 @@ 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;
[field: string]: unknown;
}) {
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);
Expand Down
8 changes: 2 additions & 6 deletions app/client/src/routes/prf2024.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -54,18 +54,14 @@ 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;
[field: string]: unknown;
}) {
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);
Expand Down
1 change: 0 additions & 1 deletion app/client/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/// <reference types="vite/client" />

declare module "formiojs/providers/storage/s3";
declare module "@formio/react";

0 comments on commit 4c00bc3

Please sign in to comment.