Skip to content

Commit 373fa20

Browse files
committed
chore(release): include personal Search connection guidance
2 parents 5da9bbe + 4505fb9 commit 373fa20

3 files changed

Lines changed: 19 additions & 12 deletions

File tree

‎apps/sim/app/workspace/[workspaceId]/integrations/components/connect-service-account-modal/client-credential-account-modal.tsx‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ const FALLBACK_ERROR_MESSAGE = "We couldn't save this credential. Try again in a
4545
function messageForClientCredentialError(
4646
err: unknown,
4747
descriptor: ClientCredentialAccountDescriptor,
48-
requiredFields: ClientCredentialAccountField[]
48+
requiredFields: ClientCredentialAccountField[],
49+
fallbackMessage = FALLBACK_ERROR_MESSAGE
4950
): string {
5051
if (isApiClientError(err) && err.code) {
5152
// Names the fields the *selected* auth method needed, so a JWT failure
@@ -68,10 +69,10 @@ function messageForClientCredentialError(
6869
case 'duplicate_display_name':
6970
return 'A credential with that name already exists in this workspace.'
7071
default:
71-
return FALLBACK_ERROR_MESSAGE
72+
return fallbackMessage
7273
}
7374
}
74-
return FALLBACK_ERROR_MESSAGE
75+
return fallbackMessage
7576
}
7677

7778
type FieldValues = Partial<Record<ClientCredentialAccountFieldId, string>>
@@ -237,9 +238,12 @@ function ClientCredentialAccountModalForm({
237238
onOpenChange(false)
238239
} catch (err: unknown) {
239240
setError(
240-
onSubmitCredentials
241-
? getErrorMessage(err, FALLBACK_ERROR_MESSAGE)
242-
: messageForClientCredentialError(err, descriptor, required)
241+
messageForClientCredentialError(
242+
err,
243+
descriptor,
244+
required,
245+
onSubmitCredentials ? getErrorMessage(err, FALLBACK_ERROR_MESSAGE) : undefined
246+
)
243247
)
244248
logger.error(`Failed to save ${descriptor.serviceLabel} service account credential`, err)
245249
}

‎apps/sim/app/workspace/[workspaceId]/integrations/components/connect-service-account-modal/token-service-account-modal.tsx‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,11 @@ function TokenServiceAccountModalForm({
167167
} catch (err: unknown) {
168168
const code = isApiClientError(err) ? err.code : undefined
169169
setError(
170-
onSubmitCredentials
171-
? getErrorMessage(err, 'Could not save this connection.')
172-
: getTokenServiceAccountErrorMessage(descriptor, code)
170+
getTokenServiceAccountErrorMessage(
171+
descriptor,
172+
code,
173+
onSubmitCredentials ? getErrorMessage(err, 'Could not save this connection.') : undefined
174+
)
173175
)
174176
logger.error(`Failed to add ${descriptor.serviceLabel} service account credential`, err)
175177
}

‎apps/sim/lib/credentials/token-service-accounts/descriptors.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -534,11 +534,12 @@ export function getTokenServiceAccountDescriptor(
534534
* given provider. Provider-specific copy is inherited from the descriptor
535535
* (token noun, service label, and the optional `invalidCredentialsHelp`
536536
* override) rather than hard-coded in the shared connect modal. An
537-
* unknown/absent code falls back to a generic retry message.
537+
* unknown/absent code uses the caller's fallback or a generic retry message.
538538
*/
539539
export function getTokenServiceAccountErrorMessage(
540540
descriptor: TokenServiceAccountDescriptor,
541-
code: string | undefined
541+
code: string | undefined,
542+
fallbackMessage = "We couldn't add this credential. Try again in a moment."
542543
): string {
543544
switch (code) {
544545
case 'invalid_credentials':
@@ -553,6 +554,6 @@ export function getTokenServiceAccountErrorMessage(
553554
case 'duplicate_display_name':
554555
return 'A credential with that name already exists in this workspace.'
555556
default:
556-
return "We couldn't add this credential. Try again in a moment."
557+
return fallbackMessage
557558
}
558559
}

0 commit comments

Comments
 (0)