Skip to content

Commit

Permalink
done use registration package
Browse files Browse the repository at this point in the history
  • Loading branch information
ap-justin committed Sep 23, 2024
1 parent 4b40ed3 commit 2e76504
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"dependencies": {
"@better-giving/assets": "1.0.18",
"@better-giving/registration": "1.0.11",
"@better-giving/registration": "1.0.13",
"@gsap/react": "2.1.1",
"@headlessui/react": "2.1.0",
"@hookform/error-message": "2.0.1",
Expand Down
10 changes: 1 addition & 9 deletions src/pages/Registration/Steps/OrgDetails/Form/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { endowDesignations } from "@better-giving/registration/models";
import countries from "assets/countries/all.json";
import ActivityCountries from "components/ActivityCountries";
import CountrySelector from "components/CountrySelector";
Expand All @@ -8,20 +9,11 @@ import { Field, Label, Radio } from "components/form";
import { unsdgs } from "constants/unsdgs";
import { TERMS_OF_USE_NPO } from "constants/urls";
import { Link } from "react-router-dom";
import type { EndowDesignation } from "types/aws";
import { steps } from "../../../routes";
import { useRegState } from "../../StepGuard";
import type { FormValues as FV } from "../types";
import useSubmit from "./useSubmit";

const endowDesignations: EndowDesignation[] = [
"Charity",
"Religious Organization",
"University",
"Hospital",
"Other",
];

export default function Form() {
const { data } = useRegState<2>();
const { submit, isSubmitting } = useSubmit();
Expand Down
4 changes: 3 additions & 1 deletion src/pages/Registration/Steps/OrgDetails/Form/useSubmit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useErrorContext } from "contexts/ErrorContext";
import { type SubmitHandler, useFormContext } from "react-hook-form";
import { useNavigate } from "react-router-dom";
import { useUpdateRegMutation } from "services/aws/registration";
import type { EndowDesignation } from "types/aws";
import { steps } from "../../../routes";
import { useRegState } from "../../StepGuard";
import type { FormValues } from "../types";
Expand Down Expand Up @@ -35,7 +36,8 @@ export default function useSubmit() {
) /**TODO: AWS update to accept number[] */,
kyc_donors_only: fv.isAnonymousDonationsAllowed === "no",
hq_country: fv.hq_country.name,
designation: fv.designation.value,
// required in schema
designation: fv.designation.value as EndowDesignation,
active_in_countries: fv.active_in_countries.map((opt) => opt.value),
});

Expand Down
4 changes: 2 additions & 2 deletions src/pages/Registration/Steps/OrgDetails/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Org } from "@better-giving/registration/models";
import { yupResolver } from "@hookform/resolvers/yup";
import { country } from "components/CountrySelector";
import { unsdgs } from "constants/unsdgs";
import { FormProvider, useForm } from "react-hook-form";
import type { RegV2 } from "types/aws";
import { useRegState, withStepGuard } from "../StepGuard";
import Form from "./Form";
import { schema } from "./schema";
Expand Down Expand Up @@ -39,7 +39,7 @@ function OrgDetails() {

export default withStepGuard(OrgDetails);

function formFomat(org: RegV2.Org): FormValues {
function formFomat(org: Org): FormValues {
return {
//level 1
website: org.website,
Expand Down
3 changes: 1 addition & 2 deletions src/pages/Registration/Steps/OrgDetails/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { Org } from "@better-giving/registration/models";
import type { EndowDesignation, Org } from "@better-giving/registration/models";
import type { Except, OverrideProperties } from "type-fest";
import type { EndowDesignation } from "types/aws";
import type { Country, OptionType } from "types/components";
import type { UNSDG_NUMS } from "types/lists";

Expand Down
1 change: 1 addition & 0 deletions src/pages/Registration/Welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function Component() {
data: reg,
isLoading,
isError,
/** @ts-ignore: TODO: simplify step type */
} = useApplicationNewQuery({ registrant_id: email, claim });

useEffect(() => {
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -822,12 +822,12 @@ __metadata:
languageName: node
linkType: hard

"@better-giving/registration@npm:1.0.11":
version: 1.0.11
resolution: "@better-giving/registration@npm:1.0.11"
"@better-giving/registration@npm:1.0.13":
version: 1.0.13
resolution: "@better-giving/registration@npm:1.0.13"
peerDependencies:
valibot: 0.42.0
checksum: 10/4dad40bdb768c78a67a627218afecd5fad57b57197f1eb5f0a7b72995fc231fdcc66b1fa67fabeb464497776707acc334a837990e8f1863ecf920e4d995359c4
checksum: 10/5af3dde366c19cdd39a96938dd0fed0d34c4ca4b230ffc401a7075c6871a48790c25980316a7e330c9989b9899619973e63bae51c4af1dbc8f742610552ff6d1
languageName: node
linkType: hard

Expand Down Expand Up @@ -3080,7 +3080,7 @@ __metadata:
resolution: "angelprotocol-web-app@workspace:."
dependencies:
"@better-giving/assets": "npm:1.0.18"
"@better-giving/registration": "npm:1.0.11"
"@better-giving/registration": "npm:1.0.13"
"@biomejs/biome": "npm:1.8.1"
"@gsap/react": "npm:2.1.1"
"@headlessui/react": "npm:2.1.0"
Expand Down

0 comments on commit 2e76504

Please sign in to comment.