Link Creation Feature – Client Side Refactoring #218
Labels
Core
Work to do on the core system of the App
Frontend
Frontend Related Issue
⚡Important
High-impact issue that needs to be resolved before the next release
New Feature
New feature to be implemented
Refactor
Code Improvement
Milestone
Refactor the client-side Link Creation flow to align with the server’s new JSON-based
visitorFields
approach, remove any numeric toggles for visitor data, and introduce typed models for requests/responses. This includes fully revamping the “CreateLink” modal UI, dynamic checkboxes via a shared config, a robustuseCreateLink
hook, and a functional “SendingAccordion” for selecting / emailing recipients.Overview
Removal of Numeric Toggles
requiredUserDetailsOption=1|2
, we adopt checkbox-based selection for fields like “Name,” “Email,” etc.Shared Config for Fields
visitorFieldsConfig.ts
(insrc/shared/config/
) to dynamically render which fields are available, storing only minimal keys (e.g.,["name","email"]
) invisitorFields
for the server.Typed Models
Use typed interfaces or types for request/response objects. For example:
This ensures consistent usage of typed data throughout the codebase.
useCreateLink Hook
POST /api/documents/[documentId]/links
call into a single custom hook,providing typed parameters and responses.SendingAccordion
/api/documents/[documentId]/links/email
).ShareableLinkDialog
Sub-Issues
Conclusion
With these sub-issues completed, the Link Creation Flow becomes:
All code should be typed and consistent, fulfilling the server-side schema changes and ensuring a more professional, DRY solution.
References
visitorFields
schemaThe text was updated successfully, but these errors were encountered: