Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ npx shadcn@latest add https://auth0-ui-components.vercel.app/r/my-organization/o
- ❌ Storing sensitive data in client-accessible props
- ❌ Type casting (`as`) unless there is no other option
- ❌ Using linter/tsc skip annotations (`// @ts-ignore`, `// eslint-disable`) unless there is no other option
- ❌ Defining custom types for API request/response shapes when the SDK already exports them — always re-export SDK types via `type Alias = SDK.Type`

---

Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/api/api-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

/**
* Represents a standardized API error shape.
*
* Intentionally custom: neither `@auth0/myaccount-js` nor `@auth0/myorganization-js`
* export an equivalent error response interface.
* @internal
*/
export interface ApiError {
Expand Down
7 changes: 6 additions & 1 deletion packages/core/src/auth/auth-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import type { MfaApiClient } from '../services/mfa-step-up/mfa-step-up-api-types

/**
* Auth parameters for fetcher functions.
* Used by both MyAccount/MyOrganization SDKs and Auth0 SDK's fetchWithAuth.
*
* Intentionally custom: internal abstraction used by the fetcher layer, not a
* direct SDK API request/response type.
* @internal
*/
export interface FetcherAuthParams {
Expand Down Expand Up @@ -58,6 +60,9 @@ export type CreateFetcherFunction = (options: CreateFetcherOptions) => Auth0Fetc

/**
* Response structure from the token endpoint.
*
* Intentionally custom: `@auth0/auth0-spa-js` exports a similar type (with an
* additional `token_type` field) but is not a dependency of this package.
* @internal
*/
export type TokenEndpointResponse = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/**
* MFA Step-Up API types for raw `/auth/mfa/*` HTTP endpoints.
*
* Intentionally custom: `@auth0/auth0-spa-js` exports matching MFA types but is
* not a dependency of `@auth0/universal-components-core`. If that dependency is
* added in the future, replace these with SDK re-exports.
* @module mfa-step-up-api-types
* @internal
*/
import type { TokenEndpointResponse } from '@core/auth/auth-types';

import type { MFA_REQUIRED_ERROR } from './mfa-step-up-api-constants';
Expand Down
19 changes: 9 additions & 10 deletions packages/core/src/services/my-account/mfa/mfa-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,13 @@ export interface Authenticator {
* Represents the type of an MFA authenticator.
* @internal
*/
export type MFAType =
| 'phone'
| 'push-notification'
| 'totp'
| 'email'
| 'webauthn-roaming'
| 'webauthn-platform'
| 'recovery-code';
export type MFAType = MyAccount.FactorTypeEnum;

/**
* Options for enrolling in MFA factors.
* Simplified enroll options for `MFAControllerInterface`.
*
* Intentionally custom: the SDK uses `CreateAuthenticationMethodRequestContent`
* (a discriminated union per factor type). This is an internal abstraction.
* @internal
*/
export interface EnrollOptions {
Expand All @@ -79,7 +75,10 @@ export interface EnrollOptions {
}

/**
* Options for confirming MFA enrollment.
* Simplified confirm options for `MFAControllerInterface`.
*
* Intentionally custom: the SDK uses `VerifyAuthenticationMethodRequestContent`
* (a discriminated union per factor type). This is an internal abstraction.
* @internal
*/
export interface ConfirmEnrollmentOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,8 @@ export type CreateOrganizationDomainRequestContent =

export type CreateDomainRequestContentPrivate = InternalDomainCreateFormValues;

type DomainStatus = 'pending' | 'failed' | 'verified';
export type DomainStatus = MyOrganization.OrgDomainStatusEnum;

export interface DomainCreate {
domain: string;
}
export type DomainCreate = MyOrganization.CreateOrganizationDomainRequestContent;

export interface Domain {
id: string;
org_id: string;
domain: string;
status: DomainStatus;
verification_txt: string;
verification_host: string;
}
export type Domain = MyOrganization.OrgDomain;
Original file line number Diff line number Diff line change
Expand Up @@ -37,51 +37,31 @@ export type UpdateIdentityProviderRequestContentPrivate = ProviderSelectionFormV
export type CreateIdpDomainRequestContent = MyOrganization.CreateIdpDomainRequestContent;
export type CreateIdpDomainResponseContent = MyOrganization.CreateIdpDomainResponseContent;

export type IdpStrategy =
| 'adfs'
| 'google-apps'
| 'oidc'
| 'okta'
| 'pingfederate'
| 'samlp'
| 'waad';
export type IdpStrategy = MyOrganization.IdpStrategyEnum;

export type IdentityProviderCreate = Omit<IdentityProvider, 'id'>;

export type IdentityProviderAssociatedWithDomain = IdentityProvider & {
is_associated: boolean;
};

export type ProvisioningMethod = 'scim' | 'google-sync';
export type ProvisioningMethod = MyOrganization.IdpProvisioningMethodEnum;

export interface ProvisioningField {
export type ProvisioningField = {
provisioning_field: string;
user_attribute: string;
description: string;
label: string;
}
description?: string;
label?: string;
Comment thread
rax7389 marked this conversation as resolved.
Outdated
};

export interface Provisioning {
identity_provider_id: string;
identity_provider_name: string;
strategy: IdpStrategy;
method: ProvisioningMethod;
fields: ProvisioningField[];
export type Provisioning = MyOrganization.IdpProvisioningConfig & {
updated_on: string;
created_at: string;
user_id_attribute: string;
}
};

export interface SCIMTokenCreate {
token_lifetime?: number;
}
export type SCIMTokenCreate = MyOrganization.CreateIdpProvisioningScimTokenRequestContent;

export interface SCIMToken {
token_id: string;
token: string;
created_at: string;
valid_until?: string;
}
export type SCIMToken = MyOrganization.IdpScimTokenCreate;

export type IdpUserAttributeMap = MyOrganization.IdpUserAttributeMapItem[];
export type IdpBaseUserAttributeItem = MyOrganization.BaseUserAttributeMapItem;
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,21 @@ export type UpdateOrganizationDetailsRequestContent =
export type UpdateOrganizationDetailsResponseContent =
MyOrganization.UpdateOrganizationDetailsResponseContent;

/**
* Hybrid form + API type. The SDK exports `OrgDetails` (with optional id/name),
* but this extends form values — not a pure API response shape.
* @internal
*/
export interface OrganizationPrivate extends OrganizationDetailsFormValues {
id?: string;
name?: string;
}

/**
* Organization with required id/name. Extends `OrganizationPrivate`.
* Not a direct SDK type — uses form values as base.
* @internal
*/
export interface Organization extends OrganizationPrivate {
id: string;
name: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ export const createMockUserMFAMgmtLogic = (
'webauthn-roaming': [],
'webauthn-platform': [],
'recovery-code': [],
password: [],
passkey: [],
},
visibleFactorTypes: ['email'],
hasNoActiveFactors: false,
Expand Down
Loading