@asgardeo/javascript 0.2.9 → 0.2.11

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/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/StorageManager.ts", "../src/constants/OIDCDiscoveryConstants.ts", "../src/constants/ScopeConstants.ts", "../src/constants/OIDCRequestConstants.ts", "../src/errors/exception.ts", "../src/constants/TokenConstants.ts", "../src/IsomorphicCrypto.ts", "../src/constants/PKCEConstants.ts", "../src/utils/extractPkceStorageKeyFromState.ts", "../src/constants/TokenExchangeConstants.ts", "../src/utils/extractUserClaimsFromIdToken.ts", "../src/errors/AsgardeoError.ts", "../src/errors/AsgardeoRuntimeError.ts", "../src/utils/processOpenIDScopes.ts", "../src/__legacy__/helpers/authentication-helper.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/constants/ApplicationNativeAuthenticationConstants.ts", "../src/constants/VendorConstants.ts", "../src/models/platforms.ts", "../src/models/embedded-signin-flow.ts", "../src/models/flow.ts", "../src/models/scim2-schema.ts", "../src/models/field.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/deepMerge.ts", "../src/utils/deriveOrganizationHandleFromBaseUrl.ts", "../src/utils/logger.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/removeTrailingSlash.ts", "../src/utils/resolveFieldType.ts", "../src/utils/resolveFieldName.ts", "../src/utils/withVendorCSSClassPrefix.ts", "../src/utils/transformBrandingPreferenceToTheme.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\nimport {Stores} from './models/store';\nimport {Storage} from './models/store';\nimport {AuthClientConfig} from './__legacy__/models';\nimport {SessionData} from './models/session';\nimport {TemporaryStore, TemporaryStoreValue} from './models/store';\nimport {OIDCDiscoveryApiResponse} from './models/oidc-discovery';\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 protected _store: Storage;\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): string {\n return userId ? `${store}-${this._id}-${userId}` : `${store}-${this._id}`;\n }\n\n protected 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 getSessionData(userId?: string): Promise<SessionData> {\n return JSON.parse((await this._store.getData(this._resolveKey(Stores.SessionData, userId))) ?? 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 public setSessionStatus(status: string): void {\n // Using local storage to store the session status as it is required to be available across tabs.\n this.isLocalStorageAvailable() && localStorage.setItem(`${ASGARDEO_SESSION_ACTIVE}`, status);\n }\n\n public getSessionStatus(): string {\n return this.isLocalStorageAvailable() ? localStorage.getItem(`${ASGARDEO_SESSION_ACTIVE}`) ?? '' : '';\n }\n\n public removeSessionStatus(): void {\n this.isLocalStorageAvailable() && localStorage.removeItem(`${ASGARDEO_SESSION_ACTIVE}`);\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 * 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 /**\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 * 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 * 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 * 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 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 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 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 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 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 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 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 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 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 * 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 * 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 /**\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) 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 public code: string | undefined;\n public message: string;\n\n public constructor(\n code: string,\n name: string,\n message: string\n ) {\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 * 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 /**\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 {AsgardeoAuthException} from './errors/exception';\nimport {Crypto, JWKInterface} from './models/crypto';\nimport {IdToken} from './models/token';\nimport TokenConstants from './constants/TokenConstants';\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 getCodeChallenge(verifier: string): string {\n return this._cryptoUtils.base64URLEncode(this._cryptoUtils.hashSha256(verifier));\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 for (const key of keys) {\n if (headerJSON['kid'] === key.kid) {\n return key;\n }\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: ' +\n 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) => {\n return Promise.reject(error);\n });\n }\n\n /**\n * This function decodes the payload of an id token and returns it.\n *\n * @param idToken - The id token to be decoded.\n *\n * @returns - The decoded payload of the id token.\n *\n * @throws\n */\n public decodeIdToken(idToken: string): IdToken {\n try {\n const utf8String: string = this._cryptoUtils.base64URLDecode(idToken?.split('.')[1]);\n const payload: IdToken = JSON.parse(utf8String);\n\n return payload;\n } catch (error: any) {\n throw new AsgardeoAuthException('JS-CRYPTO_UTIL-DIT-IV01', 'Decoding ID token failed.', error);\n }\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 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) 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]);\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).\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 /**\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 the username in token exchange operations.\n * Used when user identity needs to be included in the exchange.\n */\n USERNAME: '{{username}}',\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 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} 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\nimport {IdToken} from '../models/token';\n\n/**\n * Removes standard protocol-specific claims from the ID token payload\n * and returns a camelCased object of user-specific claims.\n *\n * @param payload The raw ID token payload.\n * @returns A cleaned-up, camelCased object containing only user-specific claims.\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 * };\n *\n * const userClaims = extractUserClaimsFromIdToken(idTokenPayload);\n * // // userClaims will be:\n * // {\n * // email: 'user@example.com'\n * // }\n * ```\n */\nconst extractUserClaimsFromIdToken = (payload: IdToken): Record<string, unknown> => {\n const filteredPayload: Partial<IdToken> = {...payload};\n\n const protocolClaims = [\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 => {\n delete filteredPayload[claim as keyof IdToken];\n });\n\n const userClaims: Record<string, unknown> = {};\n\n Object.entries(filteredPayload).forEach(([key, value]) => {\n const camelCasedKey = key\n .split('_')\n .map((part, i) => (i === 0 ? part : part[0].toUpperCase() + part.slice(1)))\n .join('');\n\n userClaims[camelCasedKey] = value;\n });\n\n return userClaims;\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 * 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 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 _origin: string = AsgardeoError.resolveOrigin(origin);\n super(message);\n\n this.name = new.target.name;\n this.code = code;\n this.origin = _origin;\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 value: 'AsgardeoRuntimeError',\n configurable: true,\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 = 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 * @param scopes - The OpenID scopes to process, which can be a string or an array of strings.\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(123); // throws AsgardeoRuntimeError\n * processOpenIDScopes({}); // throws AsgardeoRuntimeError\n * ```\n */\nconst processOpenIDScopes = (scopes: string | string[]): string => {\n let processedScopes: string[] = [];\n\n if (scopes) {\n if (Array.isArray(scopes)) {\n processedScopes = scopes;\n } else if (typeof scopes === 'string') {\n processedScopes = scopes.split(' ');\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 OIDCRequestConstants.SignIn.Payload.DEFAULT_SCOPES.forEach((defaultScope: string) => {\n if (!processedScopes.includes(defaultScope)) {\n processedScopes.push(defaultScope);\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 {JWKInterface} from '../../models/crypto';\nimport {OIDCDiscoveryEndpointsApiResponse, OIDCDiscoveryApiResponse} from '../../models/oidc-discovery';\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 private _config: () => Promise<AuthClientConfig>;\n private _oidcProviderMetaData: () => Promise<OIDCDiscoveryApiResponse>;\n private _cryptoHelper: IsomorphicCrypto;\n\n public constructor(storageManager: StorageManager<T>, cryptoHelper: IsomorphicCrypto) {\n this._storageManager = storageManager;\n this._config = async () => this._storageManager.getConfigData();\n this._oidcProviderMetaData = async () => this._storageManager.loadOpenIDProviderConfiguration();\n this._cryptoHelper = cryptoHelper;\n }\n\n public async resolveEndpoints(response: OIDCDiscoveryApiResponse): Promise<OIDCDiscoveryApiResponse> {\n const oidcProviderMetaData: OIDCDiscoveryApiResponse = {};\n const configData: StrictAuthClientConfig = await this._config();\n\n 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 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 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 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 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 const defaultEndpoints: OIDCDiscoveryApiResponse = {\n [OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints\n .AUTHORIZATION]: `${baseUrl}${OIDCDiscoveryConstants.Endpoints.AUTHORIZATION}`,\n [OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints\n .END_SESSION]: `${baseUrl}${OIDCDiscoveryConstants.Endpoints.END_SESSION}`,\n [OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints\n .ISSUER]: `${baseUrl}${OIDCDiscoveryConstants.Endpoints.ISSUER}`,\n [OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.JWKS]: `${baseUrl}${OIDCDiscoveryConstants.Endpoints.JWKS}`,\n [OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints\n .SESSION_IFRAME]: `${baseUrl}${OIDCDiscoveryConstants.Endpoints.SESSION_IFRAME}`,\n [OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints\n .REVOCATION]: `${baseUrl}${OIDCDiscoveryConstants.Endpoints.REVOCATION}`,\n [OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints\n .TOKEN]: `${baseUrl}${OIDCDiscoveryConstants.Endpoints.TOKEN}`,\n [OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints\n .USERINFO]: `${baseUrl}${OIDCDiscoveryConstants.Endpoints.USERINFO}`,\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.decodeIdToken(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.decodeIdToken(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 const sessionData: SessionData = await this._storageManager.getSessionData(userId);\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). 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');\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]);\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 ScopeConstants from '../constants/ScopeConstants';\nimport OIDCRequestConstants from '../constants/OIDCRequestConstants';\nimport generateStateParamForRequestCorrelation from './generateStateParamForRequestCorrelation';\nimport {ExtendedAuthorizeRequestUrlParams} from '../models/oauth-request';\nimport AsgardeoRuntimeError from '../errors/AsgardeoRuntimeError';\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 redirectUri: string;\n clientId: string;\n scopes?: string;\n responseMode?: string;\n codeChallenge?: string;\n codeChallengeMethod?: string;\n prompt?: string;\n } & ExtendedAuthorizeRequestUrlParams,\n pkceOptions: {key: string},\n customParams: Record<string, string | number | boolean>,\n): Map<string, string> => {\n const {redirectUri, clientId, clientSecret, scopes, responseMode, codeChallenge, codeChallengeMethod, prompt} =\n 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 for (const [key, value] of Object.entries(customParams)) {\n if (key !== '' && value !== '' && key !== OIDCRequestConstants.Params.STATE) {\n authorizeRequestParams.set(key, value.toString());\n }\n }\n }\n\n authorizeRequestParams.set(\n OIDCRequestConstants.Params.STATE,\n generateStateParamForRequestCorrelation(\n pkceKey,\n customParams ? customParams[OIDCRequestConstants.Params.STATE]?.toString() : '',\n ),\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 StorageManager from '../StorageManager';\nimport {AuthClientConfig, StrictAuthClientConfig} from './models';\nimport {ExtendedAuthorizeRequestUrlParams} from '../models/oauth-request';\nimport {Crypto} from '../models/crypto';\nimport {TokenResponse, IdToken, TokenExchangeRequestConfig} from '../models/token';\nimport {OIDCEndpoints} from '../models/oidc-endpoints';\nimport {Storage} from '../models/store';\nimport ScopeConstants from '../constants/ScopeConstants';\nimport OIDCDiscoveryConstants from '../constants/OIDCDiscoveryConstants';\nimport OIDCRequestConstants from '../constants/OIDCRequestConstants';\nimport {IsomorphicCrypto} from '../IsomorphicCrypto';\nimport extractPkceStorageKeyFromState from '../utils/extractPkceStorageKeyFromState';\nimport generateStateParamForRequestCorrelation from '../utils/generateStateParamForRequestCorrelation';\nimport {AsgardeoAuthException} from '../errors/exception';\nimport {AuthenticationHelper} from './helpers';\nimport {SessionData, UserSession} from '../models/session';\nimport {AuthorizeRequestUrlParams} from '../models/oauth-request';\nimport {TemporaryStore} from '../models/store';\nimport generatePkceStorageKey from '../utils/generatePkceStorageKey';\nimport {OIDCDiscoveryApiResponse} from '../models/oidc-discovery';\nimport getAuthorizeRequestUrlParams from '../utils/getAuthorizeRequestUrlParams';\nimport PKCEConstants from '../constants/PKCEConstants';\nimport {User} from '../models/user';\nimport processOpenIDScopes from '../utils/processOpenIDScopes';\n\n/**\n * Default configurations.\n */\nconst DefaultConfig: Partial<AuthClientConfig<unknown>> = {\n tokenValidation: {\n idToken: {\n validate: true,\n validateIssuer: true,\n clockTolerance: 300,\n },\n },\n enablePKCE: true,\n responseMode: 'query',\n sendCookiesInRequests: true,\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 private _config: () => Promise<AuthClientConfig>;\n private _oidcProviderMetaData: () => Promise<OIDCDiscoveryApiResponse>;\n private _authenticationHelper: AuthenticationHelper<T>;\n private _cryptoUtils: Crypto;\n private _cryptoHelper: IsomorphicCrypto;\n\n private static _instanceID: number;\n\n // FIXME: Validate this.\n // Ref: https://github.com/asgardeo/asgardeo-auth-js-core/pull/205\n static _authenticationHelper: 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\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 cryptoUtils: Crypto,\n instanceID?: number,\n ): Promise<void> {\n const clientId: string = config.clientId;\n\n if (!AsgardeoAuthClient._instanceID) {\n AsgardeoAuthClient._instanceID = 0;\n } else {\n AsgardeoAuthClient._instanceID += 1;\n }\n\n if (instanceID) {\n AsgardeoAuthClient._instanceID = instanceID;\n }\n\n if (!clientId) {\n this._storageManager = new StorageManager<T>(`instance_${AsgardeoAuthClient._instanceID}`, store);\n } else {\n this._storageManager = new StorageManager<T>(`instance_${AsgardeoAuthClient._instanceID}-${clientId}`, store);\n }\n\n this._cryptoUtils = cryptoUtils;\n this._cryptoHelper = new IsomorphicCrypto(cryptoUtils);\n this._authenticationHelper = new AuthenticationHelper(this._storageManager, this._cryptoHelper);\n this._config = async () => await this._storageManager.getConfigData();\n this._oidcProviderMetaData = async () => await this._storageManager.loadOpenIDProviderConfiguration();\n\n // FIXME: Validate this.\n // Ref: https://github.com/asgardeo/asgardeo-auth-js-core/pull/205\n AsgardeoAuthClient._authenticationHelper = this._authenticationHelper;\n\n await this._storageManager.setConfigData({\n ...DefaultConfig,\n ...config,\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 public getInstanceId(): number {\n return AsgardeoAuthClient._instanceID;\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 __TODO__ = async () => {\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._config();\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 = 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 redirectUri: configData.afterSignInUrl,\n clientId: configData.clientId,\n scopes: processOpenIDScopes(configData.scopes),\n responseMode: configData.responseMode,\n codeChallengeMethod: PKCEConstants.DEFAULT_CODE_CHALLENGE_METHOD,\n codeChallenge,\n prompt: configData.prompt,\n },\n {key: pkceKey},\n authRequestConfig,\n );\n\n for (const [key, value] of authorizeRequestParams.entries()) {\n authorizeRequest.searchParams.append(key, value);\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 __TODO__();\n }\n\n return this.loadOpenIDProviderConfiguration(requestConfig?.forceInit as boolean).then(() => {\n return __TODO__();\n });\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 const __TODO__ = async () => {\n const tokenEndpoint: string | undefined = (await this._oidcProviderMetaData()).token_endpoint;\n const configData: StrictAuthClientConfig = await this._config();\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 sessionState &&\n (await this._storageManager.setSessionDataParameter(\n OIDCRequestConstants.Params.SESSION_STATE as keyof SessionData,\n sessionState,\n userId,\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: 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 await this._authenticationHelper.handleTokenResponse(tokenResponse, userId);\n };\n\n if (\n await this._storageManager.getTemporaryDataParameter(\n OIDCDiscoveryConstants.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,\n )\n ) {\n return __TODO__();\n }\n\n return this.loadOpenIDProviderConfiguration(false).then(() => {\n return __TODO__();\n });\n }\n\n public async loadOpenIDProviderConfiguration(forceInit: boolean): Promise<void> {\n const configData: StrictAuthClientConfig = await this._config();\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: string = (configData as any).wellKnownEndpoint;\n\n if (wellKnownEndpoint) {\n let response: Response;\n\n try {\n response = await fetch(wellKnownEndpoint);\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(\n await this._authenticationHelper.resolveEndpoints(await response.json()),\n );\n await this._storageManager.setTemporaryDataParameter(\n OIDCDiscoveryConstants.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,\n true,\n );\n\n return Promise.resolve();\n } else if ((configData as any).baseUrl) {\n try {\n await this._storageManager.setOIDCProviderMetaData(\n await this._authenticationHelper.resolveEndpointsByBaseURL(),\n );\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 } else {\n await this._storageManager.setOIDCProviderMetaData(await this._authenticationHelper.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 /**\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._oidcProviderMetaData())?.end_session_endpoint;\n const configData: StrictAuthClientConfig = await this._config();\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._oidcProviderMetaData();\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 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 _idToken: string = (await this._storageManager.getSessionData(userId)).id_token;\n const payload: IdToken = this._cryptoHelper.decodeIdToken(_idToken ?? 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._authenticationHelper.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._oidcProviderMetaData()).revocation_endpoint;\n const configData: StrictAuthClientConfig = await this._config();\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._authenticationHelper.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._oidcProviderMetaData()).token_endpoint;\n const configData: StrictAuthClientConfig = await this._config();\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._authenticationHelper.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 const oidcProviderMetadata: OIDCDiscoveryApiResponse = await this._oidcProviderMetaData();\n const configData: StrictAuthClientConfig = await this._config();\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._authenticationHelper.replaceCustomGrantTemplateTags(\n value as string,\n userId,\n );\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._authenticationHelper.handleTokenResponse(response, userId);\n } else {\n return Promise.resolve((await response.json()) as TokenResponse | Response);\n }\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) * 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 await 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 await this._storageManager.setConfigData(config);\n await this.loadOpenIDProviderConfiguration(true);\n }\n\n public static async clearSession(userId?: string): Promise<void> {\n await this._authenticationHelper.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 value: 'AsgardeoAPIError',\n configurable: true,\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 = 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 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 = new URLSearchParams();\n Object.entries(payload).forEach(([key, value]) => {\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 method: requestConfig.method || 'POST',\n headers: {\n ...requestConfig.headers,\n 'Content-Type': 'application/x-www-form-urlencoded',\n Accept: 'application/json',\n },\n body: searchParams.toString(),\n });\n\n if (!response.ok) {\n const errorText = 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 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 method: requestConfig.method || 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n body: JSON.stringify(payload),\n });\n\n if (!response.ok) {\n const errorText = 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}\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 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 EmbeddedSignUpFlowErrorResponseV2} 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 * 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 * 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 * 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 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 method: requestConfig.method || 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n body: JSON.stringify({\n ...(payload ?? {}),\n flowType: EmbeddedFlowType.Registration,\n }),\n });\n\n if (!response.ok) {\n const errorText = 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 {User} from '../models/user';\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\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 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 method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n });\n\n if (!response.ok) {\n const errorText = 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 = /^[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; userName?: string; user_name?: string}>(user: T): T => {\n if (!user) {\n return user;\n }\n\n const processedUser = {...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 {User} from '../models/user';\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport processUserUsername from '../utils/processUsername';\n\n/**\n * Configuration for the getScim2Me request\n */\nexport interface GetScim2MeConfig extends Omit<RequestInit, 'method'> {\n /**\n * The absolute API endpoint.\n */\n url?: string;\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\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 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 = fetcher || fetch;\n const resolvedUrl: string = url ?? `${baseUrl}/scim2/Me`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n method: 'GET',\n headers: {\n 'Content-Type': 'application/scim+json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText = 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 = (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 {Schema} from '../models/scim2-schema';\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\n\n/**\n * Configuration for the getSchemas request\n */\nexport interface GetSchemasConfig extends Omit<RequestInit, 'method'> {\n /**\n * The absolute API endpoint.\n */\n url?: string;\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\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 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 = fetcher || fetch;\n const resolvedUrl: string = url ?? `${baseUrl}/scim2/Schemas`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText = 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 {AllOrganizationsApiResponse} from '../models/organization';\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\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 * 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 * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\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 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 = fetcher || fetch;\n const resolvedUrl = `${baseUrl}/api/server/v1/organizations?${queryParams.toString()}`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n method: 'GET',\n headers: {\n ...requestConfig.headers,\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n },\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText = 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 = (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 {Organization} from '../models/organization';\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\n\n/**\n * Interface for organization creation payload.\n */\nexport interface CreateOrganizationPayload {\n /**\n * Organization description.\n */\n description: string;\n /**\n * Organization handle/slug.\n */\n orgHandle?: string;\n /**\n * Organization name.\n */\n name: 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 * Organization creation payload\n */\n payload: CreateOrganizationPayload;\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\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 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 = {\n ...payload,\n type: 'TENANT' as const,\n };\n\n const fetchFn = fetcher || fetch;\n const resolvedUrl = `${baseUrl}/api/server/v1/organizations`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n body: JSON.stringify(organizationPayload),\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText = 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 {Organization} from '../models/organization';\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\n\n/**\n * Configuration for the getMeOrganizations request\n */\nexport interface GetMeOrganizationsConfig extends Omit<RequestInit, 'method'> {\n /**\n * The base URL for the API endpoint.\n */\n baseUrl: string;\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 * Base64 encoded cursor value for backward pagination\n */\n before?: string;\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 * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\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 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 = 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]) => Boolean(value)),\n ),\n );\n\n const fetchFn = fetcher || fetch;\n const resolvedUrl = `${baseUrl}/api/users/v1/me/organizations?${queryParams.toString()}`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText = 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 = (await response.json()) as any;\n return data.organizations || [];\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 * The ID of the organization to retrieve\n */\n organizationId: 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\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 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 = fetcher || fetch;\n const resolvedUrl = `${baseUrl}/api/server/v1/organizations/${organizationId}`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText = 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 AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport isEmpty from '../utils/isEmpty';\nimport {OrganizationDetails} from './getOrganization';\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 * The ID of the organization to update\n */\n organizationId: string;\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 * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\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 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 = fetcher || fetch;\n const resolvedUrl = `${baseUrl}/api/server/v1/organizations/${organizationId}`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n method: 'PATCH',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n body: JSON.stringify(operations),\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText = 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 return Object.entries(payload).map(([key, value]) => {\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};\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 {User} from '../models/user';\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\n\n/**\n * Configuration for the updateMeProfile request\n */\nexport interface UpdateMeProfileConfig extends Omit<RequestInit, 'method' | 'body'> {\n /**\n * The absolute API endpoint.\n */\n url?: string;\n /**\n * The base path of the API endpoint.\n */\n baseUrl?: string;\n /**\n * The value object to patch (SCIM2 PATCH value)\n */\n payload: any;\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\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 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 = {\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 = fetcher || fetch;\n const resolvedUrl: string = url ?? `${baseUrl}/scim2/Me`;\n\n const requestInit: RequestInit = {\n method: 'PATCH',\n ...requestConfig,\n headers: {\n ...requestConfig.headers,\n 'Content-Type': 'application/scim+json',\n Accept: 'application/json',\n },\n body: JSON.stringify(data),\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText = 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 return (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 ||\n '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 {BrandingPreference} from '../models/branding-preference';\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\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 * 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 * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\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 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 = fetcher || fetch;\n const resolvedUrl = `${baseUrl}/api/server/v1/branding-preference/resolve${\n queryParams.toString() ? `?${queryParams.toString()}` : ''\n }`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText = 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 = (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 {EmbeddedFlowExecuteRequestConfig, EmbeddedFlowResponseType, EmbeddedFlowType} from '../embedded-flow';\n\nexport enum EmbeddedSignInFlowStatusV2 {\n Complete = 'COMPLETE',\n Incomplete = 'INCOMPLETE',\n Error = 'ERROR',\n}\n\nexport enum EmbeddedSignInFlowTypeV2 {\n Redirection = 'REDIRECTION',\n View = 'VIEW',\n}\n\n/**\n * Extended response structure for the embedded sign-in flow V2.\n * @remarks This response is only done from the SDK level.\n * @experimental\n */\nexport interface ExtendedEmbeddedSignInFlowResponseV2 {\n /**\n * The URL to redirect the user after completing the sign-in flow.\n */\n redirectUrl?: string;\n}\n\n/**\n * Response structure for the new Asgardeo V2 embedded sign-in flow.\n * @experimental\n */\nexport interface EmbeddedSignInFlowResponseV2 extends ExtendedEmbeddedSignInFlowResponseV2 {\n flowId: string;\n flowStatus: EmbeddedSignInFlowStatusV2;\n type: EmbeddedSignInFlowTypeV2;\n data: {\n actions?: {\n type: EmbeddedFlowResponseType;\n id: string;\n }[];\n inputs?: {\n name: string;\n type: string;\n required: boolean;\n }[];\n };\n}\n\n/**\n * Response structure for the new Asgardeo V2 embedded sign-in flow when the flow is complete.\n * @experimental\n */\nexport interface EmbeddedSignInFlowCompleteResponse {\n redirect_uri: string;\n}\n\n/**\n * Request payload for initiating the new Asgardeo V2 embedded sign-in flow.\n * @experimental\n */\nexport type EmbeddedSignInFlowInitiateRequestV2 = {\n applicationId: string;\n flowType: EmbeddedFlowType;\n};\n\n/**\n * Request payload for executing steps in the new Asgardeo V2 embedded sign-in flow.\n * @experimental\n */\nexport interface EmbeddedSignInFlowRequestV2 extends Partial<EmbeddedSignInFlowInitiateRequestV2> {\n flowId?: string;\n actionId?: string;\n inputs?: Record<string, any>;\n}\n\n/**\n * Request config for executing the new Asgardeo V2 embedded sign-in flow.\n * @experimental\n */\nexport interface EmbeddedFlowExecuteRequestConfigV2<T = any> extends EmbeddedFlowExecuteRequestConfig<T> {\n authId?: 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 {\n EmbeddedFlowExecuteRequestConfigV2,\n EmbeddedSignInFlowResponseV2,\n EmbeddedSignInFlowStatusV2,\n} from '../../models/v2/embedded-signin-flow-v2';\nimport AsgardeoAPIError from '../../errors/AsgardeoAPIError';\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 let endpoint: string = url ?? `${baseUrl}/flow/execute`;\n\n const response: Response = await fetch(endpoint, {\n ...requestConfig,\n method: requestConfig.method || 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n body: JSON.stringify(payload),\n });\n\n if (!response.ok) {\n const errorText = 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 authorize.\n if (\n flowResponse.flowStatus === EmbeddedSignInFlowStatusV2.Complete &&\n (flowResponse as any).assertion &&\n authId\n ) {\n try {\n const oauth2Response: Response = await fetch(`${baseUrl}/oauth2/authorize`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n body: JSON.stringify({\n assertion: (flowResponse as any).assertion,\n authId,\n }),\n credentials: 'include',\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 = 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 {EmbeddedFlowExecuteRequestConfig, EmbeddedFlowResponseType, EmbeddedFlowType} from '../embedded-flow';\n\n/**\n * Status enumeration for AsgardeoV2 embedded sign-up flow responses.\n *\n * This enum defines the possible states of a sign-up flow operation,\n * allowing client applications to determine the next appropriate action.\n *\n * @experimental Part of the new AsgardeoV2 API\n */\nexport enum EmbeddedSignUpFlowStatusV2 {\n /**\n * Sign-up flow has completed successfully.\n *\n * When this status is returned, the user has successfully registered\n * and the flow can proceed to redirection or completion handling.\n * The response will typically contain redirect information.\n */\n Complete = 'COMPLETE',\n\n /**\n * Sign-up flow is in progress and requires additional user input.\n *\n * This status indicates that more steps are needed to complete the\n * sign-up process. The response will contain form components or\n * actions that need to be presented to the user.\n */\n Incomplete = 'INCOMPLETE',\n\n /**\n * Sign-up flow encountered an error and cannot proceed.\n *\n * When this status is returned, the response will be of type\n * `EmbeddedSignUpFlowErrorResponseV2` and will contain a `failureReason`\n * field with details about what went wrong. This triggers error\n * handling in the React components to display user-friendly messages.\n *\n * @see {@link EmbeddedSignUpFlowErrorResponseV2} for error response structure\n */\n Error = 'ERROR',\n}\n\nexport enum EmbeddedSignUpFlowTypeV2 {\n Redirection = 'REDIRECTION',\n View = 'VIEW',\n}\n\n/**\n * Extended response structure for the embedded sign-up flow V2.\n * @remarks This response is only done from the SDK level.\n * @experimental\n */\nexport interface ExtendedEmbeddedSignUpFlowResponseV2 {\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 V2 embedded sign-up flow.\n *\n * This interface defines the structure for successful sign-up flow responses\n * from AsgardeoV2 APIs. For error responses, see `EmbeddedSignUpFlowErrorResponseV2`.\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 `EmbeddedSignUpFlowErrorResponseV2` 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 AsgardeoV2 API\n * @see {@link EmbeddedSignUpFlowErrorResponseV2} for error response structure\n * @see {@link EmbeddedSignUpFlowStatusV2} for available flow statuses\n */\nexport interface EmbeddedSignUpFlowResponseV2 extends ExtendedEmbeddedSignUpFlowResponseV2 {\n /**\n * Unique identifier for this sign-up flow instance.\n */\n flowId: 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: EmbeddedSignUpFlowStatusV2;\n\n /**\n * Type of response, indicating the expected user interaction.\n */\n type: EmbeddedSignUpFlowTypeV2;\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 type: EmbeddedFlowResponseType;\n id: string;\n }[];\n\n /**\n * Input fields required for the current step of the sign-up flow.\n */\n inputs?: {\n name: string;\n type: string;\n required: boolean;\n }[];\n };\n}\n\n/**\n * Response structure for the new Asgardeo V2 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 V2 embedded sign-up flow.\n * @experimental\n */\nexport type EmbeddedSignUpFlowInitiateRequestV2 = {\n applicationId: string;\n flowType: EmbeddedFlowType;\n};\n\n/**\n * Request payload for executing steps in the new Asgardeo V2 embedded sign-up flow.\n * @experimental\n */\nexport interface EmbeddedSignUpFlowRequestV2 extends Partial<EmbeddedSignUpFlowInitiateRequestV2> {\n flowId?: string;\n actionId?: string;\n inputs?: Record<string, any>;\n}\n\n/**\n * Request config for executing the new Asgardeo V2 embedded sign-up flow.\n * @experimental\n */\nexport interface EmbeddedFlowExecuteRequestConfigV2<T = any> extends EmbeddedFlowExecuteRequestConfig<T> {\n authId?: string;\n}\n\n/**\n * Error response structure for the new Asgardeo V2 embedded sign-up flow.\n *\n * This interface defines the structure of error responses returned by AsgardeoV2 APIs\n * when sign-up operations fail. Unlike AsgardeoV1 which uses generic error codes and\n * descriptions, AsgardeoV2 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 `flowId` 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 AsgardeoV2 error response\n * const errorResponse: EmbeddedSignUpFlowErrorResponseV2 = {\n * flowId: \"0ccfeaf9-18b3-43a5-bcc1-07d863dcb2c0\",\n * flowStatus: EmbeddedSignUpFlowStatusV2.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 AsgardeoV2 API and may change in future versions\n * @see {@link EmbeddedSignUpFlowStatusV2.Error} for the error status enum value\n * @see {@link EmbeddedSignUpFlowResponseV2} for the corresponding success response structure\n */\nexport interface EmbeddedSignUpFlowErrorResponseV2 {\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 flowId: string;\n\n /**\n * Status of the sign-up flow, which will be `EmbeddedSignUpFlowStatusV2.Error`\n * for error responses. This field is used by error detection logic to\n * identify failed flow responses.\n */\n flowStatus: EmbeddedSignUpFlowStatusV2;\n\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 failureReason: 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 {\n EmbeddedFlowExecuteRequestConfigV2,\n EmbeddedSignUpFlowResponseV2,\n EmbeddedSignUpFlowStatusV2,\n} from '../../models/v2/embedded-signup-flow-v2';\nimport AsgardeoAPIError from '../../errors/AsgardeoAPIError';\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 let endpoint: string = url ?? `${baseUrl}/flow/execute`;\n\n const response: Response = await fetch(endpoint, {\n ...requestConfig,\n method: requestConfig.method || 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n body: JSON.stringify(payload),\n });\n\n if (!response.ok) {\n const errorText = 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 authorize.\n if (\n flowResponse.flowStatus === EmbeddedSignUpFlowStatusV2.Complete &&\n (flowResponse as any).assertion &&\n authId\n ) {\n try {\n const oauth2Response: Response = await fetch(`${baseUrl}/oauth2/authorize`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n body: JSON.stringify({\n assertion: (flowResponse as any).assertion,\n authId,\n }),\n credentials: 'include',\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 = 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\n/**\n * Constants representing Application Native Authentication related configurations and constants.\n */\nconst ApplicationNativeAuthenticationConstants = {\n SupportedAuthenticators: {\n IdentifierFirst: 'SWRlbnRpZmllckV4ZWN1dG9yOkxPQ0FM',\n EmailOtp: 'ZW1haWwtb3RwLWF1dGhlbnRpY2F0b3I6TE9DQUw',\n Totp: 'dG90cDpMT0NBTA',\n UsernamePassword: 'QmFzaWNBdXRoZW50aWNhdG9yOkxPQ0FM',\n PushNotification: 'cHVzaC1ub3RpZmljYXRpb24tYXV0aGVudGljYXRvcjpMT0NBTA',\n Passkey: 'RklET0F1dGhlbnRpY2F0b3I6TE9DQUw',\n SmsOtp: 'c21zLW90cC1hdXRoZW50aWNhdG9yOkxPQ0FM',\n MagicLink: 'TWFnaWNMaW5rQXV0aGVudGljYXRvcjpMT0NBTA',\n Google: 'R29vZ2xlT0lEQ0F1dGhlbnRpY2F0b3I6R29vZ2xl',\n GitHub: 'R2l0aHViQXV0aGVudGljYXRvcjpHaXRIdWI',\n Microsoft: 'T3BlbklEQ29ubmVjdEF1dGhlbnRpY2F0b3I6TWljcm9zb2Z0',\n Facebook: 'RmFjZWJvb2tBdXRoZW50aWNhdG9yOkZhY2Vib29r',\n LinkedIn: 'TGlua2VkSW5PSURDOkxpbmtlZElu',\n SignInWithEthereum: 'T3BlbklEQ29ubmVjdEF1dGhlbnRpY2F0b3I6U2lnbiBJbiBXaXRoIEV0aGVyZXVt',\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\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 /** WSO2 Identity Server (on-prem or custom domains) */\n IdentityServer = 'IDENTITY_SERVER',\n /** @experimental WSO2 Asgardeo V2 */\n AsgardeoV2 = 'AsgardeoV2',\n /** Unknown or unsupported platform */\n Unknown = 'UNKNOWN',\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 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\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) 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 name: string;\n type: string;\n multiValued: boolean;\n description?: string;\n required?: boolean;\n caseExact: boolean;\n mutability: string;\n returned: string;\n uniqueness: string;\n displayName?: string;\n displayOrder?: string;\n regEx?: string;\n supportedByDefault?: string;\n sharedProfileValueResolvingMethod?: string;\n subAttributes?: SchemaAttribute[];\n}\n\n/**\n * Represents a SCIM2 schema definition\n */\nexport interface Schema {\n /** Schema identifier */\n id: string;\n /** Schema name */\n name: string;\n /** Schema description */\n description: string;\n /** Schema attributes */\n attributes: SchemaAttribute[];\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 /** User Schema */\n User = 'urn:ietf:params:scim:schemas:core:2.0: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 /** Custom User Schema */\n CustomUser = 'urn:scim:schemas:extension:custom: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 Text = 'TEXT',\n Password = 'PASSWORD',\n Email = 'EMAIL',\n Number = 'NUMBER',\n Select = 'SELECT',\n Checkbox = 'CHECKBOX',\n Radio = 'RADIO',\n Otp = 'OTP',\n Date = 'DATE',\n Time = 'TIME',\n Textarea = 'TEXTAREA',\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 {AllOrganizationsApiResponse} from './models/organization';\nimport {AsgardeoClient} from './models/client';\nimport {Config, SignInOptions, SignOutOptions, SignUpOptions} from './models/config';\nimport {Storage} from './models/store';\nimport {EmbeddedFlowExecuteRequestPayload, EmbeddedFlowExecuteResponse} from './models/embedded-flow';\nimport {EmbeddedSignInFlowHandleRequestPayload} from './models/embedded-signin-flow';\nimport {TokenExchangeRequestConfig, TokenResponse} from './models/token';\nimport {Organization} from './models/organization';\nimport {User, UserProfile} from './models/user';\n\n/**\n * Base class for implementing Asgardeo clients.\n * This class provides the core functionality for managing user authentication and sessions.\n *\n * @typeParam T - Configuration type that extends Config.\n */\nabstract class AsgardeoJavaScriptClient<T = Config> implements AsgardeoClient<T> {\n abstract switchOrganization(organization: Organization, sessionId?: string): Promise<TokenResponse | Response>;\n\n abstract initialize(config: T, storage?: Storage): Promise<boolean>;\n\n abstract reInitialize(config: Partial<T>): Promise<boolean>;\n\n abstract getUser(options?: any): Promise<User>;\n\n abstract getAllOrganizations(options?: any, sessionId?: string): Promise<AllOrganizationsApiResponse>;\n\n abstract getMyOrganizations(options?: any, sessionId?: string): Promise<Organization[]>;\n\n abstract getCurrentOrganization(sessionId?: string): Promise<Organization | null>;\n\n abstract getUserProfile(options?: any): Promise<UserProfile>;\n\n abstract isLoading(): boolean;\n\n abstract isSignedIn(): Promise<boolean>;\n\n abstract updateUserProfile(payload: any, userId?: string): Promise<User>;\n\n abstract getConfiguration(): T;\n\n abstract exchangeToken(config: TokenExchangeRequestConfig, sessionId?: string): Promise<TokenResponse | Response>;\n\n abstract signIn(\n options?: SignInOptions,\n sessionId?: string,\n onSignInSuccess?: (afterSignInUrl: string) => void,\n ): Promise<User>;\n abstract signIn(\n payload: EmbeddedSignInFlowHandleRequestPayload,\n request: Request,\n sessionId?: string,\n onSignInSuccess?: (afterSignInUrl: string) => void,\n ): Promise<User>;\n\n abstract signInSilently(options?: SignInOptions): Promise<User | boolean>;\n\n abstract signOut(options?: SignOutOptions, afterSignOut?: (afterSignOutUrl: string) => void): Promise<string>;\n abstract signOut(\n options?: SignOutOptions,\n sessionId?: string,\n afterSignOut?: (afterSignOutUrl: string) => void,\n ): Promise<string>;\n\n abstract signUp(options?: SignUpOptions): Promise<void>;\n abstract signUp(payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse>;\n abstract signUp(payload?: unknown): Promise<void> | Promise<EmbeddedFlowExecuteResponse>;\n\n abstract getAccessToken(sessionId?: string): Promise<string>;\n\n abstract clearSession(sessionId?: string): void;\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, ThemeMode, ThemeVars} from './types';\nimport {RecursivePartial} from '../models/utility-types';\nimport VendorConstants from '../constants/VendorConstants';\n\nconst lightTheme: ThemeConfig = {\n colors: {\n action: {\n active: 'rgba(0, 0, 0, 0.54)',\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 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 activatedOpacity: 0.12,\n },\n primary: {\n main: '#1a73e8',\n contrastText: '#ffffff',\n dark: '#174ea6',\n },\n secondary: {\n main: '#424242',\n contrastText: '#ffffff',\n dark: '#212121',\n },\n background: {\n surface: '#ffffff',\n disabled: '#f0f0f0',\n dark: '#212121',\n body: {\n main: '#1a1a1a',\n dark: '#212121',\n },\n },\n error: {\n main: '#d32f2f',\n contrastText: '#d52828',\n dark: '#b71c1c',\n },\n info: {\n main: '#bbebff',\n contrastText: '#43aeda',\n dark: '#01579b',\n },\n success: {\n main: '#4caf50',\n contrastText: '#00a807',\n dark: '#388e3c',\n },\n warning: {\n main: '#ff9800',\n contrastText: '#be7100',\n dark: '#f57c00',\n },\n text: {\n primary: '#1a1a1a',\n secondary: '#666666',\n dark: '#212121',\n },\n border: '#e0e0e0',\n },\n spacing: {\n unit: 8,\n },\n borderRadius: {\n small: '4px',\n medium: '8px',\n large: '16px',\n },\n shadows: {\n small: '0 2px 8px rgba(0, 0, 0, 0.1)',\n medium: '0 4px 16px rgba(0, 0, 0, 0.15)',\n large: '0 8px 32px rgba(0, 0, 0, 0.2)',\n },\n typography: {\n fontFamily: '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n fontSizes: {\n xs: '0.75rem', // 12px\n sm: '0.875rem', // 14px\n md: '1rem', // 16px\n lg: '1.125rem', // 18px\n xl: '1.25rem', // 20px\n '2xl': '1.5rem', // 24px\n '3xl': '2.125rem', // 34px\n },\n fontWeights: {\n normal: 400,\n medium: 500,\n semibold: 600,\n bold: 700,\n },\n lineHeights: {\n tight: 1.2,\n normal: 1.4,\n relaxed: 1.6,\n },\n },\n images: {\n favicon: {},\n logo: {},\n },\n};\n\nconst darkTheme: ThemeConfig = {\n colors: {\n action: {\n active: '#1c1c1c',\n hover: '#1c1c1c',\n hoverOpacity: 0.04,\n selected: '#1c1c1c',\n selectedOpacity: 0.08,\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 activatedOpacity: 0.12,\n },\n primary: {\n main: '#1a73e8',\n contrastText: '#ffffff',\n dark: '#174ea6',\n },\n secondary: {\n main: '#8b8b8b',\n contrastText: '#ffffff',\n dark: '#212121',\n },\n background: {\n surface: '#121212',\n disabled: '#1f1f1f',\n dark: '#212121',\n body: {\n main: '#ffffff',\n dark: '#212121',\n },\n },\n error: {\n main: '#d32f2f',\n contrastText: '#d52828',\n dark: '#b71c1c',\n },\n info: {\n main: '#bbebff',\n contrastText: '#43aeda',\n dark: '#01579b',\n },\n success: {\n main: '#4caf50',\n contrastText: '#00a807',\n dark: '#388e3c',\n },\n warning: {\n main: '#ff9800',\n contrastText: '#be7100',\n dark: '#f57c00',\n },\n text: {\n primary: '#ffffff',\n secondary: '#b3b3b3',\n dark: '#212121',\n },\n border: '#404040',\n },\n spacing: {\n unit: 8,\n },\n borderRadius: {\n small: '4px',\n medium: '8px',\n large: '16px',\n },\n shadows: {\n small: '0 2px 8px rgba(0, 0, 0, 0.3)',\n medium: '0 4px 16px rgba(0, 0, 0, 0.4)',\n large: '0 8px 32px rgba(0, 0, 0, 0.5)',\n },\n typography: {\n fontFamily: '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n fontSizes: {\n xs: '0.75rem', // 12px\n sm: '0.875rem', // 14px\n md: '1rem', // 16px\n lg: '1.125rem', // 18px\n xl: '1.25rem', // 20px\n '2xl': '1.5rem', // 24px\n '3xl': '2.125rem', // 34px\n },\n fontWeights: {\n normal: 400,\n medium: 500,\n semibold: 600,\n bold: 700,\n },\n lineHeights: {\n tight: 1.2,\n normal: 1.4,\n relaxed: 1.6,\n },\n },\n images: {\n favicon: {},\n logo: {},\n },\n};\n\nconst toCssVariables = (theme: ThemeConfig): Record<string, string> => {\n const cssVars: Record<string, string> = {};\n const prefix = 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\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\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\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\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\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 => {\n const imageConfig = 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 = 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 colors: {\n action: {\n active: `var(--${prefix}-color-action-active)`,\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 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 activatedOpacity: `var(--${prefix}-color-action-activatedOpacity)`,\n },\n primary: {\n main: `var(--${prefix}-color-primary-main)`,\n contrastText: `var(--${prefix}-color-primary-contrastText)`,\n },\n secondary: {\n main: `var(--${prefix}-color-secondary-main)`,\n contrastText: `var(--${prefix}-color-secondary-contrastText)`,\n },\n background: {\n surface: `var(--${prefix}-color-background-surface)`,\n disabled: `var(--${prefix}-color-background-disabled)`,\n body: {\n main: `var(--${prefix}-color-background-body-main)`,\n },\n },\n error: {\n main: `var(--${prefix}-color-error-main)`,\n contrastText: `var(--${prefix}-color-error-contrastText)`,\n },\n info: {\n contrastText: `var(--${prefix}-color-info-contrastText)`,\n main: `var(--${prefix}-color-info-main)`,\n },\n success: {\n main: `var(--${prefix}-color-success-main)`,\n contrastText: `var(--${prefix}-color-success-contrastText)`,\n },\n warning: {\n main: `var(--${prefix}-color-warning-main)`,\n contrastText: `var(--${prefix}-color-warning-contrastText)`,\n },\n text: {\n primary: `var(--${prefix}-color-text-primary)`,\n secondary: `var(--${prefix}-color-text-secondary)`,\n },\n border: `var(--${prefix}-color-border)`,\n },\n spacing: {\n unit: `var(--${prefix}-spacing-unit)`,\n },\n borderRadius: {\n small: `var(--${prefix}-border-radius-small)`,\n medium: `var(--${prefix}-border-radius-medium)`,\n large: `var(--${prefix}-border-radius-large)`,\n },\n shadows: {\n small: `var(--${prefix}-shadow-small)`,\n medium: `var(--${prefix}-shadow-medium)`,\n large: `var(--${prefix}-shadow-large)`,\n },\n typography: {\n fontFamily: `var(--${prefix}-typography-fontFamily)`,\n fontSizes: {\n xs: `var(--${prefix}-typography-fontSize-xs)`,\n sm: `var(--${prefix}-typography-fontSize-sm)`,\n md: `var(--${prefix}-typography-fontSize-md)`,\n lg: `var(--${prefix}-typography-fontSize-lg)`,\n xl: `var(--${prefix}-typography-fontSize-xl)`,\n '2xl': `var(--${prefix}-typography-fontSize-2xl)`,\n '3xl': `var(--${prefix}-typography-fontSize-3xl)`,\n },\n fontWeights: {\n normal: `var(--${prefix}-typography-fontWeight-normal)`,\n medium: `var(--${prefix}-typography-fontWeight-medium)`,\n semibold: `var(--${prefix}-typography-fontWeight-semibold)`,\n bold: `var(--${prefix}-typography-fontWeight-bold)`,\n },\n lineHeights: {\n tight: `var(--${prefix}-typography-lineHeight-tight)`,\n normal: `var(--${prefix}-typography-lineHeight-normal)`,\n relaxed: `var(--${prefix}-typography-lineHeight-relaxed)`,\n },\n },\n };\n\n // Add images if they exist\n if (theme.images) {\n themeVars.images = {};\n Object.keys(theme.images).forEach(imageKey => {\n const imageConfig = theme.images![imageKey];\n themeVars.images![imageKey] = {\n url: imageConfig?.url ? `var(--${prefix}-image-${imageKey}-url)` : undefined,\n title: imageConfig?.title ? `var(--${prefix}-image-${imageKey}-title)` : undefined,\n alt: imageConfig?.alt ? `var(--${prefix}-image-${imageKey}-alt)` : 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 = false): Theme => {\n const baseTheme = isDark ? darkTheme : lightTheme;\n\n const mergedConfig = {\n ...baseTheme,\n ...config,\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 spacing: {\n ...baseTheme.spacing,\n ...config.spacing,\n },\n borderRadius: {\n ...baseTheme.borderRadius,\n ...config.borderRadius,\n },\n shadows: {\n ...baseTheme.shadows,\n ...config.shadows,\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 images: {\n ...baseTheme.images,\n ...config.images,\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 = 0; i < bytes.byteLength; i++) {\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 = 0; i < binaryString.length; i++) {\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 = 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 year: 'numeric',\n month: 'long',\n day: '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 * 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 return (\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\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 = {...target} as T;\n\n sources.forEach(source => {\n if (!source || typeof source !== 'object') {\n return;\n }\n\n Object.keys(source).forEach(key => {\n const sourceValue = source[key];\n const targetValue = (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 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 = parsedUrl.pathname?.split('/')?.filter(segment => segment?.length > 0);\n\n if (pathSegments.length < 2 || pathSegments[0] !== 't') {\n console.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 = pathSegments[1];\n\n if (!organizationHandle || organizationHandle.trim().length === 0) {\n console.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).\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 /** Minimum log level to output */\n level: LogLevel;\n /** Custom prefix for all log messages */\n prefix?: string;\n /** Whether to include timestamps */\n timestamps?: boolean;\n /** Whether to include log level in output */\n showLevel?: boolean;\n /** Custom log formatter function */\n formatter?: (level: LogLevel, message: string, ...args: any[]) => void;\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 timestamps: true,\n showLevel: true,\n};\n\n/**\n * Environment detection utilities\n */\nconst isBrowser = (): boolean => {\n /* @ts-ignore */\n return typeof window !== 'undefined' && typeof window.document !== 'undefined';\n};\n\nconst isNode = (): boolean => {\n /* @ts-ignore */\n return typeof process !== 'undefined' && process.versions && process.versions.node;\n};\n\n/**\n * Color codes for terminal output (Node.js)\n */\nconst COLORS = {\n reset: '\\x1b[0m',\n bright: '\\x1b[1m',\n dim: '\\x1b[2m',\n red: '\\x1b[31m',\n green: '\\x1b[32m',\n yellow: '\\x1b[33m',\n blue: '\\x1b[34m',\n magenta: '\\x1b[35m',\n cyan: '\\x1b[36m',\n white: '\\x1b[37m',\n gray: '\\x1b[90m',\n};\n\n/**\n * Browser console styling\n */\nconst BROWSER_STYLES = {\n debug: 'color: #6b7280; font-weight: normal;',\n info: 'color: #2563eb; font-weight: bold;',\n warn: 'color: #d97706; font-weight: bold;',\n error: 'color: #dc2626; font-weight: bold;',\n prefix: 'color: #7c3aed; font-weight: bold;',\n timestamp: 'color: #6b7280; font-size: 0.9em;',\n};\n\nconst LOG_LEVEL_ORDER: Record<LogLevel, number> = {\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\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 getTimestamp(): string {\n return new Date().toISOString();\n }\n\n /**\n * Get log level string\n */\n private 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}[${this.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 = this.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 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[${this.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 = this.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 = parts.join(' ');\n\n // Use appropriate console method\n switch (level) {\n case 'debug':\n console.debug(formattedMessage, ...styles, ...args);\n break;\n case 'info':\n console.info(formattedMessage, ...styles, ...args);\n break;\n case 'warn':\n console.warn(formattedMessage, ...styles, ...args);\n break;\n case 'error':\n console.error(formattedMessage, ...styles, ...args);\n break;\n default:\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 = this.formatForNode(level, message);\n\n // Use appropriate console method\n switch (level) {\n case 'debug':\n console.debug(formattedMessage, ...args);\n break;\n case 'info':\n console.info(formattedMessage, ...args);\n break;\n case 'warn':\n console.warn(formattedMessage, ...args);\n break;\n case 'error':\n console.error(formattedMessage, ...args);\n break;\n default:\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 = 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 = new Logger();\n\n/**\n * Create a new logger instance with custom configuration\n */\nexport const createLogger = (config?: Partial<LoggerConfig>): Logger => {\n return new Logger(config);\n};\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[]) => logger.debug(message, ...args);\nexport const info = (message: string, ...args: any[]) => logger.info(message, ...args);\nexport const warn = (message: string, ...args: any[]) => logger.warn(message, ...args);\nexport const error = (message: string, ...args: any[]) => logger.error(message, ...args);\n\n/**\n * Configure the default logger\n */\nexport const configure = (config: Partial<LoggerConfig>) => logger.configure(config);\n\n/**\n * Create component-specific loggers\n */\nexport const createComponentLogger = (component: string) => {\n return logger.child(component);\n};\n\n/**\n * Create package-specific logger\n */\nexport const createPackageLogger = (packageName: string) => {\n return createLogger({\n prefix: `${PREFIX} - ${packageName}`,\n level: 'info',\n timestamps: true,\n showLevel: true,\n });\n};\n\n/**\n * Create package component logger (package + component)\n */\nexport const createPackageComponentLogger = (packageName: string, component: string) => {\n const packageLogger = createPackageLogger(packageName);\n return packageLogger.child(component);\n};\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 AsgardeoRuntimeError from \"../errors/AsgardeoRuntimeError\";\nimport logger from \"./logger\";\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 = parsedUrl.pathname?.split('/')?.filter(segment => segment?.length > 0);\n\n if (pathSegments.length < 2 || pathSegments[0] !== 't') {\n logger.warn('[isRecognizedBaseUrlPattern] The provided base URL does not follow the expected URL pattern (/t/{orgHandle}).');\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 => {\n if (schema.attributes && Array.isArray(schema.attributes)) {\n schema.attributes.forEach(attribute => {\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 => {\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 = Array.isArray(path) ? path : path.split('.');\n\n const result = pathArray.reduce((current, key) => {\n return current?.[key];\n }, 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 = Array.isArray(path) ? path : path.split('.');\n const lastIndex = pathArray.length - 1;\n\n pathArray.reduce((current, key, index) => {\n if (index === lastIndex) {\n current[key] = value;\n } else {\n 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 = pathArray[index + 1];\n current[key] = /^\\d+$/.test(nextKey) ? [] : {};\n }\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 => {\n const {name, type, multiValued} = schema;\n\n if (!name) return;\n\n let value = get(meResponse, name);\n\n if (value !== undefined) {\n if (multiValued && !Array.isArray(value)) {\n value = [value];\n }\n } else {\n if (multiValued) {\n value = undefined;\n } else if (type === 'STRING') {\n value = '';\n } else {\n value = undefined;\n }\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 PKCEConstants from '../constants/PKCEConstants';\nimport {TemporaryStore} from '../models/store';\nimport generateStateParamForRequestCorrelation from './generateStateParamForRequestCorrelation';\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 = 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 // 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 {Config} from '../models/config';\nimport {Platform} from '../models/platforms';\nimport isRecognizedBaseUrlPattern from './isRecognizedBaseUrlPattern';\nimport logger from './logger';\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 = 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 {Config} from '../models/config';\nimport isRecognizedBaseUrlPattern from './isRecognizedBaseUrlPattern';\nimport identifyPlatform from './identifyPlatform';\nimport {Platform} from '../models/platforms';\nimport logger from './logger';\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) 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 } else 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';\nimport {EmbeddedSignInFlowAuthenticatorExtendedParamType} from '../models/embedded-signin-flow';\nimport {FieldType} from '../models/field';\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) 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, ThemeVariant} from '../models/branding-preference';\nimport {Theme, ThemeConfig} from '../theme/types';\nimport createTheme from '../theme/createTheme';\n\n/**\n * Safely extracts a color value from the branding preference structure\n */\ntype ColorVariant = {main?: string; dark?: string; contrastText?: string};\ntype TextColors = {primary?: string; secondary?: string; dark?: string};\n\nconst extractColorValue = (colorVariant?: ColorVariant, preferDark = 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?: {main?: string; contrastText?: string}) => {\n return colorVariant?.contrastText;\n};\n\n/**\n * Transforms a ThemeVariant from branding preference to ThemeConfig\n */\nconst transformThemeVariant = (themeVariant: ThemeVariant, isDark = false): Partial<ThemeConfig> => {\n const colors = themeVariant.colors;\n const buttons = themeVariant.buttons;\n const inputs = themeVariant.inputs;\n const images = themeVariant.images;\n\n const config: Partial<ThemeConfig> = {\n colors: {\n action: {\n active: isDark ? 'rgba(255, 255, 255, 0.70)' : 'rgba(0, 0, 0, 0.54)',\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 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 activatedOpacity: 0.12,\n },\n primary: {\n main: extractColorValue(colors?.primary as ColorVariant, isDark),\n contrastText: extractContrastText(colors?.primary),\n dark: colors?.primary?.dark || (colors?.primary as ColorVariant)?.main,\n },\n secondary: {\n main: extractColorValue(colors?.secondary as ColorVariant, isDark),\n contrastText: extractContrastText(colors?.secondary),\n dark: colors?.secondary?.dark || (colors?.secondary as ColorVariant)?.main,\n },\n background: {\n surface: extractColorValue(colors?.background?.surface as ColorVariant, isDark),\n disabled: extractColorValue(colors?.background?.surface as ColorVariant, isDark),\n dark:\n (colors?.background?.surface as ColorVariant)?.dark || (colors?.background?.surface as ColorVariant)?.main,\n body: {\n main: extractColorValue(colors?.background?.body as ColorVariant, isDark),\n dark: (colors?.background?.body as ColorVariant)?.dark || (colors?.background?.body as ColorVariant)?.main,\n },\n },\n text: {\n primary: (colors?.text as TextColors)?.primary,\n secondary: (colors?.text as TextColors)?.secondary,\n dark: (colors?.text as TextColors)?.dark || (colors?.text as TextColors)?.primary,\n },\n border: colors?.outlined?.default,\n error: {\n main: extractColorValue(colors?.alerts?.error as ColorVariant, isDark),\n contrastText: extractContrastText(colors?.alerts?.error),\n dark: (colors?.alerts?.error as ColorVariant)?.dark || (colors?.alerts?.error as ColorVariant)?.main,\n },\n info: {\n main: extractColorValue(colors?.alerts?.info as ColorVariant, isDark),\n contrastText: extractContrastText(colors?.alerts?.info),\n dark: (colors?.alerts?.info as ColorVariant)?.dark || (colors?.alerts?.info as ColorVariant)?.main,\n },\n success: {\n main: extractColorValue(colors?.alerts?.neutral as ColorVariant, isDark),\n contrastText: extractContrastText(colors?.alerts?.neutral),\n dark: (colors?.alerts?.neutral as ColorVariant)?.dark || (colors?.alerts?.neutral as ColorVariant)?.main,\n },\n warning: {\n main: extractColorValue(colors?.alerts?.warning as ColorVariant, isDark),\n contrastText: extractContrastText(colors?.alerts?.warning),\n dark: (colors?.alerts?.warning as ColorVariant)?.dark || (colors?.alerts?.warning as ColorVariant)?.main,\n },\n },\n images: {\n favicon: images?.favicon\n ? {\n url: images.favicon.imgURL,\n title: images.favicon.title,\n alt: images.favicon.altText,\n }\n : undefined,\n logo: images?.logo\n ? {\n url: images.logo.imgURL,\n title: images.logo.title,\n alt: images.logo.altText,\n }\n : undefined,\n },\n };\n\n /* |---------------------------------------------------------------| */\n /* | Components | */\n /* |---------------------------------------------------------------| */\n\n const buttonBorderRadius = buttons?.primary?.base?.border?.borderRadius;\n const fieldBorderRadius = 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 = 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 = themeConfig[activeThemeKey as keyof typeof themeConfig] as ThemeVariant;\n\n if (!themeVariant) {\n // If the specified theme variant doesn't exist, fallback to light theme\n const fallbackVariant = themeConfig.LIGHT || themeConfig.DARK;\n if (fallbackVariant) {\n const transformedConfig = 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 = 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"],
5
- "mappings": ";;;;;AA2BO,IAAM,0BAAkC;AAE/C,IAAM,iBAAN,MAAwB;AAAA,EAGf,YAAY,YAAoB,OAAgB;AAFvD,wBAAU;AACV,wBAAU;AAER,SAAK,MAAM;AACX,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,MAAgB,cAAc,KAAa,MAAqC;AAC9E,UAAM,mBAA4B,MAAM,KAAK,OAAO,QAAQ,GAAG,KAAM;AACrE,UAAM,eAA+B,oBAAoB,KAAK,MAAM,gBAAgB;AAEpF,UAAM,gBAAgC,EAAC,GAAG,cAAc,GAAG,KAAI;AAC/D,UAAM,oBAA4B,KAAK,UAAU,aAAa;AAE9D,UAAM,KAAK,OAAO,QAAQ,KAAK,iBAAiB;AAAA,EAClD;AAAA,EAEA,MAAgB,SACd,KACA,WACA,OACe;AACf,UAAM,mBAA4B,MAAM,KAAK,OAAO,QAAQ,GAAG,KAAM;AACrE,UAAM,eAA+B,oBAAoB,KAAK,MAAM,gBAAgB;AAEpF,UAAM,gBAAgC,EAAC,GAAG,cAAc,CAAC,SAAS,GAAG,MAAK;AAC1E,UAAM,oBAA4B,KAAK,UAAU,aAAa;AAE9D,UAAM,KAAK,OAAO,QAAQ,KAAK,iBAAiB;AAAA,EAClD;AAAA,EAEA,MAAgB,YACd,KACA,WACe;AACf,UAAM,mBAA4B,MAAM,KAAK,OAAO,QAAQ,GAAG,KAAM;AACrE,UAAM,eAA+B,oBAAoB,KAAK,MAAM,gBAAgB;AAEpF,UAAM,gBAAgC,E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B,iBAAiB,mBAAmB,MAAM;AAC1F,aAAO,oBAAYA,oBAAmB,mBAAmB,MAAM;AAAA,IACjE;AAEA,WAAO,oBAAY,CAAC,GAAG,mBAAmB,MAAM;AAAA,EAClD;AAGA,QAAM,oBAAoB,sBAAsB,cAAc,mBAAmB,MAAM;AAGvF,SAAO,oBAAY,mBAAmB,mBAAmB,MAAM;AACjE;AAEA,IAAO,6CAAQ;",
6
- "names": ["error", "error", "error", "tokenResponse", "error", "error", "error", "EmbeddedFlowType", "EmbeddedFlowStatus", "EmbeddedFlowResponseType", "EmbeddedFlowComponentType", "error", "error", "error", "error", "error", "error", "error", "error", "error", "error", "error", "EmbeddedSignInFlowStatusV2", "EmbeddedSignInFlowTypeV2", "EmbeddedSignUpFlowStatusV2", "EmbeddedSignUpFlowTypeV2", "Platform", "EmbeddedSignInFlowStatus", "EmbeddedSignInFlowType", "EmbeddedSignInFlowStepType", "EmbeddedSignInFlowAuthenticatorParamType", "EmbeddedSignInFlowAuthenticatorKnownIdPType", "EmbeddedSignInFlowAuthenticatorPromptType", "FlowMode", "WellKnownSchemaIds", "FieldType", "error", "error", "error", "url", "transformedConfig"]
3
+ "sources": ["../src/StorageManager.ts", "../src/constants/OIDCDiscoveryConstants.ts", "../src/constants/ScopeConstants.ts", "../src/constants/OIDCRequestConstants.ts", "../src/errors/exception.ts", "../src/constants/TokenConstants.ts", "../src/IsomorphicCrypto.ts", "../src/constants/PKCEConstants.ts", "../src/utils/extractPkceStorageKeyFromState.ts", "../src/constants/TokenExchangeConstants.ts", "../src/utils/extractUserClaimsFromIdToken.ts", "../src/errors/AsgardeoError.ts", "../src/errors/AsgardeoRuntimeError.ts", "../src/utils/processOpenIDScopes.ts", "../src/__legacy__/helpers/authentication-helper.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/constants/ApplicationNativeAuthenticationConstants.ts", "../src/constants/VendorConstants.ts", "../src/models/platforms.ts", "../src/models/embedded-signin-flow.ts", "../src/models/v2/embedded-flow-v2.ts", "../src/models/flow.ts", "../src/models/scim2-schema.ts", "../src/models/field.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/deepMerge.ts", "../src/utils/deriveOrganizationHandleFromBaseUrl.ts", "../src/utils/logger.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/removeTrailingSlash.ts", "../src/utils/resolveFieldType.ts", "../src/utils/resolveFieldName.ts", "../src/utils/withVendorCSSClassPrefix.ts", "../src/utils/transformBrandingPreferenceToTheme.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\nimport {Stores} from './models/store';\nimport {Storage} from './models/store';\nimport {AuthClientConfig} from './__legacy__/models';\nimport {SessionData} from './models/session';\nimport {TemporaryStore, TemporaryStoreValue} from './models/store';\nimport {OIDCDiscoveryApiResponse} from './models/oidc-discovery';\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 protected _store: Storage;\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): string {\n return userId ? `${store}-${this._id}-${userId}` : `${store}-${this._id}`;\n }\n\n protected 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 getSessionData(userId?: string): Promise<SessionData> {\n return JSON.parse((await this._store.getData(this._resolveKey(Stores.SessionData, userId))) ?? 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 public setSessionStatus(status: string): void {\n // Using local storage to store the session status as it is required to be available across tabs.\n this.isLocalStorageAvailable() && localStorage.setItem(`${ASGARDEO_SESSION_ACTIVE}`, status);\n }\n\n public getSessionStatus(): string {\n return this.isLocalStorageAvailable() ? localStorage.getItem(`${ASGARDEO_SESSION_ACTIVE}`) ?? '' : '';\n }\n\n public removeSessionStatus(): void {\n this.isLocalStorageAvailable() && localStorage.removeItem(`${ASGARDEO_SESSION_ACTIVE}`);\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 * 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 /**\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 * 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 * 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 * 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 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 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 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 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 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 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 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 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 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 * 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 * 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 /**\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) 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 public code: string | undefined;\n public message: string;\n\n public constructor(\n code: string,\n name: string,\n message: string\n ) {\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 * 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 /**\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 {AsgardeoAuthException} from './errors/exception';\nimport {Crypto, JWKInterface} from './models/crypto';\nimport {IdToken} from './models/token';\nimport TokenConstants from './constants/TokenConstants';\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 getCodeChallenge(verifier: string): string {\n return this._cryptoUtils.base64URLEncode(this._cryptoUtils.hashSha256(verifier));\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 for (const key of keys) {\n if (headerJSON['kid'] === key.kid) {\n return key;\n }\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: ' +\n 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) => {\n return Promise.reject(error);\n });\n }\n\n /**\n * This function decodes the payload of an id token and returns it.\n *\n * @param idToken - The id token to be decoded.\n *\n * @returns - The decoded payload of the id token.\n *\n * @throws\n */\n public decodeIdToken(idToken: string): IdToken {\n try {\n const utf8String: string = this._cryptoUtils.base64URLDecode(idToken?.split('.')[1]);\n const payload: IdToken = JSON.parse(utf8String);\n\n return payload;\n } catch (error: any) {\n throw new AsgardeoAuthException('JS-CRYPTO_UTIL-DIT-IV01', 'Decoding ID token failed.', error);\n }\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 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) 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]);\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).\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 /**\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 the username in token exchange operations.\n * Used when user identity needs to be included in the exchange.\n */\n USERNAME: '{{username}}',\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 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} 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\nimport {IdToken} from '../models/token';\n\n/**\n * Removes standard protocol-specific claims from the ID token payload\n * and returns a camelCased object of user-specific claims.\n *\n * @param payload The raw ID token payload.\n * @returns A cleaned-up, camelCased object containing only user-specific claims.\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 * };\n *\n * const userClaims = extractUserClaimsFromIdToken(idTokenPayload);\n * // // userClaims will be:\n * // {\n * // email: 'user@example.com'\n * // }\n * ```\n */\nconst extractUserClaimsFromIdToken = (payload: IdToken): Record<string, unknown> => {\n const filteredPayload: Partial<IdToken> = {...payload};\n\n const protocolClaims = [\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 => {\n delete filteredPayload[claim as keyof IdToken];\n });\n\n const userClaims: Record<string, unknown> = {};\n\n Object.entries(filteredPayload).forEach(([key, value]) => {\n const camelCasedKey = key\n .split('_')\n .map((part, i) => (i === 0 ? part : part[0].toUpperCase() + part.slice(1)))\n .join('');\n\n userClaims[camelCasedKey] = value;\n });\n\n return userClaims;\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 * 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 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 _origin: string = AsgardeoError.resolveOrigin(origin);\n super(message);\n\n this.name = new.target.name;\n this.code = code;\n this.origin = _origin;\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 value: 'AsgardeoRuntimeError',\n configurable: true,\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 = 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 * @param scopes - The OpenID scopes to process, which can be a string or an array of strings.\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(123); // throws AsgardeoRuntimeError\n * processOpenIDScopes({}); // throws AsgardeoRuntimeError\n * ```\n */\nconst processOpenIDScopes = (scopes: string | string[]): string => {\n let processedScopes: string[] = [];\n\n if (scopes) {\n if (Array.isArray(scopes)) {\n processedScopes = scopes;\n } else if (typeof scopes === 'string') {\n processedScopes = scopes.split(' ');\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 OIDCRequestConstants.SignIn.Payload.DEFAULT_SCOPES.forEach((defaultScope: string) => {\n if (!processedScopes.includes(defaultScope)) {\n processedScopes.push(defaultScope);\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 {JWKInterface} from '../../models/crypto';\nimport {OIDCDiscoveryEndpointsApiResponse, OIDCDiscoveryApiResponse} from '../../models/oidc-discovery';\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 private _config: () => Promise<AuthClientConfig>;\n private _oidcProviderMetaData: () => Promise<OIDCDiscoveryApiResponse>;\n private _cryptoHelper: IsomorphicCrypto;\n\n public constructor(storageManager: StorageManager<T>, cryptoHelper: IsomorphicCrypto) {\n this._storageManager = storageManager;\n this._config = async () => this._storageManager.getConfigData();\n this._oidcProviderMetaData = async () => this._storageManager.loadOpenIDProviderConfiguration();\n this._cryptoHelper = cryptoHelper;\n }\n\n public async resolveEndpoints(response: OIDCDiscoveryApiResponse): Promise<OIDCDiscoveryApiResponse> {\n const oidcProviderMetaData: OIDCDiscoveryApiResponse = {};\n const configData: StrictAuthClientConfig = await this._config();\n\n 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 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 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 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 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 const defaultEndpoints: OIDCDiscoveryApiResponse = {\n [OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints\n .AUTHORIZATION]: `${baseUrl}${OIDCDiscoveryConstants.Endpoints.AUTHORIZATION}`,\n [OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints\n .END_SESSION]: `${baseUrl}${OIDCDiscoveryConstants.Endpoints.END_SESSION}`,\n [OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints\n .ISSUER]: `${baseUrl}${OIDCDiscoveryConstants.Endpoints.ISSUER}`,\n [OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.JWKS]: `${baseUrl}${OIDCDiscoveryConstants.Endpoints.JWKS}`,\n [OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints\n .SESSION_IFRAME]: `${baseUrl}${OIDCDiscoveryConstants.Endpoints.SESSION_IFRAME}`,\n [OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints\n .REVOCATION]: `${baseUrl}${OIDCDiscoveryConstants.Endpoints.REVOCATION}`,\n [OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints\n .TOKEN]: `${baseUrl}${OIDCDiscoveryConstants.Endpoints.TOKEN}`,\n [OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints\n .USERINFO]: `${baseUrl}${OIDCDiscoveryConstants.Endpoints.USERINFO}`,\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.decodeIdToken(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.decodeIdToken(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 const sessionData: SessionData = await this._storageManager.getSessionData(userId);\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). 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');\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]);\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 ScopeConstants from '../constants/ScopeConstants';\nimport OIDCRequestConstants from '../constants/OIDCRequestConstants';\nimport generateStateParamForRequestCorrelation from './generateStateParamForRequestCorrelation';\nimport {ExtendedAuthorizeRequestUrlParams} from '../models/oauth-request';\nimport AsgardeoRuntimeError from '../errors/AsgardeoRuntimeError';\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 redirectUri: string;\n clientId: string;\n scopes?: string;\n responseMode?: string;\n codeChallenge?: string;\n codeChallengeMethod?: string;\n prompt?: string;\n } & ExtendedAuthorizeRequestUrlParams,\n pkceOptions: {key: string},\n customParams: Record<string, string | number | boolean>,\n): Map<string, string> => {\n const {redirectUri, clientId, clientSecret, scopes, responseMode, codeChallenge, codeChallengeMethod, prompt} =\n 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 for (const [key, value] of Object.entries(customParams)) {\n if (key !== '' && value !== '' && key !== OIDCRequestConstants.Params.STATE) {\n authorizeRequestParams.set(key, value.toString());\n }\n }\n }\n\n authorizeRequestParams.set(\n OIDCRequestConstants.Params.STATE,\n generateStateParamForRequestCorrelation(\n pkceKey,\n customParams ? customParams[OIDCRequestConstants.Params.STATE]?.toString() : '',\n ),\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 StorageManager from '../StorageManager';\nimport {AuthClientConfig, StrictAuthClientConfig} from './models';\nimport {ExtendedAuthorizeRequestUrlParams} from '../models/oauth-request';\nimport {Crypto} from '../models/crypto';\nimport {TokenResponse, IdToken, TokenExchangeRequestConfig} from '../models/token';\nimport {OIDCEndpoints} from '../models/oidc-endpoints';\nimport {Storage} from '../models/store';\nimport ScopeConstants from '../constants/ScopeConstants';\nimport OIDCDiscoveryConstants from '../constants/OIDCDiscoveryConstants';\nimport OIDCRequestConstants from '../constants/OIDCRequestConstants';\nimport {IsomorphicCrypto} from '../IsomorphicCrypto';\nimport extractPkceStorageKeyFromState from '../utils/extractPkceStorageKeyFromState';\nimport generateStateParamForRequestCorrelation from '../utils/generateStateParamForRequestCorrelation';\nimport {AsgardeoAuthException} from '../errors/exception';\nimport {AuthenticationHelper} from './helpers';\nimport {SessionData, UserSession} from '../models/session';\nimport {AuthorizeRequestUrlParams} from '../models/oauth-request';\nimport {TemporaryStore} from '../models/store';\nimport generatePkceStorageKey from '../utils/generatePkceStorageKey';\nimport {OIDCDiscoveryApiResponse} from '../models/oidc-discovery';\nimport getAuthorizeRequestUrlParams from '../utils/getAuthorizeRequestUrlParams';\nimport PKCEConstants from '../constants/PKCEConstants';\nimport {User} from '../models/user';\nimport processOpenIDScopes from '../utils/processOpenIDScopes';\n\n/**\n * Default configurations.\n */\nconst DefaultConfig: Partial<AuthClientConfig<unknown>> = {\n tokenValidation: {\n idToken: {\n validate: true,\n validateIssuer: true,\n clockTolerance: 300,\n },\n },\n enablePKCE: true,\n responseMode: 'query',\n sendCookiesInRequests: true,\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 private _config: () => Promise<AuthClientConfig>;\n private _oidcProviderMetaData: () => Promise<OIDCDiscoveryApiResponse>;\n private _authenticationHelper: AuthenticationHelper<T>;\n private _cryptoUtils: Crypto;\n private _cryptoHelper: IsomorphicCrypto;\n\n private static _instanceID: number;\n\n // FIXME: Validate this.\n // Ref: https://github.com/asgardeo/asgardeo-auth-js-core/pull/205\n static _authenticationHelper: 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\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 cryptoUtils: Crypto,\n instanceID?: number,\n ): Promise<void> {\n const clientId: string = config.clientId;\n\n if (!AsgardeoAuthClient._instanceID) {\n AsgardeoAuthClient._instanceID = 0;\n } else {\n AsgardeoAuthClient._instanceID += 1;\n }\n\n if (instanceID) {\n AsgardeoAuthClient._instanceID = instanceID;\n }\n\n if (!clientId) {\n this._storageManager = new StorageManager<T>(`instance_${AsgardeoAuthClient._instanceID}`, store);\n } else {\n this._storageManager = new StorageManager<T>(`instance_${AsgardeoAuthClient._instanceID}-${clientId}`, store);\n }\n\n this._cryptoUtils = cryptoUtils;\n this._cryptoHelper = new IsomorphicCrypto(cryptoUtils);\n this._authenticationHelper = new AuthenticationHelper(this._storageManager, this._cryptoHelper);\n this._config = async () => await this._storageManager.getConfigData();\n this._oidcProviderMetaData = async () => await this._storageManager.loadOpenIDProviderConfiguration();\n\n // FIXME: Validate this.\n // Ref: https://github.com/asgardeo/asgardeo-auth-js-core/pull/205\n AsgardeoAuthClient._authenticationHelper = this._authenticationHelper;\n\n await this._storageManager.setConfigData({\n ...DefaultConfig,\n ...config,\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 public getInstanceId(): number {\n return AsgardeoAuthClient._instanceID;\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 __TODO__ = async () => {\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._config();\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 = 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 redirectUri: configData.afterSignInUrl,\n clientId: configData.clientId,\n scopes: processOpenIDScopes(configData.scopes),\n responseMode: configData.responseMode,\n codeChallengeMethod: PKCEConstants.DEFAULT_CODE_CHALLENGE_METHOD,\n codeChallenge,\n prompt: configData.prompt,\n },\n {key: pkceKey},\n authRequestConfig,\n );\n\n for (const [key, value] of authorizeRequestParams.entries()) {\n authorizeRequest.searchParams.append(key, value);\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 __TODO__();\n }\n\n return this.loadOpenIDProviderConfiguration(requestConfig?.forceInit as boolean).then(() => {\n return __TODO__();\n });\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 const __TODO__ = async () => {\n const tokenEndpoint: string | undefined = (await this._oidcProviderMetaData()).token_endpoint;\n const configData: StrictAuthClientConfig = await this._config();\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 sessionState &&\n (await this._storageManager.setSessionDataParameter(\n OIDCRequestConstants.Params.SESSION_STATE as keyof SessionData,\n sessionState,\n userId,\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: 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 await this._authenticationHelper.handleTokenResponse(tokenResponse, userId);\n };\n\n if (\n await this._storageManager.getTemporaryDataParameter(\n OIDCDiscoveryConstants.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,\n )\n ) {\n return __TODO__();\n }\n\n return this.loadOpenIDProviderConfiguration(false).then(() => {\n return __TODO__();\n });\n }\n\n public async loadOpenIDProviderConfiguration(forceInit: boolean): Promise<void> {\n const configData: StrictAuthClientConfig = await this._config();\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: string = (configData as any).wellKnownEndpoint;\n\n if (wellKnownEndpoint) {\n let response: Response;\n\n try {\n response = await fetch(wellKnownEndpoint);\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(\n await this._authenticationHelper.resolveEndpoints(await response.json()),\n );\n await this._storageManager.setTemporaryDataParameter(\n OIDCDiscoveryConstants.Storage.StorageKeys.OPENID_PROVIDER_CONFIG_INITIATED,\n true,\n );\n\n return Promise.resolve();\n } else if ((configData as any).baseUrl) {\n try {\n await this._storageManager.setOIDCProviderMetaData(\n await this._authenticationHelper.resolveEndpointsByBaseURL(),\n );\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 } else {\n await this._storageManager.setOIDCProviderMetaData(await this._authenticationHelper.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 /**\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._oidcProviderMetaData())?.end_session_endpoint;\n const configData: StrictAuthClientConfig = await this._config();\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._oidcProviderMetaData();\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 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 _idToken: string = (await this._storageManager.getSessionData(userId)).id_token;\n const payload: IdToken = this._cryptoHelper.decodeIdToken(_idToken ?? 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._authenticationHelper.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._oidcProviderMetaData()).revocation_endpoint;\n const configData: StrictAuthClientConfig = await this._config();\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._authenticationHelper.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._oidcProviderMetaData()).token_endpoint;\n const configData: StrictAuthClientConfig = await this._config();\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._authenticationHelper.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 const oidcProviderMetadata: OIDCDiscoveryApiResponse = await this._oidcProviderMetaData();\n const configData: StrictAuthClientConfig = await this._config();\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._authenticationHelper.replaceCustomGrantTemplateTags(\n value as string,\n userId,\n );\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._authenticationHelper.handleTokenResponse(response, userId);\n } else {\n return Promise.resolve((await response.json()) as TokenResponse | Response);\n }\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) * 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 await 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 await this._storageManager.setConfigData(config);\n await this.loadOpenIDProviderConfiguration(true);\n }\n\n public static async clearSession(userId?: string): Promise<void> {\n await this._authenticationHelper.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 value: 'AsgardeoAPIError',\n configurable: true,\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 = 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 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 = new URLSearchParams();\n Object.entries(payload).forEach(([key, value]) => {\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 method: requestConfig.method || 'POST',\n headers: {\n ...requestConfig.headers,\n 'Content-Type': 'application/x-www-form-urlencoded',\n Accept: 'application/json',\n },\n body: searchParams.toString(),\n });\n\n if (!response.ok) {\n const errorText = 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 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 method: requestConfig.method || 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n body: JSON.stringify(payload),\n });\n\n if (!response.ok) {\n const errorText = 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}\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 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 * 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 * 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 * 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 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 method: requestConfig.method || 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n body: JSON.stringify({\n ...(payload ?? {}),\n flowType: EmbeddedFlowType.Registration,\n }),\n });\n\n if (!response.ok) {\n const errorText = 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 {User} from '../models/user';\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\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 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 method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n });\n\n if (!response.ok) {\n const errorText = 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 = /^[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; userName?: string; user_name?: string}>(user: T): T => {\n if (!user) {\n return user;\n }\n\n const processedUser = {...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 {User} from '../models/user';\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport processUserUsername from '../utils/processUsername';\n\n/**\n * Configuration for the getScim2Me request\n */\nexport interface GetScim2MeConfig extends Omit<RequestInit, 'method'> {\n /**\n * The absolute API endpoint.\n */\n url?: string;\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\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 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 = fetcher || fetch;\n const resolvedUrl: string = url ?? `${baseUrl}/scim2/Me`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n method: 'GET',\n headers: {\n 'Content-Type': 'application/scim+json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText = 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 = (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 {Schema} from '../models/scim2-schema';\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\n\n/**\n * Configuration for the getSchemas request\n */\nexport interface GetSchemasConfig extends Omit<RequestInit, 'method'> {\n /**\n * The absolute API endpoint.\n */\n url?: string;\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\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 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 = fetcher || fetch;\n const resolvedUrl: string = url ?? `${baseUrl}/scim2/Schemas`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText = 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 {AllOrganizationsApiResponse} from '../models/organization';\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\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 * 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 * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\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 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 = fetcher || fetch;\n const resolvedUrl = `${baseUrl}/api/server/v1/organizations?${queryParams.toString()}`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n method: 'GET',\n headers: {\n ...requestConfig.headers,\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n },\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText = 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 = (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 {Organization} from '../models/organization';\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\n\n/**\n * Interface for organization creation payload.\n */\nexport interface CreateOrganizationPayload {\n /**\n * Organization description.\n */\n description: string;\n /**\n * Organization handle/slug.\n */\n orgHandle?: string;\n /**\n * Organization name.\n */\n name: 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 * Organization creation payload\n */\n payload: CreateOrganizationPayload;\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\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 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 = {\n ...payload,\n type: 'TENANT' as const,\n };\n\n const fetchFn = fetcher || fetch;\n const resolvedUrl = `${baseUrl}/api/server/v1/organizations`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n body: JSON.stringify(organizationPayload),\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText = 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 {Organization} from '../models/organization';\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\n\n/**\n * Configuration for the getMeOrganizations request\n */\nexport interface GetMeOrganizationsConfig extends Omit<RequestInit, 'method'> {\n /**\n * The base URL for the API endpoint.\n */\n baseUrl: string;\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 * Base64 encoded cursor value for backward pagination\n */\n before?: string;\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 * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\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 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 = 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]) => Boolean(value)),\n ),\n );\n\n const fetchFn = fetcher || fetch;\n const resolvedUrl = `${baseUrl}/api/users/v1/me/organizations?${queryParams.toString()}`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText = 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 = (await response.json()) as any;\n return data.organizations || [];\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 * The ID of the organization to retrieve\n */\n organizationId: 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\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 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 = fetcher || fetch;\n const resolvedUrl = `${baseUrl}/api/server/v1/organizations/${organizationId}`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText = 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 AsgardeoAPIError from '../errors/AsgardeoAPIError';\nimport isEmpty from '../utils/isEmpty';\nimport {OrganizationDetails} from './getOrganization';\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 * The ID of the organization to update\n */\n organizationId: string;\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 * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\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 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 = fetcher || fetch;\n const resolvedUrl = `${baseUrl}/api/server/v1/organizations/${organizationId}`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n method: 'PATCH',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n body: JSON.stringify(operations),\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText = 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 return Object.entries(payload).map(([key, value]) => {\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};\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 {User} from '../models/user';\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\n\n/**\n * Configuration for the updateMeProfile request\n */\nexport interface UpdateMeProfileConfig extends Omit<RequestInit, 'method' | 'body'> {\n /**\n * The absolute API endpoint.\n */\n url?: string;\n /**\n * The base path of the API endpoint.\n */\n baseUrl?: string;\n /**\n * The value object to patch (SCIM2 PATCH value)\n */\n payload: any;\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\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 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 = {\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 = fetcher || fetch;\n const resolvedUrl: string = url ?? `${baseUrl}/scim2/Me`;\n\n const requestInit: RequestInit = {\n method: 'PATCH',\n ...requestConfig,\n headers: {\n ...requestConfig.headers,\n 'Content-Type': 'application/scim+json',\n Accept: 'application/json',\n },\n body: JSON.stringify(data),\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText = 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 return (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 ||\n '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 {BrandingPreference} from '../models/branding-preference';\nimport AsgardeoAPIError from '../errors/AsgardeoAPIError';\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 * 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 * Optional custom fetcher function.\n * If not provided, native fetch will be used\n */\n fetcher?: (url: string, config: RequestInit) => Promise<Response>;\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 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 = fetcher || fetch;\n const resolvedUrl = `${baseUrl}/api/server/v1/branding-preference/resolve${\n queryParams.toString() ? `?${queryParams.toString()}` : ''\n }`;\n\n const requestInit: RequestInit = {\n ...requestConfig,\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n };\n\n try {\n const response: Response = await fetchFn(resolvedUrl, requestInit);\n\n if (!response?.ok) {\n const errorText = 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 = (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 {\n EmbeddedFlowResponseType as EmbeddedFlowResponseTypeV1,\n EmbeddedFlowType as EmbeddedFlowTypeV1,\n} from '../embedded-flow';\nimport {EmbeddedFlowResponseData as EmbeddedFlowResponseDataV2} from './embedded-flow-v2';\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 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 * 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/**\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 * flowId: \"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 * Unique identifier for this specific flow instance.\n * Used to maintain state across multiple API calls during the authentication process.\n */\n flowId: 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 * 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 /** Action type identifier */\n type: EmbeddedFlowResponseTypeV1;\n /** Unique action identifier */\n id: string;\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 /** Input field type */\n type: string;\n /** Whether the field is required */\n required: boolean;\n }[];\n };\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 flowId) 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 * flowId: \"flow_12345\",\n * actionId: \"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 flow instance to continue.\n * Required when submitting data for an existing flow.\n */\n flowId?: string;\n\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 actionId?: 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 {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';\nimport AsgardeoAPIError from '../../errors/AsgardeoAPIError';\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 let 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]) => 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 flowId\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 'flowId' 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 method: requestConfig.method || 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n body: JSON.stringify(requestPayload),\n });\n\n if (!response.ok) {\n const errorText = 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 authorize.\n if (flowResponse.flowStatus === EmbeddedSignInFlowStatusV2.Complete && (flowResponse as any).assertion && authId) {\n try {\n const oauth2Response: Response = await fetch(`${baseUrl}/oauth2/authorize`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n body: JSON.stringify({\n assertion: (flowResponse as any).assertion,\n authId,\n }),\n credentials: 'include',\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 = 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 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 * 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/**\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 * Unique identifier for this sign-up flow instance.\n */\n flowId: 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 * 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 type: EmbeddedFlowResponseTypeV1;\n id: string;\n }[];\n\n /**\n * Input fields required for the current step of the sign-up flow.\n */\n inputs?: {\n name: string;\n type: string;\n required: boolean;\n }[];\n };\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 flowId?: string;\n actionId?: 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 `flowId` 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 * flowId: \"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 * 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 flowId: 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 * 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 failureReason: 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 {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';\nimport AsgardeoAPIError from '../../errors/AsgardeoAPIError';\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 let 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]) => 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 flowId\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 'flowId' 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 method: requestConfig.method || 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n body: JSON.stringify(requestPayload),\n });\n\n if (!response.ok) {\n const errorText = 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 authorize.\n if (flowResponse.flowStatus === EmbeddedSignUpFlowStatusV2.Complete && (flowResponse as any).assertion && authId) {\n try {\n const oauth2Response: Response = await fetch(`${baseUrl}/oauth2/authorize`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n ...requestConfig.headers,\n },\n body: JSON.stringify({\n assertion: (flowResponse as any).assertion,\n authId,\n }),\n credentials: 'include',\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 = 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\n/**\n * Constants representing Application Native Authentication related configurations and constants.\n */\nconst ApplicationNativeAuthenticationConstants = {\n SupportedAuthenticators: {\n IdentifierFirst: 'SWRlbnRpZmllckV4ZWN1dG9yOkxPQ0FM',\n EmailOtp: 'ZW1haWwtb3RwLWF1dGhlbnRpY2F0b3I6TE9DQUw',\n Totp: 'dG90cDpMT0NBTA',\n UsernamePassword: 'QmFzaWNBdXRoZW50aWNhdG9yOkxPQ0FM',\n PushNotification: 'cHVzaC1ub3RpZmljYXRpb24tYXV0aGVudGljYXRvcjpMT0NBTA',\n Passkey: 'RklET0F1dGhlbnRpY2F0b3I6TE9DQUw',\n SmsOtp: 'c21zLW90cC1hdXRoZW50aWNhdG9yOkxPQ0FM',\n MagicLink: 'TWFnaWNMaW5rQXV0aGVudGljYXRvcjpMT0NBTA',\n Google: 'R29vZ2xlT0lEQ0F1dGhlbnRpY2F0b3I6R29vZ2xl',\n GitHub: 'R2l0aHViQXV0aGVudGljYXRvcjpHaXRIdWI',\n Microsoft: 'T3BlbklEQ29ubmVjdEF1dGhlbnRpY2F0b3I6TWljcm9zb2Z0',\n Facebook: 'RmFjZWJvb2tBdXRoZW50aWNhdG9yOkZhY2Vib29r',\n LinkedIn: 'TGlua2VkSW5PSURDOkxpbmtlZElu',\n SignInWithEthereum: 'T3BlbklEQ29ubmVjdEF1dGhlbnRpY2F0b3I6U2lnbiBJbiBXaXRoIEV0aGVyZXVt',\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\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 /** WSO2 Identity Server (on-prem or custom domains) */\n IdentityServer = 'IDENTITY_SERVER',\n /** @experimental WSO2 Asgardeo V2 */\n AsgardeoV2 = 'AsgardeoV2',\n /** Unknown or unsupported platform */\n Unknown = 'UNKNOWN',\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 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 /** Standard text input field for user data entry */\n TextInput = 'TEXT_INPUT',\n\n /** Password input field with masking for sensitive data */\n PasswordInput = 'PASSWORD_INPUT',\n\n /**\n * Email input field with validation for email addresses.\n */\n EmailInput = 'EMAIL_INPUT',\n\n /** Text display component for labels, headings, and messages */\n Text = 'TEXT',\n\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\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 Primary = 'PRIMARY',\n Secondary = 'SECONDARY',\n Tertiary = 'TERTIARY',\n Danger = 'DANGER',\n Success = 'SUCCESS',\n Info = 'INFO',\n Warning = 'WARNING',\n Link = 'LINK',\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 Heading1 = 'HEADING_1',\n Heading2 = 'HEADING_2',\n Heading3 = 'HEADING_3',\n Heading4 = 'HEADING_4',\n Heading5 = 'HEADING_5',\n Heading6 = 'HEADING_6',\n Subtitle1 = 'SUBTITLE_1',\n Subtitle2 = 'SUBTITLE_2',\n Body1 = 'BODY_1',\n Body2 = 'BODY_2',\n Caption = 'CAPTION',\n Overline = 'OVERLINE',\n ButtonText = 'BUTTON_TEXT',\n}\n\n/**\n * Event types for action components.\n *\n * @experimental This API may change in future versions\n */\nexport enum EmbeddedFlowEventType {\n Trigger = 'TRIGGER',\n Submit = 'SUBMIT',\n Navigate = 'NAVIGATE',\n Cancel = 'CANCEL',\n Reset = 'RESET',\n Back = 'BACK',\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 * Unique identifier for the component\n */\n id: string;\n\n /**\n * Reference identifier for the component (e.g., field name, action ref)\n */\n ref?: string;\n\n /**\n * Component type that determines rendering behavior\n */\n type: EmbeddedFlowComponentType | 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 * Placeholder text for input components.\n * Provides helpful hints to users about expected input format.\n */\n placeholder?: 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 * 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 * Event type for action components that defines the interaction behavior.\n * Only relevant for Action components.\n */\n eventType?: EmbeddedFlowEventType | string;\n\n /**\n * Nested child components for container components like Block.\n */\n components?: EmbeddedFlowComponent[];\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 input definitions for backward compatibility.\n * @deprecated Use meta.components for new implementations\n */\n inputs?: {\n /** Reference identifier for the input */\n ref: string;\n /** Field identifier used in form submission */\n identifier: string;\n /** Input type (TEXT_INPUT, PASSWORD_INPUT, etc.) */\n type: string;\n /** Whether this input is required for form submission */\n required: boolean;\n }[];\n\n /**\n * Legacy action definitions for backward compatibility.\n * @deprecated Use meta.components for new implementations\n */\n actions?: {\n /** Reference identifier for the action */\n ref: string;\n /** Next flow node to navigate to (optional) */\n nextNode?: string;\n /** Event type for the action (SUBMIT, ACTIVATE, etc.) */\n eventType?: 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 * 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/authorize` 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) 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) 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 name: string;\n type: string;\n multiValued: boolean;\n description?: string;\n required?: boolean;\n caseExact: boolean;\n mutability: string;\n returned: string;\n uniqueness: string;\n displayName?: string;\n displayOrder?: string;\n regEx?: string;\n supportedByDefault?: string;\n sharedProfileValueResolvingMethod?: string;\n subAttributes?: SchemaAttribute[];\n}\n\n/**\n * Represents a SCIM2 schema definition\n */\nexport interface Schema {\n /** Schema identifier */\n id: string;\n /** Schema name */\n name: string;\n /** Schema description */\n description: string;\n /** Schema attributes */\n attributes: SchemaAttribute[];\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 /** User Schema */\n User = 'urn:ietf:params:scim:schemas:core:2.0: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 /** Custom User Schema */\n CustomUser = 'urn:scim:schemas:extension:custom: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 Text = 'TEXT',\n Password = 'PASSWORD',\n Email = 'EMAIL',\n Number = 'NUMBER',\n Select = 'SELECT',\n Checkbox = 'CHECKBOX',\n Radio = 'RADIO',\n Otp = 'OTP',\n Date = 'DATE',\n Time = 'TIME',\n Textarea = 'TEXTAREA',\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 {AllOrganizationsApiResponse} from './models/organization';\nimport {AsgardeoClient} from './models/client';\nimport {Config, SignInOptions, SignOutOptions, SignUpOptions} from './models/config';\nimport {Storage} from './models/store';\nimport {EmbeddedFlowExecuteRequestPayload, EmbeddedFlowExecuteResponse} from './models/embedded-flow';\nimport {EmbeddedSignInFlowHandleRequestPayload} from './models/embedded-signin-flow';\nimport {TokenExchangeRequestConfig, TokenResponse} from './models/token';\nimport {Organization} from './models/organization';\nimport {User, UserProfile} from './models/user';\n\n/**\n * Base class for implementing Asgardeo clients.\n * This class provides the core functionality for managing user authentication and sessions.\n *\n * @typeParam T - Configuration type that extends Config.\n */\nabstract class AsgardeoJavaScriptClient<T = Config> implements AsgardeoClient<T> {\n abstract switchOrganization(organization: Organization, sessionId?: string): Promise<TokenResponse | Response>;\n\n abstract initialize(config: T, storage?: Storage): Promise<boolean>;\n\n abstract reInitialize(config: Partial<T>): Promise<boolean>;\n\n abstract getUser(options?: any): Promise<User>;\n\n abstract getAllOrganizations(options?: any, sessionId?: string): Promise<AllOrganizationsApiResponse>;\n\n abstract getMyOrganizations(options?: any, sessionId?: string): Promise<Organization[]>;\n\n abstract getCurrentOrganization(sessionId?: string): Promise<Organization | null>;\n\n abstract getUserProfile(options?: any): Promise<UserProfile>;\n\n abstract isLoading(): boolean;\n\n abstract isSignedIn(): Promise<boolean>;\n\n abstract updateUserProfile(payload: any, userId?: string): Promise<User>;\n\n abstract getConfiguration(): T;\n\n abstract exchangeToken(config: TokenExchangeRequestConfig, sessionId?: string): Promise<TokenResponse | Response>;\n\n abstract signIn(\n options?: SignInOptions,\n sessionId?: string,\n onSignInSuccess?: (afterSignInUrl: string) => void,\n ): Promise<User>;\n abstract signIn(\n payload: EmbeddedSignInFlowHandleRequestPayload,\n request: Request,\n sessionId?: string,\n onSignInSuccess?: (afterSignInUrl: string) => void,\n ): Promise<User>;\n\n abstract signInSilently(options?: SignInOptions): Promise<User | boolean>;\n\n abstract signOut(options?: SignOutOptions, afterSignOut?: (afterSignOutUrl: string) => void): Promise<string>;\n abstract signOut(\n options?: SignOutOptions,\n sessionId?: string,\n afterSignOut?: (afterSignOutUrl: string) => void,\n ): Promise<string>;\n\n abstract signUp(options?: SignUpOptions): Promise<void>;\n abstract signUp(payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse>;\n abstract signUp(payload?: unknown): Promise<void> | Promise<EmbeddedFlowExecuteResponse>;\n\n abstract getAccessToken(sessionId?: string): Promise<string>;\n\n abstract clearSession(sessionId?: string): void;\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, ThemeMode, ThemeVars} from './types';\nimport {RecursivePartial} from '../models/utility-types';\nimport VendorConstants from '../constants/VendorConstants';\n\nconst lightTheme: ThemeConfig = {\n colors: {\n action: {\n active: 'rgba(0, 0, 0, 0.54)',\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 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 activatedOpacity: 0.12,\n },\n primary: {\n main: '#1a73e8',\n contrastText: '#ffffff',\n dark: '#174ea6',\n },\n secondary: {\n main: '#424242',\n contrastText: '#ffffff',\n dark: '#212121',\n },\n background: {\n surface: '#ffffff',\n disabled: '#f0f0f0',\n dark: '#212121',\n body: {\n main: '#1a1a1a',\n dark: '#212121',\n },\n },\n error: {\n main: '#d32f2f',\n contrastText: '#d52828',\n dark: '#b71c1c',\n },\n info: {\n main: '#bbebff',\n contrastText: '#43aeda',\n dark: '#01579b',\n },\n success: {\n main: '#4caf50',\n contrastText: '#00a807',\n dark: '#388e3c',\n },\n warning: {\n main: '#ff9800',\n contrastText: '#be7100',\n dark: '#f57c00',\n },\n text: {\n primary: '#1a1a1a',\n secondary: '#666666',\n dark: '#212121',\n },\n border: '#e0e0e0',\n },\n spacing: {\n unit: 8,\n },\n borderRadius: {\n small: '4px',\n medium: '8px',\n large: '16px',\n },\n shadows: {\n small: '0 2px 8px rgba(0, 0, 0, 0.1)',\n medium: '0 4px 16px rgba(0, 0, 0, 0.15)',\n large: '0 8px 32px rgba(0, 0, 0, 0.2)',\n },\n typography: {\n fontFamily: '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n fontSizes: {\n xs: '0.75rem', // 12px\n sm: '0.875rem', // 14px\n md: '1rem', // 16px\n lg: '1.125rem', // 18px\n xl: '1.25rem', // 20px\n '2xl': '1.5rem', // 24px\n '3xl': '2.125rem', // 34px\n },\n fontWeights: {\n normal: 400,\n medium: 500,\n semibold: 600,\n bold: 700,\n },\n lineHeights: {\n tight: 1.2,\n normal: 1.4,\n relaxed: 1.6,\n },\n },\n images: {\n favicon: {},\n logo: {},\n },\n};\n\nconst darkTheme: ThemeConfig = {\n colors: {\n action: {\n active: '#1c1c1c',\n hover: '#1c1c1c',\n hoverOpacity: 0.04,\n selected: '#1c1c1c',\n selectedOpacity: 0.08,\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 activatedOpacity: 0.12,\n },\n primary: {\n main: '#1a73e8',\n contrastText: '#ffffff',\n dark: '#174ea6',\n },\n secondary: {\n main: '#8b8b8b',\n contrastText: '#ffffff',\n dark: '#212121',\n },\n background: {\n surface: '#121212',\n disabled: '#1f1f1f',\n dark: '#212121',\n body: {\n main: '#ffffff',\n dark: '#212121',\n },\n },\n error: {\n main: '#d32f2f',\n contrastText: '#d52828',\n dark: '#b71c1c',\n },\n info: {\n main: '#bbebff',\n contrastText: '#43aeda',\n dark: '#01579b',\n },\n success: {\n main: '#4caf50',\n contrastText: '#00a807',\n dark: '#388e3c',\n },\n warning: {\n main: '#ff9800',\n contrastText: '#be7100',\n dark: '#f57c00',\n },\n text: {\n primary: '#ffffff',\n secondary: '#b3b3b3',\n dark: '#212121',\n },\n border: '#404040',\n },\n spacing: {\n unit: 8,\n },\n borderRadius: {\n small: '4px',\n medium: '8px',\n large: '16px',\n },\n shadows: {\n small: '0 2px 8px rgba(0, 0, 0, 0.3)',\n medium: '0 4px 16px rgba(0, 0, 0, 0.4)',\n large: '0 8px 32px rgba(0, 0, 0, 0.5)',\n },\n typography: {\n fontFamily: '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n fontSizes: {\n xs: '0.75rem', // 12px\n sm: '0.875rem', // 14px\n md: '1rem', // 16px\n lg: '1.125rem', // 18px\n xl: '1.25rem', // 20px\n '2xl': '1.5rem', // 24px\n '3xl': '2.125rem', // 34px\n },\n fontWeights: {\n normal: 400,\n medium: 500,\n semibold: 600,\n bold: 700,\n },\n lineHeights: {\n tight: 1.2,\n normal: 1.4,\n relaxed: 1.6,\n },\n },\n images: {\n favicon: {},\n logo: {},\n },\n};\n\nconst toCssVariables = (theme: ThemeConfig): Record<string, string> => {\n const cssVars: Record<string, string> = {};\n const prefix = 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\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\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\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\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\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 => {\n const imageConfig = 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 = 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 colors: {\n action: {\n active: `var(--${prefix}-color-action-active)`,\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 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 activatedOpacity: `var(--${prefix}-color-action-activatedOpacity)`,\n },\n primary: {\n main: `var(--${prefix}-color-primary-main)`,\n contrastText: `var(--${prefix}-color-primary-contrastText)`,\n },\n secondary: {\n main: `var(--${prefix}-color-secondary-main)`,\n contrastText: `var(--${prefix}-color-secondary-contrastText)`,\n },\n background: {\n surface: `var(--${prefix}-color-background-surface)`,\n disabled: `var(--${prefix}-color-background-disabled)`,\n body: {\n main: `var(--${prefix}-color-background-body-main)`,\n },\n },\n error: {\n main: `var(--${prefix}-color-error-main)`,\n contrastText: `var(--${prefix}-color-error-contrastText)`,\n },\n info: {\n contrastText: `var(--${prefix}-color-info-contrastText)`,\n main: `var(--${prefix}-color-info-main)`,\n },\n success: {\n main: `var(--${prefix}-color-success-main)`,\n contrastText: `var(--${prefix}-color-success-contrastText)`,\n },\n warning: {\n main: `var(--${prefix}-color-warning-main)`,\n contrastText: `var(--${prefix}-color-warning-contrastText)`,\n },\n text: {\n primary: `var(--${prefix}-color-text-primary)`,\n secondary: `var(--${prefix}-color-text-secondary)`,\n },\n border: `var(--${prefix}-color-border)`,\n },\n spacing: {\n unit: `var(--${prefix}-spacing-unit)`,\n },\n borderRadius: {\n small: `var(--${prefix}-border-radius-small)`,\n medium: `var(--${prefix}-border-radius-medium)`,\n large: `var(--${prefix}-border-radius-large)`,\n },\n shadows: {\n small: `var(--${prefix}-shadow-small)`,\n medium: `var(--${prefix}-shadow-medium)`,\n large: `var(--${prefix}-shadow-large)`,\n },\n typography: {\n fontFamily: `var(--${prefix}-typography-fontFamily)`,\n fontSizes: {\n xs: `var(--${prefix}-typography-fontSize-xs)`,\n sm: `var(--${prefix}-typography-fontSize-sm)`,\n md: `var(--${prefix}-typography-fontSize-md)`,\n lg: `var(--${prefix}-typography-fontSize-lg)`,\n xl: `var(--${prefix}-typography-fontSize-xl)`,\n '2xl': `var(--${prefix}-typography-fontSize-2xl)`,\n '3xl': `var(--${prefix}-typography-fontSize-3xl)`,\n },\n fontWeights: {\n normal: `var(--${prefix}-typography-fontWeight-normal)`,\n medium: `var(--${prefix}-typography-fontWeight-medium)`,\n semibold: `var(--${prefix}-typography-fontWeight-semibold)`,\n bold: `var(--${prefix}-typography-fontWeight-bold)`,\n },\n lineHeights: {\n tight: `var(--${prefix}-typography-lineHeight-tight)`,\n normal: `var(--${prefix}-typography-lineHeight-normal)`,\n relaxed: `var(--${prefix}-typography-lineHeight-relaxed)`,\n },\n },\n };\n\n // Add images if they exist\n if (theme.images) {\n themeVars.images = {};\n Object.keys(theme.images).forEach(imageKey => {\n const imageConfig = theme.images![imageKey];\n themeVars.images![imageKey] = {\n url: imageConfig?.url ? `var(--${prefix}-image-${imageKey}-url)` : undefined,\n title: imageConfig?.title ? `var(--${prefix}-image-${imageKey}-title)` : undefined,\n alt: imageConfig?.alt ? `var(--${prefix}-image-${imageKey}-alt)` : 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 = false): Theme => {\n const baseTheme = isDark ? darkTheme : lightTheme;\n\n const mergedConfig = {\n ...baseTheme,\n ...config,\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 spacing: {\n ...baseTheme.spacing,\n ...config.spacing,\n },\n borderRadius: {\n ...baseTheme.borderRadius,\n ...config.borderRadius,\n },\n shadows: {\n ...baseTheme.shadows,\n ...config.shadows,\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 images: {\n ...baseTheme.images,\n ...config.images,\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 = 0; i < bytes.byteLength; i++) {\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 = 0; i < binaryString.length; i++) {\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 = 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 year: 'numeric',\n month: 'long',\n day: '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 * 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 return (\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\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 = {...target} as T;\n\n sources.forEach(source => {\n if (!source || typeof source !== 'object') {\n return;\n }\n\n Object.keys(source).forEach(key => {\n const sourceValue = source[key];\n const targetValue = (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 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 = parsedUrl.pathname?.split('/')?.filter(segment => segment?.length > 0);\n\n if (pathSegments.length < 2 || pathSegments[0] !== 't') {\n console.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 = pathSegments[1];\n\n if (!organizationHandle || organizationHandle.trim().length === 0) {\n console.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).\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 /** Minimum log level to output */\n level: LogLevel;\n /** Custom prefix for all log messages */\n prefix?: string;\n /** Whether to include timestamps */\n timestamps?: boolean;\n /** Whether to include log level in output */\n showLevel?: boolean;\n /** Custom log formatter function */\n formatter?: (level: LogLevel, message: string, ...args: any[]) => void;\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 timestamps: true,\n showLevel: true,\n};\n\n/**\n * Environment detection utilities\n */\nconst isBrowser = (): boolean => {\n /* @ts-ignore */\n return typeof window !== 'undefined' && typeof window.document !== 'undefined';\n};\n\nconst isNode = (): boolean => {\n /* @ts-ignore */\n return typeof process !== 'undefined' && process.versions && process.versions.node;\n};\n\n/**\n * Color codes for terminal output (Node.js)\n */\nconst COLORS = {\n reset: '\\x1b[0m',\n bright: '\\x1b[1m',\n dim: '\\x1b[2m',\n red: '\\x1b[31m',\n green: '\\x1b[32m',\n yellow: '\\x1b[33m',\n blue: '\\x1b[34m',\n magenta: '\\x1b[35m',\n cyan: '\\x1b[36m',\n white: '\\x1b[37m',\n gray: '\\x1b[90m',\n};\n\n/**\n * Browser console styling\n */\nconst BROWSER_STYLES = {\n debug: 'color: #6b7280; font-weight: normal;',\n info: 'color: #2563eb; font-weight: bold;',\n warn: 'color: #d97706; font-weight: bold;',\n error: 'color: #dc2626; font-weight: bold;',\n prefix: 'color: #7c3aed; font-weight: bold;',\n timestamp: 'color: #6b7280; font-size: 0.9em;',\n};\n\nconst LOG_LEVEL_ORDER: Record<LogLevel, number> = {\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\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 getTimestamp(): string {\n return new Date().toISOString();\n }\n\n /**\n * Get log level string\n */\n private 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}[${this.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 = this.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 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[${this.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 = this.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 = parts.join(' ');\n\n // Use appropriate console method\n switch (level) {\n case 'debug':\n console.debug(formattedMessage, ...styles, ...args);\n break;\n case 'info':\n console.info(formattedMessage, ...styles, ...args);\n break;\n case 'warn':\n console.warn(formattedMessage, ...styles, ...args);\n break;\n case 'error':\n console.error(formattedMessage, ...styles, ...args);\n break;\n default:\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 = this.formatForNode(level, message);\n\n // Use appropriate console method\n switch (level) {\n case 'debug':\n console.debug(formattedMessage, ...args);\n break;\n case 'info':\n console.info(formattedMessage, ...args);\n break;\n case 'warn':\n console.warn(formattedMessage, ...args);\n break;\n case 'error':\n console.error(formattedMessage, ...args);\n break;\n default:\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 = 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 = new Logger();\n\n/**\n * Create a new logger instance with custom configuration\n */\nexport const createLogger = (config?: Partial<LoggerConfig>): Logger => {\n return new Logger(config);\n};\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[]) => logger.debug(message, ...args);\nexport const info = (message: string, ...args: any[]) => logger.info(message, ...args);\nexport const warn = (message: string, ...args: any[]) => logger.warn(message, ...args);\nexport const error = (message: string, ...args: any[]) => logger.error(message, ...args);\n\n/**\n * Configure the default logger\n */\nexport const configure = (config: Partial<LoggerConfig>) => logger.configure(config);\n\n/**\n * Create component-specific loggers\n */\nexport const createComponentLogger = (component: string) => {\n return logger.child(component);\n};\n\n/**\n * Create package-specific logger\n */\nexport const createPackageLogger = (packageName: string) => {\n return createLogger({\n prefix: `${PREFIX} - ${packageName}`,\n level: 'info',\n timestamps: true,\n showLevel: true,\n });\n};\n\n/**\n * Create package component logger (package + component)\n */\nexport const createPackageComponentLogger = (packageName: string, component: string) => {\n const packageLogger = createPackageLogger(packageName);\n return packageLogger.child(component);\n};\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 AsgardeoRuntimeError from \"../errors/AsgardeoRuntimeError\";\nimport logger from \"./logger\";\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 = parsedUrl.pathname?.split('/')?.filter(segment => segment?.length > 0);\n\n if (pathSegments.length < 2 || pathSegments[0] !== 't') {\n logger.warn('[isRecognizedBaseUrlPattern] The provided base URL does not follow the expected URL pattern (/t/{orgHandle}).');\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 => {\n if (schema.attributes && Array.isArray(schema.attributes)) {\n schema.attributes.forEach(attribute => {\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 => {\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 = Array.isArray(path) ? path : path.split('.');\n\n const result = pathArray.reduce((current, key) => {\n return current?.[key];\n }, 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 = Array.isArray(path) ? path : path.split('.');\n const lastIndex = pathArray.length - 1;\n\n pathArray.reduce((current, key, index) => {\n if (index === lastIndex) {\n current[key] = value;\n } else {\n 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 = pathArray[index + 1];\n current[key] = /^\\d+$/.test(nextKey) ? [] : {};\n }\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 => {\n const {name, type, multiValued} = schema;\n\n if (!name) return;\n\n let value = get(meResponse, name);\n\n if (value !== undefined) {\n if (multiValued && !Array.isArray(value)) {\n value = [value];\n }\n } else {\n if (multiValued) {\n value = undefined;\n } else if (type === 'STRING') {\n value = '';\n } else {\n value = undefined;\n }\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 PKCEConstants from '../constants/PKCEConstants';\nimport {TemporaryStore} from '../models/store';\nimport generateStateParamForRequestCorrelation from './generateStateParamForRequestCorrelation';\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 = 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 // 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 {Config} from '../models/config';\nimport {Platform} from '../models/platforms';\nimport isRecognizedBaseUrlPattern from './isRecognizedBaseUrlPattern';\nimport logger from './logger';\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 = 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 {Config} from '../models/config';\nimport isRecognizedBaseUrlPattern from './isRecognizedBaseUrlPattern';\nimport identifyPlatform from './identifyPlatform';\nimport {Platform} from '../models/platforms';\nimport logger from './logger';\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) 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 } else 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';\nimport {EmbeddedSignInFlowAuthenticatorExtendedParamType} from '../models/embedded-signin-flow';\nimport {FieldType} from '../models/field';\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) 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, ThemeVariant} from '../models/branding-preference';\nimport {Theme, ThemeConfig} from '../theme/types';\nimport createTheme from '../theme/createTheme';\n\n/**\n * Safely extracts a color value from the branding preference structure\n */\ntype ColorVariant = {main?: string; dark?: string; contrastText?: string};\ntype TextColors = {primary?: string; secondary?: string; dark?: string};\n\nconst extractColorValue = (colorVariant?: ColorVariant, preferDark = 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?: {main?: string; contrastText?: string}) => {\n return colorVariant?.contrastText;\n};\n\n/**\n * Transforms a ThemeVariant from branding preference to ThemeConfig\n */\nconst transformThemeVariant = (themeVariant: ThemeVariant, isDark = false): Partial<ThemeConfig> => {\n const colors = themeVariant.colors;\n const buttons = themeVariant.buttons;\n const inputs = themeVariant.inputs;\n const images = themeVariant.images;\n\n const config: Partial<ThemeConfig> = {\n colors: {\n action: {\n active: isDark ? 'rgba(255, 255, 255, 0.70)' : 'rgba(0, 0, 0, 0.54)',\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 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 activatedOpacity: 0.12,\n },\n primary: {\n main: extractColorValue(colors?.primary as ColorVariant, isDark),\n contrastText: extractContrastText(colors?.primary),\n dark: colors?.primary?.dark || (colors?.primary as ColorVariant)?.main,\n },\n secondary: {\n main: extractColorValue(colors?.secondary as ColorVariant, isDark),\n contrastText: extractContrastText(colors?.secondary),\n dark: colors?.secondary?.dark || (colors?.secondary as ColorVariant)?.main,\n },\n background: {\n surface: extractColorValue(colors?.background?.surface as ColorVariant, isDark),\n disabled: extractColorValue(colors?.background?.surface as ColorVariant, isDark),\n dark:\n (colors?.background?.surface as ColorVariant)?.dark || (colors?.background?.surface as ColorVariant)?.main,\n body: {\n main: extractColorValue(colors?.background?.body as ColorVariant, isDark),\n dark: (colors?.background?.body as ColorVariant)?.dark || (colors?.background?.body as ColorVariant)?.main,\n },\n },\n text: {\n primary: (colors?.text as TextColors)?.primary,\n secondary: (colors?.text as TextColors)?.secondary,\n dark: (colors?.text as TextColors)?.dark || (colors?.text as TextColors)?.primary,\n },\n border: colors?.outlined?.default,\n error: {\n main: extractColorValue(colors?.alerts?.error as ColorVariant, isDark),\n contrastText: extractContrastText(colors?.alerts?.error),\n dark: (colors?.alerts?.error as ColorVariant)?.dark || (colors?.alerts?.error as ColorVariant)?.main,\n },\n info: {\n main: extractColorValue(colors?.alerts?.info as ColorVariant, isDark),\n contrastText: extractContrastText(colors?.alerts?.info),\n dark: (colors?.alerts?.info as ColorVariant)?.dark || (colors?.alerts?.info as ColorVariant)?.main,\n },\n success: {\n main: extractColorValue(colors?.alerts?.neutral as ColorVariant, isDark),\n contrastText: extractContrastText(colors?.alerts?.neutral),\n dark: (colors?.alerts?.neutral as ColorVariant)?.dark || (colors?.alerts?.neutral as ColorVariant)?.main,\n },\n warning: {\n main: extractColorValue(colors?.alerts?.warning as ColorVariant, isDark),\n contrastText: extractContrastText(colors?.alerts?.warning),\n dark: (colors?.alerts?.warning as ColorVariant)?.dark || (colors?.alerts?.warning as ColorVariant)?.main,\n },\n },\n images: {\n favicon: images?.favicon\n ? {\n url: images.favicon.imgURL,\n title: images.favicon.title,\n alt: images.favicon.altText,\n }\n : undefined,\n logo: images?.logo\n ? {\n url: images.logo.imgURL,\n title: images.logo.title,\n alt: images.logo.altText,\n }\n : undefined,\n },\n };\n\n /* |---------------------------------------------------------------| */\n /* | Components | */\n /* |---------------------------------------------------------------| */\n\n const buttonBorderRadius = buttons?.primary?.base?.border?.borderRadius;\n const fieldBorderRadius = 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 = 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 = themeConfig[activeThemeKey as keyof typeof themeConfig] as ThemeVariant;\n\n if (!themeVariant) {\n // If the specified theme variant doesn't exist, fallback to light theme\n const fallbackVariant = themeConfig.LIGHT || themeConfig.DARK;\n if (fallbackVariant) {\n const transformedConfig = 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 = 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"],
5
+ "mappings": ";;;;;AA2BO,IAAM,0BAAkC;AAE/C,IAAM,iBAAN,MAAwB;AAAA,EAGf,YAAY,YAAoB,OAAgB;AAFvD,wBAAU;AACV,wBAAU;AAER,SAAK,MAAM;AACX,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,MAAgB,cAAc,KAAa,MAAqC;AAC9E,UAAM,mBAA4B,MAAM,KAAK,OAAO,QAAQ,GAAG,KAAM;AACrE,UAAM,eAA+B,oBAAoB,KAAK,MAAM,gBAAgB;AAEpF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M,eAAe,YAAY,cAA0C;AAE3E,MAAI,CAAC,cAAc;AAEjB,UAAM,kBAAkB,YAAY,SAAS,YAAY;AACzD,QAAI,iBAAiB;AACnB,YAAMC,qBAAoB,sBAAsB,iBAAiB,mBAAmB,MAAM;AAC1F,aAAO,oBAAYA,oBAAmB,mBAAmB,MAAM;AAAA,IACjE;AAEA,WAAO,oBAAY,CAAC,GAAG,mBAAmB,MAAM;AAAA,EAClD;AAGA,QAAM,oBAAoB,sBAAsB,cAAc,mBAAmB,MAAM;AAGvF,SAAO,oBAAY,mBAAmB,mBAAmB,MAAM;AACjE;AAEA,IAAO,6CAAQ;",
6
+ "names": ["error", "error", "error", "tokenResponse", "error", "error", "error", "EmbeddedFlowType", "EmbeddedFlowStatus", "EmbeddedFlowResponseType", "EmbeddedFlowComponentType", "error", "error", "error", "error", "error", "error", "error", "error", "error", "error", "error", "EmbeddedSignInFlowStatus", "EmbeddedSignInFlowType", "EmbeddedSignUpFlowStatus", "EmbeddedSignUpFlowType", "Platform", "EmbeddedSignInFlowStatus", "EmbeddedSignInFlowType", "EmbeddedSignInFlowStepType", "EmbeddedSignInFlowAuthenticatorParamType", "EmbeddedSignInFlowAuthenticatorKnownIdPType", "EmbeddedSignInFlowAuthenticatorPromptType", "EmbeddedFlowComponentType", "EmbeddedFlowActionVariant", "EmbeddedFlowTextVariant", "EmbeddedFlowEventType", "FlowMode", "WellKnownSchemaIds", "FieldType", "error", "error", "error", "url", "transformedConfig"]
7
7
  }