(code: string)
| 46 | } |
| 47 | |
| 48 | function getInviteError(code: string): InviteError { |
| 49 | const errorMap: Record<string, InviteError> = { |
| 50 | 'missing-token': { |
| 51 | code: 'missing-token', |
| 52 | message: 'The invitation link is invalid or missing a required parameter.', |
| 53 | }, |
| 54 | 'invalid-token': { |
| 55 | code: 'invalid-token', |
| 56 | message: 'The invitation link is invalid or has already been used.', |
| 57 | }, |
| 58 | expired: { |
| 59 | code: 'expired', |
| 60 | message: 'This invitation has expired. Please ask for a new invitation.', |
| 61 | }, |
| 62 | 'already-processed': { |
| 63 | code: 'already-processed', |
| 64 | message: 'This invitation has already been accepted or declined.', |
| 65 | }, |
| 66 | 'email-mismatch': { |
| 67 | code: 'email-mismatch', |
| 68 | message: |
| 69 | 'This invitation was sent to a different email address. Please sign in with the correct account.', |
| 70 | requiresAuth: true, |
| 71 | }, |
| 72 | 'workspace-not-found': { |
| 73 | code: 'workspace-not-found', |
| 74 | message: 'The workspace associated with this invitation could not be found.', |
| 75 | }, |
| 76 | 'user-not-found': { |
| 77 | code: 'user-not-found', |
| 78 | message: 'Your user account could not be found. Please try signing out and signing back in.', |
| 79 | requiresAuth: true, |
| 80 | }, |
| 81 | 'already-member': { |
| 82 | code: 'already-member', |
| 83 | message: 'You are already a member of this organization or workspace.', |
| 84 | }, |
| 85 | 'already-in-organization': { |
| 86 | code: 'already-in-organization', |
| 87 | message: |
| 88 | 'You are already a member of an organization. Leave your current organization before accepting a new invitation.', |
| 89 | }, |
| 90 | 'no-seats-available': { |
| 91 | code: 'no-seats-available', |
| 92 | message: |
| 93 | 'This organization has reached its seat limit. Ask an admin to contact support to add seats, then try again.', |
| 94 | canRetry: true, |
| 95 | }, |
| 96 | 'upgrade-required': { |
| 97 | code: 'upgrade-required', |
| 98 | message: |
| 99 | 'The workspace owner needs an active paid plan with billing set up before you can join. Ask them to update their plan, then try again.', |
| 100 | canRetry: true, |
| 101 | }, |
| 102 | 'invalid-invitation': { |
| 103 | code: 'invalid-invitation', |
| 104 | message: 'This invitation is invalid or no longer exists.', |
| 105 | }, |
no outgoing calls
no test coverage detected