@asgardeo/javascript 0.19.2 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AsgardeoJavaScriptClient.d.ts +2 -1
- package/dist/AsgardeoJavaScriptClient.d.ts.map +1 -1
- package/dist/api/createOrganization.d.ts.map +1 -1
- package/dist/api/executeEmbeddedSignInFlow.d.ts.map +1 -1
- package/dist/api/executeEmbeddedSignUpFlow.d.ts.map +1 -1
- package/dist/api/getAllOrganizations.d.ts.map +1 -1
- package/dist/api/getBrandingPreference.d.ts.map +1 -1
- package/dist/api/getMeOrganizations.d.ts.map +1 -1
- package/dist/api/getOrganization.d.ts.map +1 -1
- package/dist/api/getSchemas.d.ts.map +1 -1
- package/dist/api/getScim2Me.d.ts.map +1 -1
- package/dist/api/getUserInfo.d.ts.map +1 -1
- package/dist/api/initializeEmbeddedSignInFlow.d.ts.map +1 -1
- package/dist/api/updateMeProfile.d.ts.map +1 -1
- package/dist/api/updateOrganization.d.ts.map +1 -1
- package/dist/api/v2/executeEmbeddedRecoveryFlowV2.d.ts +57 -0
- package/dist/api/v2/executeEmbeddedRecoveryFlowV2.d.ts.map +1 -0
- package/dist/api/v2/executeEmbeddedSignInFlowV2.d.ts.map +1 -1
- package/dist/api/v2/executeEmbeddedSignUpFlowV2.d.ts.map +1 -1
- package/dist/api/v2/executeEmbeddedUserOnboardingFlowV2.d.ts.map +1 -1
- package/dist/api/v2/getFlowMetaV2.d.ts.map +1 -1
- package/dist/api/v2/getOrganizationUnitChildren.d.ts.map +1 -1
- package/dist/cjs/index.js +147 -40
- package/dist/cjs/index.js.map +4 -4
- package/dist/edge/index.js +144 -40
- package/dist/edge/index.js.map +4 -4
- package/dist/errors/AsgardeoAPIError.d.ts +9 -3
- package/dist/errors/AsgardeoAPIError.d.ts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +144 -40
- package/dist/index.js.map +4 -4
- package/dist/models/client.d.ts +8 -1
- package/dist/models/client.d.ts.map +1 -1
- package/dist/models/config.d.ts +1 -1
- package/dist/models/config.d.ts.map +1 -1
- package/dist/models/embedded-flow.d.ts +3 -2
- package/dist/models/embedded-flow.d.ts.map +1 -1
- package/dist/models/v2/embedded-recovery-flow-v2.d.ts +143 -0
- package/dist/models/v2/embedded-recovery-flow-v2.d.ts.map +1 -0
- package/dist/utils/parseApiErrorMessage.d.ts +29 -0
- package/dist/utils/parseApiErrorMessage.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.ts", "../../src/constants/OIDCDiscoveryConstants.ts", "../../src/constants/TokenExchangeConstants.ts", "../../src/errors/exception.ts", "../../src/models/platforms.ts", "../../src/utils/extractUserClaimsFromIdToken.ts", "../../src/constants/ScopeConstants.ts", "../../src/constants/OIDCRequestConstants.ts", "../../src/errors/AsgardeoError.ts", "../../src/errors/AsgardeoRuntimeError.ts", "../../src/utils/processOpenIDScopes.ts", "../../src/__legacy__/helpers/authentication-helper.ts", "../../src/constants/PKCEConstants.ts", "../../src/constants/v2/OIDCDiscoveryConstants.ts", "../../src/constants/TokenConstants.ts", "../../src/IsomorphicCrypto.ts", "../../src/StorageManager.ts", "../../src/utils/deepMerge.ts", "../../src/utils/extractPkceStorageKeyFromState.ts", "../../src/utils/generatePkceStorageKey.ts", "../../src/utils/generateStateParamForRequestCorrelation.ts", "../../src/utils/getAuthorizeRequestUrlParams.ts", "../../src/__legacy__/client.ts", "../../src/errors/AsgardeoAPIError.ts", "../../src/api/initializeEmbeddedSignInFlow.ts", "../../src/api/executeEmbeddedSignInFlow.ts", "../../src/models/embedded-flow.ts", "../../src/api/executeEmbeddedSignUpFlow.ts", "../../src/api/getUserInfo.ts", "../../src/utils/processUsername.ts", "../../src/api/getScim2Me.ts", "../../src/api/getSchemas.ts", "../../src/api/getAllOrganizations.ts", "../../src/api/createOrganization.ts", "../../src/api/getMeOrganizations.ts", "../../src/api/getOrganization.ts", "../../src/utils/isEmpty.ts", "../../src/api/updateOrganization.ts", "../../src/api/updateMeProfile.ts", "../../src/api/getBrandingPreference.ts", "../../src/models/v2/embedded-signin-flow-v2.ts", "../../src/api/v2/executeEmbeddedSignInFlowV2.ts", "../../src/models/v2/embedded-signup-flow-v2.ts", "../../src/api/v2/executeEmbeddedSignUpFlowV2.ts", "../../src/api/v2/executeEmbeddedUserOnboardingFlowV2.ts", "../../src/api/v2/getFlowMetaV2.ts", "../../src/api/v2/getOrganizationUnitChildren.ts", "../../src/constants/ApplicationNativeAuthenticationConstants.ts", "../../src/constants/VendorConstants.ts", "../../src/models/embedded-signin-flow.ts", "../../src/models/v2/embedded-flow-v2.ts", "../../src/models/v2/flow-meta-v2.ts", "../../src/models/flow.ts", "../../src/models/agent.ts", "../../src/models/scim2-schema.ts", "../../src/models/field.ts", "../../src/DefaultCacheStore.ts", "../../src/DefaultCrypto.ts", "../../src/AsgardeoJavaScriptClient.ts", "../../src/theme/createTheme.ts", "../../src/utils/arrayBufferToBase64url.ts", "../../src/utils/base64urlToArrayBuffer.ts", "../../src/utils/bem.ts", "../../src/utils/formatDate.ts", "../../src/utils/logger.ts", "../../src/utils/deriveOrganizationHandleFromBaseUrl.ts", "../../src/utils/isRecognizedBaseUrlPattern.ts", "../../src/utils/flattenUserSchema.ts", "../../src/utils/get.ts", "../../src/utils/set.ts", "../../src/utils/generateUserProfile.ts", "../../src/utils/getLatestStateParam.ts", "../../src/utils/generateFlattenedUserProfile.ts", "../../src/utils/identifyPlatform.ts", "../../src/utils/getRedirectBasedSignUpUrl.ts", "../../src/utils/v2/isEmojiUri.ts", "../../src/utils/v2/extractEmojiFromUri.ts", "../../src/utils/removeTrailingSlash.ts", "../../src/utils/resolveFieldType.ts", "../../src/utils/resolveFieldName.ts", "../../src/utils/v2/resolveMeta.ts", "../../src/utils/v2/parseFlowTemplateLiteral.ts", "../../src/utils/v2/resolveFlowTemplateLiterals.ts", "../../src/utils/v2/countryCodeToFlagEmoji.ts", "../../src/utils/v2/resolveLocaleDisplayName.ts", "../../src/utils/v2/resolveLocaleEmoji.ts", "../../src/utils/withVendorCSSClassPrefix.ts", "../../src/utils/transformBrandingPreferenceToTheme.ts", "../../src/HttpClient.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport {AsgardeoAuthClient} from './__legacy__/client';\nexport {\n DefaultAuthClientConfig,\n WellKnownAuthClientConfig,\n BaseURLAuthClientConfig,\n ExplicitAuthClientConfig,\n StrictAuthClientConfig,\n AuthClientConfig,\n} from './__legacy__/models';\n\nexport {IsomorphicCrypto} from './IsomorphicCrypto';\n\nexport {default as initializeEmbeddedSignInFlow} from './api/initializeEmbeddedSignInFlow';\nexport {default as executeEmbeddedSignInFlow} from './api/executeEmbeddedSignInFlow';\nexport {default as executeEmbeddedSignUpFlow} from './api/executeEmbeddedSignUpFlow';\nexport {default as getUserInfo} from './api/getUserInfo';\nexport {default as getScim2Me, GetScim2MeConfig} from './api/getScim2Me';\nexport {default as getSchemas, GetSchemasConfig} from './api/getSchemas';\nexport {default as getAllOrganizations, GetAllOrganizationsConfig} from './api/getAllOrganizations';\nexport {\n default as createOrganization,\n CreateOrganizationPayload,\n CreateOrganizationConfig,\n} from './api/createOrganization';\nexport {default as getMeOrganizations, GetMeOrganizationsConfig} from './api/getMeOrganizations';\nexport {default as getOrganization, OrganizationDetails, GetOrganizationConfig} from './api/getOrganization';\nexport {default as updateOrganization, createPatchOperations, UpdateOrganizationConfig} from './api/updateOrganization';\nexport {default as updateMeProfile, UpdateMeProfileConfig} from './api/updateMeProfile';\nexport {default as getBrandingPreference, GetBrandingPreferenceConfig} from './api/getBrandingPreference';\nexport {default as executeEmbeddedSignInFlowV2} from './api/v2/executeEmbeddedSignInFlowV2';\nexport {default as executeEmbeddedSignUpFlowV2} from './api/v2/executeEmbeddedSignUpFlowV2';\nexport {\n default as executeEmbeddedUserOnboardingFlowV2,\n EmbeddedUserOnboardingFlowResponse,\n} from './api/v2/executeEmbeddedUserOnboardingFlowV2';\nexport {default as getFlowMetaV2} from './api/v2/getFlowMetaV2';\nexport {default as getOrganizationUnitChildren} from './api/v2/getOrganizationUnitChildren';\n\nexport {default as ApplicationNativeAuthenticationConstants} from './constants/ApplicationNativeAuthenticationConstants';\nexport {default as TokenConstants} from './constants/TokenConstants';\nexport {default as OIDCRequestConstants} from './constants/OIDCRequestConstants';\nexport {default as VendorConstants} from './constants/VendorConstants';\n\nexport {default as AsgardeoError} from './errors/AsgardeoError';\nexport {default as AsgardeoAPIError} from './errors/AsgardeoAPIError';\nexport {default as AsgardeoRuntimeError} from './errors/AsgardeoRuntimeError';\nexport {AsgardeoAuthException} from './errors/exception';\n\nexport {AllOrganizationsApiResponse} from './models/organization';\nexport {Platform} from './models/platforms';\nexport {\n EmbeddedSignInFlowInitiateResponse,\n EmbeddedSignInFlowStatus,\n EmbeddedSignInFlowType,\n EmbeddedSignInFlowStepType,\n EmbeddedSignInFlowAuthenticator,\n EmbeddedSignInFlowLink,\n EmbeddedSignInFlowHandleRequestPayload,\n EmbeddedSignInFlowHandleResponse,\n EmbeddedSignInFlowAuthenticatorParamType,\n EmbeddedSignInFlowAuthenticatorPromptType,\n EmbeddedSignInFlowAuthenticatorKnownIdPType,\n} from './models/embedded-signin-flow';\nexport {\n EmbeddedFlowComponentType as EmbeddedFlowComponentTypeV2,\n EmbeddedFlowActionVariant as EmbeddedFlowActionVariantV2,\n EmbeddedFlowTextVariant as EmbeddedFlowTextVariantV2,\n EmbeddedFlowEventType as EmbeddedFlowEventTypeV2,\n EmbeddedFlowComponent as EmbeddedFlowComponentV2,\n EmbeddedFlowResponseData as EmbeddedFlowResponseDataV2,\n EmbeddedFlowExecuteRequestConfig as EmbeddedFlowExecuteRequestConfigV2,\n ConsentAttributeElement as ConsentAttributeElementV2,\n ConsentPurposeDecision as ConsentPurposeDecisionV2,\n ConsentDecisions as ConsentDecisionsV2,\n ConsentPurposeData as ConsentPurposeDataV2,\n ConsentPromptData as ConsentPromptDataV2,\n} from './models/v2/embedded-flow-v2';\nexport {\n EmbeddedSignInFlowStatus as EmbeddedSignInFlowStatusV2,\n EmbeddedSignInFlowType as EmbeddedSignInFlowTypeV2,\n ExtendedEmbeddedSignInFlowResponse as ExtendedEmbeddedSignInFlowResponseV2,\n EmbeddedSignInFlowResponse as EmbeddedSignInFlowResponseV2,\n EmbeddedSignInFlowCompleteResponse as EmbeddedSignInFlowCompleteResponseV2,\n EmbeddedSignInFlowInitiateRequest as EmbeddedSignInFlowInitiateRequestV2,\n EmbeddedSignInFlowRequest as EmbeddedSignInFlowRequestV2,\n} from './models/v2/embedded-signin-flow-v2';\nexport {\n EmbeddedSignUpFlowStatus as EmbeddedSignUpFlowStatusV2,\n EmbeddedSignUpFlowType as EmbeddedSignUpFlowTypeV2,\n ExtendedEmbeddedSignUpFlowResponse as ExtendedEmbeddedSignUpFlowResponseV2,\n EmbeddedSignUpFlowResponse as EmbeddedSignUpFlowResponseV2,\n EmbeddedSignUpFlowCompleteResponse as EmbeddedSignUpFlowCompleteResponseV2,\n EmbeddedSignUpFlowInitiateRequest as EmbeddedSignUpFlowInitiateRequestV2,\n EmbeddedSignUpFlowRequest as EmbeddedSignUpFlowRequestV2,\n EmbeddedSignUpFlowErrorResponse as EmbeddedSignUpFlowErrorResponseV2,\n} from './models/v2/embedded-signup-flow-v2';\nexport {\n OrganizationUnit,\n OrganizationUnitListResponse,\n GetOrganizationUnitChildrenConfig,\n} from './models/v2/organization-unit';\nexport {\n FlowMetaType,\n ApplicationMetadata,\n OUMetadata,\n DesignMetadata,\n I18nMetadata,\n FlowMetadataResponse,\n GetFlowMetaRequestConfig,\n FlowMetaTheme,\n FlowMetaThemeColorSet,\n FlowMetaThemeBackground,\n FlowMetaThemeTextColors,\n FlowMetaThemeColors,\n FlowMetaThemeColorScheme,\n FlowMetaThemeShape,\n FlowMetaThemeTypography,\n} from './models/v2/flow-meta-v2';\nexport {\n EmbeddedFlowType,\n EmbeddedFlowStatus,\n EmbeddedFlowExecuteResponse,\n EmbeddedFlowResponseType,\n EmbeddedSignUpFlowData,\n EmbeddedFlowComponent,\n EmbeddedFlowComponentType,\n EmbeddedFlowExecuteRequestPayload,\n EmbeddedFlowExecuteRequestConfig,\n EmbeddedFlowExecuteErrorResponse,\n} from './models/embedded-flow';\nexport {FlowMode} from './models/flow';\nexport {AsgardeoClient} from './models/client';\nexport {\n BaseConfig,\n Config,\n Preferences,\n ThemePreferences,\n I18nPreferences,\n I18nStorageStrategy,\n WithPreferences,\n Extensions,\n WithExtensions,\n SignInOptions,\n SignOutOptions,\n SignUpOptions,\n} from './models/config';\nexport type {ComponentRenderContext, ComponentRenderer, ComponentsExtensions} from './models/v2/extensions/components';\nexport {TokenResponse, IdToken, TokenExchangeRequestConfig} from './models/token';\nexport {AgentConfig} from './models/agent';\nexport {AuthCodeResponse} from './models/auth-code-response';\nexport {Crypto, JWKInterface} from './models/crypto';\nexport {OAuthResponseMode} from './models/oauth-response';\nexport {\n AuthorizeRequestUrlParams,\n KnownExtendedAuthorizeRequestUrlParams,\n ExtendedAuthorizeRequestUrlParams,\n} from './models/oauth-request';\nexport {OIDCEndpoints} from './models/oidc-endpoints';\nexport {OIDCDiscoveryApiResponse} from './models/oidc-discovery';\nexport {Storage, TemporaryStore} from './models/store';\nexport {User, UserProfile} from './models/user';\nexport {SessionData} from './models/session';\nexport {Organization} from './models/organization';\nexport {TranslationFn} from './models/v2/translation';\nexport {ResolveFlowTemplateLiteralsOptions} from './models/v2/vars';\nexport {\n BrandingPreference,\n BrandingPreferenceConfig,\n BrandingLayout,\n BrandingTheme,\n ThemeVariant,\n ButtonsConfig,\n ColorsConfig,\n ColorVariants,\n BrandingOrganizationDetails,\n UrlsConfig,\n} from './models/branding-preference';\nexport {Schema, SchemaAttribute, WellKnownSchemaIds, FlattenedSchema} from './models/scim2-schema';\nexport {RecursivePartial} from './models/utility-types';\nexport {FieldType} from './models/field';\n\nexport {default as AsgardeoJavaScriptClient} from './AsgardeoJavaScriptClient';\n\nexport {default as createTheme, DEFAULT_THEME} from './theme/createTheme';\nexport {ThemeColors, ThemeConfig, Theme, ThemeMode, ThemeDetection} from './theme/types';\n\nexport {default as arrayBufferToBase64url} from './utils/arrayBufferToBase64url';\nexport {default as base64urlToArrayBuffer} from './utils/base64urlToArrayBuffer';\nexport {default as bem} from './utils/bem';\nexport {default as formatDate} from './utils/formatDate';\nexport {default as processUsername} from './utils/processUsername';\nexport {default as deepMerge} from './utils/deepMerge';\nexport {default as deriveOrganizationHandleFromBaseUrl} from './utils/deriveOrganizationHandleFromBaseUrl';\nexport {default as extractUserClaimsFromIdToken} from './utils/extractUserClaimsFromIdToken';\nexport {default as isRecognizedBaseUrlPattern} from './utils/isRecognizedBaseUrlPattern';\nexport {default as extractPkceStorageKeyFromState} from './utils/extractPkceStorageKeyFromState';\nexport {default as flattenUserSchema} from './utils/flattenUserSchema';\nexport {default as generateUserProfile} from './utils/generateUserProfile';\nexport {default as getLatestStateParam} from './utils/getLatestStateParam';\nexport {default as generateFlattenedUserProfile} from './utils/generateFlattenedUserProfile';\nexport {default as getRedirectBasedSignUpUrl} from './utils/getRedirectBasedSignUpUrl';\nexport {default as identifyPlatform} from './utils/identifyPlatform';\nexport {default as isEmpty} from './utils/isEmpty';\nexport {default as isEmojiUri, EMOJI_URI_SCHEME} from './utils/v2/isEmojiUri';\nexport {default as extractEmojiFromUri} from './utils/v2/extractEmojiFromUri';\nexport {default as set} from './utils/set';\nexport {default as get} from './utils/get';\nexport {default as removeTrailingSlash} from './utils/removeTrailingSlash';\nexport {default as resolveFieldType} from './utils/resolveFieldType';\nexport {default as resolveFieldName} from './utils/resolveFieldName';\nexport {default as resolveMeta} from './utils/v2/resolveMeta';\nexport {default as resolveFlowTemplateLiterals} from './utils/v2/resolveFlowTemplateLiterals';\nexport {default as countryCodeToFlagEmoji} from './utils/v2/countryCodeToFlagEmoji';\nexport {default as resolveLocaleDisplayName} from './utils/v2/resolveLocaleDisplayName';\nexport {default as resolveLocaleEmoji} from './utils/v2/resolveLocaleEmoji';\nexport {default as processOpenIDScopes} from './utils/processOpenIDScopes';\nexport {default as withVendorCSSClassPrefix} from './utils/withVendorCSSClassPrefix';\nexport {default as transformBrandingPreferenceToTheme} from './utils/transformBrandingPreferenceToTheme';\n\nexport {\n default as logger,\n createLogger,\n createComponentLogger,\n createPackageLogger,\n createPackageComponentLogger,\n LogLevel,\n configure as configureLogger,\n debug,\n info,\n warn,\n error,\n} from './utils/logger';\nexport type {LoggerConfig} from './utils/logger';\n\nexport {default as StorageManager} from './StorageManager';\n\nexport {HttpClient} from './HttpClient';\nexport {HttpError, HttpRequestConfig, HttpResponse} from './models/http';\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Constants related to OpenID Connect (OIDC) metadata and endpoints.\n * This object contains all the standard OIDC endpoints and storage keys\n * used throughout the application for authentication and authorization.\n *\n * @remarks\n * The constants are organized into two main sections:\n * 1. Endpoints - Contains all OIDC standard endpoint paths\n * 2. Storage - Contains keys used for storing OIDC-related data\n *\n * @example\n * ```typescript\n * // Using an endpoint\n * const authEndpoint = OIDCDiscoveryConstants.Endpoints.AUTHORIZATION;\n *\n * // Using a storage key\n * const tokenKey = OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.TOKEN;\n * ```\n */\nconst OIDCDiscoveryConstants: {\n readonly Endpoints: {\n readonly AUTHORIZATION: string;\n readonly END_SESSION: string;\n readonly ISSUER: string;\n readonly JWKS: string;\n readonly REVOCATION: string;\n readonly SESSION_IFRAME: string;\n readonly TOKEN: string;\n readonly USERINFO: string;\n };\n readonly Storage: {\n readonly StorageKeys: {\n readonly Endpoints: {\n readonly AUTHORIZATION: string;\n readonly END_SESSION: string;\n readonly ISSUER: string;\n readonly JWKS: string;\n readonly REVOCATION: string;\n readonly SESSION_IFRAME: string;\n readonly TOKEN: string;\n readonly USERINFO: string;\n };\n readonly OPENID_PROVIDER_CONFIG_INITIATED: string;\n };\n };\n} = {\n /**\n * Collection of standard OIDC endpoint paths used for authentication flows.\n * These endpoints are relative paths that should be appended to the base URL\n * of your identity provider.\n */\n\n Endpoints: {\n /**\n * Authorization endpoint for initiating the OAuth2/OIDC flow.\n * This endpoint is used to request authorization and receive an authorization code.\n */\n AUTHORIZATION: '/oauth2/authorize',\n\n /**\n * End session endpoint for logout functionality.\n * Used to terminate the user's session and perform logout operations.\n */\n END_SESSION: '/oidc/logout',\n\n /**\n * Token issuer endpoint.\n * The endpoint that issues OAuth2/OIDC tokens.\n */\n ISSUER: '/oauth2/token',\n\n /**\n * JSON Web Key Set endpoint for key validation.\n * Provides the public keys used to verify token signatures.\n */\n JWKS: '/oauth2/jwks',\n\n /**\n * Token revocation endpoint.\n * Used to invalidate access or refresh tokens before they expire.\n */\n REVOCATION: '/oauth2/revoke',\n\n /**\n * Session check iframe endpoint for session management.\n * Used to monitor the user's session state through a hidden iframe.\n */\n SESSION_IFRAME: '/oidc/checksession',\n\n /**\n * Token endpoint for obtaining access tokens.\n * Used to exchange authorization codes for access tokens and refresh tokens.\n */\n TOKEN: '/oauth2/token',\n\n /**\n * UserInfo endpoint for obtaining user claims.\n * Provides authenticated user information when called with a valid access token.\n */\n USERINFO: '/oauth2/userinfo',\n },\n\n /**\n * Storage related constants used for maintaining OIDC state.\n * These constants define the keys used to store OIDC-related data\n * in the browser's storage mechanisms.\n */\n\n Storage: {\n /**\n * Storage keys for various OIDC endpoints and configurations.\n * These keys are used to store endpoint URLs and configuration\n * states in the browser's storage.\n */\n\n StorageKeys: {\n /**\n * Collection of storage keys for OIDC endpoints.\n * These keys are used to store the discovered endpoint URLs\n * from the OpenID Provider's configuration.\n */\n\n Endpoints: {\n /**\n * Storage key for the authorization endpoint URL.\n * Used to store the URL where authorization requests should be sent.\n */\n AUTHORIZATION: 'authorization_endpoint',\n\n /**\n * Storage key for the end session endpoint URL.\n * Used to store the URL where logout requests should be sent.\n */\n END_SESSION: 'end_session_endpoint',\n\n /**\n * Storage key for the issuer identifier URL.\n * Used to store the URL that identifies the OpenID Provider.\n */\n ISSUER: 'issuer',\n\n /**\n * Storage key for the JWKS URI endpoint URL.\n * Used to store the URL where JSON Web Key Sets can be retrieved.\n */\n JWKS: 'jwks_uri',\n\n /**\n * Storage key for the revocation endpoint URL.\n * Used to store the URL where token revocation requests should be sent.\n */\n REVOCATION: 'revocation_endpoint',\n\n /**\n * Storage key for the session check iframe URL.\n * Used to store the URL of the iframe used for session state monitoring.\n */\n SESSION_IFRAME: 'check_session_iframe',\n\n /**\n * Storage key for the token endpoint URL.\n * Used to store the URL where token requests should be sent.\n */\n TOKEN: 'token_endpoint',\n\n /**\n * Storage key for the userinfo endpoint URL.\n * Used to store the URL where user information can be retrieved.\n */\n USERINFO: 'userinfo_endpoint',\n },\n\n /**\n * Flag to track if OpenID Provider configuration is initiated.\n * Used to determine if the OIDC discovery process has been started.\n * This helps prevent duplicate initialization attempts.\n */\n OPENID_PROVIDER_CONFIG_INITIATED: 'op_config_initiated',\n },\n },\n} as const;\n\nexport default OIDCDiscoveryConstants;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Constants for OAuth 2.0 Token Exchange operations.\n * This object contains placeholders used in token exchange requests\n * and responses for dynamic value substitution.\n *\n * @remarks\n * These placeholders are used in token exchange templates and are replaced\n * with actual values during request processing. They help in creating\n * flexible and reusable token exchange configurations.\n *\n * @example\n * ```typescript\n * // Using placeholders in a token exchange template\n * const template = `grant_type=urn:ietf:params:oauth:grant-type:token-exchange&subject_token=${TokenExchangeConstants.Placeholders.TOKEN}`;\n * ```\n */\nconst TokenExchangeConstants: {\n readonly Placeholders: {\n readonly ACCESS_TOKEN: string;\n readonly CLIENT_ID: string;\n readonly CLIENT_SECRET: string;\n readonly SCOPES: string;\n readonly USERNAME: string;\n };\n} = {\n /**\n * Collection of placeholder strings used in token exchange operations.\n * These placeholders are replaced with actual values when processing\n * token exchange requests.\n */\n Placeholders: {\n /**\n * Placeholder for the token value in exchange requests.\n * Usually replaced with an access token or refresh token.\n */\n ACCESS_TOKEN: '{{accessToken}}',\n\n /**\n * Placeholder for client ID in token exchange operations.\n * Required for client authentication.\n */\n CLIENT_ID: '{{clientId}}',\n\n /**\n * Placeholder for client secret in token exchange operations.\n * Used for client authentication in confidential client flows.\n */\n CLIENT_SECRET: '{{clientSecret}}',\n\n /**\n * Placeholder for OAuth scopes in token exchange requests.\n * Replaced with space-separated scope strings.\n */\n SCOPES: '{{scopes}}',\n\n /**\n * Placeholder for the username in token exchange operations.\n * Used when user identity needs to be included in the exchange.\n */\n USERNAME: '{{username}}',\n },\n} as const;\n\nexport default TokenExchangeConstants;\n", "/**\n * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * @deprecated Use `AsgardeoRuntimeError` for runtime errors and `AsgardeoAPIError` for API errors.\n */\nexport class AsgardeoAuthException {\n public name: string;\n\n public code: string | undefined;\n\n public message: string;\n\n public constructor(code: string, name: string, message: string) {\n this.message = message;\n this.name = name;\n this.code = code;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Enumeration of supported identity platforms.\n *\n * - `Asgardeo`: Represents the Asgardeo cloud identity platform (asgardeo.io domains).\n * - `IdentityServer`: Represents WSO2 Identity Server (on-prem or custom domains).\n * - `Unknown`: Used when the platform cannot be determined from the configuration.\n *\n * This enum is used to distinguish between different identity providers and to\n * enable platform-specific logic throughout the SDK.\n */\nexport enum Platform {\n /** Asgardeo cloud identity platform (asgardeo.io domains) */\n Asgardeo = 'ASGARDEO',\n /** @experimental WSO2 Asgardeo V2 */\n AsgardeoV2 = 'AsgardeoV2',\n /** WSO2 Identity Server (on-prem or custom domains) */\n IdentityServer = 'IDENTITY_SERVER',\n /** Unknown or unsupported platform */\n Unknown = 'UNKNOWN',\n}\n", "/**\n * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {IdToken} from '../models/token';\n\n/**\n * Removes standard protocol-specific claims from the ID token payload\n * and returns an object of user-specific claims with original attribute names preserved.\n *\n * @param payload The raw ID token payload.\n * @returns A cleaned-up object containing only user-specific claims with original attribute names.\n *\n * @example\n * ````typescript\n * const idTokenPayload = {\n * iss: 'https://example.com',\n * aud: 'client_id',\n * exp: 1712345678,\n * iat: 1712345670,\n * email: 'user@example.com',\n * given_name: 'John'\n * };\n *\n * const userClaims = extractUserClaimsFromIdToken(idTokenPayload);\n * // userClaims will be:\n * // {\n * // email: 'user@example.com',\n * // given_name: 'John'\n * // }\n * ```\n */\nconst extractUserClaimsFromIdToken = (payload: IdToken): Record<string, unknown> => {\n const filteredPayload: Partial<IdToken> = {...payload};\n\n const protocolClaims: string[] = [\n 'iss',\n 'aud',\n 'exp',\n 'iat',\n 'acr',\n 'amr',\n 'azp',\n 'auth_time',\n 'nonce',\n 'c_hash',\n 'at_hash',\n 'nbf',\n 'isk',\n 'sid',\n 'jti',\n 'sub',\n ];\n\n protocolClaims.forEach((claim: string) => {\n delete filteredPayload[claim as keyof IdToken];\n });\n\n return filteredPayload as Record<string, unknown>;\n};\n\nexport default extractUserClaimsFromIdToken;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Constants for OAuth 2.0 and OpenID Connect scopes.\n * These scopes define the level of access that the client application\n * is requesting from the authorization server.\n *\n * @remarks\n * Scopes are space-separated strings that represent different permissions.\n * The 'openid' scope is required for OpenID Connect flows, while other\n * scopes provide access to different resources or user information.\n *\n * @example\n * ```typescript\n * // Requesting OpenID Connect authentication\n * const scope = [ScopeConstants.OPENID];\n *\n * // Requesting profile information\n * const scopes = [ScopeConstants.OPENID, ScopeConstants.PROFILE];\n * ```\n */\nconst ScopeConstants: {\n INTERNAL_LOGIN: string;\n OPENID: string;\n PROFILE: string;\n} = {\n /**\n * The scope for accessing the user's profile information from SCIM.\n * This scope allows the client to retrieve basic user information such as\n * name, email, profile picture, etc.\n */\n INTERNAL_LOGIN: 'internal_login',\n\n /**\n * The base OpenID Connect scope.\n * Required for all OpenID Connect flows. Indicates that the client\n * is initiating an OpenID Connect authentication request.\n */\n OPENID: 'openid',\n\n /**\n * The OpenID Connect profile scope.\n * This scope allows the client to access the user's profile information.\n * It includes details such as the user's name, email, and other profile attributes.\n */\n PROFILE: 'profile',\n} as const;\n\nexport default ScopeConstants;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport ScopeConstants from './ScopeConstants';\n\n/**\n * Constants representing standard OpenID Connect (OIDC) request and response parameters.\n * These parameters are commonly used during authorization, token exchange, and logout flows.\n */\nconst OIDCRequestConstants: {\n readonly Params: {\n readonly AUTHORIZATION_CODE: string;\n readonly SESSION_STATE: string;\n readonly SIGN_OUT_SUCCESS: string;\n readonly STATE: string;\n };\n readonly SignIn: {\n readonly Payload: {\n readonly DEFAULT_SCOPES: readonly string[];\n };\n };\n readonly SignOut: {\n readonly Storage: {\n readonly StorageKeys: {\n readonly SIGN_OUT_URL: string;\n };\n };\n };\n} = {\n Params: {\n /**\n * The authorization code returned from the authorization endpoint.\n * Used in the authorization code flow.\n */\n AUTHORIZATION_CODE: 'code',\n\n /**\n * Session state parameter used for session management between the client and the OP.\n */\n SESSION_STATE: 'session_state',\n\n /**\n * Indicates whether sign-out was successful during the end-session flow.\n * May be returned by the OP after a logout request.\n */\n SIGN_OUT_SUCCESS: 'sign_out_success',\n\n /**\n * State parameter used to maintain state between the request and the callback.\n * Helps in preventing CSRF attacks.\n */\n STATE: 'state',\n },\n\n /**\n * Constants related to the OpenID Connect (OIDC) sign-in flow.\n */\n SignIn: {\n /**\n * Constants related to the payload of the OIDC sign-in request.\n */\n Payload: {\n /**\n * The default scopes used in OIDC sign-in requests.\n */\n DEFAULT_SCOPES: [ScopeConstants.OPENID, ScopeConstants.PROFILE, ScopeConstants.INTERNAL_LOGIN],\n },\n },\n\n /**\n * Sign-out related constants for managing the end-session flow in OIDC.\n */\n SignOut: {\n /**\n * Storage-related constants for managing sign-out state.\n */\n Storage: {\n /**\n * Collection of storage keys used in sign-out implementation\n */\n StorageKeys: {\n /**\n * Storage key for the sign-out URL.\n * Used to store the complete URL where the user should be redirected after\n * completing the OIDC logout process.\n */\n SIGN_OUT_URL: 'sign_out_url',\n },\n },\n },\n} as const;\n\nexport default OIDCRequestConstants;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Base class for all Asgardeo errors. This class extends the native Error class\n * and adds support for error codes and proper stack traces. Each error is prefixed\n * with a shield emoji and the SDK name for easy identification.\n *\n * @example\n * ```typescript\n * // Create a new error with a message and code\n * throw new AsgardeoError(\n * \"Invalid authentication response\",\n * \"AUTH_ERROR\"\n * );\n *\n * // Or with a specific SDK name\n * throw new AsgardeoError(\n * \"Invalid authentication response\",\n * \"AUTH_ERROR\",\n * \"@asgardeo/react\"\n * );\n *\n * // The error message will be formatted as:\n * // \uD83D\uDEE1\uFE0F Asgardeo React: Invalid authentication response\n * //\n * // (code=\"AUTH_ERROR\")\n */\nexport default class AsgardeoError extends Error {\n public readonly code: string;\n\n public readonly origin: string;\n\n private static resolveOrigin(origin: string): string {\n if (!origin) {\n return '@asgardeo/javascript';\n }\n\n return `@asgardeo/${origin}`;\n }\n\n constructor(message: string, code: string, origin: string) {\n const resolvedOrigin: string = AsgardeoError.resolveOrigin(origin);\n super(message);\n\n this.name = new.target.name;\n this.code = code;\n this.origin = resolvedOrigin;\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, new.target);\n }\n }\n\n public override toString(): string {\n const prefix: string = `\uD83D\uDEE1\uFE0F Asgardeo - ${this.origin}:`;\n return `[${this.name}]\\n${prefix} ${this.message}\\n(code=\"${this.code}\")`;\n }\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoError from './AsgardeoError';\n\n/**\n * Base class for all runtime errors in Asgardeo. This class extends AsgardeoError\n * and adds support for additional error details. Use this class for errors that occur\n * during runtime execution that are not related to API calls.\n *\n * @example\n * ```typescript\n * throw new AsgardeoRuntimeError(\n * \"Failed to parse configuration\",\n * \"CONFIG_PARSE_ERROR\",\n * { invalidField: \"redirectUri\" }\n * );\n * ```\n */\nexport default class AsgardeoRuntimeError extends AsgardeoError {\n /**\n * Creates an instance of AsgardeoRuntimeError.\n *\n * @param message - Human-readable description of the error\n * @param code - A unique error code that identifies the error type\n * @param details - Additional details about the error that might be helpful for debugging\n * @param origin - Optional. The SDK origin (e.g. 'react', 'vue'). Defaults to generic 'Asgardeo'\n * @constructor\n */\n constructor(message: string, code: string, origin: string, public readonly details?: unknown) {\n super(message, code, origin);\n\n Object.defineProperty(this, 'name', {\n configurable: true,\n value: 'AsgardeoRuntimeError',\n writable: true,\n });\n }\n\n /**\n * Returns a string representation of the runtime error\n * @returns Formatted error string with name, code, details, and message\n */\n public override toString(): string {\n const details: string = this.details ? `\\nDetails: ${JSON.stringify(this.details, null, 2)}` : '';\n return `[${this.name}] (code=\"${this.code}\")${details}\\nMessage: ${this.message}`;\n }\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport OIDCRequestConstants from '../constants/OIDCRequestConstants';\nimport AsgardeoRuntimeError from '../errors/AsgardeoRuntimeError';\n\n/**\n * Processes OpenID scopes to ensure they are in the correct format.\n * If the input is a string, it returns it as is.\n * If the input is an array, it joins the elements into a single string separated by spaces.\n * If the input is neither, it throws an error.\n *\n * Default scopes are only injected when no scopes are configured (undefined, empty string,\n * or empty array). If the caller explicitly provides scopes, those are used as-is.\n *\n * @param scopes - The OpenID scopes to process, which can be a string, an array of strings,\n * or undefined/null when not configured.\n * @returns A string of OpenID scopes separated by spaces.\n *\n * @example\n * ```typescript\n * processOpenIDScopes(\"openid profile email\"); // returns \"openid profile email\"\n * processOpenIDScopes([\"openid\", \"profile\", \"email\"]); // returns \"openid profile email\"\n * processOpenIDScopes(undefined); // returns default scopes\n * processOpenIDScopes(123); // throws AsgardeoRuntimeError\n * processOpenIDScopes({}); // throws AsgardeoRuntimeError\n * ```\n */\nconst processOpenIDScopes = (scopes: string | string[] | undefined | null): string => {\n let processedScopes: string[] = [];\n let userConfiguredScopes: boolean = false;\n\n if (scopes !== undefined && scopes !== null) {\n if (Array.isArray(scopes)) {\n processedScopes = scopes;\n userConfiguredScopes = scopes.length > 0;\n } else if (typeof scopes === 'string') {\n processedScopes = scopes ? scopes.split(' ') : [];\n userConfiguredScopes = scopes.length > 0;\n } else {\n throw new AsgardeoRuntimeError(\n 'Scopes must be a string or an array of strings.',\n 'processOpenIDScopes-Invalid-001',\n 'javascript',\n 'The provided scopes are not in the expected format. Please provide a string or an array of strings.',\n );\n }\n }\n\n if (!userConfiguredScopes) {\n OIDCRequestConstants.SignIn.Payload.DEFAULT_SCOPES.forEach((defaultScope: string) => {\n if (!processedScopes.includes(defaultScope)) {\n processedScopes.push(defaultScope);\n }\n });\n }\n\n return processedScopes.join(' ');\n};\n\nexport default processOpenIDScopes;\n", "/**\n * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport OIDCDiscoveryConstants from '../../constants/OIDCDiscoveryConstants';\nimport TokenExchangeConstants from '../../constants/TokenExchangeConstants';\nimport {AsgardeoAuthException} from '../../errors/exception';\nimport {IsomorphicCrypto} from '../../IsomorphicCrypto';\nimport {Config} from '../../models/config';\nimport {JWKInterface} from '../../models/crypto';\nimport {OIDCDiscoveryEndpointsApiResponse, OIDCDiscoveryApiResponse} from '../../models/oidc-discovery';\nimport {Platform} from '../../models/platforms';\nimport {SessionData} from '../../models/session';\nimport {IdToken, TokenResponse, AccessTokenApiResponse} from '../../models/token';\nimport {User} from '../../models/user';\nimport StorageManager from '../../StorageManager';\nimport extractUserClaimsFromIdToken from '../../utils/extractUserClaimsFromIdToken';\nimport processOpenIDScopes from '../../utils/processOpenIDScopes';\nimport {AuthClientConfig, StrictAuthClientConfig} from '../models';\n\nexport class AuthenticationHelper<T> {\n private storageManager: StorageManager<T>;\n\n private config: () => Promise<AuthClientConfig>;\n\n private oidcProviderMetaData: () => Promise<OIDCDiscoveryApiResponse>;\n\n private cryptoHelper: IsomorphicCrypto;\n\n public constructor(storageManagerInstance: StorageManager<T>, cryptoHelperInstance: IsomorphicCrypto) {\n this.storageManager = storageManagerInstance;\n this.config = async (): Promise<AuthClientConfig> => this.storageManager.getConfigData();\n this.oidcProviderMetaData = async (): Promise<OIDCDiscoveryApiResponse> =>\n this.storageManager.loadOpenIDProviderConfiguration();\n this.cryptoHelper = cryptoHelperInstance;\n }\n\n public async resolveEndpoints(response: OIDCDiscoveryApiResponse): Promise<OIDCDiscoveryApiResponse> {\n const oidcProviderMetaData: OIDCDiscoveryApiResponse = {};\n const configData: StrictAuthClientConfig = await this.config();\n\n if (configData.endpoints) {\n Object.keys(configData.endpoints).forEach((endpointName: string) => {\n const snakeCasedName: string = endpointName.replace(/[A-Z]/g, (letter: string) => `_${letter.toLowerCase()}`);\n\n oidcProviderMetaData[snakeCasedName] = configData?.endpoints ? configData.endpoints[endpointName] : '';\n });\n }\n\n return {...response, ...oidcProviderMetaData};\n }\n\n public async resolveEndpointsExplicitly(): Promise<OIDCDiscoveryEndpointsApiResponse> {\n const oidcProviderMetaData: OIDCDiscoveryApiResponse = {};\n const configData: StrictAuthClientConfig = await this.config();\n\n const requiredEndpoints: string[] = [\n OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.AUTHORIZATION,\n OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.END_SESSION,\n OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.JWKS,\n OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.SESSION_IFRAME,\n OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.REVOCATION,\n OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.TOKEN,\n OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.ISSUER,\n OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.USERINFO,\n ];\n\n const isRequiredEndpointsContains: boolean = configData.endpoints\n ? requiredEndpoints.every((reqEndpointName: string) =>\n configData.endpoints\n ? Object.keys(configData.endpoints).some((endpointName: string) => {\n const snakeCasedName: string = endpointName.replace(\n /[A-Z]/g,\n (letter: string) => `_${letter.toLowerCase()}`,\n );\n\n return snakeCasedName === reqEndpointName;\n })\n : false,\n )\n : false;\n\n if (!isRequiredEndpointsContains) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_HELPER-REE-NF01',\n 'Required endpoints missing',\n 'Some or all of the required endpoints are missing in the object passed to the `endpoints` ' +\n 'attribute of the`AuthConfig` object.',\n );\n }\n\n if (configData.endpoints) {\n Object.keys(configData.endpoints).forEach((endpointName: string) => {\n const snakeCasedName: string = endpointName.replace(/[A-Z]/g, (letter: string) => `_${letter.toLowerCase()}`);\n\n oidcProviderMetaData[snakeCasedName] = configData?.endpoints ? configData.endpoints[endpointName] : '';\n });\n }\n\n return {...oidcProviderMetaData};\n }\n\n public async resolveEndpointsByBaseURL(): Promise<OIDCDiscoveryEndpointsApiResponse> {\n const oidcProviderMetaData: OIDCDiscoveryEndpointsApiResponse = {};\n const configData: StrictAuthClientConfig = await this.config();\n\n const {baseUrl} = configData as any;\n\n if (!baseUrl) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_HELPER_REBO-NF01',\n 'Base URL not defined.',\n 'Base URL is not defined in AuthClient config.',\n );\n }\n\n if (configData.endpoints) {\n Object.keys(configData.endpoints).forEach((endpointName: string) => {\n const snakeCasedName: string = endpointName.replace(/[A-Z]/g, (letter: string) => `_${letter.toLowerCase()}`);\n\n oidcProviderMetaData[snakeCasedName] = configData?.endpoints ? configData.endpoints[endpointName] : '';\n });\n }\n\n const endpointKeys: typeof OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints =\n OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints;\n const endpointPaths: typeof OIDCDiscoveryConstants.Endpoints = OIDCDiscoveryConstants.Endpoints;\n\n const defaultEndpoints: OIDCDiscoveryApiResponse = {\n [endpointKeys.AUTHORIZATION]: `${baseUrl}${endpointPaths.AUTHORIZATION}`,\n [endpointKeys.END_SESSION]: `${baseUrl}${endpointPaths.END_SESSION}`,\n [endpointKeys.ISSUER]: `${baseUrl}${endpointPaths.ISSUER}`,\n [endpointKeys.JWKS]: `${baseUrl}${endpointPaths.JWKS}`,\n [endpointKeys.SESSION_IFRAME]: `${baseUrl}${endpointPaths.SESSION_IFRAME}`,\n [endpointKeys.REVOCATION]: `${baseUrl}${endpointPaths.REVOCATION}`,\n [endpointKeys.TOKEN]: `${baseUrl}${endpointPaths.TOKEN}`,\n [endpointKeys.USERINFO]: `${baseUrl}${endpointPaths.USERINFO}`,\n };\n\n // For AsgardeoV2 (Thunder), the issuer must be the base URL (e.g., https://localhost:8090)\n // to comply with RFC 8414 (Section 2 & 3) and OpenID Connect Discovery specs.\n // The issuer should be a URL using \"https\" scheme with no query or fragment components.\n // The well-known metadata endpoint is derived by inserting \"/.well-known/oauth-authorization-server\"\n // between the host and path components of the issuer identifier.\n // Reference: https://datatracker.ietf.org/doc/html/rfc8414#section-2\n // Trackers:\n // - https://github.com/asgardeo/thunder/issues/815\n // - https://github.com/asgardeo/javascript/issues/322\n if ((configData as Config).platform === Platform.AsgardeoV2) {\n defaultEndpoints[OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.ISSUER] = `${baseUrl}`;\n }\n\n return {...defaultEndpoints, ...oidcProviderMetaData};\n }\n\n public async validateIdToken(idToken: string): Promise<boolean> {\n const jwksEndpoint: string | undefined = (await this.storageManager.loadOpenIDProviderConfiguration()).jwks_uri;\n const configData: StrictAuthClientConfig = await this.config();\n\n if (!jwksEndpoint || jwksEndpoint.trim().length === 0) {\n throw new AsgardeoAuthException(\n 'JS_AUTH_HELPER-VIT-NF01',\n 'JWKS endpoint not found.',\n 'No JWKS endpoint was found in the OIDC provider meta data returned by the well-known endpoint ' +\n 'or the JWKS endpoint passed to the SDK is empty.',\n );\n }\n\n let response: Response;\n\n try {\n response = await fetch(jwksEndpoint, {\n credentials: configData.sendCookiesInRequests ? 'include' : 'same-origin',\n });\n } catch (error: any) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_HELPER-VIT-NE02',\n 'Request to jwks endpoint failed.',\n error ?? 'The request sent to get the jwks from the server failed.',\n );\n }\n\n if (response.status !== 200 || !response.ok) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_HELPER-VIT-HE03',\n `Invalid response status received for jwks request (${response.statusText}).`,\n (await response.json()) as string,\n );\n }\n\n const {issuer} = await this.oidcProviderMetaData();\n\n const {keys}: {keys: JWKInterface[]} = (await response.json()) as {\n keys: JWKInterface[];\n };\n\n const jwk: any = await this.cryptoHelper.getJWKForTheIdToken(idToken.split('.')[0], keys);\n\n return this.cryptoHelper.isValidIdToken(\n idToken,\n jwk,\n (await this.config()).clientId,\n issuer ?? '',\n this.cryptoHelper.decodeJwtToken<IdToken>(idToken).sub,\n (await this.config()).tokenValidation?.idToken?.clockTolerance,\n (await this.config()).tokenValidation?.idToken?.validateIssuer ?? true,\n );\n }\n\n public getAuthenticatedUserInfo(idToken: string): User {\n const payload: IdToken = this.cryptoHelper.decodeJwtToken<IdToken>(idToken);\n const username: string = payload?.['username'] ?? '';\n const givenName: string = payload?.['given_name'] ?? '';\n const familyName: string = payload?.['family_name'] ?? '';\n const fullName: string = givenName && familyName ? `${givenName} ${familyName}` : givenName || familyName || '';\n const displayName: string = payload.preferred_username ?? fullName;\n\n return {\n displayName,\n username,\n ...extractUserClaimsFromIdToken(payload),\n };\n }\n\n public async replaceCustomGrantTemplateTags(text: string, userId?: string): Promise<string> {\n const configData: StrictAuthClientConfig = await this.config();\n\n const sourceInstanceId: number | null = configData.organizationChain?.sourceInstanceId ?? null;\n\n let sessionData: SessionData;\n\n if (sourceInstanceId) {\n const {clientId} = configData;\n let instanceKey: string;\n if (clientId) {\n instanceKey = `instance_${sourceInstanceId}-${clientId}`;\n } else {\n instanceKey = `instance_${sourceInstanceId}`;\n }\n sessionData = await this.storageManager.getSessionData(userId, instanceKey);\n\n if (!sessionData || !sessionData.access_token) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_HELPER-RCGTT-NE01',\n 'No session data found for source instance.',\n 'Failed to retrieve session data from the source organization context.',\n );\n }\n } else {\n sessionData = await this.storageManager.getSessionData(userId);\n }\n\n const scope: string = processOpenIDScopes(configData.scopes);\n\n if (typeof text !== 'string') {\n return text;\n }\n\n return text\n .replace(TokenExchangeConstants.Placeholders.ACCESS_TOKEN, sessionData.access_token)\n .replace(\n TokenExchangeConstants.Placeholders.USERNAME,\n this.getAuthenticatedUserInfo(sessionData.id_token).username,\n )\n .replace(TokenExchangeConstants.Placeholders.SCOPES, scope)\n .replace(TokenExchangeConstants.Placeholders.CLIENT_ID, configData.clientId)\n .replace(TokenExchangeConstants.Placeholders.CLIENT_SECRET, configData.clientSecret ?? '');\n }\n\n public async clearSession(userId?: string): Promise<void> {\n await this.storageManager.removeTemporaryData(userId);\n await this.storageManager.removeSessionData(userId);\n }\n\n public async handleTokenResponse(response: Response, userId?: string): Promise<TokenResponse> {\n if (response.status !== 200 || !response.ok) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_HELPER-HTR-NE01',\n `Invalid response status received for token request (${response.statusText}).`,\n (await response.json()) as string,\n );\n }\n\n // Get the response in JSON\n const parsedResponse: AccessTokenApiResponse = (await response.json()) as AccessTokenApiResponse;\n\n parsedResponse.created_at = new Date().getTime();\n\n const shouldValidateIdToken: boolean | undefined = (await this.config()).tokenValidation?.idToken?.validate;\n\n if (shouldValidateIdToken) {\n return this.validateIdToken(parsedResponse.id_token).then(async () => {\n await this.storageManager.setSessionData(parsedResponse, userId);\n\n const tokenResponse: TokenResponse = {\n accessToken: parsedResponse.access_token,\n createdAt: parsedResponse.created_at,\n expiresIn: parsedResponse.expires_in,\n idToken: parsedResponse.id_token,\n refreshToken: parsedResponse.refresh_token,\n scope: parsedResponse.scope,\n tokenType: parsedResponse.token_type,\n };\n\n return Promise.resolve(tokenResponse);\n });\n }\n const tokenResponse: TokenResponse = {\n accessToken: parsedResponse.access_token,\n createdAt: parsedResponse.created_at,\n expiresIn: parsedResponse.expires_in,\n idToken: parsedResponse.id_token,\n refreshToken: parsedResponse.refresh_token,\n scope: parsedResponse.scope,\n tokenType: parsedResponse.token_type,\n };\n\n await this.storageManager.setSessionData(parsedResponse, userId);\n\n return Promise.resolve(tokenResponse);\n }\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Constants related to Proof Key for Code Exchange (PKCE) implementation.\n * This object contains all the necessary constants for implementing PKCE\n * flow in the OAuth 2.0 authorization code grant.\n *\n * @remarks\n * PKCE is an extension to the authorization code flow to prevent CSRF and\n * authorization code injection attacks. The constants are organized into\n * storage-related sections for managing PKCE state.\n *\n * @example\n * ```typescript\n * // Using storage keys\n * const codeVerifierKey = PKCEConstants.Storage.StorageKeys.CODE_VERIFIER;\n * const separator = PKCEConstants.Storage.StorageKeys.SEPARATOR;\n * ```\n */\nconst PKCEConstants: {\n readonly DEFAULT_CODE_CHALLENGE_METHOD: string;\n readonly Storage: {\n readonly StorageKeys: {\n readonly CODE_VERIFIER: string;\n readonly SEPARATOR: string;\n };\n };\n} = {\n DEFAULT_CODE_CHALLENGE_METHOD: 'S256',\n /**\n * Storage-related constants for managing PKCE state\n */\n Storage: {\n /**\n * Collection of storage keys used in PKCE implementation\n */\n StorageKeys: {\n /**\n * Key used to store the PKCE code verifier in temporary storage.\n * The code verifier is a cryptographically random string that is\n * used to generate the code challenge.\n */\n CODE_VERIFIER: 'pkce_code_verifier',\n\n /**\n * Separator used in storage keys to create unique identifiers\n * by combining different parts of the key.\n */\n SEPARATOR: '#',\n },\n },\n} as const;\n\nexport default PKCEConstants;\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Constants related to OpenID Connect (OIDC) metadata and endpoints.\n * This object contains all the standard OIDC endpoints and storage keys\n * used throughout the application for authentication and authorization.\n *\n * @remarks\n * The constants are organized into two main sections:\n * 1. Endpoints - Contains all OIDC standard endpoint paths\n * 2. Storage - Contains keys used for storing OIDC-related data\n *\n * @example\n * ```typescript\n * // Using an endpoint\n * const wellKnownEndpoint = OIDCDiscoveryConstants.Endpoints.WELL_KNOWN;\n * ```\n */\nconst OIDCDiscoveryConstants: {\n readonly Endpoints: {\n readonly WELL_KNOWN: string;\n };\n} = {\n /**\n * Collection of standard OIDC endpoint paths used for authentication flows.\n * These endpoints are relative paths that should be appended to the base URL\n * of your identity provider.\n */\n Endpoints: {\n /**\n * OpenID Connect discovery document endpoint.\n * Used to fetch provider metadata from the authorization server.\n */\n WELL_KNOWN: '/.well-known/openid-configuration',\n },\n} as const;\n\nexport default OIDCDiscoveryConstants;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Constants related to OIDC token management and storage.\n * This object contains configuration values and storage keys\n * used in token validation and management processes.\n *\n * @remarks\n * The constants are organized into two main sections:\n * 1. SignatureValidation - Contains supported algorithms for token validation\n * 2. Storage - Contains keys used for storing token-related data\n *\n * @example\n * ```typescript\n * // Using signature validation algorithms\n * const algorithms = TokenConstants.SignatureValidation.SUPPORTED_ALGORITHMS;\n *\n * // Using storage keys\n * const timerKey = TokenConstants.Storage.StorageKeys.REFRESH_TOKEN_TIMER;\n * ```\n */\nconst TokenConstants: {\n readonly SignatureValidation: {\n readonly SUPPORTED_ALGORITHMS: readonly string[];\n };\n readonly Storage: {\n readonly StorageKeys: {\n readonly REFRESH_TOKEN_TIMER: string;\n };\n };\n} = {\n /**\n * Token signature validation constants.\n * Contains configurations related to token signature verification.\n */\n SignatureValidation: {\n /**\n * Fallback array of supported signature algorithms for OIDC token validation.\n * These values are used when the supported algorithms cannot be retrieved from\n * the .well-known/openid-configuration endpoint.\n *\n * Supported algorithms:\n * - `RS256` - RSASSA-PKCS1-v1_5 using SHA-256\n * - `RS512` - RSASSA-PKCS1-v1_5 using SHA-512\n * - `RS384` - RSASSA-PKCS1-v1_5 using SHA-384\n * - `PS256` - RSASSA-PSS using SHA-256 and MGF1 with SHA-256\n */\n SUPPORTED_ALGORITHMS: ['RS256', 'RS512', 'RS384', 'PS256'],\n },\n\n /**\n * Storage-related constants for OIDC tokens.\n * Contains keys used to store token-related data in browser storage.\n */\n Storage: {\n /**\n * Collection of storage keys used in token management.\n * These keys are used to store and retrieve token-related\n * information from browser storage.\n */\n StorageKeys: {\n /**\n * Key used to store the refresh token timer identifier.\n * This timer is used to schedule token refresh operations\n * before the current token expires.\n */\n REFRESH_TOKEN_TIMER: 'refresh_token_timer',\n },\n },\n} as const;\n\nexport default TokenConstants;\n", "/**\n * Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport TokenConstants from './constants/TokenConstants';\nimport {AsgardeoAuthException} from './errors/exception';\nimport {Crypto, JWKInterface} from './models/crypto';\n\nexport class IsomorphicCrypto<T = any> {\n private cryptoUtils: Crypto<T>;\n\n public constructor(cryptoUtils: Crypto<T>) {\n this.cryptoUtils = cryptoUtils;\n }\n\n /**\n * Generate code verifier.\n *\n * @returns code verifier.\n */\n public getCodeVerifier(): string {\n return this.cryptoUtils.base64URLEncode(this.cryptoUtils.generateRandomBytes(32));\n }\n\n /**\n * Derive code challenge from the code verifier.\n *\n * @param verifier - Code verifier.\n *\n * @returns - code challenge.\n */\n public async getCodeChallenge(verifier: string): Promise<string> {\n const hashed: T = await this.cryptoUtils.hashSha256(verifier);\n return this.cryptoUtils.base64URLEncode(hashed);\n }\n\n /**\n * Get JWK used for the id_token\n *\n * @param jwtHeader - header of the id_token.\n * @param keys - jwks response.\n *\n * @returns public key.\n *\n * @throws\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n public getJWKForTheIdToken(jwtHeader: string, keys: JWKInterface[]): JWKInterface {\n const headerJSON: Record<string, string> = JSON.parse(this.cryptoUtils.base64URLDecode(jwtHeader));\n\n const matchingKey: JWKInterface | undefined = keys.find(\n (key: JWKInterface): boolean => headerJSON['kid'] === key.kid,\n );\n\n if (matchingKey) {\n return matchingKey;\n }\n\n throw new AsgardeoAuthException(\n 'JS-CRYPTO_UTIL-GJFTIT-IV01',\n 'kid not found.',\n `Failed to find the 'kid' specified in the id_token. 'kid' found in the header : ${\n headerJSON['kid']\n }, Expected values: ${keys.map((key: JWKInterface) => key.kid).join(', ')}`,\n );\n }\n\n /**\n * Verify id token.\n *\n * @param idToken - id_token received from the IdP.\n * @param jwk - public key used for signing.\n * @param clientId - app identification.\n * @param issuer - id_token issuer.\n * @param username - Username.\n * @param clockTolerance - Allowed leeway for id_tokens (in seconds).\n *\n * @returns whether the id_token is valid.\n *\n * @throws\n */\n public isValidIdToken(\n idToken: string,\n jwk: JWKInterface,\n clientId: string,\n issuer: string,\n username: string,\n clockTolerance: number | undefined,\n validateJwtIssuer: boolean | undefined,\n ): Promise<boolean> {\n return this.cryptoUtils\n .verifyJwt(\n idToken,\n jwk,\n TokenConstants.SignatureValidation.SUPPORTED_ALGORITHMS as unknown as string[],\n clientId,\n issuer,\n username,\n clockTolerance,\n validateJwtIssuer,\n )\n .then((response: boolean) => {\n if (response) {\n return Promise.resolve(true);\n }\n\n return Promise.reject(\n new AsgardeoAuthException(\n 'JS-CRYPTO_HELPER-IVIT-IV01',\n 'Invalid ID token.',\n 'ID token validation returned false',\n ),\n );\n })\n .catch((error: AsgardeoAuthException) => Promise.reject(error));\n }\n\n public decodeJwtToken<R = Record<string, unknown>>(token: string): R {\n try {\n const utf8String: string = this.cryptoUtils.base64URLDecode(token?.split('.')[1]);\n const payload: R = JSON.parse(utf8String);\n\n return payload;\n } catch (error: any) {\n throw new AsgardeoAuthException('JS-CRYPTO_UTIL-DIT-IV02', 'Decoding token failed.', error);\n }\n }\n}\n", "/**\n * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {AuthClientConfig} from './__legacy__/models';\nimport {OIDCDiscoveryApiResponse} from './models/oidc-discovery';\nimport {SessionData} from './models/session';\nimport {Stores, Storage, TemporaryStore, TemporaryStoreValue} from './models/store';\n\ntype PartialData<T> = Partial<AuthClientConfig<T> | OIDCDiscoveryApiResponse | SessionData | TemporaryStore>;\n\nexport const ASGARDEO_SESSION_ACTIVE: string = 'asgardeo-session-active';\n\nclass StorageManager<T> {\n protected id: string;\n\n protected store: Storage;\n\n public constructor(instanceID: string, store: Storage) {\n this.id = instanceID;\n this.store = store;\n }\n\n protected async setDataInBulk(key: string, data: PartialData<T>): Promise<void> {\n const existingDataJSON: string = (await this.store.getData(key)) ?? null;\n const existingData: PartialData<T> = existingDataJSON && JSON.parse(existingDataJSON);\n\n const dataToBeSaved: PartialData<T> = {...existingData, ...data};\n const dataToBeSavedJSON: string = JSON.stringify(dataToBeSaved);\n\n await this.store.setData(key, dataToBeSavedJSON);\n }\n\n protected async setValue(\n key: string,\n attribute: keyof AuthClientConfig<T> | keyof OIDCDiscoveryApiResponse | keyof SessionData | keyof TemporaryStore,\n value: TemporaryStoreValue,\n ): Promise<void> {\n const existingDataJSON: string = (await this.store.getData(key)) ?? null;\n const existingData: PartialData<T> = existingDataJSON && JSON.parse(existingDataJSON);\n\n const dataToBeSaved: PartialData<T> = {...existingData, [attribute]: value};\n const dataToBeSavedJSON: string = JSON.stringify(dataToBeSaved);\n\n await this.store.setData(key, dataToBeSavedJSON);\n }\n\n protected async removeValue(\n key: string,\n attribute: keyof AuthClientConfig<T> | keyof OIDCDiscoveryApiResponse | keyof SessionData | keyof TemporaryStore,\n ): Promise<void> {\n const existingDataJSON: string = (await this.store.getData(key)) ?? null;\n const existingData: PartialData<T> = existingDataJSON && JSON.parse(existingDataJSON);\n\n const dataToBeSaved: PartialData<T> = {...existingData};\n\n delete dataToBeSaved[attribute as string];\n\n const dataToBeSavedJSON: string = JSON.stringify(dataToBeSaved);\n\n await this.store.setData(key, dataToBeSavedJSON);\n }\n\n protected resolveKey(store: Stores | string, userId?: string, instanceId?: string): string {\n if (userId && instanceId) {\n return `${store}-${instanceId}-${userId}`;\n }\n if (userId) {\n return `${store}-${this.id}-${userId}`;\n }\n if (instanceId) {\n return `${store}-${instanceId}`;\n }\n return `${store}-${this.id}`;\n }\n\n protected static isLocalStorageAvailable(): boolean {\n try {\n const testValue: string = '__ASGARDEO_AUTH_CORE_LOCAL_STORAGE_TEST__';\n\n localStorage.setItem(testValue, testValue);\n localStorage.removeItem(testValue);\n\n return true;\n } catch (error) {\n return false;\n }\n }\n\n public async setConfigData(config: Partial<AuthClientConfig<T>>): Promise<void> {\n await this.setDataInBulk(this.resolveKey(Stores.ConfigData), config);\n }\n\n public async setOIDCProviderMetaData(oidcProviderMetaData: Partial<OIDCDiscoveryApiResponse>): Promise<void> {\n this.setDataInBulk(this.resolveKey(Stores.OIDCProviderMetaData), oidcProviderMetaData);\n }\n\n public async setTemporaryData(temporaryData: Partial<TemporaryStore>, userId?: string): Promise<void> {\n this.setDataInBulk(this.resolveKey(Stores.TemporaryData, userId), temporaryData);\n }\n\n public async setSessionData(sessionData: Partial<SessionData>, userId?: string): Promise<void> {\n this.setDataInBulk(this.resolveKey(Stores.SessionData, userId), sessionData);\n }\n\n public async setCustomData<K>(key: string, customData: Partial<K>, userId?: string): Promise<void> {\n this.setDataInBulk(this.resolveKey(key, userId), customData);\n }\n\n public async getConfigData(userId?: string): Promise<AuthClientConfig<T>> {\n return JSON.parse((await this.store.getData(this.resolveKey(Stores.ConfigData, userId))) ?? null);\n }\n\n public async loadOpenIDProviderConfiguration(): Promise<OIDCDiscoveryApiResponse> {\n return JSON.parse((await this.store.getData(this.resolveKey(Stores.OIDCProviderMetaData))) ?? null);\n }\n\n public async getTemporaryData(userId?: string): Promise<TemporaryStore> {\n return JSON.parse((await this.store.getData(this.resolveKey(Stores.TemporaryData, userId))) ?? null);\n }\n\n public async getPersistedData(userId?: string): Promise<TemporaryStore> {\n return JSON.parse((await this.store.getData(this.resolveKey(Stores.PersistedData, userId))) ?? null);\n }\n\n public async setPersistedData(persistedData: Partial<TemporaryStore>, userId?: string): Promise<void> {\n this.setDataInBulk(this.resolveKey(Stores.PersistedData, userId), persistedData);\n }\n\n public async getSessionData(userId?: string, instanceId?: string): Promise<SessionData> {\n return JSON.parse((await this.store.getData(this.resolveKey(Stores.SessionData, userId, instanceId))) ?? null);\n }\n\n public async getCustomData<K>(key: string, userId?: string): Promise<K> {\n return JSON.parse((await this.store.getData(this.resolveKey(key, userId))) ?? null);\n }\n\n // eslint-disable-next-line class-methods-use-this\n public setSessionStatus(status: string): void {\n // Using local storage to store the session status as it is required to be available across tabs.\n if (StorageManager.isLocalStorageAvailable()) {\n localStorage.setItem(`${ASGARDEO_SESSION_ACTIVE}`, status);\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n public getSessionStatus(): string {\n return StorageManager.isLocalStorageAvailable() ? localStorage.getItem(`${ASGARDEO_SESSION_ACTIVE}`) ?? '' : '';\n }\n\n // eslint-disable-next-line class-methods-use-this\n public removeSessionStatus(): void {\n if (StorageManager.isLocalStorageAvailable()) {\n localStorage.removeItem(`${ASGARDEO_SESSION_ACTIVE}`);\n }\n }\n\n public async removeConfigData(): Promise<void> {\n await this.store.removeData(this.resolveKey(Stores.ConfigData));\n }\n\n public async removeOIDCProviderMetaData(): Promise<void> {\n await this.store.removeData(this.resolveKey(Stores.OIDCProviderMetaData));\n }\n\n public async removeTemporaryData(userId?: string): Promise<void> {\n await this.store.removeData(this.resolveKey(Stores.TemporaryData, userId));\n }\n\n public async removeSessionData(userId?: string): Promise<void> {\n await this.store.removeData(this.resolveKey(Stores.SessionData, userId));\n }\n\n public async getConfigDataParameter(key: keyof AuthClientConfig<T>): Promise<TemporaryStoreValue> {\n const data: string = await this.store.getData(this.resolveKey(Stores.ConfigData));\n\n return data && JSON.parse(data)[key];\n }\n\n public async getOIDCProviderMetaDataParameter(key: keyof OIDCDiscoveryApiResponse): Promise<TemporaryStoreValue> {\n const data: string = await this.store.getData(this.resolveKey(Stores.OIDCProviderMetaData));\n\n return data && JSON.parse(data)[key];\n }\n\n public async getTemporaryDataParameter(key: keyof TemporaryStore, userId?: string): Promise<TemporaryStoreValue> {\n const data: string = await this.store.getData(this.resolveKey(Stores.TemporaryData, userId));\n\n return data && JSON.parse(data)[key];\n }\n\n public async getSessionDataParameter(key: keyof SessionData, userId?: string): Promise<TemporaryStoreValue> {\n const data: string = await this.store.getData(this.resolveKey(Stores.SessionData, userId));\n\n return data && JSON.parse(data)[key];\n }\n\n public async setConfigDataParameter(key: keyof AuthClientConfig<T>, value: TemporaryStoreValue): Promise<void> {\n await this.setValue(this.resolveKey(Stores.ConfigData), key, value);\n }\n\n public async setOIDCProviderMetaDataParameter(\n key: keyof OIDCDiscoveryApiResponse,\n value: TemporaryStoreValue,\n ): Promise<void> {\n await this.setValue(this.resolveKey(Stores.OIDCProviderMetaData), key, value);\n }\n\n public async setTemporaryDataParameter(\n key: keyof TemporaryStore,\n value: TemporaryStoreValue,\n userId?: string,\n ): Promise<void> {\n await this.setValue(this.resolveKey(Stores.TemporaryData, userId), key, value);\n }\n\n public async setSessionDataParameter(\n key: keyof SessionData,\n value: TemporaryStoreValue,\n userId?: string,\n ): Promise<void> {\n await this.setValue(this.resolveKey(Stores.SessionData, userId), key, value);\n }\n\n public async removeConfigDataParameter(key: keyof AuthClientConfig<T>): Promise<void> {\n await this.removeValue(this.resolveKey(Stores.ConfigData), key);\n }\n\n public async removeOIDCProviderMetaDataParameter(key: keyof OIDCDiscoveryApiResponse): Promise<void> {\n await this.removeValue(this.resolveKey(Stores.OIDCProviderMetaData), key);\n }\n\n public async removeTemporaryDataParameter(key: keyof TemporaryStore, userId?: string): Promise<void> {\n await this.removeValue(this.resolveKey(Stores.TemporaryData, userId), key);\n }\n\n public async removeSessionDataParameter(key: keyof SessionData, userId?: string): Promise<void> {\n await this.removeValue(this.resolveKey(Stores.SessionData, userId), key);\n }\n}\n\nexport default StorageManager;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Checks if a value is a plain object (not an array, function, date, etc.)\n *\n * @param value - The value to check\n * @returns True if the value is a plain object\n */\nconst isPlainObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n !(value instanceof Date) &&\n !(value instanceof RegExp) &&\n Object.prototype.toString.call(value) === '[object Object]';\n\n/**\n * Recursively merges the properties of source objects into a target object.\n * Similar to Lodash's merge function, this creates a deep copy and merges\n * nested objects recursively. Arrays and non-plain objects are replaced entirely.\n *\n * @param target - The target object to merge into\n * @param sources - One or more source objects to merge from\n * @returns A new object with merged properties\n *\n * @example\n * ```typescript\n * const obj1 = { a: 1, b: { x: 1, y: 2 } };\n * const obj2 = { b: { y: 3, z: 4 }, c: 3 };\n * const result = deepMerge(obj1, obj2);\n * // Result: { a: 1, b: { x: 1, y: 3, z: 4 }, c: 3 }\n * ```\n *\n * @example\n * ```typescript\n * const config = { theme: { colors: { primary: 'blue' } } };\n * const userPrefs = { theme: { colors: { secondary: 'red' } } };\n * const merged = deepMerge(config, userPrefs);\n * // Result: { theme: { colors: { primary: 'blue', secondary: 'red' } } }\n * ```\n */\nconst deepMerge = <T extends Record<string, any>>(\n target: T,\n ...sources: Array<Record<string, any> | undefined | null>\n): T => {\n if (!target || typeof target !== 'object') {\n throw new Error('Target must be an object');\n }\n\n const result: T = {...target} as T;\n\n sources.forEach((source: Record<string, any> | undefined | null) => {\n if (!source || typeof source !== 'object') {\n return;\n }\n\n Object.keys(source).forEach((key: string) => {\n const sourceValue: any = source[key];\n const targetValue: any = (result as any)[key];\n\n if (isPlainObject(sourceValue) && isPlainObject(targetValue)) {\n (result as any)[key] = deepMerge(targetValue, sourceValue);\n } else if (sourceValue !== undefined) {\n (result as any)[key] = sourceValue;\n }\n });\n });\n\n return result;\n};\n\nexport default deepMerge;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport PKCEConstants from '../constants/PKCEConstants';\n\n/**\n * Extracts the PKCE key from a state parameter string.\n *\n * @param state - The state parameter string containing the request index.\n * @returns The PKCE key string in the format `pkce_code_verifier_${index}`.\n *\n * @example\n * ```typescript\n * const state = \"request_1\";\n * const pkceKey = extractPkceStorageKeyFromState(state);\n * // Returns: \"pkce_code_verifier_1\"\n * ```\n */\nconst extractPkceStorageKeyFromState = (state: string): string => {\n const index: number = parseInt(state.split('request_')[1], 10);\n\n return `${PKCEConstants.Storage.StorageKeys.CODE_VERIFIER}${PKCEConstants.Storage.StorageKeys.SEPARATOR}${index}`;\n};\n\nexport default extractPkceStorageKeyFromState;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport PKCEConstants from '../constants/PKCEConstants';\nimport {TemporaryStore} from '../models/store';\n\n/**\n * Generates the next available PKCE storage key based on the current temporary data.\n *\n * The generated key will follow the format: `pkce_code_verifier_<index>`, where `<index>` is incremented\n * based on the highest existing index in the provided storage object.\n *\n * @param tempStore - The object that holds temporary PKCE-related data (e.g., sessionStorage).\n *\n * @returns A new unique PKCE storage key to store the next `code_verifier`.\n *\n * @example\n * const key = generatePkceStorageKey(sessionStorage);\n * // Returns: \"pkce_code_verifier_3\" (if existing keys are pkce_code_verifier_0 to _2)\n */\nconst generatePkceStorageKey = (tempStore: TemporaryStore): string => {\n const keys: string[] = [];\n\n Object.keys(tempStore).forEach((key: string) => {\n if (key.startsWith(PKCEConstants.Storage.StorageKeys.CODE_VERIFIER)) {\n keys.push(key);\n }\n });\n\n const lastKey: string | undefined = keys.sort().pop();\n const index: number = parseInt(lastKey?.split(PKCEConstants.Storage.StorageKeys.SEPARATOR)[1] ?? '-1', 10);\n\n return `${PKCEConstants.Storage.StorageKeys.CODE_VERIFIER}${PKCEConstants.Storage.StorageKeys.SEPARATOR}${index + 1}`;\n};\n\nexport default generatePkceStorageKey;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport PKCEConstants from '../constants/PKCEConstants';\n\n/**\n * Generates a state parameter for request correlation by combining an optional state string with a request index.\n *\n * @param pkceKey - The PKCE key containing the index (format: 'pkce_code_verifier_[index]').\n * @param state - Optional state string to prepend to the request correlation.\n * @returns A state parameter string in the format '[state_]request_[index]'.\n *\n * @example\n * const pkceKey = \"pkce_code_verifier_1\";\n * const result = generateStateParamForRequestCorrelation(pkceKey, \"myState\");\n * // Returns: \"myState_request_1\"\n *\n * const resultNoState = generateStateParamForRequestCorrelation(pkceKey);\n * // Returns: \"request_1\"\n */\nconst generateStateParamForRequestCorrelation = (pkceKey: string, state?: string): string => {\n const index: number = parseInt(pkceKey.split(PKCEConstants.Storage.StorageKeys.SEPARATOR)[1], 10);\n\n return state ? `${state}_request_${index}` : `request_${index}`;\n};\n\nexport default generateStateParamForRequestCorrelation;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport generateStateParamForRequestCorrelation from './generateStateParamForRequestCorrelation';\nimport OIDCRequestConstants from '../constants/OIDCRequestConstants';\nimport AsgardeoRuntimeError from '../errors/AsgardeoRuntimeError';\nimport {ExtendedAuthorizeRequestUrlParams} from '../models/oauth-request';\n\n/**\n * Generates a map of authorization request URL parameters for OIDC authorization requests.\n *\n * This utility ensures the `openid` scope is always included, handles both string and array forms of the `scope` parameter,\n * and supports PKCE and custom parameters. Throws if a code challenge is provided without a code challenge method.\n *\n * @param options - The main options for the authorization request, including redirectUri, clientId, scope, responseMode, codeChallenge, codeChallengeMethod, and prompt.\n * @param pkceOptions - PKCE options, including the PKCE key for state correlation.\n * @param customParams - Optional custom parameters to include in the request (excluding the `state` param, which is handled separately).\n * @returns A Map of key-value pairs representing the authorization request URL parameters.\n *\n * @throws {AsgardeoRuntimeError} If a code challenge is provided without a code challenge method.\n *\n * @example\n * const params = getAuthorizeRequestUrlParams({\n * options: {\n * redirectUri: 'https://app/callback',\n * clientId: 'client123',\n * scope: ['openid', 'profile'],\n * responseMode: 'query',\n * codeChallenge: 'abc',\n * codeChallengeMethod: 'S256',\n * prompt: 'login'\n * },\n * pkceOptions: { key: 'pkce_code_verifier_1' },\n * customParams: { foo: 'bar' }\n * });\n * // Returns a Map with all required OIDC params, PKCE, and custom params.\n */\nconst getAuthorizeRequestUrlParams = (\n options: {\n clientId: string;\n codeChallenge?: string;\n codeChallengeMethod?: string;\n instanceId?: string;\n prompt?: string;\n redirectUri: string;\n responseMode?: string;\n scopes?: string;\n } & ExtendedAuthorizeRequestUrlParams,\n pkceOptions: {key: string},\n customParams: Record<string, string | number | boolean>,\n): Map<string, string> => {\n const {redirectUri, clientId, scopes, responseMode, codeChallenge, codeChallengeMethod, prompt} = options;\n const authorizeRequestParams: Map<string, string> = new Map<string, string>();\n\n authorizeRequestParams.set('response_type', 'code');\n authorizeRequestParams.set('client_id', clientId as string);\n\n authorizeRequestParams.set('scope', scopes);\n authorizeRequestParams.set('redirect_uri', redirectUri as string);\n\n if (responseMode) {\n authorizeRequestParams.set('response_mode', responseMode as string);\n }\n\n const pkceKey: string = pkceOptions?.key;\n\n if (codeChallenge) {\n authorizeRequestParams.set('code_challenge', codeChallenge as string);\n\n if (codeChallengeMethod) {\n authorizeRequestParams.set('code_challenge_method', codeChallengeMethod as string);\n } else {\n throw new AsgardeoRuntimeError(\n 'Code challenge method is required when code challenge is provided.',\n 'getAuthorizeRequestUrlParams-ValidationError-001',\n 'javascript',\n 'When PKCE is enabled, the code challenge method must be provided along with the code challenge.',\n );\n }\n }\n\n if (prompt) {\n authorizeRequestParams.set('prompt', prompt as string);\n }\n\n if (customParams) {\n Object.entries(customParams).forEach(([key, value]: [string, string | number | boolean]) => {\n if (key !== '' && value !== '' && key !== OIDCRequestConstants.Params.STATE) {\n authorizeRequestParams.set(key, value.toString());\n }\n });\n }\n\n const AUTH_INSTANCE_PREFIX: string = 'instance_';\n let customStateValue: string = '';\n\n if (options.instanceId) {\n customStateValue = AUTH_INSTANCE_PREFIX + options.instanceId;\n } else if (customParams) {\n customStateValue = customParams[OIDCRequestConstants.Params.STATE]?.toString() ?? '';\n }\n\n authorizeRequestParams.set(\n OIDCRequestConstants.Params.STATE,\n generateStateParamForRequestCorrelation(pkceKey, customStateValue),\n );\n\n return authorizeRequestParams;\n};\n\nexport default getAuthorizeRequestUrlParams;\n", "/**\n * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {AuthenticationHelper} from './helpers';\nimport {AuthClientConfig, StrictAuthClientConfig} from './models';\nimport OIDCDiscoveryConstants from '../constants/OIDCDiscoveryConstants';\nimport OIDCRequestConstants from '../constants/OIDCRequestConstants';\nimport PKCEConstants from '../constants/PKCEConstants';\nimport OIDCDiscoveryConstantsV2 from '../constants/v2/OIDCDiscoveryConstants';\nimport {AsgardeoAuthException} from '../errors/exception';\nimport {IsomorphicCrypto} from '../IsomorphicCrypto';\nimport {Crypto} from '../models/crypto';\nimport {ExtendedAuthorizeRequestUrlParams} from '../models/oauth-request';\nimport {OIDCDiscoveryApiResponse} from '../models/oidc-discovery';\nimport {OIDCEndpoints} from '../models/oidc-endpoints';\nimport {Platform} from '../models/platforms';\nimport {SessionData, UserSession} from '../models/session';\nimport {Storage, TemporaryStore} from '../models/store';\nimport {TokenResponse, IdToken, TokenExchangeRequestConfig} from '../models/token';\nimport {User} from '../models/user';\nimport StorageManager from '../StorageManager';\nimport deepMerge from '../utils/deepMerge';\nimport extractPkceStorageKeyFromState from '../utils/extractPkceStorageKeyFromState';\nimport generatePkceStorageKey from '../utils/generatePkceStorageKey';\nimport getAuthorizeRequestUrlParams from '../utils/getAuthorizeRequestUrlParams';\nimport processOpenIDScopes from '../utils/processOpenIDScopes';\n\n/**\n * Default configurations.\n */\nconst DefaultConfig: Partial<AuthClientConfig<unknown>> = {\n enablePKCE: true,\n responseMode: 'query',\n sendCookiesInRequests: true,\n tokenValidation: {\n idToken: {\n clockTolerance: 300,\n validate: true,\n validateIssuer: true,\n },\n },\n};\n\n/**\n * This class provides the necessary methods needed to implement authentication.\n */\nexport class AsgardeoAuthClient<T> {\n private storageManager!: StorageManager<T>;\n\n private configProvider: () => Promise<AuthClientConfig>;\n\n private oidcProviderMetaDataProvider: () => Promise<OIDCDiscoveryApiResponse>;\n\n private authHelper: AuthenticationHelper<T>;\n\n private cryptoUtils: Crypto;\n\n private cryptoHelper: IsomorphicCrypto;\n\n private instanceIdValue: number;\n\n // FIXME: Validate this.\n // Ref: https://github.com/asgardeo/asgardeo-auth-js-core/pull/205\n static authHelperInstance: any;\n\n /**\n * This is the constructor method that returns an instance of the .\n *\n * @param store - The store object.\n *\n * @example\n * ```\n * const _store: Store = new DataStore();\n * const auth = new AsgardeoAuthClient<CustomClientConfig>(_store);\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#constructor}\n *\n * @preserve\n */\n public constructor() {\n // intentionally empty\n }\n\n /**\n *\n * This method initializes the SDK with the config data.\n *\n * @param config - The config object to initialize with.\n *\n * @example\n * const config = \\{\n * afterSignInUrl: \"http://localhost:3000/sign-in\",\n * clientId: \"client ID\",\n * baseUrl: \"https://localhost:9443\"\n * \\}\n *\n * await auth.initialize(config);\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#initialize}\n *\n * @preserve\n */\n public async initialize(\n config: AuthClientConfig<T>,\n store: Storage,\n inputCryptoUtils: Crypto,\n instanceID?: number,\n ): Promise<void> {\n const {clientId} = config;\n\n if (!this.instanceIdValue) {\n this.instanceIdValue = 0;\n } else {\n this.instanceIdValue += 1;\n }\n\n if (instanceID !== undefined) {\n this.instanceIdValue = instanceID;\n }\n\n if (!clientId) {\n this.storageManager = new StorageManager<T>(`instance_${this.instanceIdValue}`, store);\n } else {\n this.storageManager = new StorageManager<T>(`instance_${this.instanceIdValue}-${clientId}`, store);\n }\n\n this.cryptoUtils = inputCryptoUtils;\n this.cryptoHelper = new IsomorphicCrypto(inputCryptoUtils);\n this.authHelper = new AuthenticationHelper(this.storageManager, this.cryptoHelper);\n this.configProvider = async (): Promise<AuthClientConfig> => this.storageManager.getConfigData();\n this.oidcProviderMetaDataProvider = async (): Promise<OIDCDiscoveryApiResponse> =>\n this.storageManager.loadOpenIDProviderConfiguration();\n\n // FIXME: Validate this.\n // Ref: https://github.com/asgardeo/asgardeo-auth-js-core/pull/205\n AsgardeoAuthClient.authHelperInstance = this.authHelper;\n\n const {applicationId, platform, endpoints} = config;\n let resolvedApplicationId: string | undefined = applicationId;\n\n if (applicationId) {\n await this.storageManager.setPersistedData({\n applicationId,\n });\n } else {\n const persistedData: TemporaryStore = await this.storageManager.getPersistedData();\n\n if (persistedData['applicationId']) {\n resolvedApplicationId = persistedData['applicationId'] as string;\n }\n }\n\n const resolvedEndpoints: Partial<OIDCEndpoints> = endpoints || {};\n\n if (platform === Platform.AsgardeoV2) {\n if (!resolvedEndpoints['wellKnown']) {\n resolvedEndpoints['wellKnown'] = OIDCDiscoveryConstantsV2.Endpoints.WELL_KNOWN;\n }\n }\n\n await this.storageManager.setConfigData({\n ...DefaultConfig,\n ...config,\n applicationId: resolvedApplicationId,\n endpoints: resolvedEndpoints,\n scope: processOpenIDScopes(config.scopes),\n });\n }\n\n /**\n * This method returns the `StorageManager` object that allows you to access authentication data.\n *\n * @returns - The `StorageManager` object.\n *\n * @example\n * ```\n * const data = auth.getStorageManager();\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getStorageManager}\n *\n * @preserve\n */\n public getStorageManager(): StorageManager<T> {\n return this.storageManager;\n }\n\n /**\n * This method returns the `instanceID` variable of the given instance.\n *\n * @returns - The `instanceID` number.\n *\n * @example\n * ```\n * const instanceId = auth.getInstanceId();\n * ```\n *\n * @preserve\n */\n // eslint-disable-next-line class-methods-use-this\n public getInstanceId(): number {\n return this.instanceIdValue;\n }\n\n /**\n * This is an async method that returns a Promise that resolves with the authorization URL.\n *\n * @param config - (Optional) A config object to force initialization and pass\n * custom path parameters such as the fidp parameter.\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * @returns - A promise that resolves with the authorization URL.\n *\n * @example\n * ```\n * auth.getSignInUrl().then((url)=>{\n * // console.log(url);\n * }).catch((error)=>{\n * // console.error(error);\n * });\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getSignInUrl}\n *\n * @preserve\n */\n public async getSignInUrl(requestConfig?: ExtendedAuthorizeRequestUrlParams, userId?: string): Promise<string> {\n const authRequestConfig: ExtendedAuthorizeRequestUrlParams = {...requestConfig};\n\n delete authRequestConfig?.forceInit;\n\n const buildSignInUrl = async (): Promise<string> => {\n const authorizeEndpoint: string = (await this.storageManager.getOIDCProviderMetaDataParameter(\n OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.AUTHORIZATION as keyof OIDCDiscoveryApiResponse,\n )) as string;\n\n if (!authorizeEndpoint || authorizeEndpoint.trim().length === 0) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-GAU-NF01',\n 'No authorization endpoint found.',\n 'No authorization endpoint was found in the OIDC provider meta data from the well-known endpoint ' +\n 'or the authorization endpoint passed to the SDK is empty.',\n );\n }\n\n const authorizeRequest: URL = new URL(authorizeEndpoint);\n const configData: StrictAuthClientConfig = await this.configProvider();\n const tempStore: TemporaryStore = await this.storageManager.getTemporaryData(userId);\n const pkceKey: string = await generatePkceStorageKey(tempStore);\n\n let codeVerifier: string | undefined;\n let codeChallenge: string | undefined;\n\n if (configData.enablePKCE) {\n codeVerifier = this.cryptoHelper?.getCodeVerifier();\n codeChallenge = await this.cryptoHelper?.getCodeChallenge(codeVerifier);\n await this.storageManager.setTemporaryDataParameter(pkceKey, codeVerifier, userId);\n }\n\n if (authRequestConfig['client_secret']) {\n authRequestConfig['client_secret'] = configData.clientSecret;\n }\n\n const authorizeRequestParams: Map<string, string> = getAuthorizeRequestUrlParams(\n {\n clientId: configData.clientId,\n codeChallenge,\n codeChallengeMethod: PKCEConstants.DEFAULT_CODE_CHALLENGE_METHOD,\n instanceId: this.getInstanceId().toString(),\n prompt: configData.prompt,\n redirectUri: configData.afterSignInUrl,\n responseMode: configData.responseMode,\n scopes: processOpenIDScopes(configData.scopes),\n },\n {key: pkceKey},\n authRequestConfig,\n );\n\n Array.from(authorizeRequestParams.entries()).forEach(([paramKey, paramValue]: [string, string]) => {\n authorizeRequest.searchParams.append(paramKey, paramValue);\n });\n\n return authorizeRequest.toString();\n };\n\n if (\n await this.storageManager.getTemporaryDataParameter(\n OIDCDiscoveryConstants.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,\n )\n ) {\n return buildSignInUrl();\n }\n\n return this.loadOpenIDProviderConfiguration(requestConfig?.forceInit as boolean).then(() => buildSignInUrl());\n }\n\n /**\n * This is an async method that sends a request to obtain the access token and returns a Promise\n * that resolves with the token and other relevant data.\n *\n * @param authorizationCode - The authorization code.\n * @param sessionState - The session state.\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * @returns - A Promise that resolves with the token response.\n *\n * @example\n * ```\n * auth.requestAccessToken(authCode, sessionState).then((token)=>{\n * // console.log(token);\n * }).catch((error)=>{\n * // console.error(error);\n * });\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#requestAccessToken}\n *\n *\n * @preserve\n */\n public async requestAccessToken(\n authorizationCode: string,\n sessionState: string,\n state: string,\n userId?: string,\n tokenRequestConfig?: {\n params: Record<string, unknown>;\n },\n ): Promise<TokenResponse> {\n if (\n !(await this.storageManager.getTemporaryDataParameter(\n OIDCDiscoveryConstants.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,\n ))\n ) {\n await this.loadOpenIDProviderConfiguration(false);\n }\n\n const tokenEndpoint: string | undefined = (await this.oidcProviderMetaDataProvider()).token_endpoint;\n const configData: StrictAuthClientConfig = await this.configProvider();\n\n if (!tokenEndpoint || tokenEndpoint.trim().length === 0) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RAT1-NF01',\n 'Token endpoint not found.',\n 'No token endpoint was found in the OIDC provider meta data returned by the well-known endpoint ' +\n 'or the token endpoint passed to the SDK is empty.',\n );\n }\n\n if (sessionState) {\n await this.storageManager.setSessionDataParameter(\n OIDCRequestConstants.Params.SESSION_STATE as keyof SessionData,\n sessionState,\n userId,\n );\n }\n\n const body: URLSearchParams = new URLSearchParams();\n\n body.set('client_id', configData.clientId);\n\n if (configData.clientSecret && configData.clientSecret.trim().length > 0) {\n body.set('client_secret', configData.clientSecret);\n }\n\n const code: string = authorizationCode;\n\n body.set('code', code);\n\n body.set('grant_type', 'authorization_code');\n body.set('redirect_uri', configData.afterSignInUrl);\n\n if (tokenRequestConfig?.params) {\n Object.entries(tokenRequestConfig.params).forEach(([key, value]: [key: string, value: unknown]) => {\n body.append(key, value as string);\n });\n }\n\n if (configData.enablePKCE) {\n body.set(\n 'code_verifier',\n `${await this.storageManager.getTemporaryDataParameter(extractPkceStorageKeyFromState(state), userId)}`,\n );\n\n await this.storageManager.removeTemporaryDataParameter(extractPkceStorageKeyFromState(state), userId);\n }\n\n let tokenResponse: Response;\n\n try {\n tokenResponse = await fetch(tokenEndpoint, {\n body,\n credentials: configData.sendCookiesInRequests ? 'include' : 'same-origin',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n method: 'POST',\n });\n } catch (error: any) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RAT1-NE02',\n 'Requesting access token failed',\n error ?? 'The request to get the access token from the server failed.',\n );\n }\n\n if (!tokenResponse.ok) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RAT1-HE03',\n `Requesting access token failed with ${tokenResponse.statusText}`,\n (await tokenResponse.json()) as string,\n );\n }\n\n return this.authHelper.handleTokenResponse(tokenResponse, userId);\n }\n\n public async loadOpenIDProviderConfiguration(forceInit: boolean): Promise<void> {\n const configData: StrictAuthClientConfig = await this.configProvider();\n\n if (\n !forceInit &&\n (await this.storageManager.getTemporaryDataParameter(\n OIDCDiscoveryConstants.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,\n ))\n ) {\n return Promise.resolve();\n }\n\n const {wellKnownEndpoint, platform, discovery, baseUrl, endpoints} = configData as any;\n\n const resolvedWellKnownEndpoint: string | undefined =\n wellKnownEndpoint ||\n (platform === Platform.AsgardeoV2 && discovery?.wellKnown?.enabled\n ? `${baseUrl}${endpoints?.wellKnown ?? '/.well-known/openid-configuration'}`\n : undefined);\n\n if (resolvedWellKnownEndpoint) {\n let response: Response;\n\n try {\n response = await fetch(resolvedWellKnownEndpoint);\n if (response.status !== 200 || !response.ok) {\n throw new Error();\n }\n } catch {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-GOPMD-HE01',\n 'Invalid well-known response',\n 'The well known endpoint response has been failed with an error.',\n );\n }\n\n await this.storageManager.setOIDCProviderMetaData(await this.authHelper.resolveEndpoints(await response.json()));\n await this.storageManager.setTemporaryDataParameter(\n OIDCDiscoveryConstants.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,\n true,\n );\n\n return Promise.resolve();\n }\n if ((configData as any).baseUrl) {\n try {\n await this.storageManager.setOIDCProviderMetaData(await this.authHelper.resolveEndpointsByBaseURL());\n } catch (error: any) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-GOPMD-IV02',\n 'Resolving endpoints failed.',\n error ?? 'Resolving endpoints by base url failed.',\n );\n }\n await this.storageManager.setTemporaryDataParameter(\n OIDCDiscoveryConstants.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,\n true,\n );\n\n return Promise.resolve();\n }\n await this.storageManager.setOIDCProviderMetaData(await this.authHelper.resolveEndpointsExplicitly());\n\n await this.storageManager.setTemporaryDataParameter(\n OIDCDiscoveryConstants.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,\n true,\n );\n\n return Promise.resolve();\n }\n\n /**\n * This method returns the sign-out URL.\n *\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * **This doesn't clear the authentication data.**\n *\n * @returns - A Promise that resolves with the sign-out URL.\n *\n * @example\n * ```\n * const signOutUrl = await auth.getSignOutUrl();\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getSignOutUrl}\n *\n * @preserve\n */\n public async getSignOutUrl(userId?: string): Promise<string> {\n const logoutEndpoint: string | undefined = (await this.oidcProviderMetaDataProvider())?.end_session_endpoint;\n const configData: StrictAuthClientConfig = await this.configProvider();\n\n if (!logoutEndpoint || logoutEndpoint.trim().length === 0) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-GSOU-NF01',\n 'Sign-out endpoint not found.',\n 'No sign-out endpoint was found in the OIDC provider meta data returned by the well-known endpoint ' +\n 'or the sign-out endpoint passed to the SDK is empty.',\n );\n }\n\n const callbackURL: string = configData?.afterSignOutUrl ?? configData?.afterSignInUrl;\n\n if (!callbackURL || callbackURL.trim().length === 0) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-GSOU-NF03',\n 'No sign-out redirect URL found.',\n 'The sign-out redirect URL cannot be found or the URL passed to the SDK is empty. ' +\n 'No sign-in redirect URL has been found either. ',\n );\n }\n const queryParams: URLSearchParams = new URLSearchParams();\n\n queryParams.set('post_logout_redirect_uri', callbackURL);\n\n if (configData.sendIdTokenInLogoutRequest) {\n const idToken: string = (await this.storageManager.getSessionData(userId))?.id_token;\n\n if (!idToken || idToken.trim().length === 0) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-GSOU-NF02',\n 'ID token not found.',\n 'No ID token could be found. Either the session information is lost or you have not signed in.',\n );\n }\n queryParams.set('id_token_hint', idToken);\n } else {\n queryParams.set('client_id', configData.clientId);\n }\n\n queryParams.set('state', OIDCRequestConstants.Params.SIGN_OUT_SUCCESS);\n\n return `${logoutEndpoint}?${queryParams.toString()}`;\n }\n\n /**\n * This method returns OIDC service endpoints that are fetched from the `.well-known` endpoint.\n *\n * @returns - A Promise that resolves with an object containing the OIDC service endpoints.\n *\n * @example\n * ```\n * const endpoints = await auth.getOpenIDProviderEndpoints();\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getOpenIDProviderEndpoints}\n *\n * @preserve\n */\n public async getOpenIDProviderEndpoints(): Promise<Partial<OIDCEndpoints>> {\n const oidcProviderMetaData: OIDCDiscoveryApiResponse = await this.oidcProviderMetaDataProvider();\n\n return {\n authorizationEndpoint: oidcProviderMetaData.authorization_endpoint ?? '',\n checkSessionIframe: oidcProviderMetaData.check_session_iframe ?? '',\n endSessionEndpoint: oidcProviderMetaData.end_session_endpoint ?? '',\n introspectionEndpoint: oidcProviderMetaData.introspection_endpoint ?? '',\n issuer: oidcProviderMetaData.issuer ?? '',\n jwksUri: oidcProviderMetaData.jwks_uri ?? '',\n registrationEndpoint: oidcProviderMetaData.registration_endpoint ?? '',\n revocationEndpoint: oidcProviderMetaData.revocation_endpoint ?? '',\n tokenEndpoint: oidcProviderMetaData.token_endpoint ?? '',\n userinfoEndpoint: oidcProviderMetaData.userinfo_endpoint ?? '',\n };\n }\n\n /**\n * This method decodes a given JWT token and returns the payload.\n *\n * @param token - The token to be decoded.\n * @returns - A Promise that resolves with the decoded token payload.\n *\n * @example\n * ```\n * const decodedToken = await auth.decodeJwtToken(token);\n * ```\n */\n public async decodeJwtToken<U = Record<string, unknown>>(token: string): Promise<U> {\n return this.cryptoHelper.decodeJwtToken(token);\n }\n\n /**\n * This method decodes the payload of the ID token and returns it.\n *\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * @returns - A Promise that resolves with the decoded ID token payload.\n *\n * @example\n * ```\n * const decodedIdToken = await auth.getDecodedIdToken();\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getDecodedIdToken}\n *\n * @preserve\n */\n public async getDecodedIdToken(userId?: string, idToken?: string): Promise<IdToken> {\n const storedIdToken: string = (await this.storageManager.getSessionData(userId)).id_token;\n const payload: IdToken = this.cryptoHelper.decodeJwtToken<IdToken>(storedIdToken ?? idToken);\n\n return payload;\n }\n\n /**\n * This method returns the ID token.\n *\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * @returns - A Promise that resolves with the ID token.\n *\n * @example\n * ```\n * const idToken = await auth.getIdToken();\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getIdToken}\n *\n * @preserve\n */\n public async getIdToken(userId?: string): Promise<string> {\n return (await this.storageManager.getSessionData(userId)).id_token;\n }\n\n /**\n * This method returns the basic user information obtained from the ID token.\n *\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * @returns - A Promise that resolves with an object containing the basic user information.\n *\n * @example\n * ```\n * const userInfo = await auth.getUser();\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getUser}\n *\n * @preserve\n */\n public async getUser(userId?: string): Promise<User> {\n const sessionData: SessionData = await this.storageManager.getSessionData(userId);\n const authenticatedUser: User = this.authHelper.getAuthenticatedUserInfo(sessionData?.id_token);\n\n Object.keys(authenticatedUser).forEach((key: string) => {\n if (authenticatedUser[key] === undefined || authenticatedUser[key] === '' || authenticatedUser[key] === null) {\n delete authenticatedUser[key];\n }\n });\n\n return authenticatedUser;\n }\n\n public async getUserSession(userId?: string): Promise<UserSession> {\n const sessionData: SessionData = await this.storageManager.getSessionData(userId);\n\n return {\n scopes: sessionData?.scope?.split(' '),\n sessionState: sessionData?.session_state ?? '',\n };\n }\n\n /**\n * This method returns the crypto helper object.\n *\n * @returns - A Promise that resolves with a IsomorphicCrypto object.\n *\n * @example\n * ```\n * const cryptoHelper = await auth.IsomorphicCrypto();\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getCrypto}\n *\n * @preserve\n */\n public async getCrypto(): Promise<IsomorphicCrypto> {\n return this.cryptoHelper;\n }\n\n /**\n * This method revokes the access token.\n *\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * **This method also clears the authentication data.**\n *\n * @returns - A Promise that returns the response of the revoke-access-token request.\n *\n * @example\n * ```\n * auth.revokeAccessToken().then((response)=>{\n * // console.log(response);\n * }).catch((error)=>{\n * // console.error(error);\n * });\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#revokeAccessToken}\n *\n * @preserve\n */\n public async revokeAccessToken(userId?: string): Promise<Response> {\n const revokeTokenEndpoint: string | undefined = (await this.oidcProviderMetaDataProvider()).revocation_endpoint;\n const configData: StrictAuthClientConfig = await this.configProvider();\n\n if (!revokeTokenEndpoint || revokeTokenEndpoint.trim().length === 0) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RAT3-NF01',\n 'No revoke access token endpoint found.',\n 'No revoke access token endpoint was found in the OIDC provider meta data returned by ' +\n 'the well-known endpoint or the revoke access token endpoint passed to the SDK is empty.',\n );\n }\n\n const body: string[] = [];\n\n body.push(`client_id=${configData.clientId}`);\n body.push(`token=${(await this.storageManager.getSessionData(userId)).access_token}`);\n body.push('token_type_hint=access_token');\n\n if (configData.clientSecret && configData.clientSecret.trim().length > 0) {\n body.push(`client_secret=${configData.clientSecret}`);\n }\n\n let response: Response;\n\n try {\n response = await fetch(revokeTokenEndpoint, {\n body: body.join('&'),\n credentials: configData.sendCookiesInRequests ? 'include' : 'same-origin',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n method: 'POST',\n });\n } catch (error: any) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RAT3-NE02',\n 'The request to revoke access token failed.',\n error ?? 'The request sent to revoke the access token failed.',\n );\n }\n\n if (response.status !== 200 || !response.ok) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RAT3-HE03',\n `Invalid response status received for revoke access token request (${response.statusText}).`,\n (await response.json()) as string,\n );\n }\n\n this.authHelper.clearSession(userId);\n\n return Promise.resolve(response);\n }\n\n /**\n * This method refreshes the access token and returns a Promise that resolves with the new access\n * token and other relevant data.\n *\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * @returns - A Promise that resolves with the token response.\n *\n * @example\n * ```\n * auth.refreshAccessToken().then((response)=>{\n * // console.log(response);\n * }).catch((error)=>{\n * // console.error(error);\n * });\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#refreshAccessToken}\n *\n * @preserve\n */\n public async refreshAccessToken(userId?: string): Promise<TokenResponse> {\n const tokenEndpoint: string | undefined = (await this.oidcProviderMetaDataProvider()).token_endpoint;\n const configData: StrictAuthClientConfig = await this.configProvider();\n const sessionData: SessionData = await this.storageManager.getSessionData(userId);\n\n if (!sessionData.refresh_token) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RAT2-NF01',\n 'No refresh token found.',\n \"There was no refresh token found. Asgardeo doesn't return a \" +\n 'refresh token if the refresh token grant is not enabled.',\n );\n }\n\n if (!tokenEndpoint || tokenEndpoint.trim().length === 0) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RAT2-NF02',\n 'No refresh token endpoint found.',\n 'No refresh token endpoint was in the OIDC provider meta data returned by the well-known ' +\n 'endpoint or the refresh token endpoint passed to the SDK is empty.',\n );\n }\n\n const body: string[] = [];\n\n body.push(`client_id=${configData.clientId}`);\n body.push(`refresh_token=${sessionData.refresh_token}`);\n body.push('grant_type=refresh_token');\n\n if (configData.clientSecret && configData.clientSecret.trim().length > 0) {\n body.push(`client_secret=${configData.clientSecret}`);\n }\n\n let tokenResponse: Response;\n\n try {\n tokenResponse = await fetch(tokenEndpoint, {\n body: body.join('&'),\n credentials: configData.sendCookiesInRequests ? 'include' : 'same-origin',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n method: 'POST',\n });\n } catch (error: any) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RAT2-NR03',\n 'Refresh access token request failed.',\n error ?? 'The request to refresh the access token failed.',\n );\n }\n\n if (!tokenResponse.ok) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RAT2-HE04',\n `Refreshing access token failed with ${tokenResponse.statusText}`,\n (await tokenResponse.json()) as string,\n );\n }\n\n return this.authHelper.handleTokenResponse(tokenResponse, userId);\n }\n\n /**\n * This method returns the access token.\n *\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * @returns - A Promise that resolves with the access token.\n *\n * @example\n * ```\n * const accessToken = await auth.getAccessToken();\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getAccessToken}\n *\n * @preserve\n */\n public async getAccessToken(userId?: string): Promise<string> {\n return (await this.storageManager.getSessionData(userId))?.access_token;\n }\n\n /**\n * This method sends a custom-grant request and returns a Promise that resolves with the response\n * depending on the config passed.\n *\n * @param config - A config object containing the custom grant configurations.\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * @returns - A Promise that resolves with the response depending\n * on your configurations.\n *\n * @example\n * ```\n * const config = {\n * attachToken: false,\n * data: {\n * client_id: \"{{clientId}}\",\n * grant_type: \"account_switch\",\n * scope: \"{{scope}}\",\n * token: \"{{token}}\",\n * },\n * id: \"account-switch\",\n * returnResponse: true,\n * returnsSession: true,\n * signInRequired: true\n * }\n *\n * auth.exchangeToken(config).then((response)=>{\n * // console.log(response);\n * }).catch((error)=>{\n * // console.error(error);\n * });\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#exchangeToken}\n *\n * @preserve\n */\n public async exchangeToken(config: TokenExchangeRequestConfig, userId?: string): Promise<TokenResponse | Response> {\n if (\n !(await this.storageManager.getTemporaryDataParameter(\n OIDCDiscoveryConstants.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,\n ))\n ) {\n await this.loadOpenIDProviderConfiguration(false);\n }\n\n const oidcProviderMetadata: OIDCDiscoveryApiResponse = await this.oidcProviderMetaDataProvider();\n const configData: StrictAuthClientConfig = await this.configProvider();\n\n let tokenEndpoint: string | undefined;\n\n if (config.tokenEndpoint && config.tokenEndpoint.trim().length !== 0) {\n tokenEndpoint = config.tokenEndpoint;\n } else {\n tokenEndpoint = oidcProviderMetadata.token_endpoint;\n }\n\n if (!tokenEndpoint || tokenEndpoint.trim().length === 0) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RCG-NF01',\n 'Token endpoint not found.',\n 'No token endpoint was found in the OIDC provider meta data returned by the well-known endpoint ' +\n 'or the token endpoint passed to the SDK is empty.',\n );\n }\n\n const data: string[] = await Promise.all(\n Object.entries(config.data).map(async ([key, value]: [key: string, value: any]) => {\n const newValue: string = await this.authHelper.replaceCustomGrantTemplateTags(value as string, userId);\n\n return `${key}=${newValue}`;\n }),\n );\n\n let requestHeaders: Record<string, any> = {\n Accept: 'application/json',\n 'Content-Type': 'application/x-www-form-urlencoded',\n };\n\n if (config.attachToken) {\n requestHeaders = {\n ...requestHeaders,\n Authorization: `Bearer ${(await this.storageManager.getSessionData(userId)).access_token}`,\n };\n }\n\n const requestConfig: RequestInit = {\n body: data.join('&'),\n credentials: configData.sendCookiesInRequests ? 'include' : 'same-origin',\n headers: new Headers(requestHeaders),\n method: 'POST',\n };\n\n let response: Response;\n\n try {\n response = await fetch(tokenEndpoint, requestConfig);\n } catch (error: any) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RCG-NE02',\n 'The custom grant request failed.',\n error ?? 'The request sent to get the custom grant failed.',\n );\n }\n\n if (response.status !== 200 || !response.ok) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RCG-HE03',\n `Invalid response status received for the custom grant request. (${response.statusText})`,\n (await response.json()) as string,\n );\n }\n\n if (config.returnsSession) {\n return this.authHelper.handleTokenResponse(response, userId);\n }\n return Promise.resolve((await response.json()) as TokenResponse | Response);\n }\n\n /**\n * This method returns if the user is authenticated or not.\n *\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * @returns - A Promise that resolves with `true` if the user is authenticated, `false` otherwise.\n *\n * @example\n * ```\n * await auth.isSignedIn();\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#isSignedIn}\n *\n * @preserve\n */\n public async isSignedIn(userId?: string): Promise<boolean> {\n const isAccessTokenAvailable: boolean = Boolean(await this.getAccessToken(userId));\n\n // Check if the access token is expired.\n const createdAt: number = (await this.storageManager.getSessionData(userId))?.created_at;\n\n // Get the expires in value.\n const expiresInString: string = (await this.storageManager.getSessionData(userId))?.expires_in;\n\n // If the expires in value is not available, the token is invalid and the user is not authenticated.\n if (!expiresInString) {\n return false;\n }\n\n // Convert to milliseconds.\n const expiresIn: number = parseInt(expiresInString, 10) * 1000;\n const currentTime: number = new Date().getTime();\n const isAccessTokenValid: boolean = createdAt + expiresIn > currentTime;\n\n const isSignedIn: boolean = isAccessTokenAvailable && isAccessTokenValid;\n\n return isSignedIn;\n }\n\n /**\n * This method returns the PKCE code generated during the generation of the authentication URL.\n *\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n * @param state - The state parameter that was passed in the authentication URL.\n *\n * @returns - A Promise that resolves with the PKCE code.\n *\n * @example\n * ```\n * const pkce = await getPKCECode();\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getPKCECode}\n *\n * @preserve\n */\n public async getPKCECode(state: string, userId?: string): Promise<string> {\n return (await this.storageManager.getTemporaryDataParameter(\n extractPkceStorageKeyFromState(state),\n userId,\n )) as string;\n }\n\n /**\n * This method sets the PKCE code to the data store.\n *\n * @param pkce - The PKCE code.\n * @param state - The state parameter that was passed in the authentication URL.\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * @example\n * ```\n * await auth.setPKCECode(\"pkce_code\")\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#setPKCECode}\n *\n * @preserve\n */\n public async setPKCECode(pkce: string, state: string, userId?: string): Promise<void> {\n return this.storageManager.setTemporaryDataParameter(extractPkceStorageKeyFromState(state), pkce, userId);\n }\n\n /**\n * This method returns if the sign-out is successful or not.\n *\n * @param signOutRedirectUrl - The URL to which the user has been redirected to after signing-out.\n *\n * **The server appends path parameters to the `afterSignOutUrl` and these path parameters\n * are required for this method to function.**\n *\n * @returns - `true` if successful, `false` otherwise.\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#isSignOutSuccessful}\n *\n * @preserve\n */\n public static isSignOutSuccessful(afterSignOutUrl: string): boolean {\n const url: URL = new URL(afterSignOutUrl);\n const stateParam: string | null = url.searchParams.get(OIDCRequestConstants.Params.STATE);\n const error: boolean = Boolean(url.searchParams.get('error'));\n\n return stateParam ? stateParam === OIDCRequestConstants.Params.SIGN_OUT_SUCCESS && !error : false;\n }\n\n /**\n * This method returns if the sign-out has failed or not.\n *\n * @param signOutRedirectUrl - The URL to which the user has been redirected to after signing-out.\n *\n * **The server appends path parameters to the `afterSignOutUrl` and these path parameters\n * are required for this method to function.**\n *\n * @returns - `true` if successful, `false` otherwise.\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#didSignOutFail}\n *\n * @preserve\n */\n public static didSignOutFail(afterSignOutUrl: string): boolean {\n const url: URL = new URL(afterSignOutUrl);\n const stateParam: string | null = url.searchParams.get(OIDCRequestConstants.Params.STATE);\n const error: boolean = Boolean(url.searchParams.get('error'));\n\n return stateParam ? stateParam === OIDCRequestConstants.Params.SIGN_OUT_SUCCESS && error : false;\n }\n\n /**\n * This method updates the configuration that was passed into the constructor when instantiating this class.\n *\n * @param config - A config object to update the SDK configurations with.\n *\n * @example\n * ```\n * const config = {\n * afterSignInUrl: \"http://localhost:3000/sign-in\",\n * clientId: \"client ID\",\n * baseUrl: \"https://localhost:9443\"\n * }\n *\n * await auth.reInitialize(config);\n * ```\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#reInitialize}\n *\n * @preserve\n */\n public async reInitialize(config: Partial<AuthClientConfig<T>>): Promise<void> {\n const currentConfig: AuthClientConfig<T> = this.storageManager.getConfigData() as unknown as AuthClientConfig<T>;\n const newConfig: AuthClientConfig<T> = deepMerge(currentConfig, config);\n\n await this.storageManager.setConfigData(newConfig);\n await this.loadOpenIDProviderConfiguration(true);\n }\n\n public static async clearSession(userId?: string): Promise<void> {\n await this.authHelperInstance.clearSession(userId);\n }\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoError from './AsgardeoError';\n\n/**\n * Base class for all API-related errors in Asgardeo. This class extends AsgardeoError\n * and adds support for HTTP status codes and status text.\n *\n * @example\n * ```typescript\n * throw new AsgardeoAPIError(\n * \"Failed to fetch user data\",\n * \"API_FETCH_ERROR\",\n * 404,\n * \"Not Found\"\n * );\n * ```\n */\nexport default class AsgardeoAPIError extends AsgardeoError {\n /**\n * Creates an instance of AsgardeoAPIError.\n *\n * @param message - Human-readable description of the error\n * @param code - A unique error code that identifies the error type\n * @param statusCode - HTTP status code of the failed request\n * @param statusText - HTTP status text of the failed request\n * @param origin - Optional. The SDK origin (e.g. 'react', 'vue'). Defaults to generic 'Asgardeo'\n * @constructor\n */\n constructor(\n message: string,\n code: string,\n origin: string,\n public readonly statusCode?: number,\n public readonly statusText?: string,\n ) {\n super(message, code, origin);\n\n Object.defineProperty(this, 'name', {\n configurable: true,\n value: 'AsgardeoAPIError',\n writable: true,\n });\n }\n\n /**\n * Returns a string representation of the API error\n * @returns Formatted error string with name, code, status, and message\n */\n public override toString(): string {\n const status: string = this.statusCode ? ` (HTTP ${this.statusCode} - ${this.statusText})` : '';\n return `[${this.name}] (code=\"${this.code}\")${status}\\nMessage: ${this.message}`;\n }\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {EmbeddedFlowExecuteRequestConfig} from '../models/embedded-flow';\nimport {EmbeddedSignInFlowInitiateResponse} from '../models/embedded-signin-flow';\n\n/**\n * Sends an authorization request to the specified OAuth2/OIDC authorization endpoint.\n *\n * @param requestConfig - Request configuration object containing URL and payload.\n * @returns A promise that resolves with the authorization response.\n * @throws AsgardeoAPIError when the request fails or URL is invalid.\n *\n * @example\n * ```typescript\n * try {\n * const authResponse = await initializeEmbeddedSignInFlow({\n * url: \"https://api.asgardeo.io/t/<ORGANIZATION>/oauth2/authorize\",\n * payload: {\n * response_type: \"code\",\n * client_id: \"your-client-id\",\n * redirect_uri: \"https://your-app.com/callback\",\n * scope: \"openid profile email\",\n * state: \"random-state-value\",\n * code_challenge: \"your-pkce-challenge\",\n * code_challenge_method: \"S256\"\n * }\n * });\n * console.log(authResponse);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Authorization failed:', error.message);\n * }\n * }\n * ```\n */\nconst initializeEmbeddedSignInFlow = async ({\n url,\n baseUrl,\n payload,\n ...requestConfig\n}: EmbeddedFlowExecuteRequestConfig): Promise<EmbeddedSignInFlowInitiateResponse> => {\n try {\n // eslint-disable-next-line no-new\n new URL(url ?? baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid URL provided. ${error?.toString()}`,\n 'getSchemas-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `url` or `baseUrl` path does not adhere to the URL schema.',\n );\n }\n\n if (!payload) {\n throw new AsgardeoAPIError(\n 'Authorization payload is required',\n 'initializeEmbeddedSignInFlow-ValidationError-002',\n 'javascript',\n 400,\n 'If an authorization payload is not provided, the request cannot be constructed correctly.',\n );\n }\n\n const searchParams: URLSearchParams = new URLSearchParams();\n Object.entries(payload).forEach(([key, value]: [string, unknown]) => {\n if (value !== undefined && value !== null) {\n searchParams.append(key, String(value));\n }\n });\n\n try {\n const response: Response = await fetch(url ?? `${baseUrl}/oauth2/authorize`, {\n ...requestConfig,\n body: searchParams.toString(),\n headers: {\n ...requestConfig.headers,\n Accept: 'application/json',\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n method: requestConfig.method || 'POST',\n });\n\n if (!response.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n `Authorization request failed: ${errorText}`,\n 'initializeEmbeddedSignInFlow-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n );\n }\n\n return (await response.json()) as EmbeddedSignInFlowInitiateResponse;\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'initializeEmbeddedSignInFlow-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default initializeEmbeddedSignInFlow;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {EmbeddedFlowExecuteRequestConfig} from '../models/embedded-flow';\nimport {EmbeddedSignInFlowHandleResponse} from '../models/embedded-signin-flow';\n\nconst executeEmbeddedSignInFlow = async ({\n url,\n baseUrl,\n payload,\n ...requestConfig\n}: EmbeddedFlowExecuteRequestConfig): Promise<EmbeddedSignInFlowHandleResponse> => {\n try {\n // eslint-disable-next-line no-new\n new URL(url ?? baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid URL provided. ${error?.toString()}`,\n 'executeEmbeddedSignInFlow-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `url` or `baseUrl` path does not adhere to the URL schema.',\n );\n }\n\n if (!payload) {\n throw new AsgardeoAPIError(\n 'Authorization payload is required',\n 'executeEmbeddedSignInFlow-ValidationError-002',\n 'javascript',\n 400,\n 'If an authorization payload is not provided, the request cannot be constructed correctly.',\n );\n }\n\n try {\n const response: Response = await fetch(url ?? `${baseUrl}/oauth2/authn`, {\n ...requestConfig,\n body: JSON.stringify(payload),\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: requestConfig.method || 'POST',\n });\n\n if (!response.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n `Authorization request failed: ${errorText}`,\n 'initializeEmbeddedSignInFlow-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n );\n }\n\n return (await response.json()) as EmbeddedSignInFlowHandleResponse;\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'executeEmbeddedSignInFlow-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default executeEmbeddedSignInFlow;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport enum EmbeddedFlowType {\n Authentication = 'AUTHENTICATION',\n Registration = 'REGISTRATION',\n UserOnboarding = 'USER_ONBOARDING',\n}\n\nexport interface EmbeddedFlowExecuteRequestPayload {\n actionId?: string;\n flowType: EmbeddedFlowType;\n inputs?: Record<string, any>;\n}\n\nexport interface EmbeddedFlowExecuteResponse {\n data: EmbeddedSignUpFlowData;\n flowId: string;\n flowStatus: EmbeddedFlowStatus;\n type: EmbeddedFlowResponseType;\n}\n\nexport enum EmbeddedFlowStatus {\n Complete = 'COMPLETE',\n Incomplete = 'INCOMPLETE',\n}\n\nexport enum EmbeddedFlowResponseType {\n Redirection = 'REDIRECTION',\n View = 'VIEW',\n}\n\nexport interface EmbeddedSignUpFlowData {\n additionalData?: Record<string, any>;\n components?: EmbeddedFlowComponent[];\n redirectURL?: string;\n}\n\nexport interface EmbeddedFlowComponent {\n components: EmbeddedFlowComponent[];\n config: Record<string, unknown>;\n id: string;\n type: EmbeddedFlowComponentType | string;\n variant?: string;\n}\n\nexport enum EmbeddedFlowComponentType {\n Button = 'BUTTON',\n Checkbox = 'CHECKBOX',\n Divider = 'DIVIDER',\n Form = 'FORM',\n Image = 'IMAGE',\n Input = 'INPUT',\n Radio = 'RADIO',\n Select = 'SELECT',\n Typography = 'TYPOGRAPHY',\n}\n\n/**\n * Request configuration for executing embedded flow operations.\n *\n * This interface extends standard HTTP request configuration with additional\n * properties specific to embedded flow execution, such as base URL and payload data.\n *\n * @template T - Type of the payload data being sent with the request\n */\nexport interface EmbeddedFlowExecuteRequestConfig<T = any> extends Partial<Request> {\n /**\n * Base URL for the API endpoint.\n * This is typically the Asgardeo organization URL.\n */\n baseUrl?: string;\n\n /**\n * Payload data to be sent with the request.\n * The structure depends on the specific flow operation being executed.\n */\n payload?: T;\n\n /**\n * Full URL for the API endpoint.\n * If provided, this overrides the baseUrl.\n */\n url?: string;\n}\n\n/**\n * Error response structure for AsgardeoV1 embedded flow operations.\n *\n * This interface defines the structure of error responses returned by AsgardeoV1 APIs\n * when flow operations (such as sign-up or sign-in) fail. This format is distinct from\n * AsgardeoV2's error format which uses `failureReason` instead of `code`/`description`.\n *\n * **Key Characteristics:**\n * - Uses structured error codes (e.g., \"FEE-60005\") for programmatic error handling\n * - Provides both a brief `message` and detailed `description` for context\n * - Includes `flowType` to identify which flow operation failed\n *\n * **Comparison with AsgardeoV2:**\n * - **AsgardeoV1**: Uses `code`, `message`, `description` fields\n * - **AsgardeoV2**: Uses `flowStatus: \"ERROR\"` with `failureReason` field\n *\n * **Error Handling:**\n * This error response format is automatically detected and processed by the\n * `extractErrorMessage()` and `checkForErrorResponse()` functions in the React\n * transformer to extract meaningful error messages for display to users.\n *\n * @example\n * ```typescript\n * // Typical AsgardeoV1 error response\n * const errorResponse: EmbeddedFlowExecuteErrorResponse = {\n * code: \"FEE-60005\",\n * message: \"Error while provisioning user.\",\n * description: \"Error occurred while provisioning user in the request of flow id: ac57315c-6ca6-49dc-8664-fcdcff354f46\",\n * flowType: \"REGISTRATION\"\n * };\n *\n * // The transformer will extract: \"Error occurred while provisioning user in the request of flow id: ac57315c-6ca6-49dc-8664-fcdcff354f46\"\n * // (Prefers description over message as it's usually more detailed)\n * ```\n *\n * @see {@link EmbeddedSignUpFlowErrorResponse} for the AsgardeoV2 equivalent error structure\n */\nexport interface EmbeddedFlowExecuteErrorResponse {\n /**\n * Structured error code identifying the type of error.\n *\n * Format typically follows pattern like \"FEE-XXXXX\" where:\n * - \"FEE\" indicates Flow Execution Error\n * - XXXXX is a numeric identifier for the specific error type\n *\n * @example \"FEE-60005\" - User provisioning error\n */\n code: string;\n\n /**\n * Detailed error description with contextual information.\n *\n * This field usually contains more specific information about the error,\n * including flow IDs, operation details, and other debugging context.\n * The transformer prefers this field over `message` when extracting\n * error messages for display to users.\n *\n * @example \"Error occurred while provisioning user in the request of flow id: ac57315c-6ca6-49dc-8664-fcdcff354f46\"\n */\n description: string;\n\n /**\n * Type of flow operation that encountered the error.\n *\n * Currently only supports 'REGISTRATION' but may be extended to\n * include other flow types (e.g., 'LOGIN', 'PASSWORD_RESET') in the future.\n */\n flowType: 'REGISTRATION';\n\n /**\n * Brief error message describing what went wrong.\n *\n * This is typically a short, high-level description of the error.\n * For more detailed information, refer to the `description` field.\n *\n * @example \"Error while provisioning user.\"\n */\n message: string;\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {EmbeddedFlowType, EmbeddedFlowExecuteResponse, EmbeddedFlowExecuteRequestConfig} from '../models/embedded-flow';\n\n/**\n * Executes an embedded signup flow by sending a request to the specified flow execution endpoint.\n *\n * @param requestConfig - Request configuration object containing URL and payload.\n * @returns A promise that resolves with the flow execution response.\n * @throws AsgardeoAPIError when the request fails or URL is invalid.\n *\n * @example\n * ```typescript\n * try {\n * const embeddedSignUpResponse = await executeEmbeddedSignUpFlow({\n * url: \"https://api.asgardeo.io/t/<ORGANIZATION>/api/server/v1/flow/execute\",\n * payload: {\n * flowType: \"REGISTRATION\"\n * }\n * });\n * console.log(embeddedSignUpResponse);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Embedded SignUp flow execution failed:', error.message);\n * }\n * }\n * ```\n */\nconst executeEmbeddedSignUpFlow = async ({\n url,\n baseUrl,\n payload,\n ...requestConfig\n}: EmbeddedFlowExecuteRequestConfig): Promise<EmbeddedFlowExecuteResponse> => {\n if (!baseUrl && !url) {\n throw new AsgardeoAPIError(\n 'Embedded SignUp flow execution failed: Base URL or URL is not provided.',\n 'javascript-executeEmbeddedSignUpFlow-ValidationError-001',\n 'javascript',\n 400,\n 'At least one of the baseUrl or url must be provided to execute the embedded sign up flow.',\n );\n }\n\n try {\n // eslint-disable-next-line no-new\n new URL(url ?? baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid URL provided. ${error?.toString()}`,\n 'executeEmbeddedSignUpFlow-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `url` or `baseUrl` path does not adhere to the URL schema.',\n );\n }\n\n try {\n const response: Response = await fetch(url ?? `${baseUrl}/api/server/v1/flow/execute`, {\n ...requestConfig,\n body: JSON.stringify({\n ...(payload ?? {}),\n flowType: EmbeddedFlowType.Registration,\n }),\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: requestConfig.method || 'POST',\n });\n\n if (!response.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n `Embedded SignUp flow execution failed: ${errorText}`,\n 'javascript-executeEmbeddedSignUpFlow-ResponseError-100',\n 'javascript',\n response.status,\n response.statusText,\n );\n }\n\n return (await response.json()) as EmbeddedFlowExecuteResponse;\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'executeEmbeddedSignUpFlow-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default executeEmbeddedSignUpFlow;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {User} from '../models/user';\n\n/**\n * Retrieves the user information from the specified OIDC userinfo endpoint.\n *\n * @param requestConfig - Request configuration object.\n * @returns A promise that resolves with the user information.\n * @throw\n * const userInfo = await getUserInfo({\n * url: \"https://api.asgardeo.io/t/<ORGANIZATION>/oauth2/userinfo\",\n * });\n * console.log(userInfo);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get user info:', error.message);\n * }\n * }\n * ```\n */\nconst getUserInfo = async ({url, ...requestConfig}: Partial<Request>): Promise<User> => {\n try {\n // eslint-disable-next-line no-new\n new URL(url);\n } catch (error) {\n throw new AsgardeoAPIError(\n 'Invalid endpoint URL provided',\n 'getUserInfo-ValidationError-001',\n 'javascript',\n 400,\n 'Invalid Request',\n );\n }\n\n try {\n const response: Response = await fetch(url, {\n ...requestConfig,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: 'GET',\n });\n\n if (!response.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n `Failed to fetch user info: ${errorText}`,\n 'getUserInfo-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n );\n }\n\n return (await response.json()) as User;\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'getUserInfo-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default getUserInfo;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Regular expression to match userstore prefixes in usernames.\n * Matches patterns like \"DEFAULT/\", \"ASGARDEO_USER/\", \"PRIMARY/\", etc.\n * The pattern matches any uppercase letters, numbers, and underscores followed by a forward slash.\n */\nconst USERSTORE_PREFIX_REGEX: RegExp = /^[A-Z_][A-Z0-9_]*\\//;\n\n/**\n * Removes userstore prefixes from a username if they exist.\n * This is commonly used to clean usernames returned from SCIM2 endpoints\n * that include userstore prefixes like \"DEFAULT/\", \"ASGARDEO_USER/\", \"PRIMARY/\", etc.\n *\n * @param username - The username string to process\n * @returns The username without the userstore prefix, or the original username if no prefix exists\n *\n * @example\n * ```typescript\n * const cleanUsername = removeUserstorePrefix(\"DEFAULT/john.doe\");\n * console.log(cleanUsername); // \"john.doe\"\n *\n * const asgardeoUser = removeUserstorePrefix(\"ASGARDEO_USER/jane.doe\");\n * console.log(asgardeoUser); // \"jane.doe\"\n *\n * const primaryUser = removeUserstorePrefix(\"PRIMARY/admin\");\n * console.log(primaryUser); // \"admin\"\n *\n * const alreadyClean = removeUserstorePrefix(\"user.name\");\n * console.log(alreadyClean); // \"user.name\"\n *\n * const emptyInput = removeUserstorePrefix(\"\");\n * console.log(emptyInput); // \"\"\n * ```\n */\nexport const removeUserstorePrefix = (username?: string): string => {\n if (!username) {\n return '';\n }\n\n return username.replace(USERSTORE_PREFIX_REGEX, '');\n};\n\n/**\n * Processes a user object to remove userstore prefixes from username fields.\n * This is a helper function for processing user objects returned from SCIM2 endpoints.\n * Handles various username field variations: username, userName, and user_name.\n *\n * @param user - The user object to process\n * @returns The user object with processed username fields\n *\n * @example\n * ```typescript\n * const user = { username: \"DEFAULT/john.doe\", email: \"john@example.com\" };\n * const processedUser = processUserUsername(user);\n * console.log(processedUser.username); // \"john.doe\"\n *\n * const camelCaseUser = { userName: \"ASGARDEO_USER/jane.doe\", email: \"jane@example.com\" };\n * const processedCamelCaseUser = processUserUsername(camelCaseUser);\n * console.log(processedCamelCaseUser.userName); // \"jane.doe\"\n *\n * const snakeCaseUser = { user_name: \"PRIMARY/admin\", email: \"admin@example.com\" };\n * const processedSnakeCaseUser = processUserUsername(snakeCaseUser);\n * console.log(processedSnakeCaseUser.user_name); // \"admin\"\n * ```\n */\nconst processUsername = <T extends {userName?: string; user_name?: string; username?: string}>(user: T): T => {\n if (!user) {\n return user;\n }\n\n const processedUser: T = {...user};\n\n // Process username field\n if (processedUser.username) {\n processedUser.username = removeUserstorePrefix(processedUser.username);\n }\n\n // Process userName field\n if (processedUser.userName) {\n processedUser.userName = removeUserstorePrefix(processedUser.userName);\n }\n\n // Process user_name field\n if (processedUser.user_name) {\n processedUser.user_name = removeUserstorePrefix(processedUser.user_name);\n }\n\n return processedUser;\n};\n\nexport default processUsername;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {User} from '../models/user';\nimport processUserUsername from '../utils/processUsername';\n\n/**\n * Configuration for the getScim2Me request\n */\nexport interface GetScim2MeConfig extends Omit<RequestInit, 'method'> {\n /**\n * The base path of the API endpoint.\n */\n baseUrl?: string;\n /**\n * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * The absolute API endpoint.\n */\n url?: string;\n}\n\n/**\n * Retrieves the user profile information from the specified SCIM2 /Me endpoint.\n *\n * @param config - Request configuration object.\n * @returns A promise that resolves with the user profile information.\n * @example\n * ```typescript\n * // Using default fetch\n * try {\n * const userProfile = await getScim2Me({\n * url: \"https://api.asgardeo.io/t/<ORGANIZATION>/scim2/Me\",\n * });\n * console.log(userProfile);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get user profile:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher (e.g., axios-based httpClient)\n * try {\n * const userProfile = await getScim2Me({\n * url: \"https://api.asgardeo.io/t/<ORGANIZATION>/scim2/Me\",\n * fetcher: async (url, config) => {\n * const response = await httpClient({\n * url,\n * method: config.method,\n * headers: config.headers,\n * ...config\n * });\n * // Convert axios-like response to fetch-like Response\n * return {\n * ok: response.status >= 200 && response.status < 300,\n * status: response.status,\n * statusText: response.statusText,\n * json: () => Promise.resolve(response.data),\n * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))\n * } as Response;\n * }\n * });\n * console.log(userProfile);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get user profile:', error.message);\n * }\n * }\n * ```\n */\nconst getScim2Me = async ({url, baseUrl, fetcher, ...requestConfig}: GetScim2MeConfig): Promise<User> => {\n try {\n // eslint-disable-next-line no-new\n new URL(url ?? baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid URL provided. ${error?.toString()}`,\n 'getScim2Me-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `url` or `baseUrl` path does not adhere to the URL schema.',\n );\n }\n\n const fetchFn: typeof fetch = fetcher || fetch;\n const resolvedUrl: string = url ?? `${baseUrl}/scim2/Me`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/scim+json',\n ...requestConfig.headers,\n },\n method: 'GET',\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n `Failed to fetch user profile: ${errorText}`,\n 'getScim2Me-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n );\n }\n\n const user: User = (await response.json()) as User;\n\n return processUserUsername(user);\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'getScim2Me-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default getScim2Me;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {Schema} from '../models/scim2-schema';\n\n/**\n * Configuration for the getSchemas request\n */\nexport interface GetSchemasConfig extends Omit<RequestInit, 'method'> {\n /**\n * The base path of the API endpoint.\n */\n baseUrl?: string;\n /**\n * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * The absolute API endpoint.\n */\n url?: string;\n}\n\n/**\n * Retrieves the SCIM2 schemas from the specified endpoint.\n *\n * @param config - Request configuration object.\n * @returns A promise that resolves with the SCIM2 schemas information.\n * @example\n * ```typescript\n * // Using default fetch\n * try {\n * const schemas = await getSchemas({\n * url: \"https://api.asgardeo.io/t/<ORGANIZATION>/scim2/Schemas\",\n * });\n * console.log(schemas);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get schemas:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher (e.g., axios-based httpClient)\n * try {\n * const schemas = await getSchemas({\n * url: \"https://api.asgardeo.io/t/<ORGANIZATION>/scim2/Schemas\",\n * fetcher: async (url, config) => {\n * const response = await httpClient({\n * url,\n * method: config.method,\n * headers: config.headers,\n * ...config\n * });\n * // Convert axios-like response to fetch-like Response\n * return {\n * ok: response.status >= 200 && response.status < 300,\n * status: response.status,\n * statusText: response.statusText,\n * json: () => Promise.resolve(response.data),\n * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))\n * } as Response;\n * }\n * });\n * console.log(schemas);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get schemas:', error.message);\n * }\n * }\n * ```\n */\nconst getSchemas = async ({url, baseUrl, fetcher, ...requestConfig}: GetSchemasConfig): Promise<Schema[]> => {\n try {\n // eslint-disable-next-line no-new\n new URL(url ?? baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid URL provided. ${error?.toString()}`,\n 'getSchemas-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `url` or `baseUrl` path does not adhere to the URL schema.',\n );\n }\n\n const fetchFn: typeof fetch = fetcher || fetch;\n const resolvedUrl: string = url ?? `${baseUrl}/scim2/Schemas`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: 'GET',\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n `Failed to fetch SCIM2 schemas: ${errorText}`,\n 'getSchemas-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n );\n }\n\n return (await response.json()) as Schema[];\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'getSchemas-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default getSchemas;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {AllOrganizationsApiResponse} from '../models/organization';\n\n/**\n * Configuration for the getAllOrganizations request\n */\nexport interface GetAllOrganizationsConfig extends Omit<RequestInit, 'method'> {\n /**\n * The base URL for the API endpoint.\n */\n baseUrl: string;\n /**\n * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Filter expression for organizations\n */\n filter?: string;\n /**\n * Maximum number of organizations to return\n */\n limit?: number;\n /**\n * Whether to include child organizations recursively\n */\n recursive?: boolean;\n}\n\n/**\n * Retrieves all organizations with pagination support.\n *\n * @param config - Configuration object containing baseUrl, optional query parameters, and request config.\n * @returns A promise that resolves with the paginated organizations information.\n * @example\n * ```typescript\n * // Using default fetch\n * try {\n * const response = await getAllOrganizations({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * filter: \"\",\n * limit: 10,\n * recursive: false\n * });\n * console.log(response.organizations);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get organizations:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher (e.g., axios-based httpClient)\n * try {\n * const response = await getAllOrganizations({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * filter: \"\",\n * limit: 10,\n * recursive: false,\n * fetcher: async (url, config) => {\n * const response = await httpClient({\n * url,\n * method: config.method,\n * headers: config.headers,\n * ...config\n * });\n * // Convert axios-like response to fetch-like Response\n * return {\n * ok: response.status >= 200 && response.status < 300,\n * status: response.status,\n * statusText: response.statusText,\n * json: () => Promise.resolve(response.data),\n * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))\n * } as Response;\n * }\n * });\n * console.log(response.organizations);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get organizations:', error.message);\n * }\n * }\n * ```\n */\nconst getAllOrganizations = async ({\n baseUrl,\n filter = '',\n limit = 10,\n recursive = false,\n fetcher,\n ...requestConfig\n}: GetAllOrganizationsConfig): Promise<AllOrganizationsApiResponse> => {\n try {\n // eslint-disable-next-line no-new\n new URL(baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid base URL provided. ${error?.toString()}`,\n 'getAllOrganizations-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `baseUrl` does not adhere to the URL schema.',\n );\n }\n\n const queryParams: URLSearchParams = new URLSearchParams(\n Object.fromEntries(\n Object.entries({\n filter,\n limit: limit.toString(),\n recursive: recursive.toString(),\n }).filter(([, value]: [string, string]) => Boolean(value)),\n ),\n );\n\n const fetchFn: typeof fetch = fetcher || fetch;\n const resolvedUrl: string = `${baseUrl}/api/server/v1/organizations?${queryParams.toString()}`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n headers: {\n ...requestConfig.headers,\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n method: 'GET',\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n `Failed to get organizations: ${errorText}`,\n 'getAllOrganizations-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n );\n }\n\n const data: AllOrganizationsApiResponse = (await response.json()) as any;\n\n return {\n hasMore: data.hasMore,\n nextCursor: data.nextCursor,\n organizations: data.organizations || [],\n totalCount: data.totalCount,\n };\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'getAllOrganizations-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default getAllOrganizations;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {Organization} from '../models/organization';\n\n/**\n * Interface for organization creation payload.\n */\nexport interface CreateOrganizationPayload {\n /**\n * Organization description.\n */\n description: string;\n /**\n * Organization name.\n */\n name: string;\n /**\n * Organization handle/slug.\n */\n orgHandle?: string;\n /**\n * Parent organization ID.\n */\n parentId: string;\n /**\n * Organization type.\n */\n type: 'TENANT';\n}\n\n/**\n * Configuration for the createOrganization request\n */\nexport interface CreateOrganizationConfig extends Omit<RequestInit, 'method' | 'body'> {\n /**\n * The base URL for the API endpoint.\n */\n baseUrl: string;\n /**\n * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Organization creation payload\n */\n payload: CreateOrganizationPayload;\n}\n\n/**\n * Creates a new organization.\n *\n * @param config - Configuration object containing baseUrl, payload and optional request config.\n * @returns A promise that resolves with the created organization information.\n * @example\n * ```typescript\n * // Using default fetch\n * try {\n * const organization = await createOrganization({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * payload: {\n * description: \"Share your screens\",\n * name: \"Team Viewer\",\n * orgHandle: \"team-viewer\",\n * parentId: \"f4825104-4948-40d9-ab65-a960eee3e3d5\",\n * type: \"TENANT\"\n * }\n * });\n * console.log(organization);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to create organization:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher (e.g., axios-based httpClient)\n * try {\n * const organization = await createOrganization({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * payload: {\n * description: \"Share your screens\",\n * name: \"Team Viewer\",\n * orgHandle: \"team-viewer\",\n * parentId: \"f4825104-4948-40d9-ab65-a960eee3e3d5\",\n * type: \"TENANT\"\n * },\n * fetcher: async (url, config) => {\n * const response = await httpClient({\n * url,\n * method: config.method,\n * headers: config.headers,\n * data: config.body,\n * ...config\n * });\n * // Convert axios-like response to fetch-like Response\n * return {\n * ok: response.status >= 200 && response.status < 300,\n * status: response.status,\n * statusText: response.statusText,\n * json: () => Promise.resolve(response.data),\n * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))\n * } as Response;\n * }\n * });\n * console.log(organization);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to create organization:', error.message);\n * }\n * }\n * ```\n */\nconst createOrganization = async ({\n baseUrl,\n payload,\n fetcher,\n ...requestConfig\n}: CreateOrganizationConfig): Promise<Organization> => {\n try {\n // eslint-disable-next-line no-new\n new URL(baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid base URL provided. ${error?.toString()}`,\n 'createOrganization-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `baseUrl` does not adhere to the URL schema.',\n );\n }\n\n if (!payload) {\n throw new AsgardeoAPIError(\n 'Organization payload is required',\n 'createOrganization-ValidationError-002',\n 'javascript',\n 400,\n 'Invalid Request',\n );\n }\n\n // Always set type to TENANT for now\n const organizationPayload: CreateOrganizationPayload = {\n ...payload,\n type: 'TENANT' as const,\n };\n\n const fetchFn: typeof fetch = fetcher || fetch;\n const resolvedUrl: string = `${baseUrl}/api/server/v1/organizations`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n body: JSON.stringify(organizationPayload),\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: 'POST',\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n `Failed to create organization: ${errorText}`,\n 'createOrganization-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n );\n }\n\n return (await response.json()) as Organization;\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'createOrganization-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default createOrganization;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {Organization} from '../models/organization';\n\n/**\n * Configuration for the getMeOrganizations request\n */\nexport interface GetMeOrganizationsConfig extends Omit<RequestInit, 'method'> {\n /**\n * Base64 encoded cursor value for forward pagination\n */\n after?: string;\n /**\n * Authorized application name filter\n */\n authorizedAppName?: string;\n /**\n * The base URL for the API endpoint.\n */\n baseUrl: string;\n /**\n * Base64 encoded cursor value for backward pagination\n */\n before?: string;\n /**\n * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Filter expression for organizations\n */\n filter?: string;\n /**\n * Maximum number of organizations to return\n */\n limit?: number;\n /**\n * Whether to include child organizations recursively\n */\n recursive?: boolean;\n}\n\n/**\n * Retrieves the organizations associated with the current user.\n *\n * @param config - Configuration object containing baseUrl, optional query parameters, and request config.\n * @returns A promise that resolves with the organizations information.\n * @example\n * ```typescript\n * // Using default fetch\n * try {\n * const organizations = await getMeOrganizations({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * after: \"\",\n * before: \"\",\n * filter: \"\",\n * limit: 10,\n * recursive: false\n * });\n * console.log(organizations);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get organizations:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher (e.g., axios-based httpClient)\n * try {\n * const organizations = await getMeOrganizations({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * after: \"\",\n * before: \"\",\n * filter: \"\",\n * limit: 10,\n * recursive: false,\n * fetcher: async (url, config) => {\n * const response = await httpClient({\n * url,\n * method: config.method,\n * headers: config.headers,\n * ...config\n * });\n * // Convert axios-like response to fetch-like Response\n * return {\n * ok: response.status >= 200 && response.status < 300,\n * status: response.status,\n * statusText: response.statusText,\n * json: () => Promise.resolve(response.data),\n * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))\n * } as Response;\n * }\n * });\n * console.log(organizations);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get organizations:', error.message);\n * }\n * }\n * ```\n */\nconst getMeOrganizations = async ({\n baseUrl,\n after = '',\n authorizedAppName = '',\n before = '',\n filter = '',\n limit = 10,\n recursive = false,\n fetcher,\n ...requestConfig\n}: GetMeOrganizationsConfig): Promise<Organization[]> => {\n try {\n // eslint-disable-next-line no-new\n new URL(baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid base URL provided. ${error?.toString()}`,\n 'getMeOrganizations-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `baseUrl` does not adhere to the URL schema.',\n );\n }\n\n const queryParams: URLSearchParams = new URLSearchParams(\n Object.fromEntries(\n Object.entries({\n after,\n authorizedAppName,\n before,\n filter,\n limit: limit.toString(),\n recursive: recursive.toString(),\n }).filter(([, value]: [string, string]) => Boolean(value)),\n ),\n );\n\n const fetchFn: typeof fetch = fetcher || fetch;\n const resolvedUrl: string = `${baseUrl}/api/users/v1/me/organizations?${queryParams.toString()}`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: 'GET',\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n `Failed to fetch associated organizations of the user: ${errorText}`,\n 'getMeOrganizations-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n );\n }\n\n const data: Record<string, unknown> = (await response.json()) as any;\n return (data['organizations'] as Organization[]) || [];\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'getMeOrganizations-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default getMeOrganizations;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\n\n/**\n * Extended organization interface with additional properties\n */\nexport interface OrganizationDetails {\n attributes?: Record<string, any>;\n created?: string;\n description?: string;\n id: string;\n lastModified?: string;\n name: string;\n orgHandle: string;\n parent?: {\n id: string;\n ref: string;\n };\n permissions?: string[];\n status?: string;\n type?: string;\n}\n\n/**\n * Configuration for the getOrganization request\n */\nexport interface GetOrganizationConfig extends Omit<RequestInit, 'method'> {\n /**\n * The base URL for the API endpoint.\n */\n baseUrl: string;\n /**\n * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * The ID of the organization to retrieve\n */\n organizationId: string;\n}\n\n/**\n * Retrieves detailed information for a specific organization.\n *\n * @param config - Configuration object containing baseUrl, organizationId, and request config.\n * @returns A promise that resolves with the organization details.\n * @example\n * ```typescript\n * // Using default fetch\n * try {\n * const organization = await getOrganization({\n * baseUrl: \"https://api.asgardeo.io/t/dxlab\",\n * organizationId: \"0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1\"\n * });\n * console.log(organization);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get organization:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher (e.g., axios-based httpClient)\n * try {\n * const organization = await getOrganization({\n * baseUrl: \"https://api.asgardeo.io/t/dxlab\",\n * organizationId: \"0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1\",\n * fetcher: async (url, config) => {\n * const response = await httpClient({\n * url,\n * method: config.method,\n * headers: config.headers,\n * ...config\n * });\n * // Convert axios-like response to fetch-like Response\n * return {\n * ok: response.status >= 200 && response.status < 300,\n * status: response.status,\n * statusText: response.statusText,\n * json: () => Promise.resolve(response.data),\n * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))\n * } as Response;\n * }\n * });\n * console.log(organization);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get organization:', error.message);\n * }\n * }\n * ```\n */\nconst getOrganization = async ({\n baseUrl,\n organizationId,\n fetcher,\n ...requestConfig\n}: GetOrganizationConfig): Promise<OrganizationDetails> => {\n try {\n // eslint-disable-next-line no-new\n new URL(baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid base URL provided. ${error?.toString()}`,\n 'getOrganization-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `baseUrl` does not adhere to the URL schema.',\n );\n }\n\n if (!organizationId) {\n throw new AsgardeoAPIError(\n 'Organization ID is required',\n 'getOrganization-ValidationError-002',\n 'javascript',\n 400,\n 'Invalid Request',\n );\n }\n\n const fetchFn: typeof fetch = fetcher || fetch;\n const resolvedUrl: string = `${baseUrl}/api/server/v1/organizations/${organizationId}`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: 'GET',\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n `Failed to fetch organization details: ${errorText}`,\n 'getOrganization-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n );\n }\n\n return (await response.json()) as OrganizationDetails;\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'getOrganization-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default getOrganization;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Checks if a value is considered empty.\n *\n * A value is considered empty if it is:\n * - null\n * - undefined\n * - empty string (\"\")\n * - string containing only whitespace characters\n * - empty array ([])\n * - empty object ({})\n *\n * @param value - The value to check\n * @returns true if the value is empty, false otherwise\n *\n * @example\n * ```typescript\n * isEmpty(null); // true\n * isEmpty(undefined); // true\n * isEmpty(\"\"); // true\n * isEmpty(\" \"); // true\n * isEmpty(\"hello\"); // false\n * isEmpty([]); // true\n * isEmpty([1, 2, 3]); // false\n * isEmpty({}); // true\n * isEmpty({ name: \"John\" }); // false\n * isEmpty(0); // false\n * isEmpty(false); // false\n * ```\n */\nconst isEmpty = (value: any): boolean => {\n if (value === null || value === undefined) {\n return true;\n }\n\n if (typeof value === 'string') {\n return value.trim() === '';\n }\n\n if (Array.isArray(value)) {\n return value.length === 0;\n }\n\n if (typeof value === 'object' && value.constructor === Object) {\n return Object.keys(value).length === 0;\n }\n\n return false;\n};\n\nexport default isEmpty;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {OrganizationDetails} from './getOrganization';\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport isEmpty from '../utils/isEmpty';\n\n/**\n * Configuration for the updateOrganization request\n */\nexport interface UpdateOrganizationConfig extends Omit<RequestInit, 'method' | 'body'> {\n /**\n * The base URL for the API endpoint.\n */\n baseUrl: string;\n /**\n * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Array of patch operations to apply\n */\n operations: Array<{\n operation: 'REPLACE' | 'ADD' | 'REMOVE';\n path: string;\n value?: any;\n }>;\n /**\n * The ID of the organization to update\n */\n organizationId: string;\n}\n\n/**\n * Updates the organization information using the Organizations Management API.\n *\n * @param config - Configuration object with baseUrl, organizationId, operations and optional request config.\n * @returns A promise that resolves with the updated organization information.\n * @example\n * ```typescript\n * // Using the helper function to create operations automatically\n * const operations = createPatchOperations({\n * name: \"Updated Organization Name\", // Will use REPLACE\n * description: \"\", // Will use REMOVE (empty string)\n * customField: \"Some value\" // Will use REPLACE\n * });\n *\n * await updateOrganization({\n * baseUrl: \"https://api.asgardeo.io/t/<ORG>\",\n * organizationId: \"0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1\",\n * operations\n * });\n *\n * // Or manually specify operations\n * await updateOrganization({\n * baseUrl: \"https://api.asgardeo.io/t/<ORG>\",\n * organizationId: \"0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1\",\n * operations: [\n * { operation: \"REPLACE\", path: \"/name\", value: \"Updated Organization Name\" },\n * { operation: \"REMOVE\", path: \"/description\" }\n * ]\n * });\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher (e.g., axios-based httpClient)\n * await updateOrganization({\n * baseUrl: \"https://api.asgardeo.io/t/<ORG>\",\n * organizationId: \"0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1\",\n * operations: [\n * { operation: \"REPLACE\", path: \"/name\", value: \"Updated Organization Name\" }\n * ],\n * fetcher: async (url, config) => {\n * const response = await httpClient({\n * url,\n * method: config.method,\n * headers: config.headers,\n * data: config.body,\n * ...config\n * });\n * // Convert axios-like response to fetch-like Response\n * return {\n * ok: response.status >= 200 && response.status < 300,\n * status: response.status,\n * statusText: response.statusText,\n * json: () => Promise.resolve(response.data),\n * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))\n * } as Response;\n * }\n * });\n * ```\n */\nconst updateOrganization = async ({\n baseUrl,\n organizationId,\n operations,\n fetcher,\n ...requestConfig\n}: UpdateOrganizationConfig): Promise<OrganizationDetails> => {\n try {\n // eslint-disable-next-line no-new\n new URL(baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid base URL provided. ${error?.toString()}`,\n 'updateOrganization-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `baseUrl` does not adhere to the URL schema.',\n );\n }\n\n if (!organizationId) {\n throw new AsgardeoAPIError(\n 'Organization ID is required',\n 'updateOrganization-ValidationError-002',\n 'javascript',\n 400,\n 'Invalid Request',\n );\n }\n\n if (!operations || !Array.isArray(operations) || operations.length === 0) {\n throw new AsgardeoAPIError(\n 'Operations array is required and cannot be empty',\n 'updateOrganization-ValidationError-003',\n 'javascript',\n 400,\n 'Invalid Request',\n );\n }\n\n const fetchFn: typeof fetch = fetcher || fetch;\n const resolvedUrl: string = `${baseUrl}/api/server/v1/organizations/${organizationId}`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n body: JSON.stringify(operations),\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: 'PATCH',\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n `Failed to update organization: ${errorText}`,\n 'updateOrganization-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n );\n }\n\n return (await response.json()) as OrganizationDetails;\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'updateOrganization-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\n/**\n * Helper function to convert field updates to patch operations format.\n * Uses REMOVE operation when the value is empty, otherwise uses REPLACE.\n *\n * @param payload - Object containing field updates\n * @returns Array of patch operations\n */\nexport const createPatchOperations = (\n payload: Record<string, any>,\n): Array<{\n operation: 'REPLACE' | 'REMOVE';\n path: string;\n value?: any;\n}> =>\n Object.entries(payload).map(([key, value]: [string, any]) => {\n if (isEmpty(value)) {\n return {\n operation: 'REMOVE' as const,\n path: `/${key}`,\n };\n }\n\n return {\n operation: 'REPLACE' as const,\n path: `/${key}`,\n value,\n };\n });\n\nexport default updateOrganization;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {User} from '../models/user';\nimport processUserUsername from '../utils/processUsername';\n\n/**\n * Configuration for the updateMeProfile request\n */\nexport interface UpdateMeProfileConfig extends Omit<RequestInit, 'method' | 'body'> {\n /**\n * The base path of the API endpoint.\n */\n baseUrl?: string;\n /**\n * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * The value object to patch (SCIM2 PATCH value)\n */\n payload: any;\n /**\n * The absolute API endpoint.\n */\n url?: string;\n}\n\n/**\n * Updates the user profile information at the specified SCIM2 Me endpoint.\n *\n * @param config - Configuration object with URL, payload and optional request config.\n * @returns A promise that resolves with the updated user profile information.\n * @example\n * ```typescript\n * // Using default fetch\n * await updateMeProfile({\n * url: \"https://api.asgardeo.io/t/<ORG>/scim2/Me\",\n * payload: { \"urn:scim:wso2:schema\": { mobileNumbers: [\"0777933830\"] } }\n * });\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher (e.g., axios-based httpClient)\n * await updateMeProfile({\n * url: \"https://api.asgardeo.io/t/<ORG>/scim2/Me\",\n * payload: { \"urn:scim:wso2:schema\": { mobileNumbers: [\"0777933830\"] } },\n * fetcher: async (url, config) => {\n * const response = await httpClient({\n * url,\n * method: config.method,\n * headers: config.headers,\n * data: config.body,\n * ...config\n * });\n * // Convert axios-like response to fetch-like Response\n * return {\n * ok: response.status >= 200 && response.status < 300,\n * status: response.status,\n * statusText: response.statusText,\n * json: () => Promise.resolve(response.data),\n * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))\n * } as Response;\n * }\n * });\n * ```\n */\nconst updateMeProfile = async ({\n url,\n baseUrl,\n payload,\n fetcher,\n ...requestConfig\n}: UpdateMeProfileConfig): Promise<User> => {\n try {\n // eslint-disable-next-line no-new\n new URL(url ?? baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid URL provided. ${error?.toString()}`,\n 'updateMeProfile-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `url` or `baseUrl` path does not adhere to the URL schema.',\n );\n }\n\n const data: Record<string, unknown> = {\n Operations: [\n {\n op: 'replace',\n value: payload,\n },\n ],\n schemas: ['urn:ietf:params:scim:api:messages:2.0:PatchOp'],\n };\n\n const fetchFn: typeof fetch = fetcher || fetch;\n const resolvedUrl: string = url ?? `${baseUrl}/scim2/Me`;\n\n const requestInit: RequestInit = {\n method: 'PATCH',\n ...requestConfig,\n body: JSON.stringify(data),\n headers: {\n ...requestConfig.headers,\n Accept: 'application/json',\n 'Content-Type': 'application/scim+json',\n },\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n `Failed to update user profile: ${errorText}`,\n 'updateMeProfile-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n );\n }\n\n // Match the read path (`getScim2Me`) \u2014 strip the userstore prefix\n // (e.g. \"DEFAULT/\") so consumers receive a clean `userName`. Without\n // this, the optimistic-update path would put the prefixed value into\n // local state and the UI would flip to \"DEFAULT/<email>\" after a save.\n return processUserUsername((await response.json()) as User);\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n error?.response?.data?.detail || 'An error occurred while updating the user profile. Please try again.',\n 'updateMeProfile-NetworkError-001',\n 'javascript',\n error?.data?.status,\n 'Network Error',\n );\n }\n};\n\nexport default updateMeProfile;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {BrandingPreference} from '../models/branding-preference';\n\n/**\n * Configuration for the getBrandingPreference request\n */\nexport interface GetBrandingPreferenceConfig extends Omit<RequestInit, 'method'> {\n /**\n * The base URL for the API endpoint.\n */\n baseUrl: string;\n /**\n * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Locale for the branding preference\n */\n locale?: string;\n /**\n * Name of the branding preference\n */\n name?: string;\n /**\n * Type of the branding preference\n */\n type?: string;\n}\n\n/**\n * Retrieves branding preference configuration.\n *\n * @param config - Configuration object containing baseUrl, optional query parameters, and request config.\n * @returns A promise that resolves with the branding preference information.\n * @example\n * ```typescript\n * // Using default fetch\n * try {\n * const response = await getBrandingPreference({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * locale: \"en-US\",\n * name: \"my-branding\",\n * type: \"org\"\n * });\n * console.log(response.theme);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get branding preference:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher (e.g., axios-based httpClient)\n * try {\n * const response = await getBrandingPreference({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * locale: \"en-US\",\n * name: \"my-branding\",\n * type: \"org\",\n * fetcher: async (url, config) => {\n * const response = await httpClient({\n * url,\n * method: config.method,\n * headers: config.headers,\n * ...config\n * });\n * // Convert axios-like response to fetch-like Response\n * return {\n * ok: response.status >= 200 && response.status < 300,\n * status: response.status,\n * statusText: response.statusText,\n * json: () => Promise.resolve(response.data),\n * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))\n * } as Response;\n * }\n * });\n * console.log(response.theme);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get branding preference:', error.message);\n * }\n * }\n * ```\n */\nconst getBrandingPreference = async ({\n baseUrl,\n locale,\n name,\n type,\n fetcher,\n ...requestConfig\n}: GetBrandingPreferenceConfig): Promise<BrandingPreference> => {\n try {\n // eslint-disable-next-line no-new\n new URL(baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid base URL provided. ${error?.toString()}`,\n 'getBrandingPreference-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `baseUrl` does not adhere to the URL schema.',\n );\n }\n\n const queryParams: URLSearchParams = new URLSearchParams(\n Object.fromEntries(\n Object.entries({\n locale: locale || '',\n name: name || '',\n type: type || '',\n }).filter(([, value]: [string, string]) => Boolean(value)),\n ),\n );\n\n const fetchFn: typeof fetch = fetcher || fetch;\n const resolvedUrl: string = `${baseUrl}/api/server/v1/branding-preference/resolve${\n queryParams.toString() ? `?${queryParams.toString()}` : ''\n }`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: 'GET',\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n `Failed to get branding preference: ${errorText}`,\n 'getBrandingPreference-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n );\n }\n\n const data: BrandingPreference = (await response.json()) as BrandingPreference;\n return data;\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'getBrandingPreference-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default getBrandingPreference;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {EmbeddedFlowResponseData as EmbeddedFlowResponseDataV2} from './embedded-flow-v2';\nimport {\n EmbeddedFlowResponseType as EmbeddedFlowResponseTypeV1,\n EmbeddedFlowType as EmbeddedFlowTypeV1,\n} from '../embedded-flow';\n\n/**\n * Status enumeration for Asgardeo embedded sign-in flow operations.\n *\n * These statuses indicate the current state of the sign-in flow and determine\n * the next action required by the client application. Each status provides\n * specific guidance on how to proceed with the authentication process.\n *\n * @example\n * ```typescript\n * switch (response.flowStatus) {\n * case EmbeddedSignInFlowStatus.Incomplete:\n * // More user input needed - render form components\n * break;\n * case EmbeddedSignInFlowStatus.Complete:\n * // Authentication successful - handle completion\n * break;\n * case EmbeddedSignInFlowStatus.Error:\n * // Authentication failed - show error message\n * break;\n * }\n * ```\n *\n * @experimental Part of the new Asgardeo API\n */\nexport enum EmbeddedSignInFlowStatus {\n /**\n * Sign-in flow completed successfully.\n *\n * The user has been authenticated and the flow can proceed to\n * OAuth2 completion or redirection. Check for redirectUrl or\n * assertion data in the response.\n */\n Complete = 'COMPLETE',\n\n /**\n * Sign-in flow encountered an error.\n *\n * Authentication failed due to invalid credentials, system error,\n * or other issues. Check error details in the response and handle\n * appropriately (retry, show error message, etc.).\n */\n Error = 'ERROR',\n\n /**\n * Sign-in flow requires additional user input.\n *\n * More authentication steps are needed. The response will contain\n * components in data.meta.components that should be rendered to\n * collect additional user input (e.g., MFA, password, etc.).\n */\n Incomplete = 'INCOMPLETE',\n}\n\n/**\n * Type enumeration for Asgardeo embedded sign-in flow responses.\n *\n * Determines the nature of the flow response and how the client should\n * handle the returned data. This affects both UI rendering and flow\n * continuation logic.\n *\n * @experimental Part of the new Asgardeo API\n */\nexport enum EmbeddedSignInFlowType {\n /**\n * Response requires external redirection.\n *\n * Used for social login providers, external identity providers,\n * or other flows that require navigating to an external URL.\n * The response will contain redirection information.\n */\n Redirection = 'REDIRECTION',\n\n /**\n * Response contains view components for rendering.\n *\n * Standard embedded flow response containing UI components\n * that should be rendered within the current application\n * context. Most common type for embedded authentication.\n */\n View = 'VIEW',\n}\n\n/**\n * Extended response structure for Asgardeo embedded sign-in flow.\n *\n * This interface defines additional properties that are added at the SDK level\n * to enhance the basic API response with client-side computed values. These\n * properties provide convenience for common post-authentication operations.\n *\n * @remarks This response structure is enhanced by the SDK and contains\n * properties beyond the raw API response. It's designed to simplify\n * post-authentication handling for client applications.\n *\n * @experimental This interface is part of the new Asgardeo platform\n */\nexport interface ExtendedEmbeddedSignInFlowResponse {\n /**\n * Computed redirect URL for post-authentication navigation.\n *\n * This URL is determined by the SDK based on the flow completion result\n * and configured redirect settings. When present, the client application\n * should navigate to this URL to complete the authentication process.\n *\n * @example \"https://myapp.com/dashboard?session=abc123\"\n */\n redirectUrl?: string;\n}\n\n/**\n * Primary response structure for Asgardeo embedded sign-in flow operations.\n *\n * This is the main response interface returned by the sign-in API, combining\n * the enhanced SDK properties with the core API response data. It provides all\n * information needed to handle the current state of the authentication flow.\n *\n * The response structure adapts based on the flow status:\n * - INCOMPLETE: Contains components for user interaction\n * - COMPLETE: Contains completion data and potential redirection info\n * - ERROR: Contains error information for troubleshooting\n *\n * @example\n * ```typescript\n * const response: EmbeddedSignInFlowResponse = {\n * executionId: \"flow_12345\",\n * flowStatus: EmbeddedSignInFlowStatus.Incomplete,\n * type: EmbeddedSignInFlowType.View,\n * data: {\n * meta: {\n * components: [\n * {\n * id: \"username_field\",\n * type: EmbeddedFlowComponentType.TextInput,\n * label: \"Username\",\n * required: true\n * }\n * ]\n * }\n * }\n * };\n * ```\n *\n * @experimental This interface is part of the new Asgardeo platform\n */\nexport interface EmbeddedSignInFlowResponse extends ExtendedEmbeddedSignInFlowResponse {\n /**\n * Per-step challenge token for replay protection.\n * Must be included in the next request to continue this flow.\n */\n challengeToken?: string;\n\n /**\n * Core response data containing UI components and flow metadata.\n * Includes both modern meta.components structure and legacy fields for compatibility.\n */\n data: EmbeddedFlowResponseDataV2 & {\n /**\n * Legacy action definitions for backward compatibility.\n * @deprecated Use data.meta.components for new implementations\n */\n actions?: {\n /** Unique action identifier */\n id: string;\n /** Action type identifier */\n type: EmbeddedFlowResponseTypeV1;\n }[];\n\n /**\n * Legacy input field definitions for backward compatibility.\n * @deprecated Use data.meta.components for new implementations\n */\n inputs?: {\n /** Field name identifier */\n name: string;\n /** Whether the field is required */\n required: boolean;\n /** Input field type */\n type: string;\n }[];\n };\n\n /**\n * Unique identifier for this specific flow instance.\n * Used to maintain state across multiple API calls during the authentication process.\n */\n executionId: string;\n\n /**\n * Optional reason for flow failure in case of an error.\n * Provides additional context when flowStatus is set to ERROR.\n */\n failureReason?: string;\n\n /**\n * Current status of the sign-in flow.\n * Determines the next action required by the client application.\n */\n flowStatus: EmbeddedSignInFlowStatus;\n\n /**\n * Type of response indicating how to handle the returned data.\n * Affects both UI rendering and navigation logic.\n */\n type: EmbeddedSignInFlowType;\n}\n\n/**\n * Response structure for completed Asgardeo embedded sign-in flows.\n *\n * This interface defines the response format when the embedded sign-in flow\n * reaches the COMPLETE status and requires OAuth2 flow completion. It contains\n * the redirect URI that should be used for the final authentication step.\n *\n * @example\n * ```typescript\n * const completeResponse: EmbeddedSignInFlowCompleteResponse = {\n * redirect_uri: \"https://myapp.com/callback?code=abc123&state=xyz789\"\n * };\n *\n * // Typically handled automatically by the SDK\n * window.location.href = completeResponse.redirect_uri;\n * ```\n *\n * @experimental This interface is part of the new Asgardeo platform\n */\nexport interface EmbeddedSignInFlowCompleteResponse {\n /**\n * OAuth2 redirect URI for completing the authentication flow.\n *\n * Contains the final redirect URL with authorization code, state,\n * and other OAuth2 parameters needed to complete the authentication\n * process. This URL should be navigated to automatically or manually\n * depending on the application's requirements.\n */\n redirect_uri: string;\n}\n\n/**\n * Request payload for initiating Asgardeo embedded sign-in flows.\n *\n * This type defines the minimum required information to start a new\n * embedded sign-in flow. The flow type determines the kind of authentication\n * process that will be initiated (e.g., standard login, MFA, etc.).\n *\n * @example\n * ```typescript\n * const initRequest: EmbeddedSignInFlowInitiateRequest = {\n * applicationId: \"app_12345\",\n * flowType: EmbeddedFlowType.Authentication\n * };\n *\n * const response = await executeEmbeddedSignInFlow({\n * baseUrl: \"https://api.asgardeo.io/t/myorg\",\n * payload: initRequest\n * });\n * ```\n *\n * @experimental This type is part of the new Asgardeo platform\n */\nexport type EmbeddedSignInFlowInitiateRequest = {\n /**\n * Unique identifier of the application initiating the sign-in flow.\n * Must be a valid application ID registered in the Asgardeo organization.\n */\n applicationId: string;\n\n /**\n * Type of embedded flow to initiate.\n * Determines the authentication process and available options.\n */\n flowType: EmbeddedFlowTypeV1;\n};\n\n/**\n * Request payload for executing steps in Asgardeo embedded sign-in flows.\n *\n * This interface defines the structure for subsequent requests after flow initiation.\n * It supports both continuing existing flows (with executionId) and submitting user\n * input data collected from the rendered components.\n *\n * @example\n * ```typescript\n * // Continue existing flow with user input\n * const stepRequest: EmbeddedSignInFlowRequest = {\n * executionId: \"flow_12345\",\n * action: \"action_001\",\n * inputs: {\n * username: \"user@example.com\",\n * password: \"securePassword123\"\n * }\n * };\n *\n * // Submit to continue the flow\n * const response = await executeEmbeddedSignInFlow({\n * baseUrl: \"https://api.asgardeo.io/t/myorg\",\n * payload: stepRequest\n * });\n * ```\n *\n * @experimental This interface is part of the new Asgardeo platform\n */\nexport interface EmbeddedSignInFlowRequest extends Partial<EmbeddedSignInFlowInitiateRequest> {\n /**\n * Identifier of the specific action being triggered.\n * Corresponds to action components in the UI (e.g., submit button, social login).\n */\n action?: string;\n\n /**\n * Per-step challenge token received from the previous flow response.\n * Required when continuing an existing flow to prevent replay attacks.\n */\n challengeToken?: string;\n\n /**\n * Identifier of the flow instance to continue.\n * Required when submitting data for an existing flow.\n */\n executionId?: string;\n\n /**\n * User input data collected from the form components.\n * Keys should match the component identifiers from the response.\n *\n * @example\n * ```typescript\n * {\n * \"username\": \"john.doe@example.com\",\n * \"password\": \"mySecurePassword\",\n * \"rememberMe\": true\n * }\n * ```\n */\n inputs?: Record<string, any>;\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../../errors/AsgardeoAPIError';\nimport {EmbeddedFlowExecuteRequestConfig as EmbeddedFlowExecuteRequestConfigV2} from '../../models/v2/embedded-flow-v2';\nimport {\n EmbeddedSignInFlowResponse as EmbeddedSignInFlowResponseV2,\n EmbeddedSignInFlowStatus as EmbeddedSignInFlowStatusV2,\n} from '../../models/v2/embedded-signin-flow-v2';\n\nconst executeEmbeddedSignInFlowV2 = async ({\n url,\n baseUrl,\n payload,\n authId,\n ...requestConfig\n}: EmbeddedFlowExecuteRequestConfigV2): Promise<EmbeddedSignInFlowResponseV2> => {\n if (!payload) {\n throw new AsgardeoAPIError(\n 'Authorization payload is required',\n 'executeEmbeddedSignInFlow-ValidationError-002',\n 'javascript',\n 400,\n 'If an authorization payload is not provided, the request cannot be constructed correctly.',\n );\n }\n\n const endpoint: string = url ?? `${baseUrl}/flow/execute`;\n\n // Strip any user-provided 'verbose' parameter as it should only be used internally\n const cleanPayload: typeof payload =\n typeof payload === 'object' && payload !== null\n ? Object.fromEntries(Object.entries(payload).filter(([key]: [string, unknown]) => key !== 'verbose'))\n : payload;\n\n // `verbose: true` is required to get the `meta` field in the response that includes component details.\n // Add verbose:true if:\n // 1. payload contains only applicationId and flowType\n // 2. payload contains only executionId\n const hasOnlyAppIdAndFlowType: boolean =\n typeof cleanPayload === 'object' &&\n cleanPayload !== null &&\n 'applicationId' in cleanPayload &&\n 'flowType' in cleanPayload &&\n Object.keys(cleanPayload).length === 2;\n const hasOnlyFlowId: boolean =\n typeof cleanPayload === 'object' &&\n cleanPayload !== null &&\n 'executionId' in cleanPayload &&\n Object.keys(cleanPayload).length === 1;\n\n const requestPayload: Record<string, unknown> =\n hasOnlyAppIdAndFlowType || hasOnlyFlowId ? {...cleanPayload, verbose: true} : cleanPayload;\n\n const response: Response = await fetch(endpoint, {\n ...requestConfig,\n body: JSON.stringify(requestPayload),\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: requestConfig.method || 'POST',\n });\n\n if (!response.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n `Authorization request failed: ${errorText}`,\n 'executeEmbeddedSignInFlow-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n );\n }\n\n const flowResponse: EmbeddedSignInFlowResponseV2 = await response.json();\n\n // IMPORTANT: Only applicable for Asgardeo V2 platform.\n // Check if the flow is complete and has an assertion and authId is provided, then call OAuth2 auth callback.\n if (flowResponse.flowStatus === EmbeddedSignInFlowStatusV2.Complete && (flowResponse as any).assertion && authId) {\n try {\n const oauth2Response: Response = await fetch(`${baseUrl}/oauth2/auth/callback`, {\n body: JSON.stringify({\n assertion: (flowResponse as any).assertion,\n authId,\n }),\n credentials: 'include',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: 'POST',\n });\n\n if (!oauth2Response.ok) {\n const oauth2ErrorText: string = await oauth2Response.text();\n\n throw new AsgardeoAPIError(\n `OAuth2 authorization failed: ${oauth2ErrorText}`,\n 'executeEmbeddedSignInFlow-OAuth2Error-002',\n 'javascript',\n oauth2Response.status,\n oauth2Response.statusText,\n );\n }\n\n const oauth2Result: Record<string, unknown> = await oauth2Response.json();\n\n return {\n flowStatus: flowResponse.flowStatus,\n redirectUrl: oauth2Result['redirect_uri'],\n } as any;\n } catch (authError) {\n throw new AsgardeoAPIError(\n `OAuth2 authorization failed: ${authError instanceof Error ? authError.message : 'Unknown error'}`,\n 'executeEmbeddedSignInFlow-OAuth2Error-001',\n 'javascript',\n 500,\n 'Failed to complete OAuth2 authorization after successful embedded sign-in flow.',\n );\n }\n }\n\n return flowResponse;\n};\n\nexport default executeEmbeddedSignInFlowV2;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n EmbeddedFlowResponseType as EmbeddedFlowResponseTypeV1,\n EmbeddedFlowType as EmbeddedFlowTypeV1,\n} from '../embedded-flow';\n\n/**\n * Status enumeration for Asgardeo embedded sign-up flow operations.\n *\n * These statuses indicate the current state of the registration flow and determine\n * the next action required by the client application. Each status provides specific\n * guidance on how to proceed with the user registration process.\n *\n * @example\n * ```typescript\n * switch (response.flowStatus) {\n * case EmbeddedSignUpFlowStatus.Incomplete:\n * // More user input needed - render registration form components\n * break;\n * case EmbeddedSignUpFlowStatus.Complete:\n * // Registration successful - handle completion\n * break;\n * case EmbeddedSignUpFlowStatus.Error:\n * // Registration failed - show detailed error message\n * const errorResponse = response as EmbeddedSignUpFlowErrorResponse;\n * showError(errorResponse.failureReason);\n * break;\n * }\n * ```\n *\n * @experimental Part of the new Asgardeo API\n */\nexport enum EmbeddedSignUpFlowStatus {\n /**\n * Sign-up flow completed successfully.\n *\n * The user has successfully registered and the flow can proceed to\n * OAuth2 completion or redirection. Check for redirectUrl or assertion\n * data in the response for next steps.\n */\n Complete = 'COMPLETE',\n\n /**\n * Sign-up flow encountered an error and cannot proceed.\n *\n * Registration failed due to validation errors, duplicate user,\n * system errors, or other issues. The response will be of type\n * `EmbeddedSignUpFlowErrorResponse` containing detailed failure\n * information that can be displayed to the user.\n *\n * @see {@link EmbeddedSignUpFlowErrorResponse} for error response structure\n */\n Error = 'ERROR',\n\n /**\n * Sign-up flow requires additional user input.\n *\n * More registration steps are needed. The response will contain\n * components in data.meta.components that should be rendered to\n * collect additional user information (e.g., profile data, verification).\n */\n Incomplete = 'INCOMPLETE',\n}\n\n/**\n * Type enumeration for Asgardeo embedded sign-up flow responses.\n *\n * Determines the nature of the registration flow response and how the client\n * should handle the returned data. This affects both UI rendering and flow\n * continuation logic during the user registration process.\n *\n * @experimental Part of the new Asgardeo API\n */\nexport enum EmbeddedSignUpFlowType {\n /**\n * Response requires external redirection.\n *\n * Used for social registration providers, external identity providers,\n * or other flows that require navigating to an external URL during\n * the registration process. The response will contain redirection information.\n */\n Redirection = 'REDIRECTION',\n\n /**\n * Response contains view components for rendering.\n *\n * Standard embedded registration flow response containing UI components\n * that should be rendered within the current application context.\n * Most common type for embedded user registration.\n */\n View = 'VIEW',\n}\n\n/**\n * Extended response structure for the embedded sign-up flow.\n * @remarks This response is only done from the SDK level.\n * @experimental\n */\nexport interface ExtendedEmbeddedSignUpFlowResponse {\n /**\n * The URL to redirect the user after completing the sign-up flow.\n */\n redirectUrl?: string;\n}\n\n/**\n * Response structure for the new Asgardeo embedded sign-up flow.\n *\n * This interface defines the structure for successful sign-up flow responses\n * from Asgardeo APIs. For error responses, see `EmbeddedSignUpFlowErrorResponse`.\n *\n * **Flow States:**\n * - `INCOMPLETE`: More user input required, `data` contains form components\n * - `COMPLETE`: Sign-up finished, may contain redirect information\n * - For `ERROR` status, a separate `EmbeddedSignUpFlowErrorResponse` structure is used\n *\n * **Component-Driven UI:**\n * The `data.inputs` and `data.actions` are transformed by the React transformer\n * into component-driven format for consistent UI rendering across different\n * Asgardeo versions.\n *\n * @experimental Part of the new Asgardeo API\n * @see {@link EmbeddedSignUpFlowErrorResponse} for error response structure\n * @see {@link EmbeddedSignUpFlowStatus} for available flow statuses\n */\nexport interface EmbeddedSignUpFlowResponse extends ExtendedEmbeddedSignUpFlowResponse {\n /**\n * Per-step challenge token for replay protection.\n * Must be included in the next request to continue this flow.\n */\n challengeToken?: string;\n\n /**\n * Flow data containing form inputs and available actions.\n * This is transformed to component-driven format by the React transformer.\n */\n data: {\n /**\n * Available actions the user can take (e.g., form submission, social sign-up).\n */\n actions?: {\n id: string;\n type: EmbeddedFlowResponseTypeV1;\n }[];\n\n /**\n * Input fields required for the current step of the sign-up flow.\n */\n inputs?: {\n name: string;\n required: boolean;\n type: string;\n }[];\n };\n\n /**\n * Unique identifier for this sign-up flow instance.\n */\n executionId: string;\n\n /**\n * Optional reason for flow failure in case of an error.\n * Provides additional context when flowStatus is set to ERROR.\n */\n failureReason?: string;\n\n /**\n * Current status of the sign-up flow.\n * Determines whether more input is needed or the flow is complete.\n */\n flowStatus: EmbeddedSignUpFlowStatus;\n\n /**\n * Type of response, indicating the expected user interaction.\n */\n type: EmbeddedSignUpFlowType;\n}\n\n/**\n * Response structure for the new Asgardeo embedded sign-up flow when the flow is complete.\n * @experimental\n */\nexport interface EmbeddedSignUpFlowCompleteResponse {\n redirect_uri: string;\n}\n\n/**\n * Request payload for initiating the new Asgardeo embedded sign-up flow.\n * @experimental\n */\nexport type EmbeddedSignUpFlowInitiateRequest = {\n applicationId: string;\n flowType: EmbeddedFlowTypeV1;\n};\n\n/**\n * Request payload for executing steps in the new Asgardeo embedded sign-up flow.\n * @experimental\n */\nexport interface EmbeddedSignUpFlowRequest extends Partial<EmbeddedSignUpFlowInitiateRequest> {\n action?: string;\n challengeToken?: string;\n executionId?: string;\n inputs?: Record<string, any>;\n}\n\n/**\n * Error response structure for the new Asgardeo embedded sign-up flow.\n *\n * This interface defines the structure of error responses returned by Asgardeo APIs\n * when sign-up operations fail. Unlike AsgardeoV1 which uses generic error codes and\n * descriptions, Asgardeo provides more specific failure reasons within the flow context.\n *\n * **Key Differences from AsgardeoV1:**\n * - Uses `failureReason` instead of `message`/`description` for error details\n * - Maintains flow context with `executionId` for tracking failed operations\n * - Uses structured `flowStatus` enum instead of generic error codes\n * - Provides empty `data` object for consistency with success responses\n *\n * **Error Handling:**\n * This error response format is automatically detected and processed by the\n * `extractErrorMessage()` and `checkForErrorResponse()` functions in the transformer\n * to extract meaningful error messages for display to users.\n *\n * @example\n * ```typescript\n * // Typical Asgardeo error response\n * const errorResponse: EmbeddedSignUpFlowErrorResponse = {\n * executionId: \"0ccfeaf9-18b3-43a5-bcc1-07d863dcb2c0\",\n * flowStatus: EmbeddedSignUpFlowStatus.Error,\n * data: {},\n * failureReason: \"User already exists with the provided username.\"\n * };\n *\n * // This will be automatically transformed to a user-friendly error message:\n * // \"User already exists with the provided username.\"\n * ```\n *\n * @experimental This is part of the new Asgardeo API and may change in future versions\n * @see {@link EmbeddedSignUpFlowStatus.Error} for the error status enum value\n * @see {@link EmbeddedSignUpFlowResponse} for the corresponding success response structure\n */\nexport interface EmbeddedSignUpFlowErrorResponse {\n /**\n * Additional response data, typically empty for error responses.\n * Maintained for structural consistency with successful flow responses\n * which contain components, actions, and other flow data.\n */\n data: Record<string, any>;\n\n /**\n * Human-readable explanation of why the sign-up operation failed.\n *\n * This field contains specific error details that can be directly displayed\n * to users, such as:\n * - \"User already exists with the provided username.\"\n * - \"Invalid email address format.\"\n * - \"Password does not meet complexity requirements.\"\n *\n * Unlike generic error codes, this provides contextual information\n * that helps users understand and resolve the issue.\n */\n /**\n * Unique identifier for the sign-up flow instance.\n * This ID is used to track the flow state and correlate error responses\n * with the specific sign-up attempt that failed.\n */\n executionId: string;\n\n failureReason: string;\n\n /**\n * Status of the sign-up flow, which will be `EmbeddedSignUpFlowStatus.Error`\n * for error responses. This field is used by error detection logic to\n * identify failed flow responses.\n */\n flowStatus: EmbeddedSignUpFlowStatus;\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../../errors/AsgardeoAPIError';\nimport {EmbeddedFlowExecuteRequestConfig as EmbeddedFlowExecuteRequestConfigV2} from '../../models/v2/embedded-flow-v2';\nimport {\n EmbeddedSignUpFlowResponse as EmbeddedSignUpFlowResponseV2,\n EmbeddedSignUpFlowStatus as EmbeddedSignUpFlowStatusV2,\n} from '../../models/v2/embedded-signup-flow-v2';\n\nconst executeEmbeddedSignUpFlowV2 = async ({\n url,\n baseUrl,\n payload,\n authId,\n ...requestConfig\n}: EmbeddedFlowExecuteRequestConfigV2): Promise<EmbeddedSignUpFlowResponseV2> => {\n if (!payload) {\n throw new AsgardeoAPIError(\n 'Registration payload is required',\n 'executeEmbeddedSignUpFlow-ValidationError-002',\n 'javascript',\n 400,\n 'If a registration payload is not provided, the request cannot be constructed correctly.',\n );\n }\n\n const endpoint: string = url ?? `${baseUrl}/flow/execute`;\n\n // Strip any user-provided 'verbose' parameter as it should only be used internally\n const cleanPayload: typeof payload =\n typeof payload === 'object' && payload !== null\n ? Object.fromEntries(Object.entries(payload).filter(([key]: [string, unknown]) => key !== 'verbose'))\n : payload;\n\n // `verbose: true` is required to get the `meta` field in the response that includes component details.\n // Add verbose:true if:\n // 1. payload contains only applicationId and flowType\n // 2. payload contains only executionId\n const hasOnlyAppIdAndFlowType: boolean =\n typeof cleanPayload === 'object' &&\n cleanPayload !== null &&\n 'applicationId' in cleanPayload &&\n 'flowType' in cleanPayload &&\n Object.keys(cleanPayload).length === 2;\n const hasOnlyFlowId: boolean =\n typeof cleanPayload === 'object' &&\n cleanPayload !== null &&\n 'executionId' in cleanPayload &&\n Object.keys(cleanPayload).length === 1;\n\n const requestPayload: Record<string, unknown> =\n hasOnlyAppIdAndFlowType || hasOnlyFlowId ? {...cleanPayload, verbose: true} : cleanPayload;\n\n const response: Response = await fetch(endpoint, {\n ...requestConfig,\n body: JSON.stringify(requestPayload),\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: requestConfig.method || 'POST',\n });\n\n if (!response.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n `Registration request failed: ${errorText}`,\n 'executeEmbeddedSignUpFlow-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n );\n }\n\n const flowResponse: EmbeddedSignUpFlowResponseV2 = await response.json();\n\n // IMPORTANT: Only applicable for Asgardeo V2 platform.\n // Check if the flow is complete and has an assertion and authId is provided, then call OAuth2 auth callback.\n if (flowResponse.flowStatus === EmbeddedSignUpFlowStatusV2.Complete && (flowResponse as any).assertion && authId) {\n try {\n const oauth2Response: Response = await fetch(`${baseUrl}/oauth2/auth/callback`, {\n body: JSON.stringify({\n assertion: (flowResponse as any).assertion,\n authId,\n }),\n credentials: 'include',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: 'POST',\n });\n\n if (!oauth2Response.ok) {\n const oauth2ErrorText: string = await oauth2Response.text();\n\n throw new AsgardeoAPIError(\n `OAuth2 authorization failed: ${oauth2ErrorText}`,\n 'executeEmbeddedSignUpFlow-OAuth2Error-002',\n 'javascript',\n oauth2Response.status,\n oauth2Response.statusText,\n );\n }\n\n const oauth2Result: Record<string, unknown> = await oauth2Response.json();\n\n return {\n flowStatus: flowResponse.flowStatus,\n redirectUrl: oauth2Result['redirect_uri'],\n } as any;\n } catch (authError) {\n throw new AsgardeoAPIError(\n `OAuth2 authorization failed: ${authError instanceof Error ? authError.message : 'Unknown error'}`,\n 'executeEmbeddedSignUpFlow-OAuth2Error-001',\n 'javascript',\n 500,\n 'Failed to complete OAuth2 authorization after successful embedded sign-up flow.',\n );\n }\n }\n\n return flowResponse;\n};\n\nexport default executeEmbeddedSignUpFlowV2;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../../errors/AsgardeoAPIError';\nimport {EmbeddedFlowType} from '../../models/embedded-flow';\nimport {EmbeddedFlowExecuteRequestConfig as EmbeddedFlowExecuteRequestConfigV2} from '../../models/v2/embedded-flow-v2';\n\n/**\n * Response from the user onboarding flow execution.\n */\nexport interface EmbeddedUserOnboardingFlowResponse {\n /**\n * Data for the current step including components and additional data.\n */\n data?: {\n /**\n * Additional data from the flow step (e.g., inviteLink).\n */\n additionalData?: Record<string, string>;\n\n /**\n * UI components to render for the current step.\n */\n components?: any[];\n };\n\n /**\n * Unique identifier for the flow execution.\n */\n executionId: string;\n\n /**\n * Reason for failure if flowStatus is ERROR.\n */\n failureReason?: string;\n\n /**\n * Current status of the flow.\n */\n flowStatus: 'INCOMPLETE' | 'COMPLETE' | 'ERROR';\n\n /**\n * Type of the current step in the flow.\n */\n type?: 'VIEW' | 'REDIRECTION';\n}\n\n/**\n * Executes an embedded user onboarding flow by sending a request to the flow execution endpoint.\n *\n * This function handles both:\n * - Admin flow: Initiates onboarding, collects user details, generates invite link\n * - End-user flow: Validates invite token and allows password setting\n *\n * @param requestConfig - Request configuration object containing URL, payload, and optional auth token.\n * @returns A promise that resolves with the flow execution response.\n * @throws AsgardeoAPIError when the request fails or URL is invalid.\n *\n * @example\n * ```typescript\n * // Admin initiating user onboarding (requires auth token)\n * const response = await executeEmbeddedUserOnboardingFlowV2({\n * baseUrl: \"https://api.thunder.io\",\n * payload: {\n * flowType: \"USER_ONBOARDING\"\n * },\n * headers: {\n * Authorization: `Bearer ${accessToken}`\n * }\n * });\n *\n * // End-user accepting invite (no auth required)\n * const response = await executeEmbeddedUserOnboardingFlowV2({\n * baseUrl: \"https://api.thunder.io\",\n * payload: {\n * executionId: \"flow-id-from-url\",\n * inputs: { inviteToken: \"token-from-url\" }\n * }\n * });\n * ```\n */\nconst executeEmbeddedUserOnboardingFlowV2 = async ({\n url,\n baseUrl,\n payload,\n ...requestConfig\n}: EmbeddedFlowExecuteRequestConfigV2): Promise<EmbeddedUserOnboardingFlowResponse> => {\n if (!payload) {\n throw new AsgardeoAPIError(\n 'User onboarding payload is required',\n 'executeEmbeddedUserOnboardingFlow-ValidationError-002',\n 'javascript',\n 400,\n 'If a user onboarding payload is not provided, the request cannot be constructed correctly.',\n );\n }\n\n const endpoint: string = url ?? `${baseUrl}/flow/execute`;\n\n // Strip any user-provided 'verbose' parameter as it should only be used internally\n const cleanPayload: typeof payload =\n typeof payload === 'object' && payload !== null\n ? Object.fromEntries(Object.entries(payload).filter(([key]: [string, unknown]) => key !== 'verbose'))\n : payload;\n\n // `verbose: true` is required to get the `meta` field in the response that includes component details.\n // Add verbose:true for initial requests or flow continuation without inputs\n const hasOnlyFlowType: boolean =\n typeof cleanPayload === 'object' &&\n cleanPayload !== null &&\n 'flowType' in cleanPayload &&\n Object.keys(cleanPayload).length === 1;\n const hasOnlyFlowId: boolean =\n typeof cleanPayload === 'object' &&\n cleanPayload !== null &&\n 'executionId' in cleanPayload &&\n Object.keys(cleanPayload).length === 1;\n const hasFlowIdWithInputs: boolean =\n typeof cleanPayload === 'object' &&\n cleanPayload !== null &&\n 'executionId' in cleanPayload &&\n 'inputs' in cleanPayload;\n\n // Add verbose for initial requests and when continuing with inputs\n const requestPayload: Record<string, unknown> =\n hasOnlyFlowType || hasOnlyFlowId || hasFlowIdWithInputs ? {...cleanPayload, verbose: true} : cleanPayload;\n\n // Ensure flowType is USER_ONBOARDING for initial requests\n if ('flowType' in requestPayload && requestPayload['flowType'] !== EmbeddedFlowType.UserOnboarding) {\n requestPayload['flowType'] = EmbeddedFlowType.UserOnboarding;\n }\n\n const response: Response = await fetch(endpoint, {\n ...requestConfig,\n body: JSON.stringify(requestPayload),\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: requestConfig.method || 'POST',\n });\n\n if (!response.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n `User onboarding request failed: ${errorText}`,\n 'executeEmbeddedUserOnboardingFlow-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n );\n }\n\n const flowResponse: EmbeddedUserOnboardingFlowResponse = await response.json();\n\n return flowResponse;\n};\n\nexport default executeEmbeddedUserOnboardingFlowV2;\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../../errors/AsgardeoAPIError';\nimport {FlowMetadataResponse, GetFlowMetaRequestConfig} from '../../models/v2/flow-meta-v2';\n\n/**\n * Fetches aggregated flow metadata from the `GET /flow/meta` endpoint.\n *\n * The response includes:\n * - Application or OU details depending on the `type` parameter\n * - Resolved design configuration (theme and layout)\n * - i18n translations filtered by `language` and `namespace`\n * - Registration flow enablement status\n *\n * @param config - Request configuration including `baseUrl`/`url`, and optional\n * `type`, `id`, `language`, and `namespace` filters. When `type`\n * and `id` are omitted the server returns i18n-only metadata.\n * @returns A promise that resolves to the {@link FlowMetadataResponse}.\n *\n * @throws {AsgardeoAPIError} When the server returns a non-OK response.\n *\n * @example\n * ```typescript\n * import getFlowMetaV2 from './api/v2/getFlowMetaV2';\n * import { FlowMetaType } from './models/v2/flow-meta-v2';\n *\n * const meta = await getFlowMetaV2({\n * baseUrl: 'https://localhost:8090',\n * type: FlowMetaType.App,\n * id: '60a9b38b-6eba-9f9e-55f9-267067de4680',\n * language: 'en',\n * namespace: 'auth',\n * });\n *\n * console.log(meta.application?.name);\n * console.log(meta.i18n.translations);\n * ```\n *\n * @experimental This function targets the Asgardeo V2 platform API\n */\nconst getFlowMetaV2 = async ({\n url,\n baseUrl,\n type,\n id,\n language,\n namespace,\n ...requestConfig\n}: GetFlowMetaRequestConfig): Promise<FlowMetadataResponse> => {\n const queryParams: URLSearchParams = new URLSearchParams({\n ...(id ? {id} : {}),\n ...(type ? {type} : {}),\n ...(language ? {language} : {}),\n ...(namespace ? {namespace} : {}),\n });\n\n const baseEndpoint: string = url ?? `${baseUrl}/flow/meta`;\n const endpoint: string = `${baseEndpoint}?${queryParams.toString()}`;\n\n const response: Response = await fetch(endpoint, {\n ...requestConfig,\n headers: {\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n method: 'GET',\n });\n\n if (!response.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n `Flow metadata request failed: ${errorText}`,\n 'getFlowMetaV2-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n );\n }\n\n const flowMetadata: FlowMetadataResponse = await response.json();\n\n return flowMetadata;\n};\n\nexport default getFlowMetaV2;\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../../errors/AsgardeoAPIError';\nimport {GetOrganizationUnitChildrenConfig, OrganizationUnitListResponse} from '../../models/v2/organization-unit';\n\n/**\n * Retrieves the child organization units of a given parent OU.\n *\n * @param config - Request configuration including `baseUrl`/`url`, `organizationUnitId`,\n * and optional `limit`/`offset` pagination parameters.\n * @returns A promise that resolves with the paginated list of child organization units.\n *\n * @throws {AsgardeoAPIError} When the server returns a non-OK response.\n *\n * @example\n * ```typescript\n * const children = await getOrganizationUnitChildren({\n * baseUrl: 'https://localhost:8090',\n * organizationUnitId: '0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1',\n * limit: 10,\n * offset: 0,\n * });\n * console.log(children.organizationUnits);\n * ```\n *\n * @experimental This function targets the Asgardeo V2 platform API\n */\nconst getOrganizationUnitChildren = async ({\n url,\n baseUrl,\n organizationUnitId,\n limit = 10,\n offset = 0,\n ...requestConfig\n}: GetOrganizationUnitChildrenConfig): Promise<OrganizationUnitListResponse> => {\n if (!organizationUnitId) {\n throw new AsgardeoAPIError(\n 'Organization Unit ID is required',\n 'getOrganizationUnitChildren-ValidationError-001',\n 'javascript',\n 400,\n 'If an organization unit ID is not provided, the request cannot be constructed correctly.',\n );\n }\n\n const queryParams: URLSearchParams = new URLSearchParams({\n limit: String(limit),\n offset: String(offset),\n });\n\n const endpoint: string = url ?? `${baseUrl}/organization-units/${organizationUnitId}/ous?${queryParams.toString()}`;\n\n const response: Response = await fetch(endpoint, {\n ...requestConfig,\n headers: {\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n method: 'GET',\n });\n\n if (!response.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n `Failed to fetch organization unit children: ${errorText}`,\n 'getOrganizationUnitChildren-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n );\n }\n\n const listResponse: OrganizationUnitListResponse = await response.json();\n\n return listResponse;\n};\n\nexport default getOrganizationUnitChildren;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Constants representing Application Native Authentication related configurations and constants.\n */\nconst ApplicationNativeAuthenticationConstants: {\n readonly SupportedAuthenticators: {\n readonly EmailOtp: string;\n readonly Facebook: string;\n readonly GitHub: string;\n readonly Google: string;\n readonly IdentifierFirst: string;\n readonly LinkedIn: string;\n readonly MagicLink: string;\n readonly Microsoft: string;\n readonly Passkey: string;\n readonly PushNotification: string;\n readonly SignInWithEthereum: string;\n readonly SmsOtp: string;\n readonly Totp: string;\n readonly UsernamePassword: string;\n };\n} = {\n SupportedAuthenticators: {\n EmailOtp: 'ZW1haWwtb3RwLWF1dGhlbnRpY2F0b3I6TE9DQUw',\n Facebook: 'RmFjZWJvb2tBdXRoZW50aWNhdG9yOkZhY2Vib29r',\n GitHub: 'R2l0aHViQXV0aGVudGljYXRvcjpHaXRIdWI',\n Google: 'R29vZ2xlT0lEQ0F1dGhlbnRpY2F0b3I6R29vZ2xl',\n IdentifierFirst: 'SWRlbnRpZmllckV4ZWN1dG9yOkxPQ0FM',\n LinkedIn: 'TGlua2VkSW5PSURDOkxpbmtlZElu',\n MagicLink: 'TWFnaWNMaW5rQXV0aGVudGljYXRvcjpMT0NBTA',\n Microsoft: 'T3BlbklEQ29ubmVjdEF1dGhlbnRpY2F0b3I6TWljcm9zb2Z0',\n Passkey: 'RklET0F1dGhlbnRpY2F0b3I6TE9DQUw',\n PushNotification: 'cHVzaC1ub3RpZmljYXRpb24tYXV0aGVudGljYXRvcjpMT0NBTA',\n SignInWithEthereum: 'T3BlbklEQ29ubmVjdEF1dGhlbnRpY2F0b3I6U2lnbiBJbiBXaXRoIEV0aGVyZXVt',\n SmsOtp: 'c21zLW90cC1hdXRoZW50aWNhdG9yOkxPQ0FM',\n Totp: 'dG90cDpMT0NBTA',\n UsernamePassword: 'QmFzaWNBdXRoZW50aWNhdG9yOkxPQ0FM',\n },\n} as const;\n\nexport default ApplicationNativeAuthenticationConstants;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Constants for vendor-specific configurations.\n * By default, the vendor is inferred as Asgardeo.\n *\n * @example\n * ```typescript\n * // Using the vendor prefix in a URL\n * const apiUrl = `${VendorConstants.VENDOR_PREFIX}/api/v1/resource`;\n * ```\n */\nconst VendorConstants: {\n VENDOR_PREFIX: string;\n} = {\n /**\n * The prefix used for vendor-specific API endpoints, CSS classes, or other identifiers.\n */\n VENDOR_PREFIX: 'asgardeo',\n} as const;\n\nexport default VendorConstants;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport interface EmbeddedSignInFlowInitiateResponse {\n flowId: string;\n flowStatus: EmbeddedSignInFlowStatus;\n flowType: EmbeddedSignInFlowType;\n links: EmbeddedSignInFlowLink[];\n nextStep: {\n authenticators: EmbeddedSignInFlowAuthenticator[];\n stepType: EmbeddedSignInFlowStepType;\n };\n}\n\nexport enum EmbeddedSignInFlowStatus {\n FailCompleted = 'FAIL_COMPLETED',\n FailIncomplete = 'FAIL_INCOMPLETE',\n Incomplete = 'INCOMPLETE',\n SuccessCompleted = 'SUCCESS_COMPLETED',\n}\n\nexport enum EmbeddedSignInFlowType {\n Authentication = 'AUTHENTICATION',\n}\n\nexport enum EmbeddedSignInFlowStepType {\n AuthenticatorPrompt = 'AUTHENTICATOR_PROMPT',\n MultiOptionsPrompt = 'MULTI_OPTIONS_PROMPT',\n}\n\nexport interface EmbeddedSignInFlowAuthenticator {\n authenticator: string;\n authenticatorId: string;\n idp: string;\n metadata: {\n i18nKey: string;\n params: {\n confidential: boolean;\n displayName: string;\n i18nKey: string;\n order: number;\n param: string;\n type: EmbeddedSignInFlowAuthenticatorParamType;\n }[];\n promptType: EmbeddedSignInFlowAuthenticatorPromptType;\n };\n requiredParams: string[];\n}\n\nexport interface EmbeddedSignInFlowLink {\n href: string;\n method: string;\n name: string;\n}\n\nexport interface EmbeddedSignInFlowHandleRequestPayload {\n flowId: string;\n selectedAuthenticator: {\n authenticatorId: string;\n params: Record<string, string>;\n };\n}\n\nexport interface EmbeddedSignInFlowHandleResponse {\n authData: Record<string, any>;\n flowStatus: string;\n}\n\nexport enum EmbeddedSignInFlowAuthenticatorParamType {\n Integer = 'INTEGER',\n MultiValued = 'MULTI_VALUED',\n String = 'STRING',\n}\n\nexport enum EmbeddedSignInFlowAuthenticatorExtendedParamType {\n Otp = 'OTPCode',\n}\n\nexport enum EmbeddedSignInFlowAuthenticatorKnownIdPType {\n Local = 'LOCAL',\n}\n\nexport enum EmbeddedSignInFlowAuthenticatorPromptType {\n /**\n * Prompt for internal system use, such as API keys or tokens.\n */\n InternalPrompt = 'INTERNAL_PROMPT',\n /**\n * Prompt for redirection to another page or service.\n */\n RedirectionPrompt = 'REDIRECTION_PROMPT',\n /**\n * Prompt for user input, typically for username/password or similar credentials.\n */\n UserPrompt = 'USER_PROMPT',\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {EmbeddedFlowExecuteRequestConfig as EmbeddedFlowExecuteRequestConfigV1} from '../embedded-flow';\n\n/**\n * Component types supported by the Asgardeo embedded flow API.\n *\n * These types define the different UI components that can be rendered\n * as part of the embedded authentication flows. Each type corresponds\n * to a specific UI element with its own behavior and properties.\n *\n * @example\n * ```typescript\n * // Check component type to render appropriate UI\n * if (component.type === EmbeddedFlowComponentType.TextInput) {\n * // Render text input field\n * } else if (component.type === EmbeddedFlowComponentType.Action) {\n * // Render button/action\n * }\n * ```\n *\n * @experimental This API may change in future versions\n */\nexport enum EmbeddedFlowComponentType {\n /** Interactive action component (buttons, links) for user interactions */\n Action = 'ACTION',\n\n /** Container block component that groups other components */\n Block = 'BLOCK',\n\n /** Consent component for displaying consent purposes and attributes */\n Consent = 'CONSENT',\n\n /** Copyable text display component that shows text with a copy-to-clipboard action */\n CopyableText = 'COPYABLE_TEXT',\n\n /** Divider component for visual separation of content */\n Divider = 'DIVIDER',\n\n /** Email input field with validation for email addresses. */\n EmailInput = 'EMAIL_INPUT',\n\n /** Icon display component for rendering named vector icons */\n Icon = 'ICON',\n\n /** Image display component for logos and illustrations */\n Image = 'IMAGE',\n\n /** One-time password input field for multi-factor authentication */\n OtpInput = 'OTP_INPUT',\n\n /** Organization unit tree picker for selecting an OU */\n OuSelect = 'OU_SELECT',\n\n /** Password input field with masking for sensitive data */\n PasswordInput = 'PASSWORD_INPUT',\n\n /** Phone number input field with country code support */\n PhoneInput = 'PHONE_INPUT',\n\n /** Rich text display component that renders formatted HTML content */\n RichText = 'RICH_TEXT',\n\n /** Select/dropdown input component for single choice selection */\n Select = 'SELECT',\n\n /** Stack layout component for arranging children in a row or column */\n Stack = 'STACK',\n\n /** Text display component for labels, headings, and messages */\n Text = 'TEXT',\n\n /** Standard text input field for user data entry */\n TextInput = 'TEXT_INPUT',\n\n /** Timer component for displaying a countdown */\n Timer = 'TIMER',\n}\n\n/**\n * Action variant types for buttons and interactive elements.\n *\n * @experimental This API may change in future versions\n */\nexport enum EmbeddedFlowActionVariant {\n /** Danger action button for destructive operations */\n Danger = 'DANGER',\n\n /** Info action button for informational purposes */\n Info = 'INFO',\n\n /** Link-styled action button */\n Link = 'LINK',\n\n /** Outlined action button for secondary emphasis */\n Outlined = 'OUTLINED',\n\n /** Primary action button with highest visual emphasis */\n Primary = 'PRIMARY',\n\n /** Secondary action button with moderate visual emphasis */\n Secondary = 'SECONDARY',\n\n /** Success action button for positive confirmations */\n Success = 'SUCCESS',\n\n /** Tertiary action button with minimal visual emphasis */\n Tertiary = 'TERTIARY',\n\n /** Warning action button for cautionary actions */\n Warning = 'WARNING',\n}\n\n/**\n * Text variant types for typography components.\n *\n * @experimental This API may change in future versions\n */\nexport enum EmbeddedFlowTextVariant {\n /** Primary body text for main content */\n Body1 = 'BODY_1',\n\n /** Secondary body text for supplementary content */\n Body2 = 'BODY_2',\n\n /** Text styled for button labels */\n ButtonText = 'BUTTON_TEXT',\n\n /** Small caption text for annotations and descriptions */\n Caption = 'CAPTION',\n\n /** Largest heading level for main titles */\n Heading1 = 'HEADING_1',\n\n /** Second level heading for major sections */\n Heading2 = 'HEADING_2',\n\n /** Third level heading for subsections */\n Heading3 = 'HEADING_3',\n\n /** Fourth level heading for minor sections */\n Heading4 = 'HEADING_4',\n\n /** Fifth level heading for detailed sections */\n Heading5 = 'HEADING_5',\n\n /** Smallest heading level for fine-grained sections */\n Heading6 = 'HEADING_6',\n\n /** Overline text for labels and categories */\n Overline = 'OVERLINE',\n\n /** Primary subtitle text with larger emphasis */\n Subtitle1 = 'SUBTITLE_1',\n\n /** Secondary subtitle text with moderate emphasis */\n Subtitle2 = 'SUBTITLE_2',\n}\n\n/**\n * Event types for action components.\n *\n * @experimental This API may change in future versions\n */\nexport enum EmbeddedFlowEventType {\n /** Navigate back to the previous step */\n Back = 'BACK',\n\n /** Cancel the current operation */\n Cancel = 'CANCEL',\n\n /** Navigate to a different flow step or page */\n Navigate = 'NAVIGATE',\n\n /** Reset form fields to initial state */\n Reset = 'RESET',\n\n /** Submit form data to the server */\n Submit = 'SUBMIT',\n\n /** Trigger an action or event */\n Trigger = 'TRIGGER',\n}\n\n/**\n * Enhanced component interface for embedded flow components.\n *\n * This interface provides better support for modern form handling and user experience.\n * It includes properties for labels, placeholders, and required field validation\n * that are directly provided by the API response.\n *\n * @example\n * ```typescript\n * const component: EmbeddedFlowComponent = {\n * id: 'username_field',\n * type: EmbeddedFlowComponentType.TextInput,\n * label: 'Username',\n * placeholder: 'Enter your username',\n * required: true,\n * variant: 'TEXT',\n * eventType: 'SUBMIT',\n * components: []\n * };\n * ```\n *\n * @experimental This interface may change in future versions\n */\nexport interface EmbeddedFlowComponent {\n /**\n * Alignment of children along the cross axis (for Stack components).\n */\n align?: string;\n\n /**\n * Alternative text for Image components.\n */\n alt?: string;\n\n /**\n * Icon color, CSS color value (for Icon components).\n */\n color?: string;\n\n /**\n * Nested child components for container components like Block and Stack.\n */\n components?: EmbeddedFlowComponent[];\n\n /**\n * Layout direction for Stack components ('row' | 'column').\n */\n direction?: string;\n\n /**\n * Icon to render at the end of an Action button (URL string).\n */\n endIcon?: string;\n\n /**\n * Event type for action components that defines the interaction behavior.\n * Only relevant for Action components.\n */\n eventType?: EmbeddedFlowEventType | string;\n\n /**\n * Gap between children in Stack components (number, maps to spacing units).\n */\n gap?: number;\n\n /**\n * Height of the component (for Image components, can be string with units or number for pixels).\n * The value depends on the component type (e.g., for Image components).\n */\n height?: string | number;\n\n /**\n * Unique identifier for the component\n */\n id: string;\n\n /**\n * Number of items across the main axis (for Stack grid-like layouts).\n */\n items?: string | number;\n\n /**\n * Justification of children along the main axis (for Stack components).\n */\n justify?: string;\n\n /**\n * Display label for the component (e.g., field label, button text).\n * Supports internationalization and may contain template strings.\n */\n label?: string;\n\n /**\n * Icon name for Icon components (e.g., lucide-react icon names like 'ArrowLeftRight').\n */\n name?: string;\n\n /**\n * Options for SELECT components.\n * Each option can be a string value or an object with value and label.\n */\n options?: Array<string | {label: string; value: string}>;\n\n /**\n * Placeholder text for input components.\n * Provides helpful hints to users about expected input format.\n */\n placeholder?: string;\n\n /**\n * Reference identifier for the component (e.g., field name, action ref)\n */\n ref?: string;\n\n /**\n * Indicates whether this component represents a required field.\n * Used for form validation and UI indicators.\n */\n required?: boolean;\n\n /**\n * Icon size in pixels (for Icon components).\n */\n size?: number;\n\n /**\n * Data source key for dynamic components (e.g., COPYABLE_TEXT).\n * References a key in additionalData whose value is resolved at render time.\n */\n source?: string;\n\n /**\n * Image source URL (for Image components).\n */\n src?: string;\n\n /**\n * Icon to render at the start of an Action button (URL string).\n */\n startIcon?: string;\n\n /**\n * Component type that determines rendering behavior\n */\n type: EmbeddedFlowComponentType | string;\n\n /**\n * Component variant that affects visual styling and behavior.\n * The value depends on the component type (e.g., button variants, text variants).\n */\n variant?: EmbeddedFlowActionVariant | EmbeddedFlowTextVariant | string;\n\n /**\n * Width of the component (for Image components, can be string with units or number for pixels).\n * The value depends on the component type (e.g., for Image components).\n */\n width?: string | number;\n}\n\n/**\n * Response data structure for embedded flow API.\n *\n * This interface defines the structure of data returned by the API,\n * which includes both legacy input/action arrays for backward compatibility\n * and the new meta.components structure for modern component-driven UIs.\n *\n * The key improvement is the meta.components field, which provides\n * a rich component tree with proper labels, placeholders, and hierarchy\n * that can be directly rendered without additional transformation.\n *\n * @example\n * ```typescript\n * const response: EmbeddedFlowResponseData = {\n * // Legacy format (for backward compatibility)\n * inputs: [\n * { ref: 'input_001', identifier: 'username', type: 'TEXT_INPUT', required: true }\n * ],\n * actions: [\n * { ref: 'action_001', nextNode: 'basic_auth', eventType: 'SUBMIT' }\n * ],\n * // Modern format (recommended)\n * meta: {\n * components: [\n * {\n * id: 'text_001',\n * type: 'TEXT',\n * label: '{{ t(signin:heading.label) }}',\n * variant: 'HEADING_1'\n * },\n * {\n * id: 'block_001',\n * type: 'BLOCK',\n * components: [\n * {\n * id: 'input_001',\n * type: 'TEXT_INPUT',\n * label: '{{ t(signin:fields.username.label) }}',\n * placeholder: '{{ t(signin:fields.username.placeholder) }}',\n * required: true\n * },\n * {\n * id: 'action_001',\n * type: 'ACTION',\n * label: '{{ t(signin:buttons.submit.label) }}',\n * variant: 'PRIMARY',\n * eventType: 'ACTIVATE'\n * }\n * ]\n * }\n * ]\n * }\n * };\n * ```\n *\n * @experimental This structure may change in future versions\n */\nexport interface EmbeddedFlowResponseData {\n /**\n * Legacy action definitions for backward compatibility.\n * @deprecated Use meta.components for new implementations\n */\n actions?: {\n /** Event type for the action (SUBMIT, ACTIVATE, etc.) */\n eventType?: string;\n /** Next flow node to navigate to (optional) */\n nextNode?: string;\n /** Reference identifier for the action */\n ref: string;\n }[];\n\n /**\n * Additional data dictionary for dynamic flow response properties.\n * Can be used to pass custom data like passkey challenges, server alerts, etc.\n */\n additionalData?: Record<string, any>;\n\n /**\n * Legacy input definitions for backward compatibility.\n * @deprecated Use meta.components for new implementations\n */\n inputs?: {\n /** Field identifier used in form submission */\n identifier: string;\n /** Reference identifier for the input */\n ref: string;\n /** Whether this input is required for form submission */\n required: boolean;\n /** Input type (TEXT_INPUT, PASSWORD_INPUT, etc.) */\n type: string;\n }[];\n\n /**\n * Modern component-driven metadata structure.\n * This contains the complete UI component tree with proper\n * hierarchy, labels, and configuration that can be directly rendered.\n *\n * **This is the primary data source for implementations.**\n * The legacy inputs/actions arrays are maintained only for backward compatibility.\n */\n meta?: {\n /** Array of components that define the complete UI structure */\n components: EmbeddedFlowComponent[];\n };\n\n /**\n * Optional redirect URL for flow completion or external authentication.\n */\n redirectURL?: string;\n}\n\n/**\n * Individual consent attribute/element decision.\n *\n * @experimental This interface may change in future versions\n */\nexport interface ConsentAttributeElement {\n /** Whether the user approved collection of this attribute */\n approved: boolean;\n /** The name of the attribute being consented */\n name: string;\n}\n\n/**\n * Consent decision for a single purpose.\n *\n * @experimental This interface may change in future versions\n */\nexport interface ConsentPurposeDecision {\n /** Whether the user approved this purpose */\n approved: boolean;\n /** Per-attribute decisions for this purpose */\n elements: ConsentAttributeElement[];\n /** The name of the consent purpose */\n purposeName: string;\n}\n\n/**\n * Full consent decisions structure sent to the backend when user submits the consent form.\n *\n * @experimental This interface may change in future versions\n */\nexport interface ConsentDecisions {\n /** Array of per-purpose decisions */\n purposes: ConsentPurposeDecision[];\n}\n\n/**\n * Single consent purpose data returned by the backend in additionalData.consent_prompt.\n *\n * @experimental This interface may change in future versions\n */\nexport interface ConsentPurposeData {\n /** Optional human-readable description of the purpose */\n description?: string;\n /** Attributes that are always required and cannot be declined */\n essential: string[];\n /** Attributes that the user can optionally decline */\n optional: string[];\n /** Unique identifier for the purpose */\n purposeId: string;\n /** Human-readable purpose name */\n purposeName?: string;\n}\n\n/**\n * Consent prompt data structure stored in additionalData.consent_prompt.\n *\n * @experimental This interface may change in future versions\n */\nexport interface ConsentPromptData {\n /** Array of consent purposes requiring user review */\n purposes: ConsentPurposeData[];\n}\n\n/**\n * Extended request configuration for Asgardeo V2 embedded flow operations.\n *\n * This interface extends the base request configuration with V2-specific\n * properties required for the enhanced embedded flow API. The authId parameter\n * is particularly important for the V2 OAuth2 flow completion process.\n *\n * @template T The type of the payload data being sent with the request\n *\n * @example\n * ```typescript\n * const config: EmbeddedFlowExecuteRequestConfigV2 = {\n * baseUrl: 'https://api.asgardeo.io/t/myorg',\n * payload: {\n * flowType: 'AUTHENTICATION',\n * inputs: { username: 'user@example.com' }\n * },\n * authId: 'auth_12345', // V2-specific for OAuth completion\n * headers: {\n * 'Authorization': 'Bearer token'\n * }\n * };\n * ```\n *\n * @experimental This configuration is part of the new Asgardeo V2 platform\n */\nexport interface EmbeddedFlowExecuteRequestConfig<T = any> extends EmbeddedFlowExecuteRequestConfigV1<T> {\n /**\n * Authentication ID used for OAuth2 flow completion in V2 API.\n *\n * When the embedded flow completes successfully and returns an assertion,\n * this authId is used to complete the OAuth2 authorization flow by calling\n * the `/oauth2/auth/callback` endpoint. This enables seamless transition from\n * embedded flow to traditional OAuth2 flow completion.\n *\n * @example \"auth_abc123def456\"\n */\n authId?: string;\n}\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * The type of entity to retrieve flow metadata for.\n *\n * @example\n * ```typescript\n * const config: GetFlowMetaRequestConfig = {\n * baseUrl: 'https://localhost:8090',\n * type: FlowMetaType.App,\n * id: '60a9b38b-6eba-9f9e-55f9-267067de4680',\n * };\n * ```\n *\n * @experimental This API may change in future versions\n */\nexport enum FlowMetaType {\n /** Retrieve metadata scoped to a specific application */\n App = 'APP',\n\n /** Retrieve metadata scoped to a specific organization unit */\n Ou = 'OU',\n}\n\n/**\n * Application metadata returned when `type=APP`.\n *\n * @experimental This API may change in future versions\n */\nexport interface ApplicationMetadata {\n /** Application UUID */\n id: string;\n\n /** URL of the application logo */\n logoUrl?: string;\n\n /** Human-readable application name */\n name: string;\n\n /** Privacy Policy URI */\n policyUri?: string;\n\n /** Terms of Service URI */\n tosUri?: string;\n\n /** Application home URL */\n url?: string;\n}\n\n/**\n * Organization unit metadata.\n *\n * Always present when `type=OU`. For `type=APP`, only included when the\n * deployment has exactly one organization unit.\n *\n * @experimental This API may change in future versions\n */\nexport interface OUMetadata {\n /** Cookie Policy URI */\n cookiePolicyUri?: string;\n\n /** Optional description of the organization unit */\n description?: string;\n\n /** Unique handle / slug for the organization unit */\n handle: string;\n\n /** Organization unit UUID */\n id: string;\n\n /** URL of the organization unit logo */\n logoUrl?: string;\n\n /** Human-readable organization unit name */\n name: string;\n\n /** Privacy Policy URI */\n policyUri?: string;\n\n /** Terms of Service URI */\n tosUri?: string;\n}\n\n/**\n * A single color entry in the v2 theme color scheme.\n *\n * @experimental This API may change in future versions\n */\nexport interface FlowMetaThemeColorSet {\n /** Text color that contrasts against this color */\n contrastText?: string;\n\n /** The darker variant of the color */\n dark?: string;\n\n /** The main/primary variant of the color */\n main: string;\n}\n\n/**\n * Background colors in a v2 theme color scheme.\n *\n * @experimental This API may change in future versions\n */\nexport interface FlowMetaThemeBackground {\n /** Default background color (maps to body background) */\n default?: string;\n\n /** Surface / paper background color */\n paper?: string;\n}\n\n/**\n * Text colors in a v2 theme color scheme.\n *\n * @experimental This API may change in future versions\n */\nexport interface FlowMetaThemeTextColors {\n /** Primary text color */\n primary?: string;\n\n /** Secondary / muted text color */\n secondary?: string;\n}\n\n/**\n * All colors defined for a single v2 theme color scheme (light or dark).\n *\n * @experimental This API may change in future versions\n */\nexport interface FlowMetaThemeColors {\n /** Background colors for the theme (e.g., body, paper) */\n background?: FlowMetaThemeBackground;\n\n /** Primary color set for the theme */\n primary?: FlowMetaThemeColorSet;\n\n /** Secondary color set for the theme */\n secondary?: FlowMetaThemeColorSet;\n\n /** Text colors for the theme */\n text?: FlowMetaThemeTextColors;\n}\n\n/**\n * A single color scheme (light or dark) in the v2 theme.\n *\n * @experimental This API may change in future versions\n */\nexport interface FlowMetaThemeColorScheme {\n /** All colors defined for this color scheme (light or dark) */\n palette: FlowMetaThemeColors;\n}\n\n/**\n * Shape / geometry configuration in the v2 theme.\n *\n * @experimental This API may change in future versions\n */\nexport interface FlowMetaThemeShape {\n /** Border radius in pixels applied uniformly across components */\n borderRadius?: number;\n}\n\n/**\n * Typography configuration in the v2 theme.\n *\n * @experimental This API may change in future versions\n */\nexport interface FlowMetaThemeTypography {\n /** CSS font-family string */\n fontFamily?: string;\n}\n\n/**\n * Resolved theme configuration returned inside the flow metadata response.\n *\n * Maps to the `design.theme` field of {@link FlowMetadataResponse}.\n *\n * @experimental This API may change in future versions\n */\nexport interface FlowMetaTheme {\n /** Per-scheme color definitions (light and dark) */\n colorSchemes?: {\n /** Dark color scheme */\n dark?: FlowMetaThemeColorScheme;\n /** Light color scheme */\n light?: FlowMetaThemeColorScheme;\n };\n\n /** The color scheme to apply by default */\n defaultColorScheme?: 'light' | 'dark';\n\n /** Text direction for the theme */\n direction?: 'ltr' | 'rtl';\n\n /** Shape/geometry configuration for the theme */\n shape?: FlowMetaThemeShape;\n\n /** Typography configuration for the theme */\n typography?: FlowMetaThemeTypography;\n}\n\n/**\n * Resolved design configuration (theme and layout) for the flow.\n *\n * @experimental This API may change in future versions\n */\nexport interface DesignMetadata {\n /** Resolved layout configuration (shape is server-defined) */\n layout: Record<string, unknown>;\n\n /** Resolved theme configuration for the flow */\n theme: FlowMetaTheme;\n}\n\n/**\n * Internationalisation metadata for the flow.\n *\n * @experimental This API may change in future versions\n */\nexport interface I18nMetadata {\n /** The language used for the returned translations (defaults to `en`) */\n language: string;\n\n /** List of all available language tags (BCP 47) for the entity */\n languages: string[];\n\n /** Total number of translation keys returned */\n totalResults?: number;\n\n /**\n * Translations organised by namespace.\n *\n * @example\n * ```json\n * {\n * \"auth\": {\n * \"login.button\": \"Login\",\n * \"login.title\": \"Welcome\"\n * }\n * }\n * ```\n */\n translations: Record<string, Record<string, string>>;\n}\n\n/**\n * Aggregated flow metadata response returned by `GET /flow/meta`.\n *\n * @experimental This API may change in future versions\n */\nexport interface FlowMetadataResponse {\n /**\n * Application metadata.\n * Only present when `type=APP`.\n */\n application?: ApplicationMetadata;\n\n /** Resolved design configuration */\n design: DesignMetadata;\n\n /** Internationalisation metadata and translations */\n i18n: I18nMetadata;\n\n /** Indicates whether the registration flow is enabled for the entity */\n isRegistrationFlowEnabled: boolean;\n\n /**\n * Organization unit metadata.\n * Always present when `type=OU`.\n * For `type=APP`, only present when the deployment has exactly one OU.\n */\n ou?: OUMetadata;\n}\n\n/**\n * Request configuration for `getFlowMetaV2`.\n *\n * @example\n * ```typescript\n * const config: GetFlowMetaRequestConfig = {\n * baseUrl: 'https://localhost:8090',\n * type: FlowMetaType.App,\n * id: '60a9b38b-6eba-9f9e-55f9-267067de4680',\n * language: 'en',\n * namespace: 'auth',\n * };\n * ```\n *\n * @experimental This API may change in future versions\n */\nexport interface GetFlowMetaRequestConfig extends Omit<Partial<RequestInit>, 'method' | 'body'> {\n /**\n * Base URL of the Flow API server (e.g. `https://localhost:8090`).\n * Either `baseUrl` or `url` must be provided.\n */\n baseUrl?: string;\n\n /**\n * UUID of the entity (application ID or organization unit ID).\n * Optional \u2014 when omitted the server returns i18n-only metadata (e.g. for flows\n * like AcceptInvite that are not tied to a specific application or OU).\n */\n id?: string;\n\n /**\n * Language tag in BCP 47 format for i18n translations.\n * Defaults to `en` on the server side when omitted.\n *\n * @example \"en\", \"es\", \"fr-CA\"\n */\n language?: string;\n\n /**\n * Filter translations by a specific namespace.\n *\n * @example \"auth\", \"errors\", \"common\"\n */\n namespace?: string;\n\n /**\n * The type of entity to retrieve metadata for.\n * Optional \u2014 must be omitted together with `id` for flows that are not\n * associated with a specific application or OU (e.g. AcceptInvite).\n */\n type?: FlowMetaType;\n\n /**\n * Fully qualified URL of the `/flow/meta` endpoint.\n * When provided, `baseUrl` is ignored.\n */\n url?: string;\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport enum FlowMode {\n /**\n * This mode is suitable for embedded sign-in, sign-up, etc. flows where the authentication\n * UIs are rendered within the application.\n * @see {@link https://is.docs.wso2.com/en/7.1.0/references/app-native-authentication/}\n */\n Embedded = 'DIRECT',\n /**\n * Traditional redirect based sign-in, sign-up, etc. flows where the authentication\n * UIs are from a external Identity Provider (ex: WSO2 Identity Server or Asgardeo).\n */\n Redirect = 'REDIRECTION',\n}\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Interface representing the configuration for an agent.\n */\nexport interface AgentConfig {\n /**\n * The unique identifier for the agent\n */\n agentID: string;\n /**\n * The secret credential for the agent\n */\n agentSecret: string;\n /**\n * The authenticator name to match during the embedded sign-in flow.\n * Defaults to {@link AgentConfig.DEFAULT_AUTHENTICATOR_NAME} if not provided.\n */\n authenticatorName?: string;\n}\n\n/**\n * Namespace that holds constants related to {@link AgentConfig}.\n */\nexport namespace AgentConfig {\n /**\n * Default authenticator name used when none is specified.\n */\n export const DEFAULT_AUTHENTICATOR_NAME: string = 'Username & Password';\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport interface SchemaAttribute {\n caseExact: boolean;\n description?: string;\n displayName?: string;\n displayOrder?: string;\n multiValued: boolean;\n mutability: string;\n name: string;\n regEx?: string;\n required?: boolean;\n returned: string;\n sharedProfileValueResolvingMethod?: string;\n subAttributes?: SchemaAttribute[];\n supportedByDefault?: string;\n type: string;\n uniqueness: string;\n}\n\n/**\n * Represents a SCIM2 schema definition\n */\nexport interface Schema {\n /** Schema attributes */\n attributes: SchemaAttribute[];\n /** Schema description */\n description: string;\n /** Schema identifier */\n id: string;\n /** Schema name */\n name: string;\n}\n\nexport interface FlattenedSchema extends Schema {\n schemaId: string;\n}\n\n/**\n * Well-known SCIM2 schema IDs\n */\nexport enum WellKnownSchemaIds {\n /** Core Schema */\n Core = 'urn:ietf:params:scim:schemas:core:2.0',\n /** Custom User Schema */\n CustomUser = 'urn:scim:schemas:extension:custom:User',\n /** Enterprise User Schema */\n EnterpriseUser = 'urn:ietf:params:scim:schemas:extension:enterprise:2.0:User',\n /** System User Schema */\n SystemUser = 'urn:scim:wso2:schema',\n /** User Schema */\n User = 'urn:ietf:params:scim:schemas:core:2.0:User',\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport enum FieldType {\n Checkbox = 'CHECKBOX',\n Date = 'DATE',\n Email = 'EMAIL',\n Number = 'NUMBER',\n Otp = 'OTP',\n Password = 'PASSWORD',\n Radio = 'RADIO',\n Select = 'SELECT',\n Tel = 'TEL',\n Text = 'TEXT',\n Textarea = 'TEXTAREA',\n Time = 'TIME',\n}\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport class DefaultCacheStore implements Storage {\n private cache: Map<string, string>;\n\n constructor() {\n this.cache = new Map<string, string>();\n }\n\n public get length(): number {\n return this.cache.size;\n }\n\n public getItem(key: string): string | null {\n return this.cache.get(key) ?? null;\n }\n\n public setItem(key: string, value: string): void {\n this.cache.set(key, value);\n }\n\n public removeItem(key: string): void {\n this.cache.delete(key);\n }\n\n public clear(): void {\n this.cache.clear();\n }\n\n public key(index: number): string | null {\n const keys: string[] = Array.from(this.cache.keys());\n return keys[index] ?? null;\n }\n\n public async setData(key: string, value: string): Promise<void> {\n this.cache.set(key, value);\n }\n\n public async getData(key: string): Promise<string> {\n return this.cache.get(key) ?? '{}';\n }\n\n public async removeData(key: string): Promise<void> {\n this.cache.delete(key);\n }\n}\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport * as jose from 'jose';\nimport {Crypto, JWKInterface} from './models/crypto';\n\n/**\n * Default implementation of the Crypto interface using the 'jose' library\n * and the native Web Crypto API.\n */\nexport class DefaultCrypto implements Crypto<Uint8Array> {\n // eslint-disable-next-line class-methods-use-this\n public base64URLDecode(value: string): string {\n const decodedArray: Uint8Array = jose.base64url.decode(value);\n return new TextDecoder().decode(decodedArray);\n }\n\n // eslint-disable-next-line class-methods-use-this\n public base64URLEncode(value: Uint8Array): string {\n return jose.base64url.encode(value);\n }\n\n // eslint-disable-next-line class-methods-use-this\n public generateRandomBytes(length: number): Uint8Array {\n return crypto.getRandomValues(new Uint8Array(length));\n }\n\n // eslint-disable-next-line class-methods-use-this\n public async hashSha256(data: string): Promise<Uint8Array> {\n const encoder: TextEncoder = new TextEncoder();\n const dataBuffer: Uint8Array = encoder.encode(data);\n const hashBuffer: ArrayBuffer = await crypto.subtle.digest('SHA-256', dataBuffer);\n\n return new Uint8Array(hashBuffer);\n }\n\n // eslint-disable-next-line class-methods-use-this\n public async verifyJwt(\n idToken: string,\n jwk: JWKInterface,\n algorithms: string[],\n clientId: string,\n issuer: string,\n subject: string,\n clockTolerance?: number,\n validateJwtIssuer: boolean = true,\n ): Promise<boolean> {\n const key: jose.KeyLike | Uint8Array = await jose.importJWK(jwk as jose.JWK);\n\n await jose.jwtVerify(idToken, key, {\n algorithms,\n audience: [clientId],\n clockTolerance,\n issuer: validateJwtIssuer ? issuer : undefined,\n subject,\n });\n\n return true;\n }\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {AsgardeoAuthClient} from './__legacy__/client';\nimport {AuthClientConfig} from './__legacy__/models/client-config';\nimport executeEmbeddedSignInFlow from './api/executeEmbeddedSignInFlow';\nimport initializeEmbeddedSignInFlow from './api/initializeEmbeddedSignInFlow';\nimport {DefaultCacheStore} from './DefaultCacheStore';\nimport {DefaultCrypto} from './DefaultCrypto';\nimport {AgentConfig} from './models/agent';\nimport {AuthCodeResponse} from './models/auth-code-response';\nimport {AsgardeoClient} from './models/client';\nimport {Config, SignInOptions, SignOutOptions, SignUpOptions} from './models/config';\nimport {Crypto} from './models/crypto';\nimport {\n EmbeddedFlowExecuteRequestConfig,\n EmbeddedFlowExecuteRequestPayload,\n EmbeddedFlowExecuteResponse,\n} from './models/embedded-flow';\nimport {\n EmbeddedSignInFlowAuthenticator,\n EmbeddedSignInFlowHandleResponse,\n EmbeddedSignInFlowInitiateResponse,\n EmbeddedSignInFlowStatus,\n} from './models/embedded-signin-flow';\nimport {OIDCDiscoveryApiResponse} from './models/oidc-discovery';\nimport {AllOrganizationsApiResponse, Organization} from './models/organization';\nimport {Storage} from './models/store';\nimport {TokenExchangeRequestConfig, TokenResponse} from './models/token';\nimport {User, UserProfile} from './models/user';\nimport StorageManager from './StorageManager';\n\nclass AsgardeoJavaScriptClient<T = Config> implements AsgardeoClient<T> {\n private cacheStore: Storage;\n\n private cryptoUtils: Crypto;\n\n private auth: AsgardeoAuthClient<T>;\n\n private storageManager: StorageManager<T>;\n\n private baseURL: string;\n\n constructor(config?: AuthClientConfig<T>, cacheStore?: Storage, cryptoUtils?: Crypto) {\n this.cacheStore = cacheStore ?? new DefaultCacheStore();\n this.cryptoUtils = cryptoUtils ?? new DefaultCrypto();\n this.auth = new AsgardeoAuthClient();\n\n if (config) {\n this.auth.initialize(config, this.cacheStore, this.cryptoUtils);\n this.storageManager = this.auth.getStorageManager();\n }\n\n this.baseURL = config?.baseUrl ?? '';\n }\n\n public async getDiscoveryResponse(): Promise<OIDCDiscoveryApiResponse | null> {\n if (!this.storageManager) {\n return null;\n }\n\n return this.storageManager.loadOpenIDProviderConfiguration();\n }\n\n /* eslint-disable class-methods-use-this, @typescript-eslint/no-unused-vars */\n switchOrganization(_organization: Organization, _sessionId?: string): Promise<TokenResponse | Response> {\n throw new Error('Method not implemented.');\n }\n\n initialize(_config: T, _storage?: Storage): Promise<boolean> {\n throw new Error('Method not implemented.');\n }\n\n reInitialize(_config: Partial<T>): Promise<boolean> {\n throw new Error('Method not implemented.');\n }\n\n getUser(_options?: any): Promise<User> {\n throw new Error('Method not implemented.');\n }\n\n getAllOrganizations(_options?: any, _sessionId?: string): Promise<AllOrganizationsApiResponse> {\n throw new Error('Method not implemented.');\n }\n\n getMyOrganizations(_options?: any, _sessionId?: string): Promise<Organization[]> {\n throw new Error('Method not implemented.');\n }\n\n getCurrentOrganization(_sessionId?: string): Promise<Organization | null> {\n throw new Error('Method not implemented.');\n }\n\n getUserProfile(_options?: any): Promise<UserProfile> {\n throw new Error('Method not implemented.');\n }\n\n isLoading(): boolean {\n throw new Error('Method not implemented.');\n }\n\n isSignedIn(): Promise<boolean> {\n throw new Error('Method not implemented.');\n }\n\n updateUserProfile(_payload: any, _userId?: string): Promise<User> {\n throw new Error('Method not implemented.');\n }\n\n getConfiguration(): T {\n throw new Error('Method not implemented.');\n }\n\n exchangeToken(_config: TokenExchangeRequestConfig, _sessionId?: string): Promise<TokenResponse | Response> {\n throw new Error('Method not implemented.');\n }\n\n signInSilently(_options?: SignInOptions): Promise<User | boolean> {\n throw new Error('Method not implemented.');\n }\n\n getAccessToken(_sessionId?: string): Promise<string> {\n throw new Error('Method not implemented.');\n }\n\n clearSession(_sessionId?: string): void {\n throw new Error('Method not implemented.');\n }\n\n setSession(_sessionData: Record<string, unknown>, _sessionId?: string): Promise<void> {\n throw new Error('Method not implemented.');\n }\n\n decodeJwtToken<R = Record<string, unknown>>(_token: string): Promise<R> {\n throw new Error('Method not implemented.');\n }\n\n signIn(_options?: SignInOptions): Promise<User> {\n throw new Error('Method not implemented.');\n }\n\n signOut(\n _options?: SignOutOptions,\n _sessionIdOrAfterSignOut?: string | ((afterSignOutUrl: string) => void),\n _afterSignOut?: (afterSignOutUrl: string) => void,\n ): Promise<string> {\n throw new Error('Method not implemented.');\n }\n\n signUp(options?: SignUpOptions): Promise<void>;\n\n signUp(payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse>;\n\n signUp(\n _optionsOrPayload?: SignUpOptions | EmbeddedFlowExecuteRequestPayload,\n ): Promise<void | EmbeddedFlowExecuteResponse> {\n throw new Error('Method not implemented.');\n }\n /* eslint-enable class-methods-use-this, @typescript-eslint/no-unused-vars */\n\n public async getAgentToken(agentConfig: AgentConfig): Promise<TokenResponse> {\n const customParam: Record<string, string> = {\n response_mode: 'direct',\n };\n\n const authorizeURL: URL = new URL(await this.auth.getSignInUrl(customParam));\n\n const authorizeResponse: EmbeddedSignInFlowInitiateResponse = await initializeEmbeddedSignInFlow({\n payload: Object.fromEntries(authorizeURL.searchParams.entries()),\n url: `${authorizeURL.origin}${authorizeURL.pathname}`,\n });\n\n const authenticatorName: string = agentConfig.authenticatorName ?? AgentConfig.DEFAULT_AUTHENTICATOR_NAME;\n\n const targetAuthenticator: EmbeddedSignInFlowAuthenticator | undefined =\n authorizeResponse.nextStep.authenticators.find(\n (auth: EmbeddedSignInFlowAuthenticator) => auth.authenticator === authenticatorName,\n );\n\n if (!targetAuthenticator) {\n throw new Error(`Authenticator '${authenticatorName}' not found among authentication steps.`);\n }\n\n const authnRequest: EmbeddedFlowExecuteRequestConfig = {\n baseUrl: this.baseURL,\n payload: {\n flowId: authorizeResponse.flowId,\n selectedAuthenticator: {\n authenticatorId: targetAuthenticator.authenticatorId,\n params: {\n password: agentConfig.agentSecret,\n username: agentConfig.agentID,\n },\n },\n },\n };\n\n const authnResponse: EmbeddedSignInFlowHandleResponse = await executeEmbeddedSignInFlow(authnRequest);\n\n if (authnResponse.flowStatus !== EmbeddedSignInFlowStatus.SuccessCompleted) {\n throw new Error('Agent authentication failed.');\n }\n\n return this.auth.requestAccessToken(\n authnResponse.authData['code'],\n authnResponse.authData['session_state'],\n authnResponse.authData['state'],\n );\n }\n\n public async getOBOSignInURL(agentConfig: AgentConfig): Promise<string> {\n const customParam: Record<string, string> = {\n requested_actor: agentConfig.agentID,\n };\n\n const authURL: string | undefined = await this.auth.getSignInUrl(customParam);\n\n if (authURL) {\n return authURL.toString();\n }\n\n throw new Error('Could not build Authorize URL');\n }\n\n public async getOBOToken(agentConfig: AgentConfig, authCodeResponse: AuthCodeResponse): Promise<TokenResponse> {\n const agentToken: TokenResponse = await this.getAgentToken(agentConfig);\n\n const tokenRequestConfig: {params: {actor_token: string}} = {\n params: {\n actor_token: agentToken.accessToken,\n },\n };\n\n return this.auth.requestAccessToken(\n authCodeResponse.code,\n authCodeResponse.session_state,\n authCodeResponse.state,\n undefined,\n tokenRequestConfig,\n );\n }\n}\n\nexport default AsgardeoJavaScriptClient;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {Theme, ThemeConfig, ThemeImage, ThemeMode, ThemeVars} from './types';\nimport VendorConstants from '../constants/VendorConstants';\nimport {RecursivePartial} from '../models/utility-types';\n\nconst lightTheme: ThemeConfig = {\n borderRadius: {\n large: '16px',\n medium: '8px',\n small: '4px',\n },\n colors: {\n action: {\n activatedOpacity: 0.12,\n active: 'rgba(0, 0, 0, 0.54)',\n disabled: 'rgba(0, 0, 0, 0.26)',\n disabledBackground: 'rgba(0, 0, 0, 0.12)',\n disabledOpacity: 0.38,\n focus: 'rgba(0, 0, 0, 0.12)',\n focusOpacity: 0.12,\n hover: 'rgba(0, 0, 0, 0.04)',\n hoverOpacity: 0.04,\n selected: 'rgba(0, 0, 0, 0.08)',\n selectedOpacity: 0.08,\n },\n background: {\n body: {\n dark: '#212121',\n main: '#1a1a1a',\n },\n dark: '#212121',\n disabled: '#f0f0f0',\n surface: '#ffffff',\n },\n border: '#e0e0e0',\n error: {\n contrastText: '#d52828',\n dark: '#b71c1c',\n light: '#fef2f2',\n main: '#d32f2f',\n },\n info: {\n contrastText: '#43aeda',\n dark: '#01579b',\n light: '#eff6ff',\n main: '#bbebff',\n },\n primary: {\n contrastText: '#ffffff',\n dark: '#174ea6',\n main: '#1a73e8',\n },\n secondary: {\n contrastText: '#ffffff',\n dark: '#212121',\n light: '#f3f4f6',\n main: '#424242',\n },\n success: {\n contrastText: '#00a807',\n dark: '#388e3c',\n light: '#f0fdf4',\n main: '#4caf50',\n },\n text: {\n dark: '#212121',\n primary: '#1a1a1a',\n secondary: '#666666',\n },\n warning: {\n contrastText: '#be7100',\n dark: '#f57c00',\n light: '#fffbeb',\n main: '#ff9800',\n },\n },\n images: {\n favicon: {},\n logo: {},\n },\n shadows: {\n large: '0 8px 32px rgba(0, 0, 0, 0.2)',\n medium: '0 4px 16px rgba(0, 0, 0, 0.15)',\n small: '0 2px 8px rgba(0, 0, 0, 0.1)',\n },\n spacing: {\n unit: 8,\n },\n typography: {\n fontFamily: '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n fontSizes: {\n '2xl': '1.5rem', // 24px\n '3xl': '2.125rem', // 34px\n lg: '1.125rem', // 18px\n md: '1rem', // 16px\n sm: '0.875rem', // 14px\n xl: '1.25rem', // 20px\n xs: '0.75rem', // 12px\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n normal: 400,\n semibold: 600,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n },\n};\n\nconst darkTheme: ThemeConfig = {\n borderRadius: {\n large: '16px',\n medium: '8px',\n small: '4px',\n },\n colors: {\n action: {\n activatedOpacity: 0.12,\n active: '#1c1c1c',\n disabled: 'rgba(255, 255, 255, 0.26)',\n disabledBackground: 'rgba(255, 255, 255, 0.12)',\n disabledOpacity: 0.38,\n focus: '#1c1c1c',\n focusOpacity: 0.12,\n hover: '#1c1c1c',\n hoverOpacity: 0.04,\n selected: '#1c1c1c',\n selectedOpacity: 0.08,\n },\n background: {\n body: {\n dark: '#212121',\n main: '#ffffff',\n },\n dark: '#212121',\n disabled: '#1f1f1f',\n surface: '#121212',\n },\n border: '#404040',\n error: {\n contrastText: '#d52828',\n dark: '#b71c1c',\n light: '#2d1515',\n main: '#d32f2f',\n },\n info: {\n contrastText: '#43aeda',\n dark: '#01579b',\n light: '#0f1f35',\n main: '#bbebff',\n },\n primary: {\n contrastText: '#ffffff',\n dark: '#174ea6',\n main: '#1a73e8',\n },\n secondary: {\n contrastText: '#ffffff',\n dark: '#212121',\n light: '#2a2a2a',\n main: '#8b8b8b',\n },\n success: {\n contrastText: '#00a807',\n dark: '#388e3c',\n light: '#132d1a',\n main: '#4caf50',\n },\n text: {\n dark: '#212121',\n primary: '#ffffff',\n secondary: '#b3b3b3',\n },\n warning: {\n contrastText: '#be7100',\n dark: '#f57c00',\n light: '#2d2310',\n main: '#ff9800',\n },\n },\n images: {\n favicon: {},\n logo: {},\n },\n shadows: {\n large: '0 8px 32px rgba(0, 0, 0, 0.5)',\n medium: '0 4px 16px rgba(0, 0, 0, 0.4)',\n small: '0 2px 8px rgba(0, 0, 0, 0.3)',\n },\n spacing: {\n unit: 8,\n },\n typography: {\n fontFamily: '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n fontSizes: {\n '2xl': '1.5rem', // 24px\n '3xl': '2.125rem', // 34px\n lg: '1.125rem', // 18px\n md: '1rem', // 16px\n sm: '0.875rem', // 14px\n xl: '1.25rem', // 20px\n xs: '0.75rem', // 12px\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n normal: 400,\n semibold: 600,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n },\n};\n\nconst toCssVariables = (theme: ThemeConfig): Record<string, string> => {\n const cssVars: Record<string, string> = {};\n const prefix: string = theme.cssVarPrefix || VendorConstants.VENDOR_PREFIX;\n\n // Colors - Action\n if (theme.colors?.action?.active) {\n cssVars[`--${prefix}-color-action-active`] = theme.colors.action.active;\n }\n if (theme.colors?.action?.hover) {\n cssVars[`--${prefix}-color-action-hover`] = theme.colors.action.hover;\n }\n if (theme.colors?.action?.hoverOpacity !== undefined) {\n cssVars[`--${prefix}-color-action-hoverOpacity`] = theme.colors.action.hoverOpacity.toString();\n }\n if (theme.colors?.action?.selected) {\n cssVars[`--${prefix}-color-action-selected`] = theme.colors.action.selected;\n }\n if (theme.colors?.action?.selectedOpacity !== undefined) {\n cssVars[`--${prefix}-color-action-selectedOpacity`] = theme.colors.action.selectedOpacity.toString();\n }\n if (theme.colors?.action?.disabled) {\n cssVars[`--${prefix}-color-action-disabled`] = theme.colors.action.disabled;\n }\n if (theme.colors?.action?.disabledBackground) {\n cssVars[`--${prefix}-color-action-disabledBackground`] = theme.colors.action.disabledBackground;\n }\n if (theme.colors?.action?.disabledOpacity !== undefined) {\n cssVars[`--${prefix}-color-action-disabledOpacity`] = theme.colors.action.disabledOpacity.toString();\n }\n if (theme.colors?.action?.focus) {\n cssVars[`--${prefix}-color-action-focus`] = theme.colors.action.focus;\n }\n if (theme.colors?.action?.focusOpacity !== undefined) {\n cssVars[`--${prefix}-color-action-focusOpacity`] = theme.colors.action.focusOpacity.toString();\n }\n if (theme.colors?.action?.activatedOpacity !== undefined) {\n cssVars[`--${prefix}-color-action-activatedOpacity`] = theme.colors.action.activatedOpacity.toString();\n }\n\n // Colors - Primary\n if (theme.colors?.primary?.main) {\n cssVars[`--${prefix}-color-primary-main`] = theme.colors.primary.main;\n }\n if (theme.colors?.primary?.contrastText) {\n cssVars[`--${prefix}-color-primary-contrastText`] = theme.colors.primary.contrastText;\n }\n\n // Colors - Secondary\n if (theme.colors?.secondary?.main) {\n cssVars[`--${prefix}-color-secondary-main`] = theme.colors.secondary.main;\n }\n if (theme.colors?.secondary?.contrastText) {\n cssVars[`--${prefix}-color-secondary-contrastText`] = theme.colors.secondary.contrastText;\n }\n if (theme.colors?.secondary?.light) {\n cssVars[`--${prefix}-color-secondary-light`] = theme.colors.secondary.light;\n }\n\n // Colors - Background\n if (theme.colors?.background?.surface) {\n cssVars[`--${prefix}-color-background-surface`] = theme.colors.background.surface;\n }\n if (theme.colors?.background?.disabled) {\n cssVars[`--${prefix}-color-background-disabled`] = theme.colors.background.disabled;\n }\n if (theme.colors?.background?.body?.main) {\n cssVars[`--${prefix}-color-background-body-main`] = theme.colors.background.body.main;\n }\n\n // Colors - Error\n if (theme.colors?.error?.main) {\n cssVars[`--${prefix}-color-error-main`] = theme.colors.error.main;\n }\n if (theme.colors?.error?.contrastText) {\n cssVars[`--${prefix}-color-error-contrastText`] = theme.colors.error.contrastText;\n }\n if (theme.colors?.error?.light) {\n cssVars[`--${prefix}-color-error-light`] = theme.colors.error.light;\n }\n\n // Colors - Success\n if (theme.colors?.success?.main) {\n cssVars[`--${prefix}-color-success-main`] = theme.colors.success.main;\n }\n if (theme.colors?.success?.contrastText) {\n cssVars[`--${prefix}-color-success-contrastText`] = theme.colors.success.contrastText;\n }\n if (theme.colors?.success?.light) {\n cssVars[`--${prefix}-color-success-light`] = theme.colors.success.light;\n }\n\n // Colors - Warning\n if (theme.colors?.warning?.main) {\n cssVars[`--${prefix}-color-warning-main`] = theme.colors.warning.main;\n }\n if (theme.colors?.warning?.contrastText) {\n cssVars[`--${prefix}-color-warning-contrastText`] = theme.colors.warning.contrastText;\n }\n if (theme.colors?.warning?.light) {\n cssVars[`--${prefix}-color-warning-light`] = theme.colors.warning.light;\n }\n\n // Colors - Info\n if (theme.colors?.info?.main) {\n cssVars[`--${prefix}-color-info-main`] = theme.colors.info.main;\n }\n if (theme.colors?.info?.contrastText) {\n cssVars[`--${prefix}-color-info-contrastText`] = theme.colors.info.contrastText;\n }\n if (theme.colors?.info?.light) {\n cssVars[`--${prefix}-color-info-light`] = theme.colors.info.light;\n }\n\n // Colors - Text\n if (theme.colors?.text?.primary) {\n cssVars[`--${prefix}-color-text-primary`] = theme.colors.text.primary;\n }\n if (theme.colors?.text?.secondary) {\n cssVars[`--${prefix}-color-text-secondary`] = theme.colors.text.secondary;\n }\n\n // Colors - Border\n if (theme.colors?.border) {\n cssVars[`--${prefix}-color-border`] = theme.colors.border;\n }\n\n // Spacing\n if (theme.spacing?.unit !== undefined) {\n cssVars[`--${prefix}-spacing-unit`] = `${theme.spacing.unit}px`;\n }\n\n // Border Radius\n if (theme.borderRadius?.small) {\n cssVars[`--${prefix}-border-radius-small`] = theme.borderRadius.small;\n }\n if (theme.borderRadius?.medium) {\n cssVars[`--${prefix}-border-radius-medium`] = theme.borderRadius.medium;\n }\n if (theme.borderRadius?.large) {\n cssVars[`--${prefix}-border-radius-large`] = theme.borderRadius.large;\n }\n\n // Shadows\n if (theme.shadows?.small) {\n cssVars[`--${prefix}-shadow-small`] = theme.shadows.small;\n }\n if (theme.shadows?.medium) {\n cssVars[`--${prefix}-shadow-medium`] = theme.shadows.medium;\n }\n if (theme.shadows?.large) {\n cssVars[`--${prefix}-shadow-large`] = theme.shadows.large;\n }\n\n // Typography - Font Family\n if (theme.typography?.fontFamily) {\n cssVars[`--${prefix}-typography-fontFamily`] = theme.typography.fontFamily;\n }\n\n // Typography - Font Sizes\n if (theme.typography?.fontSizes?.xs) {\n cssVars[`--${prefix}-typography-fontSize-xs`] = theme.typography.fontSizes.xs;\n }\n if (theme.typography?.fontSizes?.sm) {\n cssVars[`--${prefix}-typography-fontSize-sm`] = theme.typography.fontSizes.sm;\n }\n if (theme.typography?.fontSizes?.md) {\n cssVars[`--${prefix}-typography-fontSize-md`] = theme.typography.fontSizes.md;\n }\n if (theme.typography?.fontSizes?.lg) {\n cssVars[`--${prefix}-typography-fontSize-lg`] = theme.typography.fontSizes.lg;\n }\n if (theme.typography?.fontSizes?.xl) {\n cssVars[`--${prefix}-typography-fontSize-xl`] = theme.typography.fontSizes.xl;\n }\n if (theme.typography?.fontSizes?.['2xl']) {\n cssVars[`--${prefix}-typography-fontSize-2xl`] = theme.typography.fontSizes['2xl'];\n }\n if (theme.typography?.fontSizes?.['3xl']) {\n cssVars[`--${prefix}-typography-fontSize-3xl`] = theme.typography.fontSizes['3xl'];\n }\n\n // Typography - Font Weights\n if (theme.typography?.fontWeights?.normal !== undefined) {\n cssVars[`--${prefix}-typography-fontWeight-normal`] = theme.typography.fontWeights.normal.toString();\n }\n if (theme.typography?.fontWeights?.medium !== undefined) {\n cssVars[`--${prefix}-typography-fontWeight-medium`] = theme.typography.fontWeights.medium.toString();\n }\n if (theme.typography?.fontWeights?.semibold !== undefined) {\n cssVars[`--${prefix}-typography-fontWeight-semibold`] = theme.typography.fontWeights.semibold.toString();\n }\n if (theme.typography?.fontWeights?.bold !== undefined) {\n cssVars[`--${prefix}-typography-fontWeight-bold`] = theme.typography.fontWeights.bold.toString();\n }\n\n // Typography - Line Heights\n if (theme.typography?.lineHeights?.tight !== undefined) {\n cssVars[`--${prefix}-typography-lineHeight-tight`] = theme.typography.lineHeights.tight.toString();\n }\n if (theme.typography?.lineHeights?.normal !== undefined) {\n cssVars[`--${prefix}-typography-lineHeight-normal`] = theme.typography.lineHeights.normal.toString();\n }\n if (theme.typography?.lineHeights?.relaxed !== undefined) {\n cssVars[`--${prefix}-typography-lineHeight-relaxed`] = theme.typography.lineHeights.relaxed.toString();\n }\n\n // Images\n if (theme.images) {\n Object.keys(theme.images).forEach((imageKey: string) => {\n const imageConfig: ThemeImage | undefined = theme.images![imageKey];\n if (imageConfig?.url) {\n cssVars[`--${prefix}-image-${imageKey}-url`] = imageConfig.url;\n }\n if (imageConfig?.title) {\n cssVars[`--${prefix}-image-${imageKey}-title`] = imageConfig.title;\n }\n if (imageConfig?.alt) {\n cssVars[`--${prefix}-image-${imageKey}-alt`] = imageConfig.alt;\n }\n });\n }\n\n /* |---------------------------------------------------------------| */\n /* | Components | */\n /* |---------------------------------------------------------------| */\n\n // Button Overrides\n if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {\n cssVars[`--${prefix}-component-button-root-borderRadius`] =\n theme.components.Button.styleOverrides.root.borderRadius;\n }\n\n // Field Overrides (Parent of `TextField`, `DatePicker`, `OtpField`, `Select`, etc.)\n if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {\n cssVars[`--${prefix}-component-field-root-borderRadius`] = theme.components.Field.styleOverrides.root.borderRadius;\n }\n\n return cssVars;\n};\n\nconst toThemeVars = (theme: ThemeConfig): ThemeVars => {\n const prefix: string = theme.cssVarPrefix || VendorConstants.VENDOR_PREFIX;\n\n const componentVars: ThemeVars['components'] = {};\n if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {\n componentVars.Button = {\n root: {\n borderRadius: `var(--${prefix}-component-button-root-borderRadius)`,\n },\n };\n }\n if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {\n componentVars.Field = {\n root: {\n borderRadius: `var(--${prefix}-component-field-root-borderRadius)`,\n },\n };\n }\n\n const themeVars: ThemeVars = {\n borderRadius: {\n large: `var(--${prefix}-border-radius-large)`,\n medium: `var(--${prefix}-border-radius-medium)`,\n small: `var(--${prefix}-border-radius-small)`,\n },\n colors: {\n action: {\n activatedOpacity: `var(--${prefix}-color-action-activatedOpacity)`,\n active: `var(--${prefix}-color-action-active)`,\n disabled: `var(--${prefix}-color-action-disabled)`,\n disabledBackground: `var(--${prefix}-color-action-disabledBackground)`,\n disabledOpacity: `var(--${prefix}-color-action-disabledOpacity)`,\n focus: `var(--${prefix}-color-action-focus)`,\n focusOpacity: `var(--${prefix}-color-action-focusOpacity)`,\n hover: `var(--${prefix}-color-action-hover)`,\n hoverOpacity: `var(--${prefix}-color-action-hoverOpacity)`,\n selected: `var(--${prefix}-color-action-selected)`,\n selectedOpacity: `var(--${prefix}-color-action-selectedOpacity)`,\n },\n background: {\n body: {\n main: `var(--${prefix}-color-background-body-main)`,\n },\n disabled: `var(--${prefix}-color-background-disabled)`,\n surface: `var(--${prefix}-color-background-surface)`,\n },\n border: `var(--${prefix}-color-border)`,\n error: {\n contrastText: `var(--${prefix}-color-error-contrastText)`,\n main: `var(--${prefix}-color-error-main)`,\n },\n info: {\n contrastText: `var(--${prefix}-color-info-contrastText)`,\n main: `var(--${prefix}-color-info-main)`,\n },\n primary: {\n contrastText: `var(--${prefix}-color-primary-contrastText)`,\n main: `var(--${prefix}-color-primary-main)`,\n },\n secondary: {\n contrastText: `var(--${prefix}-color-secondary-contrastText)`,\n main: `var(--${prefix}-color-secondary-main)`,\n },\n success: {\n contrastText: `var(--${prefix}-color-success-contrastText)`,\n main: `var(--${prefix}-color-success-main)`,\n },\n text: {\n primary: `var(--${prefix}-color-text-primary)`,\n secondary: `var(--${prefix}-color-text-secondary)`,\n },\n warning: {\n contrastText: `var(--${prefix}-color-warning-contrastText)`,\n main: `var(--${prefix}-color-warning-main)`,\n },\n },\n shadows: {\n large: `var(--${prefix}-shadow-large)`,\n medium: `var(--${prefix}-shadow-medium)`,\n small: `var(--${prefix}-shadow-small)`,\n },\n spacing: {\n unit: `var(--${prefix}-spacing-unit)`,\n },\n typography: {\n fontFamily: `var(--${prefix}-typography-fontFamily)`,\n fontSizes: {\n '2xl': `var(--${prefix}-typography-fontSize-2xl)`,\n '3xl': `var(--${prefix}-typography-fontSize-3xl)`,\n lg: `var(--${prefix}-typography-fontSize-lg)`,\n md: `var(--${prefix}-typography-fontSize-md)`,\n sm: `var(--${prefix}-typography-fontSize-sm)`,\n xl: `var(--${prefix}-typography-fontSize-xl)`,\n xs: `var(--${prefix}-typography-fontSize-xs)`,\n },\n fontWeights: {\n bold: `var(--${prefix}-typography-fontWeight-bold)`,\n medium: `var(--${prefix}-typography-fontWeight-medium)`,\n normal: `var(--${prefix}-typography-fontWeight-normal)`,\n semibold: `var(--${prefix}-typography-fontWeight-semibold)`,\n },\n lineHeights: {\n normal: `var(--${prefix}-typography-lineHeight-normal)`,\n relaxed: `var(--${prefix}-typography-lineHeight-relaxed)`,\n tight: `var(--${prefix}-typography-lineHeight-tight)`,\n },\n },\n };\n\n // Add images if they exist\n if (theme.images) {\n themeVars.images = {};\n Object.keys(theme.images).forEach((imageKey: string) => {\n const imageConfig: ThemeImage | undefined = theme.images![imageKey];\n themeVars.images![imageKey] = {\n alt: imageConfig?.alt ? `var(--${prefix}-image-${imageKey}-alt)` : undefined,\n title: imageConfig?.title ? `var(--${prefix}-image-${imageKey}-title)` : undefined,\n url: imageConfig?.url ? `var(--${prefix}-image-${imageKey}-url)` : undefined,\n };\n });\n }\n\n if (Object.keys(componentVars).length > 0) {\n themeVars.components = componentVars;\n }\n\n return themeVars;\n};\n\nconst createTheme = (config: RecursivePartial<ThemeConfig> = {}, isDark: boolean = false): Theme => {\n const baseTheme: ThemeConfig = isDark ? darkTheme : lightTheme;\n\n const mergedConfig: ThemeConfig = {\n ...baseTheme,\n ...config,\n borderRadius: {\n ...baseTheme.borderRadius,\n ...config.borderRadius,\n },\n colors: {\n ...baseTheme.colors,\n ...config.colors,\n action: {\n ...baseTheme.colors.action,\n ...(config.colors?.action || {}),\n },\n secondary: {\n ...baseTheme.colors.secondary,\n ...(config.colors?.secondary || {}),\n },\n },\n images: {\n ...baseTheme.images,\n ...config.images,\n },\n shadows: {\n ...baseTheme.shadows,\n ...config.shadows,\n },\n spacing: {\n ...baseTheme.spacing,\n ...config.spacing,\n },\n typography: {\n ...baseTheme.typography,\n ...config.typography,\n fontSizes: {\n ...baseTheme.typography.fontSizes,\n ...(config.typography?.fontSizes || {}),\n },\n fontWeights: {\n ...baseTheme.typography.fontWeights,\n ...(config.typography?.fontWeights || {}),\n },\n lineHeights: {\n ...baseTheme.typography.lineHeights,\n ...(config.typography?.lineHeights || {}),\n },\n },\n } as ThemeConfig;\n\n return {\n ...mergedConfig,\n cssVariables: toCssVariables(mergedConfig),\n vars: toThemeVars(mergedConfig),\n };\n};\n\nexport const DEFAULT_THEME: ThemeMode = 'light';\n\nexport default createTheme;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Converts an ArrayBuffer to a base64url encoded string.\n *\n * Base64url encoding is a URL-safe variant of base64 encoding that:\n * - Replaces '+' with '-'\n * - Replaces '/' with '_'\n * - Removes padding '=' characters\n *\n * This encoding is commonly used in JWT tokens, OAuth2 PKCE challenges,\n * and other web standards where the encoded data needs to be safely\n * transmitted in URLs or HTTP headers.\n *\n * @param buffer - The ArrayBuffer to convert to base64url string\n * @returns The base64url encoded string representation of the input buffer\n *\n * @example\n * ```typescript\n * const buffer = new TextEncoder().encode('Hello World');\n * const encoded = arrayBufferToBase64url(buffer);\n * console.log(encoded); // \"SGVsbG8gV29ybGQ\"\n * ```\n *\n * @example\n * ```typescript\n * // Converting crypto random bytes for PKCE challenge\n * const randomBytes = crypto.getRandomValues(new Uint8Array(32));\n * const codeVerifier = arrayBufferToBase64url(randomBytes.buffer);\n * ```\n */\nconst arrayBufferToBase64url = (buffer: ArrayBuffer): string => {\n const bytes: Uint8Array<ArrayBuffer> = new Uint8Array(buffer);\n let binary: string = '';\n\n for (let i: number = 0; i < bytes.byteLength; i += 1) {\n binary += String.fromCharCode(bytes[i]);\n }\n\n return btoa(binary).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');\n};\n\nexport default arrayBufferToBase64url;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Converts a base64url encoded string back to an ArrayBuffer.\n *\n * This function performs the inverse operation of base64url encoding by:\n * - Replacing URL-safe characters: '-' becomes '+', '_' becomes '/'\n * - Adding back padding '=' characters that were removed during base64url encoding\n * - Decoding the resulting base64 string to binary data\n * - Converting the binary data to an ArrayBuffer\n *\n * This is commonly used for decoding JWT tokens, OAuth2 PKCE code verifiers,\n * and other cryptographic data that was encoded using base64url format.\n *\n * @param base64url - The base64url encoded string to decode\n * @returns The ArrayBuffer containing the decoded binary data\n *\n * @throws {DOMException} Throws an error if the input string is not valid base64url\n *\n * @example\n * ```typescript\n * const encoded = 'SGVsbG8gV29ybGQ';\n * const buffer = base64urlToArrayBuffer(encoded);\n * const text = new TextDecoder().decode(buffer);\n * console.log(text); // \"Hello World\"\n * ```\n *\n * @example\n * ```typescript\n * // Decoding a JWT payload\n * const jwtPayload = 'eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ';\n * const payloadBuffer = base64urlToArrayBuffer(jwtPayload);\n * const payloadJson = new TextDecoder().decode(payloadBuffer);\n * const payload = JSON.parse(payloadJson);\n * ```\n *\n * @see {@link arrayBufferToBase64url} - The inverse function for encoding ArrayBuffer to base64url\n */\nconst base64urlToArrayBuffer = (base64url: string): ArrayBuffer => {\n const padding: string = '='.repeat((4 - (base64url.length % 4)) % 4);\n const base64: string = base64url.replace(/-/g, '+').replace(/_/g, '/') + padding;\n\n const binaryString: string = atob(base64);\n const bytes: Uint8Array<ArrayBuffer> = new Uint8Array(binaryString.length);\n\n for (let i: number = 0; i < binaryString.length; i += 1) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n\n return bytes.buffer;\n};\n\nexport default base64urlToArrayBuffer;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Creates a BEM-style class name by combining a base class with element and/or modifier\n *\n * @param baseClass - The base CSS class string (usually from emotion's css function)\n * @param element - The BEM element name (optional)\n * @param modifier - The BEM modifier name (optional)\n * @returns The combined class name string\n *\n * @example\n * ```tsx\n * const baseClass = css`\n * display: flex;\n * &__element {\n * color: red;\n * }\n * &--modifier {\n * background: blue;\n * }\n * `;\n *\n * import bem from './utils/bem';\n *\n * const elementClass = bem(baseClass, 'element');\n * const modifierClass = bem(baseClass, null, 'modifier');\n * const elementWithModifierClass = bem(baseClass, 'element', 'modifier');\n * ```\n */\nconst bem = (baseClass: string, element?: string | null, modifier?: string | null): string => {\n let className: string = baseClass;\n\n if (element) {\n className += `__${element}`;\n }\n\n if (modifier) {\n className += `--${modifier}`;\n }\n\n return className;\n};\n\nexport default bem;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Formats a date string to a human-readable format.\n *\n * @param dateString - The date string to format (optional)\n * @returns A formatted date string in 'Month Day, Year' format, or '-' if no date is provided, or the original string if parsing fails\n *\n * @example\n * ```typescript\n * formatDate('2025-07-09T10:30:00Z'); // Returns \"July 9, 2025\"\n * formatDate(''); // Returns \"-\"\n * formatDate(undefined); // Returns \"-\"\n * formatDate('invalid-date'); // Returns \"invalid-date\"\n * ```\n */\nconst formatDate = (dateString?: string): string => {\n if (!dateString) return '-';\n\n try {\n return new Date(dateString).toLocaleDateString('en-US', {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n });\n } catch {\n return dateString;\n }\n};\n\nexport default formatDate;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Log levels enum\n */\nexport type LogLevel = 'debug' | 'info' | 'warn' | 'error';\n\n/**\n * Logger configuration interface\n */\nexport interface LoggerConfig {\n /** Custom log formatter function */\n formatter?: (level: LogLevel, message: string, ...args: any[]) => void;\n /** Minimum log level to output */\n level: LogLevel;\n /** Custom prefix for all log messages */\n prefix?: string;\n /** Whether to include log level in output */\n showLevel?: boolean;\n /** Whether to include timestamps */\n timestamps?: boolean;\n}\n\nconst PREFIX: string = '\uD83D\uDEE1\uFE0F Asgardeo';\n\n/**\n * Default logger configuration\n */\nconst DEFAULT_CONFIG: LoggerConfig = {\n level: 'info',\n prefix: `${PREFIX}`,\n showLevel: true,\n timestamps: true,\n};\n\n/**\n * Environment detection utilities\n */\nconst isBrowser = (): boolean =>\n /* @ts-ignore */\n typeof window !== 'undefined' && typeof window.document !== 'undefined';\nconst isNode = (): boolean =>\n /* @ts-ignore */\n typeof process !== 'undefined' && process.versions && process.versions.node;\n/**\n * Color codes for terminal output (Node.js)\n */\nconst COLORS: {\n blue: string;\n bright: string;\n cyan: string;\n dim: string;\n gray: string;\n green: string;\n magenta: string;\n red: string;\n reset: string;\n white: string;\n yellow: string;\n} = {\n blue: '\\x1b[34m',\n bright: '\\x1b[1m',\n cyan: '\\x1b[36m',\n dim: '\\x1b[2m',\n gray: '\\x1b[90m',\n green: '\\x1b[32m',\n magenta: '\\x1b[35m',\n red: '\\x1b[31m',\n reset: '\\x1b[0m',\n white: '\\x1b[37m',\n yellow: '\\x1b[33m',\n};\n\n/**\n * Browser console styling\n */\nconst BROWSER_STYLES: {\n debug: string;\n error: string;\n info: string;\n prefix: string;\n timestamp: string;\n warn: string;\n} = {\n debug: 'color: #6b7280; font-weight: normal;',\n error: 'color: #dc2626; font-weight: bold;',\n info: 'color: #2563eb; font-weight: bold;',\n prefix: 'color: #7c3aed; font-weight: bold;',\n timestamp: 'color: #6b7280; font-size: 0.9em;',\n warn: 'color: #d97706; font-weight: bold;',\n};\n\nconst LOG_LEVEL_ORDER: Record<LogLevel, number> = {\n debug: 0,\n error: 3,\n info: 1,\n warn: 2,\n};\n\n/**\n * Universal logger class that works in both browser and Node.js environments\n */\nclass Logger {\n private config: LoggerConfig;\n\n constructor(config: Partial<LoggerConfig> = {}) {\n this.config = {...DEFAULT_CONFIG, ...config};\n }\n\n /**\n * Update logger configuration\n */\n configure(config: Partial<LoggerConfig>): void {\n this.config = {...this.config, ...config};\n }\n\n /**\n * Get current configuration\n */\n getConfig(): LoggerConfig {\n return {...this.config};\n }\n\n /**\n * Check if a log level should be output\n */\n private shouldLog(level: LogLevel): boolean {\n return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.config.level];\n }\n\n /**\n * Get timestamp string\n */\n private static getTimestamp(): string {\n return new Date().toISOString();\n }\n\n /**\n * Get log level string\n */\n private static getLevelString(level: LogLevel): string {\n switch (level) {\n case 'debug':\n return 'DEBUG';\n case 'info':\n return 'INFO';\n case 'warn':\n return 'WARN';\n case 'error':\n return 'ERROR';\n default:\n return 'UNKNOWN';\n }\n }\n\n /**\n * Format message for Node.js terminal\n */\n private formatForNode(level: LogLevel, message: string): string {\n const parts: string[] = [];\n\n // Add timestamp\n if (this.config.timestamps) {\n parts.push(`${COLORS.gray}[${Logger.getTimestamp()}]${COLORS.reset}`);\n }\n\n // Add prefix\n if (this.config.prefix) {\n parts.push(`${COLORS.magenta}${this.config.prefix}${COLORS.reset}`);\n }\n\n // Add log level\n if (this.config.showLevel) {\n const levelStr: string = Logger.getLevelString(level);\n let coloredLevel: string;\n\n switch (level) {\n case 'debug':\n coloredLevel = `${COLORS.gray}[${levelStr}]${COLORS.reset}`;\n break;\n case 'info':\n coloredLevel = `${COLORS.blue}[${levelStr}]${COLORS.reset}`;\n break;\n case 'warn':\n coloredLevel = `${COLORS.yellow}[${levelStr}]${COLORS.reset}`;\n break;\n case 'error':\n coloredLevel = `${COLORS.red}[${levelStr}]${COLORS.reset}`;\n break;\n default:\n coloredLevel = `[${levelStr}]`;\n }\n parts.push(coloredLevel);\n }\n\n // Add message\n parts.push(message);\n\n return parts.join(' ');\n }\n\n /**\n * Log message using appropriate method\n */\n private logMessage(level: LogLevel, message: string, ...args: any[]): void {\n if (!this.shouldLog(level)) {\n return;\n }\n\n // Use custom formatter if provided\n if (this.config.formatter) {\n this.config.formatter(level, message, ...args);\n return;\n }\n\n if (isBrowser()) {\n this.logToBrowser(level, message, ...args);\n } else if (isNode()) {\n this.logToNode(level, message, ...args);\n } else {\n // Fallback for other environments\n // eslint-disable-next-line no-console\n console.log(message, ...args);\n }\n }\n\n /**\n * Log to browser console with styling\n */\n private logToBrowser(level: LogLevel, message: string, ...args: any[]): void {\n const parts: string[] = [];\n const styles: string[] = [];\n\n // Add timestamp\n if (this.config.timestamps) {\n parts.push(`%c[${Logger.getTimestamp()}]`);\n styles.push(BROWSER_STYLES.timestamp);\n }\n\n // Add prefix\n if (this.config.prefix) {\n parts.push(`%c${this.config.prefix}`);\n styles.push(BROWSER_STYLES.prefix);\n }\n\n // Add log level and message\n if (this.config.showLevel) {\n const levelStr: string = Logger.getLevelString(level);\n parts.push(`%c[${levelStr}]`);\n\n switch (level) {\n case 'debug':\n styles.push(BROWSER_STYLES.debug);\n break;\n case 'info':\n styles.push(BROWSER_STYLES.info);\n break;\n case 'warn':\n styles.push(BROWSER_STYLES.warn);\n break;\n case 'error':\n styles.push(BROWSER_STYLES.error);\n break;\n default:\n styles.push('');\n }\n }\n\n parts.push(`%c${message}`);\n styles.push('color: inherit; font-weight: normal;');\n\n const formattedMessage: string = parts.join(' ');\n\n // Use appropriate console method\n switch (level) {\n case 'debug':\n // eslint-disable-next-line no-console\n console.debug(formattedMessage, ...styles, ...args);\n break;\n case 'info':\n // eslint-disable-next-line no-console\n console.info(formattedMessage, ...styles, ...args);\n break;\n case 'warn':\n // eslint-disable-next-line no-console\n console.warn(formattedMessage, ...styles, ...args);\n break;\n case 'error':\n // eslint-disable-next-line no-console\n console.error(formattedMessage, ...styles, ...args);\n break;\n default:\n // eslint-disable-next-line no-console\n console.log(formattedMessage, ...styles, ...args);\n }\n }\n\n /**\n * Log to Node.js console\n */\n private logToNode(level: LogLevel, message: string, ...args: any[]): void {\n const formattedMessage: string = this.formatForNode(level, message);\n\n // Use appropriate console method\n switch (level) {\n case 'debug':\n // eslint-disable-next-line no-console\n console.debug(formattedMessage, ...args);\n break;\n case 'info':\n // eslint-disable-next-line no-console\n console.info(formattedMessage, ...args);\n break;\n case 'warn':\n // eslint-disable-next-line no-console\n console.warn(formattedMessage, ...args);\n break;\n case 'error':\n // eslint-disable-next-line no-console\n console.error(formattedMessage, ...args);\n break;\n default:\n // eslint-disable-next-line no-console\n console.log(formattedMessage, ...args);\n }\n }\n\n /**\n * Log debug message\n */\n debug(message: string, ...args: any[]): void {\n this.logMessage('debug', message, ...args);\n }\n\n /**\n * Log info message\n */\n info(message: string, ...args: any[]): void {\n this.logMessage('info', message, ...args);\n }\n\n /**\n * Log warning message\n */\n warn(message: string, ...args: any[]): void {\n this.logMessage('warn', message, ...args);\n }\n\n /**\n * Log error message\n */\n error(message: string, ...args: any[]): void {\n this.logMessage('error', message, ...args);\n }\n\n /**\n * Create a child logger with additional prefix\n */\n child(prefix: string): Logger {\n const childPrefix: string = this.config.prefix ? `${this.config.prefix} - ${prefix}` : prefix;\n return new Logger({\n ...this.config,\n prefix: childPrefix,\n });\n }\n\n /**\n * Set log level\n */\n setLevel(level: LogLevel): void {\n this.config.level = level;\n }\n\n /**\n * Get current log level\n */\n getLevel(): LogLevel {\n return this.config.level;\n }\n}\n\n/**\n * Default logger instance\n */\nconst logger: Logger = new Logger();\n\n/**\n * Create a new logger instance with custom configuration\n */\nexport const createLogger = (config?: Partial<LoggerConfig>): Logger => new Logger(config);\n\n/**\n * Default export - global logger instance\n */\nexport default logger;\n\n/**\n * Named exports for convenience\n */\nexport const debug = (message: string, ...args: any[]): void => logger.debug(message, ...args);\nexport const info = (message: string, ...args: any[]): void => logger.info(message, ...args);\nexport const warn = (message: string, ...args: any[]): void => logger.warn(message, ...args);\nexport const error = (message: string, ...args: any[]): void => logger.error(message, ...args);\n\n/**\n * Configure the default logger\n */\nexport const configure = (config: Partial<LoggerConfig>): void => logger.configure(config);\n\n/**\n * Create component-specific loggers\n */\nexport const createComponentLogger = (component: string): Logger => logger.child(component);\n\n/**\n * Create package-specific logger\n */\nexport const createPackageLogger = (packageName: string): Logger =>\n createLogger({\n level: 'info',\n prefix: `${PREFIX} - ${packageName}`,\n showLevel: true,\n timestamps: true,\n });\n\n/**\n * Create package component logger (package + component)\n */\nexport const createPackageComponentLogger = (packageName: string, component: string): Logger => {\n const packageLogger: Logger = createPackageLogger(packageName);\n return packageLogger.child(component);\n};\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport logger from './logger';\nimport AsgardeoRuntimeError from '../errors/AsgardeoRuntimeError';\n\n/**\n * Extracts the organization handle from an Asgardeo base URL.\n *\n * This function parses Asgardeo URLs with the standard pattern:\n * - https://dev.asgardeo.io/t/{orgHandle}\n * - https://stage.asgardeo.io/t/{orgHandle}\n * - https://prod.asgardeo.io/t/{orgHandle}\n * - https://{subdomain}.asgardeo.io/t/{orgHandle}\n *\n * @param baseUrl - The base URL of the Asgardeo identity server\n * @returns The extracted organization handle\n * @throws {AsgardeoRuntimeError} When the URL doesn't match the expected Asgardeo pattern,\n * indicating a custom domain is configured and organizationHandle must be provided explicitly\n *\n * @example\n * ```typescript\n * // Standard Asgardeo URLs\n * const handle1 = deriveOrganizationHandleFromBaseUrl('https://dev.asgardeo.io/t/dxlab');\n * // Returns: 'dxlab'\n *\n * const handle2 = deriveOrganizationHandleFromBaseUrl('https://stage.asgardeo.io/t/myorg');\n * // Returns: 'myorg'\n *\n * // Custom domain - returns empty string with a warning\n * const handle2 = deriveOrganizationHandleFromBaseUrl('https://custom.example.com/auth');\n * // Returns: '' and logs a warning\n * ```\n */\nconst deriveOrganizationHandleFromBaseUrl = (baseUrl?: string): string => {\n if (!baseUrl) {\n throw new AsgardeoRuntimeError(\n 'Base URL is required to derive organization handle.',\n 'javascript-deriveOrganizationHandleFromBaseUrl-ValidationError-001',\n 'javascript',\n 'A valid base URL must be provided to extract the organization handle.',\n );\n }\n\n let parsedUrl: URL;\n\n try {\n parsedUrl = new URL(baseUrl);\n } catch (error) {\n throw new AsgardeoRuntimeError(\n `Invalid base URL format: ${baseUrl}`,\n 'javascript-deriveOrganizationHandleFromBaseUrl-ValidationError-002',\n 'javascript',\n 'The provided base URL does not conform to valid URL syntax.',\n );\n }\n\n // Extract the organization handle from the path pattern: /t/{orgHandle}\n const pathSegments: string[] = parsedUrl.pathname?.split('/')?.filter((segment: string) => segment?.length > 0);\n\n if (pathSegments.length < 2 || pathSegments[0] !== 't') {\n logger.warn(\n new AsgardeoRuntimeError(\n 'Organization handle is required since a custom domain is configured.',\n 'javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-002',\n 'javascript',\n 'The provided base URL does not follow the expected URL pattern (/t/{orgHandle}). Please provide the organizationHandle explicitly in the configuration.',\n ).toString(),\n );\n\n return '';\n }\n\n const organizationHandle: string = pathSegments[1];\n\n if (!organizationHandle || organizationHandle.trim().length === 0) {\n logger.warn(\n new AsgardeoRuntimeError(\n 'Organization handle is required since a custom domain is configured.',\n 'javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-003',\n 'javascript',\n 'The organization handle could not be extracted from the base URL. Please provide the organizationHandle explicitly in the configuration.',\n ).toString(),\n );\n\n return '';\n }\n\n return organizationHandle;\n};\n\nexport default deriveOrganizationHandleFromBaseUrl;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport logger from './logger';\nimport AsgardeoRuntimeError from '../errors/AsgardeoRuntimeError';\n\n/**\n * Utility to determine if sensible Asgardeo fallbacks can be used based on the given base URL.\n *\n * This checks if the URL follows the standard Asgardeo pattern: /t/{orgHandle}\n * Returns true if sensible fallbacks (like deriving organization handle, tenant, etc.) can be used, false otherwise.\n *\n * @param baseUrl - The base URL of the Asgardeo identity server (string or undefined)\n * @returns boolean - true if sensible fallbacks can be used, false otherwise\n *\n * @example\n * isRecognizedBaseUrlPattern('https://dev.asgardeo.io/t/dxlab'); // true\n * isRecognizedBaseUrlPattern('https://custom.example.com/auth'); // false\n */\nconst isRecognizedBaseUrlPattern = (baseUrl: string | undefined): boolean => {\n if (!baseUrl) {\n throw new AsgardeoRuntimeError(\n 'Base URL is required to derive if the `baseUrl` is recognized.',\n 'isRecognizedBaseUrlPattern-ValidationError-001',\n 'javascript',\n 'A valid base URL must be provided to derive if the `baseUrl` is recognized to use the sensible fallbacks.',\n );\n }\n\n let parsedUrl: URL;\n\n try {\n parsedUrl = new URL(baseUrl);\n } catch (error) {\n throw new AsgardeoRuntimeError(\n `Invalid base URL format: ${baseUrl}`,\n 'isRecognizedBaseUrlPattern-ValidationError-002',\n 'javascript',\n 'The provided base URL does not conform to valid URL syntax.',\n );\n }\n\n // Extract the organization handle from the path pattern: /t/{orgHandle}\n const pathSegments: string[] = parsedUrl.pathname?.split('/')?.filter((segment: string) => segment?.length > 0);\n\n if (pathSegments.length < 2 || pathSegments[0] !== 't') {\n logger.warn(\n '[isRecognizedBaseUrlPattern] The provided base URL does not follow the expected URL pattern (/t/{orgHandle}).',\n );\n\n return false;\n }\n\n return true;\n};\n\nexport default isRecognizedBaseUrlPattern;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {Schema, FlattenedSchema} from '../models/scim2-schema';\n\n/**\n * Flattens nested schema attributes into a flat structure for easier processing\n *\n * This function processes SCIM2 schemas and creates a flattened representation by:\n * - Processing sub-attributes and creating dot-notation names (e.g., 'name.givenName')\n * - Adding schema ID reference to each flattened attribute\n * - Preserving all original attribute properties while adding schema context\n * - Only including leaf-level attributes (sub-attributes) and top-level simple attributes\n *\n * @param schemas - Array of SCIM2 schemas containing nested attribute structures\n * @returns Array of flattened schema attributes with dot-notation names and schema references\n *\n * @example\n * ```typescript\n * const schemas = [\n * {\n * id: 'urn:ietf:params:scim:schemas:core:2.0:User',\n * attributes: [\n * {\n * name: 'userName',\n * type: 'string',\n * multiValued: false\n * },\n * {\n * name: 'name',\n * type: 'complex',\n * multiValued: false,\n * subAttributes: [\n * { name: 'givenName', type: 'string', multiValued: false },\n * { name: 'familyName', type: 'string', multiValued: false }\n * ]\n * }\n * ]\n * }\n * ];\n *\n * const flattened = flattenUserSchema(schemas);\n * // Result: [\n * // { name: 'userName', type: 'string', multiValued: false, schemaId: 'urn:ietf:params:scim:schemas:core:2.0:User' },\n * // { name: 'name.givenName', type: 'string', multiValued: false, schemaId: 'urn:ietf:params:scim:schemas:core:2.0:User' },\n * // { name: 'name.familyName', type: 'string', multiValued: false, schemaId: 'urn:ietf:params:scim:schemas:core:2.0:User' }\n * // ]\n * ```\n */\nconst flattenUserSchema = (schemas: Schema[]): FlattenedSchema[] => {\n const flattenedAttributes: FlattenedSchema[] = [];\n\n schemas.forEach((schema: Schema) => {\n if (schema.attributes && Array.isArray(schema.attributes)) {\n schema.attributes.forEach((attribute: any) => {\n // If the attribute has sub-attributes, only add the flattened sub-attributes\n if (attribute.subAttributes && Array.isArray(attribute.subAttributes)) {\n attribute.subAttributes.forEach((subAttribute: any) => {\n flattenedAttributes.push({\n ...subAttribute,\n name: `${attribute.name}.${subAttribute.name}`,\n schemaId: schema.id,\n } as unknown as FlattenedSchema);\n });\n } else {\n // If it's a simple attribute (no sub-attributes), add it directly\n flattenedAttributes.push({\n ...attribute,\n schemaId: schema.id,\n } as unknown as FlattenedSchema);\n }\n });\n }\n });\n\n return flattenedAttributes;\n};\n\nexport default flattenUserSchema;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Gets the value at path of object. If the resolved value is undefined,\n * the defaultValue is returned in its place.\n * Similar to Lodash's get() function\n *\n * @param object - The object to query\n * @param path - The path of the property to get\n * @param defaultValue - The value returned for undefined resolved values\n * @returns The resolved value\n */\nconst get = (object: any, path: string | string[], defaultValue?: any): any => {\n if (!object || !path) return defaultValue;\n\n const pathArray: string[] = Array.isArray(path) ? path : path.split('.');\n\n const result: any = pathArray.reduce((current: any, key: string) => current?.[key], object);\n\n return result !== undefined ? result : defaultValue;\n};\n\nexport default get;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Sets the value at path of object. If a portion of path doesn't exist,\n * it's created. Arrays are created for missing index properties while\n * objects are created for all other missing properties.\n * Similar to Lodash's set() function\n *\n * @param object - The object to modify\n * @param path - The path of the property to set\n * @param value - The value to set\n * @returns The object\n */\nconst set = (object: any, path: string | string[], value: any): any => {\n if (!object || !path) return object;\n\n const pathArray: string[] = Array.isArray(path) ? path : path.split('.');\n const lastIndex: number = pathArray.length - 1;\n\n pathArray.reduce((current: any, key: string, index: number) => {\n if (index === lastIndex) {\n // eslint-disable-next-line no-param-reassign\n current[key] = value;\n } else if (!(key in current) || typeof current[key] !== 'object' || current[key] === null) {\n // Create array if next key is numeric, otherwise create object\n const nextKey: string = pathArray[index + 1];\n // eslint-disable-next-line no-param-reassign\n current[key] = /^\\d+$/.test(nextKey) ? [] : {};\n }\n return current[key];\n }, object);\n\n return object;\n};\n\nexport default set;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport get from './get';\nimport set from './set';\nimport {User} from '../models/user';\n\n/**\n * Creates a profile structure from ME response based on processed schemas\n *\n * This function processes each schema attribute and populates the profile dynamically by:\n * - Extracting values from the ME response using the schema attribute names\n * - Handling multi-valued attributes by converting single values to arrays when needed\n * - Setting appropriate default values based on schema type and multiValued properties\n * - Using dynamic property setting to build the final profile object\n *\n * @param meResponse - The ME API response containing user data\n * @param processedSchemas - The processed and flattened schemas with name, type, and multiValued properties\n * @returns Flat profile object with dynamically populated user attributes\n *\n * @example\n * ```typescript\n * const meResponse = {\n * userName: 'john.doe',\n * emails: ['john@example.com', 'john.doe@work.com'],\n * name: { givenName: 'John', familyName: 'Doe' }\n * };\n *\n * const schemas = [\n * { name: 'userName', type: 'STRING', multiValued: false },\n * { name: 'emails', type: 'STRING', multiValued: true },\n * { name: 'name.givenName', type: 'STRING', multiValued: false }\n * ];\n *\n * const profile = generateUserProfile(meResponse, schemas);\n * // Result: {\n * // userName: 'john.doe',\n * // emails: ['john@example.com', 'john.doe@work.com'],\n * // 'name.givenName': 'John'\n * // }\n * ```\n */\nconst generateUserProfile = (meResponse: any, processedSchemas: any[]): User => {\n const profile: User = {};\n\n processedSchemas.forEach((schema: any) => {\n const {name, type, multiValued} = schema;\n\n if (!name) return;\n\n let value: any = get(meResponse, name);\n\n if (value !== undefined) {\n if (multiValued && !Array.isArray(value)) {\n value = [value];\n }\n } else if (multiValued) {\n value = undefined;\n } else if (type === 'STRING') {\n value = '';\n } else {\n value = undefined;\n }\n\n set(profile, name, value);\n });\n\n return profile;\n};\n\nexport default generateUserProfile;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport generateStateParamForRequestCorrelation from './generateStateParamForRequestCorrelation';\nimport PKCEConstants from '../constants/PKCEConstants';\nimport {TemporaryStore} from '../models/store';\n\n/**\n * Gets the latest PKCE storage key from the temporary store.\n *\n * @param tempStore - The object that holds temporary PKCE-related data (e.g., sessionStorage).\n * @returns The latest PKCE storage key or null if no keys exist.\n */\nconst getLatestPkceStorageKey = (tempStore: TemporaryStore): string | null => {\n const keys: string[] = [];\n\n Object.keys(tempStore).forEach((key: string) => {\n if (key.startsWith(PKCEConstants.Storage.StorageKeys.CODE_VERIFIER)) {\n keys.push(key);\n }\n });\n\n const lastKey: string | undefined = keys.sort().pop();\n\n return lastKey ?? null;\n};\n\n/**\n * Finds the latest state parameter based on the most recent PKCE storage key.\n *\n * This utility combines the functionality of finding the latest PKCE key and generating\n * the corresponding state parameter for request correlation.\n *\n * @param tempStore - The object that holds temporary PKCE-related data (e.g., sessionStorage).\n * @param state - Optional state string to prepend to the request correlation.\n * @returns The latest state parameter string or null if no PKCE keys exist.\n *\n * @example\n * const latestState = getLatestStateParam(sessionStorage, \"myState\");\n * // Returns: \"myState_request_2\" (if latest PKCE key is pkce_code_verifier_2)\n *\n * const latestStateNoPrefix = getLatestStateParam(sessionStorage);\n * // Returns: \"request_2\" (if latest PKCE key is pkce_code_verifier_2)\n *\n * const noKeys = getLatestStateParam(emptyStorage);\n * // Returns: null (if no PKCE keys exist)\n */\nconst getLatestStateParam = (tempStore: TemporaryStore, state?: string): string | null => {\n const latestPkceKey: string | null = getLatestPkceStorageKey(tempStore);\n\n if (!latestPkceKey) {\n return null;\n }\n\n return generateStateParamForRequestCorrelation(latestPkceKey, state);\n};\n\nexport default getLatestStateParam;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport get from './get';\nimport {User} from '../models/user';\n\n/**\n * Generates a flattened user profile from a response object and schema definitions.\n *\n * This function processes user data according to schema specifications, creating\n * a flat object with dot notation keys instead of nested objects. Multi-valued\n * properties and type-specific defaults are handled appropriately.\n *\n * Additionally, any fields present in the response but not defined in the schema\n * will be included to ensure no user data is lost during flattening.\n *\n * @param meResponse - The response object containing user data\n * @param processedSchemas - Array of schema objects defining field properties\n * @param processedSchemas[].name - The field name/path for the property\n * @param processedSchemas[].type - The data type of the field (e.g., 'STRING')\n * @param processedSchemas[].multiValued - Whether the field can contain multiple values\n *\n * @returns A flattened user profile object with dot notation keys\n *\n * @example\n * ```typescript\n * const schemas = [\n * { name: 'name.givenName', type: 'STRING', multiValued: false },\n * { name: 'emails', type: 'STRING', multiValued: true }\n * ];\n * const response = {\n * name: { givenName: 'John' },\n * emails: 'john@example.com',\n * country: 'US' // This will be included even if not in schema\n * };\n * const profile = generateFlattenedUserProfile(response, schemas);\n * // Result: { \"name.givenName\": 'John', emails: ['john@example.com'], country: 'US' }\n * ```\n */\nconst generateFlattenedUserProfile = (meResponse: any, processedSchemas: any[]): User => {\n const profile: User = {};\n\n const allSchemaNames: string[] = processedSchemas.map((schema: any) => schema.name).filter(Boolean);\n\n // First, process all schema-defined fields\n processedSchemas.forEach((schema: any) => {\n const {name, type, multiValued} = schema;\n\n if (!name) return;\n\n // Skip this property if it's a parent of other flattened properties\n // e.g., skip \"name\" if \"name.givenName\" or \"name.familyName\" exists\n // skip \"roles\" if \"roles.default\" exists\n const hasChildProperties: boolean = allSchemaNames.some(\n (schemaName: string) => schemaName !== name && schemaName.startsWith(`${name}.`),\n );\n\n if (hasChildProperties) {\n // Skip this parent property\n return;\n }\n\n let value: any = get(meResponse, name);\n\n // SCIM2 multi-valued complex attributes (phoneNumbers, emails, ims, ...)\n // are stored as arrays of typed objects: [{type: \"mobile\", value: \"...\"}].\n // The schema flattens them as `<attr>.<type>` (e.g. \"phoneNumbers.mobile\"),\n // so when the dotted lookup misses, fall back to filtering the array by\n // `type` and reading `.value`.\n if (value === undefined) {\n const dotIndex: number = name.indexOf('.');\n if (dotIndex > 0) {\n const head: string = name.slice(0, dotIndex);\n const tail: string = name.slice(dotIndex + 1);\n const arr: any = meResponse[head];\n if (Array.isArray(arr)) {\n const match: any = arr.find((item: any) => item && item.type === tail);\n if (match && match.value !== undefined) {\n value = match.value;\n }\n }\n }\n }\n\n // If value not found at top level, check within schema namespaces\n if (value === undefined) {\n const schemaNamespaces: string[] = [\n 'urn:ietf:params:scim:schemas:core:2.0:User',\n 'urn:ietf:params:scim:schemas:extension:enterprise:2.0:User',\n 'urn:scim:wso2:schema',\n 'urn:scim:schemas:extension:custom:User',\n ];\n\n schemaNamespaces.some((namespace: string) => {\n if (meResponse[namespace]) {\n // Try the field name directly within the namespace\n if (meResponse[namespace][name] !== undefined) {\n value = meResponse[namespace][name];\n return true; // Break out of some()\n }\n // Also try using get() for nested paths within the namespace\n const nestedValue: any = get(meResponse[namespace], name);\n if (nestedValue !== undefined) {\n value = nestedValue;\n return true; // Break out of some()\n }\n }\n return false;\n });\n }\n\n if (value !== undefined) {\n if (multiValued && !Array.isArray(value)) {\n value = [value];\n }\n } else if (multiValued) {\n value = undefined;\n } else if (type === 'STRING') {\n value = '';\n } else {\n value = undefined;\n }\n\n profile[name] = value;\n });\n\n // Then, include any additional fields from meResponse that aren't in the schema\n // This ensures fields like 'country' are not missed if they exist in the response\n const flattenObject = (obj: any, prefix: string = ''): void => {\n if (obj && typeof obj === 'object' && !Array.isArray(obj)) {\n Object.keys(obj).forEach((key: string) => {\n const fullKey: string = prefix ? `${prefix}.${key}` : key;\n const value: any = obj[key];\n\n // Skip if this field is already processed by schema\n if (Object.prototype.hasOwnProperty.call(profile, fullKey)) {\n return;\n }\n\n // Skip if this is a parent of schema-defined fields\n const hasSchemaChildProperties: boolean = allSchemaNames.some((schemaName: string) =>\n schemaName.startsWith(`${fullKey}.`),\n );\n\n if (hasSchemaChildProperties) {\n // Recursively process child properties\n flattenObject(value, fullKey);\n } else {\n // Include the field as-is\n profile[fullKey] = value;\n }\n });\n }\n };\n\n flattenObject(meResponse);\n\n return profile;\n};\n\nexport default generateFlattenedUserProfile;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport isRecognizedBaseUrlPattern from './isRecognizedBaseUrlPattern';\nimport logger from './logger';\nimport {Config} from '../models/config';\nimport {Platform} from '../models/platforms';\n\n/**\n * Identifies the platform based on the given base URL.\n *\n * If the URL is recognized and matches the Asgardeo domain, returns Platform.Asgardeo.\n * Otherwise, returns Platform.IdentityServer.\n *\n * @param baseUrl - The base URL to check\n * @returns Platform enum value\n */\nconst identifyPlatform = (config: Config): Platform => {\n const {baseUrl} = config;\n\n try {\n if (isRecognizedBaseUrlPattern(baseUrl)) {\n try {\n const url: URL = new URL(baseUrl!);\n // Check for asgardeo domain (e.g., api.asgardeo.io, etc.)\n if (/\\.asgardeo\\.io$/i.test(url.hostname) || /asgardeo\\.io$/i.test(url.hostname)) {\n return Platform.Asgardeo;\n }\n } catch {\n // Fallback to IdentityServer if URL parsing fails.\n logger.debug(\n `[identifyPlatform] Could not identify platform from the base URL: ${baseUrl}. Defaulting to WSO2 Identity Server as the platform.`,\n );\n }\n\n return Platform.IdentityServer;\n }\n\n return Platform.Unknown;\n } catch (error) {\n logger.debug(`[identifyPlatform] Error identifying platform from base URL: ${baseUrl}. Error: ${error.message}`);\n\n return Platform.Unknown;\n }\n};\n\nexport default identifyPlatform;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport identifyPlatform from './identifyPlatform';\nimport isRecognizedBaseUrlPattern from './isRecognizedBaseUrlPattern';\nimport logger from './logger';\nimport {Config} from '../models/config';\nimport {Platform} from '../models/platforms';\n\n/**\n * Utility to generate the redirect-based sign-up URL for Asgardeo.\n *\n * If the baseUrl is recognized (standard Asgardeo pattern), constructs the sign-up URL.\n * Otherwise, returns an empty string.\n *\n * @param baseUrl - The base URL of the Asgardeo identity server (string or undefined)\n * @returns The sign-up URL if baseUrl is recognized, otherwise an empty string\n */\nconst getRedirectBasedSignUpUrl = (config: Config): string => {\n const {baseUrl} = config;\n\n if (!isRecognizedBaseUrlPattern(baseUrl)) return '';\n\n let signUpBaseUrl: string = baseUrl;\n\n if (identifyPlatform(config) === Platform.Asgardeo) {\n try {\n const url: URL = new URL(baseUrl!);\n\n // Replace 'api.' with 'accounts.' in the hostname, preserving subdomains like 'dev.'\n if (/([a-z0-9-]+\\.)*api\\.asgardeo\\.io$/i.test(url.hostname)) {\n url.hostname = url.hostname.replace('api.', 'accounts.');\n signUpBaseUrl = url.toString().replace(/\\/$/, ''); // Remove trailing slash if any\n }\n } catch {\n logger.debug(\n `[getRedirectBasedSignUpUrl] Could not parse base URL to replace 'api.' with 'accounts.'. Base URL: ${baseUrl}`,\n );\n }\n }\n\n const url: URL = new URL(`${signUpBaseUrl}/accountrecoveryendpoint/register.do`);\n\n if (config.clientId) {\n url.searchParams.set('client_id', config.clientId);\n }\n\n if (config.applicationId) {\n url.searchParams.set('spId', config.applicationId);\n }\n\n logger.debug(`[getRedirectBasedSignUpUrl] Generated sign-up URL: ${url.toString()}`);\n\n return url.toString();\n};\n\nexport default getRedirectBasedSignUpUrl;\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport const EMOJI_URI_SCHEME: string = 'emoji:';\n\n/**\n * Checks whether a given URI uses the `emoji:` scheme (e.g. `\"emoji:\uD83D\uDC2F\"`).\n *\n * @param uri - The URI string to check.\n * @returns `true` if the URI starts with `\"emoji:\"`, `false` otherwise.\n *\n * @example\n * ```typescript\n * isEmojiUri(\"emoji:\uD83D\uDC2F\"); // true\n * isEmojiUri(\"https://example.com/logo.png\"); // false\n * isEmojiUri(\"\"); // false\n * ```\n */\nconst isEmojiUri = (uri: string): boolean => typeof uri === 'string' && uri.startsWith(EMOJI_URI_SCHEME);\n\nexport default isEmojiUri;\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport isEmojiUri, {EMOJI_URI_SCHEME} from './isEmojiUri';\n\n/**\n * Extracts the emoji character from an `emoji:` URI.\n *\n * @param uri - A URI string in the form `\"emoji:<emoji>\"`.\n * @returns The emoji character, or an empty string if the URI is not a valid emoji URI.\n *\n * @example\n * ```typescript\n * extractEmojiFromUri(\"emoji:\uD83D\uDC2F\"); // \"\uD83D\uDC2F\"\n * extractEmojiFromUri(\"https://example.com\"); // \"\"\n * ```\n */\nconst extractEmojiFromUri = (uri: string): string => {\n if (!isEmojiUri(uri)) {\n return '';\n }\n\n return uri.slice(EMOJI_URI_SCHEME.length);\n};\n\nexport default extractEmojiFromUri;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Removes a trailing slash from a path string if it exists.\n *\n * @param path - The string path to process\n * @returns The path without a trailing slash\n *\n * @example\n * ```typescript\n * removeTrailingSlash('/path/to/something/') // returns '/path/to/something'\n * removeTrailingSlash('/path/to/something') // returns '/path/to/something'\n * ```\n */\nconst removeTrailingSlash = (path: string): string => (path.endsWith('/') ? path.slice(0, -1) : path);\n\nexport default removeTrailingSlash;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoRuntimeError from '../errors/AsgardeoRuntimeError';\nimport {\n EmbeddedSignInFlowAuthenticatorExtendedParamType,\n EmbeddedSignInFlowAuthenticatorParamType,\n} from '../models/embedded-signin-flow';\nimport {FieldType} from '../models/field';\n\nconst resolveFieldType = (field: any): FieldType => {\n if (field.type === EmbeddedSignInFlowAuthenticatorParamType.String) {\n // Check if there's a `param` property and if it matches a known type.\n if (field.param === EmbeddedSignInFlowAuthenticatorExtendedParamType.Otp) {\n return FieldType.Otp;\n }\n if (field?.confidential) {\n return FieldType.Password;\n }\n\n return FieldType.Text;\n }\n\n throw new AsgardeoRuntimeError(\n `Field type is not supported: ${field.type}`,\n 'resolveFieldType-Invalid-001',\n 'javascript',\n 'The provided field type is not supported. Please check the field configuration.',\n );\n};\n\nexport default resolveFieldType;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoRuntimeError from '../errors/AsgardeoRuntimeError';\n\nconst resolveFieldName = (field: any): string => {\n if (field.param) {\n return field.param;\n }\n\n throw new AsgardeoRuntimeError(\n 'Field name is not supported: ',\n 'resolveFieldName-Invalid-001',\n 'javascript',\n 'The provided field name is not supported. Please check the field configuration.',\n );\n};\n\nexport default resolveFieldName;\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {FlowMetadataResponse} from '../../models/v2/flow-meta-v2';\n\n/**\n * Resolves a dot-path expression against a FlowMetadataResponse object.\n *\n * Supports both camelCase paths (e.g. `logoUrl`) and snake_case API responses\n * (e.g. `logo_url`). When a camelCase segment is not found directly, the\n * function falls back to its snake_case equivalent.\n *\n * @example\n * resolveMeta('application.name', meta) // \u2192 'My App'\n * resolveMeta('ou.name', meta) // \u2192 'My Org'\n *\n * @param path - Dot-separated path into the meta object (e.g. 'application.name')\n * @param meta - The FlowMetadataResponse to look up\n * @returns The resolved string value, or empty string if not found\n */\nexport default function resolveMeta(path: string, meta: FlowMetadataResponse): string {\n const value: unknown = path.split('.').reduce<unknown>((current: unknown, part: string) => {\n if (current == null || typeof current !== 'object') {\n return undefined;\n }\n\n const obj: Record<string, unknown> = current as Record<string, unknown>;\n const snakePart: string = part.replace(/[A-Z]/g, (c: string) => `_${c.toLowerCase()}`);\n\n return part in obj ? obj[part] : obj[snakePart];\n }, meta);\n\n return value != null ? String(value) : '';\n}\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Regular expression to detect a flow template literal wrapped in double braces.\n * Matches patterns like `{{ t(key) }}`, `{{ meta(key) }}`, etc.\n *\n * Note: this regex has no `g` flag \u2014 use `new RegExp(FLOW_TEMPLATE_LITERAL_REGEX.source, 'g')`\n * when global replacement is needed (e.g. in resolveFlowTemplateLiterals).\n */\nexport const FLOW_TEMPLATE_LITERAL_REGEX: RegExp = /\\{\\{\\s*([^}]+)\\s*\\}\\}/;\n\n/**\n * Regular expression to parse a function-call expression inside flow template braces.\n * Matches `funcName(arg)` and captures the function name and argument.\n */\nexport const FLOW_TEMPLATE_FUNCTION_REGEX: RegExp = /^(\\w+)\\(([^)]+)\\)$/;\n\n/**\n * Flow template literal types supported by the SDK.\n *\n * Values correspond to the function name used in the template expression,\n * so that a `{ t }` object from `useTranslation()` can be passed directly\n * as a handler map.\n */\nexport enum FlowTemplateLiteralType {\n /** Meta template literal \u2014 `{{ meta(path) }}` \u2014 resolves against flow/page metadata */\n META = 'meta',\n /** Translation template literal \u2014 `{{ t(key) }}` */\n TRANSLATION = 't',\n /** Unknown or unsupported template literal format */\n UNKNOWN = 'unknown',\n}\n\n/**\n * Result of parsing a flow template literal.\n */\nexport interface FlowTemplateLiteralResult {\n /**\n * The extracted key or path from the template literal.\n * e.g. `\"signin:heading\"` from `\"{{ t(signin:heading) }}\"`.\n */\n key?: string;\n /** The original template literal content before parsing */\n originalValue: string;\n /** The type of flow template literal that was detected */\n type: FlowTemplateLiteralType;\n}\n\n/**\n * Map of handler functions keyed by {@link FlowTemplateLiteralType}.\n *\n * When provided to a resolver, the matching handler is called with the extracted key.\n * Because `FlowTemplateLiteralType.TRANSLATION === 't'`, you can pass the `{ t }` object\n * from `useTranslation()` directly.\n *\n * @example\n * ```typescript\n * const { t } = useTranslation();\n * // handler map: { t: (key) => string }\n * ```\n */\nexport type FlowTemplateLiteralHandlers = Partial<Record<FlowTemplateLiteralType, (key: string) => string>>;\n\n/**\n * Parse a flow template literal content string and extract its type and key.\n *\n * Supports function-call expressions like:\n * - `t(signin:heading)` \u2192 type `TRANSLATION`, key `\"signin:heading\"`\n * - `meta(application.name)` \u2192 type `META`, key `\"application.name\"`\n *\n * Surrounding quotes on the key argument are stripped automatically.\n *\n * @param content - The content inside the template literal braces (without `{{ }}`).\n * @returns Parsed flow template literal information.\n *\n * @example\n * ```typescript\n * parseFlowTemplateLiteral('t(signin:heading)')\n * // { type: FlowTemplateLiteralType.TRANSLATION, key: 'signin:heading', originalValue: 't(signin:heading)' }\n *\n * parseFlowTemplateLiteral('meta(application.name)')\n * // { type: FlowTemplateLiteralType.META, key: 'application.name', originalValue: 'meta(application.name)' }\n * ```\n */\nexport default function parseFlowTemplateLiteral(content: string): FlowTemplateLiteralResult {\n const originalValue: string = content;\n const match: RegExpExecArray | null = FLOW_TEMPLATE_FUNCTION_REGEX.exec(content);\n\n if (!match) {\n return {originalValue, type: FlowTemplateLiteralType.UNKNOWN};\n }\n\n const [, functionName, rawKey] = match;\n const key: string = rawKey.trim().replace(/^['\"]|['\"]$/g, '');\n\n switch (functionName as FlowTemplateLiteralType) {\n case FlowTemplateLiteralType.TRANSLATION:\n return {key, originalValue, type: FlowTemplateLiteralType.TRANSLATION};\n case FlowTemplateLiteralType.META:\n return {key, originalValue, type: FlowTemplateLiteralType.META};\n default:\n return {originalValue, type: FlowTemplateLiteralType.UNKNOWN};\n }\n}\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport parseFlowTemplateLiteral, {\n FLOW_TEMPLATE_LITERAL_REGEX,\n FlowTemplateLiteralResult,\n FlowTemplateLiteralType,\n} from './parseFlowTemplateLiteral';\nimport resolveMeta from './resolveMeta';\nimport {TranslationFn} from '../../models/v2/translation';\nimport {ResolveFlowTemplateLiteralsOptions} from '../../models/v2/vars';\n\n/**\n * Global version of {@link FLOW_TEMPLATE_LITERAL_REGEX} for use with `String.prototype.replace`.\n */\nconst FLOW_TEMPLATE_LITERAL_REGEX_GLOBAL: RegExp = new RegExp(FLOW_TEMPLATE_LITERAL_REGEX.source, 'g');\n\n/**\n * Resolves all flow template literal expressions in a string.\n *\n * Supported patterns:\n * - `{{ t(key) }}` \u2014 resolved via the i18n translation function.\n * Colon-separated namespaces are converted to dots:\n * `{{ t(signin:heading.label) }}` \u2192 `t('signin.heading.label')`\n * - `{{ meta(path) }}` \u2014 resolved via a dot-path lookup on FlowMetadataResponse.\n * `{{ meta(application.name) }}` \u2192 `meta.application?.name`\n *\n * Flow template literals can be embedded inside larger strings:\n * `\"Login using {{ meta(application.name) }}\"` \u2192 `\"Login using My App\"`\n *\n * Unrecognized expressions are left unchanged.\n *\n * @template TFn - The concrete translation function type.\n *\n * @param text - The string to resolve (may contain zero or more flow template literals)\n * @param options - Resolution context: translation function and optional flow metadata\n * @returns The resolved string\n */\nexport default function resolveFlowTemplateLiterals<TFn extends TranslationFn = TranslationFn>(\n text: string | undefined,\n {t, meta}: ResolveFlowTemplateLiteralsOptions<TFn>,\n): string {\n if (!text) {\n return '';\n }\n\n return text.replace(FLOW_TEMPLATE_LITERAL_REGEX_GLOBAL, (match: string, content: string): string => {\n const parsed: FlowTemplateLiteralResult = parseFlowTemplateLiteral(content.trim());\n\n if (parsed.type === FlowTemplateLiteralType.TRANSLATION && parsed.key) {\n // Convert colon-separated namespace to dot-separated key\n // e.g. \"signin:fields.password.label\" \u2192 \"signin.fields.password.label\"\n return t(parsed.key.replace(/:/g, '.'));\n }\n\n if (parsed.type === FlowTemplateLiteralType.META && parsed.key && meta) {\n return resolveMeta(parsed.key, meta);\n }\n\n return match;\n });\n}\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Converts a two-letter ISO 3166-1 alpha-2 country code to a flag emoji using\n * Unicode Regional Indicator Symbols (U+1F1E6\u2013U+1F1FF).\n *\n * @param countryCode - Two-letter uppercase country code (e.g. \"US\", \"GB\")\n * @returns Flag emoji string (e.g. \"\uD83C\uDDFA\uD83C\uDDF8\", \"\uD83C\uDDEC\uD83C\uDDE7\")\n */\nexport default function countryCodeToFlagEmoji(countryCode: string): string {\n return countryCode\n .toUpperCase()\n .split('')\n .map((char: string) => String.fromCodePoint(0x1f1e6 - 65 + char.charCodeAt(0)))\n .join('');\n}\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Resolves a BCP 47 locale tag to a human-readable display name using the\n * `Intl.DisplayNames` API.\n *\n * Falls back to the raw locale code if the runtime does not support\n * `Intl.DisplayNames` or if resolution returns `undefined`.\n *\n * @param locale - BCP 47 locale tag to resolve (e.g. \"en\", \"fr\", \"zh-Hant\")\n * @param displayLocale - Locale used for the display name language (defaults to \"en\")\n * @returns Human-readable language name (e.g. \"English\", \"French\")\n */\nexport default function resolveLocaleDisplayName(locale: string, displayLocale: string): string {\n try {\n const displayNames: Intl.DisplayNames = new Intl.DisplayNames([displayLocale], {type: 'language'});\n return displayNames.of(locale) ?? locale;\n } catch {\n return locale;\n }\n}\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport countryCodeToFlagEmoji from './countryCodeToFlagEmoji';\n\n/**\n * Maps BCP 47 language subtags to ISO 3166-1 alpha-2 country codes used for\n * flag emoji resolution when no country subtag is present in the locale.\n */\nconst LANGUAGE_TO_COUNTRY: Readonly<Record<string, string>> = {\n am: 'ET',\n ar: 'SA',\n bn: 'BD',\n cs: 'CZ',\n da: 'DK',\n de: 'DE',\n el: 'GR',\n en: 'GB',\n es: 'ES',\n fa: 'IR',\n fi: 'FI',\n fr: 'FR',\n he: 'IL',\n hi: 'IN',\n hu: 'HU',\n id: 'ID',\n it: 'IT',\n ja: 'JP',\n ko: 'KR',\n ml: 'IN',\n ms: 'MY',\n nl: 'NL',\n no: 'NO',\n pl: 'PL',\n pt: 'PT',\n ro: 'RO',\n ru: 'RU',\n si: 'LK',\n sk: 'SK',\n sv: 'SE',\n sw: 'KE',\n ta: 'IN',\n th: 'TH',\n tr: 'TR',\n uk: 'UA',\n ur: 'PK',\n vi: 'VN',\n zh: 'CN',\n};\n\n/**\n * Resolves a BCP 47 locale tag to a flag emoji.\n *\n * Resolution order:\n * 1. Country subtag when present (e.g. `\"en-US\"` \u2192 \uD83C\uDDFA\uD83C\uDDF8)\n * 2. Language-to-country fallback map (e.g. `\"en\"` \u2192 \uD83C\uDDEC\uD83C\uDDE7)\n * 3. Globe emoji \uD83C\uDF10 for unrecognised codes\n *\n * @param locale - BCP 47 locale tag (e.g. \"en\", \"en-US\", \"fr-CA\")\n * @returns Flag or globe emoji string\n */\nfunction resolveLocaleEmoji(locale: string): string {\n const parts: string[] = locale.split('-');\n const languageCode: string = parts[0].toLowerCase();\n const countrySubtag: string | undefined = parts.length > 1 ? parts[parts.length - 1].toUpperCase() : undefined;\n\n const countryCode: string | undefined = countrySubtag ?? LANGUAGE_TO_COUNTRY[languageCode];\n\n if (!countryCode || countryCode.length !== 2) {\n return '\\u{1F310}'; // \uD83C\uDF10\n }\n\n return countryCodeToFlagEmoji(countryCode);\n}\nexport default resolveLocaleEmoji;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport VendorConstants from '../constants/VendorConstants';\n\n/**\n * Adds a vendor-specific prefix to a CSS class name.\n *\n * @param className - The original CSS class name to be prefixed\n * @returns A new string with the vendor prefix added to the class name\n *\n * @example\n * ```typescript\n * // Usage with clsx\n * clsx(withVendorCSSClassPrefix('sign-in-button'), className)\n * // Result: \"wso2-sign-in-button\"\n * ```\n */\nconst withVendorCSSClassPrefix = (className: string): string => `${VendorConstants.VENDOR_PREFIX}-${className}`;\n\nexport default withVendorCSSClassPrefix;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {BrandingPreference, BrandingTheme, ThemeVariant} from '../models/branding-preference';\nimport createTheme from '../theme/createTheme';\nimport {Theme, ThemeConfig} from '../theme/types';\n\n/**\n * Safely extracts a color value from the branding preference structure\n */\ntype ColorVariant = {contrastText?: string; dark?: string; main?: string};\ntype TextColors = {dark?: string; primary?: string; secondary?: string};\n\nconst extractColorValue = (colorVariant?: ColorVariant, preferDark: boolean = false): string | undefined => {\n if (preferDark && colorVariant?.dark && colorVariant.dark.trim()) {\n return colorVariant.dark;\n }\n return colorVariant?.main;\n};\n\n/**\n * Safely extracts contrast text color from the branding preference structure\n */\nconst extractContrastText = (colorVariant?: {contrastText?: string; main?: string}): string | undefined =>\n colorVariant?.contrastText;\n\n/**\n * Transforms a ThemeVariant from branding preference to ThemeConfig\n */\nconst transformThemeVariant = (themeVariant: ThemeVariant, isDark: boolean = false): Partial<ThemeConfig> => {\n const {buttons} = themeVariant;\n const {colors} = themeVariant;\n const {images} = themeVariant;\n const {inputs} = themeVariant;\n\n const config: Partial<ThemeConfig> = {\n colors: {\n action: {\n activatedOpacity: 0.12,\n active: isDark ? 'rgba(255, 255, 255, 0.70)' : 'rgba(0, 0, 0, 0.54)',\n disabled: isDark ? 'rgba(255, 255, 255, 0.26)' : 'rgba(0, 0, 0, 0.26)',\n disabledBackground: isDark ? 'rgba(255, 255, 255, 0.12)' : 'rgba(0, 0, 0, 0.12)',\n disabledOpacity: 0.38,\n focus: isDark ? 'rgba(255, 255, 255, 0.12)' : 'rgba(0, 0, 0, 0.12)',\n focusOpacity: 0.12,\n hover: isDark ? 'rgba(255, 255, 255, 0.04)' : 'rgba(0, 0, 0, 0.04)',\n hoverOpacity: 0.04,\n selected: isDark ? 'rgba(255, 255, 255, 0.08)' : 'rgba(0, 0, 0, 0.08)',\n selectedOpacity: 0.08,\n },\n background: {\n body: {\n dark: (colors?.background?.body as ColorVariant)?.dark || (colors?.background?.body as ColorVariant)?.main,\n main: extractColorValue(colors?.background?.body as ColorVariant, isDark),\n },\n dark:\n (colors?.background?.surface as ColorVariant)?.dark || (colors?.background?.surface as ColorVariant)?.main,\n disabled: extractColorValue(colors?.background?.surface as ColorVariant, isDark),\n surface: extractColorValue(colors?.background?.surface as ColorVariant, isDark),\n },\n border: colors?.outlined?.default,\n error: {\n contrastText: extractContrastText(colors?.alerts?.error),\n dark: (colors?.alerts?.error as ColorVariant)?.dark || (colors?.alerts?.error as ColorVariant)?.main,\n main: extractColorValue(colors?.alerts?.error as ColorVariant, isDark),\n },\n info: {\n contrastText: extractContrastText(colors?.alerts?.info),\n dark: (colors?.alerts?.info as ColorVariant)?.dark || (colors?.alerts?.info as ColorVariant)?.main,\n main: extractColorValue(colors?.alerts?.info as ColorVariant, isDark),\n },\n primary: {\n contrastText: extractContrastText(colors?.primary),\n dark: colors?.primary?.dark || (colors?.primary as ColorVariant)?.main,\n main: extractColorValue(colors?.primary as ColorVariant, isDark),\n },\n secondary: {\n contrastText: extractContrastText(colors?.secondary),\n dark: colors?.secondary?.dark || (colors?.secondary as ColorVariant)?.main,\n main: extractColorValue(colors?.secondary as ColorVariant, isDark),\n },\n success: {\n contrastText: extractContrastText(colors?.alerts?.neutral),\n dark: (colors?.alerts?.neutral as ColorVariant)?.dark || (colors?.alerts?.neutral as ColorVariant)?.main,\n main: extractColorValue(colors?.alerts?.neutral as ColorVariant, isDark),\n },\n text: {\n dark: (colors?.text as TextColors)?.dark || (colors?.text as TextColors)?.primary,\n primary: (colors?.text as TextColors)?.primary,\n secondary: (colors?.text as TextColors)?.secondary,\n },\n warning: {\n contrastText: extractContrastText(colors?.alerts?.warning),\n dark: (colors?.alerts?.warning as ColorVariant)?.dark || (colors?.alerts?.warning as ColorVariant)?.main,\n main: extractColorValue(colors?.alerts?.warning as ColorVariant, isDark),\n },\n },\n images: {\n favicon: images?.favicon\n ? {\n alt: images.favicon.altText,\n title: images.favicon.title,\n url: images.favicon.imgURL,\n }\n : undefined,\n logo: images?.logo\n ? {\n alt: images.logo.altText,\n title: images.logo.title,\n url: images.logo.imgURL,\n }\n : undefined,\n },\n };\n\n /* |---------------------------------------------------------------| */\n /* | Components | */\n /* |---------------------------------------------------------------| */\n\n const buttonBorderRadius: string | undefined = buttons?.primary?.base?.border?.borderRadius;\n const fieldBorderRadius: string | undefined = inputs?.base?.border?.borderRadius;\n\n if (buttonBorderRadius || fieldBorderRadius) {\n config.components = {\n ...(buttonBorderRadius && {\n Button: {\n styleOverrides: {\n root: {\n borderRadius: buttonBorderRadius,\n },\n },\n },\n }),\n ...(fieldBorderRadius && {\n Field: {\n styleOverrides: {\n root: {\n borderRadius: fieldBorderRadius,\n },\n },\n },\n }),\n };\n }\n\n return config;\n};\n\n/**\n * Transforms branding preference response to Theme object\n *\n * @param brandingPreference - The branding preference response from getBrandingPreference\n * @param forceTheme - Optional parameter to force a specific theme ('light' or 'dark'),\n * if not provided, will use the activeTheme from branding preference\n * @returns Theme object that can be used with the theme system\n *\n * The function extracts the following from branding preference:\n * - Colors (primary, secondary, background, text, alerts, etc.)\n * - Border radius from buttons and inputs\n * - Images (logo and favicon with their URLs, titles, and alt text)\n * - Typography settings\n *\n * @example\n * ```typescript\n * const brandingPreference = await getBrandingPreference({ baseUrl: \"...\" });\n * const theme = transformBrandingPreferenceToTheme(brandingPreference);\n *\n * // Access image URLs via CSS variables\n * // Logo: var(--wso2-image-logo-url)\n * // Favicon: var(--wso2-image-favicon-url)\n *\n * // Force light theme regardless of branding preference activeTheme\n * const lightTheme = transformBrandingPreferenceToTheme(brandingPreference, 'light');\n * ```\n */\nexport const transformBrandingPreferenceToTheme = (\n brandingPreference: BrandingPreference,\n forceTheme?: 'light' | 'dark',\n): Theme => {\n // Extract theme configuration\n const themeConfig: BrandingTheme | undefined = brandingPreference?.preference?.theme;\n\n if (!themeConfig) {\n // If no theme config is provided, return default light theme\n return createTheme({}, false);\n }\n\n // Determine which theme variant to use\n let activeThemeKey: string;\n if (forceTheme) {\n activeThemeKey = forceTheme.toUpperCase();\n } else {\n activeThemeKey = themeConfig.activeTheme || 'LIGHT';\n }\n\n // Get the theme variant (LIGHT or DARK)\n const themeVariant: ThemeVariant | undefined = themeConfig[\n activeThemeKey as keyof typeof themeConfig\n ] as ThemeVariant;\n\n if (!themeVariant) {\n // If the specified theme variant doesn't exist, fallback to light theme\n const fallbackVariant: ThemeVariant | undefined = themeConfig.LIGHT || themeConfig.DARK;\n if (fallbackVariant) {\n const transformedConfig: Partial<ThemeConfig> = transformThemeVariant(fallbackVariant, activeThemeKey === 'DARK');\n return createTheme(transformedConfig, activeThemeKey === 'DARK');\n }\n // If no theme variants exist, return default theme\n return createTheme({}, activeThemeKey === 'DARK');\n }\n\n // Transform the theme variant to ThemeConfig\n const transformedConfig: Partial<ThemeConfig> = transformThemeVariant(themeVariant, activeThemeKey === 'DARK');\n\n // Create the theme using the transformed config\n return createTheme(transformedConfig, activeThemeKey === 'DARK');\n};\n\nexport default transformBrandingPreferenceToTheme;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {HttpError, HttpRequestConfig, HttpResponse} from './models/http';\n\n/**\n * Abstract base class for HTTP clients. Owns all handler/callback state and\n * the request lifecycle (pre-processing, transport, post-processing).\n *\n * Extend this class and implement `transport()` to plug in a custom HTTP transport.\n *\n * @example\n * ```ts\n * class MyHttpClient extends HttpClient {\n * protected async transport<T>(config: HttpRequestConfig): Promise<HttpResponse<T>> {\n * // custom fetch logic\n * }\n * }\n * ```\n */\nexport abstract class HttpClient {\n private static readonly DEFAULT_HANDLER_DISABLE_TIMEOUT: number = 1000;\n\n // eslint-disable-next-line class-methods-use-this\n private requestStartCallback: (request: HttpRequestConfig) => void = () => null;\n\n // eslint-disable-next-line class-methods-use-this\n private requestSuccessCallback: (response: HttpResponse) => void = () => null;\n\n // eslint-disable-next-line class-methods-use-this\n private requestErrorCallback: (error: HttpError) => void = () => null;\n\n // eslint-disable-next-line class-methods-use-this\n private requestFinishCallback: () => void = () => null;\n\n constructor(\n private isHandlerEnabled: boolean = true,\n private attachToken: (request: HttpRequestConfig) => Promise<void> = (): Promise<void> => Promise.resolve(),\n ) {}\n\n /**\n * Implemented by subclasses. Performs the actual HTTP call with no handler\n * logic applied \u2014 that is handled by `request()`.\n */\n protected abstract transport<T = any>(config: HttpRequestConfig): Promise<HttpResponse<T>>;\n\n /**\n * Public HTTP request entry point. Applies pre/post processing around `transport()`.\n */\n async request<T = any>(config: HttpRequestConfig): Promise<HttpResponse<T>> {\n const processedConfig: HttpRequestConfig = await this.requestHandler(config);\n try {\n const response: HttpResponse<T> = await this.transport<T>(processedConfig);\n return this.successHandler(response);\n } catch (error: any) {\n this.errorHandler(error as HttpError);\n throw error;\n }\n }\n\n enableHandler(): void {\n this.isHandlerEnabled = true;\n }\n\n disableHandler(): void {\n this.isHandlerEnabled = false;\n }\n\n disableHandlerWithTimeout(timeout: number = HttpClient.DEFAULT_HANDLER_DISABLE_TIMEOUT): void {\n this.isHandlerEnabled = false;\n setTimeout(() => {\n this.isHandlerEnabled = true;\n }, timeout);\n }\n\n setHttpRequestStartCallback(cb: (req: HttpRequestConfig) => void): void {\n this.requestStartCallback = cb;\n }\n\n setHttpRequestSuccessCallback(cb: (res: HttpResponse) => void): void {\n this.requestSuccessCallback = cb;\n }\n\n setHttpRequestErrorCallback(cb: (err: HttpError) => void): void {\n this.requestErrorCallback = cb;\n }\n\n setHttpRequestFinishCallback(cb: () => void): void {\n this.requestFinishCallback = cb;\n }\n\n // eslint-disable-next-line class-methods-use-this\n all<T>(values: (T | Promise<T>)[]): Promise<T[]> {\n return Promise.all(values);\n }\n\n // eslint-disable-next-line class-methods-use-this\n spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R {\n return (array: T[]) => callback(...array);\n }\n\n protected async requestHandler(config: HttpRequestConfig): Promise<HttpRequestConfig> {\n await this.attachToken(config);\n\n if (config.shouldEncodeToFormData && config.data) {\n const formData: FormData = new FormData();\n Object.keys(config.data).forEach((key: string) => formData.append(key, config.data[key]));\n // eslint-disable-next-line no-param-reassign\n config.data = formData;\n }\n\n // eslint-disable-next-line no-param-reassign\n config.startTimeInMs = Date.now();\n\n if (this.isHandlerEnabled && typeof this.requestStartCallback === 'function') {\n this.requestStartCallback(config);\n }\n\n return config;\n }\n\n protected successHandler(response: HttpResponse): HttpResponse {\n if (this.isHandlerEnabled) {\n if (typeof this.requestSuccessCallback === 'function') {\n this.requestSuccessCallback(response);\n }\n if (typeof this.requestFinishCallback === 'function') {\n this.requestFinishCallback();\n }\n }\n return response;\n }\n\n protected errorHandler(error: HttpError): void {\n if (this.isHandlerEnabled) {\n if (typeof this.requestErrorCallback === 'function') {\n this.requestErrorCallback(error);\n }\n if (typeof this.requestFinishCallback === 'function') {\n this.requestFinishCallback();\n }\n }\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qCAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAAC;AAAA,EAAA;AAAA;AAAA,gCAAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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D;AACpF,UAAM,KAAK,YAAY,MAAM;AAE7B,QAAI,OAAO,0BAA0B,OAAO,MAAM;AAChD,YAAM,WAAqB,IAAI,SAAS;AACxC,aAAO,KAAK,OAAO,IAAI,EAAE,QAAQ,CAAC,QAAgB,SAAS,OAAO,KAAK,OAAO,KAAK,GAAG,CAAC,CAAC;AAExF,aAAO,OAAO;AAAA,IAChB;AAGA,WAAO,gBAAgB,KAAK,IAAI;AAEhC,QAAI,KAAK,oBAAoB,OAAO,KAAK,yBAAyB,YAAY;AAC5E,WAAK,qBAAqB,MAAM;AAAA,IAClC;AAEA,WAAO;AAAA,EACT;AAAA,EAEU,eAAe,UAAsC;AAC7D,QAAI,KAAK,kBAAkB;AACzB,UAAI,OAAO,KAAK,2BAA2B,YAAY;AACrD,aAAK,uBAAuB,QAAQ;AAAA,MACtC;AACA,UAAI,OAAO,KAAK,0BAA0B,YAAY;AACpD,aAAK,sBAAsB;AAAA,MAC7B;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA,EAEU,aAAaA,QAAwB;AAC7C,QAAI,KAAK,kBAAkB;AACzB,UAAI,OAAO,KAAK,yBAAyB,YAAY;AACnD,aAAK,qBAAqBA,MAAK;AAAA,MACjC;AACA,UAAI,OAAO,KAAK,0BAA0B,YAAY;AACpD,aAAK,sBAAsB;AAAA,MAC7B;AAAA,IACF;AAAA,EACF;AACF;AA1HE,cADoB,aACI,mCAA0C;AAD7D,IAAe,aAAf;",
|
|
6
|
-
"names": ["EmbeddedFlowComponentType", "EmbeddedSignInFlowStatus", "EmbeddedSignInFlowType", "Platform", "error", "tokenResponse", "OIDCDiscoveryConstants", "OIDCDiscoveryConstants_default", "error", "error", "OIDCDiscoveryConstants_default", "error", "error", "error", "EmbeddedFlowType", "EmbeddedFlowStatus", "EmbeddedFlowResponseType", "EmbeddedFlowComponentType", "error", "error", "error", "error", "error", "error", "error", "error", "error", "error", "error", "EmbeddedSignInFlowStatus", "EmbeddedSignInFlowType", "EmbeddedSignUpFlowStatus", "EmbeddedSignUpFlowType", "EmbeddedSignInFlowStatus", "EmbeddedSignInFlowType", "EmbeddedSignInFlowStepType", "EmbeddedSignInFlowAuthenticatorParamType", "EmbeddedSignInFlowAuthenticatorKnownIdPType", "EmbeddedSignInFlowAuthenticatorPromptType", "EmbeddedFlowComponentType", "EmbeddedFlowActionVariant", "EmbeddedFlowTextVariant", "EmbeddedFlowEventType", "FlowMetaType", "FlowMode", "AgentConfig", "WellKnownSchemaIds", "FieldType", "base64url", "error", "error", "error", "url", "transformedConfig", "error"]
|
|
3
|
+
"sources": ["../../src/index.ts", "../../src/constants/OIDCDiscoveryConstants.ts", "../../src/constants/TokenExchangeConstants.ts", "../../src/errors/exception.ts", "../../src/models/platforms.ts", "../../src/utils/extractUserClaimsFromIdToken.ts", "../../src/constants/ScopeConstants.ts", "../../src/constants/OIDCRequestConstants.ts", "../../src/errors/AsgardeoError.ts", "../../src/errors/AsgardeoRuntimeError.ts", "../../src/utils/processOpenIDScopes.ts", "../../src/__legacy__/helpers/authentication-helper.ts", "../../src/constants/PKCEConstants.ts", "../../src/constants/v2/OIDCDiscoveryConstants.ts", "../../src/constants/TokenConstants.ts", "../../src/IsomorphicCrypto.ts", "../../src/StorageManager.ts", "../../src/utils/deepMerge.ts", "../../src/utils/extractPkceStorageKeyFromState.ts", "../../src/utils/generatePkceStorageKey.ts", "../../src/utils/generateStateParamForRequestCorrelation.ts", "../../src/utils/getAuthorizeRequestUrlParams.ts", "../../src/__legacy__/client.ts", "../../src/utils/parseApiErrorMessage.ts", "../../src/errors/AsgardeoAPIError.ts", "../../src/api/initializeEmbeddedSignInFlow.ts", "../../src/api/executeEmbeddedSignInFlow.ts", "../../src/models/embedded-flow.ts", "../../src/api/executeEmbeddedSignUpFlow.ts", "../../src/api/getUserInfo.ts", "../../src/utils/processUsername.ts", "../../src/api/getScim2Me.ts", "../../src/api/getSchemas.ts", "../../src/api/getAllOrganizations.ts", "../../src/api/createOrganization.ts", "../../src/api/getMeOrganizations.ts", "../../src/api/getOrganization.ts", "../../src/utils/isEmpty.ts", "../../src/api/updateOrganization.ts", "../../src/api/updateMeProfile.ts", "../../src/api/getBrandingPreference.ts", "../../src/models/v2/embedded-signin-flow-v2.ts", "../../src/api/v2/executeEmbeddedSignInFlowV2.ts", "../../src/models/v2/embedded-signup-flow-v2.ts", "../../src/api/v2/executeEmbeddedSignUpFlowV2.ts", "../../src/api/v2/executeEmbeddedRecoveryFlowV2.ts", "../../src/api/v2/executeEmbeddedUserOnboardingFlowV2.ts", "../../src/api/v2/getFlowMetaV2.ts", "../../src/api/v2/getOrganizationUnitChildren.ts", "../../src/constants/ApplicationNativeAuthenticationConstants.ts", "../../src/constants/VendorConstants.ts", "../../src/models/embedded-signin-flow.ts", "../../src/models/v2/embedded-flow-v2.ts", "../../src/models/v2/embedded-recovery-flow-v2.ts", "../../src/models/v2/flow-meta-v2.ts", "../../src/models/flow.ts", "../../src/models/agent.ts", "../../src/models/scim2-schema.ts", "../../src/models/field.ts", "../../src/DefaultCacheStore.ts", "../../src/DefaultCrypto.ts", "../../src/AsgardeoJavaScriptClient.ts", "../../src/theme/createTheme.ts", "../../src/utils/arrayBufferToBase64url.ts", "../../src/utils/base64urlToArrayBuffer.ts", "../../src/utils/bem.ts", "../../src/utils/formatDate.ts", "../../src/utils/logger.ts", "../../src/utils/deriveOrganizationHandleFromBaseUrl.ts", "../../src/utils/isRecognizedBaseUrlPattern.ts", "../../src/utils/flattenUserSchema.ts", "../../src/utils/get.ts", "../../src/utils/set.ts", "../../src/utils/generateUserProfile.ts", "../../src/utils/getLatestStateParam.ts", "../../src/utils/generateFlattenedUserProfile.ts", "../../src/utils/identifyPlatform.ts", "../../src/utils/getRedirectBasedSignUpUrl.ts", "../../src/utils/v2/isEmojiUri.ts", "../../src/utils/v2/extractEmojiFromUri.ts", "../../src/utils/removeTrailingSlash.ts", "../../src/utils/resolveFieldType.ts", "../../src/utils/resolveFieldName.ts", "../../src/utils/v2/resolveMeta.ts", "../../src/utils/v2/parseFlowTemplateLiteral.ts", "../../src/utils/v2/resolveFlowTemplateLiterals.ts", "../../src/utils/v2/countryCodeToFlagEmoji.ts", "../../src/utils/v2/resolveLocaleDisplayName.ts", "../../src/utils/v2/resolveLocaleEmoji.ts", "../../src/utils/withVendorCSSClassPrefix.ts", "../../src/utils/transformBrandingPreferenceToTheme.ts", "../../src/HttpClient.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright (c) 2020-2026, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport {AsgardeoAuthClient} from './__legacy__/client';\nexport {\n DefaultAuthClientConfig,\n WellKnownAuthClientConfig,\n BaseURLAuthClientConfig,\n ExplicitAuthClientConfig,\n StrictAuthClientConfig,\n AuthClientConfig,\n} from './__legacy__/models';\n\nexport {IsomorphicCrypto} from './IsomorphicCrypto';\n\nexport {default as initializeEmbeddedSignInFlow} from './api/initializeEmbeddedSignInFlow';\nexport {default as executeEmbeddedSignInFlow} from './api/executeEmbeddedSignInFlow';\nexport {default as executeEmbeddedSignUpFlow} from './api/executeEmbeddedSignUpFlow';\nexport {default as getUserInfo} from './api/getUserInfo';\nexport {default as getScim2Me, GetScim2MeConfig} from './api/getScim2Me';\nexport {default as getSchemas, GetSchemasConfig} from './api/getSchemas';\nexport {default as getAllOrganizations, GetAllOrganizationsConfig} from './api/getAllOrganizations';\nexport {\n default as createOrganization,\n CreateOrganizationPayload,\n CreateOrganizationConfig,\n} from './api/createOrganization';\nexport {default as getMeOrganizations, GetMeOrganizationsConfig} from './api/getMeOrganizations';\nexport {default as getOrganization, OrganizationDetails, GetOrganizationConfig} from './api/getOrganization';\nexport {default as updateOrganization, createPatchOperations, UpdateOrganizationConfig} from './api/updateOrganization';\nexport {default as updateMeProfile, UpdateMeProfileConfig} from './api/updateMeProfile';\nexport {default as getBrandingPreference, GetBrandingPreferenceConfig} from './api/getBrandingPreference';\nexport {default as executeEmbeddedSignInFlowV2} from './api/v2/executeEmbeddedSignInFlowV2';\nexport {default as executeEmbeddedSignUpFlowV2} from './api/v2/executeEmbeddedSignUpFlowV2';\nexport {default as executeEmbeddedRecoveryFlowV2} from './api/v2/executeEmbeddedRecoveryFlowV2';\nexport {\n default as executeEmbeddedUserOnboardingFlowV2,\n EmbeddedUserOnboardingFlowResponse,\n} from './api/v2/executeEmbeddedUserOnboardingFlowV2';\nexport {default as getFlowMetaV2} from './api/v2/getFlowMetaV2';\nexport {default as getOrganizationUnitChildren} from './api/v2/getOrganizationUnitChildren';\n\nexport {default as ApplicationNativeAuthenticationConstants} from './constants/ApplicationNativeAuthenticationConstants';\nexport {default as TokenConstants} from './constants/TokenConstants';\nexport {default as OIDCRequestConstants} from './constants/OIDCRequestConstants';\nexport {default as VendorConstants} from './constants/VendorConstants';\n\nexport {default as AsgardeoError} from './errors/AsgardeoError';\nexport {default as AsgardeoAPIError} from './errors/AsgardeoAPIError';\nexport {default as AsgardeoRuntimeError} from './errors/AsgardeoRuntimeError';\nexport {AsgardeoAuthException} from './errors/exception';\n\nexport {AllOrganizationsApiResponse} from './models/organization';\nexport {Platform} from './models/platforms';\nexport {\n EmbeddedSignInFlowInitiateResponse,\n EmbeddedSignInFlowStatus,\n EmbeddedSignInFlowType,\n EmbeddedSignInFlowStepType,\n EmbeddedSignInFlowAuthenticator,\n EmbeddedSignInFlowLink,\n EmbeddedSignInFlowHandleRequestPayload,\n EmbeddedSignInFlowHandleResponse,\n EmbeddedSignInFlowAuthenticatorParamType,\n EmbeddedSignInFlowAuthenticatorPromptType,\n EmbeddedSignInFlowAuthenticatorKnownIdPType,\n} from './models/embedded-signin-flow';\nexport {\n EmbeddedFlowComponentType as EmbeddedFlowComponentTypeV2,\n EmbeddedFlowActionVariant as EmbeddedFlowActionVariantV2,\n EmbeddedFlowTextVariant as EmbeddedFlowTextVariantV2,\n EmbeddedFlowEventType as EmbeddedFlowEventTypeV2,\n EmbeddedFlowComponent as EmbeddedFlowComponentV2,\n EmbeddedFlowResponseData as EmbeddedFlowResponseDataV2,\n EmbeddedFlowExecuteRequestConfig as EmbeddedFlowExecuteRequestConfigV2,\n ConsentAttributeElement as ConsentAttributeElementV2,\n ConsentPurposeDecision as ConsentPurposeDecisionV2,\n ConsentDecisions as ConsentDecisionsV2,\n ConsentPurposeData as ConsentPurposeDataV2,\n ConsentPromptData as ConsentPromptDataV2,\n} from './models/v2/embedded-flow-v2';\nexport {\n EmbeddedSignInFlowStatus as EmbeddedSignInFlowStatusV2,\n EmbeddedSignInFlowType as EmbeddedSignInFlowTypeV2,\n ExtendedEmbeddedSignInFlowResponse as ExtendedEmbeddedSignInFlowResponseV2,\n EmbeddedSignInFlowResponse as EmbeddedSignInFlowResponseV2,\n EmbeddedSignInFlowCompleteResponse as EmbeddedSignInFlowCompleteResponseV2,\n EmbeddedSignInFlowInitiateRequest as EmbeddedSignInFlowInitiateRequestV2,\n EmbeddedSignInFlowRequest as EmbeddedSignInFlowRequestV2,\n} from './models/v2/embedded-signin-flow-v2';\nexport {\n EmbeddedSignUpFlowStatus as EmbeddedSignUpFlowStatusV2,\n EmbeddedSignUpFlowType as EmbeddedSignUpFlowTypeV2,\n ExtendedEmbeddedSignUpFlowResponse as ExtendedEmbeddedSignUpFlowResponseV2,\n EmbeddedSignUpFlowResponse as EmbeddedSignUpFlowResponseV2,\n EmbeddedSignUpFlowCompleteResponse as EmbeddedSignUpFlowCompleteResponseV2,\n EmbeddedSignUpFlowInitiateRequest as EmbeddedSignUpFlowInitiateRequestV2,\n EmbeddedSignUpFlowRequest as EmbeddedSignUpFlowRequestV2,\n EmbeddedSignUpFlowErrorResponse as EmbeddedSignUpFlowErrorResponseV2,\n} from './models/v2/embedded-signup-flow-v2';\nexport {\n EmbeddedRecoveryFlowStatus as EmbeddedRecoveryFlowStatusV2,\n EmbeddedRecoveryFlowType as EmbeddedRecoveryFlowTypeV2,\n EmbeddedRecoveryFlowResponse as EmbeddedRecoveryFlowResponseV2,\n EmbeddedRecoveryFlowInitiateRequest as EmbeddedRecoveryFlowInitiateRequestV2,\n EmbeddedRecoveryFlowRequest as EmbeddedRecoveryFlowRequestV2,\n EmbeddedRecoveryFlowErrorResponse as EmbeddedRecoveryFlowErrorResponseV2,\n} from './models/v2/embedded-recovery-flow-v2';\nexport {\n OrganizationUnit,\n OrganizationUnitListResponse,\n GetOrganizationUnitChildrenConfig,\n} from './models/v2/organization-unit';\nexport {\n FlowMetaType,\n ApplicationMetadata,\n OUMetadata,\n DesignMetadata,\n I18nMetadata,\n FlowMetadataResponse,\n GetFlowMetaRequestConfig,\n FlowMetaTheme,\n FlowMetaThemeColorSet,\n FlowMetaThemeBackground,\n FlowMetaThemeTextColors,\n FlowMetaThemeColors,\n FlowMetaThemeColorScheme,\n FlowMetaThemeShape,\n FlowMetaThemeTypography,\n} from './models/v2/flow-meta-v2';\nexport {\n EmbeddedFlowType,\n EmbeddedFlowStatus,\n EmbeddedFlowExecuteResponse,\n EmbeddedFlowResponseType,\n EmbeddedSignUpFlowData,\n EmbeddedFlowComponent,\n EmbeddedFlowComponentType,\n EmbeddedFlowExecuteRequestPayload,\n EmbeddedFlowExecuteRequestConfig,\n EmbeddedFlowExecuteErrorResponse,\n} from './models/embedded-flow';\nexport {FlowMode} from './models/flow';\nexport {AsgardeoClient} from './models/client';\nexport {\n BaseConfig,\n Config,\n Preferences,\n ThemePreferences,\n I18nPreferences,\n I18nStorageStrategy,\n WithPreferences,\n Extensions,\n WithExtensions,\n SignInOptions,\n SignOutOptions,\n SignUpOptions,\n} from './models/config';\nexport type {ComponentRenderContext, ComponentRenderer, ComponentsExtensions} from './models/v2/extensions/components';\nexport {TokenResponse, IdToken, TokenExchangeRequestConfig} from './models/token';\nexport {AgentConfig} from './models/agent';\nexport {AuthCodeResponse} from './models/auth-code-response';\nexport {Crypto, JWKInterface} from './models/crypto';\nexport {OAuthResponseMode} from './models/oauth-response';\nexport {\n AuthorizeRequestUrlParams,\n KnownExtendedAuthorizeRequestUrlParams,\n ExtendedAuthorizeRequestUrlParams,\n} from './models/oauth-request';\nexport {OIDCEndpoints} from './models/oidc-endpoints';\nexport {OIDCDiscoveryApiResponse} from './models/oidc-discovery';\nexport {Storage, TemporaryStore} from './models/store';\nexport {User, UserProfile} from './models/user';\nexport {SessionData} from './models/session';\nexport {Organization} from './models/organization';\nexport {TranslationFn} from './models/v2/translation';\nexport {ResolveFlowTemplateLiteralsOptions} from './models/v2/vars';\nexport {\n BrandingPreference,\n BrandingPreferenceConfig,\n BrandingLayout,\n BrandingTheme,\n ThemeVariant,\n ButtonsConfig,\n ColorsConfig,\n ColorVariants,\n BrandingOrganizationDetails,\n UrlsConfig,\n} from './models/branding-preference';\nexport {Schema, SchemaAttribute, WellKnownSchemaIds, FlattenedSchema} from './models/scim2-schema';\nexport {RecursivePartial} from './models/utility-types';\nexport {FieldType} from './models/field';\n\nexport {default as AsgardeoJavaScriptClient} from './AsgardeoJavaScriptClient';\n\nexport {default as createTheme, DEFAULT_THEME} from './theme/createTheme';\nexport {ThemeColors, ThemeConfig, Theme, ThemeMode, ThemeDetection} from './theme/types';\n\nexport {default as arrayBufferToBase64url} from './utils/arrayBufferToBase64url';\nexport {default as base64urlToArrayBuffer} from './utils/base64urlToArrayBuffer';\nexport {default as bem} from './utils/bem';\nexport {default as formatDate} from './utils/formatDate';\nexport {default as processUsername} from './utils/processUsername';\nexport {default as deepMerge} from './utils/deepMerge';\nexport {default as deriveOrganizationHandleFromBaseUrl} from './utils/deriveOrganizationHandleFromBaseUrl';\nexport {default as extractUserClaimsFromIdToken} from './utils/extractUserClaimsFromIdToken';\nexport {default as isRecognizedBaseUrlPattern} from './utils/isRecognizedBaseUrlPattern';\nexport {default as extractPkceStorageKeyFromState} from './utils/extractPkceStorageKeyFromState';\nexport {default as flattenUserSchema} from './utils/flattenUserSchema';\nexport {default as generateUserProfile} from './utils/generateUserProfile';\nexport {default as getLatestStateParam} from './utils/getLatestStateParam';\nexport {default as generateFlattenedUserProfile} from './utils/generateFlattenedUserProfile';\nexport {default as getRedirectBasedSignUpUrl} from './utils/getRedirectBasedSignUpUrl';\nexport {default as identifyPlatform} from './utils/identifyPlatform';\nexport {default as isEmpty} from './utils/isEmpty';\nexport {default as isEmojiUri, EMOJI_URI_SCHEME} from './utils/v2/isEmojiUri';\nexport {default as extractEmojiFromUri} from './utils/v2/extractEmojiFromUri';\nexport {default as set} from './utils/set';\nexport {default as get} from './utils/get';\nexport {default as removeTrailingSlash} from './utils/removeTrailingSlash';\nexport {default as resolveFieldType} from './utils/resolveFieldType';\nexport {default as resolveFieldName} from './utils/resolveFieldName';\nexport {default as resolveMeta} from './utils/v2/resolveMeta';\nexport {default as resolveFlowTemplateLiterals} from './utils/v2/resolveFlowTemplateLiterals';\nexport {default as countryCodeToFlagEmoji} from './utils/v2/countryCodeToFlagEmoji';\nexport {default as resolveLocaleDisplayName} from './utils/v2/resolveLocaleDisplayName';\nexport {default as resolveLocaleEmoji} from './utils/v2/resolveLocaleEmoji';\nexport {default as processOpenIDScopes} from './utils/processOpenIDScopes';\nexport {default as withVendorCSSClassPrefix} from './utils/withVendorCSSClassPrefix';\nexport {default as transformBrandingPreferenceToTheme} from './utils/transformBrandingPreferenceToTheme';\n\nexport {\n default as logger,\n createLogger,\n createComponentLogger,\n createPackageLogger,\n createPackageComponentLogger,\n LogLevel,\n configure as configureLogger,\n debug,\n info,\n warn,\n error,\n} from './utils/logger';\nexport type {LoggerConfig} from './utils/logger';\n\nexport {default as StorageManager} from './StorageManager';\n\nexport {HttpClient} from './HttpClient';\nexport {HttpError, HttpRequestConfig, HttpResponse} from './models/http';\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Constants related to OpenID Connect (OIDC) metadata and endpoints.\n * This object contains all the standard OIDC endpoints and storage keys\n * used throughout the application for authentication and authorization.\n *\n * @remarks\n * The constants are organized into two main sections:\n * 1. Endpoints - Contains all OIDC standard endpoint paths\n * 2. Storage - Contains keys used for storing OIDC-related data\n *\n * @example\n * ```typescript\n * // Using an endpoint\n * const authEndpoint = OIDCDiscoveryConstants.Endpoints.AUTHORIZATION;\n *\n * // Using a storage key\n * const tokenKey = OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.TOKEN;\n * ```\n */\nconst OIDCDiscoveryConstants: {\n readonly Endpoints: {\n readonly AUTHORIZATION: string;\n readonly END_SESSION: string;\n readonly ISSUER: string;\n readonly JWKS: string;\n readonly REVOCATION: string;\n readonly SESSION_IFRAME: string;\n readonly TOKEN: string;\n readonly USERINFO: string;\n };\n readonly Storage: {\n readonly StorageKeys: {\n readonly Endpoints: {\n readonly AUTHORIZATION: string;\n readonly END_SESSION: string;\n readonly ISSUER: string;\n readonly JWKS: string;\n readonly REVOCATION: string;\n readonly SESSION_IFRAME: string;\n readonly TOKEN: string;\n readonly USERINFO: string;\n };\n readonly OPENID_PROVIDER_CONFIG_INITIATED: string;\n };\n };\n} = {\n /**\n * Collection of standard OIDC endpoint paths used for authentication flows.\n * These endpoints are relative paths that should be appended to the base URL\n * of your identity provider.\n */\n\n Endpoints: {\n /**\n * Authorization endpoint for initiating the OAuth2/OIDC flow.\n * This endpoint is used to request authorization and receive an authorization code.\n */\n AUTHORIZATION: '/oauth2/authorize',\n\n /**\n * End session endpoint for logout functionality.\n * Used to terminate the user's session and perform logout operations.\n */\n END_SESSION: '/oidc/logout',\n\n /**\n * Token issuer endpoint.\n * The endpoint that issues OAuth2/OIDC tokens.\n */\n ISSUER: '/oauth2/token',\n\n /**\n * JSON Web Key Set endpoint for key validation.\n * Provides the public keys used to verify token signatures.\n */\n JWKS: '/oauth2/jwks',\n\n /**\n * Token revocation endpoint.\n * Used to invalidate access or refresh tokens before they expire.\n */\n REVOCATION: '/oauth2/revoke',\n\n /**\n * Session check iframe endpoint for session management.\n * Used to monitor the user's session state through a hidden iframe.\n */\n SESSION_IFRAME: '/oidc/checksession',\n\n /**\n * Token endpoint for obtaining access tokens.\n * Used to exchange authorization codes for access tokens and refresh tokens.\n */\n TOKEN: '/oauth2/token',\n\n /**\n * UserInfo endpoint for obtaining user claims.\n * Provides authenticated user information when called with a valid access token.\n */\n USERINFO: '/oauth2/userinfo',\n },\n\n /**\n * Storage related constants used for maintaining OIDC state.\n * These constants define the keys used to store OIDC-related data\n * in the browser's storage mechanisms.\n */\n\n Storage: {\n /**\n * Storage keys for various OIDC endpoints and configurations.\n * These keys are used to store endpoint URLs and configuration\n * states in the browser's storage.\n */\n\n StorageKeys: {\n /**\n * Collection of storage keys for OIDC endpoints.\n * These keys are used to store the discovered endpoint URLs\n * from the OpenID Provider's configuration.\n */\n\n Endpoints: {\n /**\n * Storage key for the authorization endpoint URL.\n * Used to store the URL where authorization requests should be sent.\n */\n AUTHORIZATION: 'authorization_endpoint',\n\n /**\n * Storage key for the end session endpoint URL.\n * Used to store the URL where logout requests should be sent.\n */\n END_SESSION: 'end_session_endpoint',\n\n /**\n * Storage key for the issuer identifier URL.\n * Used to store the URL that identifies the OpenID Provider.\n */\n ISSUER: 'issuer',\n\n /**\n * Storage key for the JWKS URI endpoint URL.\n * Used to store the URL where JSON Web Key Sets can be retrieved.\n */\n JWKS: 'jwks_uri',\n\n /**\n * Storage key for the revocation endpoint URL.\n * Used to store the URL where token revocation requests should be sent.\n */\n REVOCATION: 'revocation_endpoint',\n\n /**\n * Storage key for the session check iframe URL.\n * Used to store the URL of the iframe used for session state monitoring.\n */\n SESSION_IFRAME: 'check_session_iframe',\n\n /**\n * Storage key for the token endpoint URL.\n * Used to store the URL where token requests should be sent.\n */\n TOKEN: 'token_endpoint',\n\n /**\n * Storage key for the userinfo endpoint URL.\n * Used to store the URL where user information can be retrieved.\n */\n USERINFO: 'userinfo_endpoint',\n },\n\n /**\n * Flag to track if OpenID Provider configuration is initiated.\n * Used to determine if the OIDC discovery process has been started.\n * This helps prevent duplicate initialization attempts.\n */\n OPENID_PROVIDER_CONFIG_INITIATED: 'op_config_initiated',\n },\n },\n} as const;\n\nexport default OIDCDiscoveryConstants;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Constants for OAuth 2.0 Token Exchange operations.\n * This object contains placeholders used in token exchange requests\n * and responses for dynamic value substitution.\n *\n * @remarks\n * These placeholders are used in token exchange templates and are replaced\n * with actual values during request processing. They help in creating\n * flexible and reusable token exchange configurations.\n *\n * @example\n * ```typescript\n * // Using placeholders in a token exchange template\n * const template = `grant_type=urn:ietf:params:oauth:grant-type:token-exchange&subject_token=${TokenExchangeConstants.Placeholders.TOKEN}`;\n * ```\n */\nconst TokenExchangeConstants: {\n readonly Placeholders: {\n readonly ACCESS_TOKEN: string;\n readonly CLIENT_ID: string;\n readonly CLIENT_SECRET: string;\n readonly SCOPES: string;\n readonly USERNAME: string;\n };\n} = {\n /**\n * Collection of placeholder strings used in token exchange operations.\n * These placeholders are replaced with actual values when processing\n * token exchange requests.\n */\n Placeholders: {\n /**\n * Placeholder for the token value in exchange requests.\n * Usually replaced with an access token or refresh token.\n */\n ACCESS_TOKEN: '{{accessToken}}',\n\n /**\n * Placeholder for client ID in token exchange operations.\n * Required for client authentication.\n */\n CLIENT_ID: '{{clientId}}',\n\n /**\n * Placeholder for client secret in token exchange operations.\n * Used for client authentication in confidential client flows.\n */\n CLIENT_SECRET: '{{clientSecret}}',\n\n /**\n * Placeholder for OAuth scopes in token exchange requests.\n * Replaced with space-separated scope strings.\n */\n SCOPES: '{{scopes}}',\n\n /**\n * Placeholder for the username in token exchange operations.\n * Used when user identity needs to be included in the exchange.\n */\n USERNAME: '{{username}}',\n },\n} as const;\n\nexport default TokenExchangeConstants;\n", "/**\n * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * @deprecated Use `AsgardeoRuntimeError` for runtime errors and `AsgardeoAPIError` for API errors.\n */\nexport class AsgardeoAuthException {\n public name: string;\n\n public code: string | undefined;\n\n public message: string;\n\n public constructor(code: string, name: string, message: string) {\n this.message = message;\n this.name = name;\n this.code = code;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Enumeration of supported identity platforms.\n *\n * - `Asgardeo`: Represents the Asgardeo cloud identity platform (asgardeo.io domains).\n * - `IdentityServer`: Represents WSO2 Identity Server (on-prem or custom domains).\n * - `Unknown`: Used when the platform cannot be determined from the configuration.\n *\n * This enum is used to distinguish between different identity providers and to\n * enable platform-specific logic throughout the SDK.\n */\nexport enum Platform {\n /** Asgardeo cloud identity platform (asgardeo.io domains) */\n Asgardeo = 'ASGARDEO',\n /** @experimental WSO2 Asgardeo V2 */\n AsgardeoV2 = 'AsgardeoV2',\n /** WSO2 Identity Server (on-prem or custom domains) */\n IdentityServer = 'IDENTITY_SERVER',\n /** Unknown or unsupported platform */\n Unknown = 'UNKNOWN',\n}\n", "/**\n * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {IdToken} from '../models/token';\n\n/**\n * Removes standard protocol-specific claims from the ID token payload\n * and returns an object of user-specific claims with original attribute names preserved.\n *\n * @param payload The raw ID token payload.\n * @returns A cleaned-up object containing only user-specific claims with original attribute names.\n *\n * @example\n * ````typescript\n * const idTokenPayload = {\n * iss: 'https://example.com',\n * aud: 'client_id',\n * exp: 1712345678,\n * iat: 1712345670,\n * email: 'user@example.com',\n * given_name: 'John'\n * };\n *\n * const userClaims = extractUserClaimsFromIdToken(idTokenPayload);\n * // userClaims will be:\n * // {\n * // email: 'user@example.com',\n * // given_name: 'John'\n * // }\n * ```\n */\nconst extractUserClaimsFromIdToken = (payload: IdToken): Record<string, unknown> => {\n const filteredPayload: Partial<IdToken> = {...payload};\n\n const protocolClaims: string[] = [\n 'iss',\n 'aud',\n 'exp',\n 'iat',\n 'acr',\n 'amr',\n 'azp',\n 'auth_time',\n 'nonce',\n 'c_hash',\n 'at_hash',\n 'nbf',\n 'isk',\n 'sid',\n 'jti',\n 'sub',\n ];\n\n protocolClaims.forEach((claim: string) => {\n delete filteredPayload[claim as keyof IdToken];\n });\n\n return filteredPayload as Record<string, unknown>;\n};\n\nexport default extractUserClaimsFromIdToken;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Constants for OAuth 2.0 and OpenID Connect scopes.\n * These scopes define the level of access that the client application\n * is requesting from the authorization server.\n *\n * @remarks\n * Scopes are space-separated strings that represent different permissions.\n * The 'openid' scope is required for OpenID Connect flows, while other\n * scopes provide access to different resources or user information.\n *\n * @example\n * ```typescript\n * // Requesting OpenID Connect authentication\n * const scope = [ScopeConstants.OPENID];\n *\n * // Requesting profile information\n * const scopes = [ScopeConstants.OPENID, ScopeConstants.PROFILE];\n * ```\n */\nconst ScopeConstants: {\n INTERNAL_LOGIN: string;\n OPENID: string;\n PROFILE: string;\n} = {\n /**\n * The scope for accessing the user's profile information from SCIM.\n * This scope allows the client to retrieve basic user information such as\n * name, email, profile picture, etc.\n */\n INTERNAL_LOGIN: 'internal_login',\n\n /**\n * The base OpenID Connect scope.\n * Required for all OpenID Connect flows. Indicates that the client\n * is initiating an OpenID Connect authentication request.\n */\n OPENID: 'openid',\n\n /**\n * The OpenID Connect profile scope.\n * This scope allows the client to access the user's profile information.\n * It includes details such as the user's name, email, and other profile attributes.\n */\n PROFILE: 'profile',\n} as const;\n\nexport default ScopeConstants;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport ScopeConstants from './ScopeConstants';\n\n/**\n * Constants representing standard OpenID Connect (OIDC) request and response parameters.\n * These parameters are commonly used during authorization, token exchange, and logout flows.\n */\nconst OIDCRequestConstants: {\n readonly Params: {\n readonly AUTHORIZATION_CODE: string;\n readonly SESSION_STATE: string;\n readonly SIGN_OUT_SUCCESS: string;\n readonly STATE: string;\n };\n readonly SignIn: {\n readonly Payload: {\n readonly DEFAULT_SCOPES: readonly string[];\n };\n };\n readonly SignOut: {\n readonly Storage: {\n readonly StorageKeys: {\n readonly SIGN_OUT_URL: string;\n };\n };\n };\n} = {\n Params: {\n /**\n * The authorization code returned from the authorization endpoint.\n * Used in the authorization code flow.\n */\n AUTHORIZATION_CODE: 'code',\n\n /**\n * Session state parameter used for session management between the client and the OP.\n */\n SESSION_STATE: 'session_state',\n\n /**\n * Indicates whether sign-out was successful during the end-session flow.\n * May be returned by the OP after a logout request.\n */\n SIGN_OUT_SUCCESS: 'sign_out_success',\n\n /**\n * State parameter used to maintain state between the request and the callback.\n * Helps in preventing CSRF attacks.\n */\n STATE: 'state',\n },\n\n /**\n * Constants related to the OpenID Connect (OIDC) sign-in flow.\n */\n SignIn: {\n /**\n * Constants related to the payload of the OIDC sign-in request.\n */\n Payload: {\n /**\n * The default scopes used in OIDC sign-in requests.\n */\n DEFAULT_SCOPES: [ScopeConstants.OPENID, ScopeConstants.PROFILE, ScopeConstants.INTERNAL_LOGIN],\n },\n },\n\n /**\n * Sign-out related constants for managing the end-session flow in OIDC.\n */\n SignOut: {\n /**\n * Storage-related constants for managing sign-out state.\n */\n Storage: {\n /**\n * Collection of storage keys used in sign-out implementation\n */\n StorageKeys: {\n /**\n * Storage key for the sign-out URL.\n * Used to store the complete URL where the user should be redirected after\n * completing the OIDC logout process.\n */\n SIGN_OUT_URL: 'sign_out_url',\n },\n },\n },\n} as const;\n\nexport default OIDCRequestConstants;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Base class for all Asgardeo errors. This class extends the native Error class\n * and adds support for error codes and proper stack traces. Each error is prefixed\n * with a shield emoji and the SDK name for easy identification.\n *\n * @example\n * ```typescript\n * // Create a new error with a message and code\n * throw new AsgardeoError(\n * \"Invalid authentication response\",\n * \"AUTH_ERROR\"\n * );\n *\n * // Or with a specific SDK name\n * throw new AsgardeoError(\n * \"Invalid authentication response\",\n * \"AUTH_ERROR\",\n * \"@asgardeo/react\"\n * );\n *\n * // The error message will be formatted as:\n * // \uD83D\uDEE1\uFE0F Asgardeo React: Invalid authentication response\n * //\n * // (code=\"AUTH_ERROR\")\n */\nexport default class AsgardeoError extends Error {\n public readonly code: string;\n\n public readonly origin: string;\n\n private static resolveOrigin(origin: string): string {\n if (!origin) {\n return '@asgardeo/javascript';\n }\n\n return `@asgardeo/${origin}`;\n }\n\n constructor(message: string, code: string, origin: string) {\n const resolvedOrigin: string = AsgardeoError.resolveOrigin(origin);\n super(message);\n\n this.name = new.target.name;\n this.code = code;\n this.origin = resolvedOrigin;\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, new.target);\n }\n }\n\n public override toString(): string {\n const prefix: string = `\uD83D\uDEE1\uFE0F Asgardeo - ${this.origin}:`;\n return `[${this.name}]\\n${prefix} ${this.message}\\n(code=\"${this.code}\")`;\n }\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoError from './AsgardeoError';\n\n/**\n * Base class for all runtime errors in Asgardeo. This class extends AsgardeoError\n * and adds support for additional error details. Use this class for errors that occur\n * during runtime execution that are not related to API calls.\n *\n * @example\n * ```typescript\n * throw new AsgardeoRuntimeError(\n * \"Failed to parse configuration\",\n * \"CONFIG_PARSE_ERROR\",\n * { invalidField: \"redirectUri\" }\n * );\n * ```\n */\nexport default class AsgardeoRuntimeError extends AsgardeoError {\n /**\n * Creates an instance of AsgardeoRuntimeError.\n *\n * @param message - Human-readable description of the error\n * @param code - A unique error code that identifies the error type\n * @param details - Additional details about the error that might be helpful for debugging\n * @param origin - Optional. The SDK origin (e.g. 'react', 'vue'). Defaults to generic 'Asgardeo'\n * @constructor\n */\n constructor(message: string, code: string, origin: string, public readonly details?: unknown) {\n super(message, code, origin);\n\n Object.defineProperty(this, 'name', {\n configurable: true,\n value: 'AsgardeoRuntimeError',\n writable: true,\n });\n }\n\n /**\n * Returns a string representation of the runtime error\n * @returns Formatted error string with name, code, details, and message\n */\n public override toString(): string {\n const details: string = this.details ? `\\nDetails: ${JSON.stringify(this.details, null, 2)}` : '';\n return `[${this.name}] (code=\"${this.code}\")${details}\\nMessage: ${this.message}`;\n }\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport OIDCRequestConstants from '../constants/OIDCRequestConstants';\nimport AsgardeoRuntimeError from '../errors/AsgardeoRuntimeError';\n\n/**\n * Processes OpenID scopes to ensure they are in the correct format.\n * If the input is a string, it returns it as is.\n * If the input is an array, it joins the elements into a single string separated by spaces.\n * If the input is neither, it throws an error.\n *\n * Default scopes are only injected when no scopes are configured (undefined, empty string,\n * or empty array). If the caller explicitly provides scopes, those are used as-is.\n *\n * @param scopes - The OpenID scopes to process, which can be a string, an array of strings,\n * or undefined/null when not configured.\n * @returns A string of OpenID scopes separated by spaces.\n *\n * @example\n * ```typescript\n * processOpenIDScopes(\"openid profile email\"); // returns \"openid profile email\"\n * processOpenIDScopes([\"openid\", \"profile\", \"email\"]); // returns \"openid profile email\"\n * processOpenIDScopes(undefined); // returns default scopes\n * processOpenIDScopes(123); // throws AsgardeoRuntimeError\n * processOpenIDScopes({}); // throws AsgardeoRuntimeError\n * ```\n */\nconst processOpenIDScopes = (scopes: string | string[] | undefined | null): string => {\n let processedScopes: string[] = [];\n let userConfiguredScopes: boolean = false;\n\n if (scopes !== undefined && scopes !== null) {\n if (Array.isArray(scopes)) {\n processedScopes = scopes;\n userConfiguredScopes = scopes.length > 0;\n } else if (typeof scopes === 'string') {\n processedScopes = scopes ? scopes.split(' ') : [];\n userConfiguredScopes = scopes.length > 0;\n } else {\n throw new AsgardeoRuntimeError(\n 'Scopes must be a string or an array of strings.',\n 'processOpenIDScopes-Invalid-001',\n 'javascript',\n 'The provided scopes are not in the expected format. Please provide a string or an array of strings.',\n );\n }\n }\n\n if (!userConfiguredScopes) {\n OIDCRequestConstants.SignIn.Payload.DEFAULT_SCOPES.forEach((defaultScope: string) => {\n if (!processedScopes.includes(defaultScope)) {\n processedScopes.push(defaultScope);\n }\n });\n }\n\n return processedScopes.join(' ');\n};\n\nexport default processOpenIDScopes;\n", "/**\n * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport OIDCDiscoveryConstants from '../../constants/OIDCDiscoveryConstants';\nimport TokenExchangeConstants from '../../constants/TokenExchangeConstants';\nimport {AsgardeoAuthException} from '../../errors/exception';\nimport {IsomorphicCrypto} from '../../IsomorphicCrypto';\nimport {Config} from '../../models/config';\nimport {JWKInterface} from '../../models/crypto';\nimport {OIDCDiscoveryEndpointsApiResponse, OIDCDiscoveryApiResponse} from '../../models/oidc-discovery';\nimport {Platform} from '../../models/platforms';\nimport {SessionData} from '../../models/session';\nimport {IdToken, TokenResponse, AccessTokenApiResponse} from '../../models/token';\nimport {User} from '../../models/user';\nimport StorageManager from '../../StorageManager';\nimport extractUserClaimsFromIdToken from '../../utils/extractUserClaimsFromIdToken';\nimport processOpenIDScopes from '../../utils/processOpenIDScopes';\nimport {AuthClientConfig, StrictAuthClientConfig} from '../models';\n\nexport class AuthenticationHelper<T> {\n private storageManager: StorageManager<T>;\n\n private config: () => Promise<AuthClientConfig>;\n\n private oidcProviderMetaData: () => Promise<OIDCDiscoveryApiResponse>;\n\n private cryptoHelper: IsomorphicCrypto;\n\n public constructor(storageManagerInstance: StorageManager<T>, cryptoHelperInstance: IsomorphicCrypto) {\n this.storageManager = storageManagerInstance;\n this.config = async (): Promise<AuthClientConfig> => this.storageManager.getConfigData();\n this.oidcProviderMetaData = async (): Promise<OIDCDiscoveryApiResponse> =>\n this.storageManager.loadOpenIDProviderConfiguration();\n this.cryptoHelper = cryptoHelperInstance;\n }\n\n public async resolveEndpoints(response: OIDCDiscoveryApiResponse): Promise<OIDCDiscoveryApiResponse> {\n const oidcProviderMetaData: OIDCDiscoveryApiResponse = {};\n const configData: StrictAuthClientConfig = await this.config();\n\n if (configData.endpoints) {\n Object.keys(configData.endpoints).forEach((endpointName: string) => {\n const snakeCasedName: string = endpointName.replace(/[A-Z]/g, (letter: string) => `_${letter.toLowerCase()}`);\n\n oidcProviderMetaData[snakeCasedName] = configData?.endpoints ? configData.endpoints[endpointName] : '';\n });\n }\n\n return {...response, ...oidcProviderMetaData};\n }\n\n public async resolveEndpointsExplicitly(): Promise<OIDCDiscoveryEndpointsApiResponse> {\n const oidcProviderMetaData: OIDCDiscoveryApiResponse = {};\n const configData: StrictAuthClientConfig = await this.config();\n\n const requiredEndpoints: string[] = [\n OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.AUTHORIZATION,\n OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.END_SESSION,\n OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.JWKS,\n OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.SESSION_IFRAME,\n OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.REVOCATION,\n OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.TOKEN,\n OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.ISSUER,\n OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.USERINFO,\n ];\n\n const isRequiredEndpointsContains: boolean = configData.endpoints\n ? requiredEndpoints.every((reqEndpointName: string) =>\n configData.endpoints\n ? Object.keys(configData.endpoints).some((endpointName: string) => {\n const snakeCasedName: string = endpointName.replace(\n /[A-Z]/g,\n (letter: string) => `_${letter.toLowerCase()}`,\n );\n\n return snakeCasedName === reqEndpointName;\n })\n : false,\n )\n : false;\n\n if (!isRequiredEndpointsContains) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_HELPER-REE-NF01',\n 'Required endpoints missing',\n 'Some or all of the required endpoints are missing in the object passed to the `endpoints` ' +\n 'attribute of the`AuthConfig` object.',\n );\n }\n\n if (configData.endpoints) {\n Object.keys(configData.endpoints).forEach((endpointName: string) => {\n const snakeCasedName: string = endpointName.replace(/[A-Z]/g, (letter: string) => `_${letter.toLowerCase()}`);\n\n oidcProviderMetaData[snakeCasedName] = configData?.endpoints ? configData.endpoints[endpointName] : '';\n });\n }\n\n return {...oidcProviderMetaData};\n }\n\n public async resolveEndpointsByBaseURL(): Promise<OIDCDiscoveryEndpointsApiResponse> {\n const oidcProviderMetaData: OIDCDiscoveryEndpointsApiResponse = {};\n const configData: StrictAuthClientConfig = await this.config();\n\n const {baseUrl} = configData as any;\n\n if (!baseUrl) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_HELPER_REBO-NF01',\n 'Base URL not defined.',\n 'Base URL is not defined in AuthClient config.',\n );\n }\n\n if (configData.endpoints) {\n Object.keys(configData.endpoints).forEach((endpointName: string) => {\n const snakeCasedName: string = endpointName.replace(/[A-Z]/g, (letter: string) => `_${letter.toLowerCase()}`);\n\n oidcProviderMetaData[snakeCasedName] = configData?.endpoints ? configData.endpoints[endpointName] : '';\n });\n }\n\n const endpointKeys: typeof OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints =\n OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints;\n const endpointPaths: typeof OIDCDiscoveryConstants.Endpoints = OIDCDiscoveryConstants.Endpoints;\n\n const defaultEndpoints: OIDCDiscoveryApiResponse = {\n [endpointKeys.AUTHORIZATION]: `${baseUrl}${endpointPaths.AUTHORIZATION}`,\n [endpointKeys.END_SESSION]: `${baseUrl}${endpointPaths.END_SESSION}`,\n [endpointKeys.ISSUER]: `${baseUrl}${endpointPaths.ISSUER}`,\n [endpointKeys.JWKS]: `${baseUrl}${endpointPaths.JWKS}`,\n [endpointKeys.SESSION_IFRAME]: `${baseUrl}${endpointPaths.SESSION_IFRAME}`,\n [endpointKeys.REVOCATION]: `${baseUrl}${endpointPaths.REVOCATION}`,\n [endpointKeys.TOKEN]: `${baseUrl}${endpointPaths.TOKEN}`,\n [endpointKeys.USERINFO]: `${baseUrl}${endpointPaths.USERINFO}`,\n };\n\n // For AsgardeoV2 (Thunder), the issuer must be the base URL (e.g., https://localhost:8090)\n // to comply with RFC 8414 (Section 2 & 3) and OpenID Connect Discovery specs.\n // The issuer should be a URL using \"https\" scheme with no query or fragment components.\n // The well-known metadata endpoint is derived by inserting \"/.well-known/oauth-authorization-server\"\n // between the host and path components of the issuer identifier.\n // Reference: https://datatracker.ietf.org/doc/html/rfc8414#section-2\n // Trackers:\n // - https://github.com/asgardeo/thunder/issues/815\n // - https://github.com/asgardeo/javascript/issues/322\n if ((configData as Config).platform === Platform.AsgardeoV2) {\n defaultEndpoints[OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.ISSUER] = `${baseUrl}`;\n }\n\n return {...defaultEndpoints, ...oidcProviderMetaData};\n }\n\n public async validateIdToken(idToken: string): Promise<boolean> {\n const jwksEndpoint: string | undefined = (await this.storageManager.loadOpenIDProviderConfiguration()).jwks_uri;\n const configData: StrictAuthClientConfig = await this.config();\n\n if (!jwksEndpoint || jwksEndpoint.trim().length === 0) {\n throw new AsgardeoAuthException(\n 'JS_AUTH_HELPER-VIT-NF01',\n 'JWKS endpoint not found.',\n 'No JWKS endpoint was found in the OIDC provider meta data returned by the well-known endpoint ' +\n 'or the JWKS endpoint passed to the SDK is empty.',\n );\n }\n\n let response: Response;\n\n try {\n response = await fetch(jwksEndpoint, {\n credentials: configData.sendCookiesInRequests ? 'include' : 'same-origin',\n });\n } catch (error: any) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_HELPER-VIT-NE02',\n 'Request to jwks endpoint failed.',\n error ?? 'The request sent to get the jwks from the server failed.',\n );\n }\n\n if (response.status !== 200 || !response.ok) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_HELPER-VIT-HE03',\n `Invalid response status received for jwks request (${response.statusText}).`,\n (await response.json()) as string,\n );\n }\n\n const {issuer} = await this.oidcProviderMetaData();\n\n const {keys}: {keys: JWKInterface[]} = (await response.json()) as {\n keys: JWKInterface[];\n };\n\n const jwk: any = await this.cryptoHelper.getJWKForTheIdToken(idToken.split('.')[0], keys);\n\n return this.cryptoHelper.isValidIdToken(\n idToken,\n jwk,\n (await this.config()).clientId,\n issuer ?? '',\n this.cryptoHelper.decodeJwtToken<IdToken>(idToken).sub,\n (await this.config()).tokenValidation?.idToken?.clockTolerance,\n (await this.config()).tokenValidation?.idToken?.validateIssuer ?? true,\n );\n }\n\n public getAuthenticatedUserInfo(idToken: string): User {\n const payload: IdToken = this.cryptoHelper.decodeJwtToken<IdToken>(idToken);\n const username: string = payload?.['username'] ?? '';\n const givenName: string = payload?.['given_name'] ?? '';\n const familyName: string = payload?.['family_name'] ?? '';\n const fullName: string = givenName && familyName ? `${givenName} ${familyName}` : givenName || familyName || '';\n const displayName: string = payload.preferred_username ?? fullName;\n\n return {\n displayName,\n username,\n ...extractUserClaimsFromIdToken(payload),\n };\n }\n\n public async replaceCustomGrantTemplateTags(text: string, userId?: string): Promise<string> {\n const configData: StrictAuthClientConfig = await this.config();\n\n const sourceInstanceId: number | null = configData.organizationChain?.sourceInstanceId ?? null;\n\n let sessionData: SessionData;\n\n if (sourceInstanceId) {\n const {clientId} = configData;\n let instanceKey: string;\n if (clientId) {\n instanceKey = `instance_${sourceInstanceId}-${clientId}`;\n } else {\n instanceKey = `instance_${sourceInstanceId}`;\n }\n sessionData = await this.storageManager.getSessionData(userId, instanceKey);\n\n if (!sessionData || !sessionData.access_token) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_HELPER-RCGTT-NE01',\n 'No session data found for source instance.',\n 'Failed to retrieve session data from the source organization context.',\n );\n }\n } else {\n sessionData = await this.storageManager.getSessionData(userId);\n }\n\n const scope: string = processOpenIDScopes(configData.scopes);\n\n if (typeof text !== 'string') {\n return text;\n }\n\n return text\n .replace(TokenExchangeConstants.Placeholders.ACCESS_TOKEN, sessionData.access_token)\n .replace(\n TokenExchangeConstants.Placeholders.USERNAME,\n this.getAuthenticatedUserInfo(sessionData.id_token).username,\n )\n .replace(TokenExchangeConstants.Placeholders.SCOPES, scope)\n .replace(TokenExchangeConstants.Placeholders.CLIENT_ID, configData.clientId)\n .replace(TokenExchangeConstants.Placeholders.CLIENT_SECRET, configData.clientSecret ?? '');\n }\n\n public async clearSession(userId?: string): Promise<void> {\n await this.storageManager.removeTemporaryData(userId);\n await this.storageManager.removeSessionData(userId);\n }\n\n public async handleTokenResponse(response: Response, userId?: string): Promise<TokenResponse> {\n if (response.status !== 200 || !response.ok) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_HELPER-HTR-NE01',\n `Invalid response status received for token request (${response.statusText}).`,\n (await response.json()) as string,\n );\n }\n\n // Get the response in JSON\n const parsedResponse: AccessTokenApiResponse = (await response.json()) as AccessTokenApiResponse;\n\n parsedResponse.created_at = new Date().getTime();\n\n const shouldValidateIdToken: boolean | undefined = (await this.config()).tokenValidation?.idToken?.validate;\n\n if (shouldValidateIdToken) {\n return this.validateIdToken(parsedResponse.id_token).then(async () => {\n await this.storageManager.setSessionData(parsedResponse, userId);\n\n const tokenResponse: TokenResponse = {\n accessToken: parsedResponse.access_token,\n createdAt: parsedResponse.created_at,\n expiresIn: parsedResponse.expires_in,\n idToken: parsedResponse.id_token,\n refreshToken: parsedResponse.refresh_token,\n scope: parsedResponse.scope,\n tokenType: parsedResponse.token_type,\n };\n\n return Promise.resolve(tokenResponse);\n });\n }\n const tokenResponse: TokenResponse = {\n accessToken: parsedResponse.access_token,\n createdAt: parsedResponse.created_at,\n expiresIn: parsedResponse.expires_in,\n idToken: parsedResponse.id_token,\n refreshToken: parsedResponse.refresh_token,\n scope: parsedResponse.scope,\n tokenType: parsedResponse.token_type,\n };\n\n await this.storageManager.setSessionData(parsedResponse, userId);\n\n return Promise.resolve(tokenResponse);\n }\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Constants related to Proof Key for Code Exchange (PKCE) implementation.\n * This object contains all the necessary constants for implementing PKCE\n * flow in the OAuth 2.0 authorization code grant.\n *\n * @remarks\n * PKCE is an extension to the authorization code flow to prevent CSRF and\n * authorization code injection attacks. The constants are organized into\n * storage-related sections for managing PKCE state.\n *\n * @example\n * ```typescript\n * // Using storage keys\n * const codeVerifierKey = PKCEConstants.Storage.StorageKeys.CODE_VERIFIER;\n * const separator = PKCEConstants.Storage.StorageKeys.SEPARATOR;\n * ```\n */\nconst PKCEConstants: {\n readonly DEFAULT_CODE_CHALLENGE_METHOD: string;\n readonly Storage: {\n readonly StorageKeys: {\n readonly CODE_VERIFIER: string;\n readonly SEPARATOR: string;\n };\n };\n} = {\n DEFAULT_CODE_CHALLENGE_METHOD: 'S256',\n /**\n * Storage-related constants for managing PKCE state\n */\n Storage: {\n /**\n * Collection of storage keys used in PKCE implementation\n */\n StorageKeys: {\n /**\n * Key used to store the PKCE code verifier in temporary storage.\n * The code verifier is a cryptographically random string that is\n * used to generate the code challenge.\n */\n CODE_VERIFIER: 'pkce_code_verifier',\n\n /**\n * Separator used in storage keys to create unique identifiers\n * by combining different parts of the key.\n */\n SEPARATOR: '#',\n },\n },\n} as const;\n\nexport default PKCEConstants;\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Constants related to OpenID Connect (OIDC) metadata and endpoints.\n * This object contains all the standard OIDC endpoints and storage keys\n * used throughout the application for authentication and authorization.\n *\n * @remarks\n * The constants are organized into two main sections:\n * 1. Endpoints - Contains all OIDC standard endpoint paths\n * 2. Storage - Contains keys used for storing OIDC-related data\n *\n * @example\n * ```typescript\n * // Using an endpoint\n * const wellKnownEndpoint = OIDCDiscoveryConstants.Endpoints.WELL_KNOWN;\n * ```\n */\nconst OIDCDiscoveryConstants: {\n readonly Endpoints: {\n readonly WELL_KNOWN: string;\n };\n} = {\n /**\n * Collection of standard OIDC endpoint paths used for authentication flows.\n * These endpoints are relative paths that should be appended to the base URL\n * of your identity provider.\n */\n Endpoints: {\n /**\n * OpenID Connect discovery document endpoint.\n * Used to fetch provider metadata from the authorization server.\n */\n WELL_KNOWN: '/.well-known/openid-configuration',\n },\n} as const;\n\nexport default OIDCDiscoveryConstants;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Constants related to OIDC token management and storage.\n * This object contains configuration values and storage keys\n * used in token validation and management processes.\n *\n * @remarks\n * The constants are organized into two main sections:\n * 1. SignatureValidation - Contains supported algorithms for token validation\n * 2. Storage - Contains keys used for storing token-related data\n *\n * @example\n * ```typescript\n * // Using signature validation algorithms\n * const algorithms = TokenConstants.SignatureValidation.SUPPORTED_ALGORITHMS;\n *\n * // Using storage keys\n * const timerKey = TokenConstants.Storage.StorageKeys.REFRESH_TOKEN_TIMER;\n * ```\n */\nconst TokenConstants: {\n readonly SignatureValidation: {\n readonly SUPPORTED_ALGORITHMS: readonly string[];\n };\n readonly Storage: {\n readonly StorageKeys: {\n readonly REFRESH_TOKEN_TIMER: string;\n };\n };\n} = {\n /**\n * Token signature validation constants.\n * Contains configurations related to token signature verification.\n */\n SignatureValidation: {\n /**\n * Fallback array of supported signature algorithms for OIDC token validation.\n * These values are used when the supported algorithms cannot be retrieved from\n * the .well-known/openid-configuration endpoint.\n *\n * Supported algorithms:\n * - `RS256` - RSASSA-PKCS1-v1_5 using SHA-256\n * - `RS512` - RSASSA-PKCS1-v1_5 using SHA-512\n * - `RS384` - RSASSA-PKCS1-v1_5 using SHA-384\n * - `PS256` - RSASSA-PSS using SHA-256 and MGF1 with SHA-256\n */\n SUPPORTED_ALGORITHMS: ['RS256', 'RS512', 'RS384', 'PS256'],\n },\n\n /**\n * Storage-related constants for OIDC tokens.\n * Contains keys used to store token-related data in browser storage.\n */\n Storage: {\n /**\n * Collection of storage keys used in token management.\n * These keys are used to store and retrieve token-related\n * information from browser storage.\n */\n StorageKeys: {\n /**\n * Key used to store the refresh token timer identifier.\n * This timer is used to schedule token refresh operations\n * before the current token expires.\n */\n REFRESH_TOKEN_TIMER: 'refresh_token_timer',\n },\n },\n} as const;\n\nexport default TokenConstants;\n", "/**\n * Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport TokenConstants from './constants/TokenConstants';\nimport {AsgardeoAuthException} from './errors/exception';\nimport {Crypto, JWKInterface} from './models/crypto';\n\nexport class IsomorphicCrypto<T = any> {\n private cryptoUtils: Crypto<T>;\n\n public constructor(cryptoUtils: Crypto<T>) {\n this.cryptoUtils = cryptoUtils;\n }\n\n /**\n * Generate code verifier.\n *\n * @returns code verifier.\n */\n public getCodeVerifier(): string {\n return this.cryptoUtils.base64URLEncode(this.cryptoUtils.generateRandomBytes(32));\n }\n\n /**\n * Derive code challenge from the code verifier.\n *\n * @param verifier - Code verifier.\n *\n * @returns - code challenge.\n */\n public async getCodeChallenge(verifier: string): Promise<string> {\n const hashed: T = await this.cryptoUtils.hashSha256(verifier);\n return this.cryptoUtils.base64URLEncode(hashed);\n }\n\n /**\n * Get JWK used for the id_token\n *\n * @param jwtHeader - header of the id_token.\n * @param keys - jwks response.\n *\n * @returns public key.\n *\n * @throws\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n public getJWKForTheIdToken(jwtHeader: string, keys: JWKInterface[]): JWKInterface {\n const headerJSON: Record<string, string> = JSON.parse(this.cryptoUtils.base64URLDecode(jwtHeader));\n\n const matchingKey: JWKInterface | undefined = keys.find(\n (key: JWKInterface): boolean => headerJSON['kid'] === key.kid,\n );\n\n if (matchingKey) {\n return matchingKey;\n }\n\n throw new AsgardeoAuthException(\n 'JS-CRYPTO_UTIL-GJFTIT-IV01',\n 'kid not found.',\n `Failed to find the 'kid' specified in the id_token. 'kid' found in the header : ${\n headerJSON['kid']\n }, Expected values: ${keys.map((key: JWKInterface) => key.kid).join(', ')}`,\n );\n }\n\n /**\n * Verify id token.\n *\n * @param idToken - id_token received from the IdP.\n * @param jwk - public key used for signing.\n * @param clientId - app identification.\n * @param issuer - id_token issuer.\n * @param username - Username.\n * @param clockTolerance - Allowed leeway for id_tokens (in seconds).\n *\n * @returns whether the id_token is valid.\n *\n * @throws\n */\n public isValidIdToken(\n idToken: string,\n jwk: JWKInterface,\n clientId: string,\n issuer: string,\n username: string,\n clockTolerance: number | undefined,\n validateJwtIssuer: boolean | undefined,\n ): Promise<boolean> {\n return this.cryptoUtils\n .verifyJwt(\n idToken,\n jwk,\n TokenConstants.SignatureValidation.SUPPORTED_ALGORITHMS as unknown as string[],\n clientId,\n issuer,\n username,\n clockTolerance,\n validateJwtIssuer,\n )\n .then((response: boolean) => {\n if (response) {\n return Promise.resolve(true);\n }\n\n return Promise.reject(\n new AsgardeoAuthException(\n 'JS-CRYPTO_HELPER-IVIT-IV01',\n 'Invalid ID token.',\n 'ID token validation returned false',\n ),\n );\n })\n .catch((error: AsgardeoAuthException) => Promise.reject(error));\n }\n\n public decodeJwtToken<R = Record<string, unknown>>(token: string): R {\n try {\n const utf8String: string = this.cryptoUtils.base64URLDecode(token?.split('.')[1]);\n const payload: R = JSON.parse(utf8String);\n\n return payload;\n } catch (error: any) {\n throw new AsgardeoAuthException('JS-CRYPTO_UTIL-DIT-IV02', 'Decoding token failed.', error);\n }\n }\n}\n", "/**\n * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {AuthClientConfig} from './__legacy__/models';\nimport {OIDCDiscoveryApiResponse} from './models/oidc-discovery';\nimport {SessionData} from './models/session';\nimport {Stores, Storage, TemporaryStore, TemporaryStoreValue} from './models/store';\n\ntype PartialData<T> = Partial<AuthClientConfig<T> | OIDCDiscoveryApiResponse | SessionData | TemporaryStore>;\n\nexport const ASGARDEO_SESSION_ACTIVE: string = 'asgardeo-session-active';\n\nclass StorageManager<T> {\n protected id: string;\n\n protected store: Storage;\n\n public constructor(instanceID: string, store: Storage) {\n this.id = instanceID;\n this.store = store;\n }\n\n protected async setDataInBulk(key: string, data: PartialData<T>): Promise<void> {\n const existingDataJSON: string = (await this.store.getData(key)) ?? null;\n const existingData: PartialData<T> = existingDataJSON && JSON.parse(existingDataJSON);\n\n const dataToBeSaved: PartialData<T> = {...existingData, ...data};\n const dataToBeSavedJSON: string = JSON.stringify(dataToBeSaved);\n\n await this.store.setData(key, dataToBeSavedJSON);\n }\n\n protected async setValue(\n key: string,\n attribute: keyof AuthClientConfig<T> | keyof OIDCDiscoveryApiResponse | keyof SessionData | keyof TemporaryStore,\n value: TemporaryStoreValue,\n ): Promise<void> {\n const existingDataJSON: string = (await this.store.getData(key)) ?? null;\n const existingData: PartialData<T> = existingDataJSON && JSON.parse(existingDataJSON);\n\n const dataToBeSaved: PartialData<T> = {...existingData, [attribute]: value};\n const dataToBeSavedJSON: string = JSON.stringify(dataToBeSaved);\n\n await this.store.setData(key, dataToBeSavedJSON);\n }\n\n protected async removeValue(\n key: string,\n attribute: keyof AuthClientConfig<T> | keyof OIDCDiscoveryApiResponse | keyof SessionData | keyof TemporaryStore,\n ): Promise<void> {\n const existingDataJSON: string = (await this.store.getData(key)) ?? null;\n const existingData: PartialData<T> = existingDataJSON && JSON.parse(existingDataJSON);\n\n const dataToBeSaved: PartialData<T> = {...existingData};\n\n delete dataToBeSaved[attribute as string];\n\n const dataToBeSavedJSON: string = JSON.stringify(dataToBeSaved);\n\n await this.store.setData(key, dataToBeSavedJSON);\n }\n\n protected resolveKey(store: Stores | string, userId?: string, instanceId?: string): string {\n if (userId && instanceId) {\n return `${store}-${instanceId}-${userId}`;\n }\n if (userId) {\n return `${store}-${this.id}-${userId}`;\n }\n if (instanceId) {\n return `${store}-${instanceId}`;\n }\n return `${store}-${this.id}`;\n }\n\n protected static isLocalStorageAvailable(): boolean {\n try {\n const testValue: string = '__ASGARDEO_AUTH_CORE_LOCAL_STORAGE_TEST__';\n\n localStorage.setItem(testValue, testValue);\n localStorage.removeItem(testValue);\n\n return true;\n } catch (error) {\n return false;\n }\n }\n\n public async setConfigData(config: Partial<AuthClientConfig<T>>): Promise<void> {\n await this.setDataInBulk(this.resolveKey(Stores.ConfigData), config);\n }\n\n public async setOIDCProviderMetaData(oidcProviderMetaData: Partial<OIDCDiscoveryApiResponse>): Promise<void> {\n this.setDataInBulk(this.resolveKey(Stores.OIDCProviderMetaData), oidcProviderMetaData);\n }\n\n public async setTemporaryData(temporaryData: Partial<TemporaryStore>, userId?: string): Promise<void> {\n this.setDataInBulk(this.resolveKey(Stores.TemporaryData, userId), temporaryData);\n }\n\n public async setSessionData(sessionData: Partial<SessionData>, userId?: string): Promise<void> {\n this.setDataInBulk(this.resolveKey(Stores.SessionData, userId), sessionData);\n }\n\n public async setCustomData<K>(key: string, customData: Partial<K>, userId?: string): Promise<void> {\n this.setDataInBulk(this.resolveKey(key, userId), customData);\n }\n\n public async getConfigData(userId?: string): Promise<AuthClientConfig<T>> {\n return JSON.parse((await this.store.getData(this.resolveKey(Stores.ConfigData, userId))) ?? null);\n }\n\n public async loadOpenIDProviderConfiguration(): Promise<OIDCDiscoveryApiResponse> {\n return JSON.parse((await this.store.getData(this.resolveKey(Stores.OIDCProviderMetaData))) ?? null);\n }\n\n public async getTemporaryData(userId?: string): Promise<TemporaryStore> {\n return JSON.parse((await this.store.getData(this.resolveKey(Stores.TemporaryData, userId))) ?? null);\n }\n\n public async getPersistedData(userId?: string): Promise<TemporaryStore> {\n return JSON.parse((await this.store.getData(this.resolveKey(Stores.PersistedData, userId))) ?? null);\n }\n\n public async setPersistedData(persistedData: Partial<TemporaryStore>, userId?: string): Promise<void> {\n this.setDataInBulk(this.resolveKey(Stores.PersistedData, userId), persistedData);\n }\n\n public async getSessionData(userId?: string, instanceId?: string): Promise<SessionData> {\n return JSON.parse((await this.store.getData(this.resolveKey(Stores.SessionData, userId, instanceId))) ?? null);\n }\n\n public async getCustomData<K>(key: string, userId?: string): Promise<K> {\n return JSON.parse((await this.store.getData(this.resolveKey(key, userId))) ?? null);\n }\n\n // eslint-disable-next-line class-methods-use-this\n public setSessionStatus(status: string): void {\n // Using local storage to store the session status as it is required to be available across tabs.\n if (StorageManager.isLocalStorageAvailable()) {\n localStorage.setItem(`${ASGARDEO_SESSION_ACTIVE}`, status);\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n public getSessionStatus(): string {\n return StorageManager.isLocalStorageAvailable() ? localStorage.getItem(`${ASGARDEO_SESSION_ACTIVE}`) ?? '' : '';\n }\n\n // eslint-disable-next-line class-methods-use-this\n public removeSessionStatus(): void {\n if (StorageManager.isLocalStorageAvailable()) {\n localStorage.removeItem(`${ASGARDEO_SESSION_ACTIVE}`);\n }\n }\n\n public async removeConfigData(): Promise<void> {\n await this.store.removeData(this.resolveKey(Stores.ConfigData));\n }\n\n public async removeOIDCProviderMetaData(): Promise<void> {\n await this.store.removeData(this.resolveKey(Stores.OIDCProviderMetaData));\n }\n\n public async removeTemporaryData(userId?: string): Promise<void> {\n await this.store.removeData(this.resolveKey(Stores.TemporaryData, userId));\n }\n\n public async removeSessionData(userId?: string): Promise<void> {\n await this.store.removeData(this.resolveKey(Stores.SessionData, userId));\n }\n\n public async getConfigDataParameter(key: keyof AuthClientConfig<T>): Promise<TemporaryStoreValue> {\n const data: string = await this.store.getData(this.resolveKey(Stores.ConfigData));\n\n return data && JSON.parse(data)[key];\n }\n\n public async getOIDCProviderMetaDataParameter(key: keyof OIDCDiscoveryApiResponse): Promise<TemporaryStoreValue> {\n const data: string = await this.store.getData(this.resolveKey(Stores.OIDCProviderMetaData));\n\n return data && JSON.parse(data)[key];\n }\n\n public async getTemporaryDataParameter(key: keyof TemporaryStore, userId?: string): Promise<TemporaryStoreValue> {\n const data: string = await this.store.getData(this.resolveKey(Stores.TemporaryData, userId));\n\n return data && JSON.parse(data)[key];\n }\n\n public async getSessionDataParameter(key: keyof SessionData, userId?: string): Promise<TemporaryStoreValue> {\n const data: string = await this.store.getData(this.resolveKey(Stores.SessionData, userId));\n\n return data && JSON.parse(data)[key];\n }\n\n public async setConfigDataParameter(key: keyof AuthClientConfig<T>, value: TemporaryStoreValue): Promise<void> {\n await this.setValue(this.resolveKey(Stores.ConfigData), key, value);\n }\n\n public async setOIDCProviderMetaDataParameter(\n key: keyof OIDCDiscoveryApiResponse,\n value: TemporaryStoreValue,\n ): Promise<void> {\n await this.setValue(this.resolveKey(Stores.OIDCProviderMetaData), key, value);\n }\n\n public async setTemporaryDataParameter(\n key: keyof TemporaryStore,\n value: TemporaryStoreValue,\n userId?: string,\n ): Promise<void> {\n await this.setValue(this.resolveKey(Stores.TemporaryData, userId), key, value);\n }\n\n public async setSessionDataParameter(\n key: keyof SessionData,\n value: TemporaryStoreValue,\n userId?: string,\n ): Promise<void> {\n await this.setValue(this.resolveKey(Stores.SessionData, userId), key, value);\n }\n\n public async removeConfigDataParameter(key: keyof AuthClientConfig<T>): Promise<void> {\n await this.removeValue(this.resolveKey(Stores.ConfigData), key);\n }\n\n public async removeOIDCProviderMetaDataParameter(key: keyof OIDCDiscoveryApiResponse): Promise<void> {\n await this.removeValue(this.resolveKey(Stores.OIDCProviderMetaData), key);\n }\n\n public async removeTemporaryDataParameter(key: keyof TemporaryStore, userId?: string): Promise<void> {\n await this.removeValue(this.resolveKey(Stores.TemporaryData, userId), key);\n }\n\n public async removeSessionDataParameter(key: keyof SessionData, userId?: string): Promise<void> {\n await this.removeValue(this.resolveKey(Stores.SessionData, userId), key);\n }\n}\n\nexport default StorageManager;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Checks if a value is a plain object (not an array, function, date, etc.)\n *\n * @param value - The value to check\n * @returns True if the value is a plain object\n */\nconst isPlainObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n !(value instanceof Date) &&\n !(value instanceof RegExp) &&\n Object.prototype.toString.call(value) === '[object Object]';\n\n/**\n * Recursively merges the properties of source objects into a target object.\n * Similar to Lodash's merge function, this creates a deep copy and merges\n * nested objects recursively. Arrays and non-plain objects are replaced entirely.\n *\n * @param target - The target object to merge into\n * @param sources - One or more source objects to merge from\n * @returns A new object with merged properties\n *\n * @example\n * ```typescript\n * const obj1 = { a: 1, b: { x: 1, y: 2 } };\n * const obj2 = { b: { y: 3, z: 4 }, c: 3 };\n * const result = deepMerge(obj1, obj2);\n * // Result: { a: 1, b: { x: 1, y: 3, z: 4 }, c: 3 }\n * ```\n *\n * @example\n * ```typescript\n * const config = { theme: { colors: { primary: 'blue' } } };\n * const userPrefs = { theme: { colors: { secondary: 'red' } } };\n * const merged = deepMerge(config, userPrefs);\n * // Result: { theme: { colors: { primary: 'blue', secondary: 'red' } } }\n * ```\n */\nconst deepMerge = <T extends Record<string, any>>(\n target: T,\n ...sources: Array<Record<string, any> | undefined | null>\n): T => {\n if (!target || typeof target !== 'object') {\n throw new Error('Target must be an object');\n }\n\n const result: T = {...target} as T;\n\n sources.forEach((source: Record<string, any> | undefined | null) => {\n if (!source || typeof source !== 'object') {\n return;\n }\n\n Object.keys(source).forEach((key: string) => {\n const sourceValue: any = source[key];\n const targetValue: any = (result as any)[key];\n\n if (isPlainObject(sourceValue) && isPlainObject(targetValue)) {\n (result as any)[key] = deepMerge(targetValue, sourceValue);\n } else if (sourceValue !== undefined) {\n (result as any)[key] = sourceValue;\n }\n });\n });\n\n return result;\n};\n\nexport default deepMerge;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport PKCEConstants from '../constants/PKCEConstants';\n\n/**\n * Extracts the PKCE key from a state parameter string.\n *\n * @param state - The state parameter string containing the request index.\n * @returns The PKCE key string in the format `pkce_code_verifier_${index}`.\n *\n * @example\n * ```typescript\n * const state = \"request_1\";\n * const pkceKey = extractPkceStorageKeyFromState(state);\n * // Returns: \"pkce_code_verifier_1\"\n * ```\n */\nconst extractPkceStorageKeyFromState = (state: string): string => {\n const index: number = parseInt(state.split('request_')[1], 10);\n\n return `${PKCEConstants.Storage.StorageKeys.CODE_VERIFIER}${PKCEConstants.Storage.StorageKeys.SEPARATOR}${index}`;\n};\n\nexport default extractPkceStorageKeyFromState;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport PKCEConstants from '../constants/PKCEConstants';\nimport {TemporaryStore} from '../models/store';\n\n/**\n * Generates the next available PKCE storage key based on the current temporary data.\n *\n * The generated key will follow the format: `pkce_code_verifier_<index>`, where `<index>` is incremented\n * based on the highest existing index in the provided storage object.\n *\n * @param tempStore - The object that holds temporary PKCE-related data (e.g., sessionStorage).\n *\n * @returns A new unique PKCE storage key to store the next `code_verifier`.\n *\n * @example\n * const key = generatePkceStorageKey(sessionStorage);\n * // Returns: \"pkce_code_verifier_3\" (if existing keys are pkce_code_verifier_0 to _2)\n */\nconst generatePkceStorageKey = (tempStore: TemporaryStore): string => {\n const keys: string[] = [];\n\n Object.keys(tempStore).forEach((key: string) => {\n if (key.startsWith(PKCEConstants.Storage.StorageKeys.CODE_VERIFIER)) {\n keys.push(key);\n }\n });\n\n const lastKey: string | undefined = keys.sort().pop();\n const index: number = parseInt(lastKey?.split(PKCEConstants.Storage.StorageKeys.SEPARATOR)[1] ?? '-1', 10);\n\n return `${PKCEConstants.Storage.StorageKeys.CODE_VERIFIER}${PKCEConstants.Storage.StorageKeys.SEPARATOR}${index + 1}`;\n};\n\nexport default generatePkceStorageKey;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport PKCEConstants from '../constants/PKCEConstants';\n\n/**\n * Generates a state parameter for request correlation by combining an optional state string with a request index.\n *\n * @param pkceKey - The PKCE key containing the index (format: 'pkce_code_verifier_[index]').\n * @param state - Optional state string to prepend to the request correlation.\n * @returns A state parameter string in the format '[state_]request_[index]'.\n *\n * @example\n * const pkceKey = \"pkce_code_verifier_1\";\n * const result = generateStateParamForRequestCorrelation(pkceKey, \"myState\");\n * // Returns: \"myState_request_1\"\n *\n * const resultNoState = generateStateParamForRequestCorrelation(pkceKey);\n * // Returns: \"request_1\"\n */\nconst generateStateParamForRequestCorrelation = (pkceKey: string, state?: string): string => {\n const index: number = parseInt(pkceKey.split(PKCEConstants.Storage.StorageKeys.SEPARATOR)[1], 10);\n\n return state ? `${state}_request_${index}` : `request_${index}`;\n};\n\nexport default generateStateParamForRequestCorrelation;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport generateStateParamForRequestCorrelation from './generateStateParamForRequestCorrelation';\nimport OIDCRequestConstants from '../constants/OIDCRequestConstants';\nimport AsgardeoRuntimeError from '../errors/AsgardeoRuntimeError';\nimport {ExtendedAuthorizeRequestUrlParams} from '../models/oauth-request';\n\n/**\n * Generates a map of authorization request URL parameters for OIDC authorization requests.\n *\n * This utility ensures the `openid` scope is always included, handles both string and array forms of the `scope` parameter,\n * and supports PKCE and custom parameters. Throws if a code challenge is provided without a code challenge method.\n *\n * @param options - The main options for the authorization request, including redirectUri, clientId, scope, responseMode, codeChallenge, codeChallengeMethod, and prompt.\n * @param pkceOptions - PKCE options, including the PKCE key for state correlation.\n * @param customParams - Optional custom parameters to include in the request (excluding the `state` param, which is handled separately).\n * @returns A Map of key-value pairs representing the authorization request URL parameters.\n *\n * @throws {AsgardeoRuntimeError} If a code challenge is provided without a code challenge method.\n *\n * @example\n * const params = getAuthorizeRequestUrlParams({\n * options: {\n * redirectUri: 'https://app/callback',\n * clientId: 'client123',\n * scope: ['openid', 'profile'],\n * responseMode: 'query',\n * codeChallenge: 'abc',\n * codeChallengeMethod: 'S256',\n * prompt: 'login'\n * },\n * pkceOptions: { key: 'pkce_code_verifier_1' },\n * customParams: { foo: 'bar' }\n * });\n * // Returns a Map with all required OIDC params, PKCE, and custom params.\n */\nconst getAuthorizeRequestUrlParams = (\n options: {\n clientId: string;\n codeChallenge?: string;\n codeChallengeMethod?: string;\n instanceId?: string;\n prompt?: string;\n redirectUri: string;\n responseMode?: string;\n scopes?: string;\n } & ExtendedAuthorizeRequestUrlParams,\n pkceOptions: {key: string},\n customParams: Record<string, string | number | boolean>,\n): Map<string, string> => {\n const {redirectUri, clientId, scopes, responseMode, codeChallenge, codeChallengeMethod, prompt} = options;\n const authorizeRequestParams: Map<string, string> = new Map<string, string>();\n\n authorizeRequestParams.set('response_type', 'code');\n authorizeRequestParams.set('client_id', clientId as string);\n\n authorizeRequestParams.set('scope', scopes);\n authorizeRequestParams.set('redirect_uri', redirectUri as string);\n\n if (responseMode) {\n authorizeRequestParams.set('response_mode', responseMode as string);\n }\n\n const pkceKey: string = pkceOptions?.key;\n\n if (codeChallenge) {\n authorizeRequestParams.set('code_challenge', codeChallenge as string);\n\n if (codeChallengeMethod) {\n authorizeRequestParams.set('code_challenge_method', codeChallengeMethod as string);\n } else {\n throw new AsgardeoRuntimeError(\n 'Code challenge method is required when code challenge is provided.',\n 'getAuthorizeRequestUrlParams-ValidationError-001',\n 'javascript',\n 'When PKCE is enabled, the code challenge method must be provided along with the code challenge.',\n );\n }\n }\n\n if (prompt) {\n authorizeRequestParams.set('prompt', prompt as string);\n }\n\n if (customParams) {\n Object.entries(customParams).forEach(([key, value]: [string, string | number | boolean]) => {\n if (key !== '' && value !== '' && key !== OIDCRequestConstants.Params.STATE) {\n authorizeRequestParams.set(key, value.toString());\n }\n });\n }\n\n const AUTH_INSTANCE_PREFIX: string = 'instance_';\n let customStateValue: string = '';\n\n if (options.instanceId) {\n customStateValue = AUTH_INSTANCE_PREFIX + options.instanceId;\n } else if (customParams) {\n customStateValue = customParams[OIDCRequestConstants.Params.STATE]?.toString() ?? '';\n }\n\n authorizeRequestParams.set(\n OIDCRequestConstants.Params.STATE,\n generateStateParamForRequestCorrelation(pkceKey, customStateValue),\n );\n\n return authorizeRequestParams;\n};\n\nexport default getAuthorizeRequestUrlParams;\n", "/**\n * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {AuthenticationHelper} from './helpers';\nimport {AuthClientConfig, StrictAuthClientConfig} from './models';\nimport OIDCDiscoveryConstants from '../constants/OIDCDiscoveryConstants';\nimport OIDCRequestConstants from '../constants/OIDCRequestConstants';\nimport PKCEConstants from '../constants/PKCEConstants';\nimport OIDCDiscoveryConstantsV2 from '../constants/v2/OIDCDiscoveryConstants';\nimport {AsgardeoAuthException} from '../errors/exception';\nimport {IsomorphicCrypto} from '../IsomorphicCrypto';\nimport {Crypto} from '../models/crypto';\nimport {ExtendedAuthorizeRequestUrlParams} from '../models/oauth-request';\nimport {OIDCDiscoveryApiResponse} from '../models/oidc-discovery';\nimport {OIDCEndpoints} from '../models/oidc-endpoints';\nimport {Platform} from '../models/platforms';\nimport {SessionData, UserSession} from '../models/session';\nimport {Storage, TemporaryStore} from '../models/store';\nimport {TokenResponse, IdToken, TokenExchangeRequestConfig} from '../models/token';\nimport {User} from '../models/user';\nimport StorageManager from '../StorageManager';\nimport deepMerge from '../utils/deepMerge';\nimport extractPkceStorageKeyFromState from '../utils/extractPkceStorageKeyFromState';\nimport generatePkceStorageKey from '../utils/generatePkceStorageKey';\nimport getAuthorizeRequestUrlParams from '../utils/getAuthorizeRequestUrlParams';\nimport processOpenIDScopes from '../utils/processOpenIDScopes';\n\n/**\n * Default configurations.\n */\nconst DefaultConfig: Partial<AuthClientConfig<unknown>> = {\n enablePKCE: true,\n responseMode: 'query',\n sendCookiesInRequests: true,\n tokenValidation: {\n idToken: {\n clockTolerance: 300,\n validate: true,\n validateIssuer: true,\n },\n },\n};\n\n/**\n * This class provides the necessary methods needed to implement authentication.\n */\nexport class AsgardeoAuthClient<T> {\n private storageManager!: StorageManager<T>;\n\n private configProvider: () => Promise<AuthClientConfig>;\n\n private oidcProviderMetaDataProvider: () => Promise<OIDCDiscoveryApiResponse>;\n\n private authHelper: AuthenticationHelper<T>;\n\n private cryptoUtils: Crypto;\n\n private cryptoHelper: IsomorphicCrypto;\n\n private instanceIdValue: number;\n\n // FIXME: Validate this.\n // Ref: https://github.com/asgardeo/asgardeo-auth-js-core/pull/205\n static authHelperInstance: any;\n\n /**\n * This is the constructor method that returns an instance of the .\n *\n * @param store - The store object.\n *\n * @example\n * ```\n * const _store: Store = new DataStore();\n * const auth = new AsgardeoAuthClient<CustomClientConfig>(_store);\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#constructor}\n *\n * @preserve\n */\n public constructor() {\n // intentionally empty\n }\n\n /**\n *\n * This method initializes the SDK with the config data.\n *\n * @param config - The config object to initialize with.\n *\n * @example\n * const config = \\{\n * afterSignInUrl: \"http://localhost:3000/sign-in\",\n * clientId: \"client ID\",\n * baseUrl: \"https://localhost:9443\"\n * \\}\n *\n * await auth.initialize(config);\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#initialize}\n *\n * @preserve\n */\n public async initialize(\n config: AuthClientConfig<T>,\n store: Storage,\n inputCryptoUtils: Crypto,\n instanceID?: number,\n ): Promise<void> {\n const {clientId} = config;\n\n if (!this.instanceIdValue) {\n this.instanceIdValue = 0;\n } else {\n this.instanceIdValue += 1;\n }\n\n if (instanceID !== undefined) {\n this.instanceIdValue = instanceID;\n }\n\n if (!clientId) {\n this.storageManager = new StorageManager<T>(`instance_${this.instanceIdValue}`, store);\n } else {\n this.storageManager = new StorageManager<T>(`instance_${this.instanceIdValue}-${clientId}`, store);\n }\n\n this.cryptoUtils = inputCryptoUtils;\n this.cryptoHelper = new IsomorphicCrypto(inputCryptoUtils);\n this.authHelper = new AuthenticationHelper(this.storageManager, this.cryptoHelper);\n this.configProvider = async (): Promise<AuthClientConfig> => this.storageManager.getConfigData();\n this.oidcProviderMetaDataProvider = async (): Promise<OIDCDiscoveryApiResponse> =>\n this.storageManager.loadOpenIDProviderConfiguration();\n\n // FIXME: Validate this.\n // Ref: https://github.com/asgardeo/asgardeo-auth-js-core/pull/205\n AsgardeoAuthClient.authHelperInstance = this.authHelper;\n\n const {applicationId, platform, endpoints} = config;\n let resolvedApplicationId: string | undefined = applicationId;\n\n if (applicationId) {\n await this.storageManager.setPersistedData({\n applicationId,\n });\n } else {\n const persistedData: TemporaryStore = await this.storageManager.getPersistedData();\n\n if (persistedData['applicationId']) {\n resolvedApplicationId = persistedData['applicationId'] as string;\n }\n }\n\n const resolvedEndpoints: Partial<OIDCEndpoints> = endpoints || {};\n\n if (platform === Platform.AsgardeoV2) {\n if (!resolvedEndpoints['wellKnown']) {\n resolvedEndpoints['wellKnown'] = OIDCDiscoveryConstantsV2.Endpoints.WELL_KNOWN;\n }\n }\n\n await this.storageManager.setConfigData({\n ...DefaultConfig,\n ...config,\n applicationId: resolvedApplicationId,\n endpoints: resolvedEndpoints,\n scope: processOpenIDScopes(config.scopes),\n });\n }\n\n /**\n * This method returns the `StorageManager` object that allows you to access authentication data.\n *\n * @returns - The `StorageManager` object.\n *\n * @example\n * ```\n * const data = auth.getStorageManager();\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getStorageManager}\n *\n * @preserve\n */\n public getStorageManager(): StorageManager<T> {\n return this.storageManager;\n }\n\n /**\n * This method returns the `instanceID` variable of the given instance.\n *\n * @returns - The `instanceID` number.\n *\n * @example\n * ```\n * const instanceId = auth.getInstanceId();\n * ```\n *\n * @preserve\n */\n // eslint-disable-next-line class-methods-use-this\n public getInstanceId(): number {\n return this.instanceIdValue;\n }\n\n /**\n * This is an async method that returns a Promise that resolves with the authorization URL.\n *\n * @param config - (Optional) A config object to force initialization and pass\n * custom path parameters such as the fidp parameter.\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * @returns - A promise that resolves with the authorization URL.\n *\n * @example\n * ```\n * auth.getSignInUrl().then((url)=>{\n * // console.log(url);\n * }).catch((error)=>{\n * // console.error(error);\n * });\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getSignInUrl}\n *\n * @preserve\n */\n public async getSignInUrl(requestConfig?: ExtendedAuthorizeRequestUrlParams, userId?: string): Promise<string> {\n const authRequestConfig: ExtendedAuthorizeRequestUrlParams = {...requestConfig};\n\n delete authRequestConfig?.forceInit;\n\n const buildSignInUrl = async (): Promise<string> => {\n const authorizeEndpoint: string = (await this.storageManager.getOIDCProviderMetaDataParameter(\n OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.AUTHORIZATION as keyof OIDCDiscoveryApiResponse,\n )) as string;\n\n if (!authorizeEndpoint || authorizeEndpoint.trim().length === 0) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-GAU-NF01',\n 'No authorization endpoint found.',\n 'No authorization endpoint was found in the OIDC provider meta data from the well-known endpoint ' +\n 'or the authorization endpoint passed to the SDK is empty.',\n );\n }\n\n const authorizeRequest: URL = new URL(authorizeEndpoint);\n const configData: StrictAuthClientConfig = await this.configProvider();\n const tempStore: TemporaryStore = await this.storageManager.getTemporaryData(userId);\n const pkceKey: string = await generatePkceStorageKey(tempStore);\n\n let codeVerifier: string | undefined;\n let codeChallenge: string | undefined;\n\n if (configData.enablePKCE) {\n codeVerifier = this.cryptoHelper?.getCodeVerifier();\n codeChallenge = await this.cryptoHelper?.getCodeChallenge(codeVerifier);\n await this.storageManager.setTemporaryDataParameter(pkceKey, codeVerifier, userId);\n }\n\n if (authRequestConfig['client_secret']) {\n authRequestConfig['client_secret'] = configData.clientSecret;\n }\n\n const authorizeRequestParams: Map<string, string> = getAuthorizeRequestUrlParams(\n {\n clientId: configData.clientId,\n codeChallenge,\n codeChallengeMethod: PKCEConstants.DEFAULT_CODE_CHALLENGE_METHOD,\n instanceId: this.getInstanceId().toString(),\n prompt: configData.prompt,\n redirectUri: configData.afterSignInUrl,\n responseMode: configData.responseMode,\n scopes: processOpenIDScopes(configData.scopes),\n },\n {key: pkceKey},\n authRequestConfig,\n );\n\n Array.from(authorizeRequestParams.entries()).forEach(([paramKey, paramValue]: [string, string]) => {\n authorizeRequest.searchParams.append(paramKey, paramValue);\n });\n\n return authorizeRequest.toString();\n };\n\n if (\n await this.storageManager.getTemporaryDataParameter(\n OIDCDiscoveryConstants.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,\n )\n ) {\n return buildSignInUrl();\n }\n\n return this.loadOpenIDProviderConfiguration(requestConfig?.forceInit as boolean).then(() => buildSignInUrl());\n }\n\n /**\n * This is an async method that sends a request to obtain the access token and returns a Promise\n * that resolves with the token and other relevant data.\n *\n * @param authorizationCode - The authorization code.\n * @param sessionState - The session state.\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * @returns - A Promise that resolves with the token response.\n *\n * @example\n * ```\n * auth.requestAccessToken(authCode, sessionState).then((token)=>{\n * // console.log(token);\n * }).catch((error)=>{\n * // console.error(error);\n * });\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#requestAccessToken}\n *\n *\n * @preserve\n */\n public async requestAccessToken(\n authorizationCode: string,\n sessionState: string,\n state: string,\n userId?: string,\n tokenRequestConfig?: {\n params: Record<string, unknown>;\n },\n ): Promise<TokenResponse> {\n if (\n !(await this.storageManager.getTemporaryDataParameter(\n OIDCDiscoveryConstants.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,\n ))\n ) {\n await this.loadOpenIDProviderConfiguration(false);\n }\n\n const tokenEndpoint: string | undefined = (await this.oidcProviderMetaDataProvider()).token_endpoint;\n const configData: StrictAuthClientConfig = await this.configProvider();\n\n if (!tokenEndpoint || tokenEndpoint.trim().length === 0) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RAT1-NF01',\n 'Token endpoint not found.',\n 'No token endpoint was found in the OIDC provider meta data returned by the well-known endpoint ' +\n 'or the token endpoint passed to the SDK is empty.',\n );\n }\n\n if (sessionState) {\n await this.storageManager.setSessionDataParameter(\n OIDCRequestConstants.Params.SESSION_STATE as keyof SessionData,\n sessionState,\n userId,\n );\n }\n\n const body: URLSearchParams = new URLSearchParams();\n\n body.set('client_id', configData.clientId);\n\n if (configData.clientSecret && configData.clientSecret.trim().length > 0) {\n body.set('client_secret', configData.clientSecret);\n }\n\n const code: string = authorizationCode;\n\n body.set('code', code);\n\n body.set('grant_type', 'authorization_code');\n body.set('redirect_uri', configData.afterSignInUrl);\n\n if (tokenRequestConfig?.params) {\n Object.entries(tokenRequestConfig.params).forEach(([key, value]: [key: string, value: unknown]) => {\n body.append(key, value as string);\n });\n }\n\n if (configData.enablePKCE) {\n body.set(\n 'code_verifier',\n `${await this.storageManager.getTemporaryDataParameter(extractPkceStorageKeyFromState(state), userId)}`,\n );\n\n await this.storageManager.removeTemporaryDataParameter(extractPkceStorageKeyFromState(state), userId);\n }\n\n let tokenResponse: Response;\n\n try {\n tokenResponse = await fetch(tokenEndpoint, {\n body,\n credentials: configData.sendCookiesInRequests ? 'include' : 'same-origin',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n method: 'POST',\n });\n } catch (error: any) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RAT1-NE02',\n 'Requesting access token failed',\n error ?? 'The request to get the access token from the server failed.',\n );\n }\n\n if (!tokenResponse.ok) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RAT1-HE03',\n `Requesting access token failed with ${tokenResponse.statusText}`,\n (await tokenResponse.json()) as string,\n );\n }\n\n return this.authHelper.handleTokenResponse(tokenResponse, userId);\n }\n\n public async loadOpenIDProviderConfiguration(forceInit: boolean): Promise<void> {\n const configData: StrictAuthClientConfig = await this.configProvider();\n\n if (\n !forceInit &&\n (await this.storageManager.getTemporaryDataParameter(\n OIDCDiscoveryConstants.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,\n ))\n ) {\n return Promise.resolve();\n }\n\n const {wellKnownEndpoint, platform, discovery, baseUrl, endpoints} = configData as any;\n\n const resolvedWellKnownEndpoint: string | undefined =\n wellKnownEndpoint ||\n (platform === Platform.AsgardeoV2 && discovery?.wellKnown?.enabled\n ? `${baseUrl}${endpoints?.wellKnown ?? '/.well-known/openid-configuration'}`\n : undefined);\n\n if (resolvedWellKnownEndpoint) {\n let response: Response;\n\n try {\n response = await fetch(resolvedWellKnownEndpoint);\n if (response.status !== 200 || !response.ok) {\n throw new Error();\n }\n } catch {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-GOPMD-HE01',\n 'Invalid well-known response',\n 'The well known endpoint response has been failed with an error.',\n );\n }\n\n await this.storageManager.setOIDCProviderMetaData(await this.authHelper.resolveEndpoints(await response.json()));\n await this.storageManager.setTemporaryDataParameter(\n OIDCDiscoveryConstants.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,\n true,\n );\n\n return Promise.resolve();\n }\n if ((configData as any).baseUrl) {\n try {\n await this.storageManager.setOIDCProviderMetaData(await this.authHelper.resolveEndpointsByBaseURL());\n } catch (error: any) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-GOPMD-IV02',\n 'Resolving endpoints failed.',\n error ?? 'Resolving endpoints by base url failed.',\n );\n }\n await this.storageManager.setTemporaryDataParameter(\n OIDCDiscoveryConstants.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,\n true,\n );\n\n return Promise.resolve();\n }\n await this.storageManager.setOIDCProviderMetaData(await this.authHelper.resolveEndpointsExplicitly());\n\n await this.storageManager.setTemporaryDataParameter(\n OIDCDiscoveryConstants.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,\n true,\n );\n\n return Promise.resolve();\n }\n\n /**\n * This method returns the sign-out URL.\n *\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * **This doesn't clear the authentication data.**\n *\n * @returns - A Promise that resolves with the sign-out URL.\n *\n * @example\n * ```\n * const signOutUrl = await auth.getSignOutUrl();\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getSignOutUrl}\n *\n * @preserve\n */\n public async getSignOutUrl(userId?: string): Promise<string> {\n const logoutEndpoint: string | undefined = (await this.oidcProviderMetaDataProvider())?.end_session_endpoint;\n const configData: StrictAuthClientConfig = await this.configProvider();\n\n if (!logoutEndpoint || logoutEndpoint.trim().length === 0) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-GSOU-NF01',\n 'Sign-out endpoint not found.',\n 'No sign-out endpoint was found in the OIDC provider meta data returned by the well-known endpoint ' +\n 'or the sign-out endpoint passed to the SDK is empty.',\n );\n }\n\n const callbackURL: string = configData?.afterSignOutUrl ?? configData?.afterSignInUrl;\n\n if (!callbackURL || callbackURL.trim().length === 0) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-GSOU-NF03',\n 'No sign-out redirect URL found.',\n 'The sign-out redirect URL cannot be found or the URL passed to the SDK is empty. ' +\n 'No sign-in redirect URL has been found either. ',\n );\n }\n const queryParams: URLSearchParams = new URLSearchParams();\n\n queryParams.set('post_logout_redirect_uri', callbackURL);\n\n if (configData.sendIdTokenInLogoutRequest) {\n const idToken: string = (await this.storageManager.getSessionData(userId))?.id_token;\n\n if (!idToken || idToken.trim().length === 0) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-GSOU-NF02',\n 'ID token not found.',\n 'No ID token could be found. Either the session information is lost or you have not signed in.',\n );\n }\n queryParams.set('id_token_hint', idToken);\n } else {\n queryParams.set('client_id', configData.clientId);\n }\n\n queryParams.set('state', OIDCRequestConstants.Params.SIGN_OUT_SUCCESS);\n\n return `${logoutEndpoint}?${queryParams.toString()}`;\n }\n\n /**\n * This method returns OIDC service endpoints that are fetched from the `.well-known` endpoint.\n *\n * @returns - A Promise that resolves with an object containing the OIDC service endpoints.\n *\n * @example\n * ```\n * const endpoints = await auth.getOpenIDProviderEndpoints();\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getOpenIDProviderEndpoints}\n *\n * @preserve\n */\n public async getOpenIDProviderEndpoints(): Promise<Partial<OIDCEndpoints>> {\n const oidcProviderMetaData: OIDCDiscoveryApiResponse = await this.oidcProviderMetaDataProvider();\n\n return {\n authorizationEndpoint: oidcProviderMetaData.authorization_endpoint ?? '',\n checkSessionIframe: oidcProviderMetaData.check_session_iframe ?? '',\n endSessionEndpoint: oidcProviderMetaData.end_session_endpoint ?? '',\n introspectionEndpoint: oidcProviderMetaData.introspection_endpoint ?? '',\n issuer: oidcProviderMetaData.issuer ?? '',\n jwksUri: oidcProviderMetaData.jwks_uri ?? '',\n registrationEndpoint: oidcProviderMetaData.registration_endpoint ?? '',\n revocationEndpoint: oidcProviderMetaData.revocation_endpoint ?? '',\n tokenEndpoint: oidcProviderMetaData.token_endpoint ?? '',\n userinfoEndpoint: oidcProviderMetaData.userinfo_endpoint ?? '',\n };\n }\n\n /**\n * This method decodes a given JWT token and returns the payload.\n *\n * @param token - The token to be decoded.\n * @returns - A Promise that resolves with the decoded token payload.\n *\n * @example\n * ```\n * const decodedToken = await auth.decodeJwtToken(token);\n * ```\n */\n public async decodeJwtToken<U = Record<string, unknown>>(token: string): Promise<U> {\n return this.cryptoHelper.decodeJwtToken(token);\n }\n\n /**\n * This method decodes the payload of the ID token and returns it.\n *\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * @returns - A Promise that resolves with the decoded ID token payload.\n *\n * @example\n * ```\n * const decodedIdToken = await auth.getDecodedIdToken();\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getDecodedIdToken}\n *\n * @preserve\n */\n public async getDecodedIdToken(userId?: string, idToken?: string): Promise<IdToken> {\n const storedIdToken: string = (await this.storageManager.getSessionData(userId)).id_token;\n const payload: IdToken = this.cryptoHelper.decodeJwtToken<IdToken>(storedIdToken ?? idToken);\n\n return payload;\n }\n\n /**\n * This method returns the ID token.\n *\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * @returns - A Promise that resolves with the ID token.\n *\n * @example\n * ```\n * const idToken = await auth.getIdToken();\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getIdToken}\n *\n * @preserve\n */\n public async getIdToken(userId?: string): Promise<string> {\n return (await this.storageManager.getSessionData(userId)).id_token;\n }\n\n /**\n * This method returns the basic user information obtained from the ID token.\n *\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * @returns - A Promise that resolves with an object containing the basic user information.\n *\n * @example\n * ```\n * const userInfo = await auth.getUser();\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getUser}\n *\n * @preserve\n */\n public async getUser(userId?: string): Promise<User> {\n const sessionData: SessionData = await this.storageManager.getSessionData(userId);\n const authenticatedUser: User = this.authHelper.getAuthenticatedUserInfo(sessionData?.id_token);\n\n Object.keys(authenticatedUser).forEach((key: string) => {\n if (authenticatedUser[key] === undefined || authenticatedUser[key] === '' || authenticatedUser[key] === null) {\n delete authenticatedUser[key];\n }\n });\n\n return authenticatedUser;\n }\n\n public async getUserSession(userId?: string): Promise<UserSession> {\n const sessionData: SessionData = await this.storageManager.getSessionData(userId);\n\n return {\n scopes: sessionData?.scope?.split(' '),\n sessionState: sessionData?.session_state ?? '',\n };\n }\n\n /**\n * This method returns the crypto helper object.\n *\n * @returns - A Promise that resolves with a IsomorphicCrypto object.\n *\n * @example\n * ```\n * const cryptoHelper = await auth.IsomorphicCrypto();\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getCrypto}\n *\n * @preserve\n */\n public async getCrypto(): Promise<IsomorphicCrypto> {\n return this.cryptoHelper;\n }\n\n /**\n * This method revokes the access token.\n *\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * **This method also clears the authentication data.**\n *\n * @returns - A Promise that returns the response of the revoke-access-token request.\n *\n * @example\n * ```\n * auth.revokeAccessToken().then((response)=>{\n * // console.log(response);\n * }).catch((error)=>{\n * // console.error(error);\n * });\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#revokeAccessToken}\n *\n * @preserve\n */\n public async revokeAccessToken(userId?: string): Promise<Response> {\n const revokeTokenEndpoint: string | undefined = (await this.oidcProviderMetaDataProvider()).revocation_endpoint;\n const configData: StrictAuthClientConfig = await this.configProvider();\n\n if (!revokeTokenEndpoint || revokeTokenEndpoint.trim().length === 0) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RAT3-NF01',\n 'No revoke access token endpoint found.',\n 'No revoke access token endpoint was found in the OIDC provider meta data returned by ' +\n 'the well-known endpoint or the revoke access token endpoint passed to the SDK is empty.',\n );\n }\n\n const body: string[] = [];\n\n body.push(`client_id=${configData.clientId}`);\n body.push(`token=${(await this.storageManager.getSessionData(userId)).access_token}`);\n body.push('token_type_hint=access_token');\n\n if (configData.clientSecret && configData.clientSecret.trim().length > 0) {\n body.push(`client_secret=${configData.clientSecret}`);\n }\n\n let response: Response;\n\n try {\n response = await fetch(revokeTokenEndpoint, {\n body: body.join('&'),\n credentials: configData.sendCookiesInRequests ? 'include' : 'same-origin',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n method: 'POST',\n });\n } catch (error: any) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RAT3-NE02',\n 'The request to revoke access token failed.',\n error ?? 'The request sent to revoke the access token failed.',\n );\n }\n\n if (response.status !== 200 || !response.ok) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RAT3-HE03',\n `Invalid response status received for revoke access token request (${response.statusText}).`,\n (await response.json()) as string,\n );\n }\n\n this.authHelper.clearSession(userId);\n\n return Promise.resolve(response);\n }\n\n /**\n * This method refreshes the access token and returns a Promise that resolves with the new access\n * token and other relevant data.\n *\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * @returns - A Promise that resolves with the token response.\n *\n * @example\n * ```\n * auth.refreshAccessToken().then((response)=>{\n * // console.log(response);\n * }).catch((error)=>{\n * // console.error(error);\n * });\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#refreshAccessToken}\n *\n * @preserve\n */\n public async refreshAccessToken(userId?: string): Promise<TokenResponse> {\n const tokenEndpoint: string | undefined = (await this.oidcProviderMetaDataProvider()).token_endpoint;\n const configData: StrictAuthClientConfig = await this.configProvider();\n const sessionData: SessionData = await this.storageManager.getSessionData(userId);\n\n if (!sessionData.refresh_token) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RAT2-NF01',\n 'No refresh token found.',\n \"There was no refresh token found. Asgardeo doesn't return a \" +\n 'refresh token if the refresh token grant is not enabled.',\n );\n }\n\n if (!tokenEndpoint || tokenEndpoint.trim().length === 0) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RAT2-NF02',\n 'No refresh token endpoint found.',\n 'No refresh token endpoint was in the OIDC provider meta data returned by the well-known ' +\n 'endpoint or the refresh token endpoint passed to the SDK is empty.',\n );\n }\n\n const body: string[] = [];\n\n body.push(`client_id=${configData.clientId}`);\n body.push(`refresh_token=${sessionData.refresh_token}`);\n body.push('grant_type=refresh_token');\n\n if (configData.clientSecret && configData.clientSecret.trim().length > 0) {\n body.push(`client_secret=${configData.clientSecret}`);\n }\n\n let tokenResponse: Response;\n\n try {\n tokenResponse = await fetch(tokenEndpoint, {\n body: body.join('&'),\n credentials: configData.sendCookiesInRequests ? 'include' : 'same-origin',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n method: 'POST',\n });\n } catch (error: any) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RAT2-NR03',\n 'Refresh access token request failed.',\n error ?? 'The request to refresh the access token failed.',\n );\n }\n\n if (!tokenResponse.ok) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RAT2-HE04',\n `Refreshing access token failed with ${tokenResponse.statusText}`,\n (await tokenResponse.json()) as string,\n );\n }\n\n return this.authHelper.handleTokenResponse(tokenResponse, userId);\n }\n\n /**\n * This method returns the access token.\n *\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * @returns - A Promise that resolves with the access token.\n *\n * @example\n * ```\n * const accessToken = await auth.getAccessToken();\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getAccessToken}\n *\n * @preserve\n */\n public async getAccessToken(userId?: string): Promise<string> {\n return (await this.storageManager.getSessionData(userId))?.access_token;\n }\n\n /**\n * This method sends a custom-grant request and returns a Promise that resolves with the response\n * depending on the config passed.\n *\n * @param config - A config object containing the custom grant configurations.\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * @returns - A Promise that resolves with the response depending\n * on your configurations.\n *\n * @example\n * ```\n * const config = {\n * attachToken: false,\n * data: {\n * client_id: \"{{clientId}}\",\n * grant_type: \"account_switch\",\n * scope: \"{{scope}}\",\n * token: \"{{token}}\",\n * },\n * id: \"account-switch\",\n * returnResponse: true,\n * returnsSession: true,\n * signInRequired: true\n * }\n *\n * auth.exchangeToken(config).then((response)=>{\n * // console.log(response);\n * }).catch((error)=>{\n * // console.error(error);\n * });\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#exchangeToken}\n *\n * @preserve\n */\n public async exchangeToken(config: TokenExchangeRequestConfig, userId?: string): Promise<TokenResponse | Response> {\n if (\n !(await this.storageManager.getTemporaryDataParameter(\n OIDCDiscoveryConstants.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,\n ))\n ) {\n await this.loadOpenIDProviderConfiguration(false);\n }\n\n const oidcProviderMetadata: OIDCDiscoveryApiResponse = await this.oidcProviderMetaDataProvider();\n const configData: StrictAuthClientConfig = await this.configProvider();\n\n let tokenEndpoint: string | undefined;\n\n if (config.tokenEndpoint && config.tokenEndpoint.trim().length !== 0) {\n tokenEndpoint = config.tokenEndpoint;\n } else {\n tokenEndpoint = oidcProviderMetadata.token_endpoint;\n }\n\n if (!tokenEndpoint || tokenEndpoint.trim().length === 0) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RCG-NF01',\n 'Token endpoint not found.',\n 'No token endpoint was found in the OIDC provider meta data returned by the well-known endpoint ' +\n 'or the token endpoint passed to the SDK is empty.',\n );\n }\n\n const data: string[] = await Promise.all(\n Object.entries(config.data).map(async ([key, value]: [key: string, value: any]) => {\n const newValue: string = await this.authHelper.replaceCustomGrantTemplateTags(value as string, userId);\n\n return `${key}=${newValue}`;\n }),\n );\n\n let requestHeaders: Record<string, any> = {\n Accept: 'application/json',\n 'Content-Type': 'application/x-www-form-urlencoded',\n };\n\n if (config.attachToken) {\n requestHeaders = {\n ...requestHeaders,\n Authorization: `Bearer ${(await this.storageManager.getSessionData(userId)).access_token}`,\n };\n }\n\n const requestConfig: RequestInit = {\n body: data.join('&'),\n credentials: configData.sendCookiesInRequests ? 'include' : 'same-origin',\n headers: new Headers(requestHeaders),\n method: 'POST',\n };\n\n let response: Response;\n\n try {\n response = await fetch(tokenEndpoint, requestConfig);\n } catch (error: any) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RCG-NE02',\n 'The custom grant request failed.',\n error ?? 'The request sent to get the custom grant failed.',\n );\n }\n\n if (response.status !== 200 || !response.ok) {\n throw new AsgardeoAuthException(\n 'JS-AUTH_CORE-RCG-HE03',\n `Invalid response status received for the custom grant request. (${response.statusText})`,\n (await response.json()) as string,\n );\n }\n\n if (config.returnsSession) {\n return this.authHelper.handleTokenResponse(response, userId);\n }\n return Promise.resolve((await response.json()) as TokenResponse | Response);\n }\n\n /**\n * This method returns if the user is authenticated or not.\n *\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * @returns - A Promise that resolves with `true` if the user is authenticated, `false` otherwise.\n *\n * @example\n * ```\n * await auth.isSignedIn();\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#isSignedIn}\n *\n * @preserve\n */\n public async isSignedIn(userId?: string): Promise<boolean> {\n const isAccessTokenAvailable: boolean = Boolean(await this.getAccessToken(userId));\n\n // Check if the access token is expired.\n const createdAt: number = (await this.storageManager.getSessionData(userId))?.created_at;\n\n // Get the expires in value.\n const expiresInString: string = (await this.storageManager.getSessionData(userId))?.expires_in;\n\n // If the expires in value is not available, the token is invalid and the user is not authenticated.\n if (!expiresInString) {\n return false;\n }\n\n // Convert to milliseconds.\n const expiresIn: number = parseInt(expiresInString, 10) * 1000;\n const currentTime: number = new Date().getTime();\n const isAccessTokenValid: boolean = createdAt + expiresIn > currentTime;\n\n const isSignedIn: boolean = isAccessTokenAvailable && isAccessTokenValid;\n\n return isSignedIn;\n }\n\n /**\n * This method returns the PKCE code generated during the generation of the authentication URL.\n *\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n * @param state - The state parameter that was passed in the authentication URL.\n *\n * @returns - A Promise that resolves with the PKCE code.\n *\n * @example\n * ```\n * const pkce = await getPKCECode();\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getPKCECode}\n *\n * @preserve\n */\n public async getPKCECode(state: string, userId?: string): Promise<string> {\n return (await this.storageManager.getTemporaryDataParameter(\n extractPkceStorageKeyFromState(state),\n userId,\n )) as string;\n }\n\n /**\n * This method sets the PKCE code to the data store.\n *\n * @param pkce - The PKCE code.\n * @param state - The state parameter that was passed in the authentication URL.\n * @param userId - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user\n * scenarios where each user should be uniquely identified.\n *\n * @example\n * ```\n * await auth.setPKCECode(\"pkce_code\")\n * ```\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#setPKCECode}\n *\n * @preserve\n */\n public async setPKCECode(pkce: string, state: string, userId?: string): Promise<void> {\n return this.storageManager.setTemporaryDataParameter(extractPkceStorageKeyFromState(state), pkce, userId);\n }\n\n /**\n * This method returns if the sign-out is successful or not.\n *\n * @param signOutRedirectUrl - The URL to which the user has been redirected to after signing-out.\n *\n * **The server appends path parameters to the `afterSignOutUrl` and these path parameters\n * are required for this method to function.**\n *\n * @returns - `true` if successful, `false` otherwise.\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#isSignOutSuccessful}\n *\n * @preserve\n */\n public static isSignOutSuccessful(afterSignOutUrl: string): boolean {\n const url: URL = new URL(afterSignOutUrl);\n const stateParam: string | null = url.searchParams.get(OIDCRequestConstants.Params.STATE);\n const error: boolean = Boolean(url.searchParams.get('error'));\n\n return stateParam ? stateParam === OIDCRequestConstants.Params.SIGN_OUT_SUCCESS && !error : false;\n }\n\n /**\n * This method returns if the sign-out has failed or not.\n *\n * @param signOutRedirectUrl - The URL to which the user has been redirected to after signing-out.\n *\n * **The server appends path parameters to the `afterSignOutUrl` and these path parameters\n * are required for this method to function.**\n *\n * @returns - `true` if successful, `false` otherwise.\n *\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#didSignOutFail}\n *\n * @preserve\n */\n public static didSignOutFail(afterSignOutUrl: string): boolean {\n const url: URL = new URL(afterSignOutUrl);\n const stateParam: string | null = url.searchParams.get(OIDCRequestConstants.Params.STATE);\n const error: boolean = Boolean(url.searchParams.get('error'));\n\n return stateParam ? stateParam === OIDCRequestConstants.Params.SIGN_OUT_SUCCESS && error : false;\n }\n\n /**\n * This method updates the configuration that was passed into the constructor when instantiating this class.\n *\n * @param config - A config object to update the SDK configurations with.\n *\n * @example\n * ```\n * const config = {\n * afterSignInUrl: \"http://localhost:3000/sign-in\",\n * clientId: \"client ID\",\n * baseUrl: \"https://localhost:9443\"\n * }\n *\n * await auth.reInitialize(config);\n * ```\n * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#reInitialize}\n *\n * @preserve\n */\n public async reInitialize(config: Partial<AuthClientConfig<T>>): Promise<void> {\n const currentConfig: AuthClientConfig<T> = this.storageManager.getConfigData() as unknown as AuthClientConfig<T>;\n const newConfig: AuthClientConfig<T> = deepMerge(currentConfig, config);\n\n await this.storageManager.setConfigData(newConfig);\n await this.loadOpenIDProviderConfiguration(true);\n }\n\n public static async clearSession(userId?: string): Promise<void> {\n await this.authHelperInstance.clearSession(userId);\n }\n}\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Attempts to extract a human-readable message from a structured API error response body.\n *\n * The backend returns errors in the following form:\n * {\"code\":\"...\",\"message\":{\"key\":\"...\",\"defaultValue\":\"...\"},\"description\":{\"key\":\"...\",\"defaultValue\":\"...\"}}\n *\n * Returns `description.defaultValue` if present, then `message.defaultValue`, and falls back\n * to the raw `errorText` when the response is not a recognised structured error.\n */\nconst parseApiErrorMessage = (errorText: string): string => {\n try {\n const parsed: Record<string, unknown> = JSON.parse(errorText) as Record<string, unknown>;\n const description: {defaultValue?: string} | undefined = parsed['description'] as\n | {defaultValue?: string}\n | undefined;\n const message: {defaultValue?: string} | undefined = parsed['message'] as {defaultValue?: string} | undefined;\n if (description?.defaultValue) return description.defaultValue;\n if (message?.defaultValue) return message.defaultValue;\n } catch {\n // not JSON \u2014 fall through to raw text\n }\n return errorText;\n};\n\nexport default parseApiErrorMessage;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoError from './AsgardeoError';\nimport parseApiErrorMessage from '../utils/parseApiErrorMessage';\n\n/**\n * Base class for all API-related errors in Asgardeo. This class extends AsgardeoError\n * and adds support for HTTP status codes and status text.\n *\n * The `message` parameter may be either a plain string or a raw JSON error body from the\n * Asgardeo API \u2014 the constructor will extract a human-readable message automatically.\n * An optional `prefix` is prepended to the resolved message (e.g. \"Failed to fetch user profile\").\n *\n * @example\n * ```typescript\n * throw new AsgardeoAPIError(\n * \"Failed to fetch user data\",\n * \"API_FETCH_ERROR\",\n * \"javascript\",\n * 404,\n * \"Not Found\"\n * );\n * ```\n */\nexport default class AsgardeoAPIError extends AsgardeoError {\n /**\n * Creates an instance of AsgardeoAPIError.\n *\n * @param message - Human-readable description or raw API error response body\n * @param code - A unique error code that identifies the error type\n * @param origin - The SDK origin (e.g. 'react', 'vue')\n * @param statusCode - HTTP status code of the failed request\n * @param statusText - HTTP status text of the failed request\n * @param prefix - Optional prefix prepended to the resolved message\n * @constructor\n */\n constructor(\n message: string,\n code: string,\n origin: string,\n public readonly statusCode?: number,\n public readonly statusText?: string,\n prefix?: string,\n ) {\n const parsed: string = parseApiErrorMessage(message);\n const resolvedMessage: string = prefix ? `${prefix}: ${parsed}` : parsed;\n super(resolvedMessage, code, origin);\n\n Object.defineProperty(this, 'name', {\n configurable: true,\n value: 'AsgardeoAPIError',\n writable: true,\n });\n }\n\n /**\n * Returns a string representation of the API error\n * @returns Formatted error string with name, code, status, and message\n */\n public override toString(): string {\n const status: string = this.statusCode ? ` (HTTP ${this.statusCode} - ${this.statusText})` : '';\n return `[${this.name}] (code=\"${this.code}\")${status}\\nMessage: ${this.message}`;\n }\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {EmbeddedFlowExecuteRequestConfig} from '../models/embedded-flow';\nimport {EmbeddedSignInFlowInitiateResponse} from '../models/embedded-signin-flow';\n\n/**\n * Sends an authorization request to the specified OAuth2/OIDC authorization endpoint.\n *\n * @param requestConfig - Request configuration object containing URL and payload.\n * @returns A promise that resolves with the authorization response.\n * @throws AsgardeoAPIError when the request fails or URL is invalid.\n *\n * @example\n * ```typescript\n * try {\n * const authResponse = await initializeEmbeddedSignInFlow({\n * url: \"https://api.asgardeo.io/t/<ORGANIZATION>/oauth2/authorize\",\n * payload: {\n * response_type: \"code\",\n * client_id: \"your-client-id\",\n * redirect_uri: \"https://your-app.com/callback\",\n * scope: \"openid profile email\",\n * state: \"random-state-value\",\n * code_challenge: \"your-pkce-challenge\",\n * code_challenge_method: \"S256\"\n * }\n * });\n * console.log(authResponse);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Authorization failed:', error.message);\n * }\n * }\n * ```\n */\nconst initializeEmbeddedSignInFlow = async ({\n url,\n baseUrl,\n payload,\n ...requestConfig\n}: EmbeddedFlowExecuteRequestConfig): Promise<EmbeddedSignInFlowInitiateResponse> => {\n try {\n // eslint-disable-next-line no-new\n new URL(url ?? baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid URL provided. ${error?.toString()}`,\n 'getSchemas-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `url` or `baseUrl` path does not adhere to the URL schema.',\n );\n }\n\n if (!payload) {\n throw new AsgardeoAPIError(\n 'Authorization payload is required',\n 'initializeEmbeddedSignInFlow-ValidationError-002',\n 'javascript',\n 400,\n 'If an authorization payload is not provided, the request cannot be constructed correctly.',\n );\n }\n\n const searchParams: URLSearchParams = new URLSearchParams();\n Object.entries(payload).forEach(([key, value]: [string, unknown]) => {\n if (value !== undefined && value !== null) {\n searchParams.append(key, String(value));\n }\n });\n\n try {\n const response: Response = await fetch(url ?? `${baseUrl}/oauth2/authorize`, {\n ...requestConfig,\n body: searchParams.toString(),\n headers: {\n ...requestConfig.headers,\n Accept: 'application/json',\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n method: requestConfig.method || 'POST',\n });\n\n if (!response.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n errorText,\n 'initializeEmbeddedSignInFlow-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n 'Authorization request failed',\n );\n }\n\n return (await response.json()) as EmbeddedSignInFlowInitiateResponse;\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'initializeEmbeddedSignInFlow-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default initializeEmbeddedSignInFlow;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {EmbeddedFlowExecuteRequestConfig} from '../models/embedded-flow';\nimport {EmbeddedSignInFlowHandleResponse} from '../models/embedded-signin-flow';\n\nconst executeEmbeddedSignInFlow = async ({\n url,\n baseUrl,\n payload,\n ...requestConfig\n}: EmbeddedFlowExecuteRequestConfig): Promise<EmbeddedSignInFlowHandleResponse> => {\n try {\n // eslint-disable-next-line no-new\n new URL(url ?? baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid URL provided. ${error?.toString()}`,\n 'executeEmbeddedSignInFlow-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `url` or `baseUrl` path does not adhere to the URL schema.',\n );\n }\n\n if (!payload) {\n throw new AsgardeoAPIError(\n 'Authorization payload is required',\n 'executeEmbeddedSignInFlow-ValidationError-002',\n 'javascript',\n 400,\n 'If an authorization payload is not provided, the request cannot be constructed correctly.',\n );\n }\n\n try {\n const response: Response = await fetch(url ?? `${baseUrl}/oauth2/authn`, {\n ...requestConfig,\n body: JSON.stringify(payload),\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: requestConfig.method || 'POST',\n });\n\n if (!response.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n errorText,\n 'initializeEmbeddedSignInFlow-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n 'Authorization request failed',\n );\n }\n\n return (await response.json()) as EmbeddedSignInFlowHandleResponse;\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'executeEmbeddedSignInFlow-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default executeEmbeddedSignInFlow;\n", "/**\n * Copyright (c) 2025-2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport enum EmbeddedFlowType {\n Authentication = 'AUTHENTICATION',\n Recovery = 'RECOVERY',\n Registration = 'REGISTRATION',\n UserOnboarding = 'USER_ONBOARDING',\n}\n\nexport interface EmbeddedFlowExecuteRequestPayload {\n actionId?: string;\n flowType: EmbeddedFlowType;\n inputs?: Record<string, any>;\n}\n\nexport interface EmbeddedFlowExecuteResponse {\n data: EmbeddedSignUpFlowData;\n flowId: string;\n flowStatus: EmbeddedFlowStatus;\n type: EmbeddedFlowResponseType;\n}\n\nexport enum EmbeddedFlowStatus {\n Complete = 'COMPLETE',\n Incomplete = 'INCOMPLETE',\n}\n\nexport enum EmbeddedFlowResponseType {\n Redirection = 'REDIRECTION',\n View = 'VIEW',\n}\n\nexport interface EmbeddedSignUpFlowData {\n additionalData?: Record<string, any>;\n components?: EmbeddedFlowComponent[];\n redirectURL?: string;\n}\n\nexport interface EmbeddedFlowComponent {\n components: EmbeddedFlowComponent[];\n config: Record<string, unknown>;\n id: string;\n type: EmbeddedFlowComponentType | string;\n variant?: string;\n}\n\nexport enum EmbeddedFlowComponentType {\n Button = 'BUTTON',\n Checkbox = 'CHECKBOX',\n Divider = 'DIVIDER',\n Form = 'FORM',\n Image = 'IMAGE',\n Input = 'INPUT',\n Radio = 'RADIO',\n Select = 'SELECT',\n Typography = 'TYPOGRAPHY',\n}\n\n/**\n * Request configuration for executing embedded flow operations.\n *\n * This interface extends standard HTTP request configuration with additional\n * properties specific to embedded flow execution, such as base URL and payload data.\n *\n * @template T - Type of the payload data being sent with the request\n */\nexport interface EmbeddedFlowExecuteRequestConfig<T = any> extends Partial<Request> {\n /**\n * Base URL for the API endpoint.\n * This is typically the Asgardeo organization URL.\n */\n baseUrl?: string;\n\n /**\n * Payload data to be sent with the request.\n * The structure depends on the specific flow operation being executed.\n */\n payload?: T;\n\n /**\n * Full URL for the API endpoint.\n * If provided, this overrides the baseUrl.\n */\n url?: string;\n}\n\n/**\n * Error response structure for AsgardeoV1 embedded flow operations.\n *\n * This interface defines the structure of error responses returned by AsgardeoV1 APIs\n * when flow operations (such as sign-up or sign-in) fail. This format is distinct from\n * AsgardeoV2's error format which uses `failureReason` instead of `code`/`description`.\n *\n * **Key Characteristics:**\n * - Uses structured error codes (e.g., \"FEE-60005\") for programmatic error handling\n * - Provides both a brief `message` and detailed `description` for context\n * - Includes `flowType` to identify which flow operation failed\n *\n * **Comparison with AsgardeoV2:**\n * - **AsgardeoV1**: Uses `code`, `message`, `description` fields\n * - **AsgardeoV2**: Uses `flowStatus: \"ERROR\"` with `failureReason` field\n *\n * **Error Handling:**\n * This error response format is automatically detected and processed by the\n * `extractErrorMessage()` and `checkForErrorResponse()` functions in the React\n * transformer to extract meaningful error messages for display to users.\n *\n * @example\n * ```typescript\n * // Typical AsgardeoV1 error response\n * const errorResponse: EmbeddedFlowExecuteErrorResponse = {\n * code: \"FEE-60005\",\n * message: \"Error while provisioning user.\",\n * description: \"Error occurred while provisioning user in the request of flow id: ac57315c-6ca6-49dc-8664-fcdcff354f46\",\n * flowType: \"REGISTRATION\"\n * };\n *\n * // The transformer will extract: \"Error occurred while provisioning user in the request of flow id: ac57315c-6ca6-49dc-8664-fcdcff354f46\"\n * // (Prefers description over message as it's usually more detailed)\n * ```\n *\n * @see {@link EmbeddedSignUpFlowErrorResponse} for the AsgardeoV2 equivalent error structure\n */\nexport interface EmbeddedFlowExecuteErrorResponse {\n /**\n * Structured error code identifying the type of error.\n *\n * Format typically follows pattern like \"FEE-XXXXX\" where:\n * - \"FEE\" indicates Flow Execution Error\n * - XXXXX is a numeric identifier for the specific error type\n *\n * @example \"FEE-60005\" - User provisioning error\n */\n code: string;\n\n /**\n * Detailed error description with contextual information.\n *\n * This field usually contains more specific information about the error,\n * including flow IDs, operation details, and other debugging context.\n * The transformer prefers this field over `message` when extracting\n * error messages for display to users.\n *\n * @example \"Error occurred while provisioning user in the request of flow id: ac57315c-6ca6-49dc-8664-fcdcff354f46\"\n */\n description: string;\n\n /**\n * Type of flow operation that encountered the error.\n *\n * Currently only supports 'REGISTRATION' but may be extended to\n * include other flow types (e.g., 'LOGIN', 'PASSWORD_RESET') in the future.\n */\n flowType: 'REGISTRATION' | 'RECOVERY';\n\n /**\n * Brief error message describing what went wrong.\n *\n * This is typically a short, high-level description of the error.\n * For more detailed information, refer to the `description` field.\n *\n * @example \"Error while provisioning user.\"\n */\n message: string;\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {EmbeddedFlowType, EmbeddedFlowExecuteResponse, EmbeddedFlowExecuteRequestConfig} from '../models/embedded-flow';\n\n/**\n * Executes an embedded signup flow by sending a request to the specified flow execution endpoint.\n *\n * @param requestConfig - Request configuration object containing URL and payload.\n * @returns A promise that resolves with the flow execution response.\n * @throws AsgardeoAPIError when the request fails or URL is invalid.\n *\n * @example\n * ```typescript\n * try {\n * const embeddedSignUpResponse = await executeEmbeddedSignUpFlow({\n * url: \"https://api.asgardeo.io/t/<ORGANIZATION>/api/server/v1/flow/execute\",\n * payload: {\n * flowType: \"REGISTRATION\"\n * }\n * });\n * console.log(embeddedSignUpResponse);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Embedded SignUp flow execution failed:', error.message);\n * }\n * }\n * ```\n */\nconst executeEmbeddedSignUpFlow = async ({\n url,\n baseUrl,\n payload,\n ...requestConfig\n}: EmbeddedFlowExecuteRequestConfig): Promise<EmbeddedFlowExecuteResponse> => {\n if (!baseUrl && !url) {\n throw new AsgardeoAPIError(\n 'Embedded SignUp flow execution failed: Base URL or URL is not provided.',\n 'javascript-executeEmbeddedSignUpFlow-ValidationError-001',\n 'javascript',\n 400,\n 'At least one of the baseUrl or url must be provided to execute the embedded sign up flow.',\n );\n }\n\n try {\n // eslint-disable-next-line no-new\n new URL(url ?? baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid URL provided. ${error?.toString()}`,\n 'executeEmbeddedSignUpFlow-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `url` or `baseUrl` path does not adhere to the URL schema.',\n );\n }\n\n try {\n const response: Response = await fetch(url ?? `${baseUrl}/api/server/v1/flow/execute`, {\n ...requestConfig,\n body: JSON.stringify({\n ...(payload ?? {}),\n flowType: EmbeddedFlowType.Registration,\n }),\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: requestConfig.method || 'POST',\n });\n\n if (!response.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n errorText,\n 'javascript-executeEmbeddedSignUpFlow-ResponseError-100',\n 'javascript',\n response.status,\n response.statusText,\n 'Embedded SignUp flow execution failed',\n );\n }\n\n return (await response.json()) as EmbeddedFlowExecuteResponse;\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'executeEmbeddedSignUpFlow-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default executeEmbeddedSignUpFlow;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {User} from '../models/user';\n\n/**\n * Retrieves the user information from the specified OIDC userinfo endpoint.\n *\n * @param requestConfig - Request configuration object.\n * @returns A promise that resolves with the user information.\n * @throw\n * const userInfo = await getUserInfo({\n * url: \"https://api.asgardeo.io/t/<ORGANIZATION>/oauth2/userinfo\",\n * });\n * console.log(userInfo);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get user info:', error.message);\n * }\n * }\n * ```\n */\nconst getUserInfo = async ({url, ...requestConfig}: Partial<Request>): Promise<User> => {\n try {\n // eslint-disable-next-line no-new\n new URL(url);\n } catch (error) {\n throw new AsgardeoAPIError(\n 'Invalid endpoint URL provided',\n 'getUserInfo-ValidationError-001',\n 'javascript',\n 400,\n 'Invalid Request',\n );\n }\n\n try {\n const response: Response = await fetch(url, {\n ...requestConfig,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: 'GET',\n });\n\n if (!response.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n errorText,\n 'getUserInfo-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n 'Failed to fetch user info',\n );\n }\n\n return (await response.json()) as User;\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'getUserInfo-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default getUserInfo;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Regular expression to match userstore prefixes in usernames.\n * Matches patterns like \"DEFAULT/\", \"ASGARDEO_USER/\", \"PRIMARY/\", etc.\n * The pattern matches any uppercase letters, numbers, and underscores followed by a forward slash.\n */\nconst USERSTORE_PREFIX_REGEX: RegExp = /^[A-Z_][A-Z0-9_]*\\//;\n\n/**\n * Removes userstore prefixes from a username if they exist.\n * This is commonly used to clean usernames returned from SCIM2 endpoints\n * that include userstore prefixes like \"DEFAULT/\", \"ASGARDEO_USER/\", \"PRIMARY/\", etc.\n *\n * @param username - The username string to process\n * @returns The username without the userstore prefix, or the original username if no prefix exists\n *\n * @example\n * ```typescript\n * const cleanUsername = removeUserstorePrefix(\"DEFAULT/john.doe\");\n * console.log(cleanUsername); // \"john.doe\"\n *\n * const asgardeoUser = removeUserstorePrefix(\"ASGARDEO_USER/jane.doe\");\n * console.log(asgardeoUser); // \"jane.doe\"\n *\n * const primaryUser = removeUserstorePrefix(\"PRIMARY/admin\");\n * console.log(primaryUser); // \"admin\"\n *\n * const alreadyClean = removeUserstorePrefix(\"user.name\");\n * console.log(alreadyClean); // \"user.name\"\n *\n * const emptyInput = removeUserstorePrefix(\"\");\n * console.log(emptyInput); // \"\"\n * ```\n */\nexport const removeUserstorePrefix = (username?: string): string => {\n if (!username) {\n return '';\n }\n\n return username.replace(USERSTORE_PREFIX_REGEX, '');\n};\n\n/**\n * Processes a user object to remove userstore prefixes from username fields.\n * This is a helper function for processing user objects returned from SCIM2 endpoints.\n * Handles various username field variations: username, userName, and user_name.\n *\n * @param user - The user object to process\n * @returns The user object with processed username fields\n *\n * @example\n * ```typescript\n * const user = { username: \"DEFAULT/john.doe\", email: \"john@example.com\" };\n * const processedUser = processUserUsername(user);\n * console.log(processedUser.username); // \"john.doe\"\n *\n * const camelCaseUser = { userName: \"ASGARDEO_USER/jane.doe\", email: \"jane@example.com\" };\n * const processedCamelCaseUser = processUserUsername(camelCaseUser);\n * console.log(processedCamelCaseUser.userName); // \"jane.doe\"\n *\n * const snakeCaseUser = { user_name: \"PRIMARY/admin\", email: \"admin@example.com\" };\n * const processedSnakeCaseUser = processUserUsername(snakeCaseUser);\n * console.log(processedSnakeCaseUser.user_name); // \"admin\"\n * ```\n */\nconst processUsername = <T extends {userName?: string; user_name?: string; username?: string}>(user: T): T => {\n if (!user) {\n return user;\n }\n\n const processedUser: T = {...user};\n\n // Process username field\n if (processedUser.username) {\n processedUser.username = removeUserstorePrefix(processedUser.username);\n }\n\n // Process userName field\n if (processedUser.userName) {\n processedUser.userName = removeUserstorePrefix(processedUser.userName);\n }\n\n // Process user_name field\n if (processedUser.user_name) {\n processedUser.user_name = removeUserstorePrefix(processedUser.user_name);\n }\n\n return processedUser;\n};\n\nexport default processUsername;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {User} from '../models/user';\nimport processUserUsername from '../utils/processUsername';\n\n/**\n * Configuration for the getScim2Me request\n */\nexport interface GetScim2MeConfig extends Omit<RequestInit, 'method'> {\n /**\n * The base path of the API endpoint.\n */\n baseUrl?: string;\n /**\n * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * The absolute API endpoint.\n */\n url?: string;\n}\n\n/**\n * Retrieves the user profile information from the specified SCIM2 /Me endpoint.\n *\n * @param config - Request configuration object.\n * @returns A promise that resolves with the user profile information.\n * @example\n * ```typescript\n * // Using default fetch\n * try {\n * const userProfile = await getScim2Me({\n * url: \"https://api.asgardeo.io/t/<ORGANIZATION>/scim2/Me\",\n * });\n * console.log(userProfile);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get user profile:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher (e.g., axios-based httpClient)\n * try {\n * const userProfile = await getScim2Me({\n * url: \"https://api.asgardeo.io/t/<ORGANIZATION>/scim2/Me\",\n * fetcher: async (url, config) => {\n * const response = await httpClient({\n * url,\n * method: config.method,\n * headers: config.headers,\n * ...config\n * });\n * // Convert axios-like response to fetch-like Response\n * return {\n * ok: response.status >= 200 && response.status < 300,\n * status: response.status,\n * statusText: response.statusText,\n * json: () => Promise.resolve(response.data),\n * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))\n * } as Response;\n * }\n * });\n * console.log(userProfile);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get user profile:', error.message);\n * }\n * }\n * ```\n */\nconst getScim2Me = async ({url, baseUrl, fetcher, ...requestConfig}: GetScim2MeConfig): Promise<User> => {\n try {\n // eslint-disable-next-line no-new\n new URL(url ?? baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid URL provided. ${error?.toString()}`,\n 'getScim2Me-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `url` or `baseUrl` path does not adhere to the URL schema.',\n );\n }\n\n const fetchFn: typeof fetch = fetcher || fetch;\n const resolvedUrl: string = url ?? `${baseUrl}/scim2/Me`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/scim+json',\n ...requestConfig.headers,\n },\n method: 'GET',\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n errorText,\n 'getScim2Me-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n 'Failed to fetch user profile',\n );\n }\n\n const user: User = (await response.json()) as User;\n\n return processUserUsername(user);\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'getScim2Me-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default getScim2Me;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {Schema} from '../models/scim2-schema';\n\n/**\n * Configuration for the getSchemas request\n */\nexport interface GetSchemasConfig extends Omit<RequestInit, 'method'> {\n /**\n * The base path of the API endpoint.\n */\n baseUrl?: string;\n /**\n * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * The absolute API endpoint.\n */\n url?: string;\n}\n\n/**\n * Retrieves the SCIM2 schemas from the specified endpoint.\n *\n * @param config - Request configuration object.\n * @returns A promise that resolves with the SCIM2 schemas information.\n * @example\n * ```typescript\n * // Using default fetch\n * try {\n * const schemas = await getSchemas({\n * url: \"https://api.asgardeo.io/t/<ORGANIZATION>/scim2/Schemas\",\n * });\n * console.log(schemas);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get schemas:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher (e.g., axios-based httpClient)\n * try {\n * const schemas = await getSchemas({\n * url: \"https://api.asgardeo.io/t/<ORGANIZATION>/scim2/Schemas\",\n * fetcher: async (url, config) => {\n * const response = await httpClient({\n * url,\n * method: config.method,\n * headers: config.headers,\n * ...config\n * });\n * // Convert axios-like response to fetch-like Response\n * return {\n * ok: response.status >= 200 && response.status < 300,\n * status: response.status,\n * statusText: response.statusText,\n * json: () => Promise.resolve(response.data),\n * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))\n * } as Response;\n * }\n * });\n * console.log(schemas);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get schemas:', error.message);\n * }\n * }\n * ```\n */\nconst getSchemas = async ({url, baseUrl, fetcher, ...requestConfig}: GetSchemasConfig): Promise<Schema[]> => {\n try {\n // eslint-disable-next-line no-new\n new URL(url ?? baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid URL provided. ${error?.toString()}`,\n 'getSchemas-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `url` or `baseUrl` path does not adhere to the URL schema.',\n );\n }\n\n const fetchFn: typeof fetch = fetcher || fetch;\n const resolvedUrl: string = url ?? `${baseUrl}/scim2/Schemas`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: 'GET',\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n errorText,\n 'getSchemas-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n 'Failed to fetch SCIM2 schemas',\n );\n }\n\n return (await response.json()) as Schema[];\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'getSchemas-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default getSchemas;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {AllOrganizationsApiResponse} from '../models/organization';\n\n/**\n * Configuration for the getAllOrganizations request\n */\nexport interface GetAllOrganizationsConfig extends Omit<RequestInit, 'method'> {\n /**\n * The base URL for the API endpoint.\n */\n baseUrl: string;\n /**\n * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Filter expression for organizations\n */\n filter?: string;\n /**\n * Maximum number of organizations to return\n */\n limit?: number;\n /**\n * Whether to include child organizations recursively\n */\n recursive?: boolean;\n}\n\n/**\n * Retrieves all organizations with pagination support.\n *\n * @param config - Configuration object containing baseUrl, optional query parameters, and request config.\n * @returns A promise that resolves with the paginated organizations information.\n * @example\n * ```typescript\n * // Using default fetch\n * try {\n * const response = await getAllOrganizations({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * filter: \"\",\n * limit: 10,\n * recursive: false\n * });\n * console.log(response.organizations);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get organizations:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher (e.g., axios-based httpClient)\n * try {\n * const response = await getAllOrganizations({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * filter: \"\",\n * limit: 10,\n * recursive: false,\n * fetcher: async (url, config) => {\n * const response = await httpClient({\n * url,\n * method: config.method,\n * headers: config.headers,\n * ...config\n * });\n * // Convert axios-like response to fetch-like Response\n * return {\n * ok: response.status >= 200 && response.status < 300,\n * status: response.status,\n * statusText: response.statusText,\n * json: () => Promise.resolve(response.data),\n * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))\n * } as Response;\n * }\n * });\n * console.log(response.organizations);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get organizations:', error.message);\n * }\n * }\n * ```\n */\nconst getAllOrganizations = async ({\n baseUrl,\n filter = '',\n limit = 10,\n recursive = false,\n fetcher,\n ...requestConfig\n}: GetAllOrganizationsConfig): Promise<AllOrganizationsApiResponse> => {\n try {\n // eslint-disable-next-line no-new\n new URL(baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid base URL provided. ${error?.toString()}`,\n 'getAllOrganizations-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `baseUrl` does not adhere to the URL schema.',\n );\n }\n\n const queryParams: URLSearchParams = new URLSearchParams(\n Object.fromEntries(\n Object.entries({\n filter,\n limit: limit.toString(),\n recursive: recursive.toString(),\n }).filter(([, value]: [string, string]) => Boolean(value)),\n ),\n );\n\n const fetchFn: typeof fetch = fetcher || fetch;\n const resolvedUrl: string = `${baseUrl}/api/server/v1/organizations?${queryParams.toString()}`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n headers: {\n ...requestConfig.headers,\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n method: 'GET',\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n errorText,\n 'getAllOrganizations-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n 'Failed to get organizations',\n );\n }\n\n const data: AllOrganizationsApiResponse = (await response.json()) as any;\n\n return {\n hasMore: data.hasMore,\n nextCursor: data.nextCursor,\n organizations: data.organizations || [],\n totalCount: data.totalCount,\n };\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'getAllOrganizations-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default getAllOrganizations;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {Organization} from '../models/organization';\n\n/**\n * Interface for organization creation payload.\n */\nexport interface CreateOrganizationPayload {\n /**\n * Organization description.\n */\n description: string;\n /**\n * Organization name.\n */\n name: string;\n /**\n * Organization handle/slug.\n */\n orgHandle?: string;\n /**\n * Parent organization ID.\n */\n parentId: string;\n /**\n * Organization type.\n */\n type: 'TENANT';\n}\n\n/**\n * Configuration for the createOrganization request\n */\nexport interface CreateOrganizationConfig extends Omit<RequestInit, 'method' | 'body'> {\n /**\n * The base URL for the API endpoint.\n */\n baseUrl: string;\n /**\n * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Organization creation payload\n */\n payload: CreateOrganizationPayload;\n}\n\n/**\n * Creates a new organization.\n *\n * @param config - Configuration object containing baseUrl, payload and optional request config.\n * @returns A promise that resolves with the created organization information.\n * @example\n * ```typescript\n * // Using default fetch\n * try {\n * const organization = await createOrganization({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * payload: {\n * description: \"Share your screens\",\n * name: \"Team Viewer\",\n * orgHandle: \"team-viewer\",\n * parentId: \"f4825104-4948-40d9-ab65-a960eee3e3d5\",\n * type: \"TENANT\"\n * }\n * });\n * console.log(organization);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to create organization:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher (e.g., axios-based httpClient)\n * try {\n * const organization = await createOrganization({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * payload: {\n * description: \"Share your screens\",\n * name: \"Team Viewer\",\n * orgHandle: \"team-viewer\",\n * parentId: \"f4825104-4948-40d9-ab65-a960eee3e3d5\",\n * type: \"TENANT\"\n * },\n * fetcher: async (url, config) => {\n * const response = await httpClient({\n * url,\n * method: config.method,\n * headers: config.headers,\n * data: config.body,\n * ...config\n * });\n * // Convert axios-like response to fetch-like Response\n * return {\n * ok: response.status >= 200 && response.status < 300,\n * status: response.status,\n * statusText: response.statusText,\n * json: () => Promise.resolve(response.data),\n * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))\n * } as Response;\n * }\n * });\n * console.log(organization);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to create organization:', error.message);\n * }\n * }\n * ```\n */\nconst createOrganization = async ({\n baseUrl,\n payload,\n fetcher,\n ...requestConfig\n}: CreateOrganizationConfig): Promise<Organization> => {\n try {\n // eslint-disable-next-line no-new\n new URL(baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid base URL provided. ${error?.toString()}`,\n 'createOrganization-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `baseUrl` does not adhere to the URL schema.',\n );\n }\n\n if (!payload) {\n throw new AsgardeoAPIError(\n 'Organization payload is required',\n 'createOrganization-ValidationError-002',\n 'javascript',\n 400,\n 'Invalid Request',\n );\n }\n\n // Always set type to TENANT for now\n const organizationPayload: CreateOrganizationPayload = {\n ...payload,\n type: 'TENANT' as const,\n };\n\n const fetchFn: typeof fetch = fetcher || fetch;\n const resolvedUrl: string = `${baseUrl}/api/server/v1/organizations`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n body: JSON.stringify(organizationPayload),\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: 'POST',\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n errorText,\n 'createOrganization-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n 'Failed to create organization',\n );\n }\n\n return (await response.json()) as Organization;\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'createOrganization-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default createOrganization;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {Organization} from '../models/organization';\n\n/**\n * Configuration for the getMeOrganizations request\n */\nexport interface GetMeOrganizationsConfig extends Omit<RequestInit, 'method'> {\n /**\n * Base64 encoded cursor value for forward pagination\n */\n after?: string;\n /**\n * Authorized application name filter\n */\n authorizedAppName?: string;\n /**\n * The base URL for the API endpoint.\n */\n baseUrl: string;\n /**\n * Base64 encoded cursor value for backward pagination\n */\n before?: string;\n /**\n * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Filter expression for organizations\n */\n filter?: string;\n /**\n * Maximum number of organizations to return\n */\n limit?: number;\n /**\n * Whether to include child organizations recursively\n */\n recursive?: boolean;\n}\n\n/**\n * Retrieves the organizations associated with the current user.\n *\n * @param config - Configuration object containing baseUrl, optional query parameters, and request config.\n * @returns A promise that resolves with the organizations information.\n * @example\n * ```typescript\n * // Using default fetch\n * try {\n * const organizations = await getMeOrganizations({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * after: \"\",\n * before: \"\",\n * filter: \"\",\n * limit: 10,\n * recursive: false\n * });\n * console.log(organizations);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get organizations:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher (e.g., axios-based httpClient)\n * try {\n * const organizations = await getMeOrganizations({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * after: \"\",\n * before: \"\",\n * filter: \"\",\n * limit: 10,\n * recursive: false,\n * fetcher: async (url, config) => {\n * const response = await httpClient({\n * url,\n * method: config.method,\n * headers: config.headers,\n * ...config\n * });\n * // Convert axios-like response to fetch-like Response\n * return {\n * ok: response.status >= 200 && response.status < 300,\n * status: response.status,\n * statusText: response.statusText,\n * json: () => Promise.resolve(response.data),\n * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))\n * } as Response;\n * }\n * });\n * console.log(organizations);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get organizations:', error.message);\n * }\n * }\n * ```\n */\nconst getMeOrganizations = async ({\n baseUrl,\n after = '',\n authorizedAppName = '',\n before = '',\n filter = '',\n limit = 10,\n recursive = false,\n fetcher,\n ...requestConfig\n}: GetMeOrganizationsConfig): Promise<Organization[]> => {\n try {\n // eslint-disable-next-line no-new\n new URL(baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid base URL provided. ${error?.toString()}`,\n 'getMeOrganizations-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `baseUrl` does not adhere to the URL schema.',\n );\n }\n\n const queryParams: URLSearchParams = new URLSearchParams(\n Object.fromEntries(\n Object.entries({\n after,\n authorizedAppName,\n before,\n filter,\n limit: limit.toString(),\n recursive: recursive.toString(),\n }).filter(([, value]: [string, string]) => Boolean(value)),\n ),\n );\n\n const fetchFn: typeof fetch = fetcher || fetch;\n const resolvedUrl: string = `${baseUrl}/api/users/v1/me/organizations?${queryParams.toString()}`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: 'GET',\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n errorText,\n 'getMeOrganizations-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n 'Failed to fetch associated organizations of the user',\n );\n }\n\n const data: Record<string, unknown> = (await response.json()) as any;\n return (data['organizations'] as Organization[]) || [];\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'getMeOrganizations-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default getMeOrganizations;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\n\n/**\n * Extended organization interface with additional properties\n */\nexport interface OrganizationDetails {\n attributes?: Record<string, any>;\n created?: string;\n description?: string;\n id: string;\n lastModified?: string;\n name: string;\n orgHandle: string;\n parent?: {\n id: string;\n ref: string;\n };\n permissions?: string[];\n status?: string;\n type?: string;\n}\n\n/**\n * Configuration for the getOrganization request\n */\nexport interface GetOrganizationConfig extends Omit<RequestInit, 'method'> {\n /**\n * The base URL for the API endpoint.\n */\n baseUrl: string;\n /**\n * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * The ID of the organization to retrieve\n */\n organizationId: string;\n}\n\n/**\n * Retrieves detailed information for a specific organization.\n *\n * @param config - Configuration object containing baseUrl, organizationId, and request config.\n * @returns A promise that resolves with the organization details.\n * @example\n * ```typescript\n * // Using default fetch\n * try {\n * const organization = await getOrganization({\n * baseUrl: \"https://api.asgardeo.io/t/dxlab\",\n * organizationId: \"0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1\"\n * });\n * console.log(organization);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get organization:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher (e.g., axios-based httpClient)\n * try {\n * const organization = await getOrganization({\n * baseUrl: \"https://api.asgardeo.io/t/dxlab\",\n * organizationId: \"0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1\",\n * fetcher: async (url, config) => {\n * const response = await httpClient({\n * url,\n * method: config.method,\n * headers: config.headers,\n * ...config\n * });\n * // Convert axios-like response to fetch-like Response\n * return {\n * ok: response.status >= 200 && response.status < 300,\n * status: response.status,\n * statusText: response.statusText,\n * json: () => Promise.resolve(response.data),\n * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))\n * } as Response;\n * }\n * });\n * console.log(organization);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get organization:', error.message);\n * }\n * }\n * ```\n */\nconst getOrganization = async ({\n baseUrl,\n organizationId,\n fetcher,\n ...requestConfig\n}: GetOrganizationConfig): Promise<OrganizationDetails> => {\n try {\n // eslint-disable-next-line no-new\n new URL(baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid base URL provided. ${error?.toString()}`,\n 'getOrganization-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `baseUrl` does not adhere to the URL schema.',\n );\n }\n\n if (!organizationId) {\n throw new AsgardeoAPIError(\n 'Organization ID is required',\n 'getOrganization-ValidationError-002',\n 'javascript',\n 400,\n 'Invalid Request',\n );\n }\n\n const fetchFn: typeof fetch = fetcher || fetch;\n const resolvedUrl: string = `${baseUrl}/api/server/v1/organizations/${organizationId}`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: 'GET',\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n errorText,\n 'getOrganization-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n 'Failed to fetch organization details',\n );\n }\n\n return (await response.json()) as OrganizationDetails;\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'getOrganization-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default getOrganization;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Checks if a value is considered empty.\n *\n * A value is considered empty if it is:\n * - null\n * - undefined\n * - empty string (\"\")\n * - string containing only whitespace characters\n * - empty array ([])\n * - empty object ({})\n *\n * @param value - The value to check\n * @returns true if the value is empty, false otherwise\n *\n * @example\n * ```typescript\n * isEmpty(null); // true\n * isEmpty(undefined); // true\n * isEmpty(\"\"); // true\n * isEmpty(\" \"); // true\n * isEmpty(\"hello\"); // false\n * isEmpty([]); // true\n * isEmpty([1, 2, 3]); // false\n * isEmpty({}); // true\n * isEmpty({ name: \"John\" }); // false\n * isEmpty(0); // false\n * isEmpty(false); // false\n * ```\n */\nconst isEmpty = (value: any): boolean => {\n if (value === null || value === undefined) {\n return true;\n }\n\n if (typeof value === 'string') {\n return value.trim() === '';\n }\n\n if (Array.isArray(value)) {\n return value.length === 0;\n }\n\n if (typeof value === 'object' && value.constructor === Object) {\n return Object.keys(value).length === 0;\n }\n\n return false;\n};\n\nexport default isEmpty;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {OrganizationDetails} from './getOrganization';\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport isEmpty from '../utils/isEmpty';\n\n/**\n * Configuration for the updateOrganization request\n */\nexport interface UpdateOrganizationConfig extends Omit<RequestInit, 'method' | 'body'> {\n /**\n * The base URL for the API endpoint.\n */\n baseUrl: string;\n /**\n * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Array of patch operations to apply\n */\n operations: Array<{\n operation: 'REPLACE' | 'ADD' | 'REMOVE';\n path: string;\n value?: any;\n }>;\n /**\n * The ID of the organization to update\n */\n organizationId: string;\n}\n\n/**\n * Updates the organization information using the Organizations Management API.\n *\n * @param config - Configuration object with baseUrl, organizationId, operations and optional request config.\n * @returns A promise that resolves with the updated organization information.\n * @example\n * ```typescript\n * // Using the helper function to create operations automatically\n * const operations = createPatchOperations({\n * name: \"Updated Organization Name\", // Will use REPLACE\n * description: \"\", // Will use REMOVE (empty string)\n * customField: \"Some value\" // Will use REPLACE\n * });\n *\n * await updateOrganization({\n * baseUrl: \"https://api.asgardeo.io/t/<ORG>\",\n * organizationId: \"0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1\",\n * operations\n * });\n *\n * // Or manually specify operations\n * await updateOrganization({\n * baseUrl: \"https://api.asgardeo.io/t/<ORG>\",\n * organizationId: \"0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1\",\n * operations: [\n * { operation: \"REPLACE\", path: \"/name\", value: \"Updated Organization Name\" },\n * { operation: \"REMOVE\", path: \"/description\" }\n * ]\n * });\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher (e.g., axios-based httpClient)\n * await updateOrganization({\n * baseUrl: \"https://api.asgardeo.io/t/<ORG>\",\n * organizationId: \"0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1\",\n * operations: [\n * { operation: \"REPLACE\", path: \"/name\", value: \"Updated Organization Name\" }\n * ],\n * fetcher: async (url, config) => {\n * const response = await httpClient({\n * url,\n * method: config.method,\n * headers: config.headers,\n * data: config.body,\n * ...config\n * });\n * // Convert axios-like response to fetch-like Response\n * return {\n * ok: response.status >= 200 && response.status < 300,\n * status: response.status,\n * statusText: response.statusText,\n * json: () => Promise.resolve(response.data),\n * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))\n * } as Response;\n * }\n * });\n * ```\n */\nconst updateOrganization = async ({\n baseUrl,\n organizationId,\n operations,\n fetcher,\n ...requestConfig\n}: UpdateOrganizationConfig): Promise<OrganizationDetails> => {\n try {\n // eslint-disable-next-line no-new\n new URL(baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid base URL provided. ${error?.toString()}`,\n 'updateOrganization-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `baseUrl` does not adhere to the URL schema.',\n );\n }\n\n if (!organizationId) {\n throw new AsgardeoAPIError(\n 'Organization ID is required',\n 'updateOrganization-ValidationError-002',\n 'javascript',\n 400,\n 'Invalid Request',\n );\n }\n\n if (!operations || !Array.isArray(operations) || operations.length === 0) {\n throw new AsgardeoAPIError(\n 'Operations array is required and cannot be empty',\n 'updateOrganization-ValidationError-003',\n 'javascript',\n 400,\n 'Invalid Request',\n );\n }\n\n const fetchFn: typeof fetch = fetcher || fetch;\n const resolvedUrl: string = `${baseUrl}/api/server/v1/organizations/${organizationId}`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n body: JSON.stringify(operations),\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: 'PATCH',\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n errorText,\n 'updateOrganization-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n 'Failed to update organization',\n );\n }\n\n return (await response.json()) as OrganizationDetails;\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'updateOrganization-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\n/**\n * Helper function to convert field updates to patch operations format.\n * Uses REMOVE operation when the value is empty, otherwise uses REPLACE.\n *\n * @param payload - Object containing field updates\n * @returns Array of patch operations\n */\nexport const createPatchOperations = (\n payload: Record<string, any>,\n): Array<{\n operation: 'REPLACE' | 'REMOVE';\n path: string;\n value?: any;\n}> =>\n Object.entries(payload).map(([key, value]: [string, any]) => {\n if (isEmpty(value)) {\n return {\n operation: 'REMOVE' as const,\n path: `/${key}`,\n };\n }\n\n return {\n operation: 'REPLACE' as const,\n path: `/${key}`,\n value,\n };\n });\n\nexport default updateOrganization;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {User} from '../models/user';\nimport processUserUsername from '../utils/processUsername';\n\n/**\n * Configuration for the updateMeProfile request\n */\nexport interface UpdateMeProfileConfig extends Omit<RequestInit, 'method' | 'body'> {\n /**\n * The base path of the API endpoint.\n */\n baseUrl?: string;\n /**\n * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * The value object to patch (SCIM2 PATCH value)\n */\n payload: any;\n /**\n * The absolute API endpoint.\n */\n url?: string;\n}\n\n/**\n * Updates the user profile information at the specified SCIM2 Me endpoint.\n *\n * @param config - Configuration object with URL, payload and optional request config.\n * @returns A promise that resolves with the updated user profile information.\n * @example\n * ```typescript\n * // Using default fetch\n * await updateMeProfile({\n * url: \"https://api.asgardeo.io/t/<ORG>/scim2/Me\",\n * payload: { \"urn:scim:wso2:schema\": { mobileNumbers: [\"0777933830\"] } }\n * });\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher (e.g., axios-based httpClient)\n * await updateMeProfile({\n * url: \"https://api.asgardeo.io/t/<ORG>/scim2/Me\",\n * payload: { \"urn:scim:wso2:schema\": { mobileNumbers: [\"0777933830\"] } },\n * fetcher: async (url, config) => {\n * const response = await httpClient({\n * url,\n * method: config.method,\n * headers: config.headers,\n * data: config.body,\n * ...config\n * });\n * // Convert axios-like response to fetch-like Response\n * return {\n * ok: response.status >= 200 && response.status < 300,\n * status: response.status,\n * statusText: response.statusText,\n * json: () => Promise.resolve(response.data),\n * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))\n * } as Response;\n * }\n * });\n * ```\n */\nconst updateMeProfile = async ({\n url,\n baseUrl,\n payload,\n fetcher,\n ...requestConfig\n}: UpdateMeProfileConfig): Promise<User> => {\n try {\n // eslint-disable-next-line no-new\n new URL(url ?? baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid URL provided. ${error?.toString()}`,\n 'updateMeProfile-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `url` or `baseUrl` path does not adhere to the URL schema.',\n );\n }\n\n const data: Record<string, unknown> = {\n Operations: [\n {\n op: 'replace',\n value: payload,\n },\n ],\n schemas: ['urn:ietf:params:scim:api:messages:2.0:PatchOp'],\n };\n\n const fetchFn: typeof fetch = fetcher || fetch;\n const resolvedUrl: string = url ?? `${baseUrl}/scim2/Me`;\n\n const requestInit: RequestInit = {\n method: 'PATCH',\n ...requestConfig,\n body: JSON.stringify(data),\n headers: {\n ...requestConfig.headers,\n Accept: 'application/json',\n 'Content-Type': 'application/scim+json',\n },\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n errorText,\n 'updateMeProfile-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n 'Failed to update user profile',\n );\n }\n\n // Match the read path (`getScim2Me`) \u2014 strip the userstore prefix\n // (e.g. \"DEFAULT/\") so consumers receive a clean `userName`. Without\n // this, the optimistic-update path would put the prefixed value into\n // local state and the UI would flip to \"DEFAULT/<email>\" after a save.\n return processUserUsername((await response.json()) as User);\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n error?.response?.data?.detail || 'An error occurred while updating the user profile. Please try again.',\n 'updateMeProfile-NetworkError-001',\n 'javascript',\n error?.data?.status,\n 'Network Error',\n );\n }\n};\n\nexport default updateMeProfile;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport {BrandingPreference} from '../models/branding-preference';\n\n/**\n * Configuration for the getBrandingPreference request\n */\nexport interface GetBrandingPreferenceConfig extends Omit<RequestInit, 'method'> {\n /**\n * The base URL for the API endpoint.\n */\n baseUrl: string;\n /**\n * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\n /**\n * Locale for the branding preference\n */\n locale?: string;\n /**\n * Name of the branding preference\n */\n name?: string;\n /**\n * Type of the branding preference\n */\n type?: string;\n}\n\n/**\n * Retrieves branding preference configuration.\n *\n * @param config - Configuration object containing baseUrl, optional query parameters, and request config.\n * @returns A promise that resolves with the branding preference information.\n * @example\n * ```typescript\n * // Using default fetch\n * try {\n * const response = await getBrandingPreference({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * locale: \"en-US\",\n * name: \"my-branding\",\n * type: \"org\"\n * });\n * console.log(response.theme);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get branding preference:', error.message);\n * }\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Using custom fetcher (e.g., axios-based httpClient)\n * try {\n * const response = await getBrandingPreference({\n * baseUrl: \"https://api.asgardeo.io/t/<ORGANIZATION>\",\n * locale: \"en-US\",\n * name: \"my-branding\",\n * type: \"org\",\n * fetcher: async (url, config) => {\n * const response = await httpClient({\n * url,\n * method: config.method,\n * headers: config.headers,\n * ...config\n * });\n * // Convert axios-like response to fetch-like Response\n * return {\n * ok: response.status >= 200 && response.status < 300,\n * status: response.status,\n * statusText: response.statusText,\n * json: () => Promise.resolve(response.data),\n * text: () => Promise.resolve(typeof response.data === 'string' ? response.data : JSON.stringify(response.data))\n * } as Response;\n * }\n * });\n * console.log(response.theme);\n * } catch (error) {\n * if (error instanceof AsgardeoAPIError) {\n * console.error('Failed to get branding preference:', error.message);\n * }\n * }\n * ```\n */\nconst getBrandingPreference = async ({\n baseUrl,\n locale,\n name,\n type,\n fetcher,\n ...requestConfig\n}: GetBrandingPreferenceConfig): Promise<BrandingPreference> => {\n try {\n // eslint-disable-next-line no-new\n new URL(baseUrl);\n } catch (error) {\n throw new AsgardeoAPIError(\n `Invalid base URL provided. ${error?.toString()}`,\n 'getBrandingPreference-ValidationError-001',\n 'javascript',\n 400,\n 'The provided `baseUrl` does not adhere to the URL schema.',\n );\n }\n\n const queryParams: URLSearchParams = new URLSearchParams(\n Object.fromEntries(\n Object.entries({\n locale: locale || '',\n name: name || '',\n type: type || '',\n }).filter(([, value]: [string, string]) => Boolean(value)),\n ),\n );\n\n const fetchFn: typeof fetch = fetcher || fetch;\n const resolvedUrl: string = `${baseUrl}/api/server/v1/branding-preference/resolve${\n queryParams.toString() ? `?${queryParams.toString()}` : ''\n }`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: 'GET',\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n errorText,\n 'getBrandingPreference-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n 'Failed to get branding preference',\n );\n }\n\n const data: BrandingPreference = (await response.json()) as BrandingPreference;\n return data;\n } catch (error) {\n if (error instanceof AsgardeoAPIError) {\n throw error;\n }\n\n throw new AsgardeoAPIError(\n `Network or parsing error: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'getBrandingPreference-NetworkError-001',\n 'javascript',\n 0,\n 'Network Error',\n );\n }\n};\n\nexport default getBrandingPreference;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {EmbeddedFlowResponseData as EmbeddedFlowResponseDataV2} from './embedded-flow-v2';\nimport {\n EmbeddedFlowResponseType as EmbeddedFlowResponseTypeV1,\n EmbeddedFlowType as EmbeddedFlowTypeV1,\n} from '../embedded-flow';\n\n/**\n * Status enumeration for Asgardeo embedded sign-in flow operations.\n *\n * These statuses indicate the current state of the sign-in flow and determine\n * the next action required by the client application. Each status provides\n * specific guidance on how to proceed with the authentication process.\n *\n * @example\n * ```typescript\n * switch (response.flowStatus) {\n * case EmbeddedSignInFlowStatus.Incomplete:\n * // More user input needed - render form components\n * break;\n * case EmbeddedSignInFlowStatus.Complete:\n * // Authentication successful - handle completion\n * break;\n * case EmbeddedSignInFlowStatus.Error:\n * // Authentication failed - show error message\n * break;\n * }\n * ```\n *\n * @experimental Part of the new Asgardeo API\n */\nexport enum EmbeddedSignInFlowStatus {\n /**\n * Sign-in flow completed successfully.\n *\n * The user has been authenticated and the flow can proceed to\n * OAuth2 completion or redirection. Check for redirectUrl or\n * assertion data in the response.\n */\n Complete = 'COMPLETE',\n\n /**\n * Sign-in flow encountered an error.\n *\n * Authentication failed due to invalid credentials, system error,\n * or other issues. Check error details in the response and handle\n * appropriately (retry, show error message, etc.).\n */\n Error = 'ERROR',\n\n /**\n * Sign-in flow requires additional user input.\n *\n * More authentication steps are needed. The response will contain\n * components in data.meta.components that should be rendered to\n * collect additional user input (e.g., MFA, password, etc.).\n */\n Incomplete = 'INCOMPLETE',\n}\n\n/**\n * Type enumeration for Asgardeo embedded sign-in flow responses.\n *\n * Determines the nature of the flow response and how the client should\n * handle the returned data. This affects both UI rendering and flow\n * continuation logic.\n *\n * @experimental Part of the new Asgardeo API\n */\nexport enum EmbeddedSignInFlowType {\n /**\n * Response requires external redirection.\n *\n * Used for social login providers, external identity providers,\n * or other flows that require navigating to an external URL.\n * The response will contain redirection information.\n */\n Redirection = 'REDIRECTION',\n\n /**\n * Response contains view components for rendering.\n *\n * Standard embedded flow response containing UI components\n * that should be rendered within the current application\n * context. Most common type for embedded authentication.\n */\n View = 'VIEW',\n}\n\n/**\n * Extended response structure for Asgardeo embedded sign-in flow.\n *\n * This interface defines additional properties that are added at the SDK level\n * to enhance the basic API response with client-side computed values. These\n * properties provide convenience for common post-authentication operations.\n *\n * @remarks This response structure is enhanced by the SDK and contains\n * properties beyond the raw API response. It's designed to simplify\n * post-authentication handling for client applications.\n *\n * @experimental This interface is part of the new Asgardeo platform\n */\nexport interface ExtendedEmbeddedSignInFlowResponse {\n /**\n * Computed redirect URL for post-authentication navigation.\n *\n * This URL is determined by the SDK based on the flow completion result\n * and configured redirect settings. When present, the client application\n * should navigate to this URL to complete the authentication process.\n *\n * @example \"https://myapp.com/dashboard?session=abc123\"\n */\n redirectUrl?: string;\n}\n\n/**\n * Primary response structure for Asgardeo embedded sign-in flow operations.\n *\n * This is the main response interface returned by the sign-in API, combining\n * the enhanced SDK properties with the core API response data. It provides all\n * information needed to handle the current state of the authentication flow.\n *\n * The response structure adapts based on the flow status:\n * - INCOMPLETE: Contains components for user interaction\n * - COMPLETE: Contains completion data and potential redirection info\n * - ERROR: Contains error information for troubleshooting\n *\n * @example\n * ```typescript\n * const response: EmbeddedSignInFlowResponse = {\n * executionId: \"flow_12345\",\n * flowStatus: EmbeddedSignInFlowStatus.Incomplete,\n * type: EmbeddedSignInFlowType.View,\n * data: {\n * meta: {\n * components: [\n * {\n * id: \"username_field\",\n * type: EmbeddedFlowComponentType.TextInput,\n * label: \"Username\",\n * required: true\n * }\n * ]\n * }\n * }\n * };\n * ```\n *\n * @experimental This interface is part of the new Asgardeo platform\n */\nexport interface EmbeddedSignInFlowResponse extends ExtendedEmbeddedSignInFlowResponse {\n /**\n * Per-step challenge token for replay protection.\n * Must be included in the next request to continue this flow.\n */\n challengeToken?: string;\n\n /**\n * Core response data containing UI components and flow metadata.\n * Includes both modern meta.components structure and legacy fields for compatibility.\n */\n data: EmbeddedFlowResponseDataV2 & {\n /**\n * Legacy action definitions for backward compatibility.\n * @deprecated Use data.meta.components for new implementations\n */\n actions?: {\n /** Unique action identifier */\n id: string;\n /** Action type identifier */\n type: EmbeddedFlowResponseTypeV1;\n }[];\n\n /**\n * Legacy input field definitions for backward compatibility.\n * @deprecated Use data.meta.components for new implementations\n */\n inputs?: {\n /** Field name identifier */\n name: string;\n /** Whether the field is required */\n required: boolean;\n /** Input field type */\n type: string;\n }[];\n };\n\n /**\n * Unique identifier for this specific flow instance.\n * Used to maintain state across multiple API calls during the authentication process.\n */\n executionId: string;\n\n /**\n * Optional reason for flow failure in case of an error.\n * Provides additional context when flowStatus is set to ERROR.\n */\n failureReason?: string;\n\n /**\n * Current status of the sign-in flow.\n * Determines the next action required by the client application.\n */\n flowStatus: EmbeddedSignInFlowStatus;\n\n /**\n * Type of response indicating how to handle the returned data.\n * Affects both UI rendering and navigation logic.\n */\n type: EmbeddedSignInFlowType;\n}\n\n/**\n * Response structure for completed Asgardeo embedded sign-in flows.\n *\n * This interface defines the response format when the embedded sign-in flow\n * reaches the COMPLETE status and requires OAuth2 flow completion. It contains\n * the redirect URI that should be used for the final authentication step.\n *\n * @example\n * ```typescript\n * const completeResponse: EmbeddedSignInFlowCompleteResponse = {\n * redirect_uri: \"https://myapp.com/callback?code=abc123&state=xyz789\"\n * };\n *\n * // Typically handled automatically by the SDK\n * window.location.href = completeResponse.redirect_uri;\n * ```\n *\n * @experimental This interface is part of the new Asgardeo platform\n */\nexport interface EmbeddedSignInFlowCompleteResponse {\n /**\n * OAuth2 redirect URI for completing the authentication flow.\n *\n * Contains the final redirect URL with authorization code, state,\n * and other OAuth2 parameters needed to complete the authentication\n * process. This URL should be navigated to automatically or manually\n * depending on the application's requirements.\n */\n redirect_uri: string;\n}\n\n/**\n * Request payload for initiating Asgardeo embedded sign-in flows.\n *\n * This type defines the minimum required information to start a new\n * embedded sign-in flow. The flow type determines the kind of authentication\n * process that will be initiated (e.g., standard login, MFA, etc.).\n *\n * @example\n * ```typescript\n * const initRequest: EmbeddedSignInFlowInitiateRequest = {\n * applicationId: \"app_12345\",\n * flowType: EmbeddedFlowType.Authentication\n * };\n *\n * const response = await executeEmbeddedSignInFlow({\n * baseUrl: \"https://api.asgardeo.io/t/myorg\",\n * payload: initRequest\n * });\n * ```\n *\n * @experimental This type is part of the new Asgardeo platform\n */\nexport type EmbeddedSignInFlowInitiateRequest = {\n /**\n * Unique identifier of the application initiating the sign-in flow.\n * Must be a valid application ID registered in the Asgardeo organization.\n */\n applicationId: string;\n\n /**\n * Type of embedded flow to initiate.\n * Determines the authentication process and available options.\n */\n flowType: EmbeddedFlowTypeV1;\n};\n\n/**\n * Request payload for executing steps in Asgardeo embedded sign-in flows.\n *\n * This interface defines the structure for subsequent requests after flow initiation.\n * It supports both continuing existing flows (with executionId) and submitting user\n * input data collected from the rendered components.\n *\n * @example\n * ```typescript\n * // Continue existing flow with user input\n * const stepRequest: EmbeddedSignInFlowRequest = {\n * executionId: \"flow_12345\",\n * action: \"action_001\",\n * inputs: {\n * username: \"user@example.com\",\n * password: \"securePassword123\"\n * }\n * };\n *\n * // Submit to continue the flow\n * const response = await executeEmbeddedSignInFlow({\n * baseUrl: \"https://api.asgardeo.io/t/myorg\",\n * payload: stepRequest\n * });\n * ```\n *\n * @experimental This interface is part of the new Asgardeo platform\n */\nexport interface EmbeddedSignInFlowRequest extends Partial<EmbeddedSignInFlowInitiateRequest> {\n /**\n * Identifier of the specific action being triggered.\n * Corresponds to action components in the UI (e.g., submit button, social login).\n */\n action?: string;\n\n /**\n * Per-step challenge token received from the previous flow response.\n * Required when continuing an existing flow to prevent replay attacks.\n */\n challengeToken?: string;\n\n /**\n * Identifier of the flow instance to continue.\n * Required when submitting data for an existing flow.\n */\n executionId?: string;\n\n /**\n * User input data collected from the form components.\n * Keys should match the component identifiers from the response.\n *\n * @example\n * ```typescript\n * {\n * \"username\": \"john.doe@example.com\",\n * \"password\": \"mySecurePassword\",\n * \"rememberMe\": true\n * }\n * ```\n */\n inputs?: Record<string, any>;\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../../errors/AsgardeoAPIError';\nimport {EmbeddedFlowExecuteRequestConfig as EmbeddedFlowExecuteRequestConfigV2} from '../../models/v2/embedded-flow-v2';\nimport {\n EmbeddedSignInFlowResponse as EmbeddedSignInFlowResponseV2,\n EmbeddedSignInFlowStatus as EmbeddedSignInFlowStatusV2,\n} from '../../models/v2/embedded-signin-flow-v2';\n\nconst executeEmbeddedSignInFlowV2 = async ({\n url,\n baseUrl,\n payload,\n authId,\n ...requestConfig\n}: EmbeddedFlowExecuteRequestConfigV2): Promise<EmbeddedSignInFlowResponseV2> => {\n if (!payload) {\n throw new AsgardeoAPIError(\n 'Authorization payload is required',\n 'executeEmbeddedSignInFlow-ValidationError-002',\n 'javascript',\n 400,\n 'If an authorization payload is not provided, the request cannot be constructed correctly.',\n );\n }\n\n const endpoint: string = url ?? `${baseUrl}/flow/execute`;\n\n // Strip any user-provided 'verbose' parameter as it should only be used internally\n const cleanPayload: typeof payload =\n typeof payload === 'object' && payload !== null\n ? Object.fromEntries(Object.entries(payload).filter(([key]: [string, unknown]) => key !== 'verbose'))\n : payload;\n\n // `verbose: true` is required to get the `meta` field in the response that includes component details.\n // Add verbose:true if:\n // 1. payload contains only applicationId and flowType\n // 2. payload contains only executionId\n const hasOnlyAppIdAndFlowType: boolean =\n typeof cleanPayload === 'object' &&\n cleanPayload !== null &&\n 'applicationId' in cleanPayload &&\n 'flowType' in cleanPayload &&\n Object.keys(cleanPayload).length === 2;\n const hasOnlyFlowId: boolean =\n typeof cleanPayload === 'object' &&\n cleanPayload !== null &&\n 'executionId' in cleanPayload &&\n Object.keys(cleanPayload).length === 1;\n\n const requestPayload: Record<string, unknown> =\n hasOnlyAppIdAndFlowType || hasOnlyFlowId ? {...cleanPayload, verbose: true} : cleanPayload;\n\n const response: Response = await fetch(endpoint, {\n ...requestConfig,\n body: JSON.stringify(requestPayload),\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: requestConfig.method || 'POST',\n });\n\n if (!response.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n errorText,\n 'executeEmbeddedSignInFlow-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n 'Authorization request failed',\n );\n }\n\n const flowResponse: EmbeddedSignInFlowResponseV2 = await response.json();\n\n // IMPORTANT: Only applicable for Asgardeo V2 platform.\n // Check if the flow is complete and has an assertion and authId is provided, then call OAuth2 auth callback.\n if (flowResponse.flowStatus === EmbeddedSignInFlowStatusV2.Complete && (flowResponse as any).assertion && authId) {\n try {\n const oauth2Response: Response = await fetch(`${baseUrl}/oauth2/auth/callback`, {\n body: JSON.stringify({\n assertion: (flowResponse as any).assertion,\n authId,\n }),\n credentials: 'include',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: 'POST',\n });\n\n if (!oauth2Response.ok) {\n const oauth2ErrorText: string = await oauth2Response.text();\n\n throw new AsgardeoAPIError(\n `OAuth2 authorization failed: ${oauth2ErrorText}`,\n 'executeEmbeddedSignInFlow-OAuth2Error-002',\n 'javascript',\n oauth2Response.status,\n oauth2Response.statusText,\n );\n }\n\n const oauth2Result: Record<string, unknown> = await oauth2Response.json();\n\n return {\n flowStatus: flowResponse.flowStatus,\n redirectUrl: oauth2Result['redirect_uri'],\n } as any;\n } catch (authError) {\n throw new AsgardeoAPIError(\n `OAuth2 authorization failed: ${authError instanceof Error ? authError.message : 'Unknown error'}`,\n 'executeEmbeddedSignInFlow-OAuth2Error-001',\n 'javascript',\n 500,\n 'Failed to complete OAuth2 authorization after successful embedded sign-in flow.',\n );\n }\n }\n\n return flowResponse;\n};\n\nexport default executeEmbeddedSignInFlowV2;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n EmbeddedFlowResponseType as EmbeddedFlowResponseTypeV1,\n EmbeddedFlowType as EmbeddedFlowTypeV1,\n} from '../embedded-flow';\n\n/**\n * Status enumeration for Asgardeo embedded sign-up flow operations.\n *\n * These statuses indicate the current state of the registration flow and determine\n * the next action required by the client application. Each status provides specific\n * guidance on how to proceed with the user registration process.\n *\n * @example\n * ```typescript\n * switch (response.flowStatus) {\n * case EmbeddedSignUpFlowStatus.Incomplete:\n * // More user input needed - render registration form components\n * break;\n * case EmbeddedSignUpFlowStatus.Complete:\n * // Registration successful - handle completion\n * break;\n * case EmbeddedSignUpFlowStatus.Error:\n * // Registration failed - show detailed error message\n * const errorResponse = response as EmbeddedSignUpFlowErrorResponse;\n * showError(errorResponse.failureReason);\n * break;\n * }\n * ```\n *\n * @experimental Part of the new Asgardeo API\n */\nexport enum EmbeddedSignUpFlowStatus {\n /**\n * Sign-up flow completed successfully.\n *\n * The user has successfully registered and the flow can proceed to\n * OAuth2 completion or redirection. Check for redirectUrl or assertion\n * data in the response for next steps.\n */\n Complete = 'COMPLETE',\n\n /**\n * Sign-up flow encountered an error and cannot proceed.\n *\n * Registration failed due to validation errors, duplicate user,\n * system errors, or other issues. The response will be of type\n * `EmbeddedSignUpFlowErrorResponse` containing detailed failure\n * information that can be displayed to the user.\n *\n * @see {@link EmbeddedSignUpFlowErrorResponse} for error response structure\n */\n Error = 'ERROR',\n\n /**\n * Sign-up flow requires additional user input.\n *\n * More registration steps are needed. The response will contain\n * components in data.meta.components that should be rendered to\n * collect additional user information (e.g., profile data, verification).\n */\n Incomplete = 'INCOMPLETE',\n}\n\n/**\n * Type enumeration for Asgardeo embedded sign-up flow responses.\n *\n * Determines the nature of the registration flow response and how the client\n * should handle the returned data. This affects both UI rendering and flow\n * continuation logic during the user registration process.\n *\n * @experimental Part of the new Asgardeo API\n */\nexport enum EmbeddedSignUpFlowType {\n /**\n * Response requires external redirection.\n *\n * Used for social registration providers, external identity providers,\n * or other flows that require navigating to an external URL during\n * the registration process. The response will contain redirection information.\n */\n Redirection = 'REDIRECTION',\n\n /**\n * Response contains view components for rendering.\n *\n * Standard embedded registration flow response containing UI components\n * that should be rendered within the current application context.\n * Most common type for embedded user registration.\n */\n View = 'VIEW',\n}\n\n/**\n * Extended response structure for the embedded sign-up flow.\n * @remarks This response is only done from the SDK level.\n * @experimental\n */\nexport interface ExtendedEmbeddedSignUpFlowResponse {\n /**\n * The URL to redirect the user after completing the sign-up flow.\n */\n redirectUrl?: string;\n}\n\n/**\n * Response structure for the new Asgardeo embedded sign-up flow.\n *\n * This interface defines the structure for successful sign-up flow responses\n * from Asgardeo APIs. For error responses, see `EmbeddedSignUpFlowErrorResponse`.\n *\n * **Flow States:**\n * - `INCOMPLETE`: More user input required, `data` contains form components\n * - `COMPLETE`: Sign-up finished, may contain redirect information\n * - For `ERROR` status, a separate `EmbeddedSignUpFlowErrorResponse` structure is used\n *\n * **Component-Driven UI:**\n * The `data.inputs` and `data.actions` are transformed by the React transformer\n * into component-driven format for consistent UI rendering across different\n * Asgardeo versions.\n *\n * @experimental Part of the new Asgardeo API\n * @see {@link EmbeddedSignUpFlowErrorResponse} for error response structure\n * @see {@link EmbeddedSignUpFlowStatus} for available flow statuses\n */\nexport interface EmbeddedSignUpFlowResponse extends ExtendedEmbeddedSignUpFlowResponse {\n /**\n * Per-step challenge token for replay protection.\n * Must be included in the next request to continue this flow.\n */\n challengeToken?: string;\n\n /**\n * Flow data containing form inputs and available actions.\n * This is transformed to component-driven format by the React transformer.\n */\n data: {\n /**\n * Available actions the user can take (e.g., form submission, social sign-up).\n */\n actions?: {\n id: string;\n type: EmbeddedFlowResponseTypeV1;\n }[];\n\n /**\n * Input fields required for the current step of the sign-up flow.\n */\n inputs?: {\n name: string;\n required: boolean;\n type: string;\n }[];\n };\n\n /**\n * Unique identifier for this sign-up flow instance.\n */\n executionId: string;\n\n /**\n * Optional reason for flow failure in case of an error.\n * Provides additional context when flowStatus is set to ERROR.\n */\n failureReason?: string;\n\n /**\n * Current status of the sign-up flow.\n * Determines whether more input is needed or the flow is complete.\n */\n flowStatus: EmbeddedSignUpFlowStatus;\n\n /**\n * Type of response, indicating the expected user interaction.\n */\n type: EmbeddedSignUpFlowType;\n}\n\n/**\n * Response structure for the new Asgardeo embedded sign-up flow when the flow is complete.\n * @experimental\n */\nexport interface EmbeddedSignUpFlowCompleteResponse {\n redirect_uri: string;\n}\n\n/**\n * Request payload for initiating the new Asgardeo embedded sign-up flow.\n * @experimental\n */\nexport type EmbeddedSignUpFlowInitiateRequest = {\n applicationId: string;\n flowType: EmbeddedFlowTypeV1;\n};\n\n/**\n * Request payload for executing steps in the new Asgardeo embedded sign-up flow.\n * @experimental\n */\nexport interface EmbeddedSignUpFlowRequest extends Partial<EmbeddedSignUpFlowInitiateRequest> {\n action?: string;\n challengeToken?: string;\n executionId?: string;\n inputs?: Record<string, any>;\n}\n\n/**\n * Error response structure for the new Asgardeo embedded sign-up flow.\n *\n * This interface defines the structure of error responses returned by Asgardeo APIs\n * when sign-up operations fail. Unlike AsgardeoV1 which uses generic error codes and\n * descriptions, Asgardeo provides more specific failure reasons within the flow context.\n *\n * **Key Differences from AsgardeoV1:**\n * - Uses `failureReason` instead of `message`/`description` for error details\n * - Maintains flow context with `executionId` for tracking failed operations\n * - Uses structured `flowStatus` enum instead of generic error codes\n * - Provides empty `data` object for consistency with success responses\n *\n * **Error Handling:**\n * This error response format is automatically detected and processed by the\n * `extractErrorMessage()` and `checkForErrorResponse()` functions in the transformer\n * to extract meaningful error messages for display to users.\n *\n * @example\n * ```typescript\n * // Typical Asgardeo error response\n * const errorResponse: EmbeddedSignUpFlowErrorResponse = {\n * executionId: \"0ccfeaf9-18b3-43a5-bcc1-07d863dcb2c0\",\n * flowStatus: EmbeddedSignUpFlowStatus.Error,\n * data: {},\n * failureReason: \"User already exists with the provided username.\"\n * };\n *\n * // This will be automatically transformed to a user-friendly error message:\n * // \"User already exists with the provided username.\"\n * ```\n *\n * @experimental This is part of the new Asgardeo API and may change in future versions\n * @see {@link EmbeddedSignUpFlowStatus.Error} for the error status enum value\n * @see {@link EmbeddedSignUpFlowResponse} for the corresponding success response structure\n */\nexport interface EmbeddedSignUpFlowErrorResponse {\n /**\n * Additional response data, typically empty for error responses.\n * Maintained for structural consistency with successful flow responses\n * which contain components, actions, and other flow data.\n */\n data: Record<string, any>;\n\n /**\n * Human-readable explanation of why the sign-up operation failed.\n *\n * This field contains specific error details that can be directly displayed\n * to users, such as:\n * - \"User already exists with the provided username.\"\n * - \"Invalid email address format.\"\n * - \"Password does not meet complexity requirements.\"\n *\n * Unlike generic error codes, this provides contextual information\n * that helps users understand and resolve the issue.\n */\n /**\n * Unique identifier for the sign-up flow instance.\n * This ID is used to track the flow state and correlate error responses\n * with the specific sign-up attempt that failed.\n */\n executionId: string;\n\n failureReason: string;\n\n /**\n * Status of the sign-up flow, which will be `EmbeddedSignUpFlowStatus.Error`\n * for error responses. This field is used by error detection logic to\n * identify failed flow responses.\n */\n flowStatus: EmbeddedSignUpFlowStatus;\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../../errors/AsgardeoAPIError';\nimport {EmbeddedFlowExecuteRequestConfig as EmbeddedFlowExecuteRequestConfigV2} from '../../models/v2/embedded-flow-v2';\nimport {\n EmbeddedSignUpFlowResponse as EmbeddedSignUpFlowResponseV2,\n EmbeddedSignUpFlowStatus as EmbeddedSignUpFlowStatusV2,\n} from '../../models/v2/embedded-signup-flow-v2';\n\nconst executeEmbeddedSignUpFlowV2 = async ({\n url,\n baseUrl,\n payload,\n authId,\n ...requestConfig\n}: EmbeddedFlowExecuteRequestConfigV2): Promise<EmbeddedSignUpFlowResponseV2> => {\n if (!payload) {\n throw new AsgardeoAPIError(\n 'Registration payload is required',\n 'executeEmbeddedSignUpFlow-ValidationError-002',\n 'javascript',\n 400,\n 'If a registration payload is not provided, the request cannot be constructed correctly.',\n );\n }\n\n const endpoint: string = url ?? `${baseUrl}/flow/execute`;\n\n // Strip any user-provided 'verbose' parameter as it should only be used internally\n const cleanPayload: typeof payload =\n typeof payload === 'object' && payload !== null\n ? Object.fromEntries(Object.entries(payload).filter(([key]: [string, unknown]) => key !== 'verbose'))\n : payload;\n\n // `verbose: true` is required to get the `meta` field in the response that includes component details.\n // Add verbose:true if:\n // 1. payload contains only applicationId and flowType\n // 2. payload contains only executionId\n const hasOnlyAppIdAndFlowType: boolean =\n typeof cleanPayload === 'object' &&\n cleanPayload !== null &&\n 'applicationId' in cleanPayload &&\n 'flowType' in cleanPayload &&\n Object.keys(cleanPayload).length === 2;\n const hasOnlyFlowId: boolean =\n typeof cleanPayload === 'object' &&\n cleanPayload !== null &&\n 'executionId' in cleanPayload &&\n Object.keys(cleanPayload).length === 1;\n\n const requestPayload: Record<string, unknown> =\n hasOnlyAppIdAndFlowType || hasOnlyFlowId ? {...cleanPayload, verbose: true} : cleanPayload;\n\n const response: Response = await fetch(endpoint, {\n ...requestConfig,\n body: JSON.stringify(requestPayload),\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: requestConfig.method || 'POST',\n });\n\n if (!response.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n errorText,\n 'executeEmbeddedSignUpFlow-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n 'Registration request failed',\n );\n }\n\n const flowResponse: EmbeddedSignUpFlowResponseV2 = await response.json();\n\n // IMPORTANT: Only applicable for Asgardeo V2 platform.\n // Check if the flow is complete and has an assertion and authId is provided, then call OAuth2 auth callback.\n if (flowResponse.flowStatus === EmbeddedSignUpFlowStatusV2.Complete && (flowResponse as any).assertion && authId) {\n try {\n const oauth2Response: Response = await fetch(`${baseUrl}/oauth2/auth/callback`, {\n body: JSON.stringify({\n assertion: (flowResponse as any).assertion,\n authId,\n }),\n credentials: 'include',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: 'POST',\n });\n\n if (!oauth2Response.ok) {\n const oauth2ErrorText: string = await oauth2Response.text();\n\n throw new AsgardeoAPIError(\n `OAuth2 authorization failed: ${oauth2ErrorText}`,\n 'executeEmbeddedSignUpFlow-OAuth2Error-002',\n 'javascript',\n oauth2Response.status,\n oauth2Response.statusText,\n );\n }\n\n const oauth2Result: Record<string, unknown> = await oauth2Response.json();\n\n return {\n flowStatus: flowResponse.flowStatus,\n redirectUrl: oauth2Result['redirect_uri'],\n } as any;\n } catch (authError) {\n throw new AsgardeoAPIError(\n `OAuth2 authorization failed: ${authError instanceof Error ? authError.message : 'Unknown error'}`,\n 'executeEmbeddedSignUpFlow-OAuth2Error-001',\n 'javascript',\n 500,\n 'Failed to complete OAuth2 authorization after successful embedded sign-up flow.',\n );\n }\n }\n\n return flowResponse;\n};\n\nexport default executeEmbeddedSignUpFlowV2;\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../../errors/AsgardeoAPIError';\nimport {EmbeddedFlowExecuteRequestConfig as EmbeddedFlowExecuteRequestConfigV2} from '../../models/v2/embedded-flow-v2';\nimport {EmbeddedRecoveryFlowResponse} from '../../models/v2/embedded-recovery-flow-v2';\n\n/**\n * Executes an embedded recovery flow by sending a request to the flow execution endpoint.\n *\n * This function handles password-recovery and account-recovery flows driven by the\n * Asgardeo server. The server returns UI components for each step (e.g. username\n * collection, OTP verification, password reset) and this function forwards the\n * user's responses back to the server.\n *\n * @param requestConfig - Request configuration containing URL, payload, and optional headers.\n * @returns A promise that resolves with the flow execution response.\n * @throws AsgardeoAPIError when the request fails or a payload is missing.\n *\n * @example\n * ```typescript\n * // Initiate recovery flow\n * const response = await executeEmbeddedRecoveryFlowV2({\n * baseUrl: 'https://api.asgardeo.io/t/myorg',\n * payload: {\n * flowType: 'RECOVERY',\n * applicationId: 'my-app-id',\n * },\n * });\n *\n * // Continue recovery flow with user input\n * const nextResponse = await executeEmbeddedRecoveryFlowV2({\n * baseUrl: 'https://api.asgardeo.io/t/myorg',\n * payload: {\n * executionId: response.executionId,\n * action: 'submit',\n * inputs: { username: 'user@example.com' },\n * challengeToken: response.challengeToken,\n * },\n * });\n * ```\n */\nconst executeEmbeddedRecoveryFlowV2 = async ({\n url,\n baseUrl,\n payload,\n ...requestConfig\n}: EmbeddedFlowExecuteRequestConfigV2): Promise<EmbeddedRecoveryFlowResponse> => {\n if (!payload) {\n throw new AsgardeoAPIError(\n 'Recovery payload is required',\n 'executeEmbeddedRecoveryFlow-ValidationError-002',\n 'javascript',\n 400,\n 'If a recovery payload is not provided, the request cannot be constructed correctly.',\n );\n }\n\n const endpoint: string = url ?? `${baseUrl}/flow/execute`;\n\n // Strip any user-provided 'verbose' parameter as it should only be used internally\n const cleanPayload: typeof payload =\n typeof payload === 'object' && payload !== null\n ? Object.fromEntries(Object.entries(payload).filter(([key]: [string, unknown]) => key !== 'verbose'))\n : payload;\n\n // `verbose: true` is required to get the `meta` field in the response that includes component details.\n // Add verbose:true if:\n // 1. payload contains only applicationId and flowType (initial request)\n // 2. payload contains only executionId (flow continuation without inputs)\n const hasOnlyAppIdAndFlowType: boolean =\n typeof cleanPayload === 'object' &&\n cleanPayload !== null &&\n 'applicationId' in cleanPayload &&\n 'flowType' in cleanPayload &&\n Object.keys(cleanPayload).length === 2;\n const hasOnlyFlowId: boolean =\n typeof cleanPayload === 'object' &&\n cleanPayload !== null &&\n 'executionId' in cleanPayload &&\n Object.keys(cleanPayload).length === 1;\n\n const requestPayload: Record<string, unknown> =\n hasOnlyAppIdAndFlowType || hasOnlyFlowId\n ? {\n ...cleanPayload,\n verbose: true,\n }\n : cleanPayload;\n\n const response: Response = await fetch(endpoint, {\n ...requestConfig,\n body: JSON.stringify(requestPayload),\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: requestConfig.method || 'POST',\n });\n\n if (!response.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n `Recovery request failed: ${errorText}`,\n 'executeEmbeddedRecoveryFlow-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n );\n }\n\n const flowResponse: EmbeddedRecoveryFlowResponse = await response.json();\n\n return flowResponse;\n};\n\nexport default executeEmbeddedRecoveryFlowV2;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../../errors/AsgardeoAPIError';\nimport {EmbeddedFlowType} from '../../models/embedded-flow';\nimport {EmbeddedFlowExecuteRequestConfig as EmbeddedFlowExecuteRequestConfigV2} from '../../models/v2/embedded-flow-v2';\n\n/**\n * Response from the user onboarding flow execution.\n */\nexport interface EmbeddedUserOnboardingFlowResponse {\n /**\n * Data for the current step including components and additional data.\n */\n data?: {\n /**\n * Additional data from the flow step (e.g., inviteLink).\n */\n additionalData?: Record<string, string>;\n\n /**\n * UI components to render for the current step.\n */\n components?: any[];\n };\n\n /**\n * Unique identifier for the flow execution.\n */\n executionId: string;\n\n /**\n * Reason for failure if flowStatus is ERROR.\n */\n failureReason?: string;\n\n /**\n * Current status of the flow.\n */\n flowStatus: 'INCOMPLETE' | 'COMPLETE' | 'ERROR';\n\n /**\n * Type of the current step in the flow.\n */\n type?: 'VIEW' | 'REDIRECTION';\n}\n\n/**\n * Executes an embedded user onboarding flow by sending a request to the flow execution endpoint.\n *\n * This function handles both:\n * - Admin flow: Initiates onboarding, collects user details, generates invite link\n * - End-user flow: Validates invite token and allows password setting\n *\n * @param requestConfig - Request configuration object containing URL, payload, and optional auth token.\n * @returns A promise that resolves with the flow execution response.\n * @throws AsgardeoAPIError when the request fails or URL is invalid.\n *\n * @example\n * ```typescript\n * // Admin initiating user onboarding (requires auth token)\n * const response = await executeEmbeddedUserOnboardingFlowV2({\n * baseUrl: \"https://api.thunder.io\",\n * payload: {\n * flowType: \"USER_ONBOARDING\"\n * },\n * headers: {\n * Authorization: `Bearer ${accessToken}`\n * }\n * });\n *\n * // End-user accepting invite (no auth required)\n * const response = await executeEmbeddedUserOnboardingFlowV2({\n * baseUrl: \"https://api.thunder.io\",\n * payload: {\n * executionId: \"flow-id-from-url\",\n * inputs: { inviteToken: \"token-from-url\" }\n * }\n * });\n * ```\n */\nconst executeEmbeddedUserOnboardingFlowV2 = async ({\n url,\n baseUrl,\n payload,\n ...requestConfig\n}: EmbeddedFlowExecuteRequestConfigV2): Promise<EmbeddedUserOnboardingFlowResponse> => {\n if (!payload) {\n throw new AsgardeoAPIError(\n 'User onboarding payload is required',\n 'executeEmbeddedUserOnboardingFlow-ValidationError-002',\n 'javascript',\n 400,\n 'If a user onboarding payload is not provided, the request cannot be constructed correctly.',\n );\n }\n\n const endpoint: string = url ?? `${baseUrl}/flow/execute`;\n\n // Strip any user-provided 'verbose' parameter as it should only be used internally\n const cleanPayload: typeof payload =\n typeof payload === 'object' && payload !== null\n ? Object.fromEntries(Object.entries(payload).filter(([key]: [string, unknown]) => key !== 'verbose'))\n : payload;\n\n // `verbose: true` is required to get the `meta` field in the response that includes component details.\n // Add verbose:true for initial requests or flow continuation without inputs\n const hasOnlyFlowType: boolean =\n typeof cleanPayload === 'object' &&\n cleanPayload !== null &&\n 'flowType' in cleanPayload &&\n Object.keys(cleanPayload).length === 1;\n const hasOnlyFlowId: boolean =\n typeof cleanPayload === 'object' &&\n cleanPayload !== null &&\n 'executionId' in cleanPayload &&\n Object.keys(cleanPayload).length === 1;\n const hasFlowIdWithInputs: boolean =\n typeof cleanPayload === 'object' &&\n cleanPayload !== null &&\n 'executionId' in cleanPayload &&\n 'inputs' in cleanPayload;\n\n // Add verbose for initial requests and when continuing with inputs\n const requestPayload: Record<string, unknown> =\n hasOnlyFlowType || hasOnlyFlowId || hasFlowIdWithInputs ? {...cleanPayload, verbose: true} : cleanPayload;\n\n // Ensure flowType is USER_ONBOARDING for initial requests\n if ('flowType' in requestPayload && requestPayload['flowType'] !== EmbeddedFlowType.UserOnboarding) {\n requestPayload['flowType'] = EmbeddedFlowType.UserOnboarding;\n }\n\n const response: Response = await fetch(endpoint, {\n ...requestConfig,\n body: JSON.stringify(requestPayload),\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...requestConfig.headers,\n },\n method: requestConfig.method || 'POST',\n });\n\n if (!response.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n errorText,\n 'executeEmbeddedUserOnboardingFlow-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n 'User onboarding request failed',\n );\n }\n\n const flowResponse: EmbeddedUserOnboardingFlowResponse = await response.json();\n\n return flowResponse;\n};\n\nexport default executeEmbeddedUserOnboardingFlowV2;\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../../errors/AsgardeoAPIError';\nimport {FlowMetadataResponse, GetFlowMetaRequestConfig} from '../../models/v2/flow-meta-v2';\n\n/**\n * Fetches aggregated flow metadata from the `GET /flow/meta` endpoint.\n *\n * The response includes:\n * - Application or OU details depending on the `type` parameter\n * - Resolved design configuration (theme and layout)\n * - i18n translations filtered by `language` and `namespace`\n * - Registration flow enablement status\n *\n * @param config - Request configuration including `baseUrl`/`url`, and optional\n * `type`, `id`, `language`, and `namespace` filters. When `type`\n * and `id` are omitted the server returns i18n-only metadata.\n * @returns A promise that resolves to the {@link FlowMetadataResponse}.\n *\n * @throws {AsgardeoAPIError} When the server returns a non-OK response.\n *\n * @example\n * ```typescript\n * import getFlowMetaV2 from './api/v2/getFlowMetaV2';\n * import { FlowMetaType } from './models/v2/flow-meta-v2';\n *\n * const meta = await getFlowMetaV2({\n * baseUrl: 'https://localhost:8090',\n * type: FlowMetaType.App,\n * id: '60a9b38b-6eba-9f9e-55f9-267067de4680',\n * language: 'en',\n * namespace: 'auth',\n * });\n *\n * console.log(meta.application?.name);\n * console.log(meta.i18n.translations);\n * ```\n *\n * @experimental This function targets the Asgardeo V2 platform API\n */\nconst getFlowMetaV2 = async ({\n url,\n baseUrl,\n type,\n id,\n language,\n namespace,\n ...requestConfig\n}: GetFlowMetaRequestConfig): Promise<FlowMetadataResponse> => {\n const queryParams: URLSearchParams = new URLSearchParams({\n ...(id ? {id} : {}),\n ...(type ? {type} : {}),\n ...(language ? {language} : {}),\n ...(namespace ? {namespace} : {}),\n });\n\n const baseEndpoint: string = url ?? `${baseUrl}/flow/meta`;\n const endpoint: string = `${baseEndpoint}?${queryParams.toString()}`;\n\n const response: Response = await fetch(endpoint, {\n ...requestConfig,\n headers: {\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n method: 'GET',\n });\n\n if (!response.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n errorText,\n 'getFlowMetaV2-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n 'Flow metadata request failed',\n );\n }\n\n const flowMetadata: FlowMetadataResponse = await response.json();\n\n return flowMetadata;\n};\n\nexport default getFlowMetaV2;\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoAPIError from '../../errors/AsgardeoAPIError';\nimport {GetOrganizationUnitChildrenConfig, OrganizationUnitListResponse} from '../../models/v2/organization-unit';\n\n/**\n * Retrieves the child organization units of a given parent OU.\n *\n * @param config - Request configuration including `baseUrl`/`url`, `organizationUnitId`,\n * and optional `limit`/`offset` pagination parameters.\n * @returns A promise that resolves with the paginated list of child organization units.\n *\n * @throws {AsgardeoAPIError} When the server returns a non-OK response.\n *\n * @example\n * ```typescript\n * const children = await getOrganizationUnitChildren({\n * baseUrl: 'https://localhost:8090',\n * organizationUnitId: '0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1',\n * limit: 10,\n * offset: 0,\n * });\n * console.log(children.organizationUnits);\n * ```\n *\n * @experimental This function targets the Asgardeo V2 platform API\n */\nconst getOrganizationUnitChildren = async ({\n url,\n baseUrl,\n organizationUnitId,\n limit = 10,\n offset = 0,\n ...requestConfig\n}: GetOrganizationUnitChildrenConfig): Promise<OrganizationUnitListResponse> => {\n if (!organizationUnitId) {\n throw new AsgardeoAPIError(\n 'Organization Unit ID is required',\n 'getOrganizationUnitChildren-ValidationError-001',\n 'javascript',\n 400,\n 'If an organization unit ID is not provided, the request cannot be constructed correctly.',\n );\n }\n\n const queryParams: URLSearchParams = new URLSearchParams({\n limit: String(limit),\n offset: String(offset),\n });\n\n const endpoint: string = url ?? `${baseUrl}/organization-units/${organizationUnitId}/ous?${queryParams.toString()}`;\n\n const response: Response = await fetch(endpoint, {\n ...requestConfig,\n headers: {\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n method: 'GET',\n });\n\n if (!response.ok) {\n const errorText: string = await response.text();\n\n throw new AsgardeoAPIError(\n errorText,\n 'getOrganizationUnitChildren-ResponseError-001',\n 'javascript',\n response.status,\n response.statusText,\n 'Failed to fetch organization unit children',\n );\n }\n\n const listResponse: OrganizationUnitListResponse = await response.json();\n\n return listResponse;\n};\n\nexport default getOrganizationUnitChildren;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Constants representing Application Native Authentication related configurations and constants.\n */\nconst ApplicationNativeAuthenticationConstants: {\n readonly SupportedAuthenticators: {\n readonly EmailOtp: string;\n readonly Facebook: string;\n readonly GitHub: string;\n readonly Google: string;\n readonly IdentifierFirst: string;\n readonly LinkedIn: string;\n readonly MagicLink: string;\n readonly Microsoft: string;\n readonly Passkey: string;\n readonly PushNotification: string;\n readonly SignInWithEthereum: string;\n readonly SmsOtp: string;\n readonly Totp: string;\n readonly UsernamePassword: string;\n };\n} = {\n SupportedAuthenticators: {\n EmailOtp: 'ZW1haWwtb3RwLWF1dGhlbnRpY2F0b3I6TE9DQUw',\n Facebook: 'RmFjZWJvb2tBdXRoZW50aWNhdG9yOkZhY2Vib29r',\n GitHub: 'R2l0aHViQXV0aGVudGljYXRvcjpHaXRIdWI',\n Google: 'R29vZ2xlT0lEQ0F1dGhlbnRpY2F0b3I6R29vZ2xl',\n IdentifierFirst: 'SWRlbnRpZmllckV4ZWN1dG9yOkxPQ0FM',\n LinkedIn: 'TGlua2VkSW5PSURDOkxpbmtlZElu',\n MagicLink: 'TWFnaWNMaW5rQXV0aGVudGljYXRvcjpMT0NBTA',\n Microsoft: 'T3BlbklEQ29ubmVjdEF1dGhlbnRpY2F0b3I6TWljcm9zb2Z0',\n Passkey: 'RklET0F1dGhlbnRpY2F0b3I6TE9DQUw',\n PushNotification: 'cHVzaC1ub3RpZmljYXRpb24tYXV0aGVudGljYXRvcjpMT0NBTA',\n SignInWithEthereum: 'T3BlbklEQ29ubmVjdEF1dGhlbnRpY2F0b3I6U2lnbiBJbiBXaXRoIEV0aGVyZXVt',\n SmsOtp: 'c21zLW90cC1hdXRoZW50aWNhdG9yOkxPQ0FM',\n Totp: 'dG90cDpMT0NBTA',\n UsernamePassword: 'QmFzaWNBdXRoZW50aWNhdG9yOkxPQ0FM',\n },\n} as const;\n\nexport default ApplicationNativeAuthenticationConstants;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Constants for vendor-specific configurations.\n * By default, the vendor is inferred as Asgardeo.\n *\n * @example\n * ```typescript\n * // Using the vendor prefix in a URL\n * const apiUrl = `${VendorConstants.VENDOR_PREFIX}/api/v1/resource`;\n * ```\n */\nconst VendorConstants: {\n VENDOR_PREFIX: string;\n} = {\n /**\n * The prefix used for vendor-specific API endpoints, CSS classes, or other identifiers.\n */\n VENDOR_PREFIX: 'asgardeo',\n} as const;\n\nexport default VendorConstants;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport interface EmbeddedSignInFlowInitiateResponse {\n flowId: string;\n flowStatus: EmbeddedSignInFlowStatus;\n flowType: EmbeddedSignInFlowType;\n links: EmbeddedSignInFlowLink[];\n nextStep: {\n authenticators: EmbeddedSignInFlowAuthenticator[];\n stepType: EmbeddedSignInFlowStepType;\n };\n}\n\nexport enum EmbeddedSignInFlowStatus {\n FailCompleted = 'FAIL_COMPLETED',\n FailIncomplete = 'FAIL_INCOMPLETE',\n Incomplete = 'INCOMPLETE',\n SuccessCompleted = 'SUCCESS_COMPLETED',\n}\n\nexport enum EmbeddedSignInFlowType {\n Authentication = 'AUTHENTICATION',\n}\n\nexport enum EmbeddedSignInFlowStepType {\n AuthenticatorPrompt = 'AUTHENTICATOR_PROMPT',\n MultiOptionsPrompt = 'MULTI_OPTIONS_PROMPT',\n}\n\nexport interface EmbeddedSignInFlowAuthenticator {\n authenticator: string;\n authenticatorId: string;\n idp: string;\n metadata: {\n i18nKey: string;\n params: {\n confidential: boolean;\n displayName: string;\n i18nKey: string;\n order: number;\n param: string;\n type: EmbeddedSignInFlowAuthenticatorParamType;\n }[];\n promptType: EmbeddedSignInFlowAuthenticatorPromptType;\n };\n requiredParams: string[];\n}\n\nexport interface EmbeddedSignInFlowLink {\n href: string;\n method: string;\n name: string;\n}\n\nexport interface EmbeddedSignInFlowHandleRequestPayload {\n flowId: string;\n selectedAuthenticator: {\n authenticatorId: string;\n params: Record<string, string>;\n };\n}\n\nexport interface EmbeddedSignInFlowHandleResponse {\n authData: Record<string, any>;\n flowStatus: string;\n}\n\nexport enum EmbeddedSignInFlowAuthenticatorParamType {\n Integer = 'INTEGER',\n MultiValued = 'MULTI_VALUED',\n String = 'STRING',\n}\n\nexport enum EmbeddedSignInFlowAuthenticatorExtendedParamType {\n Otp = 'OTPCode',\n}\n\nexport enum EmbeddedSignInFlowAuthenticatorKnownIdPType {\n Local = 'LOCAL',\n}\n\nexport enum EmbeddedSignInFlowAuthenticatorPromptType {\n /**\n * Prompt for internal system use, such as API keys or tokens.\n */\n InternalPrompt = 'INTERNAL_PROMPT',\n /**\n * Prompt for redirection to another page or service.\n */\n RedirectionPrompt = 'REDIRECTION_PROMPT',\n /**\n * Prompt for user input, typically for username/password or similar credentials.\n */\n UserPrompt = 'USER_PROMPT',\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {EmbeddedFlowExecuteRequestConfig as EmbeddedFlowExecuteRequestConfigV1} from '../embedded-flow';\n\n/**\n * Component types supported by the Asgardeo embedded flow API.\n *\n * These types define the different UI components that can be rendered\n * as part of the embedded authentication flows. Each type corresponds\n * to a specific UI element with its own behavior and properties.\n *\n * @example\n * ```typescript\n * // Check component type to render appropriate UI\n * if (component.type === EmbeddedFlowComponentType.TextInput) {\n * // Render text input field\n * } else if (component.type === EmbeddedFlowComponentType.Action) {\n * // Render button/action\n * }\n * ```\n *\n * @experimental This API may change in future versions\n */\nexport enum EmbeddedFlowComponentType {\n /** Interactive action component (buttons, links) for user interactions */\n Action = 'ACTION',\n\n /** Container block component that groups other components */\n Block = 'BLOCK',\n\n /** Consent component for displaying consent purposes and attributes */\n Consent = 'CONSENT',\n\n /** Copyable text display component that shows text with a copy-to-clipboard action */\n CopyableText = 'COPYABLE_TEXT',\n\n /** Divider component for visual separation of content */\n Divider = 'DIVIDER',\n\n /** Email input field with validation for email addresses. */\n EmailInput = 'EMAIL_INPUT',\n\n /** Icon display component for rendering named vector icons */\n Icon = 'ICON',\n\n /** Image display component for logos and illustrations */\n Image = 'IMAGE',\n\n /** One-time password input field for multi-factor authentication */\n OtpInput = 'OTP_INPUT',\n\n /** Organization unit tree picker for selecting an OU */\n OuSelect = 'OU_SELECT',\n\n /** Password input field with masking for sensitive data */\n PasswordInput = 'PASSWORD_INPUT',\n\n /** Phone number input field with country code support */\n PhoneInput = 'PHONE_INPUT',\n\n /** Rich text display component that renders formatted HTML content */\n RichText = 'RICH_TEXT',\n\n /** Select/dropdown input component for single choice selection */\n Select = 'SELECT',\n\n /** Stack layout component for arranging children in a row or column */\n Stack = 'STACK',\n\n /** Text display component for labels, headings, and messages */\n Text = 'TEXT',\n\n /** Standard text input field for user data entry */\n TextInput = 'TEXT_INPUT',\n\n /** Timer component for displaying a countdown */\n Timer = 'TIMER',\n}\n\n/**\n * Action variant types for buttons and interactive elements.\n *\n * @experimental This API may change in future versions\n */\nexport enum EmbeddedFlowActionVariant {\n /** Danger action button for destructive operations */\n Danger = 'DANGER',\n\n /** Info action button for informational purposes */\n Info = 'INFO',\n\n /** Link-styled action button */\n Link = 'LINK',\n\n /** Outlined action button for secondary emphasis */\n Outlined = 'OUTLINED',\n\n /** Primary action button with highest visual emphasis */\n Primary = 'PRIMARY',\n\n /** Secondary action button with moderate visual emphasis */\n Secondary = 'SECONDARY',\n\n /** Success action button for positive confirmations */\n Success = 'SUCCESS',\n\n /** Tertiary action button with minimal visual emphasis */\n Tertiary = 'TERTIARY',\n\n /** Warning action button for cautionary actions */\n Warning = 'WARNING',\n}\n\n/**\n * Text variant types for typography components.\n *\n * @experimental This API may change in future versions\n */\nexport enum EmbeddedFlowTextVariant {\n /** Primary body text for main content */\n Body1 = 'BODY_1',\n\n /** Secondary body text for supplementary content */\n Body2 = 'BODY_2',\n\n /** Text styled for button labels */\n ButtonText = 'BUTTON_TEXT',\n\n /** Small caption text for annotations and descriptions */\n Caption = 'CAPTION',\n\n /** Largest heading level for main titles */\n Heading1 = 'HEADING_1',\n\n /** Second level heading for major sections */\n Heading2 = 'HEADING_2',\n\n /** Third level heading for subsections */\n Heading3 = 'HEADING_3',\n\n /** Fourth level heading for minor sections */\n Heading4 = 'HEADING_4',\n\n /** Fifth level heading for detailed sections */\n Heading5 = 'HEADING_5',\n\n /** Smallest heading level for fine-grained sections */\n Heading6 = 'HEADING_6',\n\n /** Overline text for labels and categories */\n Overline = 'OVERLINE',\n\n /** Primary subtitle text with larger emphasis */\n Subtitle1 = 'SUBTITLE_1',\n\n /** Secondary subtitle text with moderate emphasis */\n Subtitle2 = 'SUBTITLE_2',\n}\n\n/**\n * Event types for action components.\n *\n * @experimental This API may change in future versions\n */\nexport enum EmbeddedFlowEventType {\n /** Navigate back to the previous step */\n Back = 'BACK',\n\n /** Cancel the current operation */\n Cancel = 'CANCEL',\n\n /** Navigate to a different flow step or page */\n Navigate = 'NAVIGATE',\n\n /** Reset form fields to initial state */\n Reset = 'RESET',\n\n /** Submit form data to the server */\n Submit = 'SUBMIT',\n\n /** Trigger an action or event */\n Trigger = 'TRIGGER',\n}\n\n/**\n * Enhanced component interface for embedded flow components.\n *\n * This interface provides better support for modern form handling and user experience.\n * It includes properties for labels, placeholders, and required field validation\n * that are directly provided by the API response.\n *\n * @example\n * ```typescript\n * const component: EmbeddedFlowComponent = {\n * id: 'username_field',\n * type: EmbeddedFlowComponentType.TextInput,\n * label: 'Username',\n * placeholder: 'Enter your username',\n * required: true,\n * variant: 'TEXT',\n * eventType: 'SUBMIT',\n * components: []\n * };\n * ```\n *\n * @experimental This interface may change in future versions\n */\nexport interface EmbeddedFlowComponent {\n /**\n * Alignment of children along the cross axis (for Stack components).\n */\n align?: string;\n\n /**\n * Alternative text for Image components.\n */\n alt?: string;\n\n /**\n * Icon color, CSS color value (for Icon components).\n */\n color?: string;\n\n /**\n * Nested child components for container components like Block and Stack.\n */\n components?: EmbeddedFlowComponent[];\n\n /**\n * Layout direction for Stack components ('row' | 'column').\n */\n direction?: string;\n\n /**\n * Icon to render at the end of an Action button (URL string).\n */\n endIcon?: string;\n\n /**\n * Event type for action components that defines the interaction behavior.\n * Only relevant for Action components.\n */\n eventType?: EmbeddedFlowEventType | string;\n\n /**\n * Gap between children in Stack components (number, maps to spacing units).\n */\n gap?: number;\n\n /**\n * Height of the component (for Image components, can be string with units or number for pixels).\n * The value depends on the component type (e.g., for Image components).\n */\n height?: string | number;\n\n /**\n * Unique identifier for the component\n */\n id: string;\n\n /**\n * Number of items across the main axis (for Stack grid-like layouts).\n */\n items?: string | number;\n\n /**\n * Justification of children along the main axis (for Stack components).\n */\n justify?: string;\n\n /**\n * Display label for the component (e.g., field label, button text).\n * Supports internationalization and may contain template strings.\n */\n label?: string;\n\n /**\n * Icon name for Icon components (e.g., lucide-react icon names like 'ArrowLeftRight').\n */\n name?: string;\n\n /**\n * Options for SELECT components.\n * Each option can be a string value or an object with value and label.\n */\n options?: Array<string | {label: string; value: string}>;\n\n /**\n * Placeholder text for input components.\n * Provides helpful hints to users about expected input format.\n */\n placeholder?: string;\n\n /**\n * Reference identifier for the component (e.g., field name, action ref)\n */\n ref?: string;\n\n /**\n * Indicates whether this component represents a required field.\n * Used for form validation and UI indicators.\n */\n required?: boolean;\n\n /**\n * Icon size in pixels (for Icon components).\n */\n size?: number;\n\n /**\n * Data source key for dynamic components (e.g., COPYABLE_TEXT).\n * References a key in additionalData whose value is resolved at render time.\n */\n source?: string;\n\n /**\n * Image source URL (for Image components).\n */\n src?: string;\n\n /**\n * Icon to render at the start of an Action button (URL string).\n */\n startIcon?: string;\n\n /**\n * Component type that determines rendering behavior\n */\n type: EmbeddedFlowComponentType | string;\n\n /**\n * Component variant that affects visual styling and behavior.\n * The value depends on the component type (e.g., button variants, text variants).\n */\n variant?: EmbeddedFlowActionVariant | EmbeddedFlowTextVariant | string;\n\n /**\n * Width of the component (for Image components, can be string with units or number for pixels).\n * The value depends on the component type (e.g., for Image components).\n */\n width?: string | number;\n}\n\n/**\n * Response data structure for embedded flow API.\n *\n * This interface defines the structure of data returned by the API,\n * which includes both legacy input/action arrays for backward compatibility\n * and the new meta.components structure for modern component-driven UIs.\n *\n * The key improvement is the meta.components field, which provides\n * a rich component tree with proper labels, placeholders, and hierarchy\n * that can be directly rendered without additional transformation.\n *\n * @example\n * ```typescript\n * const response: EmbeddedFlowResponseData = {\n * // Legacy format (for backward compatibility)\n * inputs: [\n * { ref: 'input_001', identifier: 'username', type: 'TEXT_INPUT', required: true }\n * ],\n * actions: [\n * { ref: 'action_001', nextNode: 'basic_auth', eventType: 'SUBMIT' }\n * ],\n * // Modern format (recommended)\n * meta: {\n * components: [\n * {\n * id: 'text_001',\n * type: 'TEXT',\n * label: '{{ t(signin:heading.label) }}',\n * variant: 'HEADING_1'\n * },\n * {\n * id: 'block_001',\n * type: 'BLOCK',\n * components: [\n * {\n * id: 'input_001',\n * type: 'TEXT_INPUT',\n * label: '{{ t(signin:fields.username.label) }}',\n * placeholder: '{{ t(signin:fields.username.placeholder) }}',\n * required: true\n * },\n * {\n * id: 'action_001',\n * type: 'ACTION',\n * label: '{{ t(signin:buttons.submit.label) }}',\n * variant: 'PRIMARY',\n * eventType: 'ACTIVATE'\n * }\n * ]\n * }\n * ]\n * }\n * };\n * ```\n *\n * @experimental This structure may change in future versions\n */\nexport interface EmbeddedFlowResponseData {\n /**\n * Legacy action definitions for backward compatibility.\n * @deprecated Use meta.components for new implementations\n */\n actions?: {\n /** Event type for the action (SUBMIT, ACTIVATE, etc.) */\n eventType?: string;\n /** Next flow node to navigate to (optional) */\n nextNode?: string;\n /** Reference identifier for the action */\n ref: string;\n }[];\n\n /**\n * Additional data dictionary for dynamic flow response properties.\n * Can be used to pass custom data like passkey challenges, server alerts, etc.\n */\n additionalData?: Record<string, any>;\n\n /**\n * Legacy input definitions for backward compatibility.\n * @deprecated Use meta.components for new implementations\n */\n inputs?: {\n /** Field identifier used in form submission */\n identifier: string;\n /** Reference identifier for the input */\n ref: string;\n /** Whether this input is required for form submission */\n required: boolean;\n /** Input type (TEXT_INPUT, PASSWORD_INPUT, etc.) */\n type: string;\n }[];\n\n /**\n * Modern component-driven metadata structure.\n * This contains the complete UI component tree with proper\n * hierarchy, labels, and configuration that can be directly rendered.\n *\n * **This is the primary data source for implementations.**\n * The legacy inputs/actions arrays are maintained only for backward compatibility.\n */\n meta?: {\n /** Array of components that define the complete UI structure */\n components: EmbeddedFlowComponent[];\n };\n\n /**\n * Optional redirect URL for flow completion or external authentication.\n */\n redirectURL?: string;\n}\n\n/**\n * Individual consent attribute/element decision.\n *\n * @experimental This interface may change in future versions\n */\nexport interface ConsentAttributeElement {\n /** Whether the user approved collection of this attribute */\n approved: boolean;\n /** The name of the attribute being consented */\n name: string;\n}\n\n/**\n * Consent decision for a single purpose.\n *\n * @experimental This interface may change in future versions\n */\nexport interface ConsentPurposeDecision {\n /** Whether the user approved this purpose */\n approved: boolean;\n /** Per-attribute decisions for this purpose */\n elements: ConsentAttributeElement[];\n /** The name of the consent purpose */\n purposeName: string;\n}\n\n/**\n * Full consent decisions structure sent to the backend when user submits the consent form.\n *\n * @experimental This interface may change in future versions\n */\nexport interface ConsentDecisions {\n /** Array of per-purpose decisions */\n purposes: ConsentPurposeDecision[];\n}\n\n/**\n * Single consent purpose data returned by the backend in additionalData.consent_prompt.\n *\n * @experimental This interface may change in future versions\n */\nexport interface ConsentPurposeData {\n /** Optional human-readable description of the purpose */\n description?: string;\n /** Attributes that are always required and cannot be declined */\n essential: string[];\n /** Attributes that the user can optionally decline */\n optional: string[];\n /** Unique identifier for the purpose */\n purposeId: string;\n /** Human-readable purpose name */\n purposeName?: string;\n}\n\n/**\n * Consent prompt data structure stored in additionalData.consent_prompt.\n *\n * @experimental This interface may change in future versions\n */\nexport interface ConsentPromptData {\n /** Array of consent purposes requiring user review */\n purposes: ConsentPurposeData[];\n}\n\n/**\n * Extended request configuration for Asgardeo V2 embedded flow operations.\n *\n * This interface extends the base request configuration with V2-specific\n * properties required for the enhanced embedded flow API. The authId parameter\n * is particularly important for the V2 OAuth2 flow completion process.\n *\n * @template T The type of the payload data being sent with the request\n *\n * @example\n * ```typescript\n * const config: EmbeddedFlowExecuteRequestConfigV2 = {\n * baseUrl: 'https://api.asgardeo.io/t/myorg',\n * payload: {\n * flowType: 'AUTHENTICATION',\n * inputs: { username: 'user@example.com' }\n * },\n * authId: 'auth_12345', // V2-specific for OAuth completion\n * headers: {\n * 'Authorization': 'Bearer token'\n * }\n * };\n * ```\n *\n * @experimental This configuration is part of the new Asgardeo V2 platform\n */\nexport interface EmbeddedFlowExecuteRequestConfig<T = any> extends EmbeddedFlowExecuteRequestConfigV1<T> {\n /**\n * Authentication ID used for OAuth2 flow completion in V2 API.\n *\n * When the embedded flow completes successfully and returns an assertion,\n * this authId is used to complete the OAuth2 authorization flow by calling\n * the `/oauth2/auth/callback` endpoint. This enables seamless transition from\n * embedded flow to traditional OAuth2 flow completion.\n *\n * @example \"auth_abc123def456\"\n */\n authId?: string;\n}\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {EmbeddedFlowType} from '../embedded-flow';\n\n/**\n * Status enumeration for the embedded recovery flow operations.\n *\n * @experimental Part of the new Asgardeo API\n */\nexport enum EmbeddedRecoveryFlowStatus {\n /**\n * Recovery flow completed successfully.\n */\n Complete = 'COMPLETE',\n\n /**\n * Recovery flow encountered an error and cannot proceed.\n *\n * @see {@link EmbeddedRecoveryFlowErrorResponse} for error response structure\n */\n Error = 'ERROR',\n\n /**\n * Recovery flow requires additional user input.\n */\n Incomplete = 'INCOMPLETE',\n}\n\n/**\n * Type enumeration for embedded recovery flow responses.\n *\n * @experimental Part of the new Asgardeo API\n */\nexport enum EmbeddedRecoveryFlowType {\n /**\n * Response requires external redirection.\n */\n Redirection = 'REDIRECTION',\n\n /**\n * Response contains view components for rendering.\n */\n View = 'VIEW',\n}\n\n/**\n * Response structure for the embedded recovery flow.\n *\n * @experimental Part of the new Asgardeo API\n */\nexport interface EmbeddedRecoveryFlowResponse {\n /**\n * Per-step challenge token for replay protection.\n * Must be included in the next request to continue this flow.\n */\n challengeToken?: string;\n\n /**\n * Flow data containing UI components for the current step.\n */\n data: {\n /**\n * Additional data from the flow step.\n */\n additionalData?: Record<string, any>;\n\n /**\n * UI components to render for the current step.\n */\n components?: any[];\n\n /**\n * Redirect URL if type is REDIRECTION.\n */\n redirectURL?: string;\n };\n\n /**\n * Unique identifier for this recovery flow execution.\n */\n executionId: string;\n\n /**\n * Optional reason for failure when flowStatus is ERROR.\n */\n failureReason?: string;\n\n /**\n * Current status of the recovery flow.\n */\n flowStatus: EmbeddedRecoveryFlowStatus;\n\n /**\n * Type of response, indicating the expected user interaction.\n */\n type: EmbeddedRecoveryFlowType;\n}\n\n/**\n * Request payload for initiating the embedded recovery flow.\n *\n * @experimental Part of the new Asgardeo API\n */\nexport type EmbeddedRecoveryFlowInitiateRequest = {\n applicationId?: string;\n flowType: EmbeddedFlowType.Recovery;\n};\n\n/**\n * Request payload for executing steps in the embedded recovery flow.\n *\n * @experimental Part of the new Asgardeo API\n */\nexport interface EmbeddedRecoveryFlowRequest extends Partial<EmbeddedRecoveryFlowInitiateRequest> {\n action?: string;\n challengeToken?: string;\n executionId?: string;\n inputs?: Record<string, any>;\n}\n\n/**\n * Error response structure for the embedded recovery flow.\n *\n * @experimental Part of the new Asgardeo API\n */\nexport interface EmbeddedRecoveryFlowErrorResponse {\n /**\n * Additional response data, typically empty for error responses.\n */\n data: Record<string, any>;\n\n /**\n * Unique identifier for the recovery flow instance that failed.\n */\n executionId: string;\n\n /**\n * Human-readable explanation of why the recovery operation failed.\n */\n failureReason: string;\n\n /**\n * Status of the recovery flow \u2014 always ERROR for this interface.\n */\n flowStatus: EmbeddedRecoveryFlowStatus;\n}\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * The type of entity to retrieve flow metadata for.\n *\n * @example\n * ```typescript\n * const config: GetFlowMetaRequestConfig = {\n * baseUrl: 'https://localhost:8090',\n * type: FlowMetaType.App,\n * id: '60a9b38b-6eba-9f9e-55f9-267067de4680',\n * };\n * ```\n *\n * @experimental This API may change in future versions\n */\nexport enum FlowMetaType {\n /** Retrieve metadata scoped to a specific application */\n App = 'APP',\n\n /** Retrieve metadata scoped to a specific organization unit */\n Ou = 'OU',\n}\n\n/**\n * Application metadata returned when `type=APP`.\n *\n * @experimental This API may change in future versions\n */\nexport interface ApplicationMetadata {\n /** Application UUID */\n id: string;\n\n /** URL of the application logo */\n logoUrl?: string;\n\n /** Human-readable application name */\n name: string;\n\n /** Privacy Policy URI */\n policyUri?: string;\n\n /** Terms of Service URI */\n tosUri?: string;\n\n /** Application home URL */\n url?: string;\n}\n\n/**\n * Organization unit metadata.\n *\n * Always present when `type=OU`. For `type=APP`, only included when the\n * deployment has exactly one organization unit.\n *\n * @experimental This API may change in future versions\n */\nexport interface OUMetadata {\n /** Cookie Policy URI */\n cookiePolicyUri?: string;\n\n /** Optional description of the organization unit */\n description?: string;\n\n /** Unique handle / slug for the organization unit */\n handle: string;\n\n /** Organization unit UUID */\n id: string;\n\n /** URL of the organization unit logo */\n logoUrl?: string;\n\n /** Human-readable organization unit name */\n name: string;\n\n /** Privacy Policy URI */\n policyUri?: string;\n\n /** Terms of Service URI */\n tosUri?: string;\n}\n\n/**\n * A single color entry in the v2 theme color scheme.\n *\n * @experimental This API may change in future versions\n */\nexport interface FlowMetaThemeColorSet {\n /** Text color that contrasts against this color */\n contrastText?: string;\n\n /** The darker variant of the color */\n dark?: string;\n\n /** The main/primary variant of the color */\n main: string;\n}\n\n/**\n * Background colors in a v2 theme color scheme.\n *\n * @experimental This API may change in future versions\n */\nexport interface FlowMetaThemeBackground {\n /** Default background color (maps to body background) */\n default?: string;\n\n /** Surface / paper background color */\n paper?: string;\n}\n\n/**\n * Text colors in a v2 theme color scheme.\n *\n * @experimental This API may change in future versions\n */\nexport interface FlowMetaThemeTextColors {\n /** Primary text color */\n primary?: string;\n\n /** Secondary / muted text color */\n secondary?: string;\n}\n\n/**\n * All colors defined for a single v2 theme color scheme (light or dark).\n *\n * @experimental This API may change in future versions\n */\nexport interface FlowMetaThemeColors {\n /** Background colors for the theme (e.g., body, paper) */\n background?: FlowMetaThemeBackground;\n\n /** Primary color set for the theme */\n primary?: FlowMetaThemeColorSet;\n\n /** Secondary color set for the theme */\n secondary?: FlowMetaThemeColorSet;\n\n /** Text colors for the theme */\n text?: FlowMetaThemeTextColors;\n}\n\n/**\n * A single color scheme (light or dark) in the v2 theme.\n *\n * @experimental This API may change in future versions\n */\nexport interface FlowMetaThemeColorScheme {\n /** All colors defined for this color scheme (light or dark) */\n palette: FlowMetaThemeColors;\n}\n\n/**\n * Shape / geometry configuration in the v2 theme.\n *\n * @experimental This API may change in future versions\n */\nexport interface FlowMetaThemeShape {\n /** Border radius in pixels applied uniformly across components */\n borderRadius?: number;\n}\n\n/**\n * Typography configuration in the v2 theme.\n *\n * @experimental This API may change in future versions\n */\nexport interface FlowMetaThemeTypography {\n /** CSS font-family string */\n fontFamily?: string;\n}\n\n/**\n * Resolved theme configuration returned inside the flow metadata response.\n *\n * Maps to the `design.theme` field of {@link FlowMetadataResponse}.\n *\n * @experimental This API may change in future versions\n */\nexport interface FlowMetaTheme {\n /** Per-scheme color definitions (light and dark) */\n colorSchemes?: {\n /** Dark color scheme */\n dark?: FlowMetaThemeColorScheme;\n /** Light color scheme */\n light?: FlowMetaThemeColorScheme;\n };\n\n /** The color scheme to apply by default */\n defaultColorScheme?: 'light' | 'dark';\n\n /** Text direction for the theme */\n direction?: 'ltr' | 'rtl';\n\n /** Shape/geometry configuration for the theme */\n shape?: FlowMetaThemeShape;\n\n /** Typography configuration for the theme */\n typography?: FlowMetaThemeTypography;\n}\n\n/**\n * Resolved design configuration (theme and layout) for the flow.\n *\n * @experimental This API may change in future versions\n */\nexport interface DesignMetadata {\n /** Resolved layout configuration (shape is server-defined) */\n layout: Record<string, unknown>;\n\n /** Resolved theme configuration for the flow */\n theme: FlowMetaTheme;\n}\n\n/**\n * Internationalisation metadata for the flow.\n *\n * @experimental This API may change in future versions\n */\nexport interface I18nMetadata {\n /** The language used for the returned translations (defaults to `en`) */\n language: string;\n\n /** List of all available language tags (BCP 47) for the entity */\n languages: string[];\n\n /** Total number of translation keys returned */\n totalResults?: number;\n\n /**\n * Translations organised by namespace.\n *\n * @example\n * ```json\n * {\n * \"auth\": {\n * \"login.button\": \"Login\",\n * \"login.title\": \"Welcome\"\n * }\n * }\n * ```\n */\n translations: Record<string, Record<string, string>>;\n}\n\n/**\n * Aggregated flow metadata response returned by `GET /flow/meta`.\n *\n * @experimental This API may change in future versions\n */\nexport interface FlowMetadataResponse {\n /**\n * Application metadata.\n * Only present when `type=APP`.\n */\n application?: ApplicationMetadata;\n\n /** Resolved design configuration */\n design: DesignMetadata;\n\n /** Internationalisation metadata and translations */\n i18n: I18nMetadata;\n\n /** Indicates whether the registration flow is enabled for the entity */\n isRegistrationFlowEnabled: boolean;\n\n /**\n * Organization unit metadata.\n * Always present when `type=OU`.\n * For `type=APP`, only present when the deployment has exactly one OU.\n */\n ou?: OUMetadata;\n}\n\n/**\n * Request configuration for `getFlowMetaV2`.\n *\n * @example\n * ```typescript\n * const config: GetFlowMetaRequestConfig = {\n * baseUrl: 'https://localhost:8090',\n * type: FlowMetaType.App,\n * id: '60a9b38b-6eba-9f9e-55f9-267067de4680',\n * language: 'en',\n * namespace: 'auth',\n * };\n * ```\n *\n * @experimental This API may change in future versions\n */\nexport interface GetFlowMetaRequestConfig extends Omit<Partial<RequestInit>, 'method' | 'body'> {\n /**\n * Base URL of the Flow API server (e.g. `https://localhost:8090`).\n * Either `baseUrl` or `url` must be provided.\n */\n baseUrl?: string;\n\n /**\n * UUID of the entity (application ID or organization unit ID).\n * Optional \u2014 when omitted the server returns i18n-only metadata (e.g. for flows\n * like AcceptInvite that are not tied to a specific application or OU).\n */\n id?: string;\n\n /**\n * Language tag in BCP 47 format for i18n translations.\n * Defaults to `en` on the server side when omitted.\n *\n * @example \"en\", \"es\", \"fr-CA\"\n */\n language?: string;\n\n /**\n * Filter translations by a specific namespace.\n *\n * @example \"auth\", \"errors\", \"common\"\n */\n namespace?: string;\n\n /**\n * The type of entity to retrieve metadata for.\n * Optional \u2014 must be omitted together with `id` for flows that are not\n * associated with a specific application or OU (e.g. AcceptInvite).\n */\n type?: FlowMetaType;\n\n /**\n * Fully qualified URL of the `/flow/meta` endpoint.\n * When provided, `baseUrl` is ignored.\n */\n url?: string;\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport enum FlowMode {\n /**\n * This mode is suitable for embedded sign-in, sign-up, etc. flows where the authentication\n * UIs are rendered within the application.\n * @see {@link https://is.docs.wso2.com/en/7.1.0/references/app-native-authentication/}\n */\n Embedded = 'DIRECT',\n /**\n * Traditional redirect based sign-in, sign-up, etc. flows where the authentication\n * UIs are from a external Identity Provider (ex: WSO2 Identity Server or Asgardeo).\n */\n Redirect = 'REDIRECTION',\n}\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Interface representing the configuration for an agent.\n */\nexport interface AgentConfig {\n /**\n * The unique identifier for the agent\n */\n agentID: string;\n /**\n * The secret credential for the agent\n */\n agentSecret: string;\n /**\n * The authenticator name to match during the embedded sign-in flow.\n * Defaults to {@link AgentConfig.DEFAULT_AUTHENTICATOR_NAME} if not provided.\n */\n authenticatorName?: string;\n}\n\n/**\n * Namespace that holds constants related to {@link AgentConfig}.\n */\nexport namespace AgentConfig {\n /**\n * Default authenticator name used when none is specified.\n */\n export const DEFAULT_AUTHENTICATOR_NAME: string = 'Username & Password';\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport interface SchemaAttribute {\n caseExact: boolean;\n description?: string;\n displayName?: string;\n displayOrder?: string;\n multiValued: boolean;\n mutability: string;\n name: string;\n regEx?: string;\n required?: boolean;\n returned: string;\n sharedProfileValueResolvingMethod?: string;\n subAttributes?: SchemaAttribute[];\n supportedByDefault?: string;\n type: string;\n uniqueness: string;\n}\n\n/**\n * Represents a SCIM2 schema definition\n */\nexport interface Schema {\n /** Schema attributes */\n attributes: SchemaAttribute[];\n /** Schema description */\n description: string;\n /** Schema identifier */\n id: string;\n /** Schema name */\n name: string;\n}\n\nexport interface FlattenedSchema extends Schema {\n schemaId: string;\n}\n\n/**\n * Well-known SCIM2 schema IDs\n */\nexport enum WellKnownSchemaIds {\n /** Core Schema */\n Core = 'urn:ietf:params:scim:schemas:core:2.0',\n /** Custom User Schema */\n CustomUser = 'urn:scim:schemas:extension:custom:User',\n /** Enterprise User Schema */\n EnterpriseUser = 'urn:ietf:params:scim:schemas:extension:enterprise:2.0:User',\n /** System User Schema */\n SystemUser = 'urn:scim:wso2:schema',\n /** User Schema */\n User = 'urn:ietf:params:scim:schemas:core:2.0:User',\n}\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport enum FieldType {\n Checkbox = 'CHECKBOX',\n Date = 'DATE',\n Email = 'EMAIL',\n Number = 'NUMBER',\n Otp = 'OTP',\n Password = 'PASSWORD',\n Radio = 'RADIO',\n Select = 'SELECT',\n Tel = 'TEL',\n Text = 'TEXT',\n Textarea = 'TEXTAREA',\n Time = 'TIME',\n}\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport class DefaultCacheStore implements Storage {\n private cache: Map<string, string>;\n\n constructor() {\n this.cache = new Map<string, string>();\n }\n\n public get length(): number {\n return this.cache.size;\n }\n\n public getItem(key: string): string | null {\n return this.cache.get(key) ?? null;\n }\n\n public setItem(key: string, value: string): void {\n this.cache.set(key, value);\n }\n\n public removeItem(key: string): void {\n this.cache.delete(key);\n }\n\n public clear(): void {\n this.cache.clear();\n }\n\n public key(index: number): string | null {\n const keys: string[] = Array.from(this.cache.keys());\n return keys[index] ?? null;\n }\n\n public async setData(key: string, value: string): Promise<void> {\n this.cache.set(key, value);\n }\n\n public async getData(key: string): Promise<string> {\n return this.cache.get(key) ?? '{}';\n }\n\n public async removeData(key: string): Promise<void> {\n this.cache.delete(key);\n }\n}\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport * as jose from 'jose';\nimport {Crypto, JWKInterface} from './models/crypto';\n\n/**\n * Default implementation of the Crypto interface using the 'jose' library\n * and the native Web Crypto API.\n */\nexport class DefaultCrypto implements Crypto<Uint8Array> {\n // eslint-disable-next-line class-methods-use-this\n public base64URLDecode(value: string): string {\n const decodedArray: Uint8Array = jose.base64url.decode(value);\n return new TextDecoder().decode(decodedArray);\n }\n\n // eslint-disable-next-line class-methods-use-this\n public base64URLEncode(value: Uint8Array): string {\n return jose.base64url.encode(value);\n }\n\n // eslint-disable-next-line class-methods-use-this\n public generateRandomBytes(length: number): Uint8Array {\n return crypto.getRandomValues(new Uint8Array(length));\n }\n\n // eslint-disable-next-line class-methods-use-this\n public async hashSha256(data: string): Promise<Uint8Array> {\n const encoder: TextEncoder = new TextEncoder();\n const dataBuffer: Uint8Array = encoder.encode(data);\n const hashBuffer: ArrayBuffer = await crypto.subtle.digest('SHA-256', dataBuffer);\n\n return new Uint8Array(hashBuffer);\n }\n\n // eslint-disable-next-line class-methods-use-this\n public async verifyJwt(\n idToken: string,\n jwk: JWKInterface,\n algorithms: string[],\n clientId: string,\n issuer: string,\n subject: string,\n clockTolerance?: number,\n validateJwtIssuer: boolean = true,\n ): Promise<boolean> {\n const key: jose.KeyLike | Uint8Array = await jose.importJWK(jwk as jose.JWK);\n\n await jose.jwtVerify(idToken, key, {\n algorithms,\n audience: [clientId],\n clockTolerance,\n issuer: validateJwtIssuer ? issuer : undefined,\n subject,\n });\n\n return true;\n }\n}\n", "/**\n * Copyright (c) 2025-2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {AsgardeoAuthClient} from './__legacy__/client';\nimport {AuthClientConfig} from './__legacy__/models/client-config';\nimport executeEmbeddedSignInFlow from './api/executeEmbeddedSignInFlow';\nimport initializeEmbeddedSignInFlow from './api/initializeEmbeddedSignInFlow';\nimport {DefaultCacheStore} from './DefaultCacheStore';\nimport {DefaultCrypto} from './DefaultCrypto';\nimport {AgentConfig} from './models/agent';\nimport {AuthCodeResponse} from './models/auth-code-response';\nimport {AsgardeoClient} from './models/client';\nimport {Config, SignInOptions, SignOutOptions, SignUpOptions} from './models/config';\nimport {Crypto} from './models/crypto';\nimport {\n EmbeddedFlowExecuteRequestConfig,\n EmbeddedFlowExecuteRequestPayload,\n EmbeddedFlowExecuteResponse,\n} from './models/embedded-flow';\nimport {\n EmbeddedSignInFlowAuthenticator,\n EmbeddedSignInFlowHandleResponse,\n EmbeddedSignInFlowInitiateResponse,\n EmbeddedSignInFlowStatus,\n} from './models/embedded-signin-flow';\nimport {OIDCDiscoveryApiResponse} from './models/oidc-discovery';\nimport {AllOrganizationsApiResponse, Organization} from './models/organization';\nimport {Storage} from './models/store';\nimport {TokenExchangeRequestConfig, TokenResponse} from './models/token';\nimport {User, UserProfile} from './models/user';\nimport StorageManager from './StorageManager';\n\nclass AsgardeoJavaScriptClient<T = Config> implements AsgardeoClient<T> {\n private cacheStore: Storage;\n\n private cryptoUtils: Crypto;\n\n private auth: AsgardeoAuthClient<T>;\n\n private storageManager: StorageManager<T>;\n\n private baseURL: string;\n\n constructor(config?: AuthClientConfig<T>, cacheStore?: Storage, cryptoUtils?: Crypto) {\n this.cacheStore = cacheStore ?? new DefaultCacheStore();\n this.cryptoUtils = cryptoUtils ?? new DefaultCrypto();\n this.auth = new AsgardeoAuthClient();\n\n if (config) {\n this.auth.initialize(config, this.cacheStore, this.cryptoUtils);\n this.storageManager = this.auth.getStorageManager();\n }\n\n this.baseURL = config?.baseUrl ?? '';\n }\n\n public async getDiscoveryResponse(): Promise<OIDCDiscoveryApiResponse | null> {\n if (!this.storageManager) {\n return null;\n }\n\n return this.storageManager.loadOpenIDProviderConfiguration();\n }\n\n /* eslint-disable class-methods-use-this, @typescript-eslint/no-unused-vars */\n switchOrganization(_organization: Organization, _sessionId?: string): Promise<TokenResponse | Response> {\n throw new Error('Method not implemented.');\n }\n\n initialize(_config: T, _storage?: Storage): Promise<boolean> {\n throw new Error('Method not implemented.');\n }\n\n reInitialize(_config: Partial<T>): Promise<boolean> {\n throw new Error('Method not implemented.');\n }\n\n getUser(_options?: any): Promise<User> {\n throw new Error('Method not implemented.');\n }\n\n getAllOrganizations(_options?: any, _sessionId?: string): Promise<AllOrganizationsApiResponse> {\n throw new Error('Method not implemented.');\n }\n\n getMyOrganizations(_options?: any, _sessionId?: string): Promise<Organization[]> {\n throw new Error('Method not implemented.');\n }\n\n getCurrentOrganization(_sessionId?: string): Promise<Organization | null> {\n throw new Error('Method not implemented.');\n }\n\n getUserProfile(_options?: any): Promise<UserProfile> {\n throw new Error('Method not implemented.');\n }\n\n isLoading(): boolean {\n throw new Error('Method not implemented.');\n }\n\n isSignedIn(): Promise<boolean> {\n throw new Error('Method not implemented.');\n }\n\n updateUserProfile(_payload: any, _userId?: string): Promise<User> {\n throw new Error('Method not implemented.');\n }\n\n getConfiguration(): T {\n throw new Error('Method not implemented.');\n }\n\n exchangeToken(_config: TokenExchangeRequestConfig, _sessionId?: string): Promise<TokenResponse | Response> {\n throw new Error('Method not implemented.');\n }\n\n signInSilently(_options?: SignInOptions): Promise<User | boolean> {\n throw new Error('Method not implemented.');\n }\n\n getAccessToken(_sessionId?: string): Promise<string> {\n throw new Error('Method not implemented.');\n }\n\n clearSession(_sessionId?: string): void {\n throw new Error('Method not implemented.');\n }\n\n setSession(_sessionData: Record<string, unknown>, _sessionId?: string): Promise<void> {\n throw new Error('Method not implemented.');\n }\n\n decodeJwtToken<R = Record<string, unknown>>(_token: string): Promise<R> {\n throw new Error('Method not implemented.');\n }\n\n signIn(_options?: SignInOptions): Promise<User> {\n throw new Error('Method not implemented.');\n }\n\n signOut(\n _options?: SignOutOptions,\n _sessionIdOrAfterSignOut?: string | ((afterSignOutUrl: string) => void),\n _afterSignOut?: (afterSignOutUrl: string) => void,\n ): Promise<string> {\n throw new Error('Method not implemented.');\n }\n\n recover(_payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse> {\n throw new Error('Method not implemented.');\n }\n\n signUp(options?: SignUpOptions): Promise<void>;\n\n signUp(payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse>;\n\n signUp(\n _optionsOrPayload?: SignUpOptions | EmbeddedFlowExecuteRequestPayload,\n ): Promise<void | EmbeddedFlowExecuteResponse> {\n throw new Error('Method not implemented.');\n }\n /* eslint-enable class-methods-use-this, @typescript-eslint/no-unused-vars */\n\n public async getAgentToken(agentConfig: AgentConfig): Promise<TokenResponse> {\n const customParam: Record<string, string> = {\n response_mode: 'direct',\n };\n\n const authorizeURL: URL = new URL(await this.auth.getSignInUrl(customParam));\n\n const authorizeResponse: EmbeddedSignInFlowInitiateResponse = await initializeEmbeddedSignInFlow({\n payload: Object.fromEntries(authorizeURL.searchParams.entries()),\n url: `${authorizeURL.origin}${authorizeURL.pathname}`,\n });\n\n const authenticatorName: string = agentConfig.authenticatorName ?? AgentConfig.DEFAULT_AUTHENTICATOR_NAME;\n\n const targetAuthenticator: EmbeddedSignInFlowAuthenticator | undefined =\n authorizeResponse.nextStep.authenticators.find(\n (auth: EmbeddedSignInFlowAuthenticator) => auth.authenticator === authenticatorName,\n );\n\n if (!targetAuthenticator) {\n throw new Error(`Authenticator '${authenticatorName}' not found among authentication steps.`);\n }\n\n const authnRequest: EmbeddedFlowExecuteRequestConfig = {\n baseUrl: this.baseURL,\n payload: {\n flowId: authorizeResponse.flowId,\n selectedAuthenticator: {\n authenticatorId: targetAuthenticator.authenticatorId,\n params: {\n password: agentConfig.agentSecret,\n username: agentConfig.agentID,\n },\n },\n },\n };\n\n const authnResponse: EmbeddedSignInFlowHandleResponse = await executeEmbeddedSignInFlow(authnRequest);\n\n if (authnResponse.flowStatus !== EmbeddedSignInFlowStatus.SuccessCompleted) {\n throw new Error('Agent authentication failed.');\n }\n\n return this.auth.requestAccessToken(\n authnResponse.authData['code'],\n authnResponse.authData['session_state'],\n authnResponse.authData['state'],\n );\n }\n\n public async getOBOSignInURL(agentConfig: AgentConfig): Promise<string> {\n const customParam: Record<string, string> = {\n requested_actor: agentConfig.agentID,\n };\n\n const authURL: string | undefined = await this.auth.getSignInUrl(customParam);\n\n if (authURL) {\n return authURL.toString();\n }\n\n throw new Error('Could not build Authorize URL');\n }\n\n public async getOBOToken(agentConfig: AgentConfig, authCodeResponse: AuthCodeResponse): Promise<TokenResponse> {\n const agentToken: TokenResponse = await this.getAgentToken(agentConfig);\n\n const tokenRequestConfig: {params: {actor_token: string}} = {\n params: {\n actor_token: agentToken.accessToken,\n },\n };\n\n return this.auth.requestAccessToken(\n authCodeResponse.code,\n authCodeResponse.session_state,\n authCodeResponse.state,\n undefined,\n tokenRequestConfig,\n );\n }\n}\n\nexport default AsgardeoJavaScriptClient;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {Theme, ThemeConfig, ThemeImage, ThemeMode, ThemeVars} from './types';\nimport VendorConstants from '../constants/VendorConstants';\nimport {RecursivePartial} from '../models/utility-types';\n\nconst lightTheme: ThemeConfig = {\n borderRadius: {\n large: '16px',\n medium: '8px',\n small: '4px',\n },\n colors: {\n action: {\n activatedOpacity: 0.12,\n active: 'rgba(0, 0, 0, 0.54)',\n disabled: 'rgba(0, 0, 0, 0.26)',\n disabledBackground: 'rgba(0, 0, 0, 0.12)',\n disabledOpacity: 0.38,\n focus: 'rgba(0, 0, 0, 0.12)',\n focusOpacity: 0.12,\n hover: 'rgba(0, 0, 0, 0.04)',\n hoverOpacity: 0.04,\n selected: 'rgba(0, 0, 0, 0.08)',\n selectedOpacity: 0.08,\n },\n background: {\n body: {\n dark: '#212121',\n main: '#1a1a1a',\n },\n dark: '#212121',\n disabled: '#f0f0f0',\n surface: '#ffffff',\n },\n border: '#e0e0e0',\n error: {\n contrastText: '#d52828',\n dark: '#b71c1c',\n light: '#fef2f2',\n main: '#d32f2f',\n },\n info: {\n contrastText: '#43aeda',\n dark: '#01579b',\n light: '#eff6ff',\n main: '#bbebff',\n },\n primary: {\n contrastText: '#ffffff',\n dark: '#174ea6',\n main: '#1a73e8',\n },\n secondary: {\n contrastText: '#ffffff',\n dark: '#212121',\n light: '#f3f4f6',\n main: '#424242',\n },\n success: {\n contrastText: '#00a807',\n dark: '#388e3c',\n light: '#f0fdf4',\n main: '#4caf50',\n },\n text: {\n dark: '#212121',\n primary: '#1a1a1a',\n secondary: '#666666',\n },\n warning: {\n contrastText: '#be7100',\n dark: '#f57c00',\n light: '#fffbeb',\n main: '#ff9800',\n },\n },\n images: {\n favicon: {},\n logo: {},\n },\n shadows: {\n large: '0 8px 32px rgba(0, 0, 0, 0.2)',\n medium: '0 4px 16px rgba(0, 0, 0, 0.15)',\n small: '0 2px 8px rgba(0, 0, 0, 0.1)',\n },\n spacing: {\n unit: 8,\n },\n typography: {\n fontFamily: '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n fontSizes: {\n '2xl': '1.5rem', // 24px\n '3xl': '2.125rem', // 34px\n lg: '1.125rem', // 18px\n md: '1rem', // 16px\n sm: '0.875rem', // 14px\n xl: '1.25rem', // 20px\n xs: '0.75rem', // 12px\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n normal: 400,\n semibold: 600,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n },\n};\n\nconst darkTheme: ThemeConfig = {\n borderRadius: {\n large: '16px',\n medium: '8px',\n small: '4px',\n },\n colors: {\n action: {\n activatedOpacity: 0.12,\n active: '#1c1c1c',\n disabled: 'rgba(255, 255, 255, 0.26)',\n disabledBackground: 'rgba(255, 255, 255, 0.12)',\n disabledOpacity: 0.38,\n focus: '#1c1c1c',\n focusOpacity: 0.12,\n hover: '#1c1c1c',\n hoverOpacity: 0.04,\n selected: '#1c1c1c',\n selectedOpacity: 0.08,\n },\n background: {\n body: {\n dark: '#212121',\n main: '#ffffff',\n },\n dark: '#212121',\n disabled: '#1f1f1f',\n surface: '#121212',\n },\n border: '#404040',\n error: {\n contrastText: '#d52828',\n dark: '#b71c1c',\n light: '#2d1515',\n main: '#d32f2f',\n },\n info: {\n contrastText: '#43aeda',\n dark: '#01579b',\n light: '#0f1f35',\n main: '#bbebff',\n },\n primary: {\n contrastText: '#ffffff',\n dark: '#174ea6',\n main: '#1a73e8',\n },\n secondary: {\n contrastText: '#ffffff',\n dark: '#212121',\n light: '#2a2a2a',\n main: '#8b8b8b',\n },\n success: {\n contrastText: '#00a807',\n dark: '#388e3c',\n light: '#132d1a',\n main: '#4caf50',\n },\n text: {\n dark: '#212121',\n primary: '#ffffff',\n secondary: '#b3b3b3',\n },\n warning: {\n contrastText: '#be7100',\n dark: '#f57c00',\n light: '#2d2310',\n main: '#ff9800',\n },\n },\n images: {\n favicon: {},\n logo: {},\n },\n shadows: {\n large: '0 8px 32px rgba(0, 0, 0, 0.5)',\n medium: '0 4px 16px rgba(0, 0, 0, 0.4)',\n small: '0 2px 8px rgba(0, 0, 0, 0.3)',\n },\n spacing: {\n unit: 8,\n },\n typography: {\n fontFamily: '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n fontSizes: {\n '2xl': '1.5rem', // 24px\n '3xl': '2.125rem', // 34px\n lg: '1.125rem', // 18px\n md: '1rem', // 16px\n sm: '0.875rem', // 14px\n xl: '1.25rem', // 20px\n xs: '0.75rem', // 12px\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n normal: 400,\n semibold: 600,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n },\n};\n\nconst toCssVariables = (theme: ThemeConfig): Record<string, string> => {\n const cssVars: Record<string, string> = {};\n const prefix: string = theme.cssVarPrefix || VendorConstants.VENDOR_PREFIX;\n\n // Colors - Action\n if (theme.colors?.action?.active) {\n cssVars[`--${prefix}-color-action-active`] = theme.colors.action.active;\n }\n if (theme.colors?.action?.hover) {\n cssVars[`--${prefix}-color-action-hover`] = theme.colors.action.hover;\n }\n if (theme.colors?.action?.hoverOpacity !== undefined) {\n cssVars[`--${prefix}-color-action-hoverOpacity`] = theme.colors.action.hoverOpacity.toString();\n }\n if (theme.colors?.action?.selected) {\n cssVars[`--${prefix}-color-action-selected`] = theme.colors.action.selected;\n }\n if (theme.colors?.action?.selectedOpacity !== undefined) {\n cssVars[`--${prefix}-color-action-selectedOpacity`] = theme.colors.action.selectedOpacity.toString();\n }\n if (theme.colors?.action?.disabled) {\n cssVars[`--${prefix}-color-action-disabled`] = theme.colors.action.disabled;\n }\n if (theme.colors?.action?.disabledBackground) {\n cssVars[`--${prefix}-color-action-disabledBackground`] = theme.colors.action.disabledBackground;\n }\n if (theme.colors?.action?.disabledOpacity !== undefined) {\n cssVars[`--${prefix}-color-action-disabledOpacity`] = theme.colors.action.disabledOpacity.toString();\n }\n if (theme.colors?.action?.focus) {\n cssVars[`--${prefix}-color-action-focus`] = theme.colors.action.focus;\n }\n if (theme.colors?.action?.focusOpacity !== undefined) {\n cssVars[`--${prefix}-color-action-focusOpacity`] = theme.colors.action.focusOpacity.toString();\n }\n if (theme.colors?.action?.activatedOpacity !== undefined) {\n cssVars[`--${prefix}-color-action-activatedOpacity`] = theme.colors.action.activatedOpacity.toString();\n }\n\n // Colors - Primary\n if (theme.colors?.primary?.main) {\n cssVars[`--${prefix}-color-primary-main`] = theme.colors.primary.main;\n }\n if (theme.colors?.primary?.contrastText) {\n cssVars[`--${prefix}-color-primary-contrastText`] = theme.colors.primary.contrastText;\n }\n\n // Colors - Secondary\n if (theme.colors?.secondary?.main) {\n cssVars[`--${prefix}-color-secondary-main`] = theme.colors.secondary.main;\n }\n if (theme.colors?.secondary?.contrastText) {\n cssVars[`--${prefix}-color-secondary-contrastText`] = theme.colors.secondary.contrastText;\n }\n if (theme.colors?.secondary?.light) {\n cssVars[`--${prefix}-color-secondary-light`] = theme.colors.secondary.light;\n }\n\n // Colors - Background\n if (theme.colors?.background?.surface) {\n cssVars[`--${prefix}-color-background-surface`] = theme.colors.background.surface;\n }\n if (theme.colors?.background?.disabled) {\n cssVars[`--${prefix}-color-background-disabled`] = theme.colors.background.disabled;\n }\n if (theme.colors?.background?.body?.main) {\n cssVars[`--${prefix}-color-background-body-main`] = theme.colors.background.body.main;\n }\n\n // Colors - Error\n if (theme.colors?.error?.main) {\n cssVars[`--${prefix}-color-error-main`] = theme.colors.error.main;\n }\n if (theme.colors?.error?.contrastText) {\n cssVars[`--${prefix}-color-error-contrastText`] = theme.colors.error.contrastText;\n }\n if (theme.colors?.error?.light) {\n cssVars[`--${prefix}-color-error-light`] = theme.colors.error.light;\n }\n\n // Colors - Success\n if (theme.colors?.success?.main) {\n cssVars[`--${prefix}-color-success-main`] = theme.colors.success.main;\n }\n if (theme.colors?.success?.contrastText) {\n cssVars[`--${prefix}-color-success-contrastText`] = theme.colors.success.contrastText;\n }\n if (theme.colors?.success?.light) {\n cssVars[`--${prefix}-color-success-light`] = theme.colors.success.light;\n }\n\n // Colors - Warning\n if (theme.colors?.warning?.main) {\n cssVars[`--${prefix}-color-warning-main`] = theme.colors.warning.main;\n }\n if (theme.colors?.warning?.contrastText) {\n cssVars[`--${prefix}-color-warning-contrastText`] = theme.colors.warning.contrastText;\n }\n if (theme.colors?.warning?.light) {\n cssVars[`--${prefix}-color-warning-light`] = theme.colors.warning.light;\n }\n\n // Colors - Info\n if (theme.colors?.info?.main) {\n cssVars[`--${prefix}-color-info-main`] = theme.colors.info.main;\n }\n if (theme.colors?.info?.contrastText) {\n cssVars[`--${prefix}-color-info-contrastText`] = theme.colors.info.contrastText;\n }\n if (theme.colors?.info?.light) {\n cssVars[`--${prefix}-color-info-light`] = theme.colors.info.light;\n }\n\n // Colors - Text\n if (theme.colors?.text?.primary) {\n cssVars[`--${prefix}-color-text-primary`] = theme.colors.text.primary;\n }\n if (theme.colors?.text?.secondary) {\n cssVars[`--${prefix}-color-text-secondary`] = theme.colors.text.secondary;\n }\n\n // Colors - Border\n if (theme.colors?.border) {\n cssVars[`--${prefix}-color-border`] = theme.colors.border;\n }\n\n // Spacing\n if (theme.spacing?.unit !== undefined) {\n cssVars[`--${prefix}-spacing-unit`] = `${theme.spacing.unit}px`;\n }\n\n // Border Radius\n if (theme.borderRadius?.small) {\n cssVars[`--${prefix}-border-radius-small`] = theme.borderRadius.small;\n }\n if (theme.borderRadius?.medium) {\n cssVars[`--${prefix}-border-radius-medium`] = theme.borderRadius.medium;\n }\n if (theme.borderRadius?.large) {\n cssVars[`--${prefix}-border-radius-large`] = theme.borderRadius.large;\n }\n\n // Shadows\n if (theme.shadows?.small) {\n cssVars[`--${prefix}-shadow-small`] = theme.shadows.small;\n }\n if (theme.shadows?.medium) {\n cssVars[`--${prefix}-shadow-medium`] = theme.shadows.medium;\n }\n if (theme.shadows?.large) {\n cssVars[`--${prefix}-shadow-large`] = theme.shadows.large;\n }\n\n // Typography - Font Family\n if (theme.typography?.fontFamily) {\n cssVars[`--${prefix}-typography-fontFamily`] = theme.typography.fontFamily;\n }\n\n // Typography - Font Sizes\n if (theme.typography?.fontSizes?.xs) {\n cssVars[`--${prefix}-typography-fontSize-xs`] = theme.typography.fontSizes.xs;\n }\n if (theme.typography?.fontSizes?.sm) {\n cssVars[`--${prefix}-typography-fontSize-sm`] = theme.typography.fontSizes.sm;\n }\n if (theme.typography?.fontSizes?.md) {\n cssVars[`--${prefix}-typography-fontSize-md`] = theme.typography.fontSizes.md;\n }\n if (theme.typography?.fontSizes?.lg) {\n cssVars[`--${prefix}-typography-fontSize-lg`] = theme.typography.fontSizes.lg;\n }\n if (theme.typography?.fontSizes?.xl) {\n cssVars[`--${prefix}-typography-fontSize-xl`] = theme.typography.fontSizes.xl;\n }\n if (theme.typography?.fontSizes?.['2xl']) {\n cssVars[`--${prefix}-typography-fontSize-2xl`] = theme.typography.fontSizes['2xl'];\n }\n if (theme.typography?.fontSizes?.['3xl']) {\n cssVars[`--${prefix}-typography-fontSize-3xl`] = theme.typography.fontSizes['3xl'];\n }\n\n // Typography - Font Weights\n if (theme.typography?.fontWeights?.normal !== undefined) {\n cssVars[`--${prefix}-typography-fontWeight-normal`] = theme.typography.fontWeights.normal.toString();\n }\n if (theme.typography?.fontWeights?.medium !== undefined) {\n cssVars[`--${prefix}-typography-fontWeight-medium`] = theme.typography.fontWeights.medium.toString();\n }\n if (theme.typography?.fontWeights?.semibold !== undefined) {\n cssVars[`--${prefix}-typography-fontWeight-semibold`] = theme.typography.fontWeights.semibold.toString();\n }\n if (theme.typography?.fontWeights?.bold !== undefined) {\n cssVars[`--${prefix}-typography-fontWeight-bold`] = theme.typography.fontWeights.bold.toString();\n }\n\n // Typography - Line Heights\n if (theme.typography?.lineHeights?.tight !== undefined) {\n cssVars[`--${prefix}-typography-lineHeight-tight`] = theme.typography.lineHeights.tight.toString();\n }\n if (theme.typography?.lineHeights?.normal !== undefined) {\n cssVars[`--${prefix}-typography-lineHeight-normal`] = theme.typography.lineHeights.normal.toString();\n }\n if (theme.typography?.lineHeights?.relaxed !== undefined) {\n cssVars[`--${prefix}-typography-lineHeight-relaxed`] = theme.typography.lineHeights.relaxed.toString();\n }\n\n // Images\n if (theme.images) {\n Object.keys(theme.images).forEach((imageKey: string) => {\n const imageConfig: ThemeImage | undefined = theme.images![imageKey];\n if (imageConfig?.url) {\n cssVars[`--${prefix}-image-${imageKey}-url`] = imageConfig.url;\n }\n if (imageConfig?.title) {\n cssVars[`--${prefix}-image-${imageKey}-title`] = imageConfig.title;\n }\n if (imageConfig?.alt) {\n cssVars[`--${prefix}-image-${imageKey}-alt`] = imageConfig.alt;\n }\n });\n }\n\n /* |---------------------------------------------------------------| */\n /* | Components | */\n /* |---------------------------------------------------------------| */\n\n // Button Overrides\n if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {\n cssVars[`--${prefix}-component-button-root-borderRadius`] =\n theme.components.Button.styleOverrides.root.borderRadius;\n }\n\n // Field Overrides (Parent of `TextField`, `DatePicker`, `OtpField`, `Select`, etc.)\n if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {\n cssVars[`--${prefix}-component-field-root-borderRadius`] = theme.components.Field.styleOverrides.root.borderRadius;\n }\n\n return cssVars;\n};\n\nconst toThemeVars = (theme: ThemeConfig): ThemeVars => {\n const prefix: string = theme.cssVarPrefix || VendorConstants.VENDOR_PREFIX;\n\n const componentVars: ThemeVars['components'] = {};\n if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {\n componentVars.Button = {\n root: {\n borderRadius: `var(--${prefix}-component-button-root-borderRadius)`,\n },\n };\n }\n if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {\n componentVars.Field = {\n root: {\n borderRadius: `var(--${prefix}-component-field-root-borderRadius)`,\n },\n };\n }\n\n const themeVars: ThemeVars = {\n borderRadius: {\n large: `var(--${prefix}-border-radius-large)`,\n medium: `var(--${prefix}-border-radius-medium)`,\n small: `var(--${prefix}-border-radius-small)`,\n },\n colors: {\n action: {\n activatedOpacity: `var(--${prefix}-color-action-activatedOpacity)`,\n active: `var(--${prefix}-color-action-active)`,\n disabled: `var(--${prefix}-color-action-disabled)`,\n disabledBackground: `var(--${prefix}-color-action-disabledBackground)`,\n disabledOpacity: `var(--${prefix}-color-action-disabledOpacity)`,\n focus: `var(--${prefix}-color-action-focus)`,\n focusOpacity: `var(--${prefix}-color-action-focusOpacity)`,\n hover: `var(--${prefix}-color-action-hover)`,\n hoverOpacity: `var(--${prefix}-color-action-hoverOpacity)`,\n selected: `var(--${prefix}-color-action-selected)`,\n selectedOpacity: `var(--${prefix}-color-action-selectedOpacity)`,\n },\n background: {\n body: {\n main: `var(--${prefix}-color-background-body-main)`,\n },\n disabled: `var(--${prefix}-color-background-disabled)`,\n surface: `var(--${prefix}-color-background-surface)`,\n },\n border: `var(--${prefix}-color-border)`,\n error: {\n contrastText: `var(--${prefix}-color-error-contrastText)`,\n main: `var(--${prefix}-color-error-main)`,\n },\n info: {\n contrastText: `var(--${prefix}-color-info-contrastText)`,\n main: `var(--${prefix}-color-info-main)`,\n },\n primary: {\n contrastText: `var(--${prefix}-color-primary-contrastText)`,\n main: `var(--${prefix}-color-primary-main)`,\n },\n secondary: {\n contrastText: `var(--${prefix}-color-secondary-contrastText)`,\n main: `var(--${prefix}-color-secondary-main)`,\n },\n success: {\n contrastText: `var(--${prefix}-color-success-contrastText)`,\n main: `var(--${prefix}-color-success-main)`,\n },\n text: {\n primary: `var(--${prefix}-color-text-primary)`,\n secondary: `var(--${prefix}-color-text-secondary)`,\n },\n warning: {\n contrastText: `var(--${prefix}-color-warning-contrastText)`,\n main: `var(--${prefix}-color-warning-main)`,\n },\n },\n shadows: {\n large: `var(--${prefix}-shadow-large)`,\n medium: `var(--${prefix}-shadow-medium)`,\n small: `var(--${prefix}-shadow-small)`,\n },\n spacing: {\n unit: `var(--${prefix}-spacing-unit)`,\n },\n typography: {\n fontFamily: `var(--${prefix}-typography-fontFamily)`,\n fontSizes: {\n '2xl': `var(--${prefix}-typography-fontSize-2xl)`,\n '3xl': `var(--${prefix}-typography-fontSize-3xl)`,\n lg: `var(--${prefix}-typography-fontSize-lg)`,\n md: `var(--${prefix}-typography-fontSize-md)`,\n sm: `var(--${prefix}-typography-fontSize-sm)`,\n xl: `var(--${prefix}-typography-fontSize-xl)`,\n xs: `var(--${prefix}-typography-fontSize-xs)`,\n },\n fontWeights: {\n bold: `var(--${prefix}-typography-fontWeight-bold)`,\n medium: `var(--${prefix}-typography-fontWeight-medium)`,\n normal: `var(--${prefix}-typography-fontWeight-normal)`,\n semibold: `var(--${prefix}-typography-fontWeight-semibold)`,\n },\n lineHeights: {\n normal: `var(--${prefix}-typography-lineHeight-normal)`,\n relaxed: `var(--${prefix}-typography-lineHeight-relaxed)`,\n tight: `var(--${prefix}-typography-lineHeight-tight)`,\n },\n },\n };\n\n // Add images if they exist\n if (theme.images) {\n themeVars.images = {};\n Object.keys(theme.images).forEach((imageKey: string) => {\n const imageConfig: ThemeImage | undefined = theme.images![imageKey];\n themeVars.images![imageKey] = {\n alt: imageConfig?.alt ? `var(--${prefix}-image-${imageKey}-alt)` : undefined,\n title: imageConfig?.title ? `var(--${prefix}-image-${imageKey}-title)` : undefined,\n url: imageConfig?.url ? `var(--${prefix}-image-${imageKey}-url)` : undefined,\n };\n });\n }\n\n if (Object.keys(componentVars).length > 0) {\n themeVars.components = componentVars;\n }\n\n return themeVars;\n};\n\nconst createTheme = (config: RecursivePartial<ThemeConfig> = {}, isDark: boolean = false): Theme => {\n const baseTheme: ThemeConfig = isDark ? darkTheme : lightTheme;\n\n const mergedConfig: ThemeConfig = {\n ...baseTheme,\n ...config,\n borderRadius: {\n ...baseTheme.borderRadius,\n ...config.borderRadius,\n },\n colors: {\n ...baseTheme.colors,\n ...config.colors,\n action: {\n ...baseTheme.colors.action,\n ...(config.colors?.action || {}),\n },\n secondary: {\n ...baseTheme.colors.secondary,\n ...(config.colors?.secondary || {}),\n },\n },\n images: {\n ...baseTheme.images,\n ...config.images,\n },\n shadows: {\n ...baseTheme.shadows,\n ...config.shadows,\n },\n spacing: {\n ...baseTheme.spacing,\n ...config.spacing,\n },\n typography: {\n ...baseTheme.typography,\n ...config.typography,\n fontSizes: {\n ...baseTheme.typography.fontSizes,\n ...(config.typography?.fontSizes || {}),\n },\n fontWeights: {\n ...baseTheme.typography.fontWeights,\n ...(config.typography?.fontWeights || {}),\n },\n lineHeights: {\n ...baseTheme.typography.lineHeights,\n ...(config.typography?.lineHeights || {}),\n },\n },\n } as ThemeConfig;\n\n return {\n ...mergedConfig,\n cssVariables: toCssVariables(mergedConfig),\n vars: toThemeVars(mergedConfig),\n };\n};\n\nexport const DEFAULT_THEME: ThemeMode = 'light';\n\nexport default createTheme;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Converts an ArrayBuffer to a base64url encoded string.\n *\n * Base64url encoding is a URL-safe variant of base64 encoding that:\n * - Replaces '+' with '-'\n * - Replaces '/' with '_'\n * - Removes padding '=' characters\n *\n * This encoding is commonly used in JWT tokens, OAuth2 PKCE challenges,\n * and other web standards where the encoded data needs to be safely\n * transmitted in URLs or HTTP headers.\n *\n * @param buffer - The ArrayBuffer to convert to base64url string\n * @returns The base64url encoded string representation of the input buffer\n *\n * @example\n * ```typescript\n * const buffer = new TextEncoder().encode('Hello World');\n * const encoded = arrayBufferToBase64url(buffer);\n * console.log(encoded); // \"SGVsbG8gV29ybGQ\"\n * ```\n *\n * @example\n * ```typescript\n * // Converting crypto random bytes for PKCE challenge\n * const randomBytes = crypto.getRandomValues(new Uint8Array(32));\n * const codeVerifier = arrayBufferToBase64url(randomBytes.buffer);\n * ```\n */\nconst arrayBufferToBase64url = (buffer: ArrayBuffer): string => {\n const bytes: Uint8Array<ArrayBuffer> = new Uint8Array(buffer);\n let binary: string = '';\n\n for (let i: number = 0; i < bytes.byteLength; i += 1) {\n binary += String.fromCharCode(bytes[i]);\n }\n\n return btoa(binary).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');\n};\n\nexport default arrayBufferToBase64url;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Converts a base64url encoded string back to an ArrayBuffer.\n *\n * This function performs the inverse operation of base64url encoding by:\n * - Replacing URL-safe characters: '-' becomes '+', '_' becomes '/'\n * - Adding back padding '=' characters that were removed during base64url encoding\n * - Decoding the resulting base64 string to binary data\n * - Converting the binary data to an ArrayBuffer\n *\n * This is commonly used for decoding JWT tokens, OAuth2 PKCE code verifiers,\n * and other cryptographic data that was encoded using base64url format.\n *\n * @param base64url - The base64url encoded string to decode\n * @returns The ArrayBuffer containing the decoded binary data\n *\n * @throws {DOMException} Throws an error if the input string is not valid base64url\n *\n * @example\n * ```typescript\n * const encoded = 'SGVsbG8gV29ybGQ';\n * const buffer = base64urlToArrayBuffer(encoded);\n * const text = new TextDecoder().decode(buffer);\n * console.log(text); // \"Hello World\"\n * ```\n *\n * @example\n * ```typescript\n * // Decoding a JWT payload\n * const jwtPayload = 'eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ';\n * const payloadBuffer = base64urlToArrayBuffer(jwtPayload);\n * const payloadJson = new TextDecoder().decode(payloadBuffer);\n * const payload = JSON.parse(payloadJson);\n * ```\n *\n * @see {@link arrayBufferToBase64url} - The inverse function for encoding ArrayBuffer to base64url\n */\nconst base64urlToArrayBuffer = (base64url: string): ArrayBuffer => {\n const padding: string = '='.repeat((4 - (base64url.length % 4)) % 4);\n const base64: string = base64url.replace(/-/g, '+').replace(/_/g, '/') + padding;\n\n const binaryString: string = atob(base64);\n const bytes: Uint8Array<ArrayBuffer> = new Uint8Array(binaryString.length);\n\n for (let i: number = 0; i < binaryString.length; i += 1) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n\n return bytes.buffer;\n};\n\nexport default base64urlToArrayBuffer;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Creates a BEM-style class name by combining a base class with element and/or modifier\n *\n * @param baseClass - The base CSS class string (usually from emotion's css function)\n * @param element - The BEM element name (optional)\n * @param modifier - The BEM modifier name (optional)\n * @returns The combined class name string\n *\n * @example\n * ```tsx\n * const baseClass = css`\n * display: flex;\n * &__element {\n * color: red;\n * }\n * &--modifier {\n * background: blue;\n * }\n * `;\n *\n * import bem from './utils/bem';\n *\n * const elementClass = bem(baseClass, 'element');\n * const modifierClass = bem(baseClass, null, 'modifier');\n * const elementWithModifierClass = bem(baseClass, 'element', 'modifier');\n * ```\n */\nconst bem = (baseClass: string, element?: string | null, modifier?: string | null): string => {\n let className: string = baseClass;\n\n if (element) {\n className += `__${element}`;\n }\n\n if (modifier) {\n className += `--${modifier}`;\n }\n\n return className;\n};\n\nexport default bem;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Formats a date string to a human-readable format.\n *\n * @param dateString - The date string to format (optional)\n * @returns A formatted date string in 'Month Day, Year' format, or '-' if no date is provided, or the original string if parsing fails\n *\n * @example\n * ```typescript\n * formatDate('2025-07-09T10:30:00Z'); // Returns \"July 9, 2025\"\n * formatDate(''); // Returns \"-\"\n * formatDate(undefined); // Returns \"-\"\n * formatDate('invalid-date'); // Returns \"invalid-date\"\n * ```\n */\nconst formatDate = (dateString?: string): string => {\n if (!dateString) return '-';\n\n try {\n return new Date(dateString).toLocaleDateString('en-US', {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n });\n } catch {\n return dateString;\n }\n};\n\nexport default formatDate;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Log levels enum\n */\nexport type LogLevel = 'debug' | 'info' | 'warn' | 'error';\n\n/**\n * Logger configuration interface\n */\nexport interface LoggerConfig {\n /** Custom log formatter function */\n formatter?: (level: LogLevel, message: string, ...args: any[]) => void;\n /** Minimum log level to output */\n level: LogLevel;\n /** Custom prefix for all log messages */\n prefix?: string;\n /** Whether to include log level in output */\n showLevel?: boolean;\n /** Whether to include timestamps */\n timestamps?: boolean;\n}\n\nconst PREFIX: string = '\uD83D\uDEE1\uFE0F Asgardeo';\n\n/**\n * Default logger configuration\n */\nconst DEFAULT_CONFIG: LoggerConfig = {\n level: 'info',\n prefix: `${PREFIX}`,\n showLevel: true,\n timestamps: true,\n};\n\n/**\n * Environment detection utilities\n */\nconst isBrowser = (): boolean =>\n /* @ts-ignore */\n typeof window !== 'undefined' && typeof window.document !== 'undefined';\nconst isNode = (): boolean =>\n /* @ts-ignore */\n typeof process !== 'undefined' && process.versions && process.versions.node;\n/**\n * Color codes for terminal output (Node.js)\n */\nconst COLORS: {\n blue: string;\n bright: string;\n cyan: string;\n dim: string;\n gray: string;\n green: string;\n magenta: string;\n red: string;\n reset: string;\n white: string;\n yellow: string;\n} = {\n blue: '\\x1b[34m',\n bright: '\\x1b[1m',\n cyan: '\\x1b[36m',\n dim: '\\x1b[2m',\n gray: '\\x1b[90m',\n green: '\\x1b[32m',\n magenta: '\\x1b[35m',\n red: '\\x1b[31m',\n reset: '\\x1b[0m',\n white: '\\x1b[37m',\n yellow: '\\x1b[33m',\n};\n\n/**\n * Browser console styling\n */\nconst BROWSER_STYLES: {\n debug: string;\n error: string;\n info: string;\n prefix: string;\n timestamp: string;\n warn: string;\n} = {\n debug: 'color: #6b7280; font-weight: normal;',\n error: 'color: #dc2626; font-weight: bold;',\n info: 'color: #2563eb; font-weight: bold;',\n prefix: 'color: #7c3aed; font-weight: bold;',\n timestamp: 'color: #6b7280; font-size: 0.9em;',\n warn: 'color: #d97706; font-weight: bold;',\n};\n\nconst LOG_LEVEL_ORDER: Record<LogLevel, number> = {\n debug: 0,\n error: 3,\n info: 1,\n warn: 2,\n};\n\n/**\n * Universal logger class that works in both browser and Node.js environments\n */\nclass Logger {\n private config: LoggerConfig;\n\n constructor(config: Partial<LoggerConfig> = {}) {\n this.config = {...DEFAULT_CONFIG, ...config};\n }\n\n /**\n * Update logger configuration\n */\n configure(config: Partial<LoggerConfig>): void {\n this.config = {...this.config, ...config};\n }\n\n /**\n * Get current configuration\n */\n getConfig(): LoggerConfig {\n return {...this.config};\n }\n\n /**\n * Check if a log level should be output\n */\n private shouldLog(level: LogLevel): boolean {\n return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.config.level];\n }\n\n /**\n * Get timestamp string\n */\n private static getTimestamp(): string {\n return new Date().toISOString();\n }\n\n /**\n * Get log level string\n */\n private static getLevelString(level: LogLevel): string {\n switch (level) {\n case 'debug':\n return 'DEBUG';\n case 'info':\n return 'INFO';\n case 'warn':\n return 'WARN';\n case 'error':\n return 'ERROR';\n default:\n return 'UNKNOWN';\n }\n }\n\n /**\n * Format message for Node.js terminal\n */\n private formatForNode(level: LogLevel, message: string): string {\n const parts: string[] = [];\n\n // Add timestamp\n if (this.config.timestamps) {\n parts.push(`${COLORS.gray}[${Logger.getTimestamp()}]${COLORS.reset}`);\n }\n\n // Add prefix\n if (this.config.prefix) {\n parts.push(`${COLORS.magenta}${this.config.prefix}${COLORS.reset}`);\n }\n\n // Add log level\n if (this.config.showLevel) {\n const levelStr: string = Logger.getLevelString(level);\n let coloredLevel: string;\n\n switch (level) {\n case 'debug':\n coloredLevel = `${COLORS.gray}[${levelStr}]${COLORS.reset}`;\n break;\n case 'info':\n coloredLevel = `${COLORS.blue}[${levelStr}]${COLORS.reset}`;\n break;\n case 'warn':\n coloredLevel = `${COLORS.yellow}[${levelStr}]${COLORS.reset}`;\n break;\n case 'error':\n coloredLevel = `${COLORS.red}[${levelStr}]${COLORS.reset}`;\n break;\n default:\n coloredLevel = `[${levelStr}]`;\n }\n parts.push(coloredLevel);\n }\n\n // Add message\n parts.push(message);\n\n return parts.join(' ');\n }\n\n /**\n * Log message using appropriate method\n */\n private logMessage(level: LogLevel, message: string, ...args: any[]): void {\n if (!this.shouldLog(level)) {\n return;\n }\n\n // Use custom formatter if provided\n if (this.config.formatter) {\n this.config.formatter(level, message, ...args);\n return;\n }\n\n if (isBrowser()) {\n this.logToBrowser(level, message, ...args);\n } else if (isNode()) {\n this.logToNode(level, message, ...args);\n } else {\n // Fallback for other environments\n // eslint-disable-next-line no-console\n console.log(message, ...args);\n }\n }\n\n /**\n * Log to browser console with styling\n */\n private logToBrowser(level: LogLevel, message: string, ...args: any[]): void {\n const parts: string[] = [];\n const styles: string[] = [];\n\n // Add timestamp\n if (this.config.timestamps) {\n parts.push(`%c[${Logger.getTimestamp()}]`);\n styles.push(BROWSER_STYLES.timestamp);\n }\n\n // Add prefix\n if (this.config.prefix) {\n parts.push(`%c${this.config.prefix}`);\n styles.push(BROWSER_STYLES.prefix);\n }\n\n // Add log level and message\n if (this.config.showLevel) {\n const levelStr: string = Logger.getLevelString(level);\n parts.push(`%c[${levelStr}]`);\n\n switch (level) {\n case 'debug':\n styles.push(BROWSER_STYLES.debug);\n break;\n case 'info':\n styles.push(BROWSER_STYLES.info);\n break;\n case 'warn':\n styles.push(BROWSER_STYLES.warn);\n break;\n case 'error':\n styles.push(BROWSER_STYLES.error);\n break;\n default:\n styles.push('');\n }\n }\n\n parts.push(`%c${message}`);\n styles.push('color: inherit; font-weight: normal;');\n\n const formattedMessage: string = parts.join(' ');\n\n // Use appropriate console method\n switch (level) {\n case 'debug':\n // eslint-disable-next-line no-console\n console.debug(formattedMessage, ...styles, ...args);\n break;\n case 'info':\n // eslint-disable-next-line no-console\n console.info(formattedMessage, ...styles, ...args);\n break;\n case 'warn':\n // eslint-disable-next-line no-console\n console.warn(formattedMessage, ...styles, ...args);\n break;\n case 'error':\n // eslint-disable-next-line no-console\n console.error(formattedMessage, ...styles, ...args);\n break;\n default:\n // eslint-disable-next-line no-console\n console.log(formattedMessage, ...styles, ...args);\n }\n }\n\n /**\n * Log to Node.js console\n */\n private logToNode(level: LogLevel, message: string, ...args: any[]): void {\n const formattedMessage: string = this.formatForNode(level, message);\n\n // Use appropriate console method\n switch (level) {\n case 'debug':\n // eslint-disable-next-line no-console\n console.debug(formattedMessage, ...args);\n break;\n case 'info':\n // eslint-disable-next-line no-console\n console.info(formattedMessage, ...args);\n break;\n case 'warn':\n // eslint-disable-next-line no-console\n console.warn(formattedMessage, ...args);\n break;\n case 'error':\n // eslint-disable-next-line no-console\n console.error(formattedMessage, ...args);\n break;\n default:\n // eslint-disable-next-line no-console\n console.log(formattedMessage, ...args);\n }\n }\n\n /**\n * Log debug message\n */\n debug(message: string, ...args: any[]): void {\n this.logMessage('debug', message, ...args);\n }\n\n /**\n * Log info message\n */\n info(message: string, ...args: any[]): void {\n this.logMessage('info', message, ...args);\n }\n\n /**\n * Log warning message\n */\n warn(message: string, ...args: any[]): void {\n this.logMessage('warn', message, ...args);\n }\n\n /**\n * Log error message\n */\n error(message: string, ...args: any[]): void {\n this.logMessage('error', message, ...args);\n }\n\n /**\n * Create a child logger with additional prefix\n */\n child(prefix: string): Logger {\n const childPrefix: string = this.config.prefix ? `${this.config.prefix} - ${prefix}` : prefix;\n return new Logger({\n ...this.config,\n prefix: childPrefix,\n });\n }\n\n /**\n * Set log level\n */\n setLevel(level: LogLevel): void {\n this.config.level = level;\n }\n\n /**\n * Get current log level\n */\n getLevel(): LogLevel {\n return this.config.level;\n }\n}\n\n/**\n * Default logger instance\n */\nconst logger: Logger = new Logger();\n\n/**\n * Create a new logger instance with custom configuration\n */\nexport const createLogger = (config?: Partial<LoggerConfig>): Logger => new Logger(config);\n\n/**\n * Default export - global logger instance\n */\nexport default logger;\n\n/**\n * Named exports for convenience\n */\nexport const debug = (message: string, ...args: any[]): void => logger.debug(message, ...args);\nexport const info = (message: string, ...args: any[]): void => logger.info(message, ...args);\nexport const warn = (message: string, ...args: any[]): void => logger.warn(message, ...args);\nexport const error = (message: string, ...args: any[]): void => logger.error(message, ...args);\n\n/**\n * Configure the default logger\n */\nexport const configure = (config: Partial<LoggerConfig>): void => logger.configure(config);\n\n/**\n * Create component-specific loggers\n */\nexport const createComponentLogger = (component: string): Logger => logger.child(component);\n\n/**\n * Create package-specific logger\n */\nexport const createPackageLogger = (packageName: string): Logger =>\n createLogger({\n level: 'info',\n prefix: `${PREFIX} - ${packageName}`,\n showLevel: true,\n timestamps: true,\n });\n\n/**\n * Create package component logger (package + component)\n */\nexport const createPackageComponentLogger = (packageName: string, component: string): Logger => {\n const packageLogger: Logger = createPackageLogger(packageName);\n return packageLogger.child(component);\n};\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport logger from './logger';\nimport AsgardeoRuntimeError from '../errors/AsgardeoRuntimeError';\n\n/**\n * Extracts the organization handle from an Asgardeo base URL.\n *\n * This function parses Asgardeo URLs with the standard pattern:\n * - https://dev.asgardeo.io/t/{orgHandle}\n * - https://stage.asgardeo.io/t/{orgHandle}\n * - https://prod.asgardeo.io/t/{orgHandle}\n * - https://{subdomain}.asgardeo.io/t/{orgHandle}\n *\n * @param baseUrl - The base URL of the Asgardeo identity server\n * @returns The extracted organization handle\n * @throws {AsgardeoRuntimeError} When the URL doesn't match the expected Asgardeo pattern,\n * indicating a custom domain is configured and organizationHandle must be provided explicitly\n *\n * @example\n * ```typescript\n * // Standard Asgardeo URLs\n * const handle1 = deriveOrganizationHandleFromBaseUrl('https://dev.asgardeo.io/t/dxlab');\n * // Returns: 'dxlab'\n *\n * const handle2 = deriveOrganizationHandleFromBaseUrl('https://stage.asgardeo.io/t/myorg');\n * // Returns: 'myorg'\n *\n * // Custom domain - returns empty string with a warning\n * const handle2 = deriveOrganizationHandleFromBaseUrl('https://custom.example.com/auth');\n * // Returns: '' and logs a warning\n * ```\n */\nconst deriveOrganizationHandleFromBaseUrl = (baseUrl?: string): string => {\n if (!baseUrl) {\n throw new AsgardeoRuntimeError(\n 'Base URL is required to derive organization handle.',\n 'javascript-deriveOrganizationHandleFromBaseUrl-ValidationError-001',\n 'javascript',\n 'A valid base URL must be provided to extract the organization handle.',\n );\n }\n\n let parsedUrl: URL;\n\n try {\n parsedUrl = new URL(baseUrl);\n } catch (error) {\n throw new AsgardeoRuntimeError(\n `Invalid base URL format: ${baseUrl}`,\n 'javascript-deriveOrganizationHandleFromBaseUrl-ValidationError-002',\n 'javascript',\n 'The provided base URL does not conform to valid URL syntax.',\n );\n }\n\n // Extract the organization handle from the path pattern: /t/{orgHandle}\n const pathSegments: string[] = parsedUrl.pathname?.split('/')?.filter((segment: string) => segment?.length > 0);\n\n if (pathSegments.length < 2 || pathSegments[0] !== 't') {\n logger.warn(\n new AsgardeoRuntimeError(\n 'Organization handle is required since a custom domain is configured.',\n 'javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-002',\n 'javascript',\n 'The provided base URL does not follow the expected URL pattern (/t/{orgHandle}). Please provide the organizationHandle explicitly in the configuration.',\n ).toString(),\n );\n\n return '';\n }\n\n const organizationHandle: string = pathSegments[1];\n\n if (!organizationHandle || organizationHandle.trim().length === 0) {\n logger.warn(\n new AsgardeoRuntimeError(\n 'Organization handle is required since a custom domain is configured.',\n 'javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-003',\n 'javascript',\n 'The organization handle could not be extracted from the base URL. Please provide the organizationHandle explicitly in the configuration.',\n ).toString(),\n );\n\n return '';\n }\n\n return organizationHandle;\n};\n\nexport default deriveOrganizationHandleFromBaseUrl;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport logger from './logger';\nimport AsgardeoRuntimeError from '../errors/AsgardeoRuntimeError';\n\n/**\n * Utility to determine if sensible Asgardeo fallbacks can be used based on the given base URL.\n *\n * This checks if the URL follows the standard Asgardeo pattern: /t/{orgHandle}\n * Returns true if sensible fallbacks (like deriving organization handle, tenant, etc.) can be used, false otherwise.\n *\n * @param baseUrl - The base URL of the Asgardeo identity server (string or undefined)\n * @returns boolean - true if sensible fallbacks can be used, false otherwise\n *\n * @example\n * isRecognizedBaseUrlPattern('https://dev.asgardeo.io/t/dxlab'); // true\n * isRecognizedBaseUrlPattern('https://custom.example.com/auth'); // false\n */\nconst isRecognizedBaseUrlPattern = (baseUrl: string | undefined): boolean => {\n if (!baseUrl) {\n throw new AsgardeoRuntimeError(\n 'Base URL is required to derive if the `baseUrl` is recognized.',\n 'isRecognizedBaseUrlPattern-ValidationError-001',\n 'javascript',\n 'A valid base URL must be provided to derive if the `baseUrl` is recognized to use the sensible fallbacks.',\n );\n }\n\n let parsedUrl: URL;\n\n try {\n parsedUrl = new URL(baseUrl);\n } catch (error) {\n throw new AsgardeoRuntimeError(\n `Invalid base URL format: ${baseUrl}`,\n 'isRecognizedBaseUrlPattern-ValidationError-002',\n 'javascript',\n 'The provided base URL does not conform to valid URL syntax.',\n );\n }\n\n // Extract the organization handle from the path pattern: /t/{orgHandle}\n const pathSegments: string[] = parsedUrl.pathname?.split('/')?.filter((segment: string) => segment?.length > 0);\n\n if (pathSegments.length < 2 || pathSegments[0] !== 't') {\n logger.warn(\n '[isRecognizedBaseUrlPattern] The provided base URL does not follow the expected URL pattern (/t/{orgHandle}).',\n );\n\n return false;\n }\n\n return true;\n};\n\nexport default isRecognizedBaseUrlPattern;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {Schema, FlattenedSchema} from '../models/scim2-schema';\n\n/**\n * Flattens nested schema attributes into a flat structure for easier processing\n *\n * This function processes SCIM2 schemas and creates a flattened representation by:\n * - Processing sub-attributes and creating dot-notation names (e.g., 'name.givenName')\n * - Adding schema ID reference to each flattened attribute\n * - Preserving all original attribute properties while adding schema context\n * - Only including leaf-level attributes (sub-attributes) and top-level simple attributes\n *\n * @param schemas - Array of SCIM2 schemas containing nested attribute structures\n * @returns Array of flattened schema attributes with dot-notation names and schema references\n *\n * @example\n * ```typescript\n * const schemas = [\n * {\n * id: 'urn:ietf:params:scim:schemas:core:2.0:User',\n * attributes: [\n * {\n * name: 'userName',\n * type: 'string',\n * multiValued: false\n * },\n * {\n * name: 'name',\n * type: 'complex',\n * multiValued: false,\n * subAttributes: [\n * { name: 'givenName', type: 'string', multiValued: false },\n * { name: 'familyName', type: 'string', multiValued: false }\n * ]\n * }\n * ]\n * }\n * ];\n *\n * const flattened = flattenUserSchema(schemas);\n * // Result: [\n * // { name: 'userName', type: 'string', multiValued: false, schemaId: 'urn:ietf:params:scim:schemas:core:2.0:User' },\n * // { name: 'name.givenName', type: 'string', multiValued: false, schemaId: 'urn:ietf:params:scim:schemas:core:2.0:User' },\n * // { name: 'name.familyName', type: 'string', multiValued: false, schemaId: 'urn:ietf:params:scim:schemas:core:2.0:User' }\n * // ]\n * ```\n */\nconst flattenUserSchema = (schemas: Schema[]): FlattenedSchema[] => {\n const flattenedAttributes: FlattenedSchema[] = [];\n\n schemas.forEach((schema: Schema) => {\n if (schema.attributes && Array.isArray(schema.attributes)) {\n schema.attributes.forEach((attribute: any) => {\n // If the attribute has sub-attributes, only add the flattened sub-attributes\n if (attribute.subAttributes && Array.isArray(attribute.subAttributes)) {\n attribute.subAttributes.forEach((subAttribute: any) => {\n flattenedAttributes.push({\n ...subAttribute,\n name: `${attribute.name}.${subAttribute.name}`,\n schemaId: schema.id,\n } as unknown as FlattenedSchema);\n });\n } else {\n // If it's a simple attribute (no sub-attributes), add it directly\n flattenedAttributes.push({\n ...attribute,\n schemaId: schema.id,\n } as unknown as FlattenedSchema);\n }\n });\n }\n });\n\n return flattenedAttributes;\n};\n\nexport default flattenUserSchema;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Gets the value at path of object. If the resolved value is undefined,\n * the defaultValue is returned in its place.\n * Similar to Lodash's get() function\n *\n * @param object - The object to query\n * @param path - The path of the property to get\n * @param defaultValue - The value returned for undefined resolved values\n * @returns The resolved value\n */\nconst get = (object: any, path: string | string[], defaultValue?: any): any => {\n if (!object || !path) return defaultValue;\n\n const pathArray: string[] = Array.isArray(path) ? path : path.split('.');\n\n const result: any = pathArray.reduce((current: any, key: string) => current?.[key], object);\n\n return result !== undefined ? result : defaultValue;\n};\n\nexport default get;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Sets the value at path of object. If a portion of path doesn't exist,\n * it's created. Arrays are created for missing index properties while\n * objects are created for all other missing properties.\n * Similar to Lodash's set() function\n *\n * @param object - The object to modify\n * @param path - The path of the property to set\n * @param value - The value to set\n * @returns The object\n */\nconst set = (object: any, path: string | string[], value: any): any => {\n if (!object || !path) return object;\n\n const pathArray: string[] = Array.isArray(path) ? path : path.split('.');\n const lastIndex: number = pathArray.length - 1;\n\n pathArray.reduce((current: any, key: string, index: number) => {\n if (index === lastIndex) {\n // eslint-disable-next-line no-param-reassign\n current[key] = value;\n } else if (!(key in current) || typeof current[key] !== 'object' || current[key] === null) {\n // Create array if next key is numeric, otherwise create object\n const nextKey: string = pathArray[index + 1];\n // eslint-disable-next-line no-param-reassign\n current[key] = /^\\d+$/.test(nextKey) ? [] : {};\n }\n return current[key];\n }, object);\n\n return object;\n};\n\nexport default set;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport get from './get';\nimport set from './set';\nimport {User} from '../models/user';\n\n/**\n * Creates a profile structure from ME response based on processed schemas\n *\n * This function processes each schema attribute and populates the profile dynamically by:\n * - Extracting values from the ME response using the schema attribute names\n * - Handling multi-valued attributes by converting single values to arrays when needed\n * - Setting appropriate default values based on schema type and multiValued properties\n * - Using dynamic property setting to build the final profile object\n *\n * @param meResponse - The ME API response containing user data\n * @param processedSchemas - The processed and flattened schemas with name, type, and multiValued properties\n * @returns Flat profile object with dynamically populated user attributes\n *\n * @example\n * ```typescript\n * const meResponse = {\n * userName: 'john.doe',\n * emails: ['john@example.com', 'john.doe@work.com'],\n * name: { givenName: 'John', familyName: 'Doe' }\n * };\n *\n * const schemas = [\n * { name: 'userName', type: 'STRING', multiValued: false },\n * { name: 'emails', type: 'STRING', multiValued: true },\n * { name: 'name.givenName', type: 'STRING', multiValued: false }\n * ];\n *\n * const profile = generateUserProfile(meResponse, schemas);\n * // Result: {\n * // userName: 'john.doe',\n * // emails: ['john@example.com', 'john.doe@work.com'],\n * // 'name.givenName': 'John'\n * // }\n * ```\n */\nconst generateUserProfile = (meResponse: any, processedSchemas: any[]): User => {\n const profile: User = {};\n\n processedSchemas.forEach((schema: any) => {\n const {name, type, multiValued} = schema;\n\n if (!name) return;\n\n let value: any = get(meResponse, name);\n\n if (value !== undefined) {\n if (multiValued && !Array.isArray(value)) {\n value = [value];\n }\n } else if (multiValued) {\n value = undefined;\n } else if (type === 'STRING') {\n value = '';\n } else {\n value = undefined;\n }\n\n set(profile, name, value);\n });\n\n return profile;\n};\n\nexport default generateUserProfile;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport generateStateParamForRequestCorrelation from './generateStateParamForRequestCorrelation';\nimport PKCEConstants from '../constants/PKCEConstants';\nimport {TemporaryStore} from '../models/store';\n\n/**\n * Gets the latest PKCE storage key from the temporary store.\n *\n * @param tempStore - The object that holds temporary PKCE-related data (e.g., sessionStorage).\n * @returns The latest PKCE storage key or null if no keys exist.\n */\nconst getLatestPkceStorageKey = (tempStore: TemporaryStore): string | null => {\n const keys: string[] = [];\n\n Object.keys(tempStore).forEach((key: string) => {\n if (key.startsWith(PKCEConstants.Storage.StorageKeys.CODE_VERIFIER)) {\n keys.push(key);\n }\n });\n\n const lastKey: string | undefined = keys.sort().pop();\n\n return lastKey ?? null;\n};\n\n/**\n * Finds the latest state parameter based on the most recent PKCE storage key.\n *\n * This utility combines the functionality of finding the latest PKCE key and generating\n * the corresponding state parameter for request correlation.\n *\n * @param tempStore - The object that holds temporary PKCE-related data (e.g., sessionStorage).\n * @param state - Optional state string to prepend to the request correlation.\n * @returns The latest state parameter string or null if no PKCE keys exist.\n *\n * @example\n * const latestState = getLatestStateParam(sessionStorage, \"myState\");\n * // Returns: \"myState_request_2\" (if latest PKCE key is pkce_code_verifier_2)\n *\n * const latestStateNoPrefix = getLatestStateParam(sessionStorage);\n * // Returns: \"request_2\" (if latest PKCE key is pkce_code_verifier_2)\n *\n * const noKeys = getLatestStateParam(emptyStorage);\n * // Returns: null (if no PKCE keys exist)\n */\nconst getLatestStateParam = (tempStore: TemporaryStore, state?: string): string | null => {\n const latestPkceKey: string | null = getLatestPkceStorageKey(tempStore);\n\n if (!latestPkceKey) {\n return null;\n }\n\n return generateStateParamForRequestCorrelation(latestPkceKey, state);\n};\n\nexport default getLatestStateParam;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport get from './get';\nimport {User} from '../models/user';\n\n/**\n * Generates a flattened user profile from a response object and schema definitions.\n *\n * This function processes user data according to schema specifications, creating\n * a flat object with dot notation keys instead of nested objects. Multi-valued\n * properties and type-specific defaults are handled appropriately.\n *\n * Additionally, any fields present in the response but not defined in the schema\n * will be included to ensure no user data is lost during flattening.\n *\n * @param meResponse - The response object containing user data\n * @param processedSchemas - Array of schema objects defining field properties\n * @param processedSchemas[].name - The field name/path for the property\n * @param processedSchemas[].type - The data type of the field (e.g., 'STRING')\n * @param processedSchemas[].multiValued - Whether the field can contain multiple values\n *\n * @returns A flattened user profile object with dot notation keys\n *\n * @example\n * ```typescript\n * const schemas = [\n * { name: 'name.givenName', type: 'STRING', multiValued: false },\n * { name: 'emails', type: 'STRING', multiValued: true }\n * ];\n * const response = {\n * name: { givenName: 'John' },\n * emails: 'john@example.com',\n * country: 'US' // This will be included even if not in schema\n * };\n * const profile = generateFlattenedUserProfile(response, schemas);\n * // Result: { \"name.givenName\": 'John', emails: ['john@example.com'], country: 'US' }\n * ```\n */\nconst generateFlattenedUserProfile = (meResponse: any, processedSchemas: any[]): User => {\n const profile: User = {};\n\n const allSchemaNames: string[] = processedSchemas.map((schema: any) => schema.name).filter(Boolean);\n\n // First, process all schema-defined fields\n processedSchemas.forEach((schema: any) => {\n const {name, type, multiValued} = schema;\n\n if (!name) return;\n\n // Skip this property if it's a parent of other flattened properties\n // e.g., skip \"name\" if \"name.givenName\" or \"name.familyName\" exists\n // skip \"roles\" if \"roles.default\" exists\n const hasChildProperties: boolean = allSchemaNames.some(\n (schemaName: string) => schemaName !== name && schemaName.startsWith(`${name}.`),\n );\n\n if (hasChildProperties) {\n // Skip this parent property\n return;\n }\n\n let value: any = get(meResponse, name);\n\n // SCIM2 multi-valued complex attributes (phoneNumbers, emails, ims, ...)\n // are stored as arrays of typed objects: [{type: \"mobile\", value: \"...\"}].\n // The schema flattens them as `<attr>.<type>` (e.g. \"phoneNumbers.mobile\"),\n // so when the dotted lookup misses, fall back to filtering the array by\n // `type` and reading `.value`.\n if (value === undefined) {\n const dotIndex: number = name.indexOf('.');\n if (dotIndex > 0) {\n const head: string = name.slice(0, dotIndex);\n const tail: string = name.slice(dotIndex + 1);\n const arr: any = meResponse[head];\n if (Array.isArray(arr)) {\n const match: any = arr.find((item: any) => item && item.type === tail);\n if (match && match.value !== undefined) {\n value = match.value;\n }\n }\n }\n }\n\n // If value not found at top level, check within schema namespaces\n if (value === undefined) {\n const schemaNamespaces: string[] = [\n 'urn:ietf:params:scim:schemas:core:2.0:User',\n 'urn:ietf:params:scim:schemas:extension:enterprise:2.0:User',\n 'urn:scim:wso2:schema',\n 'urn:scim:schemas:extension:custom:User',\n ];\n\n schemaNamespaces.some((namespace: string) => {\n if (meResponse[namespace]) {\n // Try the field name directly within the namespace\n if (meResponse[namespace][name] !== undefined) {\n value = meResponse[namespace][name];\n return true; // Break out of some()\n }\n // Also try using get() for nested paths within the namespace\n const nestedValue: any = get(meResponse[namespace], name);\n if (nestedValue !== undefined) {\n value = nestedValue;\n return true; // Break out of some()\n }\n }\n return false;\n });\n }\n\n if (value !== undefined) {\n if (multiValued && !Array.isArray(value)) {\n value = [value];\n }\n } else if (multiValued) {\n value = undefined;\n } else if (type === 'STRING') {\n value = '';\n } else {\n value = undefined;\n }\n\n profile[name] = value;\n });\n\n // Then, include any additional fields from meResponse that aren't in the schema\n // This ensures fields like 'country' are not missed if they exist in the response\n const flattenObject = (obj: any, prefix: string = ''): void => {\n if (obj && typeof obj === 'object' && !Array.isArray(obj)) {\n Object.keys(obj).forEach((key: string) => {\n const fullKey: string = prefix ? `${prefix}.${key}` : key;\n const value: any = obj[key];\n\n // Skip if this field is already processed by schema\n if (Object.prototype.hasOwnProperty.call(profile, fullKey)) {\n return;\n }\n\n // Skip if this is a parent of schema-defined fields\n const hasSchemaChildProperties: boolean = allSchemaNames.some((schemaName: string) =>\n schemaName.startsWith(`${fullKey}.`),\n );\n\n if (hasSchemaChildProperties) {\n // Recursively process child properties\n flattenObject(value, fullKey);\n } else {\n // Include the field as-is\n profile[fullKey] = value;\n }\n });\n }\n };\n\n flattenObject(meResponse);\n\n return profile;\n};\n\nexport default generateFlattenedUserProfile;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport isRecognizedBaseUrlPattern from './isRecognizedBaseUrlPattern';\nimport logger from './logger';\nimport {Config} from '../models/config';\nimport {Platform} from '../models/platforms';\n\n/**\n * Identifies the platform based on the given base URL.\n *\n * If the URL is recognized and matches the Asgardeo domain, returns Platform.Asgardeo.\n * Otherwise, returns Platform.IdentityServer.\n *\n * @param baseUrl - The base URL to check\n * @returns Platform enum value\n */\nconst identifyPlatform = (config: Config): Platform => {\n const {baseUrl} = config;\n\n try {\n if (isRecognizedBaseUrlPattern(baseUrl)) {\n try {\n const url: URL = new URL(baseUrl!);\n // Check for asgardeo domain (e.g., api.asgardeo.io, etc.)\n if (/\\.asgardeo\\.io$/i.test(url.hostname) || /asgardeo\\.io$/i.test(url.hostname)) {\n return Platform.Asgardeo;\n }\n } catch {\n // Fallback to IdentityServer if URL parsing fails.\n logger.debug(\n `[identifyPlatform] Could not identify platform from the base URL: ${baseUrl}. Defaulting to WSO2 Identity Server as the platform.`,\n );\n }\n\n return Platform.IdentityServer;\n }\n\n return Platform.Unknown;\n } catch (error) {\n logger.debug(`[identifyPlatform] Error identifying platform from base URL: ${baseUrl}. Error: ${error.message}`);\n\n return Platform.Unknown;\n }\n};\n\nexport default identifyPlatform;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport identifyPlatform from './identifyPlatform';\nimport isRecognizedBaseUrlPattern from './isRecognizedBaseUrlPattern';\nimport logger from './logger';\nimport {Config} from '../models/config';\nimport {Platform} from '../models/platforms';\n\n/**\n * Utility to generate the redirect-based sign-up URL for Asgardeo.\n *\n * If the baseUrl is recognized (standard Asgardeo pattern), constructs the sign-up URL.\n * Otherwise, returns an empty string.\n *\n * @param baseUrl - The base URL of the Asgardeo identity server (string or undefined)\n * @returns The sign-up URL if baseUrl is recognized, otherwise an empty string\n */\nconst getRedirectBasedSignUpUrl = (config: Config): string => {\n const {baseUrl} = config;\n\n if (!isRecognizedBaseUrlPattern(baseUrl)) return '';\n\n let signUpBaseUrl: string = baseUrl;\n\n if (identifyPlatform(config) === Platform.Asgardeo) {\n try {\n const url: URL = new URL(baseUrl!);\n\n // Replace 'api.' with 'accounts.' in the hostname, preserving subdomains like 'dev.'\n if (/([a-z0-9-]+\\.)*api\\.asgardeo\\.io$/i.test(url.hostname)) {\n url.hostname = url.hostname.replace('api.', 'accounts.');\n signUpBaseUrl = url.toString().replace(/\\/$/, ''); // Remove trailing slash if any\n }\n } catch {\n logger.debug(\n `[getRedirectBasedSignUpUrl] Could not parse base URL to replace 'api.' with 'accounts.'. Base URL: ${baseUrl}`,\n );\n }\n }\n\n const url: URL = new URL(`${signUpBaseUrl}/accountrecoveryendpoint/register.do`);\n\n if (config.clientId) {\n url.searchParams.set('client_id', config.clientId);\n }\n\n if (config.applicationId) {\n url.searchParams.set('spId', config.applicationId);\n }\n\n logger.debug(`[getRedirectBasedSignUpUrl] Generated sign-up URL: ${url.toString()}`);\n\n return url.toString();\n};\n\nexport default getRedirectBasedSignUpUrl;\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nexport const EMOJI_URI_SCHEME: string = 'emoji:';\n\n/**\n * Checks whether a given URI uses the `emoji:` scheme (e.g. `\"emoji:\uD83D\uDC2F\"`).\n *\n * @param uri - The URI string to check.\n * @returns `true` if the URI starts with `\"emoji:\"`, `false` otherwise.\n *\n * @example\n * ```typescript\n * isEmojiUri(\"emoji:\uD83D\uDC2F\"); // true\n * isEmojiUri(\"https://example.com/logo.png\"); // false\n * isEmojiUri(\"\"); // false\n * ```\n */\nconst isEmojiUri = (uri: string): boolean => typeof uri === 'string' && uri.startsWith(EMOJI_URI_SCHEME);\n\nexport default isEmojiUri;\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport isEmojiUri, {EMOJI_URI_SCHEME} from './isEmojiUri';\n\n/**\n * Extracts the emoji character from an `emoji:` URI.\n *\n * @param uri - A URI string in the form `\"emoji:<emoji>\"`.\n * @returns The emoji character, or an empty string if the URI is not a valid emoji URI.\n *\n * @example\n * ```typescript\n * extractEmojiFromUri(\"emoji:\uD83D\uDC2F\"); // \"\uD83D\uDC2F\"\n * extractEmojiFromUri(\"https://example.com\"); // \"\"\n * ```\n */\nconst extractEmojiFromUri = (uri: string): string => {\n if (!isEmojiUri(uri)) {\n return '';\n }\n\n return uri.slice(EMOJI_URI_SCHEME.length);\n};\n\nexport default extractEmojiFromUri;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Removes a trailing slash from a path string if it exists.\n *\n * @param path - The string path to process\n * @returns The path without a trailing slash\n *\n * @example\n * ```typescript\n * removeTrailingSlash('/path/to/something/') // returns '/path/to/something'\n * removeTrailingSlash('/path/to/something') // returns '/path/to/something'\n * ```\n */\nconst removeTrailingSlash = (path: string): string => (path.endsWith('/') ? path.slice(0, -1) : path);\n\nexport default removeTrailingSlash;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoRuntimeError from '../errors/AsgardeoRuntimeError';\nimport {\n EmbeddedSignInFlowAuthenticatorExtendedParamType,\n EmbeddedSignInFlowAuthenticatorParamType,\n} from '../models/embedded-signin-flow';\nimport {FieldType} from '../models/field';\n\nconst resolveFieldType = (field: any): FieldType => {\n if (field.type === EmbeddedSignInFlowAuthenticatorParamType.String) {\n // Check if there's a `param` property and if it matches a known type.\n if (field.param === EmbeddedSignInFlowAuthenticatorExtendedParamType.Otp) {\n return FieldType.Otp;\n }\n if (field?.confidential) {\n return FieldType.Password;\n }\n\n return FieldType.Text;\n }\n\n throw new AsgardeoRuntimeError(\n `Field type is not supported: ${field.type}`,\n 'resolveFieldType-Invalid-001',\n 'javascript',\n 'The provided field type is not supported. Please check the field configuration.',\n );\n};\n\nexport default resolveFieldType;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport AsgardeoRuntimeError from '../errors/AsgardeoRuntimeError';\n\nconst resolveFieldName = (field: any): string => {\n if (field.param) {\n return field.param;\n }\n\n throw new AsgardeoRuntimeError(\n 'Field name is not supported: ',\n 'resolveFieldName-Invalid-001',\n 'javascript',\n 'The provided field name is not supported. Please check the field configuration.',\n );\n};\n\nexport default resolveFieldName;\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {FlowMetadataResponse} from '../../models/v2/flow-meta-v2';\n\n/**\n * Resolves a dot-path expression against a FlowMetadataResponse object.\n *\n * Supports both camelCase paths (e.g. `logoUrl`) and snake_case API responses\n * (e.g. `logo_url`). When a camelCase segment is not found directly, the\n * function falls back to its snake_case equivalent.\n *\n * @example\n * resolveMeta('application.name', meta) // \u2192 'My App'\n * resolveMeta('ou.name', meta) // \u2192 'My Org'\n *\n * @param path - Dot-separated path into the meta object (e.g. 'application.name')\n * @param meta - The FlowMetadataResponse to look up\n * @returns The resolved string value, or empty string if not found\n */\nexport default function resolveMeta(path: string, meta: FlowMetadataResponse): string {\n const value: unknown = path.split('.').reduce<unknown>((current: unknown, part: string) => {\n if (current == null || typeof current !== 'object') {\n return undefined;\n }\n\n const obj: Record<string, unknown> = current as Record<string, unknown>;\n const snakePart: string = part.replace(/[A-Z]/g, (c: string) => `_${c.toLowerCase()}`);\n\n return part in obj ? obj[part] : obj[snakePart];\n }, meta);\n\n return value != null ? String(value) : '';\n}\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Regular expression to detect a flow template literal wrapped in double braces.\n * Matches patterns like `{{ t(key) }}`, `{{ meta(key) }}`, etc.\n *\n * Note: this regex has no `g` flag \u2014 use `new RegExp(FLOW_TEMPLATE_LITERAL_REGEX.source, 'g')`\n * when global replacement is needed (e.g. in resolveFlowTemplateLiterals).\n */\nexport const FLOW_TEMPLATE_LITERAL_REGEX: RegExp = /\\{\\{\\s*([^}]+)\\s*\\}\\}/;\n\n/**\n * Regular expression to parse a function-call expression inside flow template braces.\n * Matches `funcName(arg)` and captures the function name and argument.\n */\nexport const FLOW_TEMPLATE_FUNCTION_REGEX: RegExp = /^(\\w+)\\(([^)]+)\\)$/;\n\n/**\n * Flow template literal types supported by the SDK.\n *\n * Values correspond to the function name used in the template expression,\n * so that a `{ t }` object from `useTranslation()` can be passed directly\n * as a handler map.\n */\nexport enum FlowTemplateLiteralType {\n /** Meta template literal \u2014 `{{ meta(path) }}` \u2014 resolves against flow/page metadata */\n META = 'meta',\n /** Translation template literal \u2014 `{{ t(key) }}` */\n TRANSLATION = 't',\n /** Unknown or unsupported template literal format */\n UNKNOWN = 'unknown',\n}\n\n/**\n * Result of parsing a flow template literal.\n */\nexport interface FlowTemplateLiteralResult {\n /**\n * The extracted key or path from the template literal.\n * e.g. `\"signin:heading\"` from `\"{{ t(signin:heading) }}\"`.\n */\n key?: string;\n /** The original template literal content before parsing */\n originalValue: string;\n /** The type of flow template literal that was detected */\n type: FlowTemplateLiteralType;\n}\n\n/**\n * Map of handler functions keyed by {@link FlowTemplateLiteralType}.\n *\n * When provided to a resolver, the matching handler is called with the extracted key.\n * Because `FlowTemplateLiteralType.TRANSLATION === 't'`, you can pass the `{ t }` object\n * from `useTranslation()` directly.\n *\n * @example\n * ```typescript\n * const { t } = useTranslation();\n * // handler map: { t: (key) => string }\n * ```\n */\nexport type FlowTemplateLiteralHandlers = Partial<Record<FlowTemplateLiteralType, (key: string) => string>>;\n\n/**\n * Parse a flow template literal content string and extract its type and key.\n *\n * Supports function-call expressions like:\n * - `t(signin:heading)` \u2192 type `TRANSLATION`, key `\"signin:heading\"`\n * - `meta(application.name)` \u2192 type `META`, key `\"application.name\"`\n *\n * Surrounding quotes on the key argument are stripped automatically.\n *\n * @param content - The content inside the template literal braces (without `{{ }}`).\n * @returns Parsed flow template literal information.\n *\n * @example\n * ```typescript\n * parseFlowTemplateLiteral('t(signin:heading)')\n * // { type: FlowTemplateLiteralType.TRANSLATION, key: 'signin:heading', originalValue: 't(signin:heading)' }\n *\n * parseFlowTemplateLiteral('meta(application.name)')\n * // { type: FlowTemplateLiteralType.META, key: 'application.name', originalValue: 'meta(application.name)' }\n * ```\n */\nexport default function parseFlowTemplateLiteral(content: string): FlowTemplateLiteralResult {\n const originalValue: string = content;\n const match: RegExpExecArray | null = FLOW_TEMPLATE_FUNCTION_REGEX.exec(content);\n\n if (!match) {\n return {originalValue, type: FlowTemplateLiteralType.UNKNOWN};\n }\n\n const [, functionName, rawKey] = match;\n const key: string = rawKey.trim().replace(/^['\"]|['\"]$/g, '');\n\n switch (functionName as FlowTemplateLiteralType) {\n case FlowTemplateLiteralType.TRANSLATION:\n return {key, originalValue, type: FlowTemplateLiteralType.TRANSLATION};\n case FlowTemplateLiteralType.META:\n return {key, originalValue, type: FlowTemplateLiteralType.META};\n default:\n return {originalValue, type: FlowTemplateLiteralType.UNKNOWN};\n }\n}\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport parseFlowTemplateLiteral, {\n FLOW_TEMPLATE_LITERAL_REGEX,\n FlowTemplateLiteralResult,\n FlowTemplateLiteralType,\n} from './parseFlowTemplateLiteral';\nimport resolveMeta from './resolveMeta';\nimport {TranslationFn} from '../../models/v2/translation';\nimport {ResolveFlowTemplateLiteralsOptions} from '../../models/v2/vars';\n\n/**\n * Global version of {@link FLOW_TEMPLATE_LITERAL_REGEX} for use with `String.prototype.replace`.\n */\nconst FLOW_TEMPLATE_LITERAL_REGEX_GLOBAL: RegExp = new RegExp(FLOW_TEMPLATE_LITERAL_REGEX.source, 'g');\n\n/**\n * Resolves all flow template literal expressions in a string.\n *\n * Supported patterns:\n * - `{{ t(key) }}` \u2014 resolved via the i18n translation function.\n * Colon-separated namespaces are converted to dots:\n * `{{ t(signin:heading.label) }}` \u2192 `t('signin.heading.label')`\n * - `{{ meta(path) }}` \u2014 resolved via a dot-path lookup on FlowMetadataResponse.\n * `{{ meta(application.name) }}` \u2192 `meta.application?.name`\n *\n * Flow template literals can be embedded inside larger strings:\n * `\"Login using {{ meta(application.name) }}\"` \u2192 `\"Login using My App\"`\n *\n * Unrecognized expressions are left unchanged.\n *\n * @template TFn - The concrete translation function type.\n *\n * @param text - The string to resolve (may contain zero or more flow template literals)\n * @param options - Resolution context: translation function and optional flow metadata\n * @returns The resolved string\n */\nexport default function resolveFlowTemplateLiterals<TFn extends TranslationFn = TranslationFn>(\n text: string | undefined,\n {t, meta}: ResolveFlowTemplateLiteralsOptions<TFn>,\n): string {\n if (!text) {\n return '';\n }\n\n return text.replace(FLOW_TEMPLATE_LITERAL_REGEX_GLOBAL, (match: string, content: string): string => {\n const parsed: FlowTemplateLiteralResult = parseFlowTemplateLiteral(content.trim());\n\n if (parsed.type === FlowTemplateLiteralType.TRANSLATION && parsed.key) {\n // Convert colon-separated namespace to dot-separated key\n // e.g. \"signin:fields.password.label\" \u2192 \"signin.fields.password.label\"\n return t(parsed.key.replace(/:/g, '.'));\n }\n\n if (parsed.type === FlowTemplateLiteralType.META && parsed.key && meta) {\n return resolveMeta(parsed.key, meta);\n }\n\n return match;\n });\n}\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Converts a two-letter ISO 3166-1 alpha-2 country code to a flag emoji using\n * Unicode Regional Indicator Symbols (U+1F1E6\u2013U+1F1FF).\n *\n * @param countryCode - Two-letter uppercase country code (e.g. \"US\", \"GB\")\n * @returns Flag emoji string (e.g. \"\uD83C\uDDFA\uD83C\uDDF8\", \"\uD83C\uDDEC\uD83C\uDDE7\")\n */\nexport default function countryCodeToFlagEmoji(countryCode: string): string {\n return countryCode\n .toUpperCase()\n .split('')\n .map((char: string) => String.fromCodePoint(0x1f1e6 - 65 + char.charCodeAt(0)))\n .join('');\n}\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\n/**\n * Resolves a BCP 47 locale tag to a human-readable display name using the\n * `Intl.DisplayNames` API.\n *\n * Falls back to the raw locale code if the runtime does not support\n * `Intl.DisplayNames` or if resolution returns `undefined`.\n *\n * @param locale - BCP 47 locale tag to resolve (e.g. \"en\", \"fr\", \"zh-Hant\")\n * @param displayLocale - Locale used for the display name language (defaults to \"en\")\n * @returns Human-readable language name (e.g. \"English\", \"French\")\n */\nexport default function resolveLocaleDisplayName(locale: string, displayLocale: string): string {\n try {\n const displayNames: Intl.DisplayNames = new Intl.DisplayNames([displayLocale], {type: 'language'});\n return displayNames.of(locale) ?? locale;\n } catch {\n return locale;\n }\n}\n", "/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport countryCodeToFlagEmoji from './countryCodeToFlagEmoji';\n\n/**\n * Maps BCP 47 language subtags to ISO 3166-1 alpha-2 country codes used for\n * flag emoji resolution when no country subtag is present in the locale.\n */\nconst LANGUAGE_TO_COUNTRY: Readonly<Record<string, string>> = {\n am: 'ET',\n ar: 'SA',\n bn: 'BD',\n cs: 'CZ',\n da: 'DK',\n de: 'DE',\n el: 'GR',\n en: 'GB',\n es: 'ES',\n fa: 'IR',\n fi: 'FI',\n fr: 'FR',\n he: 'IL',\n hi: 'IN',\n hu: 'HU',\n id: 'ID',\n it: 'IT',\n ja: 'JP',\n ko: 'KR',\n ml: 'IN',\n ms: 'MY',\n nl: 'NL',\n no: 'NO',\n pl: 'PL',\n pt: 'PT',\n ro: 'RO',\n ru: 'RU',\n si: 'LK',\n sk: 'SK',\n sv: 'SE',\n sw: 'KE',\n ta: 'IN',\n th: 'TH',\n tr: 'TR',\n uk: 'UA',\n ur: 'PK',\n vi: 'VN',\n zh: 'CN',\n};\n\n/**\n * Resolves a BCP 47 locale tag to a flag emoji.\n *\n * Resolution order:\n * 1. Country subtag when present (e.g. `\"en-US\"` \u2192 \uD83C\uDDFA\uD83C\uDDF8)\n * 2. Language-to-country fallback map (e.g. `\"en\"` \u2192 \uD83C\uDDEC\uD83C\uDDE7)\n * 3. Globe emoji \uD83C\uDF10 for unrecognised codes\n *\n * @param locale - BCP 47 locale tag (e.g. \"en\", \"en-US\", \"fr-CA\")\n * @returns Flag or globe emoji string\n */\nfunction resolveLocaleEmoji(locale: string): string {\n const parts: string[] = locale.split('-');\n const languageCode: string = parts[0].toLowerCase();\n const countrySubtag: string | undefined = parts.length > 1 ? parts[parts.length - 1].toUpperCase() : undefined;\n\n const countryCode: string | undefined = countrySubtag ?? LANGUAGE_TO_COUNTRY[languageCode];\n\n if (!countryCode || countryCode.length !== 2) {\n return '\\u{1F310}'; // \uD83C\uDF10\n }\n\n return countryCodeToFlagEmoji(countryCode);\n}\nexport default resolveLocaleEmoji;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport VendorConstants from '../constants/VendorConstants';\n\n/**\n * Adds a vendor-specific prefix to a CSS class name.\n *\n * @param className - The original CSS class name to be prefixed\n * @returns A new string with the vendor prefix added to the class name\n *\n * @example\n * ```typescript\n * // Usage with clsx\n * clsx(withVendorCSSClassPrefix('sign-in-button'), className)\n * // Result: \"wso2-sign-in-button\"\n * ```\n */\nconst withVendorCSSClassPrefix = (className: string): string => `${VendorConstants.VENDOR_PREFIX}-${className}`;\n\nexport default withVendorCSSClassPrefix;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {BrandingPreference, BrandingTheme, ThemeVariant} from '../models/branding-preference';\nimport createTheme from '../theme/createTheme';\nimport {Theme, ThemeConfig} from '../theme/types';\n\n/**\n * Safely extracts a color value from the branding preference structure\n */\ntype ColorVariant = {contrastText?: string; dark?: string; main?: string};\ntype TextColors = {dark?: string; primary?: string; secondary?: string};\n\nconst extractColorValue = (colorVariant?: ColorVariant, preferDark: boolean = false): string | undefined => {\n if (preferDark && colorVariant?.dark && colorVariant.dark.trim()) {\n return colorVariant.dark;\n }\n return colorVariant?.main;\n};\n\n/**\n * Safely extracts contrast text color from the branding preference structure\n */\nconst extractContrastText = (colorVariant?: {contrastText?: string; main?: string}): string | undefined =>\n colorVariant?.contrastText;\n\n/**\n * Transforms a ThemeVariant from branding preference to ThemeConfig\n */\nconst transformThemeVariant = (themeVariant: ThemeVariant, isDark: boolean = false): Partial<ThemeConfig> => {\n const {buttons} = themeVariant;\n const {colors} = themeVariant;\n const {images} = themeVariant;\n const {inputs} = themeVariant;\n\n const config: Partial<ThemeConfig> = {\n colors: {\n action: {\n activatedOpacity: 0.12,\n active: isDark ? 'rgba(255, 255, 255, 0.70)' : 'rgba(0, 0, 0, 0.54)',\n disabled: isDark ? 'rgba(255, 255, 255, 0.26)' : 'rgba(0, 0, 0, 0.26)',\n disabledBackground: isDark ? 'rgba(255, 255, 255, 0.12)' : 'rgba(0, 0, 0, 0.12)',\n disabledOpacity: 0.38,\n focus: isDark ? 'rgba(255, 255, 255, 0.12)' : 'rgba(0, 0, 0, 0.12)',\n focusOpacity: 0.12,\n hover: isDark ? 'rgba(255, 255, 255, 0.04)' : 'rgba(0, 0, 0, 0.04)',\n hoverOpacity: 0.04,\n selected: isDark ? 'rgba(255, 255, 255, 0.08)' : 'rgba(0, 0, 0, 0.08)',\n selectedOpacity: 0.08,\n },\n background: {\n body: {\n dark: (colors?.background?.body as ColorVariant)?.dark || (colors?.background?.body as ColorVariant)?.main,\n main: extractColorValue(colors?.background?.body as ColorVariant, isDark),\n },\n dark:\n (colors?.background?.surface as ColorVariant)?.dark || (colors?.background?.surface as ColorVariant)?.main,\n disabled: extractColorValue(colors?.background?.surface as ColorVariant, isDark),\n surface: extractColorValue(colors?.background?.surface as ColorVariant, isDark),\n },\n border: colors?.outlined?.default,\n error: {\n contrastText: extractContrastText(colors?.alerts?.error),\n dark: (colors?.alerts?.error as ColorVariant)?.dark || (colors?.alerts?.error as ColorVariant)?.main,\n main: extractColorValue(colors?.alerts?.error as ColorVariant, isDark),\n },\n info: {\n contrastText: extractContrastText(colors?.alerts?.info),\n dark: (colors?.alerts?.info as ColorVariant)?.dark || (colors?.alerts?.info as ColorVariant)?.main,\n main: extractColorValue(colors?.alerts?.info as ColorVariant, isDark),\n },\n primary: {\n contrastText: extractContrastText(colors?.primary),\n dark: colors?.primary?.dark || (colors?.primary as ColorVariant)?.main,\n main: extractColorValue(colors?.primary as ColorVariant, isDark),\n },\n secondary: {\n contrastText: extractContrastText(colors?.secondary),\n dark: colors?.secondary?.dark || (colors?.secondary as ColorVariant)?.main,\n main: extractColorValue(colors?.secondary as ColorVariant, isDark),\n },\n success: {\n contrastText: extractContrastText(colors?.alerts?.neutral),\n dark: (colors?.alerts?.neutral as ColorVariant)?.dark || (colors?.alerts?.neutral as ColorVariant)?.main,\n main: extractColorValue(colors?.alerts?.neutral as ColorVariant, isDark),\n },\n text: {\n dark: (colors?.text as TextColors)?.dark || (colors?.text as TextColors)?.primary,\n primary: (colors?.text as TextColors)?.primary,\n secondary: (colors?.text as TextColors)?.secondary,\n },\n warning: {\n contrastText: extractContrastText(colors?.alerts?.warning),\n dark: (colors?.alerts?.warning as ColorVariant)?.dark || (colors?.alerts?.warning as ColorVariant)?.main,\n main: extractColorValue(colors?.alerts?.warning as ColorVariant, isDark),\n },\n },\n images: {\n favicon: images?.favicon\n ? {\n alt: images.favicon.altText,\n title: images.favicon.title,\n url: images.favicon.imgURL,\n }\n : undefined,\n logo: images?.logo\n ? {\n alt: images.logo.altText,\n title: images.logo.title,\n url: images.logo.imgURL,\n }\n : undefined,\n },\n };\n\n /* |---------------------------------------------------------------| */\n /* | Components | */\n /* |---------------------------------------------------------------| */\n\n const buttonBorderRadius: string | undefined = buttons?.primary?.base?.border?.borderRadius;\n const fieldBorderRadius: string | undefined = inputs?.base?.border?.borderRadius;\n\n if (buttonBorderRadius || fieldBorderRadius) {\n config.components = {\n ...(buttonBorderRadius && {\n Button: {\n styleOverrides: {\n root: {\n borderRadius: buttonBorderRadius,\n },\n },\n },\n }),\n ...(fieldBorderRadius && {\n Field: {\n styleOverrides: {\n root: {\n borderRadius: fieldBorderRadius,\n },\n },\n },\n }),\n };\n }\n\n return config;\n};\n\n/**\n * Transforms branding preference response to Theme object\n *\n * @param brandingPreference - The branding preference response from getBrandingPreference\n * @param forceTheme - Optional parameter to force a specific theme ('light' or 'dark'),\n * if not provided, will use the activeTheme from branding preference\n * @returns Theme object that can be used with the theme system\n *\n * The function extracts the following from branding preference:\n * - Colors (primary, secondary, background, text, alerts, etc.)\n * - Border radius from buttons and inputs\n * - Images (logo and favicon with their URLs, titles, and alt text)\n * - Typography settings\n *\n * @example\n * ```typescript\n * const brandingPreference = await getBrandingPreference({ baseUrl: \"...\" });\n * const theme = transformBrandingPreferenceToTheme(brandingPreference);\n *\n * // Access image URLs via CSS variables\n * // Logo: var(--wso2-image-logo-url)\n * // Favicon: var(--wso2-image-favicon-url)\n *\n * // Force light theme regardless of branding preference activeTheme\n * const lightTheme = transformBrandingPreferenceToTheme(brandingPreference, 'light');\n * ```\n */\nexport const transformBrandingPreferenceToTheme = (\n brandingPreference: BrandingPreference,\n forceTheme?: 'light' | 'dark',\n): Theme => {\n // Extract theme configuration\n const themeConfig: BrandingTheme | undefined = brandingPreference?.preference?.theme;\n\n if (!themeConfig) {\n // If no theme config is provided, return default light theme\n return createTheme({}, false);\n }\n\n // Determine which theme variant to use\n let activeThemeKey: string;\n if (forceTheme) {\n activeThemeKey = forceTheme.toUpperCase();\n } else {\n activeThemeKey = themeConfig.activeTheme || 'LIGHT';\n }\n\n // Get the theme variant (LIGHT or DARK)\n const themeVariant: ThemeVariant | undefined = themeConfig[\n activeThemeKey as keyof typeof themeConfig\n ] as ThemeVariant;\n\n if (!themeVariant) {\n // If the specified theme variant doesn't exist, fallback to light theme\n const fallbackVariant: ThemeVariant | undefined = themeConfig.LIGHT || themeConfig.DARK;\n if (fallbackVariant) {\n const transformedConfig: Partial<ThemeConfig> = transformThemeVariant(fallbackVariant, activeThemeKey === 'DARK');\n return createTheme(transformedConfig, activeThemeKey === 'DARK');\n }\n // If no theme variants exist, return default theme\n return createTheme({}, activeThemeKey === 'DARK');\n }\n\n // Transform the theme variant to ThemeConfig\n const transformedConfig: Partial<ThemeConfig> = transformThemeVariant(themeVariant, activeThemeKey === 'DARK');\n\n // Create the theme using the transformed config\n return createTheme(transformedConfig, activeThemeKey === 'DARK');\n};\n\nexport default transformBrandingPreferenceToTheme;\n", "/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {HttpError, HttpRequestConfig, HttpResponse} from './models/http';\n\n/**\n * Abstract base class for HTTP clients. Owns all handler/callback state and\n * the request lifecycle (pre-processing, transport, post-processing).\n *\n * Extend this class and implement `transport()` to plug in a custom HTTP transport.\n *\n * @example\n * ```ts\n * class MyHttpClient extends HttpClient {\n * protected async transport<T>(config: HttpRequestConfig): Promise<HttpResponse<T>> {\n * // custom fetch logic\n * }\n * }\n * ```\n */\nexport abstract class HttpClient {\n private static readonly DEFAULT_HANDLER_DISABLE_TIMEOUT: number = 1000;\n\n // eslint-disable-next-line class-methods-use-this\n private requestStartCallback: (request: HttpRequestConfig) => void = () => null;\n\n // eslint-disable-next-line class-methods-use-this\n private requestSuccessCallback: (response: HttpResponse) => void = () => null;\n\n // eslint-disable-next-line class-methods-use-this\n private requestErrorCallback: (error: HttpError) => void = () => null;\n\n // eslint-disable-next-line class-methods-use-this\n private requestFinishCallback: () => void = () => null;\n\n constructor(\n private isHandlerEnabled: boolean = true,\n private attachToken: (request: HttpRequestConfig) => Promise<void> = (): Promise<void> => Promise.resolve(),\n ) {}\n\n /**\n * Implemented by subclasses. Performs the actual HTTP call with no handler\n * logic applied \u2014 that is handled by `request()`.\n */\n protected abstract transport<T = any>(config: HttpRequestConfig): Promise<HttpResponse<T>>;\n\n /**\n * Public HTTP request entry point. Applies pre/post processing around `transport()`.\n */\n async request<T = any>(config: HttpRequestConfig): Promise<HttpResponse<T>> {\n const processedConfig: HttpRequestConfig = await this.requestHandler(config);\n try {\n const response: HttpResponse<T> = await this.transport<T>(processedConfig);\n return this.successHandler(response);\n } catch (error: any) {\n this.errorHandler(error as HttpError);\n throw error;\n }\n }\n\n enableHandler(): void {\n this.isHandlerEnabled = true;\n }\n\n disableHandler(): void {\n this.isHandlerEnabled = false;\n }\n\n disableHandlerWithTimeout(timeout: number = HttpClient.DEFAULT_HANDLER_DISABLE_TIMEOUT): void {\n this.isHandlerEnabled = false;\n setTimeout(() => {\n this.isHandlerEnabled = true;\n }, timeout);\n }\n\n setHttpRequestStartCallback(cb: (req: HttpRequestConfig) => void): void {\n this.requestStartCallback = cb;\n }\n\n setHttpRequestSuccessCallback(cb: (res: HttpResponse) => void): void {\n this.requestSuccessCallback = cb;\n }\n\n setHttpRequestErrorCallback(cb: (err: HttpError) => void): void {\n this.requestErrorCallback = cb;\n }\n\n setHttpRequestFinishCallback(cb: () => void): void {\n this.requestFinishCallback = cb;\n }\n\n // eslint-disable-next-line class-methods-use-this\n all<T>(values: (T | Promise<T>)[]): Promise<T[]> {\n return Promise.all(values);\n }\n\n // eslint-disable-next-line class-methods-use-this\n spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R {\n return (array: T[]) => callback(...array);\n }\n\n protected async requestHandler(config: HttpRequestConfig): Promise<HttpRequestConfig> {\n await this.attachToken(config);\n\n if (config.shouldEncodeToFormData && config.data) {\n const formData: FormData = new FormData();\n Object.keys(config.data).forEach((key: string) => formData.append(key, config.data[key]));\n // eslint-disable-next-line no-param-reassign\n config.data = formData;\n }\n\n // eslint-disable-next-line no-param-reassign\n config.startTimeInMs = Date.now();\n\n if (this.isHandlerEnabled && typeof this.requestStartCallback === 'function') {\n this.requestStartCallback(config);\n }\n\n return config;\n }\n\n protected successHandler(response: HttpResponse): HttpResponse {\n if (this.isHandlerEnabled) {\n if (typeof this.requestSuccessCallback === 'function') {\n this.requestSuccessCallback(response);\n }\n if (typeof this.requestFinishCallback === 'function') {\n this.requestFinishCallback();\n }\n }\n return response;\n }\n\n protected errorHandler(error: HttpError): void {\n if (this.isHandlerEnabled) {\n if (typeof this.requestErrorCallback === 'function') {\n this.requestErrorCallback(error);\n }\n if (typeof this.requestFinishCallback === 'function') {\n this.requestFinishCallback();\n }\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qCAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAAC;AAAA,EAAA;AAAA;AAAA,gCAAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACqCA,IAAM,yBA0B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MAAK;AAAA,MACjC;AACA,UAAI,OAAO,KAAK,0BAA0B,YAAY;AACpD,aAAK,sBAAsB;AAAA,MAC7B;AAAA,IACF;AAAA,EACF;AACF;AA1HE,cADoB,aACI,mCAA0C;AAD7D,IAAe,aAAf;",
|
|
6
|
+
"names": ["EmbeddedFlowComponentType", "EmbeddedSignInFlowStatus", "EmbeddedSignInFlowType", "Platform", "error", "tokenResponse", "OIDCDiscoveryConstants", "OIDCDiscoveryConstants_default", "error", "error", "OIDCDiscoveryConstants_default", "error", "error", "error", "EmbeddedFlowType", "EmbeddedFlowStatus", "EmbeddedFlowResponseType", "EmbeddedFlowComponentType", "error", "error", "error", "error", "error", "error", "error", "error", "error", "error", "error", "EmbeddedSignInFlowStatus", "EmbeddedSignInFlowType", "EmbeddedSignUpFlowStatus", "EmbeddedSignUpFlowType", "EmbeddedSignInFlowStatus", "EmbeddedSignInFlowType", "EmbeddedSignInFlowStepType", "EmbeddedSignInFlowAuthenticatorParamType", "EmbeddedSignInFlowAuthenticatorKnownIdPType", "EmbeddedSignInFlowAuthenticatorPromptType", "EmbeddedFlowComponentType", "EmbeddedFlowActionVariant", "EmbeddedFlowTextVariant", "EmbeddedFlowEventType", "EmbeddedRecoveryFlowStatus", "EmbeddedRecoveryFlowType", "FlowMetaType", "FlowMode", "AgentConfig", "WellKnownSchemaIds", "FieldType", "base64url", "error", "error", "error", "url", "transformedConfig", "error"]
|
|
7
7
|
}
|