Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(webforms): Init webforms #201

Merged
merged 580 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
580 commits
Select commit Hold shift + click to select a range
9c771ac
Merge pull request #170 from Enterprise-CMCS/finsoup
benjaminpaige Oct 18, 2023
9a6665f
Merge pull request #156 from Enterprise-CMCS/saw
benjaminpaige Oct 18, 2023
0c37aff
build out a little more
benjaminpaige Oct 18, 2023
d739678
Use Merriweather for section headers
charmcitygavin Oct 19, 2023
216fef5
Resolve radio button spacing issues
charmcitygavin Oct 19, 2023
b8cd152
Update full title for font testing
charmcitygavin Oct 19, 2023
5c7094b
Fix trash icon spacing
charmcitygavin Oct 19, 2023
e7dea62
Merge pull request #172 from Enterprise-CMCS/tiger
charmcitygavin Oct 19, 2023
c567fb0
initial field groups and unregistering
daniel-belcher Oct 19, 2023
a4c3382
feat: remove option for groups and fix shared field
daniel-belcher Oct 20, 2023
90ff9fe
remove logs
daniel-belcher Oct 20, 2023
c04e9b5
Merge pull request #173 from Enterprise-CMCS/multishark
benjaminpaige Oct 20, 2023
d0c58c5
Resolve font size and spacing issues
charmcitygavin Oct 23, 2023
989f9d2
Merge branch 'webforms' into tiger
charmcitygavin Oct 23, 2023
e1c25de
Add border and top gradient to form
charmcitygavin Oct 23, 2023
c274542
Add top padding after adding border/gradient
charmcitygavin Oct 23, 2023
bb4a4f4
Merge pull request #174 from Enterprise-CMCS/tiger
charmcitygavin Oct 23, 2023
4b9e8ac
feat(webform): doc initializer
pkim-gswell Oct 25, 2023
46a2597
Merge branch 'webforms' of https://github.com/Enterprise-CMCS/macpro-…
pkim-gswell Oct 25, 2023
c9df42c
feat(webform): doc initializer
pkim-gswell Oct 25, 2023
1cf6e58
feat(webform): doc initializer
pkim-gswell Oct 25, 2023
6fffa75
Merge pull request #178 from Enterprise-CMCS/finsoup
pkim-gswell Oct 27, 2023
77b5e72
add the rest of abp 1 data
daniel-belcher Oct 27, 2023
ee219b8
minor name tweaks
daniel-belcher Oct 27, 2023
cef346d
add scroll for select to account for quantity
daniel-belcher Oct 27, 2023
f3e8e42
Create useGetForm
charmcitygavin Oct 30, 2023
6e7ce85
Merge branch 'webforms' into tiger
charmcitygavin Oct 30, 2023
fe21784
Test useGetForm
charmcitygavin Oct 30, 2023
53ca0ec
Export useGetForm
charmcitygavin Oct 30, 2023
fc76a61
Merge pull request #179 from Enterprise-CMCS/abp1
benjaminpaige Oct 30, 2023
e024561
add accessibility issues
jdinh8124 Oct 31, 2023
b947838
Temporarily disable authorizer
charmcitygavin Oct 31, 2023
4f73705
Temporarily hard-code formId
charmcitygavin Oct 31, 2023
bd1194a
Wrap returns in response
charmcitygavin Oct 31, 2023
84f1051
Temp. disable 400 response
charmcitygavin Oct 31, 2023
7b1a0e1
Update index.tsx
jdinh8124 Oct 31, 2023
1271eec
Update index.tsx
jdinh8124 Oct 31, 2023
d0f2910
Re-enable error 400 response
charmcitygavin Oct 31, 2023
6dbb9f6
Update index.tsx
jdinh8124 Oct 31, 2023
eacf710
Update index.tsx
jdinh8124 Oct 31, 2023
0364367
WIP: Receive params instead of a body for GET req
charmcitygavin Nov 1, 2023
2c38067
WIP: Use query params
charmcitygavin Nov 1, 2023
ec532e2
Cleanup
charmcitygavin Nov 1, 2023
54f4c55
Cleanup
charmcitygavin Nov 1, 2023
dce9e57
Reenable AWS IAM roles for forms endpoint
charmcitygavin Nov 1, 2023
1b9a58c
Merge branch 'webforms' into tiger
charmcitygavin Nov 1, 2023
3bbb5ed
Use formID variable as query key
charmcitygavin Nov 2, 2023
3329ee5
Add a TODO reminder to use the Document type
charmcitygavin Nov 2, 2023
d0cc80f
continue to run accessibilities
jdinh8124 Nov 2, 2023
c4d516b
Merge pull request #183 from Enterprise-CMCS/tiger
charmcitygavin Nov 2, 2023
469690d
Merge branch 'master' into webforms
benjaminpaige Nov 3, 2023
8553ad3
feat(webform): doc validator
pkim-gswell Nov 3, 2023
a0eb009
Merge remote-tracking branch 'origin/webforms' into silky
jdinh8124 Nov 3, 2023
c301d20
Merge pull request #180 from Enterprise-CMCS/silky
jdinh8124 Nov 3, 2023
9ccaffb
feat(webform): doc validator
pkim-gswell Nov 3, 2023
697d4d6
fix(OY-25433): WIP filter changes
pkim-gswell Nov 6, 2023
cf6563e
Merge branch 'webforms' into silky
jdinh8124 Nov 6, 2023
0bcb64c
Merge remote-tracking branch 'origin/silky-os-filters' into silky
jdinh8124 Nov 6, 2023
cf2cd95
Merge master into webforms
benjaminpaige Nov 6, 2023
4e33d3c
Merge remote-tracking branch 'origin/webforms' into silky
jdinh8124 Nov 6, 2023
72823a4
Fix routing issue
benjaminpaige Nov 6, 2023
5822229
Merge remote-tracking branch 'origin/webforms' into silky
jdinh8124 Nov 6, 2023
80f873a
Merge branch 'master' of https://github.com/Enterprise-CMCS/macpro-ma…
pkim-gswell Nov 6, 2023
8353936
add type
jdinh8124 Nov 6, 2023
13b55df
Merge branch 'webforms' into finsoup
benjaminpaige Nov 6, 2023
c549866
Merge pull request #184 from Enterprise-CMCS/finsoup
pkim-gswell Nov 7, 2023
60982de
working through date logic
jdinh8124 Nov 7, 2023
ec43613
Update FilterableDateRange.tsx
jdinh8124 Nov 7, 2023
19f40bc
Ensure text size is consistent across form and with Figma
charmcitygavin Nov 8, 2023
6bb0f15
Labels should not be bold by default according to designs
charmcitygavin Nov 8, 2023
db358e7
Adjust leading to better reflect design
charmcitygavin Nov 8, 2023
b4e5225
Adjust form title spacing to match design
charmcitygavin Nov 8, 2023
de8f363
Merge pull request #188 from Enterprise-CMCS/tigertwo
charmcitygavin Nov 8, 2023
dedde42
Update ABP1 copy to match Figma
charmcitygavin Nov 8, 2023
7998712
Merge pull request #190 from Enterprise-CMCS/tigertwo
charmcitygavin Nov 8, 2023
6252d0e
add route back to temp form
daniel-belcher Nov 8, 2023
18d88f0
Merge branch 'master' into webforms
benjaminpaige Nov 9, 2023
03ceb18
Merge branch 'webforms' of github.com:Enterprise-CMCS/macpro-om-templ…
benjaminpaige Nov 9, 2023
0cbcc10
Merge branch 'master' into webforms
benjaminpaige Nov 9, 2023
7d03c3c
push calendar logic
jdinh8124 Nov 9, 2023
e9c98e8
feat(misc-inputs): Handle non standard numerical inputs
benjaminpaige Nov 13, 2023
00b44a8
little cleanup
benjaminpaige Nov 13, 2023
75b16f2
Merge pull request #193 from Enterprise-CMCS/misc-inputs
benjaminpaige Nov 13, 2023
3304bec
updated ui logic
jdinh8124 Nov 13, 2023
0f683d4
adjust date clearing logic
jdinh8124 Nov 13, 2023
d1cc6da
Merge branch 'master' into webforms
benjaminpaige Nov 13, 2023
2d344e1
add unregister effect in Slot comp
benjaminpaige Nov 14, 2023
2393b35
Add required attribute to abp1
benjaminpaige Nov 14, 2023
c08a2b1
Merge pull request #196 from Enterprise-CMCS/forms-req
benjaminpaige Nov 14, 2023
38d67ee
fix: change switch to radio with children
daniel-belcher Nov 14, 2023
6b0e4d6
fix accessibility and race condition
jdinh8124 Nov 14, 2023
207abf9
add end of day logic
jdinh8124 Nov 14, 2023
a8508da
fix: change to singular checkbox with child
daniel-belcher Nov 15, 2023
bf42c39
fix: remove fieldArray-fieldGroup undefined error
daniel-belcher Nov 15, 2023
ce5e238
fix: remove default Select and Radio options
daniel-belcher Nov 15, 2023
73d70b6
fix: select auto-sized for values
daniel-belcher Nov 15, 2023
0864d3b
Update FilterableDateRange.tsx
jdinh8124 Nov 15, 2023
f72d733
Update FilterableDateRange.tsx
jdinh8124 Nov 15, 2023
3770904
fix: fields no longer sharing names
daniel-belcher Nov 15, 2023
b450488
fix: account for sub-group groups
daniel-belcher Nov 15, 2023
615e71c
fix test
jdinh8124 Nov 15, 2023
b214352
fix end of day logic in range
jdinh8124 Nov 15, 2023
87983e1
first pass through Padma feedback
daniel-belcher Nov 16, 2023
92468f8
text changes
daniel-belcher Nov 16, 2023
5d2e7e1
clean logic
jdinh8124 Nov 16, 2023
6bfc09d
Merge pull request #194 from Enterprise-CMCS/silky
jdinh8124 Nov 16, 2023
9d2563e
Merge remote-tracking branch 'origin/webforms' into silky
jdinh8124 Nov 16, 2023
f767a24
fix: name mismatch
daniel-belcher Nov 16, 2023
2e7a9ca
Merge branch 'webforms' into padma-t1
daniel-belcher Nov 16, 2023
92ea530
add char limit to fields and text changes
daniel-belcher Nov 16, 2023
9469391
text changes
daniel-belcher Nov 16, 2023
0b71b87
trying new logic with new object
jdinh8124 Nov 16, 2023
627a733
add get logic
jdinh8124 Nov 16, 2023
412f956
types
jdinh8124 Nov 16, 2023
d3ea85c
adjust types
jdinh8124 Nov 16, 2023
d6f7e51
adjust types
jdinh8124 Nov 16, 2023
7acd121
Update index.tsx
jdinh8124 Nov 16, 2023
92d045d
type check
jdinh8124 Nov 16, 2023
d7ee9cc
Update initializer.ts
jdinh8124 Nov 16, 2023
feb0055
Update index.tsx
jdinh8124 Nov 16, 2023
a1209da
Update index.tsx
jdinh8124 Nov 16, 2023
7b3ec82
Add a Register button for logged-out users
charmcitygavin Nov 17, 2023
09fa6ab
fix: switch now changing values in form
daniel-belcher Nov 17, 2023
640a301
Add webforms page and conditional header link
benjaminpaige Nov 17, 2023
149db11
merge master into webforms
benjaminpaige Nov 17, 2023
97761ab
Merge branch 'webforms' of github.com:Enterprise-CMCS/macpro-om-templ…
benjaminpaige Nov 17, 2023
76ad120
feat: add select sorting
daniel-belcher Nov 17, 2023
2a3e100
testing logic
jdinh8124 Nov 17, 2023
db30896
Update forms.ts
jdinh8124 Nov 17, 2023
52ba100
fix logic
jdinh8124 Nov 17, 2023
ba5ae5d
running type logic
jdinh8124 Nov 17, 2023
7c7efe7
Update forms.ts
jdinh8124 Nov 17, 2023
3ad3bec
Merge pull request #202 from Enterprise-CMCS/padma-t1
daniel-belcher Nov 17, 2023
a5eb8a3
adjust build
jdinh8124 Nov 17, 2023
4672c45
add build logic
jdinh8124 Nov 17, 2023
c16daa7
Update serverless.yml
jdinh8124 Nov 17, 2023
39fe8d4
Update serverless.yml
jdinh8124 Nov 17, 2023
726b9f8
Update tsconfig.json
jdinh8124 Nov 17, 2023
2e113c5
Update package.json
jdinh8124 Nov 17, 2023
02c7acc
Update tsconfig.json
jdinh8124 Nov 20, 2023
fd0f953
Set up basic route for user profile
charmcitygavin Nov 20, 2023
ac43fb1
Merge branch 'webforms' into tigertwo
charmcitygavin Nov 20, 2023
e6bb9de
Add Profile route to ROUTES
charmcitygavin Nov 20, 2023
98141d7
add logic
jdinh8124 Nov 20, 2023
1a5e014
Update forms.ts
jdinh8124 Nov 20, 2023
b991000
Update forms.ts
jdinh8124 Nov 20, 2023
c1ccd7d
nodenext
jdinh8124 Nov 20, 2023
c6a43ac
log
jdinh8124 Nov 20, 2023
dc21b36
Update package.json
jdinh8124 Nov 20, 2023
ea5e01d
adjust logic
jdinh8124 Nov 20, 2023
32cc0eb
Update serverless.yml
jdinh8124 Nov 20, 2023
2049a64
Update serverless.yml
jdinh8124 Nov 20, 2023
e7296fc
Update serverless.yml
jdinh8124 Nov 20, 2023
4de764c
Update serverless.yml
jdinh8124 Nov 20, 2023
ff49f07
Update serverless.yml
jdinh8124 Nov 21, 2023
d075356
fix(char-limit): remove character limit in abp1
benjaminpaige Nov 21, 2023
85c2204
Update serverless.yml
jdinh8124 Nov 21, 2023
072163c
Update serverless.yml
jdinh8124 Nov 21, 2023
4d67eb8
Update serverless.yml
jdinh8124 Nov 21, 2023
b29cd27
change file
jdinh8124 Nov 21, 2023
cb8140e
Merge pull request #207 from Enterprise-CMCS/ben
benjaminpaige Nov 21, 2023
085b621
Update forms.ts
jdinh8124 Nov 21, 2023
b8bc1c1
.js
jdinh8124 Nov 21, 2023
924e049
Update forms.ts
jdinh8124 Nov 21, 2023
bdf2b79
next
jdinh8124 Nov 21, 2023
d75187a
Update forms.ts
jdinh8124 Nov 21, 2023
3a31ed5
Update serverless.yml
jdinh8124 Nov 21, 2023
f42b10d
itteratting
jdinh8124 Nov 21, 2023
a1dd8a9
itteratting
jdinh8124 Nov 21, 2023
dbc1eed
Update v1.ts
jdinh8124 Nov 21, 2023
afbe35d
Update tsconfig.json
jdinh8124 Nov 21, 2023
b29cf73
Update package.json
jdinh8124 Nov 21, 2023
bbb663a
Update forms.ts
jdinh8124 Nov 21, 2023
c9369c4
Update forms.ts
jdinh8124 Nov 21, 2023
934c6c0
json
jdinh8124 Nov 21, 2023
aefd5e7
Update package.json
jdinh8124 Nov 21, 2023
3f18d86
Update tsconfig.json
jdinh8124 Nov 21, 2023
d0176be
Merge pull request #209 from Enterprise-CMCS/utesting
benjaminpaige Nov 21, 2023
be32e52
Merge branch 'master' into webforms
benjaminpaige Nov 21, 2023
9cf7b08
adding logic
jdinh8124 Nov 21, 2023
622e80b
cleanup
jdinh8124 Nov 21, 2023
5ab2c35
Merge remote-tracking branch 'origin/webforms' into silky
jdinh8124 Nov 21, 2023
4830358
Clean up logic
jdinh8124 Nov 21, 2023
858f88a
update webforms link check
benjaminpaige Nov 21, 2023
3265100
Move form into Webform component dir
jdinh8124 Nov 21, 2023
6dc11e8
Improve spacing
charmcitygavin Nov 22, 2023
250b70b
Merge branch 'webforms' into tigertwo
charmcitygavin Nov 22, 2023
d2c8742
Remove Access box for now
charmcitygavin Nov 22, 2023
2c517f5
Add alert banner
charmcitygavin Nov 22, 2023
189de8d
Merge branch 'webforms', remote-tracking branch 'origin' into utesting
benjaminpaige Nov 22, 2023
c4f9685
add save draft
benjaminpaige Nov 22, 2023
7e5da9e
Move form schema types to shared folder
jdinh8124 Nov 22, 2023
68bfaa5
Cleanup
jdinh8124 Nov 22, 2023
a22c1bc
run logic
jdinh8124 Nov 22, 2023
a13d877
Additional cleanup
jdinh8124 Nov 22, 2023
677a837
Merge remote-tracking branch 'origin/webforms' into silky
jdinh8124 Nov 23, 2023
f8a2ab4
Update index.tsx
jdinh8124 Nov 23, 2023
94b52b0
pra disclosure
daniel-belcher Nov 24, 2023
fad2772
Update package.json
jdinh8124 Nov 24, 2023
90ef61f
Add isAuth to webform link condition
benjaminpaige Nov 24, 2023
bcb5cd8
Merge pull request #218 from Enterprise-CMCS/utesting
benjaminpaige Nov 24, 2023
3d4645f
Merge remote-tracking branch 'origin/webforms' into silky
jdinh8124 Nov 24, 2023
9e68c03
adjust logic with new webforms pull
jdinh8124 Nov 24, 2023
4600286
Merge branch 'webforms' into tigertwo
charmcitygavin Nov 27, 2023
3b554eb
Updated label per design feedback
charmcitygavin Nov 27, 2023
4fad11b
Set up structure for dropdown menu
charmcitygavin Nov 27, 2023
20c524a
Add links to dropdown
charmcitygavin Nov 27, 2023
720349a
Update menu colors and layout
charmcitygavin Nov 27, 2023
0d79e55
Add an arrow to indicate dropdown menu
charmcitygavin Nov 27, 2023
50148f8
add data check
jdinh8124 Nov 27, 2023
c89e105
Improve layout to better match design
charmcitygavin Nov 28, 2023
6bd3bcd
Parmaeterize the url to idm
mdial89f Nov 28, 2023
9e36951
removed nulls
jdinh8124 Nov 28, 2023
326713e
bump
mdial89f Nov 28, 2023
c58e5ce
guarentee formschema
jdinh8124 Nov 28, 2023
85114eb
Add a nicer default
mdial89f Nov 28, 2023
f416bee
add logic in case of no data
jdinh8124 Nov 28, 2023
468e0e6
Merge pull request #213 from Enterprise-CMCS/silky
jdinh8124 Nov 28, 2023
de40297
rename footer and temp remove back button
daniel-belcher Nov 28, 2023
b3400a4
Merge branch 'webforms' into oy2-26378
daniel-belcher Nov 28, 2023
e750abf
footer rename and relocation
daniel-belcher Nov 28, 2023
acd0936
Merge pull request #216 from Enterprise-CMCS/oy2-26378
daniel-belcher Nov 28, 2023
e350935
Use self-closing tag
charmcitygavin Nov 28, 2023
7f4663a
Remove cruft
charmcitygavin Nov 28, 2023
2e4860a
Merge branch 'webforms' into tigertwo
charmcitygavin Nov 28, 2023
8581718
Parameterize idm url
mdial89f Nov 28, 2023
f8d535a
one more
mdial89f Nov 28, 2023
fd1604c
Remove unused consts
charmcitygavin Nov 29, 2023
28ce76d
Add parameterized IDM link
charmcitygavin Nov 29, 2023
cf19b83
Move rolesDescriptions to user.ts
charmcitygavin Nov 29, 2023
033c866
Improve My Account menu styling
charmcitygavin Nov 29, 2023
e413ee7
Merge branch 'master' into webforms
benjaminpaige Nov 29, 2023
f955d22
Store role descriptions as object and remove function
charmcitygavin Nov 29, 2023
c94c551
Get role description strings from shared types
charmcitygavin Nov 29, 2023
d9b7486
Merge branch 'webforms' into tigertwo
charmcitygavin Nov 29, 2023
db640a7
Simplify type
charmcitygavin Nov 29, 2023
1450ec9
Update src/services/ui/src/components/Layout/index.tsx
charmcitygavin Nov 29, 2023
a4dec11
Improve a11y
charmcitygavin Nov 29, 2023
7efc01a
Restore top level H1
charmcitygavin Nov 29, 2023
a882cfe
Merge pull request #212 from Enterprise-CMCS/tigertwo
charmcitygavin Nov 29, 2023
6c8a163
coonvert form regex for json transmission
benjaminpaige Nov 30, 2023
e8bfec3
small fix
benjaminpaige Nov 30, 2023
6a940c4
var name change
benjaminpaige Nov 30, 2023
1778eb7
Prettier
benjaminpaige Nov 30, 2023
d87ca65
Merge pull request #236 from Enterprise-CMCS/utesting
benjaminpaige Nov 30, 2023
660fb62
add new diagram
jdinh8124 Nov 30, 2023
baa60a1
smaller svg
jdinh8124 Nov 30, 2023
6593b0b
Merge pull request #238 from Enterprise-CMCS/galapagos
jdinh8124 Nov 30, 2023
5dd35a5
Merge branch 'master' into webforms
benjaminpaige Dec 1, 2023
e4e3a11
adjust a thing
benjaminpaige Dec 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/assets/diagram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion docs/docs/services/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ The api service deploys a lambda-backed API Gateway that is used by the frontend

The largest component of the api service is the API Gateway itself. This is a standard deployment of a regional, REST API Gateway. We do not apply custom certificates or DNS names to the api gateway endpoint (yet); instead, our application uses the amazon generated SSL endpoint.

There are three endpoints on the api. Each is guarded by AWS IAM, meaning that while the API Gateway is publicly available, the API will not forward your request to the backing lambda unless you provide valid credentials obtained through AWS Cognito. This way, only users with an account that we can authenticate may successfully call endpoints. The three endpoints are:
There are four endpoints on the api. Each is guarded by AWS IAM, meaning that while the API Gateway is publicly available, the API will not forward your request to the backing lambda unless you provide valid credentials obtained through AWS Cognito. This way, only users with an account that we can authenticate may successfully call endpoints. The four endpoints are:
- /search (POST): This endpoint accepts search queries from clients in the form of OpenSearch Query DSL queries. Once the query is received, the lambda adds extra query filters to ensure fine grain auth. This works by looking up the user making the call in Cognito, determining what type of user (cms or state) is making the call, determining what states that user has access to (if appropriate), and modifying the query in a way that will only return results for those states. By design, the only thing the search endpoint adds is related to authentication; the rest of the query building is left to the frontend for faster and more flexible development.
- /item (POST): The item endpoint is used to fetch details for exactly one record. While you can form a query to do this and use the search endpoint, the item endpoint is for convenience. Simply make a post call containing the ID of the desired record to the item endpoint, and the record will be returned. Note that fine grain auth is still enforced in an identical way to search, whereby you will only obtain results for that ID if you should have access to that ID.
- /getAttachmentUrl (POST): This endpoint is used to generate a presigned url for direct client downloading of S3 data, enforcing fine grain auth along the way. This is how we securely allow download of submission attachment data. From the details page, a user may click a file to download. Once clicked, their client makes a post to /getAttachmentUrl with the attachment metadata. The lambda function determines if the caller should or should not have access based on identical logic as the other endpoints (the UI would not display something they cannot download, but this guards against bad actors). If access is allowed, the lambda function generates a presigned url good for 60 seconds and returns it to the client browser, at which point files are downloaded automatically.
- /forms (GET): This endpoint function serves as the backend for handling forms and their associated data. This function provides various features, including retrieving form data, validating access, and serving the requested form content. The request to this endpoint must include a formId in the request body. Optionally, you can include a formVersion parameter. If you access this endpoint with formId without specifying formVersion, it will return the latest version. Form schemas are stored in a Lambda layer. Each form is organized in its directory, and each version is stored within that directory. The Lambda layer is located in the "opt" directory when deployed to aws. To access a specific version of a form with a formId, use the following URL structure: /opt/${formId}/v${formVersion}.json. The JSON form schemas are versioned and stored in Git under the "api/layers" directory.

All endpoints and backing functions interact with the OpenSearch data layer. As such, and because OpenSearch is deployed within a VPC, all lambda functions of the api service are VPC based. The functions share a security group that allows outbound traffic.

Expand Down
141 changes: 141 additions & 0 deletions src/packages/shared-types/forms.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
import {
Control,
FieldArrayPath,
FieldValues,
RegisterOptions,
} from "react-hook-form";
import {
CalendarProps,
InputProps,
RadioProps,
SelectProps,
SwitchProps,
TextareaProps,
} from "shared-types";

export interface FormSchema {
header: string;
sections: Section[];
}

export type RHFSlotProps = {
name: string;
label?: string;
labelStyling?: string;
groupNamePrefix?: string;
description?: string;
dependency?: DependencyRule;
rules?: RegisterOptions;
} & {
[K in keyof RHFComponentMap]: {
rhf: K;
props?: RHFComponentMap[K];
fields?: K extends "FieldArray"
? RHFSlotProps[]
: K extends "FieldGroup"
? RHFSlotProps[]
: never;
};
}[keyof RHFComponentMap];

export type RHFOption = {
label: string;
value: string;
form?: FormGroup[];
slots?: RHFSlotProps[];
};

export type RHFComponentMap = {
Input: InputProps & {
label?: string;
description?: string;
};
Textarea: TextareaProps;
Switch: SwitchProps;
Select: SelectProps & { sort?: "ascending" | "descending" };
Radio: RadioProps & {
options: RHFOption[];
};
DatePicker: CalendarProps;
Checkbox: {
options: RHFOption[];
};
FieldArray: {
appendText?: string;
};
FieldGroup: {
appendText?: string;
removeText?: string;
};
};

export type FormGroup = {
description?: string;
slots: RHFSlotProps[];
wrapperStyling?: string;
dependency?: DependencyRule;
};

export interface Section {
title: string;
form: FormGroup[];
dependency?: DependencyRule;
}

export interface Document {
header: string;
sections: Section[];
}

export type FieldArrayProps<
T extends FieldValues,
TFieldArrayName extends FieldArrayPath<T> = FieldArrayPath<T>
> = {
control: Control<T, unknown>;
name: TFieldArrayName;
fields: RHFSlotProps[];
groupNamePrefix?: string;
appendText?: string;
};

export type FieldGroupProps<
T extends FieldValues,
TFieldArrayName extends FieldArrayPath<T> = FieldArrayPath<T>
> = {
control: Control<T, unknown>;
name: TFieldArrayName;
fields: RHFSlotProps[];
appendText?: string;
removeText?: string;
groupNamePrefix?: string;
};

type ConditionRules =
| {
type: "valueExists" | "valueNotExist";
}
| {
type: "expectedValue";
expectedValue: unknown;
};

type Condition = { name: string } & ConditionRules;

type Effects =
| {
type: "show" | "hide";
}
| {
type: "setValue";
newValue: unknown;
};

export interface DependencyRule {
conditions: Condition[];
effect: Effects;
}

export interface DependencyWrapperProps {
name?: string;
dependency?: DependencyRule;
}
2 changes: 2 additions & 0 deletions src/packages/shared-types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ export * from "./actions";
export * from "./attachments";
export * from "./authority";
export * from "./action-types/withdraw-record";
export * from "./forms";
export * from "./inputs";
45 changes: 45 additions & 0 deletions src/packages/shared-types/inputs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { DayPicker } from "react-day-picker";
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
import * as SwitchPrimitives from "@radix-ui/react-switch";
import * as SelectPrimitive from "@radix-ui/react-select";

export type CalendarProps = React.ComponentProps<typeof DayPicker> & {
className?: string;
classNames?: any;
showOutsideDays?: boolean;
};

export type DatePickerProps = {
date: Date | undefined;
onChange: (date: Date | undefined) => void;
};

export interface InputProps
extends React.InputHTMLAttributes<HTMLInputElement> {
icon?: string;
}

export type RadioProps = React.ComponentPropsWithoutRef<
typeof RadioGroupPrimitive.Root
> & {
className?: string;
};

export type SelectProps = React.ComponentPropsWithoutRef<
typeof SelectPrimitive.Root
> & {
options: { label: string; value: any }[];
className?: string;
};

export type SwitchProps = React.ComponentPropsWithoutRef<
typeof SwitchPrimitives.Root
> & {
className?: string;
};

export interface TextareaProps
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
charcount?: "simple" | "limited";
charcountstyling?: string;
}
7 changes: 7 additions & 0 deletions src/packages/shared-types/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,10 @@ export const CMS_READ_ONLY_ROLES = [
];

export const STATE_ROLES = [UserRoles.STATE_SUBMITTER];

export const RoleDescriptionStrings: { [key: string]: string } = {
[UserRoles.CMS_READ_ONLY]: "Read Only",
[UserRoles.CMS_REVIEWER]: "Reviewer",
[UserRoles.HELPDESK]: "Helpdesk",
[UserRoles.STATE_SUBMITTER]: "State Submitter",
};
1 change: 1 addition & 0 deletions src/packages/shared-utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./user-helper";
export * from "./s3-url-parser";
export * from "./rai-helper"
export * from "./regex"
43 changes: 43 additions & 0 deletions src/packages/shared-utils/regex.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { it, describe, expect } from "vitest";
import { convertRegexToString, reInsertRegex } from "./regex";

const testRegex = /^-?\d*\.?\d+$/g

const testForm = {
label: "SSI federal benefit amount",
value: "ssi_federal_benefit_amount",
slots: [
{
rhf: "Input",
name: "ssi_federal_benefit_percentage",
label: "Enter the SSI Federal Benefit Rate percentage",
props: {
icon: "%",
},
rules: {
pattern: {
value: testRegex,
message: "Must be a percentage",
},
required: "* Required",
},
},
],
};

describe("form regex", () => {
it("conversion logic should work", () => {
const result = convertRegexToString(testForm)
const val = result.slots[0].rules.pattern.value

const jsonVal = JSON.stringify(val)
expect(jsonVal).toBeTypeOf('string')

const parsedVal = JSON.parse(jsonVal)

const restoredRegex = new RegExp(parsedVal[1], parsedVal[2]);
expect(restoredRegex).toEqual(testRegex)
expect(reInsertRegex(result)).toEqual(testForm)

});
})
44 changes: 44 additions & 0 deletions src/packages/shared-utils/regex.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
export const convertRegexToString = (obj: any) => {
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
const value = obj[key];

if (value instanceof RegExp) {
// Convert RegExp to string
const str = value.toString();
// save it in this weird array thing
obj[key] = /\/(.*)\/(.*)/.exec(str);
} else if (typeof value === "object" && value !== null) {
// Recursively process nested objects
obj[key] = convertRegexToString(value);
}
}
}

return obj;
};

export const reInsertRegex = (obj: any) => {
for (const key in obj) {
if (obj.hasOwnProperty(key)) {
if (typeof obj[key] === "object" && obj[key] !== null) {
// If the current property is an object, recursively call the function
obj[key] = reInsertRegex(obj[key]);

// Check if the current object has a property "pattern" with a "value" key
if (
obj[key].hasOwnProperty("pattern") &&
typeof obj[key].pattern === "object" &&
obj[key].pattern.hasOwnProperty("value")
) {
// if its a pattern.value replace the value's value with a regex from the weird array thing
obj[key].pattern.value = new RegExp(
obj[key].pattern.value[1],
obj[key].pattern.value[2]
);
}
}
}
}
return obj;
};
Loading
Loading