Commit Graph
85 Commits
Author SHA1 Message Date
David NguyenandLucas Smith 006b732edb fix: update document flow fetch logic (#1039)
## Description

**Fixes issues with mismatching state between document steps.**

For example, editing a recipient and proceeding to the next step may not
display the updated recipient. And going back will display the old
recipient instead of the updated values.

**This PR also improves mutation and query speeds by adding logic to
bypass query invalidation.**

```ts
export const trpc = createTRPCReact<AppRouter>({
  unstable_overrides: {
    useMutation: {
      async onSuccess(opts) {
        await opts.originalFn();

        // This forces mutations to wait for all the queries on the page to reload, and in
        // this case one of the queries is `searchDocument` for the command overlay, which
        // on average takes ~500ms. This means that every single mutation must wait for this.
        await opts.queryClient.invalidateQueries(); 
      },
    },
  },
});
```

I've added workarounds to allow us to bypass things such as batching and
invalidating queries. But I think we should instead remove this and
update all the mutations where a query is required for a more optimised
system.

## Example benchmarks

Using stg-app vs this preview there's an average 50% speed increase
across mutations.

**Set signer step:**
Average old speed: ~1100ms
Average new speed: ~550ms

**Set recipient step:**
Average old speed: ~1200ms
Average new speed: ~600ms

**Set fields step:**
Average old speed: ~1200ms
Average new speed: ~600ms

## Related Issue

This will resolve #470

## Changes Made

- Added ability to skip batch queries
- Added a state to store the required document data.
- Refetch the data between steps if/when required
- Optimise mutations and queries

## Checklist

- [X] I have tested these changes locally and they work as expected.
- [X] I have followed the project's coding style guidelines.

---------

Co-authored-by: Lucas Smith <me@lucasjamessmith.me>
2024-03-26 21:12:41 +08:00
David Nguyen 5210fe2963 feat: add passkeys (#989)
## Description

Add support to login with passkeys.

Passkeys can be added via the user security settings page.

Note: Currently left out adding the type of authentication method for
the 'user security audit logs' because we're using the `signIn`
next-auth event which doesn't appear to provide the context. Will look
into it at another time.

## Changes Made

- Add passkeys to login
- Add passkeys feature flag
- Add page to manage passkeys
- Add audit logs relating to passkeys
- Updated prisma schema to support passkeys & anonymous verification
tokens

## Testing Performed

To be done.

MacOS:
- Safari  
- Chrome  
- Firefox 

Windows:
- Chrome [Untested] 
- Firefox [Untested]

Linux:
- Chrome [Untested]
- Firefox [Untested]

iOS:
- Safari 

## Checklist

<!--- Please check the boxes that apply to this pull request. -->
<!--- You can add or remove items as needed. -->

- [X] I have tested these changes locally and they work as expected.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Introduced Passkey authentication, including creation, sign-in, and
management of passkeys.
- Added a Passkeys section in Security Settings for managing user
passkeys.
- Implemented UI updates for Passkey authentication, including a new
dialog for creating passkeys and a data table for managing them.
- Enhanced security settings with server-side feature flags to
conditionally display new security features.
- **Bug Fixes**
	- Improved UI consistency in the Settings Security Activity Page.
- Updated button styling in the 2FA Recovery Codes component for better
visibility.
- **Refactor**
- Streamlined authentication options to include WebAuthn credentials
provider.
- **Chores**
- Updated database schema to support passkeys and related functionality.
	- Added new audit log types for passkey-related activities.
- Enhanced server-only authentication utilities for passkey registration
and management.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-03-26 21:11:59 +08:00
David Nguyen 43400c07de feat: remove 2FA password requirement (#1053) 2024-03-25 11:34:50 +08:00
David Nguyen fc34f1c045 chore: set default PR template 2024-03-24 17:01:21 +08:00
David Nguyen 6d754acfcd fix: disable edit signer inputs (#1035)
## Description

Update the add signer form to disable the signers when required.

I assume the actual issue is that `{...field}` was spreading a disabled
prop which was overriding our one.

## Changes Made

- Use fieldset to disable inputs
- Manually disable select since fieldset doesn't work for that select
for some reason
2024-03-18 19:59:39 +08:00
David Nguyen f6eddaa9f6 fix: remove duplicate neon pooler (#990)
## Description

Fixes the issue with Vercel preview deployments failing.

It appears that the old `PGHOST` environment variable injected by neon
was:

`ep-snowy-snowflake-a2vc5pa2.eu-central-1.aws.neon.tech`

It is now:

`ep-snowy-snowflake-a2vc5pa2.eu-central-1-pooler.aws.neon.tech`

Notice the `-pooler` being attached automatically to the `PGHOST`.

## References

> The following changes were made to the [Neon Vercel
Integration](https://vercel.com/integrations/neon):
>
>To ensure that users accessing a Neon database from a serverless
environment have enough connections, the DATABASE_URL and PGHOST
environment variables added to a Vercel project by the Neon integration
are now set to a pooled Neon connection string by default. Pooled
connections support up to 10,000 simultaneous connections. Previously,
these variables were set to an unpooled connection string supporting
fewer concurrent connections.

https://neon.tech/docs/changelog

https://neon.tech/docs/guides/vercel#manage-vercel-environment-variables
2024-03-07 18:17:28 +08:00
David Nguyen 70494fa5bb feat: add offline development support (#987)
## Description

Add support to develop without network access since TRPC by default will
prevent network requests when offline.

https://tanstack.com/query/v4/docs/framework/react/guides/network-mode#network-mode-always

## Changes Made

- Add dynamic logic to toggle offline development
- Removed teams feature flag
2024-03-05 22:06:48 +11:00
David Nguyen 5bd0dde4a5 fix: e2e tests 2024-02-26 10:50:46 +11:00
David Nguyen a06b40af3c fix: revert hardcoded env 2024-02-24 15:11:12 +11:00
David Nguyen 0900836040 fix: missing marketing env variables 2024-02-24 14:56:11 +11:00
David Nguyen a58fee2da6 fix: e2e tests 2024-02-22 22:58:51 +11:00
David Nguyen 34825aaf3a feat: add separate document audit page 2024-02-22 19:14:01 +11:00
David Nguyen 48321f2f62 Merge branch 'main' into feat/separate-document-page 2024-02-22 16:13:33 +11:00
David Nguyen ac6da9ab45 feat: add feature flag 2024-02-19 14:31:26 +11:00
David Nguyen 791a22cb5f refactor: add comments 2024-02-19 13:22:48 +11:00
David Nguyen 2815b1a809 feat: add enterprise billing (#939)
## Description

Add support for enterprise billing plans.

Enterprise billing plans by default get access to everything early
adopters do:
- Unlimited teams
- Unlimited documents

They will also get additional features in the future.

## Notes

Pending webhook updates to support enterprise onboarding.
Rolled back env changes `NEXT_PUBLIC_PROJECT` since it doesn't seem to
work.
2024-02-17 12:42:00 +11:00
David Nguyen 7fbe9b519c fix: styling 2024-02-15 20:42:17 +11:00
David Nguyen bd3c64658a feat: add document version history UI 2024-02-15 20:39:26 +11:00
David Nguyen 524a2f4ea9 Merge branch 'main' into feat/separate-document-page 2024-02-13 11:15:31 +11:00
David Nguyen 82b87739d0 fix: update document links 2024-02-12 19:00:47 +11:00
David Nguyen a868ecf2d2 fix: restrict team verification tokens (#927)
## Description

Currently we're not restricting team transfer and email verification
tokens from flowing into the frontend.

This changes restricts it to only return the required information
instead of the whole data object.
2024-02-12 18:23:07 +11:00
David Nguyen 071475769c feat: add document page view 2024-02-12 17:30:23 +11:00
David Nguyen b1bb345929 fix: redirect URL preventing document flow (#925)
## Description

Currently the document redirect URL feature is preventing documents from
being created unless a redirect URL is provided.

During the document edit flow, the redirect URL is hidden in an advanced
tab with the value of an empty string, which will always fail the
current Zod validation since `optional` requires undefined to pass.

There are multiple ways to fix this, but I think this is the easiest
method where we can assume an empty string is valid.
2024-02-12 15:23:15 +11:00
David Nguyen 3a32bc62c5 feat: initial document audit logs implementation (#922)
Added initial implementation of document audit logs.
2024-02-12 12:04:53 +11:00
David Nguyen 8641884515 fix: recipients with CC role not being editable (#918)
## Description

Fixed issue where setting a recipient role as CC will prevent any
further changes as it is considered as "sent" and "signed".

## Other changes

- Prevent editing document after completed
- Removed CC and Viewers from the field recipient list since they will
never be filled
- Minor UI issues

## Checklist

- [X] I have tested these changes locally and they work as expected.
- [X] I have added/updated tests that prove the effectiveness of these
changes.
- [X] I have followed the project's coding style guidelines.
2024-02-09 12:37:17 +11:00
David Nguyen e97b9b4f1c feat: add team templates (#912) 2024-02-08 12:33:20 +11:00
David Nguyen 7d39e3d065 feat: add team feature flag (#915)
## Description

Add the ability to feature flag the teams feature via UI.

Also added minor UI changes

## Checklist

- [X] I have tested these changes locally and they work as expected.
- [X] I have added/updated tests that prove the effectiveness of these
changes.
- [X] I have followed the project's coding style guidelines.
2024-02-07 21:32:44 +11:00
David Nguyen cad48236a0 Merge branch 'main' into feat/disable-access-unverified-users 2024-02-07 16:30:22 +11:00
David Nguyen 58e2eda5e9 fix: update field remove logic 2024-02-07 14:40:15 +11:00
David Nguyen 0c339b78b6 feat: add teams (#848)
## Description

Add support for teams which will allow users to collaborate on
documents.

Teams features allows users to:

- Create, manage and transfer teams
- Manage team members
- Manage team emails
- Manage a shared team inbox and documents

These changes do NOT include the following, which are planned for a
future release:

- Team templates
- Team API
- Search menu integration

## Testing Performed

- Added E2E tests for general team management
- Added E2E tests to validate document counts

## Checklist

- [X] I have tested these changes locally and they work as expected.
- [X] I have added/updated tests that prove the effectiveness of these
changes.
- [ ] I have updated the documentation to reflect these changes, if
applicable.
- [X] I have followed the project's coding style guidelines.
2024-02-06 16:16:10 +11:00
David Nguyen 27d8098511 fix: document count period filter (#882)
## Description

Currently the count for the documents table tabs do not display the
correct values when the period filter is applied.

## Changes Made

- Updated `getStats` to support filtering on period

## Testing Performed

- Tested to see if the documents tab count were being filtered based on
the period

## Checklist

- [X] I have tested these changes locally and they work as expected.
- [X] I have followed the project's coding style guidelines.
2024-01-31 12:40:37 +11:00
David Nguyen ada46a5f47 feat: add auth fail logs 2024-01-31 12:27:40 +11:00
David Nguyen 1bda74b3aa fix: add cascade delete for audit logs 2024-01-30 18:37:48 +11:00
David Nguyen 9427143951 fix: remove account create log 2024-01-30 18:26:46 +11:00
David Nguyen 7e15058a3a feat: add user security audit logs 2024-01-30 17:32:20 +11:00
David Nguyen d766b58f42 feat: add server crypto (#863)
## Description

Currently we are required to ensure PII data is not passed around in
search parameters and in the open for GDPR reasons.

Allowing us to encrypt and decrypt values with expiry dates will allow
us to ensure this doesn't happen.

## Changes Made

- Added TPRC router for encryption method

## Testing Performed

- Tested encrypting and decrypting data with and without `expiredAt`
- Tested via directly accessing API and also via trpc in react
components
- Tested parsing en email search param in a page and decrypting it
successfully

## Checklist

- [X] I have tested these changes locally and they work as expected.
- [X] I have followed the project's coding style guidelines.
2024-01-25 16:07:57 +11:00
David Nguyen e90dd518df fix: auto verify google sso emails (#856) 2024-01-25 13:30:50 +11:00
David Nguyen e63122a718 chore: update github feature template (#849) 2024-01-23 11:28:11 +11:00
David Nguyen 6be119ac95 fix: improve document meta logic 2024-01-03 20:10:50 +11:00
David Nguyen 3f89f8725b fix: resolve conflicting z-index values (#788)
## Description

Currently there are various z-index values that are causing:
- Toasts to be placed behind dialog blur background
- Menu being cropped off by header

## Changes Made

- Revert `z-[1000]` back to `z-50` for the header (not exactly sure why
it was bumped)
- Refactor z-indexes over 9000 to start from 1000
- Ensure z-index of toast is higher than dialog
2023-12-28 20:08:19 +11:00
David Nguyen c4800f74b9 feat: update disabled dropzone text (#787)
Update the dropzone so it will display the relevant disabled text based
on the reason it is disabled.
2023-12-28 20:07:29 +11:00
David NguyenandLucas Smith 88534fa1c6 feat: add multi subscription support (#734)
## Description

Previously we assumed that there can only be 1 subscription per user.
However, that will soon no longer the case with the introduction of the
Teams subscription.

This PR will apply the required migrations to support multiple
subscriptions.

## Changes Made

- Updated the Prisma schema to allow for multiple `Subscriptions` per
`User`
- Added a Stripe `customerId` field to the `User` model
- Updated relevant billing sections to support multiple subscriptions

## Testing Performed

- Tested running the Prisma migration on a demo database created on the
main branch

Will require a lot of additional testing.

## Checklist

- [ ] I have tested these changes locally and they work as expected.
- [ ] I have added/updated tests that prove the effectiveness of these
changes.
- [X] I have followed the project's coding style guidelines.

## Additional Notes

Added the following custom SQL statement to the migration:

> DELETE FROM "Subscription" WHERE "planId" IS NULL OR "priceId" IS
NULL;

Prior to deployment this will require changes to Stripe products:
- Adding `type` meta attribute

---------

Co-authored-by: Lucas Smith <me@lucasjamessmith.me>
2023-12-14 15:22:54 +11:00
David Nguyen b9282f11b0 Merge branch 'main' into refactor/download-function 2023-12-08 11:26:02 +11:00
David Nguyen f9a0ec99dc fix: correctly sign SPM documents (#627)
- Sign and email correct SPM document
- Optimise signing SPM documents
2023-11-06 13:02:21 +11:00
David Nguyen ba7d92d255 chore: update bug report template (#580) 2023-11-06 13:02:21 +11:00
David Nguyen 1d291e8e03 feat: add safari clipboard copy support (#486) 2023-11-06 13:02:19 +11:00
David Nguyen 6d7fc32075 fix: stripe customer fetch logic 2023-11-06 13:02:19 +11:00
David Nguyen 81eea4213c fix: merge issues 2023-11-06 13:02:19 +11:00
David Nguyen f45cd81b5f feat: wip 2023-11-06 13:02:19 +11:00
David Nguyen 2856cd9c15 feat: add free tier Stripe subscription 2023-11-06 13:02:19 +11:00
David Nguyen 702df60076 fix: add cascade delete for share links 2023-11-06 13:02:19 +11:00
David Nguyen 38960c459b feat: add document share button to marketing (#422) 2023-11-06 13:02:19 +11:00
David Nguyen 6d0e8f6dd8 feat: single-player-mode-polish (#435) 2023-11-06 13:02:19 +11:00
David Nguyen e0662ce024 chore: add code of conduct (#521)
Update contributing guidelines
2023-11-06 13:01:46 +11:00
David Nguyen 2e12893e0c fix: add missing URL to email template 2023-11-06 13:01:46 +11:00
David Nguyen 8fb5fdc058 feat: add email forgot password action
Updated email template imports
2023-11-06 13:01:46 +11:00
David Nguyen 0c607e6b39 feat: update email templates
Add SPM email attachment
2023-11-06 13:01:46 +11:00
David Nguyen 48f4289c09 fix: resolve document title inconsistency (#452) 2023-11-06 13:01:45 +11:00
David Nguyen 7ec8ce2a56 feat: add posthog reverse proxy (#449) 2023-11-06 13:01:45 +11:00
David Nguyen 341c0df231 fix: firefox signing fields 2023-11-06 13:01:44 +11:00
David Nguyen 0ff044978f feat: update success page text 2023-11-06 13:01:44 +11:00
David Nguyen d20ad4217c feat: add uninserted field validation 2023-11-06 13:01:44 +11:00
David Nguyen ebebceea1f feat: add uninserted field validation 2023-11-06 13:01:44 +11:00
David Nguyen a9a719cd37 feat: utilise transport layer 2023-11-06 13:01:44 +11:00
David Nguyen db1d6478a1 fix: timeout issues 2023-11-06 13:01:44 +11:00
David Nguyen 34232c79e5 feat: add single player mode 2023-11-06 13:01:43 +11:00
David Nguyen 771042c9ce feat: add vercel build script 2023-11-06 13:01:13 +11:00
David Nguyen a72248e871 refactor: organise recipient utils 2023-11-06 13:01:12 +11:00
David Nguyen 48e58d4675 feat: add avatar email fallback 2023-11-06 13:01:12 +11:00
David Nguyen 41d46c82d1 feat: update document table layout (#371)
* feat: update document table layout

- Removed dashboard page
- Removed redundant ID column
- Moved date to first column
- Added estimated locales for SSR dates
2023-11-06 13:01:12 +11:00
David Nguyen d5753dfbb3 feat: update marketing mobile menu 2023-11-06 13:01:12 +11:00
David Nguyen a99efdc916 feat: add inbox 2023-11-06 13:01:11 +11:00
David Nguyen 97c7bd9792 refactor: remove whitespace 2023-11-06 13:01:10 +11:00
David Nguyen 215eaebc1a feat: update document flow
- Fixed z-index when dragging pre-existing fields
- Refactored document flow
- Added button spinner
- Added animation for document flow slider
- Updated drag and drop fields
- Updated document flow so it adjusts to the height of the PDF
- Updated claim plan dialog
2023-11-06 13:01:10 +11:00
David Nguyen a0abf56833 refactor: extract common components into UI package 2023-11-06 13:01:10 +11:00
David Nguyen 857a48b3d9 feat: update items 2023-11-06 13:01:10 +11:00
David Nguyen 371f0947fb feat: update items
Refactored billing flag name

Refactored FeatureFlag type

Disabled session recording by default
2023-11-06 13:01:10 +11:00
David Nguyen aa2969fd50 feat: feature flags 2023-11-06 13:01:10 +11:00
David Nguyen 71e9f016b6 feat: update privacy content 2023-11-06 13:01:08 +11:00
David Nguyen 96fc2fb850 feat: update blog styling 2023-11-06 13:01:08 +11:00
David Nguyen 3f322d1d0c feat: update privacy content 2023-11-06 13:01:08 +11:00
David Nguyen 79684c9970 feat: remove whitespace 2023-11-06 13:01:08 +11:00
David Nguyen fcf9720a1e feat: add generic content page 2023-11-06 13:01:08 +11:00
David NguyenandJoshua Sharp 822624bc02 Update apps/marketing/content/blog/announcing-documenso.mdx
Co-authored-by: Joshua Sharp <joshuafsharp@gmail.com>
2023-11-06 13:01:08 +11:00
David Nguyen 154ef26465 feat: add content layer
Add blog pages

Add privacy page
2023-11-06 13:01:08 +11:00