fix: duplicate webhook calls on document complete (#1721)

Fix webhooks being sent twice due to duplicate frontend calls

Updated the assistant confirmation dialog so the next signer is always
visible (if dictate is enabled). Because if the form is invalid (due to
no name) there is no visual queue that the form is invalid (since it's
hidden)

## Notes

Didn't bother to remove the weird assistants form since it currently
works for now


![image](https://github.com/user-attachments/assets/47910fec-e05e-486a-a61d-16078d948893)

## Tests

- Currently running locally
- Tested webhooks via network tab and via webhook.site
This commit is contained in:
David Nguyen
2025-03-25 21:59:13 +11:00
committed by GitHub
parent 063fd32f18
commit 31be548939
12 changed files with 76 additions and 189 deletions
@@ -341,9 +341,6 @@ test('[NEXT_RECIPIENT_DICTATION]: should allow assistant to dictate next signer'
await expect(page.getByRole('dialog')).toBeVisible();
await expect(page.getByText('The next recipient to sign this document will be')).toBeVisible();
// Update next recipient
await page.locator('button').filter({ hasText: 'Update Recipient' }).click();
// Use dialog context to ensure we're targeting the correct form fields
const dialog = page.getByRole('dialog');
await dialog.getByLabel('Name').fill('New Signer');
@@ -148,6 +148,10 @@ test('[TEAMS]: check signature modes work for templates', async ({ page }) => {
await page.getByRole('button', { name: 'Update' }).first().click();
// Wait for finish
await page.getByText('Document preferences updated').waitFor({ state: 'visible' });
await page.getByTestId('toast-close').click();
const template = await seedTeamTemplateWithMeta(team);
await page.goto(`/t/${team.url}/templates/${template.id}`);
-6
View File
@@ -5049,11 +5049,6 @@ msgstr "Schritt <0>{step} von {maxStep}</0>"
msgid "Subject <0>(Optional)</0>"
msgstr "Betreff <0>(Optional)</0>"
#: apps/remix/app/components/general/document-signing/document-signing-form.tsx
#: apps/remix/app/components/dialogs/assistant-confirmation-dialog.tsx
msgid "Submitting..."
msgstr ""
#: apps/remix/app/components/general/billing-plans.tsx
msgid "Subscribe"
msgstr ""
@@ -6121,7 +6116,6 @@ msgstr "Profil aktualisieren"
#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx
#: apps/remix/app/components/general/document-signing/document-signing-complete-dialog.tsx
#: apps/remix/app/components/dialogs/assistant-confirmation-dialog.tsx
msgid "Update Recipient"
msgstr "Empfänger aktualisieren"
-6
View File
@@ -5044,11 +5044,6 @@ msgstr "Step <0>{step} of {maxStep}</0>"
msgid "Subject <0>(Optional)</0>"
msgstr "Subject <0>(Optional)</0>"
#: apps/remix/app/components/general/document-signing/document-signing-form.tsx
#: apps/remix/app/components/dialogs/assistant-confirmation-dialog.tsx
msgid "Submitting..."
msgstr "Submitting..."
#: apps/remix/app/components/general/billing-plans.tsx
msgid "Subscribe"
msgstr "Subscribe"
@@ -6118,7 +6113,6 @@ msgstr "Update profile"
#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx
#: apps/remix/app/components/general/document-signing/document-signing-complete-dialog.tsx
#: apps/remix/app/components/dialogs/assistant-confirmation-dialog.tsx
msgid "Update Recipient"
msgstr "Update Recipient"
-6
View File
@@ -5049,11 +5049,6 @@ msgstr "Paso <0>{step} de {maxStep}</0>"
msgid "Subject <0>(Optional)</0>"
msgstr "Asunto <0>(Opcional)</0>"
#: apps/remix/app/components/general/document-signing/document-signing-form.tsx
#: apps/remix/app/components/dialogs/assistant-confirmation-dialog.tsx
msgid "Submitting..."
msgstr ""
#: apps/remix/app/components/general/billing-plans.tsx
msgid "Subscribe"
msgstr ""
@@ -6121,7 +6116,6 @@ msgstr "Actualizar perfil"
#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx
#: apps/remix/app/components/general/document-signing/document-signing-complete-dialog.tsx
#: apps/remix/app/components/dialogs/assistant-confirmation-dialog.tsx
msgid "Update Recipient"
msgstr "Actualizar destinatario"
-6
View File
@@ -5049,11 +5049,6 @@ msgstr "Étape <0>{step} sur {maxStep}</0>"
msgid "Subject <0>(Optional)</0>"
msgstr "Objet <0>(Optionnel)</0>"
#: apps/remix/app/components/general/document-signing/document-signing-form.tsx
#: apps/remix/app/components/dialogs/assistant-confirmation-dialog.tsx
msgid "Submitting..."
msgstr ""
#: apps/remix/app/components/general/billing-plans.tsx
msgid "Subscribe"
msgstr ""
@@ -6121,7 +6116,6 @@ msgstr "Mettre à jour le profil"
#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx
#: apps/remix/app/components/general/document-signing/document-signing-complete-dialog.tsx
#: apps/remix/app/components/dialogs/assistant-confirmation-dialog.tsx
msgid "Update Recipient"
msgstr "Mettre à jour le destinataire"
-6
View File
@@ -5049,11 +5049,6 @@ msgstr "Passo <0>{step} di {maxStep}</0>"
msgid "Subject <0>(Optional)</0>"
msgstr "Oggetto <0>(Opzionale)</0>"
#: apps/remix/app/components/general/document-signing/document-signing-form.tsx
#: apps/remix/app/components/dialogs/assistant-confirmation-dialog.tsx
msgid "Submitting..."
msgstr ""
#: apps/remix/app/components/general/billing-plans.tsx
msgid "Subscribe"
msgstr ""
@@ -6121,7 +6116,6 @@ msgstr "Aggiorna profilo"
#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx
#: apps/remix/app/components/general/document-signing/document-signing-complete-dialog.tsx
#: apps/remix/app/components/dialogs/assistant-confirmation-dialog.tsx
msgid "Update Recipient"
msgstr "Aggiorna destinatario"
-6
View File
@@ -5049,11 +5049,6 @@ msgstr "Krok <0>{step} z {maxStep}</0>"
msgid "Subject <0>(Optional)</0>"
msgstr "Temat <0>(Opcjonalnie)</0>"
#: apps/remix/app/components/general/document-signing/document-signing-form.tsx
#: apps/remix/app/components/dialogs/assistant-confirmation-dialog.tsx
msgid "Submitting..."
msgstr ""
#: apps/remix/app/components/general/billing-plans.tsx
msgid "Subscribe"
msgstr ""
@@ -6121,7 +6116,6 @@ msgstr "Zaktualizuj profil"
#: apps/remix/app/components/tables/admin-document-recipient-item-table.tsx
#: apps/remix/app/components/general/document-signing/document-signing-complete-dialog.tsx
#: apps/remix/app/components/dialogs/assistant-confirmation-dialog.tsx
msgid "Update Recipient"
msgstr "Zaktualizuj odbiorcę"
@@ -37,6 +37,7 @@ export const updateDocumentRoute = authenticatedProcedure
redirectUrl: meta.redirectUrl,
distributionMethod: meta.distributionMethod,
signingOrder: meta.signingOrder,
allowDictateNextSigner: meta.allowDictateNextSigner,
emailSettings: meta.emailSettings,
requestMetadata: ctx.metadata,
});
+1
View File
@@ -78,6 +78,7 @@ const ToastClose = React.forwardRef<
>(({ className, ...props }, ref) => (
<ToastPrimitives.Close
ref={ref}
data-testid="toast-close"
className={cn(
'text-foreground/50 hover:text-foreground absolute right-2 top-2 rounded-md p-1 opacity-100 transition-opacity focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600 md:opacity-0 group-hover:md:opacity-100',
className,