@thunderid/react 0.3.5 → 0.3.7
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/ThunderIDReactClient.d.ts.map +1 -1
- package/dist/ThunderIDReactClient.js +1 -5
- package/dist/ThunderIDReactClient.js.map +1 -1
- package/dist/cjs/ThunderIDReactClient.cjs +1 -5
- package/dist/cjs/ThunderIDReactClient.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.cjs +1 -1
- package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs +37 -4
- package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.cjs +1 -1
- package/dist/cjs/components/presentation/auth/Recovery/BaseRecovery.cjs +1 -1
- package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs +4 -32
- package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/SignIn/SignIn.cjs +37 -27
- package/dist/cjs/components/presentation/auth/SignIn/SignIn.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs +2 -2
- package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs.map +1 -1
- package/dist/cjs/contexts/FlowMeta/FlowMetaProvider.cjs +11 -3
- package/dist/cjs/contexts/FlowMeta/FlowMetaProvider.cjs.map +1 -1
- package/dist/cjs/index.cjs +3 -0
- package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.js +1 -1
- package/dist/components/presentation/auth/AuthOptionFactory.d.ts.map +1 -1
- package/dist/components/presentation/auth/AuthOptionFactory.js +37 -4
- package/dist/components/presentation/auth/AuthOptionFactory.js.map +1 -1
- package/dist/components/presentation/auth/InviteUser/BaseInviteUser.js +1 -1
- package/dist/components/presentation/auth/Recovery/BaseRecovery.js +1 -1
- package/dist/components/presentation/auth/SignIn/BaseSignIn.d.ts +1 -6
- package/dist/components/presentation/auth/SignIn/BaseSignIn.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignIn/BaseSignIn.js +6 -34
- package/dist/components/presentation/auth/SignIn/BaseSignIn.js.map +1 -1
- package/dist/components/presentation/auth/SignIn/SignIn.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignIn/SignIn.js +37 -27
- package/dist/components/presentation/auth/SignIn/SignIn.js.map +1 -1
- package/dist/components/presentation/auth/SignUp/BaseSignUp.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignUp/BaseSignUp.js +3 -3
- package/dist/components/presentation/auth/SignUp/BaseSignUp.js.map +1 -1
- package/dist/contexts/FlowMeta/FlowMetaProvider.d.ts +8 -0
- package/dist/contexts/FlowMeta/FlowMetaProvider.d.ts.map +1 -1
- package/dist/contexts/FlowMeta/FlowMetaProvider.js +11 -3
- package/dist/contexts/FlowMeta/FlowMetaProvider.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThunderIDReactClient.d.ts","sourceRoot":"","sources":["../src/ThunderIDReactClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,sBAAsB,EACtB,WAAW,EACX,aAAa,EACb,IAAI,EACJ,aAAa,EAGb,OAAO,EAEP,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,0BAA0B,EAE1B,0BAA0B,EAK3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAC,oBAAoB,EAAC,MAAM,iBAAiB,CAAC;AAErD,cAAM,oBAAoB,CAAC,CAAC,SAAS,oBAAoB,GAAG,oBAAoB,CAAE,SAAQ,sBAAsB,CAAC,CAAC,CAAC;IACjH,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAO,CAAC,iBAAiB,CAAmC;gBAEhD,UAAU,SAA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C,iBAAiB,IAAI,GAAG;IAIlC,OAAO,CAAC,aAAa,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAItE,UAAU,CAAC,cAAc,CAAC,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;CAGrF;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -112,12 +112,8 @@ var ThunderIDReactClient = class extends ThunderIDBrowserClient {
|
|
|
112
112
|
const config = await this.getStorageManager().getConfigData();
|
|
113
113
|
const firstArg = args[0];
|
|
114
114
|
const baseUrl = config?.baseUrl ?? "";
|
|
115
|
-
const authIdFromUrl = new URL(window.location.href).searchParams.get("authId") ?? "";
|
|
116
|
-
const authIdFromStorage = await this.getStorageManager().getHybridDataParameter("authId") ?? "";
|
|
117
|
-
const authId = authIdFromUrl || authIdFromStorage;
|
|
118
|
-
if (authIdFromUrl && !authIdFromStorage) await this.getStorageManager().setHybridDataParameter("authId", authIdFromUrl);
|
|
119
115
|
const response = await executeEmbeddedSignUpFlow({
|
|
120
|
-
authId,
|
|
116
|
+
authId: new URL(window.location.href).searchParams.get("authId") ?? "",
|
|
121
117
|
baseUrl,
|
|
122
118
|
payload: typeof firstArg === "object" && "flowType" in firstArg ? {
|
|
123
119
|
...firstArg,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThunderIDReactClient.js","names":["isInitialized: boolean","claims: User","arg1: any","arg2: any","config: ThunderIDReactConfig | undefined","authIdFromUrl: string","authIdFromStorage: string","response: EmbeddedSignInFlowResponse","decodedAssertion: {\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n }","createdAt: number","expiresIn: number","config: ThunderIDReactConfig","firstArg: any","baseUrl: string","authId: string","response: any","decodedAssertion: {\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n }"],"sources":["../src/ThunderIDReactClient.ts"],"sourcesContent":["/**\n * Copyright (c) 2025-2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n ThunderIDBrowserClient,\n UserProfile,\n SignInOptions,\n User,\n SignUpOptions,\n ThunderIDRuntimeError,\n executeEmbeddedSignInFlow,\n IdToken,\n extractUserClaimsFromIdToken,\n TokenResponse,\n HttpRequestConfig,\n HttpResponse,\n TokenExchangeRequestConfig,\n isEmpty,\n EmbeddedSignInFlowResponse,\n executeEmbeddedSignUpFlow,\n executeEmbeddedRecoveryFlow,\n EmbeddedSignInFlowStatus,\n EmbeddedSignUpFlowStatus,\n} from '@thunderid/browser';\nimport {ThunderIDReactConfig} from './models/config';\n\nclass ThunderIDReactClient<T extends ThunderIDReactConfig = ThunderIDReactConfig> extends ThunderIDBrowserClient<T> {\n private loadingState = false;\n\n private _initializeConfig: ThunderIDReactConfig | undefined;\n\n constructor(instanceId = 0) {\n super(instanceId);\n }\n\n private setLoading(loading: boolean): void {\n this.loadingState = loading;\n }\n\n private async withLoading<TResult>(operation: () => Promise<TResult>): Promise<TResult> {\n this.setLoading(true);\n try {\n const result: TResult = await operation();\n return result;\n } finally {\n this.setLoading(false);\n }\n }\n\n override initialize(config: ThunderIDReactConfig): Promise<boolean> {\n return this.withLoading(async () => {\n this._initializeConfig = {\n ...config,\n periodicTokenRefresh:\n config?.tokenLifecycle?.refreshToken?.autoRefresh ?? (config as any)?.periodicTokenRefresh,\n } as any;\n\n return super.initialize(this._initializeConfig as unknown as T);\n });\n }\n\n override reInitialize(config: Partial<ThunderIDReactConfig>): Promise<boolean> {\n return this.withLoading(async () => {\n let isInitialized: boolean;\n\n try {\n await super.reInitialize(config as Partial<T>);\n isInitialized = true;\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Failed to check if the client is initialized: ${error instanceof Error ? error.message : String(error)}`,\n 'ThunderIDReactClient-reInitialize-RuntimeError-001',\n 'react',\n 'An error occurred while checking the initialization status of the client.',\n );\n }\n\n return isInitialized;\n });\n }\n\n override async updateUserProfile(): Promise<User> {\n throw new Error('Not implemented');\n }\n\n override async getUser(): Promise<User> {\n return extractUserClaimsFromIdToken(await this.getDecodedIdToken());\n }\n\n override async getDecodedIdToken(sessionId?: string): Promise<IdToken> {\n return super.getDecodedIdToken(sessionId);\n }\n\n override async getIdToken(): Promise<string> {\n return this.withLoading(async () => super.getIdToken());\n }\n\n override async getUserProfile(): Promise<UserProfile> {\n return this.withLoading(async () => {\n const claims: User = extractUserClaimsFromIdToken(await this.getDecodedIdToken());\n return {\n flattenedProfile: claims,\n profile: claims,\n schemas: [],\n };\n });\n }\n\n override isLoading(): boolean {\n return this.loadingState;\n }\n\n override async isSignedIn(): Promise<boolean> {\n return super.isSignedIn();\n }\n\n override async exchangeToken(config: TokenExchangeRequestConfig): Promise<TokenResponse | Response> {\n return this.withLoading(async () => super.exchangeToken(config) as unknown as TokenResponse | Response);\n }\n\n override async signIn(...args: any[]): Promise<User | EmbeddedSignInFlowResponse> {\n return this.withLoading(async () => {\n const arg1: any = args[0];\n const arg2: any = args[1];\n\n const config: ThunderIDReactConfig | undefined = (await this.getStorageManager().getConfigData()) as\n | ThunderIDReactConfig\n | undefined;\n\n // NOTE: With React 19 strict mode, the initialization logic runs twice, and there's an intermittent\n // issue where the config object is not getting stored in the storage layer with Vite scaffolding.\n // Hence, we need to check if the client is initialized but the config object is empty, and reinitialize.\n if (!config || Object.keys(config).length === 0) {\n await this.initialize(this._initializeConfig!);\n }\n\n if (typeof arg1 === 'object' && arg1 !== null && arg1.callOnlyOnRedirect === true) {\n return undefined as any;\n }\n\n if (\n typeof arg1 === 'object' &&\n arg1 !== null &&\n !isEmpty(arg1) &&\n ('executionId' in arg1 || 'applicationId' in arg1)\n ) {\n const authIdFromUrl: string = new URL(window.location.href).searchParams.get('authId') ?? '';\n const authIdFromStorage: string =\n ((await this.getStorageManager().getHybridDataParameter('authId')) as string) ?? '';\n const authId: string = authIdFromUrl || authIdFromStorage;\n const baseUrl: string = config?.baseUrl ?? '';\n\n const response: EmbeddedSignInFlowResponse = await executeEmbeddedSignInFlow({\n authId,\n baseUrl,\n payload: arg1,\n url: arg2?.url,\n });\n\n if (\n response &&\n typeof response === 'object' &&\n response.flowStatus === EmbeddedSignInFlowStatus.Complete &&\n response.assertion\n ) {\n const decodedAssertion: {\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n } = await this.decodeJwtToken<{\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n }>(response.assertion);\n\n const createdAt: number = decodedAssertion.iat ? decodedAssertion.iat * 1000 : Date.now();\n const expiresIn: number =\n decodedAssertion.exp && decodedAssertion.iat ? decodedAssertion.exp - decodedAssertion.iat : 3600;\n\n await this.setSession({\n access_token: response.assertion,\n created_at: createdAt,\n expires_in: expiresIn,\n id_token: response.assertion,\n scope: decodedAssertion.scope,\n token_type: 'Bearer',\n });\n\n this.notifySignIn(extractUserClaimsFromIdToken(decodedAssertion as IdToken) as User);\n }\n\n return response;\n }\n\n return (await super.signIn(...args)) as unknown as User;\n });\n }\n\n override async signInSilently(options?: SignInOptions): Promise<User | boolean> {\n return super.signInSilently(options as Record<string, string | boolean>) as Promise<User | boolean>;\n }\n\n override async signUp(options?: SignUpOptions): Promise<void>;\n override async signUp(payload: any): Promise<any>;\n override async signUp(...args: any[]): Promise<void | any> {\n const config: ThunderIDReactConfig = (await this.getStorageManager().getConfigData()) as ThunderIDReactConfig;\n const firstArg: any = args[0];\n const baseUrl: string = config?.baseUrl ?? '';\n\n const authIdFromUrl: string = new URL(window.location.href).searchParams.get('authId') ?? '';\n const authIdFromStorage: string =\n ((await this.getStorageManager().getHybridDataParameter('authId')) as string) ?? '';\n const authId: string = authIdFromUrl || authIdFromStorage;\n\n if (authIdFromUrl && !authIdFromStorage) {\n await this.getStorageManager().setHybridDataParameter('authId', authIdFromUrl);\n }\n\n const response: any = await executeEmbeddedSignUpFlow({\n authId,\n baseUrl,\n payload: typeof firstArg === 'object' && 'flowType' in firstArg ? {...firstArg, verbose: true} : firstArg,\n });\n\n if (\n response &&\n typeof response === 'object' &&\n response.flowStatus === EmbeddedSignUpFlowStatus.Complete &&\n response.assertion\n ) {\n const decodedAssertion: {\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n } = await this.decodeJwtToken<{\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n }>(response.assertion);\n\n const createdAt: number = decodedAssertion.iat ? decodedAssertion.iat * 1000 : Date.now();\n const expiresIn: number =\n decodedAssertion.exp && decodedAssertion.iat ? decodedAssertion.exp - decodedAssertion.iat : 3600;\n\n await this.setSession({\n access_token: response.assertion,\n created_at: createdAt,\n expires_in: expiresIn,\n id_token: response.assertion,\n scope: decodedAssertion.scope,\n token_type: 'Bearer',\n });\n\n this.notifySignIn(extractUserClaimsFromIdToken(decodedAssertion as IdToken) as User);\n }\n\n return response;\n }\n\n override async recover(payload?: any): Promise<any> {\n const config: ThunderIDReactConfig = (await this.getStorageManager().getConfigData()) as ThunderIDReactConfig;\n\n return executeEmbeddedRecoveryFlow({\n baseUrl: config?.baseUrl,\n payload: {...payload, verbose: true},\n }) as any;\n }\n\n public override getStorageManager(): any {\n return super.getStorageManager();\n }\n\n async request(requestConfig?: HttpRequestConfig): Promise<HttpResponse<any>> {\n return super.httpRequest(requestConfig!) as Promise<HttpResponse<any>>;\n }\n\n async requestAll(requestConfigs?: HttpRequestConfig[]): Promise<HttpResponse<any>[]> {\n return super.httpRequestAll(requestConfigs!) as Promise<HttpResponse<any>[]>;\n }\n}\n\nexport default ThunderIDReactClient;\n"],"mappings":";;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IAAC,GAAG;IAAS,SAAS;IAAK;GACrC,CAAC;;CAGJ,AAAgB,oBAAyB;AACvC,SAAO,MAAM,mBAAmB;;CAGlC,MAAM,QAAQ,eAA+D;AAC3E,SAAO,MAAM,YAAY,cAAe;;CAG1C,MAAM,WAAW,gBAAoE;AACnF,SAAO,MAAM,eAAe,eAAgB;;;AAIhD,mCAAe"}
|
|
1
|
+
{"version":3,"file":"ThunderIDReactClient.js","names":["isInitialized: boolean","claims: User","arg1: any","arg2: any","config: ThunderIDReactConfig | undefined","authIdFromUrl: string","authIdFromStorage: string","response: EmbeddedSignInFlowResponse","decodedAssertion: {\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n }","createdAt: number","expiresIn: number","config: ThunderIDReactConfig","firstArg: any","baseUrl: string","response: any","decodedAssertion: {\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n }"],"sources":["../src/ThunderIDReactClient.ts"],"sourcesContent":["/**\n * Copyright (c) 2025-2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n ThunderIDBrowserClient,\n UserProfile,\n SignInOptions,\n User,\n SignUpOptions,\n ThunderIDRuntimeError,\n executeEmbeddedSignInFlow,\n IdToken,\n extractUserClaimsFromIdToken,\n TokenResponse,\n HttpRequestConfig,\n HttpResponse,\n TokenExchangeRequestConfig,\n isEmpty,\n EmbeddedSignInFlowResponse,\n executeEmbeddedSignUpFlow,\n executeEmbeddedRecoveryFlow,\n EmbeddedSignInFlowStatus,\n EmbeddedSignUpFlowStatus,\n} from '@thunderid/browser';\nimport {ThunderIDReactConfig} from './models/config';\n\nclass ThunderIDReactClient<T extends ThunderIDReactConfig = ThunderIDReactConfig> extends ThunderIDBrowserClient<T> {\n private loadingState = false;\n\n private _initializeConfig: ThunderIDReactConfig | undefined;\n\n constructor(instanceId = 0) {\n super(instanceId);\n }\n\n private setLoading(loading: boolean): void {\n this.loadingState = loading;\n }\n\n private async withLoading<TResult>(operation: () => Promise<TResult>): Promise<TResult> {\n this.setLoading(true);\n try {\n const result: TResult = await operation();\n return result;\n } finally {\n this.setLoading(false);\n }\n }\n\n override initialize(config: ThunderIDReactConfig): Promise<boolean> {\n return this.withLoading(async () => {\n this._initializeConfig = {\n ...config,\n periodicTokenRefresh:\n config?.tokenLifecycle?.refreshToken?.autoRefresh ?? (config as any)?.periodicTokenRefresh,\n } as any;\n\n return super.initialize(this._initializeConfig as unknown as T);\n });\n }\n\n override reInitialize(config: Partial<ThunderIDReactConfig>): Promise<boolean> {\n return this.withLoading(async () => {\n let isInitialized: boolean;\n\n try {\n await super.reInitialize(config as Partial<T>);\n isInitialized = true;\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Failed to check if the client is initialized: ${error instanceof Error ? error.message : String(error)}`,\n 'ThunderIDReactClient-reInitialize-RuntimeError-001',\n 'react',\n 'An error occurred while checking the initialization status of the client.',\n );\n }\n\n return isInitialized;\n });\n }\n\n override async updateUserProfile(): Promise<User> {\n throw new Error('Not implemented');\n }\n\n override async getUser(): Promise<User> {\n return extractUserClaimsFromIdToken(await this.getDecodedIdToken());\n }\n\n override async getDecodedIdToken(sessionId?: string): Promise<IdToken> {\n return super.getDecodedIdToken(sessionId);\n }\n\n override async getIdToken(): Promise<string> {\n return this.withLoading(async () => super.getIdToken());\n }\n\n override async getUserProfile(): Promise<UserProfile> {\n return this.withLoading(async () => {\n const claims: User = extractUserClaimsFromIdToken(await this.getDecodedIdToken());\n return {\n flattenedProfile: claims,\n profile: claims,\n schemas: [],\n };\n });\n }\n\n override isLoading(): boolean {\n return this.loadingState;\n }\n\n override async isSignedIn(): Promise<boolean> {\n return super.isSignedIn();\n }\n\n override async exchangeToken(config: TokenExchangeRequestConfig): Promise<TokenResponse | Response> {\n return this.withLoading(async () => super.exchangeToken(config) as unknown as TokenResponse | Response);\n }\n\n override async signIn(...args: any[]): Promise<User | EmbeddedSignInFlowResponse> {\n return this.withLoading(async () => {\n const arg1: any = args[0];\n const arg2: any = args[1];\n\n const config: ThunderIDReactConfig | undefined = (await this.getStorageManager().getConfigData()) as\n | ThunderIDReactConfig\n | undefined;\n\n // NOTE: With React 19 strict mode, the initialization logic runs twice, and there's an intermittent\n // issue where the config object is not getting stored in the storage layer with Vite scaffolding.\n // Hence, we need to check if the client is initialized but the config object is empty, and reinitialize.\n if (!config || Object.keys(config).length === 0) {\n await this.initialize(this._initializeConfig!);\n }\n\n if (typeof arg1 === 'object' && arg1 !== null && arg1.callOnlyOnRedirect === true) {\n return undefined as any;\n }\n\n if (\n typeof arg1 === 'object' &&\n arg1 !== null &&\n !isEmpty(arg1) &&\n ('executionId' in arg1 || 'applicationId' in arg1)\n ) {\n const authIdFromUrl: string = new URL(window.location.href).searchParams.get('authId') ?? '';\n const authIdFromStorage: string =\n ((await this.getStorageManager().getHybridDataParameter('authId')) as string) ?? '';\n const authId: string = authIdFromUrl || authIdFromStorage;\n const baseUrl: string = config?.baseUrl ?? '';\n\n const response: EmbeddedSignInFlowResponse = await executeEmbeddedSignInFlow({\n authId,\n baseUrl,\n payload: arg1,\n url: arg2?.url,\n });\n\n if (\n response &&\n typeof response === 'object' &&\n response.flowStatus === EmbeddedSignInFlowStatus.Complete &&\n response.assertion\n ) {\n const decodedAssertion: {\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n } = await this.decodeJwtToken<{\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n }>(response.assertion);\n\n const createdAt: number = decodedAssertion.iat ? decodedAssertion.iat * 1000 : Date.now();\n const expiresIn: number =\n decodedAssertion.exp && decodedAssertion.iat ? decodedAssertion.exp - decodedAssertion.iat : 3600;\n\n await this.setSession({\n access_token: response.assertion,\n created_at: createdAt,\n expires_in: expiresIn,\n id_token: response.assertion,\n scope: decodedAssertion.scope,\n token_type: 'Bearer',\n });\n\n this.notifySignIn(extractUserClaimsFromIdToken(decodedAssertion as IdToken) as User);\n }\n\n return response;\n }\n\n return (await super.signIn(...args)) as unknown as User;\n });\n }\n\n override async signInSilently(options?: SignInOptions): Promise<User | boolean> {\n return super.signInSilently(options as Record<string, string | boolean>) as Promise<User | boolean>;\n }\n\n override async signUp(options?: SignUpOptions): Promise<void>;\n override async signUp(payload: any): Promise<any>;\n override async signUp(...args: any[]): Promise<void | any> {\n const config: ThunderIDReactConfig = (await this.getStorageManager().getConfigData()) as ThunderIDReactConfig;\n const firstArg: any = args[0];\n const baseUrl: string = config?.baseUrl ?? '';\n\n const authId: string = new URL(window.location.href).searchParams.get('authId') ?? '';\n\n const response: any = await executeEmbeddedSignUpFlow({\n authId,\n baseUrl,\n payload: typeof firstArg === 'object' && 'flowType' in firstArg ? {...firstArg, verbose: true} : firstArg,\n });\n\n if (\n response &&\n typeof response === 'object' &&\n response.flowStatus === EmbeddedSignUpFlowStatus.Complete &&\n response.assertion\n ) {\n const decodedAssertion: {\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n } = await this.decodeJwtToken<{\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n }>(response.assertion);\n\n const createdAt: number = decodedAssertion.iat ? decodedAssertion.iat * 1000 : Date.now();\n const expiresIn: number =\n decodedAssertion.exp && decodedAssertion.iat ? decodedAssertion.exp - decodedAssertion.iat : 3600;\n\n await this.setSession({\n access_token: response.assertion,\n created_at: createdAt,\n expires_in: expiresIn,\n id_token: response.assertion,\n scope: decodedAssertion.scope,\n token_type: 'Bearer',\n });\n\n this.notifySignIn(extractUserClaimsFromIdToken(decodedAssertion as IdToken) as User);\n }\n\n return response;\n }\n\n override async recover(payload?: any): Promise<any> {\n const config: ThunderIDReactConfig = (await this.getStorageManager().getConfigData()) as ThunderIDReactConfig;\n\n return executeEmbeddedRecoveryFlow({\n baseUrl: config?.baseUrl,\n payload: {...payload, verbose: true},\n }) as any;\n }\n\n public override getStorageManager(): any {\n return super.getStorageManager();\n }\n\n async request(requestConfig?: HttpRequestConfig): Promise<HttpResponse<any>> {\n return super.httpRequest(requestConfig!) as Promise<HttpResponse<any>>;\n }\n\n async requestAll(requestConfigs?: HttpRequestConfig[]): Promise<HttpResponse<any>[]> {\n return super.httpRequestAll(requestConfigs!) as Promise<HttpResponse<any>[]>;\n }\n}\n\nexport default ThunderIDReactClient;\n"],"mappings":";;;AAyCA,IAAM,uBAAN,cAA0F,uBAA0B;CAClH,AAAQ,eAAe;CAEvB,AAAQ;CAER,YAAY,aAAa,GAAG;AAC1B,QAAM,WAAW;;CAGnB,AAAQ,WAAW,SAAwB;AACzC,OAAK,eAAe;;CAGtB,MAAc,YAAqB,WAAqD;AACtF,OAAK,WAAW,KAAK;AACrB,MAAI;AAEF,UADwB,MAAM,WAAW;YAEjC;AACR,QAAK,WAAW,MAAM;;;CAI1B,AAAS,WAAW,QAAgD;AAClE,SAAO,KAAK,YAAY,YAAY;AAClC,QAAK,oBAAoB;IACvB,GAAG;IACH,sBACE,QAAQ,gBAAgB,cAAc,eAAgB,QAAgB;IACzE;AAED,UAAO,MAAM,WAAW,KAAK,kBAAkC;IAC/D;;CAGJ,AAAS,aAAa,QAAyD;AAC7E,SAAO,KAAK,YAAY,YAAY;GAClC,IAAIA;AAEJ,OAAI;AACF,UAAM,MAAM,aAAa,OAAqB;AAC9C,oBAAgB;YACT,OAAO;AACd,UAAM,IAAI,sBACR,iDAAiD,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,IACvG,sDACA,SACA,4EACD;;AAGH,UAAO;IACP;;CAGJ,MAAe,oBAAmC;AAChD,QAAM,IAAI,MAAM,kBAAkB;;CAGpC,MAAe,UAAyB;AACtC,S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Y;IACZ,UAAU,SAAS;IACnB,OAAO,iBAAiB;IACxB,YAAY;IACb,CAAC;AAEF,QAAK,aAAa,6BAA6B,iBAA4B,CAAS;;AAGtF,SAAO;;CAGT,MAAe,QAAQ,SAA6B;AAGlD,SAAO,4BAA4B;GACjC,UAHoC,MAAM,KAAK,mBAAmB,CAAC,eAAe,GAGjE;GACjB,SAAS;IAAC,GAAG;IAAS,SAAS;IAAK;GACrC,CAAC;;CAGJ,AAAgB,oBAAyB;AACvC,SAAO,MAAM,mBAAmB;;CAGlC,MAAM,QAAQ,eAA+D;AAC3E,SAAO,MAAM,YAAY,cAAe;;CAG1C,MAAM,WAAW,gBAAoE;AACnF,SAAO,MAAM,eAAe,eAAgB;;;AAIhD,mCAAe"}
|
|
@@ -114,12 +114,8 @@ var ThunderIDReactClient = class extends __thunderid_browser.ThunderIDBrowserCli
|
|
|
114
114
|
const config = await this.getStorageManager().getConfigData();
|
|
115
115
|
const firstArg = args[0];
|
|
116
116
|
const baseUrl = config?.baseUrl ?? "";
|
|
117
|
-
const authIdFromUrl = new URL(window.location.href).searchParams.get("authId") ?? "";
|
|
118
|
-
const authIdFromStorage = await this.getStorageManager().getHybridDataParameter("authId") ?? "";
|
|
119
|
-
const authId = authIdFromUrl || authIdFromStorage;
|
|
120
|
-
if (authIdFromUrl && !authIdFromStorage) await this.getStorageManager().setHybridDataParameter("authId", authIdFromUrl);
|
|
121
117
|
const response = await (0, __thunderid_browser.executeEmbeddedSignUpFlow)({
|
|
122
|
-
authId,
|
|
118
|
+
authId: new URL(window.location.href).searchParams.get("authId") ?? "",
|
|
123
119
|
baseUrl,
|
|
124
120
|
payload: typeof firstArg === "object" && "flowType" in firstArg ? {
|
|
125
121
|
...firstArg,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThunderIDReactClient.cjs","names":["ThunderIDBrowserClient","isInitialized: boolean","ThunderIDRuntimeError","claims: User","arg1: any","arg2: any","config: ThunderIDReactConfig | undefined","authIdFromUrl: string","authIdFromStorage: string","response: EmbeddedSignInFlowResponse","EmbeddedSignInFlowStatus","decodedAssertion: {\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n }","createdAt: number","expiresIn: number","config: ThunderIDReactConfig","firstArg: any","baseUrl: string","authId: string","response: any","EmbeddedSignUpFlowStatus","decodedAssertion: {\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n }"],"sources":["../../src/ThunderIDReactClient.ts"],"sourcesContent":["/**\n * Copyright (c) 2025-2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n ThunderIDBrowserClient,\n UserProfile,\n SignInOptions,\n User,\n SignUpOptions,\n ThunderIDRuntimeError,\n executeEmbeddedSignInFlow,\n IdToken,\n extractUserClaimsFromIdToken,\n TokenResponse,\n HttpRequestConfig,\n HttpResponse,\n TokenExchangeRequestConfig,\n isEmpty,\n EmbeddedSignInFlowResponse,\n executeEmbeddedSignUpFlow,\n executeEmbeddedRecoveryFlow,\n EmbeddedSignInFlowStatus,\n EmbeddedSignUpFlowStatus,\n} from '@thunderid/browser';\nimport {ThunderIDReactConfig} from './models/config';\n\nclass ThunderIDReactClient<T extends ThunderIDReactConfig = ThunderIDReactConfig> extends ThunderIDBrowserClient<T> {\n private loadingState = false;\n\n private _initializeConfig: ThunderIDReactConfig | undefined;\n\n constructor(instanceId = 0) {\n super(instanceId);\n }\n\n private setLoading(loading: boolean): void {\n this.loadingState = loading;\n }\n\n private async withLoading<TResult>(operation: () => Promise<TResult>): Promise<TResult> {\n this.setLoading(true);\n try {\n const result: TResult = await operation();\n return result;\n } finally {\n this.setLoading(false);\n }\n }\n\n override initialize(config: ThunderIDReactConfig): Promise<boolean> {\n return this.withLoading(async () => {\n this._initializeConfig = {\n ...config,\n periodicTokenRefresh:\n config?.tokenLifecycle?.refreshToken?.autoRefresh ?? (config as any)?.periodicTokenRefresh,\n } as any;\n\n return super.initialize(this._initializeConfig as unknown as T);\n });\n }\n\n override reInitialize(config: Partial<ThunderIDReactConfig>): Promise<boolean> {\n return this.withLoading(async () => {\n let isInitialized: boolean;\n\n try {\n await super.reInitialize(config as Partial<T>);\n isInitialized = true;\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Failed to check if the client is initialized: ${error instanceof Error ? error.message : String(error)}`,\n 'ThunderIDReactClient-reInitialize-RuntimeError-001',\n 'react',\n 'An error occurred while checking the initialization status of the client.',\n );\n }\n\n return isInitialized;\n });\n }\n\n override async updateUserProfile(): Promise<User> {\n throw new Error('Not implemented');\n }\n\n override async getUser(): Promise<User> {\n return extractUserClaimsFromIdToken(await this.getDecodedIdToken());\n }\n\n override async getDecodedIdToken(sessionId?: string): Promise<IdToken> {\n return super.getDecodedIdToken(sessionId);\n }\n\n override async getIdToken(): Promise<string> {\n return this.withLoading(async () => super.getIdToken());\n }\n\n override async getUserProfile(): Promise<UserProfile> {\n return this.withLoading(async () => {\n const claims: User = extractUserClaimsFromIdToken(await this.getDecodedIdToken());\n return {\n flattenedProfile: claims,\n profile: claims,\n schemas: [],\n };\n });\n }\n\n override isLoading(): boolean {\n return this.loadingState;\n }\n\n override async isSignedIn(): Promise<boolean> {\n return super.isSignedIn();\n }\n\n override async exchangeToken(config: TokenExchangeRequestConfig): Promise<TokenResponse | Response> {\n return this.withLoading(async () => super.exchangeToken(config) as unknown as TokenResponse | Response);\n }\n\n override async signIn(...args: any[]): Promise<User | EmbeddedSignInFlowResponse> {\n return this.withLoading(async () => {\n const arg1: any = args[0];\n const arg2: any = args[1];\n\n const config: ThunderIDReactConfig | undefined = (await this.getStorageManager().getConfigData()) as\n | ThunderIDReactConfig\n | undefined;\n\n // NOTE: With React 19 strict mode, the initialization logic runs twice, and there's an intermittent\n // issue where the config object is not getting stored in the storage layer with Vite scaffolding.\n // Hence, we need to check if the client is initialized but the config object is empty, and reinitialize.\n if (!config || Object.keys(config).length === 0) {\n await this.initialize(this._initializeConfig!);\n }\n\n if (typeof arg1 === 'object' && arg1 !== null && arg1.callOnlyOnRedirect === true) {\n return undefined as any;\n }\n\n if (\n typeof arg1 === 'object' &&\n arg1 !== null &&\n !isEmpty(arg1) &&\n ('executionId' in arg1 || 'applicationId' in arg1)\n ) {\n const authIdFromUrl: string = new URL(window.location.href).searchParams.get('authId') ?? '';\n const authIdFromStorage: string =\n ((await this.getStorageManager().getHybridDataParameter('authId')) as string) ?? '';\n const authId: string = authIdFromUrl || authIdFromStorage;\n const baseUrl: string = config?.baseUrl ?? '';\n\n const response: EmbeddedSignInFlowResponse = await executeEmbeddedSignInFlow({\n authId,\n baseUrl,\n payload: arg1,\n url: arg2?.url,\n });\n\n if (\n response &&\n typeof response === 'object' &&\n response.flowStatus === EmbeddedSignInFlowStatus.Complete &&\n response.assertion\n ) {\n const decodedAssertion: {\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n } = await this.decodeJwtToken<{\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n }>(response.assertion);\n\n const createdAt: number = decodedAssertion.iat ? decodedAssertion.iat * 1000 : Date.now();\n const expiresIn: number =\n decodedAssertion.exp && decodedAssertion.iat ? decodedAssertion.exp - decodedAssertion.iat : 3600;\n\n await this.setSession({\n access_token: response.assertion,\n created_at: createdAt,\n expires_in: expiresIn,\n id_token: response.assertion,\n scope: decodedAssertion.scope,\n token_type: 'Bearer',\n });\n\n this.notifySignIn(extractUserClaimsFromIdToken(decodedAssertion as IdToken) as User);\n }\n\n return response;\n }\n\n return (await super.signIn(...args)) as unknown as User;\n });\n }\n\n override async signInSilently(options?: SignInOptions): Promise<User | boolean> {\n return super.signInSilently(options as Record<string, string | boolean>) as Promise<User | boolean>;\n }\n\n override async signUp(options?: SignUpOptions): Promise<void>;\n override async signUp(payload: any): Promise<any>;\n override async signUp(...args: any[]): Promise<void | any> {\n const config: ThunderIDReactConfig = (await this.getStorageManager().getConfigData()) as ThunderIDReactConfig;\n const firstArg: any = args[0];\n const baseUrl: string = config?.baseUrl ?? '';\n\n const authIdFromUrl: string = new URL(window.location.href).searchParams.get('authId') ?? '';\n const authIdFromStorage: string =\n ((await this.getStorageManager().getHybridDataParameter('authId')) as string) ?? '';\n const authId: string = authIdFromUrl || authIdFromStorage;\n\n if (authIdFromUrl && !authIdFromStorage) {\n await this.getStorageManager().setHybridDataParameter('authId', authIdFromUrl);\n }\n\n const response: any = await executeEmbeddedSignUpFlow({\n authId,\n baseUrl,\n payload: typeof firstArg === 'object' && 'flowType' in firstArg ? {...firstArg, verbose: true} : firstArg,\n });\n\n if (\n response &&\n typeof response === 'object' &&\n response.flowStatus === EmbeddedSignUpFlowStatus.Complete &&\n response.assertion\n ) {\n const decodedAssertion: {\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n } = await this.decodeJwtToken<{\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n }>(response.assertion);\n\n const createdAt: number = decodedAssertion.iat ? decodedAssertion.iat * 1000 : Date.now();\n const expiresIn: number =\n decodedAssertion.exp && decodedAssertion.iat ? decodedAssertion.exp - decodedAssertion.iat : 3600;\n\n await this.setSession({\n access_token: response.assertion,\n created_at: createdAt,\n expires_in: expiresIn,\n id_token: response.assertion,\n scope: decodedAssertion.scope,\n token_type: 'Bearer',\n });\n\n this.notifySignIn(extractUserClaimsFromIdToken(decodedAssertion as IdToken) as User);\n }\n\n return response;\n }\n\n override async recover(payload?: any): Promise<any> {\n const config: ThunderIDReactConfig = (await this.getStorageManager().getConfigData()) as ThunderIDReactConfig;\n\n return executeEmbeddedRecoveryFlow({\n baseUrl: config?.baseUrl,\n payload: {...payload, verbose: true},\n }) as any;\n }\n\n public override getStorageManager(): any {\n return super.getStorageManager();\n }\n\n async request(requestConfig?: HttpRequestConfig): Promise<HttpResponse<any>> {\n return super.httpRequest(requestConfig!) as Promise<HttpResponse<any>>;\n }\n\n async requestAll(requestConfigs?: HttpRequestConfig[]): Promise<HttpResponse<any>[]> {\n return super.httpRequestAll(requestConfigs!) as Promise<HttpResponse<any>[]>;\n }\n}\n\nexport default ThunderIDReactClient;\n"],"mappings":";;;;;AAyCA,IAAM,uBAAN,cAA0FA,2CAA0B;CAClH,AAAQ,eAAe;CAEvB,AAAQ;CAER,YAAY,aAAa,GAAG;AAC1B,QAAM,WAAW;;CAGnB,AAAQ,WAAW,SAAwB;AACzC,OAAK,eAAe;;CAGtB,MAAc,YAAqB,WAAqD;AACtF,OAAK,WAAW,KAAK;AACrB,MAAI;AAEF,UADwB,MAAM,WAAW;YAEjC;AACR,QAAK,WAAW,MAAM;;;CAI1B,AAAS,WAAW,QAAgD;AAClE,SAAO,KAAK,YAAY,YAAY;AAClC,QAAK,oBAAoB;IACvB,GAAG;IACH,sBACE,QAAQ,gBAAgB,cAAc,eAAgB,QAAgB;IACzE;AAED,UAAO,MAAM,WAAW,KAAK,kBAAkC;IAC/D;;CAGJ,AAAS,aAAa,QAAyD;AAC7E,SAAO,KAAK,YAAY,YAAY;GAClC,IAAIC;AAEJ,OAAI;AACF,UAAM,MAAM,aAAa,OAAqB;AAC9C,oBAAgB;YACT,OAAO;AACd,UAAM,IAAIC,0CACR,iDAAiD,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,IACvG,sDACA,SACA,4EACD;;AAGH,UAAO;IACP;;CAGJ,MAAe,oBAAmC;AAChD,QAAM,IAAI,MAAM,kBAAkB;;CAGpC,MAAe,UAAyB;AACtC,+DAAoC,MAAM,KAAK,mBAAmB,CAAC;;CAGrE,MAAe,kBAAkB,WAAsC;AACrE,SAAO,MAAM,kBAAkB,UAAU;;CAG3C,MAAe,a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WAAW;IACpB,cAAc,SAAS;IACvB,YAAY;IACZ,YAAY;IACZ,UAAU,SAAS;IACnB,OAAO,iBAAiB;IACxB,YAAY;IACb,CAAC;AAEF,QAAK,mEAA0C,iBAA4B,CAAS;;AAGtF,SAAO;;CAGT,MAAe,QAAQ,SAA6B;AAGlD,8DAAmC;GACjC,UAHoC,MAAM,KAAK,mBAAmB,CAAC,eAAe,GAGjE;GACjB,SAAS;IAAC,GAAG;IAAS,SAAS;IAAK;GACrC,CAAC;;CAGJ,AAAgB,oBAAyB;AACvC,SAAO,MAAM,mBAAmB;;CAGlC,MAAM,QAAQ,eAA+D;AAC3E,SAAO,MAAM,YAAY,cAAe;;CAG1C,MAAM,WAAW,gBAAoE;AACnF,SAAO,MAAM,eAAe,eAAgB;;;AAIhD,mCAAe"}
|
|
1
|
+
{"version":3,"file":"ThunderIDReactClient.cjs","names":["ThunderIDBrowserClient","isInitialized: boolean","ThunderIDRuntimeError","claims: User","arg1: any","arg2: any","config: ThunderIDReactConfig | undefined","authIdFromUrl: string","authIdFromStorage: string","response: EmbeddedSignInFlowResponse","EmbeddedSignInFlowStatus","decodedAssertion: {\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n }","createdAt: number","expiresIn: number","config: ThunderIDReactConfig","firstArg: any","baseUrl: string","response: any","EmbeddedSignUpFlowStatus","decodedAssertion: {\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n }"],"sources":["../../src/ThunderIDReactClient.ts"],"sourcesContent":["/**\n * Copyright (c) 2025-2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n ThunderIDBrowserClient,\n UserProfile,\n SignInOptions,\n User,\n SignUpOptions,\n ThunderIDRuntimeError,\n executeEmbeddedSignInFlow,\n IdToken,\n extractUserClaimsFromIdToken,\n TokenResponse,\n HttpRequestConfig,\n HttpResponse,\n TokenExchangeRequestConfig,\n isEmpty,\n EmbeddedSignInFlowResponse,\n executeEmbeddedSignUpFlow,\n executeEmbeddedRecoveryFlow,\n EmbeddedSignInFlowStatus,\n EmbeddedSignUpFlowStatus,\n} from '@thunderid/browser';\nimport {ThunderIDReactConfig} from './models/config';\n\nclass ThunderIDReactClient<T extends ThunderIDReactConfig = ThunderIDReactConfig> extends ThunderIDBrowserClient<T> {\n private loadingState = false;\n\n private _initializeConfig: ThunderIDReactConfig | undefined;\n\n constructor(instanceId = 0) {\n super(instanceId);\n }\n\n private setLoading(loading: boolean): void {\n this.loadingState = loading;\n }\n\n private async withLoading<TResult>(operation: () => Promise<TResult>): Promise<TResult> {\n this.setLoading(true);\n try {\n const result: TResult = await operation();\n return result;\n } finally {\n this.setLoading(false);\n }\n }\n\n override initialize(config: ThunderIDReactConfig): Promise<boolean> {\n return this.withLoading(async () => {\n this._initializeConfig = {\n ...config,\n periodicTokenRefresh:\n config?.tokenLifecycle?.refreshToken?.autoRefresh ?? (config as any)?.periodicTokenRefresh,\n } as any;\n\n return super.initialize(this._initializeConfig as unknown as T);\n });\n }\n\n override reInitialize(config: Partial<ThunderIDReactConfig>): Promise<boolean> {\n return this.withLoading(async () => {\n let isInitialized: boolean;\n\n try {\n await super.reInitialize(config as Partial<T>);\n isInitialized = true;\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Failed to check if the client is initialized: ${error instanceof Error ? error.message : String(error)}`,\n 'ThunderIDReactClient-reInitialize-RuntimeError-001',\n 'react',\n 'An error occurred while checking the initialization status of the client.',\n );\n }\n\n return isInitialized;\n });\n }\n\n override async updateUserProfile(): Promise<User> {\n throw new Error('Not implemented');\n }\n\n override async getUser(): Promise<User> {\n return extractUserClaimsFromIdToken(await this.getDecodedIdToken());\n }\n\n override async getDecodedIdToken(sessionId?: string): Promise<IdToken> {\n return super.getDecodedIdToken(sessionId);\n }\n\n override async getIdToken(): Promise<string> {\n return this.withLoading(async () => super.getIdToken());\n }\n\n override async getUserProfile(): Promise<UserProfile> {\n return this.withLoading(async () => {\n const claims: User = extractUserClaimsFromIdToken(await this.getDecodedIdToken());\n return {\n flattenedProfile: claims,\n profile: claims,\n schemas: [],\n };\n });\n }\n\n override isLoading(): boolean {\n return this.loadingState;\n }\n\n override async isSignedIn(): Promise<boolean> {\n return super.isSignedIn();\n }\n\n override async exchangeToken(config: TokenExchangeRequestConfig): Promise<TokenResponse | Response> {\n return this.withLoading(async () => super.exchangeToken(config) as unknown as TokenResponse | Response);\n }\n\n override async signIn(...args: any[]): Promise<User | EmbeddedSignInFlowResponse> {\n return this.withLoading(async () => {\n const arg1: any = args[0];\n const arg2: any = args[1];\n\n const config: ThunderIDReactConfig | undefined = (await this.getStorageManager().getConfigData()) as\n | ThunderIDReactConfig\n | undefined;\n\n // NOTE: With React 19 strict mode, the initialization logic runs twice, and there's an intermittent\n // issue where the config object is not getting stored in the storage layer with Vite scaffolding.\n // Hence, we need to check if the client is initialized but the config object is empty, and reinitialize.\n if (!config || Object.keys(config).length === 0) {\n await this.initialize(this._initializeConfig!);\n }\n\n if (typeof arg1 === 'object' && arg1 !== null && arg1.callOnlyOnRedirect === true) {\n return undefined as any;\n }\n\n if (\n typeof arg1 === 'object' &&\n arg1 !== null &&\n !isEmpty(arg1) &&\n ('executionId' in arg1 || 'applicationId' in arg1)\n ) {\n const authIdFromUrl: string = new URL(window.location.href).searchParams.get('authId') ?? '';\n const authIdFromStorage: string =\n ((await this.getStorageManager().getHybridDataParameter('authId')) as string) ?? '';\n const authId: string = authIdFromUrl || authIdFromStorage;\n const baseUrl: string = config?.baseUrl ?? '';\n\n const response: EmbeddedSignInFlowResponse = await executeEmbeddedSignInFlow({\n authId,\n baseUrl,\n payload: arg1,\n url: arg2?.url,\n });\n\n if (\n response &&\n typeof response === 'object' &&\n response.flowStatus === EmbeddedSignInFlowStatus.Complete &&\n response.assertion\n ) {\n const decodedAssertion: {\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n } = await this.decodeJwtToken<{\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n }>(response.assertion);\n\n const createdAt: number = decodedAssertion.iat ? decodedAssertion.iat * 1000 : Date.now();\n const expiresIn: number =\n decodedAssertion.exp && decodedAssertion.iat ? decodedAssertion.exp - decodedAssertion.iat : 3600;\n\n await this.setSession({\n access_token: response.assertion,\n created_at: createdAt,\n expires_in: expiresIn,\n id_token: response.assertion,\n scope: decodedAssertion.scope,\n token_type: 'Bearer',\n });\n\n this.notifySignIn(extractUserClaimsFromIdToken(decodedAssertion as IdToken) as User);\n }\n\n return response;\n }\n\n return (await super.signIn(...args)) as unknown as User;\n });\n }\n\n override async signInSilently(options?: SignInOptions): Promise<User | boolean> {\n return super.signInSilently(options as Record<string, string | boolean>) as Promise<User | boolean>;\n }\n\n override async signUp(options?: SignUpOptions): Promise<void>;\n override async signUp(payload: any): Promise<any>;\n override async signUp(...args: any[]): Promise<void | any> {\n const config: ThunderIDReactConfig = (await this.getStorageManager().getConfigData()) as ThunderIDReactConfig;\n const firstArg: any = args[0];\n const baseUrl: string = config?.baseUrl ?? '';\n\n const authId: string = new URL(window.location.href).searchParams.get('authId') ?? '';\n\n const response: any = await executeEmbeddedSignUpFlow({\n authId,\n baseUrl,\n payload: typeof firstArg === 'object' && 'flowType' in firstArg ? {...firstArg, verbose: true} : firstArg,\n });\n\n if (\n response &&\n typeof response === 'object' &&\n response.flowStatus === EmbeddedSignUpFlowStatus.Complete &&\n response.assertion\n ) {\n const decodedAssertion: {\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n } = await this.decodeJwtToken<{\n [key: string]: unknown;\n exp?: number;\n iat?: number;\n scope?: string;\n }>(response.assertion);\n\n const createdAt: number = decodedAssertion.iat ? decodedAssertion.iat * 1000 : Date.now();\n const expiresIn: number =\n decodedAssertion.exp && decodedAssertion.iat ? decodedAssertion.exp - decodedAssertion.iat : 3600;\n\n await this.setSession({\n access_token: response.assertion,\n created_at: createdAt,\n expires_in: expiresIn,\n id_token: response.assertion,\n scope: decodedAssertion.scope,\n token_type: 'Bearer',\n });\n\n this.notifySignIn(extractUserClaimsFromIdToken(decodedAssertion as IdToken) as User);\n }\n\n return response;\n }\n\n override async recover(payload?: any): Promise<any> {\n const config: ThunderIDReactConfig = (await this.getStorageManager().getConfigData()) as ThunderIDReactConfig;\n\n return executeEmbeddedRecoveryFlow({\n baseUrl: config?.baseUrl,\n payload: {...payload, verbose: true},\n }) as any;\n }\n\n public override getStorageManager(): any {\n return super.getStorageManager();\n }\n\n async request(requestConfig?: HttpRequestConfig): Promise<HttpResponse<any>> {\n return super.httpRequest(requestConfig!) as Promise<HttpResponse<any>>;\n }\n\n async requestAll(requestConfigs?: HttpRequestConfig[]): Promise<HttpResponse<any>[]> {\n return super.httpRequestAll(requestConfigs!) as Promise<HttpResponse<any>[]>;\n }\n}\n\nexport default ThunderIDReactClient;\n"],"mappings":";;;;;AAyCA,IAAM,uBAAN,cAA0FA,2CAA0B;CAClH,AAAQ,eAAe;CAEvB,AAAQ;CAER,YAAY,aAAa,GAAG;AAC1B,QAAM,WAAW;;CAGnB,AAAQ,WAAW,SAAwB;AACzC,OAAK,eAAe;;CAGtB,MAAc,YAAqB,WAAqD;AACtF,OAAK,WAAW,KAAK;AACrB,MAAI;AAEF,UADwB,MAAM,WAAW;YAEjC;AACR,QAAK,WAAW,MAAM;;;CAI1B,AAAS,WAAW,QAAgD;AAClE,SAAO,KAAK,YAAY,YAAY;AAClC,QAAK,oBAAoB;IACvB,GAAG;IACH,sBACE,QAAQ,gBAAgB,cAAc,eAAgB,QAAgB;IACzE;AAED,UAAO,MAAM,WAAW,KAAK,kBAAkC;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,aAAa,YACpB,SAAS,eAAeC,6CAAyB,YACjD,SAAS,WACT;GACA,MAAMC,mBAKF,MAAM,KAAK,eAKZ,SAAS,UAAU;GAEtB,MAAMP,YAAoB,iBAAiB,MAAM,iBAAiB,MAAM,MAAO,KAAK,KAAK;GACzF,MAAMC,YACJ,iBAAiB,OAAO,iBAAiB,MAAM,iBAAiB,MAAM,iBAAiB,MAAM;AAE/F,SAAM,KAAK,WAAW;IACpB,cAAc,SAAS;IACvB,YAAY;IACZ,YAAY;IACZ,UAAU,SAAS;IACnB,OAAO,iBAAiB;IACxB,YAAY;IACb,CAAC;AAEF,QAAK,mEAA0C,iBAA4B,CAAS;;AAGtF,SAAO;;CAGT,MAAe,QAAQ,SAA6B;AAGlD,8DAAmC;GACjC,UAHoC,MAAM,KAAK,mBAAmB,CAAC,eAAe,GAGjE;GACjB,SAAS;IAAC,GAAG;IAAS,SAAS;IAAK;GACrC,CAAC;;CAGJ,AAAgB,oBAAyB;AACvC,SAAO,MAAM,mBAAmB;;CAGlC,MAAM,QAAQ,eAA+D;AAC3E,SAAO,MAAM,YAAY,cAAe;;CAG1C,MAAM,WAAW,gBAAoE;AACnF,SAAO,MAAM,eAAe,eAAgB;;;AAIhD,mCAAe"}
|
|
@@ -3,9 +3,9 @@ const require_ComponentRendererContext = require('../../../../contexts/Component
|
|
|
3
3
|
const require_useThunderID = require('../../../../contexts/ThunderID/useThunderID.cjs');
|
|
4
4
|
const require_useTheme = require('../../../../contexts/Theme/useTheme.cjs');
|
|
5
5
|
const require_useTranslation = require('../../../../hooks/useTranslation.cjs');
|
|
6
|
+
const require_flowTransformer = require('../../../../utils/flowTransformer.cjs');
|
|
6
7
|
const require_Spinner = require('../../../primitives/Spinner/Spinner.cjs');
|
|
7
8
|
const require_Button = require('../../../primitives/Button/Button.cjs');
|
|
8
|
-
const require_flowTransformer = require('../../../../utils/flowTransformer.cjs');
|
|
9
9
|
const require_Typography = require('../../../primitives/Typography/Typography.cjs');
|
|
10
10
|
const require_Alert = require('../../../primitives/Alert/Alert.cjs');
|
|
11
11
|
const require_Card = require('../../../primitives/Card/Card.cjs');
|
|
@@ -336,10 +336,43 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
336
336
|
}, key);
|
|
337
337
|
}
|
|
338
338
|
return null;
|
|
339
|
-
case __thunderid_browser.EmbeddedFlowComponentType.RichText:
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
339
|
+
case __thunderid_browser.EmbeddedFlowComponentType.RichText: {
|
|
340
|
+
const richTextAction = component.action;
|
|
341
|
+
const dispatchRichTextAction = () => {
|
|
342
|
+
if (!richTextAction || !options.onSubmit) return;
|
|
343
|
+
const eventTypeValue = String(richTextAction.eventType ?? __thunderid_browser.EmbeddedFlowEventType.Submit);
|
|
344
|
+
const shouldSkipValidation = eventTypeValue.toUpperCase() === String(__thunderid_browser.EmbeddedFlowEventType.Trigger);
|
|
345
|
+
const syntheticAction = {
|
|
346
|
+
eventType: eventTypeValue,
|
|
347
|
+
id: `${component.id}_action`,
|
|
348
|
+
ref: richTextAction.ref,
|
|
349
|
+
type: __thunderid_browser.EmbeddedFlowComponentType.Action
|
|
350
|
+
};
|
|
351
|
+
const formData = {};
|
|
352
|
+
Object.keys(formValues).forEach((field) => {
|
|
353
|
+
formData[field] = formValues[field];
|
|
354
|
+
});
|
|
355
|
+
options.onSubmit(syntheticAction, formData, shouldSkipValidation);
|
|
356
|
+
};
|
|
357
|
+
const isMatchingSentinelAnchor = (anchor) => anchor.getAttribute("data-action-ref") === richTextAction?.ref;
|
|
358
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
359
|
+
className: richTextClass,
|
|
360
|
+
onClick: richTextAction ? (event) => {
|
|
361
|
+
const anchor = event.target.closest("a");
|
|
362
|
+
if (!anchor || !isMatchingSentinelAnchor(anchor)) return;
|
|
363
|
+
event.preventDefault();
|
|
364
|
+
dispatchRichTextAction();
|
|
365
|
+
} : void 0,
|
|
366
|
+
onKeyDown: richTextAction ? (event) => {
|
|
367
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
368
|
+
const anchor = event.target.closest("a");
|
|
369
|
+
if (!anchor || !isMatchingSentinelAnchor(anchor)) return;
|
|
370
|
+
event.preventDefault();
|
|
371
|
+
dispatchRichTextAction();
|
|
372
|
+
} : void 0,
|
|
373
|
+
dangerouslySetInnerHTML: { __html: dompurify.default.sanitize((0, __thunderid_browser.resolveEmojiUrisInHtml)(resolve(component.label))) }
|
|
374
|
+
}, key);
|
|
375
|
+
}
|
|
343
376
|
case __thunderid_browser.EmbeddedFlowComponentType.Image: {
|
|
344
377
|
const explicitHeight = resolve(component.height?.toString());
|
|
345
378
|
const explicitWidth = resolve(component.width?.toString());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthOptionFactory.cjs","names":["logger: ReturnType<typeof createPackageComponentLogger>","richTextClass: string","EmbeddedFlowComponentType","FieldType","providerId: any","providerMatches: any","theme: any","customRenderers: ComponentRendererMap","key: string | number","customRenderer: ComponentRenderer | undefined","identifier: string","value: string","error: string","fieldType: string","createField","actionId: string","eventType: string","buttonText: string","componentVariant: string","shouldSkipValidation: boolean","EmbeddedFlowEventType","formData: Record<string, any>","consentPrompt: ConsentPromptData | undefined","isDeny: boolean","decisions: ConsentDecisions","getConsentOptionalKey","GoogleButton","GitHubButton","FacebookButton","MicrosoftButton","LinkedInButton","SignInWithEthereumButton","SmsOtpButton","startIconEl: ReactElement | null","endIconEl: ReactElement | null","Button","Typography","Divider","selectOptions: any","Select","DatePicker","formStyles: CSSProperties","blockComponents: any","DOMPurify","explicitHeight: string","explicitWidth: string","ImageComponent","iconName: string","IconComponent: any","flowIconRegistry","direction: string","gap: number","align: string","justify: string","consentPromptRawData: ConsentPromptData | string | undefined","Consent","textTemplate: string","timeoutMs: number","FlowTimer","sourceKey: string | undefined","CopyableText"],"sources":["../../../../../src/components/presentation/auth/AuthOptionFactory.tsx"],"sourcesContent":["/**\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 {css} from '@emotion/css';\nimport {\n FieldType,\n FlowMetadataResponse,\n EmbeddedFlowComponent,\n EmbeddedFlowComponentType,\n EmbeddedFlowTextVariant,\n EmbeddedFlowEventType,\n createPackageComponentLogger,\n resolveFlowTemplateLiterals,\n resolveEmojiUrisInHtml,\n ConsentPurposeData,\n ConsentPromptData,\n ConsentDecisions,\n ConsentPurposeDecision,\n ConsentAttributeElement,\n OrganizationUnitListResponse,\n} from '@thunderid/browser';\nimport DOMPurify from 'dompurify';\nimport {cloneElement, CSSProperties, ReactElement} from 'react';\nimport {\n ComponentRenderer,\n ComponentRenderContext,\n ComponentRendererMap,\n} from '../../../contexts/ComponentRenderer/ComponentRendererContext';\nimport {UseTranslation} from '../../../hooks/useTranslation';\nimport Consent from '../../adapters/Consent';\nimport {getConsentOptionalKey} from '../../adapters/ConsentCheckboxList';\nimport FacebookButton from '../../adapters/FacebookButton';\nimport FlowTimer from '../../adapters/FlowTimer';\nimport GitHubButton from '../../adapters/GitHubButton';\nimport GoogleButton from '../../adapters/GoogleButton';\nimport ImageComponent from '../../adapters/ImageComponent';\nimport LinkedInButton from '../../adapters/LinkedInButton';\nimport MicrosoftButton from '../../adapters/MicrosoftButton';\nimport SignInWithEthereumButton from '../../adapters/SignInWithEthereumButton';\nimport SmsOtpButton from '../../adapters/SmsOtpButton';\nimport {createField} from '../../factories/FieldFactory';\nimport Button from '../../primitives/Button/Button';\nimport CopyableText from '../../primitives/CopyableText/CopyableText';\nimport DatePicker from '../../primitives/DatePicker/DatePicker';\nimport Divider from '../../primitives/Divider/Divider';\nimport flowIconRegistry from '../../primitives/Icons/flowIconRegistry';\nimport Select from '../../primitives/Select/Select';\nimport Typography from '../../primitives/Typography/Typography';\nimport {TypographyVariant} from '../../primitives/Typography/Typography.styles';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/react',\n 'AuthOptionFactory',\n);\n\n/**\n * Replaces `emoji:` URIs embedded in HTML before DOMPurify sanitization.\n *\n * DOMPurify strips unknown URI schemes from attributes (e.g. `src=\"emoji:🦊\"` → `src=\"\"`).\n * This function converts:\n * - `<img src=\"emoji:X\" alt=\"Y\">` → `<span role=\"img\" aria-label=\"Y\">X</span>`\n * - Any remaining `emoji:X` text occurrences → `X`\n */\n\n/** Ensures rich-text content (including all inner elements from the server) always word-wraps. */\nconst richTextClass: string = css`\n overflow-wrap: anywhere;\n & * {\n overflow-wrap: anywhere;\n word-break: break-word;\n }\n & .rich-text-align-left {\n text-align: left;\n }\n & .rich-text-align-center {\n text-align: center;\n }\n & .rich-text-align-right {\n text-align: right;\n }\n & .rich-text-align-justify {\n text-align: justify;\n }\n & a,\n & .rich-text-link {\n text-decoration: underline;\n }\n & span[role='img'] {\n display: inline-block;\n }\n`;\n\nexport type AuthType = 'signin' | 'signup' | 'recovery';\n\n/**\n * Get the appropriate FieldType for an input component.\n */\nconst getFieldType = (variant: EmbeddedFlowComponentType): FieldType => {\n switch (variant) {\n case EmbeddedFlowComponentType.EmailInput:\n return FieldType.Email;\n case EmbeddedFlowComponentType.PhoneInput:\n return FieldType.Tel;\n case EmbeddedFlowComponentType.PasswordInput:\n return FieldType.Password;\n case EmbeddedFlowComponentType.TextInput:\n default:\n return FieldType.Text;\n }\n};\n\n/**\n * Get typography variant from component variant.\n */\nconst getTypographyVariant = (variant: string): any => {\n const variantMap: Record<EmbeddedFlowTextVariant, TypographyVariant> = {\n BODY_1: 'body1',\n BODY_2: 'body2',\n BUTTON_TEXT: 'button',\n CAPTION: 'caption',\n HEADING_1: 'h1',\n HEADING_2: 'h2',\n HEADING_3: 'h3',\n HEADING_4: 'h4',\n HEADING_5: 'h5',\n HEADING_6: 'h6',\n OVERLINE: 'overline',\n SUBTITLE_1: 'subtitle1',\n SUBTITLE_2: 'subtitle2',\n };\n\n return variantMap[variant] || 'h3';\n};\n\n/**\n * Check if a button text or action matches a social provider.\n */\nconst matchesSocialProvider = (\n actionId: string,\n eventType: string,\n buttonText: string,\n provider: string,\n authType: AuthType,\n /* eslint-disable-next-line @typescript-eslint/no-unused-vars */\n _componentVariant?: string,\n): boolean => {\n const providerId: any = `${provider}_auth`;\n const providerMatches: any = actionId === providerId || eventType === providerId;\n\n // Social buttons usually have \"Sign in with X\" or \"Continue with X\" text,\n // so also check button text for the provider name to increase chances of correct detection (especially for signup flows where action IDs are less standardized)\n if (buttonText.toLowerCase().includes(provider)) {\n return true;\n }\n\n // For signup, also check button text\n if (authType === 'signup') {\n return providerMatches || buttonText.toLowerCase().includes(provider);\n }\n\n return providerMatches;\n};\n\n/**\n * Create an auth component from flow component configuration.\n */\nconst createAuthComponentFromFlow = (\n component: EmbeddedFlowComponent,\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n onInputChange: (name: string, value: string) => void,\n authType: AuthType,\n options: {\n /** @internal Passed from the host React component so hooks aren't called inside a loop. */\n _customRenderers?: ComponentRendererMap;\n /** @internal Passed from the host React component so hooks aren't called inside a loop. */\n _theme?: any;\n /** Additional data from the flow response, used for different dynamic data */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n /** Current consent purpose being rendered. Set by CONSENT_PURPOSE block iteration. */\n currentConsentPurpose?: ConsentPurposeData;\n inStack?: boolean;\n inputClassName?: string;\n /** Flag to determine if the step timeline has expired */\n isTimeoutDisabled?: boolean;\n key?: string | number;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n } = {},\n): ReactElement | null => {\n const theme: any = options._theme;\n const customRenderers: ComponentRendererMap = options._customRenderers ?? {};\n\n const key: string | number = options.key || component.id;\n\n const customRenderer: ComponentRenderer | undefined =\n customRenderers[component.id] ?? customRenderers[component.type];\n if (customRenderer) {\n const renderCtx: ComponentRenderContext = {\n additionalData: options.additionalData,\n authType,\n formErrors,\n formValues,\n isFormValid,\n isLoading,\n meta: options.meta,\n onInputBlur: options.onInputBlur,\n onInputChange,\n onSubmit: options.onSubmit,\n touchedFields,\n };\n return customRenderer(component, renderCtx);\n }\n\n /** Resolve any remaining {{t()}} or {{meta()}} template expressions in a string at render time. */\n const resolve = (text: string | undefined): string => {\n if (!text || (!options.t && !options.meta)) {\n return text || '';\n }\n return resolveFlowTemplateLiterals(text, {meta: options.meta, t: options.t || ((k: string): string => k)});\n };\n\n switch (component.type) {\n case EmbeddedFlowComponentType.TextInput:\n case EmbeddedFlowComponentType.PasswordInput:\n case EmbeddedFlowComponentType.EmailInput:\n case EmbeddedFlowComponentType.PhoneInput: {\n const identifier: string = component.ref!;\n const value: string = formValues[identifier] || '';\n const isTouched: boolean = touchedFields[identifier] || false;\n const error: string = isTouched ? formErrors[identifier] : undefined!;\n const fieldType: string = getFieldType(component.type);\n\n const field: any = createField({\n className: options.inputClassName,\n error,\n label: resolve(component.label) || '',\n name: identifier,\n onBlur: () => options.onInputBlur?.(identifier),\n onChange: (newValue: string) => onInputChange(identifier, newValue),\n placeholder: resolve(component.placeholder) || '',\n required: component.required || false,\n type: fieldType as FieldType,\n value,\n });\n\n return cloneElement(field, {key});\n }\n\n case EmbeddedFlowComponentType.OtpInput: {\n const identifier: string = component.ref!;\n const value: string = formValues[identifier] || '';\n const isTouched: boolean = touchedFields[identifier] || false;\n const error: string = isTouched ? formErrors[identifier] : undefined!;\n\n const field: any = createField({\n className: options.inputClassName,\n error,\n label: resolve(component.label) || '',\n name: identifier,\n onBlur: () => options.onInputBlur?.(identifier),\n onChange: (newValue: string) => onInputChange(identifier, newValue),\n placeholder: resolve(component.placeholder) || '',\n required: component.required || false,\n type: FieldType.Otp,\n value,\n });\n\n return cloneElement(field, {key});\n }\n\n case EmbeddedFlowComponentType.Action: {\n const actionId: string = component.id;\n const eventType: string = component.eventType || '';\n const buttonText: string = resolve(component.label);\n const componentVariant: string = component.variant || '';\n\n // Only validate on submit type events.\n const shouldSkipValidation: boolean = eventType.toUpperCase() === EmbeddedFlowEventType.Trigger;\n\n const handleClick = (): any => {\n if (options.onSubmit) {\n const formData: Record<string, any> = {};\n Object.keys(formValues).forEach((field: any) => {\n // Include all values, even empty strings, to ensure proper submission\n formData[field] = formValues[field];\n });\n\n // For consent actions, build the consent_decisions JSON from the form values.\n // The allow action captures per-attribute choices; the deny action sends\n // all purposes as rejected so the backend ConsentExecutor can fail the flow.\n const consentPrompt: ConsentPromptData | undefined = options.additionalData?.['consentPrompt'] as\n | ConsentPromptData\n | undefined;\n if (consentPrompt && eventType.toUpperCase() === EmbeddedFlowEventType.Submit) {\n const isDeny: boolean = componentVariant.toLowerCase() !== 'primary';\n const decisions: ConsentDecisions = {\n purposes: consentPrompt.purposes.map(\n (p: ConsentPurposeData): ConsentPurposeDecision => ({\n approved: !isDeny,\n elements: [\n ...p.essential.map((e): ConsentAttributeElement => ({approved: !isDeny, name: e.name})),\n ...p.optional.map(\n (e): ConsentAttributeElement => ({\n approved: isDeny ? false : formValues[getConsentOptionalKey(p.purposeId, e.name)] !== 'false',\n name: e.name,\n }),\n ),\n ],\n purposeName: p.purposeName!,\n }),\n ),\n };\n formData['consent_decisions'] = JSON.stringify(decisions);\n }\n\n options.onSubmit(component, formData, shouldSkipValidation);\n }\n };\n\n // Render branded social login buttons for known action IDs\n\n if (matchesSocialProvider(actionId, eventType, buttonText, 'google', authType, componentVariant)) {\n return <GoogleButton key={key} onClick={handleClick} className={options.buttonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'github', authType, componentVariant)) {\n return <GitHubButton key={key} onClick={handleClick} className={options.buttonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'facebook', authType, componentVariant)) {\n return <FacebookButton key={key} onClick={handleClick} className={options.buttonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'microsoft', authType, componentVariant)) {\n return <MicrosoftButton key={key} onClick={handleClick} className={options.buttonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'linkedin', authType, componentVariant)) {\n return <LinkedInButton key={key} onClick={handleClick} className={options.buttonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'ethereum', authType, componentVariant)) {\n return <SignInWithEthereumButton key={key} onClick={handleClick} className={options.buttonClassName} />;\n }\n if (actionId === 'prompt_mobile' || eventType === 'prompt_mobile') {\n return <SmsOtpButton key={key} onClick={handleClick} className={options.buttonClassName} />;\n }\n\n const startIconEl: ReactElement | null = component.startIcon ? (\n <img\n src={component.startIcon}\n alt=\"\"\n aria-hidden=\"true\"\n style={{height: '1.25em', objectFit: 'contain', width: '1.25em'}}\n />\n ) : null;\n\n const endIconEl: ReactElement | null = component.endIcon ? (\n <img\n src={component.endIcon}\n alt=\"\"\n aria-hidden=\"true\"\n style={{height: '1.25em', objectFit: 'contain', width: '1.25em'}}\n />\n ) : null;\n\n return (\n <Button\n fullWidth\n key={key}\n onClick={handleClick}\n disabled={\n isLoading ||\n (!isFormValid && !shouldSkipValidation) ||\n options.isTimeoutDisabled ||\n (component as any).config?.disabled\n }\n className={options.buttonClassName}\n data-testid=\"thunderid-signin-submit\"\n variant={component.variant?.toLowerCase() === 'primary' ? 'solid' : 'outline'}\n color={component.variant?.toLowerCase() === 'primary' ? 'primary' : 'secondary'}\n startIcon={startIconEl}\n endIcon={endIconEl}\n >\n {buttonText || 'Submit'}\n </Button>\n );\n }\n\n case EmbeddedFlowComponentType.Text: {\n const variant: any = getTypographyVariant(component.variant!);\n return (\n <Typography\n key={key}\n variant={variant}\n style={{\n marginBottom: 2,\n textAlign:\n typeof component?.align === 'string' ? (component.align as React.CSSProperties['textAlign']) : 'left',\n }}\n >\n {resolve(component.label)}\n </Typography>\n );\n }\n\n case EmbeddedFlowComponentType.Divider: {\n return <Divider key={key}>{resolve(component.label) || ''}</Divider>;\n }\n\n case EmbeddedFlowComponentType.Select: {\n const identifier: string = component.ref!;\n const value: string = formValues[identifier] || '';\n const isTouched: boolean = touchedFields[identifier] || false;\n const error: string = isTouched ? formErrors[identifier] : undefined!;\n\n // Options are pre-sanitized by flowTransformer to {value: string, label: string} format\n const selectOptions: any = (component.options || []).map((opt: any) => ({\n label: typeof opt === 'string' ? opt : String(opt.label ?? opt.value ?? ''),\n value: typeof opt === 'string' ? opt : String(opt.value ?? ''),\n }));\n\n return (\n <Select\n key={key}\n name={identifier}\n label={resolve(component.label) || ''}\n placeholder={resolve(component.placeholder)}\n required={component.required}\n options={selectOptions}\n value={value}\n error={error}\n onChange={(e: any): void => onInputChange(identifier, e.target.value)}\n onBlur={(): any => options.onInputBlur?.(identifier)}\n className={options.inputClassName}\n />\n );\n }\n\n case EmbeddedFlowComponentType.DateInput: {\n const identifier: string = component.ref!;\n const value: string = formValues[identifier] || '';\n const isTouched: boolean = touchedFields[identifier] || false;\n const error: string = isTouched ? formErrors[identifier] : undefined!;\n\n return (\n <DatePicker\n key={key}\n name={identifier}\n label={resolve(component.label) || ''}\n placeholder={resolve(component.placeholder)}\n required={component.required}\n dateFormat={component.dateFormat}\n value={value}\n error={error}\n onChange={(e: any): void => onInputChange(identifier, e.target.value)}\n onBlur={(): any => options.onInputBlur?.(identifier)}\n className={options.inputClassName}\n />\n );\n }\n\n case EmbeddedFlowComponentType.OuSelect: {\n logger.warn('OU_SELECT component type is not supported. Skipping render.');\n return null;\n }\n\n case EmbeddedFlowComponentType.Block: {\n if (component.components && component.components.length > 0) {\n const formStyles: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n gap: `calc(${theme?.vars?.spacing?.unit ?? '4px'} * 2)`,\n };\n\n const blockComponents: any = component.components\n .map((childComponent: any, index: any) =>\n createAuthComponentFromFlow(\n childComponent,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n onInputChange,\n authType,\n {\n ...options,\n key: childComponent.id || `${component.id}_${index}`,\n },\n ),\n )\n .filter(Boolean);\n\n return (\n <form id={component.id} key={key} style={formStyles}>\n {blockComponents}\n </form>\n );\n }\n return null;\n }\n\n case EmbeddedFlowComponentType.RichText: {\n return (\n <div\n key={key}\n className={richTextClass}\n // Manually sanitizes with `DOMPurify`.\n // IMPORTANT: DO NOT REMOVE OR MODIFY THIS SANITIZATION STEP.\n dangerouslySetInnerHTML={{__html: DOMPurify.sanitize(resolveEmojiUrisInHtml(resolve(component.label)))}}\n />\n );\n }\n\n case EmbeddedFlowComponentType.Image: {\n const explicitHeight: string = resolve(component.height?.toString());\n const explicitWidth: string = resolve(component.width?.toString());\n return (\n <ImageComponent\n key={key}\n component={\n {\n config: {\n alt: resolve(component.alt) || resolve(component.label) || 'Image',\n height: explicitHeight || (options.inStack ? '50' : 'auto'),\n src: resolve(component.src),\n width: explicitWidth || (options.inStack ? '50' : '100%'),\n },\n } as any\n }\n formErrors={undefined!}\n formValues={undefined!}\n isFormValid={false}\n isLoading={false}\n onInputChange={(): void => {\n throw new Error('Function not implemented.');\n }}\n touchedFields={undefined!}\n />\n );\n }\n\n case EmbeddedFlowComponentType.Icon: {\n const iconName: string = component.name || '';\n const IconComponent: any = flowIconRegistry[iconName];\n if (!IconComponent) {\n logger.warn(`Unknown icon name: \"${iconName}\". Skipping render.`);\n return null;\n }\n return <IconComponent key={key} size={component.size || 24} color={component.color || 'currentColor'} />;\n }\n\n case EmbeddedFlowComponentType.Stack: {\n const direction: string = (component as any).direction || 'row';\n const gap: number = (component as any).gap ?? 2;\n const align: string = (component as any).align || 'center';\n const justify: string = (component as any).justify || 'flex-start';\n\n const stackStyle: CSSProperties = {\n alignItems: align,\n display: 'flex',\n flexDirection: direction as CSSProperties['flexDirection'],\n flexWrap: 'wrap',\n gap: `${gap * 0.5}rem`,\n justifyContent: justify,\n };\n\n const stackChildren: (ReactElement | null)[] = component.components\n ? component.components.map((childComponent: any, index: number) =>\n createAuthComponentFromFlow(\n childComponent,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n onInputChange,\n authType,\n {\n ...options,\n inStack: true,\n key: childComponent.id || `${component.id}_${index}`,\n },\n ),\n )\n : [];\n\n return (\n <div key={key} style={stackStyle}>\n {stackChildren}\n </div>\n );\n }\n\n case EmbeddedFlowComponentType.Consent: {\n const consentPromptRawData: ConsentPromptData | string | undefined = options.additionalData?.['consentPrompt'];\n\n return (\n <Consent\n key={key}\n consentData={consentPromptRawData as any}\n formValues={formValues}\n onInputChange={onInputChange}\n />\n );\n }\n\n case EmbeddedFlowComponentType.Timer: {\n const textTemplate: string = resolve((component as any).label) || 'Time remaining: {time}';\n const timeoutMs: number = Number(options.additionalData?.['stepTimeout']) || 0;\n const expiresIn: number = timeoutMs > 0 ? Math.max(0, Math.floor((timeoutMs - Date.now()) / 1000)) : 0;\n\n return <FlowTimer key={key} expiresIn={expiresIn} textTemplate={textTemplate} />;\n }\n\n case EmbeddedFlowComponentType.CopyableText: {\n const sourceKey: string | undefined = (component as any).source;\n const value: string = sourceKey && options.additionalData ? String(options.additionalData[sourceKey] ?? '') : '';\n const labelText: string | undefined = resolve((component as any).label) || undefined;\n\n return <CopyableText key={key} label={labelText} value={value} />;\n }\n\n default:\n // Gracefully handle unsupported component types by returning null\n logger.warn(`Unsupported component type: ${component.type}. Skipping render.`);\n return null;\n }\n};\n\n/**\n * Processes an array of components and renders them as React elements for sign-in.\n */\nexport const renderSignInComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n onInputChange: (name: string, value: string) => void,\n options?: {\n /** @internal */\n _customRenderers?: ComponentRendererMap;\n /** @internal */\n _theme?: any;\n /** Additional data from the flow response */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n inputClassName?: string;\n /** Flag to determine if the step timeline has expired */\n isTimeoutDisabled?: boolean;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createAuthComponentFromFlow(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n onInputChange,\n 'signin',\n {\n ...options,\n key: component.id || index,\n },\n ),\n )\n .filter((x): x is ReactElement => x !== null);\n\n/**\n * Processes an array of components and renders them as React elements for sign-up.\n */\nexport const renderSignUpComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n onInputChange: (name: string, value: string) => void,\n options?: {\n /** @internal */\n _customRenderers?: ComponentRendererMap;\n /** @internal */\n _theme?: any;\n /** Additional data from the flow response */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n inputClassName?: string;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createAuthComponentFromFlow(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n onInputChange,\n 'signup',\n {\n ...options,\n key: component.id || index,\n },\n ),\n )\n .filter((x): x is ReactElement => x !== null);\n\n/**\n * Processes an array of components and renders them as React elements for recovery flow.\n */\nexport const renderRecoveryComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n onInputChange: (name: string, value: string) => void,\n options?: {\n /** @internal */\n _customRenderers?: ComponentRendererMap;\n /** @internal */\n _theme?: any;\n /** Additional data from the flow response */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n inputClassName?: string;\n /** Flag to determine if the step timeline has expired */\n isTimeoutDisabled?: boolean;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createAuthComponentFromFlow(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n onInputChange,\n 'recovery',\n {\n ...options,\n key: component.id || index,\n },\n ),\n )\n .filter((x): x is ReactElement => x !== null);\n\n/**\n * Processes an array of components and renders them as React elements for invite user.\n * This is used by both InviteUser and AcceptInvite components.\n */\nexport const renderInviteUserComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n onInputChange: (name: string, value: string) => void,\n options?: {\n /** @internal */\n _customRenderers?: ComponentRendererMap;\n /** @internal */\n _theme?: any;\n /** Additional data from the flow response */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n /** Function to fetch child organization units for OU_SELECT components. */\n fetchOrganizationUnitChildren?: (\n parentId: string,\n limit: number,\n offset: number,\n ) => Promise<OrganizationUnitListResponse>;\n inputClassName?: string;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createAuthComponentFromFlow(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n onInputChange,\n 'signup',\n {\n ...options,\n key: component.id || index,\n },\n ),\n )\n .filter((x): x is ReactElement => x !== null);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,MAAMA,+DACJ,oBACA,oBACD;;;;;;;;;;AAYD,MAAMC,gBAAwB,iBAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCjC,MAAM,gBAAgB,YAAkD;AACtE,SAAQ,SAAR;EACE,KAAKC,8CAA0B,WAC7B,QAAOC,8BAAU;EACnB,KAAKD,8CAA0B,WAC7B,QAAOC,8BAAU;EACnB,KAAKD,8CAA0B,cAC7B,QAAOC,8BAAU;EACnB,KAAKD,8CAA0B;EAC/B,QACE,QAAOC,8BAAU;;;;;;AAOvB,MAAM,wBAAwB,YAAyB;AAiBrD,QAhBuE;EACrE,QAAQ;EACR,QAAQ;EACR,aAAa;EACb,SAAS;EACT,WAAW;EACX,WAAW;EACX,WAAW;EACX,WAAW;EACX,WAAW;EACX,WAAW;EACX,UAAU;EACV,YAAY;EACZ,YAAY;EACb,CAEiB,YAAY;;;;;AAMhC,MAAM,yBACJ,UACA,WACA,YACA,UACA,UAEA,sBACY;CACZ,MAAMC,aAA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tB,CACF,CACF,CACA,QAAQ,MAAyB,MAAM,KAAK;;;;;AAMjD,MAAa,8BACX,YACA,YACA,eACA,YACA,WACA,aACA,eACA,YAyBA,WACG,KAAK,WAAgB,UACpB,4BACE,WACA,YACA,eACA,YACA,WACA,aACA,eACA,UACA;CACE,GAAG;CACH,KAAK,UAAU,MAAM;CACtB,CACF,CACF,CACA,QAAQ,MAAyB,MAAM,KAAK"}
|
|
1
|
+
{"version":3,"file":"AuthOptionFactory.cjs","names":["logger: ReturnType<typeof createPackageComponentLogger>","richTextClass: string","EmbeddedFlowComponentType","FieldType","providerId: any","providerMatches: any","theme: any","customRenderers: ComponentRendererMap","key: string | number","customRenderer: ComponentRenderer | undefined","identifier: string","value: string","error: string","fieldType: string","createField","actionId: string","eventType: string","buttonText: string","componentVariant: string","shouldSkipValidation: boolean","EmbeddedFlowEventType","formData: Record<string, any>","consentPrompt: ConsentPromptData | undefined","isDeny: boolean","decisions: ConsentDecisions","getConsentOptionalKey","GoogleButton","GitHubButton","FacebookButton","MicrosoftButton","LinkedInButton","SignInWithEthereumButton","SmsOtpButton","startIconEl: ReactElement | null","endIconEl: ReactElement | null","Button","Typography","Divider","selectOptions: any","Select","DatePicker","formStyles: CSSProperties","blockComponents: any","richTextAction: EmbeddedFlowComponentAction | undefined","syntheticAction: EmbeddedFlowComponent","formData: Record<string, string>","anchor: HTMLAnchorElement | null","DOMPurify","explicitHeight: string","explicitWidth: string","ImageComponent","iconName: string","IconComponent: any","flowIconRegistry","direction: string","gap: number","align: string","justify: string","consentPromptRawData: ConsentPromptData | string | undefined","Consent","textTemplate: string","timeoutMs: number","FlowTimer","sourceKey: string | undefined","CopyableText"],"sources":["../../../../../src/components/presentation/auth/AuthOptionFactory.tsx"],"sourcesContent":["/**\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 {css} from '@emotion/css';\nimport {\n FieldType,\n FlowMetadataResponse,\n EmbeddedFlowComponent,\n EmbeddedFlowComponentAction,\n EmbeddedFlowComponentType,\n EmbeddedFlowTextVariant,\n EmbeddedFlowEventType,\n createPackageComponentLogger,\n resolveFlowTemplateLiterals,\n resolveEmojiUrisInHtml,\n ConsentPurposeData,\n ConsentPromptData,\n ConsentDecisions,\n ConsentPurposeDecision,\n ConsentAttributeElement,\n OrganizationUnitListResponse,\n} from '@thunderid/browser';\nimport DOMPurify from 'dompurify';\nimport {cloneElement, CSSProperties, ReactElement} from 'react';\nimport {\n ComponentRenderer,\n ComponentRenderContext,\n ComponentRendererMap,\n} from '../../../contexts/ComponentRenderer/ComponentRendererContext';\nimport {UseTranslation} from '../../../hooks/useTranslation';\nimport Consent from '../../adapters/Consent';\nimport {getConsentOptionalKey} from '../../adapters/ConsentCheckboxList';\nimport FacebookButton from '../../adapters/FacebookButton';\nimport FlowTimer from '../../adapters/FlowTimer';\nimport GitHubButton from '../../adapters/GitHubButton';\nimport GoogleButton from '../../adapters/GoogleButton';\nimport ImageComponent from '../../adapters/ImageComponent';\nimport LinkedInButton from '../../adapters/LinkedInButton';\nimport MicrosoftButton from '../../adapters/MicrosoftButton';\nimport SignInWithEthereumButton from '../../adapters/SignInWithEthereumButton';\nimport SmsOtpButton from '../../adapters/SmsOtpButton';\nimport {createField} from '../../factories/FieldFactory';\nimport Button from '../../primitives/Button/Button';\nimport CopyableText from '../../primitives/CopyableText/CopyableText';\nimport DatePicker from '../../primitives/DatePicker/DatePicker';\nimport Divider from '../../primitives/Divider/Divider';\nimport flowIconRegistry from '../../primitives/Icons/flowIconRegistry';\nimport Select from '../../primitives/Select/Select';\nimport Typography from '../../primitives/Typography/Typography';\nimport {TypographyVariant} from '../../primitives/Typography/Typography.styles';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/react',\n 'AuthOptionFactory',\n);\n\n/**\n * Replaces `emoji:` URIs embedded in HTML before DOMPurify sanitization.\n *\n * DOMPurify strips unknown URI schemes from attributes (e.g. `src=\"emoji:🦊\"` → `src=\"\"`).\n * This function converts:\n * - `<img src=\"emoji:X\" alt=\"Y\">` → `<span role=\"img\" aria-label=\"Y\">X</span>`\n * - Any remaining `emoji:X` text occurrences → `X`\n */\n\n/** Ensures rich-text content (including all inner elements from the server) always word-wraps. */\nconst richTextClass: string = css`\n overflow-wrap: anywhere;\n & * {\n overflow-wrap: anywhere;\n word-break: break-word;\n }\n & .rich-text-align-left {\n text-align: left;\n }\n & .rich-text-align-center {\n text-align: center;\n }\n & .rich-text-align-right {\n text-align: right;\n }\n & .rich-text-align-justify {\n text-align: justify;\n }\n & a,\n & .rich-text-link {\n text-decoration: underline;\n }\n & span[role='img'] {\n display: inline-block;\n }\n`;\n\nexport type AuthType = 'signin' | 'signup' | 'recovery';\n\n/**\n * Get the appropriate FieldType for an input component.\n */\nconst getFieldType = (variant: EmbeddedFlowComponentType): FieldType => {\n switch (variant) {\n case EmbeddedFlowComponentType.EmailInput:\n return FieldType.Email;\n case EmbeddedFlowComponentType.PhoneInput:\n return FieldType.Tel;\n case EmbeddedFlowComponentType.PasswordInput:\n return FieldType.Password;\n case EmbeddedFlowComponentType.TextInput:\n default:\n return FieldType.Text;\n }\n};\n\n/**\n * Get typography variant from component variant.\n */\nconst getTypographyVariant = (variant: string): any => {\n const variantMap: Record<EmbeddedFlowTextVariant, TypographyVariant> = {\n BODY_1: 'body1',\n BODY_2: 'body2',\n BUTTON_TEXT: 'button',\n CAPTION: 'caption',\n HEADING_1: 'h1',\n HEADING_2: 'h2',\n HEADING_3: 'h3',\n HEADING_4: 'h4',\n HEADING_5: 'h5',\n HEADING_6: 'h6',\n OVERLINE: 'overline',\n SUBTITLE_1: 'subtitle1',\n SUBTITLE_2: 'subtitle2',\n };\n\n return variantMap[variant] || 'h3';\n};\n\n/**\n * Check if a button text or action matches a social provider.\n */\nconst matchesSocialProvider = (\n actionId: string,\n eventType: string,\n buttonText: string,\n provider: string,\n authType: AuthType,\n /* eslint-disable-next-line @typescript-eslint/no-unused-vars */\n _componentVariant?: string,\n): boolean => {\n const providerId: any = `${provider}_auth`;\n const providerMatches: any = actionId === providerId || eventType === providerId;\n\n // Social buttons usually have \"Sign in with X\" or \"Continue with X\" text,\n // so also check button text for the provider name to increase chances of correct detection (especially for signup flows where action IDs are less standardized)\n if (buttonText.toLowerCase().includes(provider)) {\n return true;\n }\n\n // For signup, also check button text\n if (authType === 'signup') {\n return providerMatches || buttonText.toLowerCase().includes(provider);\n }\n\n return providerMatches;\n};\n\n/**\n * Create an auth component from flow component configuration.\n */\nconst createAuthComponentFromFlow = (\n component: EmbeddedFlowComponent,\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n onInputChange: (name: string, value: string) => void,\n authType: AuthType,\n options: {\n /** @internal Passed from the host React component so hooks aren't called inside a loop. */\n _customRenderers?: ComponentRendererMap;\n /** @internal Passed from the host React component so hooks aren't called inside a loop. */\n _theme?: any;\n /** Additional data from the flow response, used for different dynamic data */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n /** Current consent purpose being rendered. Set by CONSENT_PURPOSE block iteration. */\n currentConsentPurpose?: ConsentPurposeData;\n inStack?: boolean;\n inputClassName?: string;\n /** Flag to determine if the step timeline has expired */\n isTimeoutDisabled?: boolean;\n key?: string | number;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n } = {},\n): ReactElement | null => {\n const theme: any = options._theme;\n const customRenderers: ComponentRendererMap = options._customRenderers ?? {};\n\n const key: string | number = options.key || component.id;\n\n const customRenderer: ComponentRenderer | undefined =\n customRenderers[component.id] ?? customRenderers[component.type];\n if (customRenderer) {\n const renderCtx: ComponentRenderContext = {\n additionalData: options.additionalData,\n authType,\n formErrors,\n formValues,\n isFormValid,\n isLoading,\n meta: options.meta,\n onInputBlur: options.onInputBlur,\n onInputChange,\n onSubmit: options.onSubmit,\n touchedFields,\n };\n return customRenderer(component, renderCtx);\n }\n\n /** Resolve any remaining {{t()}} or {{meta()}} template expressions in a string at render time. */\n const resolve = (text: string | undefined): string => {\n if (!text || (!options.t && !options.meta)) {\n return text || '';\n }\n return resolveFlowTemplateLiterals(text, {meta: options.meta, t: options.t || ((k: string): string => k)});\n };\n\n switch (component.type) {\n case EmbeddedFlowComponentType.TextInput:\n case EmbeddedFlowComponentType.PasswordInput:\n case EmbeddedFlowComponentType.EmailInput:\n case EmbeddedFlowComponentType.PhoneInput: {\n const identifier: string = component.ref!;\n const value: string = formValues[identifier] || '';\n const isTouched: boolean = touchedFields[identifier] || false;\n const error: string = isTouched ? formErrors[identifier] : undefined!;\n const fieldType: string = getFieldType(component.type);\n\n const field: any = createField({\n className: options.inputClassName,\n error,\n label: resolve(component.label) || '',\n name: identifier,\n onBlur: () => options.onInputBlur?.(identifier),\n onChange: (newValue: string) => onInputChange(identifier, newValue),\n placeholder: resolve(component.placeholder) || '',\n required: component.required || false,\n type: fieldType as FieldType,\n value,\n });\n\n return cloneElement(field, {key});\n }\n\n case EmbeddedFlowComponentType.OtpInput: {\n const identifier: string = component.ref!;\n const value: string = formValues[identifier] || '';\n const isTouched: boolean = touchedFields[identifier] || false;\n const error: string = isTouched ? formErrors[identifier] : undefined!;\n\n const field: any = createField({\n className: options.inputClassName,\n error,\n label: resolve(component.label) || '',\n name: identifier,\n onBlur: () => options.onInputBlur?.(identifier),\n onChange: (newValue: string) => onInputChange(identifier, newValue),\n placeholder: resolve(component.placeholder) || '',\n required: component.required || false,\n type: FieldType.Otp,\n value,\n });\n\n return cloneElement(field, {key});\n }\n\n case EmbeddedFlowComponentType.Action: {\n const actionId: string = component.id;\n const eventType: string = component.eventType || '';\n const buttonText: string = resolve(component.label);\n const componentVariant: string = component.variant || '';\n\n // Only validate on submit type events.\n const shouldSkipValidation: boolean = eventType.toUpperCase() === EmbeddedFlowEventType.Trigger;\n\n const handleClick = (): any => {\n if (options.onSubmit) {\n const formData: Record<string, any> = {};\n Object.keys(formValues).forEach((field: any) => {\n // Include all values, even empty strings, to ensure proper submission\n formData[field] = formValues[field];\n });\n\n // For consent actions, build the consent_decisions JSON from the form values.\n // The allow action captures per-attribute choices; the deny action sends\n // all purposes as rejected so the backend ConsentExecutor can fail the flow.\n const consentPrompt: ConsentPromptData | undefined = options.additionalData?.['consentPrompt'] as\n | ConsentPromptData\n | undefined;\n if (consentPrompt && eventType.toUpperCase() === EmbeddedFlowEventType.Submit) {\n const isDeny: boolean = componentVariant.toLowerCase() !== 'primary';\n const decisions: ConsentDecisions = {\n purposes: consentPrompt.purposes.map(\n (p: ConsentPurposeData): ConsentPurposeDecision => ({\n approved: !isDeny,\n elements: [\n ...p.essential.map((e): ConsentAttributeElement => ({approved: !isDeny, name: e.name})),\n ...p.optional.map(\n (e): ConsentAttributeElement => ({\n approved: isDeny ? false : formValues[getConsentOptionalKey(p.purposeId, e.name)] !== 'false',\n name: e.name,\n }),\n ),\n ],\n purposeName: p.purposeName!,\n }),\n ),\n };\n formData['consent_decisions'] = JSON.stringify(decisions);\n }\n\n options.onSubmit(component, formData, shouldSkipValidation);\n }\n };\n\n // Render branded social login buttons for known action IDs\n\n if (matchesSocialProvider(actionId, eventType, buttonText, 'google', authType, componentVariant)) {\n return <GoogleButton key={key} onClick={handleClick} className={options.buttonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'github', authType, componentVariant)) {\n return <GitHubButton key={key} onClick={handleClick} className={options.buttonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'facebook', authType, componentVariant)) {\n return <FacebookButton key={key} onClick={handleClick} className={options.buttonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'microsoft', authType, componentVariant)) {\n return <MicrosoftButton key={key} onClick={handleClick} className={options.buttonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'linkedin', authType, componentVariant)) {\n return <LinkedInButton key={key} onClick={handleClick} className={options.buttonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'ethereum', authType, componentVariant)) {\n return <SignInWithEthereumButton key={key} onClick={handleClick} className={options.buttonClassName} />;\n }\n if (actionId === 'prompt_mobile' || eventType === 'prompt_mobile') {\n return <SmsOtpButton key={key} onClick={handleClick} className={options.buttonClassName} />;\n }\n\n const startIconEl: ReactElement | null = component.startIcon ? (\n <img\n src={component.startIcon}\n alt=\"\"\n aria-hidden=\"true\"\n style={{height: '1.25em', objectFit: 'contain', width: '1.25em'}}\n />\n ) : null;\n\n const endIconEl: ReactElement | null = component.endIcon ? (\n <img\n src={component.endIcon}\n alt=\"\"\n aria-hidden=\"true\"\n style={{height: '1.25em', objectFit: 'contain', width: '1.25em'}}\n />\n ) : null;\n\n return (\n <Button\n fullWidth\n key={key}\n onClick={handleClick}\n disabled={\n isLoading ||\n (!isFormValid && !shouldSkipValidation) ||\n options.isTimeoutDisabled ||\n (component as any).config?.disabled\n }\n className={options.buttonClassName}\n data-testid=\"thunderid-signin-submit\"\n variant={component.variant?.toLowerCase() === 'primary' ? 'solid' : 'outline'}\n color={component.variant?.toLowerCase() === 'primary' ? 'primary' : 'secondary'}\n startIcon={startIconEl}\n endIcon={endIconEl}\n >\n {buttonText || 'Submit'}\n </Button>\n );\n }\n\n case EmbeddedFlowComponentType.Text: {\n const variant: any = getTypographyVariant(component.variant!);\n return (\n <Typography\n key={key}\n variant={variant}\n style={{\n marginBottom: 2,\n textAlign:\n typeof component?.align === 'string' ? (component.align as React.CSSProperties['textAlign']) : 'left',\n }}\n >\n {resolve(component.label)}\n </Typography>\n );\n }\n\n case EmbeddedFlowComponentType.Divider: {\n return <Divider key={key}>{resolve(component.label) || ''}</Divider>;\n }\n\n case EmbeddedFlowComponentType.Select: {\n const identifier: string = component.ref!;\n const value: string = formValues[identifier] || '';\n const isTouched: boolean = touchedFields[identifier] || false;\n const error: string = isTouched ? formErrors[identifier] : undefined!;\n\n // Options are pre-sanitized by flowTransformer to {value: string, label: string} format\n const selectOptions: any = (component.options || []).map((opt: any) => ({\n label: typeof opt === 'string' ? opt : String(opt.label ?? opt.value ?? ''),\n value: typeof opt === 'string' ? opt : String(opt.value ?? ''),\n }));\n\n return (\n <Select\n key={key}\n name={identifier}\n label={resolve(component.label) || ''}\n placeholder={resolve(component.placeholder)}\n required={component.required}\n options={selectOptions}\n value={value}\n error={error}\n onChange={(e: any): void => onInputChange(identifier, e.target.value)}\n onBlur={(): any => options.onInputBlur?.(identifier)}\n className={options.inputClassName}\n />\n );\n }\n\n case EmbeddedFlowComponentType.DateInput: {\n const identifier: string = component.ref!;\n const value: string = formValues[identifier] || '';\n const isTouched: boolean = touchedFields[identifier] || false;\n const error: string = isTouched ? formErrors[identifier] : undefined!;\n\n return (\n <DatePicker\n key={key}\n name={identifier}\n label={resolve(component.label) || ''}\n placeholder={resolve(component.placeholder)}\n required={component.required}\n dateFormat={component.dateFormat}\n value={value}\n error={error}\n onChange={(e: any): void => onInputChange(identifier, e.target.value)}\n onBlur={(): any => options.onInputBlur?.(identifier)}\n className={options.inputClassName}\n />\n );\n }\n\n case EmbeddedFlowComponentType.OuSelect: {\n logger.warn('OU_SELECT component type is not supported. Skipping render.');\n return null;\n }\n\n case EmbeddedFlowComponentType.Block: {\n if (component.components && component.components.length > 0) {\n const formStyles: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n gap: `calc(${theme?.vars?.spacing?.unit ?? '4px'} * 2)`,\n };\n\n const blockComponents: any = component.components\n .map((childComponent: any, index: any) =>\n createAuthComponentFromFlow(\n childComponent,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n onInputChange,\n authType,\n {\n ...options,\n key: childComponent.id || `${component.id}_${index}`,\n },\n ),\n )\n .filter(Boolean);\n\n return (\n <form id={component.id} key={key} style={formStyles}>\n {blockComponents}\n </form>\n );\n }\n return null;\n }\n\n case EmbeddedFlowComponentType.RichText: {\n const richTextAction: EmbeddedFlowComponentAction | undefined = component.action;\n\n const dispatchRichTextAction = (): void => {\n if (!richTextAction || !options.onSubmit) {\n return;\n }\n const eventTypeValue = String(richTextAction.eventType ?? EmbeddedFlowEventType.Submit);\n const shouldSkipValidation: boolean = eventTypeValue.toUpperCase() === String(EmbeddedFlowEventType.Trigger);\n const syntheticAction: EmbeddedFlowComponent = {\n eventType: eventTypeValue,\n id: `${component.id}_action`,\n ref: richTextAction.ref,\n type: EmbeddedFlowComponentType.Action,\n };\n const formData: Record<string, string> = {};\n Object.keys(formValues).forEach((field: string) => {\n formData[field] = formValues[field];\n });\n options.onSubmit(syntheticAction, formData, shouldSkipValidation);\n };\n\n // Sentinel-anchor contract: only anchors carrying `data-action-ref` equal to\n // richTextAction.ref dispatch the action. Anchors without the sentinel (or with\n // a non-matching one) are treated as ordinary links and are ignored here.\n const isMatchingSentinelAnchor = (anchor: HTMLAnchorElement): boolean =>\n anchor.getAttribute('data-action-ref') === richTextAction?.ref;\n\n const handleRichTextClick: React.MouseEventHandler<HTMLDivElement> | undefined = richTextAction\n ? (event: React.MouseEvent<HTMLDivElement>): void => {\n const anchor: HTMLAnchorElement | null = (event.target as HTMLElement).closest('a');\n if (!anchor || !isMatchingSentinelAnchor(anchor)) {\n return;\n }\n event.preventDefault();\n dispatchRichTextAction();\n }\n : undefined;\n\n const handleRichTextKeyDown: React.KeyboardEventHandler<HTMLDivElement> | undefined = richTextAction\n ? (event: React.KeyboardEvent<HTMLDivElement>): void => {\n if (event.key !== 'Enter' && event.key !== ' ') {\n return;\n }\n const anchor: HTMLAnchorElement | null = (event.target as HTMLElement).closest('a');\n if (!anchor || !isMatchingSentinelAnchor(anchor)) {\n return;\n }\n event.preventDefault();\n dispatchRichTextAction();\n }\n : undefined;\n\n return (\n // Sentinel anchors are made keyboard-operable via the container's onKeyDown\n // (Enter/Space activate the matching anchor). Authors should ensure the anchor\n // is focusable (`href` or `tabIndex`); the click+keydown delegation covers both\n // pointer and keyboard activation once focus lands on the anchor.\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div\n key={key}\n className={richTextClass}\n onClick={handleRichTextClick}\n onKeyDown={handleRichTextKeyDown}\n // Manually sanitizes with `DOMPurify`.\n // IMPORTANT: DO NOT REMOVE OR MODIFY THIS SANITIZATION STEP.\n dangerouslySetInnerHTML={{__html: DOMPurify.sanitize(resolveEmojiUrisInHtml(resolve(component.label)))}}\n />\n );\n }\n\n case EmbeddedFlowComponentType.Image: {\n const explicitHeight: string = resolve(component.height?.toString());\n const explicitWidth: string = resolve(component.width?.toString());\n return (\n <ImageComponent\n key={key}\n component={\n {\n config: {\n alt: resolve(component.alt) || resolve(component.label) || 'Image',\n height: explicitHeight || (options.inStack ? '50' : 'auto'),\n src: resolve(component.src),\n width: explicitWidth || (options.inStack ? '50' : '100%'),\n },\n } as any\n }\n formErrors={undefined!}\n formValues={undefined!}\n isFormValid={false}\n isLoading={false}\n onInputChange={(): void => {\n throw new Error('Function not implemented.');\n }}\n touchedFields={undefined!}\n />\n );\n }\n\n case EmbeddedFlowComponentType.Icon: {\n const iconName: string = component.name || '';\n const IconComponent: any = flowIconRegistry[iconName];\n if (!IconComponent) {\n logger.warn(`Unknown icon name: \"${iconName}\". Skipping render.`);\n return null;\n }\n return <IconComponent key={key} size={component.size || 24} color={component.color || 'currentColor'} />;\n }\n\n case EmbeddedFlowComponentType.Stack: {\n const direction: string = (component as any).direction || 'row';\n const gap: number = (component as any).gap ?? 2;\n const align: string = (component as any).align || 'center';\n const justify: string = (component as any).justify || 'flex-start';\n\n const stackStyle: CSSProperties = {\n alignItems: align,\n display: 'flex',\n flexDirection: direction as CSSProperties['flexDirection'],\n flexWrap: 'wrap',\n gap: `${gap * 0.5}rem`,\n justifyContent: justify,\n };\n\n const stackChildren: (ReactElement | null)[] = component.components\n ? component.components.map((childComponent: any, index: number) =>\n createAuthComponentFromFlow(\n childComponent,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n onInputChange,\n authType,\n {\n ...options,\n inStack: true,\n key: childComponent.id || `${component.id}_${index}`,\n },\n ),\n )\n : [];\n\n return (\n <div key={key} style={stackStyle}>\n {stackChildren}\n </div>\n );\n }\n\n case EmbeddedFlowComponentType.Consent: {\n const consentPromptRawData: ConsentPromptData | string | undefined = options.additionalData?.['consentPrompt'];\n\n return (\n <Consent\n key={key}\n consentData={consentPromptRawData as any}\n formValues={formValues}\n onInputChange={onInputChange}\n />\n );\n }\n\n case EmbeddedFlowComponentType.Timer: {\n const textTemplate: string = resolve((component as any).label) || 'Time remaining: {time}';\n const timeoutMs: number = Number(options.additionalData?.['stepTimeout']) || 0;\n const expiresIn: number = timeoutMs > 0 ? Math.max(0, Math.floor((timeoutMs - Date.now()) / 1000)) : 0;\n\n return <FlowTimer key={key} expiresIn={expiresIn} textTemplate={textTemplate} />;\n }\n\n case EmbeddedFlowComponentType.CopyableText: {\n const sourceKey: string | undefined = (component as any).source;\n const value: string = sourceKey && options.additionalData ? String(options.additionalData[sourceKey] ?? '') : '';\n const labelText: string | undefined = resolve((component as any).label) || undefined;\n\n return <CopyableText key={key} label={labelText} value={value} />;\n }\n\n default:\n // Gracefully handle unsupported component types by returning null\n logger.warn(`Unsupported component type: ${component.type}. Skipping render.`);\n return null;\n }\n};\n\n/**\n * Processes an array of components and renders them as React elements for sign-in.\n */\nexport const renderSignInComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n onInputChange: (name: string, value: string) => void,\n options?: {\n /** @internal */\n _customRenderers?: ComponentRendererMap;\n /** @internal */\n _theme?: any;\n /** Additional data from the flow response */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n inputClassName?: string;\n /** Flag to determine if the step timeline has expired */\n isTimeoutDisabled?: boolean;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createAuthComponentFromFlow(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n onInputChange,\n 'signin',\n {\n ...options,\n key: component.id || index,\n },\n ),\n )\n .filter((x): x is ReactElement => x !== null);\n\n/**\n * Processes an array of components and renders them as React elements for sign-up.\n */\nexport const renderSignUpComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n onInputChange: (name: string, value: string) => void,\n options?: {\n /** @internal */\n _customRenderers?: ComponentRendererMap;\n /** @internal */\n _theme?: any;\n /** Additional data from the flow response */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n inputClassName?: string;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createAuthComponentFromFlow(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n onInputChange,\n 'signup',\n {\n ...options,\n key: component.id || index,\n },\n ),\n )\n .filter((x): x is ReactElement => x !== null);\n\n/**\n * Processes an array of components and renders them as React elements for recovery flow.\n */\nexport const renderRecoveryComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n onInputChange: (name: string, value: string) => void,\n options?: {\n /** @internal */\n _customRenderers?: ComponentRendererMap;\n /** @internal */\n _theme?: any;\n /** Additional data from the flow response */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n inputClassName?: string;\n /** Flag to determine if the step timeline has expired */\n isTimeoutDisabled?: boolean;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createAuthComponentFromFlow(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n onInputChange,\n 'recovery',\n {\n ...options,\n key: component.id || index,\n },\n ),\n )\n .filter((x): x is ReactElement => x !== null);\n\n/**\n * Processes an array of components and renders them as React elements for invite user.\n * This is used by both InviteUser and AcceptInvite components.\n */\nexport const renderInviteUserComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n onInputChange: (name: string, value: string) => void,\n options?: {\n /** @internal */\n _customRenderers?: ComponentRendererMap;\n /** @internal */\n _theme?: any;\n /** Additional data from the flow response */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n /** Function to fetch child organization units for OU_SELECT components. */\n fetchOrganizationUnitChildren?: (\n parentId: string,\n limit: number,\n offset: number,\n ) => Promise<OrganizationUnitListResponse>;\n inputClassName?: string;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createAuthComponentFromFlow(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n onInputChange,\n 'signup',\n {\n ...options,\n key: component.id || index,\n },\n ),\n )\n .filter((x): x is ReactElement => x !== null);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,MAAMA,+DACJ,oBACA,oBACD;;;;;;;;;;AAYD,MAAMC,gBAAwB,iBAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCjC,MAAM,gBAAgB,YAAkD;AACtE,SAAQ,SAAR;EACE,KAAKC,8CAA0B,WAC7B,QAAOC,8BAAU;EACnB,KAAKD,8CAA0B,WAC7B,QAAOC,8BAAU;EACnB,KAAKD,8CAA0B,cAC7B,QAAOC,8BAAU;EACnB,KAAKD,8CAA0B;EAC/B,QACE,QAAOC,8BAAU;;;;;;AAOvB,MAAM,wBAAwB,YAAyB;AAiBrD,QAhBuE;EACrE,QAAQ;EACR,QAAQ;EACR,aAAa;EACb,SAAS;EACT,WAAW;EACX,WAAW;EACX,WAAW;EACX,WAAW;EACX,WAAW;EACX,WAAW;EACX,UAAU;EACV,YAAY;EACZ,YAAY;EACb,CAEiB,YAAY;;;;;AAMhC,MAAM,yBACJ,UACA,WACA,YACA,UACA,UAEA,sBACY;CACZ,MAAMC,aAAkB,GAAG,SAAS;CACpC,MAA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ErC;MAAzC,IAAyD;;EAGlF,KAAK5D,8CAA0B,cAAc;GAC3C,MAAM6D,YAAiC,UAAkB;GACzD,MAAMpD,QAAgB,aAAa,QAAQ,iBAAiB,OAAO,QAAQ,eAAe,cAAc,GAAG,GAAG;AAG9G,UAAO,2CAACqD;IAAuB,OAFO,QAAS,UAAkB,MAAM,IAAI;IAEnB;MAA9B,IAAuC;;EAGnE;AAEE,UAAO,KAAK,+BAA+B,UAAU,KAAK,oBAAoB;AAC9E,UAAO;;;;;;AAOb,MAAa,0BACX,YACA,YACA,eACA,YACA,WACA,aACA,eACA,YAqBA,WACG,KAAK,WAAgB,UACpB,4BACE,WACA,YACA,eACA,YACA,WACA,aACA,eACA,UACA;CACE,GAAG;CACH,KAAK,UAAU,MAAM;CACtB,CACF,CACF,CACA,QAAQ,MAAyB,MAAM,KAAK;;;;AAKjD,MAAa,0BACX,YACA,YACA,eACA,YACA,WACA,aACA,eACA,YAmBA,WACG,KAAK,WAAgB,UACpB,4BACE,WACA,YACA,eACA,YACA,WACA,aACA,eACA,UACA;CACE,GAAG;CACH,KAAK,UAAU,MAAM;CACtB,CACF,CACF,CACA,QAAQ,MAAyB,MAAM,KAAK;;;;AAKjD,MAAa,4BACX,YACA,YACA,eACA,YACA,WACA,aACA,eACA,YAqBA,WACG,KAAK,WAAgB,UACpB,4BACE,WACA,YACA,eACA,YACA,WACA,aACA,eACA,YACA;CACE,GAAG;CACH,KAAK,UAAU,MAAM;CACtB,CACF,CACF,CACA,QAAQ,MAAyB,MAAM,KAAK;;;;;AAMjD,MAAa,8BACX,YACA,YACA,eACA,YACA,WACA,aACA,eACA,YAyBA,WACG,KAAK,WAAgB,UACpB,4BACE,WACA,YACA,eACA,YACA,WACA,aACA,eACA,UACA;CACE,GAAG;CACH,KAAK,UAAU,MAAM;CACtB,CACF,CACF,CACA,QAAQ,MAAyB,MAAM,KAAK"}
|
|
@@ -3,8 +3,8 @@ const require_ComponentRendererContext = require('../../../../contexts/Component
|
|
|
3
3
|
const require_useThunderID = require('../../../../contexts/ThunderID/useThunderID.cjs');
|
|
4
4
|
const require_useTheme = require('../../../../contexts/Theme/useTheme.cjs');
|
|
5
5
|
const require_useTranslation = require('../../../../hooks/useTranslation.cjs');
|
|
6
|
-
const require_Spinner = require('../../../primitives/Spinner/Spinner.cjs');
|
|
7
6
|
const require_flowTransformer = require('../../../../utils/flowTransformer.cjs');
|
|
7
|
+
const require_Spinner = require('../../../primitives/Spinner/Spinner.cjs');
|
|
8
8
|
const require_Typography = require('../../../primitives/Typography/Typography.cjs');
|
|
9
9
|
const require_Alert = require('../../../primitives/Alert/Alert.cjs');
|
|
10
10
|
const require_Card = require('../../../primitives/Card/Card.cjs');
|
|
@@ -6,9 +6,9 @@ const require_useFlow = require('../../../../contexts/Flow/useFlow.cjs');
|
|
|
6
6
|
const require_useTheme = require('../../../../contexts/Theme/useTheme.cjs');
|
|
7
7
|
const require_ComponentPreferencesContext = require('../../../../contexts/I18n/ComponentPreferencesContext.cjs');
|
|
8
8
|
const require_useTranslation = require('../../../../hooks/useTranslation.cjs');
|
|
9
|
+
const require_flowTransformer = require('../../../../utils/flowTransformer.cjs');
|
|
9
10
|
const require_useForm = require('../../../../hooks/useForm.cjs');
|
|
10
11
|
const require_Spinner = require('../../../primitives/Spinner/Spinner.cjs');
|
|
11
|
-
const require_flowTransformer = require('../../../../utils/flowTransformer.cjs');
|
|
12
12
|
const require_Typography = require('../../../primitives/Typography/Typography.cjs');
|
|
13
13
|
const require_Alert = require('../../../primitives/Alert/Alert.cjs');
|
|
14
14
|
const require_Card = require('../../../primitives/Card/Card.cjs');
|
|
@@ -6,10 +6,10 @@ const require_useFlow = require('../../../../contexts/Flow/useFlow.cjs');
|
|
|
6
6
|
const require_useTheme = require('../../../../contexts/Theme/useTheme.cjs');
|
|
7
7
|
const require_ComponentPreferencesContext = require('../../../../contexts/I18n/ComponentPreferencesContext.cjs');
|
|
8
8
|
const require_useTranslation = require('../../../../hooks/useTranslation.cjs');
|
|
9
|
+
const require_flowTransformer = require('../../../../utils/flowTransformer.cjs');
|
|
9
10
|
const require_useForm = require('../../../../hooks/useForm.cjs');
|
|
10
11
|
const require_Spinner = require('../../../primitives/Spinner/Spinner.cjs');
|
|
11
12
|
const require_BaseSignIn_styles = require('./BaseSignIn.styles.cjs');
|
|
12
|
-
const require_flowTransformer = require('../../../../utils/flowTransformer.cjs');
|
|
13
13
|
const require_Typography = require('../../../primitives/Typography/Typography.cjs');
|
|
14
14
|
const require_Alert = require('../../../primitives/Alert/Alert.cjs');
|
|
15
15
|
const require_Card = require('../../../primitives/Card/Card.cjs');
|
|
@@ -27,7 +27,7 @@ __emotion_css = require_rolldown_runtime.__toESM(__emotion_css);
|
|
|
27
27
|
/**
|
|
28
28
|
* Internal component that consumes FlowContext and renders the sign-in UI.
|
|
29
29
|
*/
|
|
30
|
-
const BaseSignInContent = ({ components = [], onSubmit, onError, error: externalError, className = "", inputClassName = "", buttonClassName = "", messageClassName = "", size = "medium", variant = "outlined", isLoading: externalIsLoading, children, additionalData = {}, isTimeoutDisabled = false
|
|
30
|
+
const BaseSignInContent = ({ components = [], onSubmit, onError, error: externalError, className = "", inputClassName = "", buttonClassName = "", messageClassName = "", size = "medium", variant = "outlined", isLoading: externalIsLoading, children, additionalData = {}, isTimeoutDisabled = false }) => {
|
|
31
31
|
const { meta } = require_useThunderID.default();
|
|
32
32
|
const { theme } = require_useTheme.default();
|
|
33
33
|
const customRenderers = (0, react.useContext)(require_ComponentRendererContext.default);
|
|
@@ -61,9 +61,8 @@ const BaseSignInContent = ({ components = [], onSubmit, onError, error: external
|
|
|
61
61
|
const fields = [];
|
|
62
62
|
const processComponents = (comps) => {
|
|
63
63
|
comps.forEach((component) => {
|
|
64
|
-
if (component.type === "TEXT_INPUT" || component.type === "PASSWORD_INPUT" || component.type === "EMAIL_INPUT" || component.type === "PHONE_INPUT" || component.type === "OTP_INPUT"
|
|
64
|
+
if (component.type === "TEXT_INPUT" || component.type === "PASSWORD_INPUT" || component.type === "EMAIL_INPUT" || component.type === "PHONE_INPUT" || component.type === "OTP_INPUT") {
|
|
65
65
|
const identifier = component.ref;
|
|
66
|
-
const ruleValidator = (0, __thunderid_browser.buildValidatorFromRules)(component.validation);
|
|
67
66
|
fields.push({
|
|
68
67
|
initialValue: "",
|
|
69
68
|
name: identifier,
|
|
@@ -71,10 +70,6 @@ const BaseSignInContent = ({ components = [], onSubmit, onError, error: external
|
|
|
71
70
|
validator: (value) => {
|
|
72
71
|
if (component.required && (!value || value.trim() === "")) return t("validations.required.field.error");
|
|
73
72
|
if ((component.type === "EMAIL_INPUT" || component.variant === "EMAIL") && value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) return t("field.email.invalid");
|
|
74
|
-
if (ruleValidator && value) {
|
|
75
|
-
const ruleMessage = ruleValidator(value);
|
|
76
|
-
if (ruleMessage) return t(ruleMessage);
|
|
77
|
-
}
|
|
78
73
|
return null;
|
|
79
74
|
}
|
|
80
75
|
});
|
|
@@ -85,7 +80,7 @@ const BaseSignInContent = ({ components = [], onSubmit, onError, error: external
|
|
|
85
80
|
processComponents(flowComponents);
|
|
86
81
|
return fields;
|
|
87
82
|
}, [t]);
|
|
88
|
-
const { values: formValues, touched: touchedFields, errors: formErrors, isValid: isFormValid, setValue: setFormValue, setTouched: setFormTouched,
|
|
83
|
+
const { values: formValues, touched: touchedFields, errors: formErrors, isValid: isFormValid, setValue: setFormValue, setTouched: setFormTouched, validateForm, touchAllFields } = require_useForm.useForm({
|
|
89
84
|
fields: components ? extractFormFields(components) : [],
|
|
90
85
|
initialValues: {},
|
|
91
86
|
requiredMessage: t("validations.required.field.error"),
|
|
@@ -93,29 +88,6 @@ const BaseSignInContent = ({ components = [], onSubmit, onError, error: external
|
|
|
93
88
|
validateOnChange: false
|
|
94
89
|
});
|
|
95
90
|
/**
|
|
96
|
-
* Project server-side validation errors (from `data.fieldErrors`) into the form's
|
|
97
|
-
* `errors` state so they surface through the same render-prop / UI as client-side
|
|
98
|
-
* errors. When the server returns multiple failing rules for one field, only the
|
|
99
|
-
* first message is shown — matching the SDK's single-string-per-field contract.
|
|
100
|
-
* The full FieldError[] remains available via the `serverFieldErrors` prop.
|
|
101
|
-
*
|
|
102
|
-
* Also marks each affected field as `touched` so the error renders immediately —
|
|
103
|
-
* `useForm` only shows errors for touched fields by default.
|
|
104
|
-
*/
|
|
105
|
-
(0, react.useEffect)(() => {
|
|
106
|
-
clearFormErrors();
|
|
107
|
-
if (!serverFieldErrors || serverFieldErrors.length === 0) return;
|
|
108
|
-
const errors = {};
|
|
109
|
-
for (const fe of serverFieldErrors) if (!(fe.identifier in errors)) errors[fe.identifier] = fe.message;
|
|
110
|
-
setFormErrors(errors);
|
|
111
|
-
Object.keys(errors).forEach((field) => setFormTouched(field, true));
|
|
112
|
-
}, [
|
|
113
|
-
serverFieldErrors,
|
|
114
|
-
setFormErrors,
|
|
115
|
-
setFormTouched,
|
|
116
|
-
clearFormErrors
|
|
117
|
-
]);
|
|
118
|
-
/**
|
|
119
91
|
* Handle input value changes.
|
|
120
92
|
* Only updates the value without marking as touched.
|
|
121
93
|
* Touched state is set on blur to avoid premature validation.
|