Skip to content

Commit 8bece6d

Browse files
committed
chore: custom retry button text
1 parent b623722 commit 8bece6d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/frontend/src/components/ExecutionStep/hooks/useExecutionStepStatus.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export interface UseExecutionStepStatusReturn {
3030
isPartialSuccess: boolean
3131
canRetry: boolean
3232
loading: boolean
33+
customRetryButtonText?: string
3334
}
3435

3536
export function useExecutionStepStatus({
@@ -63,6 +64,20 @@ export function useExecutionStepStatus({
6364
return failureIcon
6465
}, [isPartialSuccess, isStepSuccessful, status])
6566

67+
const customRetryButtonText = useMemo(() => {
68+
// specific to email by postman where we want to allow users to retry without attachments
69+
// postman returns this error code when:
70+
// - attachment is password-protected; AND/OR
71+
// - attachment is unsupported
72+
if (
73+
errorDetails?.details?.code === 'invalid_template' ||
74+
errorDetails?.name === 'Password-protected attachment(s)'
75+
) {
76+
return 'Retry without attachments'
77+
}
78+
return undefined
79+
}, [errorDetails])
80+
6681
return {
6782
app,
6883
appName,
@@ -72,5 +87,6 @@ export function useExecutionStepStatus({
7287
isPartialSuccess,
7388
canRetry,
7489
loading,
90+
customRetryButtonText,
7591
}
7692
}

0 commit comments

Comments
 (0)