From 94714861b9e515aa3109ea132918ee0a6eaa840f Mon Sep 17 00:00:00 2001 From: Laura Beatris <48022589+LauraBeatris@users.noreply.github.com> Date: Mon, 2 Dec 2024 19:24:41 -0300 Subject: [PATCH] Use enterprise SSO as strategy --- packages/clerk-js/src/core/resources/EmailAddress.ts | 2 +- packages/types/src/emailAddress.ts | 12 ++++++------ packages/types/src/strategies.ts | 1 - packages/types/src/verification.ts | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/clerk-js/src/core/resources/EmailAddress.ts b/packages/clerk-js/src/core/resources/EmailAddress.ts index c50fb127a8..6f6f9d0c32 100644 --- a/packages/clerk-js/src/core/resources/EmailAddress.ts +++ b/packages/clerk-js/src/core/resources/EmailAddress.ts @@ -93,7 +93,7 @@ export class EmailAddress extends BaseResource implements EmailAddressResource { clerkVerifyEmailAddressCalledBeforeCreate('SignUp'); } const response = await this.prepareVerification({ - strategy: 'saml', + strategy: 'enterprise_sso', redirectUrl: redirectUrl, }); if (!response.verification.externalVerificationRedirectURL) { diff --git a/packages/types/src/emailAddress.ts b/packages/types/src/emailAddress.ts index 9afef85bc2..ace11cc4a4 100644 --- a/packages/types/src/emailAddress.ts +++ b/packages/types/src/emailAddress.ts @@ -1,11 +1,11 @@ import type { IdentificationLinkResource } from './identificationLink'; import type { ClerkResource } from './resource'; -import type { EmailCodeStrategy, EmailLinkStrategy, EmailSAMLStrategy } from './strategies'; +import type { EmailCodeStrategy, EmailLinkStrategy, EnterpriseSSOStrategy } from './strategies'; import type { CreateEmailLinkFlowReturn, - CreateEnterpriseConnectionLinkFlowReturn, StartEmailLinkFlowParams, - StartEnterpriseConnectionLinkFlowParams, + StartEnterpriseSsoFlowParams, + StartEnterpriseSsoFlowReturn, VerificationResource, } from './verification'; @@ -18,7 +18,7 @@ export type PrepareEmailAddressVerificationParams = redirectUrl: string; } | { - strategy: EmailSAMLStrategy; + strategy: EnterpriseSSOStrategy; redirectUrl: string; }; @@ -36,8 +36,8 @@ export interface EmailAddressResource extends ClerkResource { prepareVerification: (params: PrepareEmailAddressVerificationParams) => Promise; attemptVerification: (params: AttemptEmailAddressVerificationParams) => Promise; createEmailLinkFlow: () => CreateEmailLinkFlowReturn; - createEnterpriseConnectionLinkFlow: () => CreateEnterpriseConnectionLinkFlowReturn< - StartEnterpriseConnectionLinkFlowParams, + createEnterpriseConnectionLinkFlow: () => StartEnterpriseSsoFlowReturn< + StartEnterpriseSsoFlowParams, EmailAddressResource >; destroy: () => Promise; diff --git a/packages/types/src/strategies.ts b/packages/types/src/strategies.ts index 0ffdd83c25..0b73fb8849 100644 --- a/packages/types/src/strategies.ts +++ b/packages/types/src/strategies.ts @@ -7,7 +7,6 @@ export type PasswordStrategy = 'password'; export type PhoneCodeStrategy = 'phone_code'; export type EmailCodeStrategy = 'email_code'; export type EmailLinkStrategy = 'email_link'; -export type EmailSAMLStrategy = 'saml'; export type TicketStrategy = 'ticket'; export type TOTPStrategy = 'totp'; export type BackupCodeStrategy = 'backup_code'; diff --git a/packages/types/src/verification.ts b/packages/types/src/verification.ts index 1e77837285..dfa448e06e 100644 --- a/packages/types/src/verification.ts +++ b/packages/types/src/verification.ts @@ -42,11 +42,11 @@ export type CreateEmailLinkFlowReturn = { cancelEmailLinkFlow: () => void; }; -export interface StartEnterpriseConnectionLinkFlowParams { +export interface StartEnterpriseSsoFlowParams { redirectUrl: string; } -export type CreateEnterpriseConnectionLinkFlowReturn = { +export type StartEnterpriseSsoFlowReturn = { startEnterpriseConnectionLinkFlow: (params: Params) => Promise; cancelEnterpriseConnectionLinkFlow: () => void; };