@acorex-platform/module-auth-client 0.0.59 → 0.0.60
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/fesm2022/{acorex-platform-module-auth-client-accept-invitation.component-Ct28GG3a.mjs → acorex-platform-module-auth-client-accept-invitation.component-Bq49K_8F.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-accept-invitation.component-Ct28GG3a.mjs.map → acorex-platform-module-auth-client-accept-invitation.component-Bq49K_8F.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-acorex-platform-module-auth-client-CQEt9bXJ.mjs → acorex-platform-module-auth-client-acorex-platform-module-auth-client-DINrCCAx.mjs} +75 -51
- package/fesm2022/acorex-platform-module-auth-client-acorex-platform-module-auth-client-DINrCCAx.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-app-chooser.component-SUwPTueG.mjs → acorex-platform-module-auth-client-app-chooser.component-C1fUi_Mp.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-auth-client-app-chooser.component-SUwPTueG.mjs.map → acorex-platform-module-auth-client-app-chooser.component-C1fUi_Mp.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-change-password.command-DRwzhNlO.mjs → acorex-platform-module-auth-client-change-password.command-UvBqwF9V.mjs} +48 -23
- package/fesm2022/acorex-platform-module-auth-client-change-password.command-UvBqwF9V.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-change-photo.command-C1Fm_MdA.mjs → acorex-platform-module-auth-client-change-photo.command-2e7ZjiEf.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-change-photo.command-C1Fm_MdA.mjs.map → acorex-platform-module-auth-client-change-photo.command-2e7ZjiEf.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-get-user-activity.query-CLdmidQb.mjs → acorex-platform-module-auth-client-get-user-activity.query-BGOYJ4FC.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-get-user-activity.query-CLdmidQb.mjs.map → acorex-platform-module-auth-client-get-user-activity.query-BGOYJ4FC.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-lock-screen.command-CHbe_N-Z.mjs → acorex-platform-module-auth-client-lock-screen.command-BOKKr6WW.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-lock-screen.command-CHbe_N-Z.mjs.map → acorex-platform-module-auth-client-lock-screen.command-BOKKr6WW.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-login.module-BM3L_d8i.mjs → acorex-platform-module-auth-client-login.module-gi6wea8m.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-login.module-BM3L_d8i.mjs.map → acorex-platform-module-auth-client-login.module-gi6wea8m.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-manage-two-factor.command-BOM6_896.mjs → acorex-platform-module-auth-client-manage-two-factor.command-DRsNZWZF.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-manage-two-factor.command-BOM6_896.mjs.map → acorex-platform-module-auth-client-manage-two-factor.command-DRsNZWZF.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-oauth-callback.component-BgUSFibH.mjs → acorex-platform-module-auth-client-oauth-callback.component-DLrIDQXn.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-oauth-callback.component-BgUSFibH.mjs.map → acorex-platform-module-auth-client-oauth-callback.component-DLrIDQXn.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-open-sessions.command-Dq9eJ-bY.mjs → acorex-platform-module-auth-client-open-sessions.command-CwWtPiTG.mjs} +5 -5
- package/fesm2022/{acorex-platform-module-auth-client-open-sessions.command-Dq9eJ-bY.mjs.map → acorex-platform-module-auth-client-open-sessions.command-CwWtPiTG.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-password.component-SpEVRPaE.mjs → acorex-platform-module-auth-client-password.component-CAZ3tVPG.mjs} +5 -5
- package/fesm2022/{acorex-platform-module-auth-client-password.component-SpEVRPaE.mjs.map → acorex-platform-module-auth-client-password.component-CAZ3tVPG.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-password.component-Ci5Wy3rO.mjs → acorex-platform-module-auth-client-password.component-CE2nXYCz.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-password.component-Ci5Wy3rO.mjs.map → acorex-platform-module-auth-client-password.component-CE2nXYCz.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-platform-settings-unavailable.component-LwuokJiZ.mjs → acorex-platform-module-auth-client-platform-settings-unavailable.component-BJMtsa99.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-auth-client-platform-settings-unavailable.component-LwuokJiZ.mjs.map → acorex-platform-module-auth-client-platform-settings-unavailable.component-BJMtsa99.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-profile-activity-chart.component-DcMdz44P.mjs → acorex-platform-module-auth-client-profile-activity-chart.component-BcbVLmZo.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-auth-client-profile-activity-chart.component-DcMdz44P.mjs.map → acorex-platform-module-auth-client-profile-activity-chart.component-BcbVLmZo.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-profile-delete-account-danger-zone.component-DTujROAP.mjs → acorex-platform-module-auth-client-profile-delete-account-danger-zone.component-Dx2-o9XL.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-profile-delete-account-danger-zone.component-DTujROAP.mjs.map → acorex-platform-module-auth-client-profile-delete-account-danger-zone.component-Dx2-o9XL.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-profile-page-component.provider-CelasDrw.mjs → acorex-platform-module-auth-client-profile-page-component.provider-DEVBmVKd.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-auth-client-profile-page-component.provider-CelasDrw.mjs.map → acorex-platform-module-auth-client-profile-page-component.provider-DEVBmVKd.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-profile-page.component-iGdfjv6g.mjs → acorex-platform-module-auth-client-profile-page.component-BNYoh2IL.mjs} +7 -7
- package/fesm2022/{acorex-platform-module-auth-client-profile-page.component-iGdfjv6g.mjs.map → acorex-platform-module-auth-client-profile-page.component-BNYoh2IL.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-register-password.component-CaztyyPx.mjs → acorex-platform-module-auth-client-register-password.component-DArLfswX.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-auth-client-register-password.component-CaztyyPx.mjs.map → acorex-platform-module-auth-client-register-password.component-DArLfswX.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-register.module-R-yxS0EI.mjs → acorex-platform-module-auth-client-register.module-BXMV9tp3.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-auth-client-register.module-R-yxS0EI.mjs.map → acorex-platform-module-auth-client-register.module-BXMV9tp3.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-remove-pin-code.command-DHY46WWD.mjs → acorex-platform-module-auth-client-remove-pin-code.command-D9uLV6je.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-remove-pin-code.command-DHY46WWD.mjs.map → acorex-platform-module-auth-client-remove-pin-code.command-D9uLV6je.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-reset-password.component-BQfKSqpW.mjs → acorex-platform-module-auth-client-reset-password.component-Cz4UePgF.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-reset-password.component-BQfKSqpW.mjs.map → acorex-platform-module-auth-client-reset-password.component-Cz4UePgF.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-result.component-DuMch6Ge.mjs → acorex-platform-module-auth-client-result.component-BS5uizi6.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-auth-client-result.component-DuMch6Ge.mjs.map → acorex-platform-module-auth-client-result.component-BS5uizi6.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-auth-client-routes-Dw8YhBrw.mjs +21 -0
- package/fesm2022/acorex-platform-module-auth-client-routes-Dw8YhBrw.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-session-limit.component-Dc6TIn-2.mjs → acorex-platform-module-auth-client-session-limit.component-DH58dRba.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-session-limit.component-Dc6TIn-2.mjs.map → acorex-platform-module-auth-client-session-limit.component-DH58dRba.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-session-lock-overlay.component-DBJjSIOq.mjs → acorex-platform-module-auth-client-session-lock-overlay.component-D_IKdJl8.mjs} +5 -5
- package/fesm2022/{acorex-platform-module-auth-client-session-lock-overlay.component-DBJjSIOq.mjs.map → acorex-platform-module-auth-client-session-lock-overlay.component-D_IKdJl8.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-set-pin-code.command-CheMeghC.mjs → acorex-platform-module-auth-client-set-pin-code.command-DRLTGXEF.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-set-pin-code.command-CheMeghC.mjs.map → acorex-platform-module-auth-client-set-pin-code.command-DRLTGXEF.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-set-pin-code.component-BWl3vLOO.mjs → acorex-platform-module-auth-client-set-pin-code.component-m7SwyaZH.mjs} +5 -5
- package/fesm2022/{acorex-platform-module-auth-client-set-pin-code.component-BWl3vLOO.mjs.map → acorex-platform-module-auth-client-set-pin-code.component-m7SwyaZH.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-tenant-chooser.component-BEtlhGUb.mjs → acorex-platform-module-auth-client-tenant-chooser.component-CdqBeKVw.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-auth-client-tenant-chooser.component-BEtlhGUb.mjs.map → acorex-platform-module-auth-client-tenant-chooser.component-CdqBeKVw.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-auth-client-tenant-request.component-B-qx-HIi.mjs +256 -0
- package/fesm2022/acorex-platform-module-auth-client-tenant-request.component-B-qx-HIi.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-two-factor-code.component-4XVRgh6H.mjs → acorex-platform-module-auth-client-two-factor-code.component-B1334bPg.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-auth-client-two-factor-code.component-4XVRgh6H.mjs.map → acorex-platform-module-auth-client-two-factor-code.component-B1334bPg.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-two-factor.module-CrLPxje1.mjs → acorex-platform-module-auth-client-two-factor.module-C0mkbR4X.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-two-factor.module-CrLPxje1.mjs.map → acorex-platform-module-auth-client-two-factor.module-C0mkbR4X.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-view-login-history.command-qrd0bNM9.mjs → acorex-platform-module-auth-client-view-login-history.command-CerhsvHF.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-view-login-history.command-qrd0bNM9.mjs.map → acorex-platform-module-auth-client-view-login-history.command-CerhsvHF.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-auth-client-waiting-room.component-Wu8iPiTm.mjs +327 -0
- package/fesm2022/acorex-platform-module-auth-client-waiting-room.component-Wu8iPiTm.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-welcome-onboarding-page.component-3yva-FyV.mjs → acorex-platform-module-auth-client-welcome-onboarding-page.component-BKqHYkv2.mjs} +5 -5
- package/fesm2022/{acorex-platform-module-auth-client-welcome-onboarding-page.component-3yva-FyV.mjs.map → acorex-platform-module-auth-client-welcome-onboarding-page.component-BKqHYkv2.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-welcome-onboarding.command-CFpMZAwC.mjs → acorex-platform-module-auth-client-welcome-onboarding.command--Rr0duJS.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-welcome-onboarding.command-CFpMZAwC.mjs.map → acorex-platform-module-auth-client-welcome-onboarding.command--Rr0duJS.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-auth-client.mjs +1 -1
- package/i18n/en-AU/auth.json +70 -5
- package/i18n/en-US/auth.json +70 -5
- package/i18n/fa-IR/auth.json +70 -5
- package/package.json +3 -2
- package/fesm2022/acorex-platform-module-auth-client-acorex-platform-module-auth-client-CQEt9bXJ.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-change-password.command-DRwzhNlO.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-routes-90eFjxx8.mjs +0 -17
- package/fesm2022/acorex-platform-module-auth-client-routes-90eFjxx8.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-waiting-room.component-IAVIt1fY.mjs +0 -165
- package/fesm2022/acorex-platform-module-auth-client-waiting-room.component-IAVIt1fY.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-auth-client-two-factor-code.component-4XVRgh6H.mjs","sources":["../../../../libs/modules/auth/client/src/lib/pages/two-factor/two-factor-code/two-factor-code.component.ts","../../../../libs/modules/auth/client/src/lib/pages/two-factor/two-factor-code/two-factor-code.component.html"],"sourcesContent":["import { AXButtonModule } from '@acorex/components/button';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXFormComponent, AXFormModule } from '@acorex/components/form';\nimport { AXLabelModule } from '@acorex/components/label';\nimport { AXLoadingModule } from '@acorex/components/loading';\nimport { AXTextBoxModule } from '@acorex/components/text-box';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationModule, AXTranslationService } from '@acorex/core/translation';\nimport { AXValidationModule } from '@acorex/core/validation';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPHomePageService } from '@acorex-platform/framework-client/common';\nimport { AXM_TWO_FACTOR_ERROR_CODES } from '@acorex-platform/module-security-management-client/contracts';\nimport { CommonModule } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n OnInit,\n ViewChild,\n ViewEncapsulation,\n inject,\n} from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { ActivatedRoute, Router, RouterModule } from '@angular/router';\nimport { BehaviorSubject, firstValueFrom } from 'rxjs';\n\nimport { AXMAuthPlatformSettingsService } from '../../../auth-platform-settings.service';\nimport {\n clearTwoFactorChallenge,\n readTwoFactorChallenge,\n} from '../two-factor-challenge.storage';\n\n//#region ----- Constants -----\n\nconst TWO_FACTOR_ERROR_I18N: Record<string, string> = {\n [AXM_TWO_FACTOR_ERROR_CODES.InvalidInput]: '@auth:twofactor.errors.invalid-input',\n [AXM_TWO_FACTOR_ERROR_CODES.IncorrectCode]: '@auth:twofactor.errors.incorrect-code',\n [AXM_TWO_FACTOR_ERROR_CODES.ChallengeExpired]: '@auth:twofactor.errors.challenge-expired',\n [AXM_TWO_FACTOR_ERROR_CODES.RateLimited]: '@auth:twofactor.errors.rate-limited',\n [AXM_TWO_FACTOR_ERROR_CODES.InvalidConfiguration]: '@auth:twofactor.errors.invalid-configuration',\n [AXM_TWO_FACTOR_ERROR_CODES.NotEnabled]: '@auth:twofactor.errors.not-enabled',\n};\n\nconst CHALLENGE_CLEARING_CODES = new Set<string>([\n AXM_TWO_FACTOR_ERROR_CODES.ChallengeExpired,\n AXM_TWO_FACTOR_ERROR_CODES.InvalidConfiguration,\n AXM_TWO_FACTOR_ERROR_CODES.NotEnabled,\n]);\n\n//#endregion\n\n//#region ----- Module Imports -----\n\nconst MODULES = [\n CommonModule,\n FormsModule,\n AXFormModule,\n AXTextBoxModule,\n AXButtonModule,\n AXLabelModule,\n AXDecoratorModule,\n AXTranslationModule,\n AXLoadingModule,\n RouterModule,\n AXValidationModule,\n];\n\n//#endregion\n\n//#region ----- Component -----\n\n@Component({\n selector: 'axp-auth-two-factor-code',\n templateUrl: './two-factor-code.component.html',\n imports: [...MODULES],\n changeDetection: ChangeDetectionStrategy.Eager,\n encapsulation: ViewEncapsulation.None,\n})\nexport class AXPAuthTwoFactorCodeComponent implements OnInit {\n //#region ----- Services & Dependencies -----\n\n private readonly sessionService = inject(AXPSessionService);\n private readonly authPlatformSettings = inject(AXMAuthPlatformSettingsService);\n private readonly homePageService = inject(AXPHomePageService);\n private readonly toastService = inject(AXToastService);\n private readonly translateService = inject(AXTranslationService);\n private readonly router = inject(Router);\n private readonly activateRoute = inject(ActivatedRoute);\n\n //#endregion\n\n //#region ----- Form References -----\n\n @ViewChild(AXFormComponent)\n private form!: AXFormComponent;\n\n //#endregion\n\n //#region ----- State -----\n\n protected code = '';\n protected isLoading$ = new BehaviorSubject<boolean>(false);\n protected submitText = 'twofactor.submit';\n private challengeId = '';\n private rememberMe = false;\n\n //#endregion\n\n //#region ----- Lifecycle -----\n\n ngOnInit(): void {\n const stored = readTwoFactorChallenge();\n if (!stored?.challengeId) {\n void this.router.navigate(['/auth/login'], {\n queryParams: this.activateRoute.snapshot.queryParams,\n });\n return;\n }\n\n this.challengeId = stored.challengeId;\n this.rememberMe = stored.rememberMe;\n }\n\n //#endregion\n\n //#region ----- Event Handlers -----\n\n protected handleBackToLogin(): void {\n clearTwoFactorChallenge();\n void this.router.navigate(['/auth/login'], {\n queryParams: this.activateRoute.snapshot.queryParams,\n });\n }\n\n protected handleVerifyClick(): void {\n const strategyName = this.authPlatformSettings.defaultStrategyName();\n this.sessionService.setStrategy(strategyName);\n const redirectUrl = this.activateRoute.snapshot.queryParams['redirectUrl'];\n\n void this.form.validate().then(async (form) => {\n if (!form.result) {\n return;\n }\n\n const trimmedCode = this.code.trim();\n if (!trimmedCode || !this.challengeId) {\n return;\n }\n\n this.isLoading$.next(true);\n this.submitText = 'processing';\n\n try {\n await this.sessionService.signin({\n strategy: strategyName,\n username: '',\n password: '',\n challengeId: this.challengeId,\n code: trimmedCode,\n rememberMe: this.rememberMe,\n });\n\n const isAuthenticated = await firstValueFrom(this.sessionService.isAuthenticated$);\n if (!isAuthenticated) {\n throw new Error('Authentication failed after two-factor verification');\n }\n\n clearTwoFactorChallenge();\n await this.navigateAfterAuth(redirectUrl);\n } catch (error: unknown) {\n await this.handleVerifyError(error);\n } finally {\n this.submitText = 'twofactor.submit';\n this.isLoading$.next(false);\n }\n });\n }\n\n //#endregion\n\n //#region ----- Private Helpers -----\n\n private async navigateAfterAuth(redirectUrl?: string): Promise<void> {\n if (this.sessionService.tenant?.id == null) {\n await this.router.navigate(['/auth/account/tenant-chooser']);\n return;\n }\n\n if (this.sessionService.application?.id == null) {\n await this.router.navigate(['/auth/account/app-chooser']);\n return;\n }\n\n if (redirectUrl) {\n await this.router.navigate([redirectUrl]);\n return;\n }\n\n await this.homePageService.navigateTo();\n }\n\n private async handleVerifyError(error: unknown): Promise<void> {\n const apiError = this.extractApiError(error);\n const errorCode =\n (typeof apiError?.['error'] === 'string' && apiError['error']) ||\n (typeof apiError?.['code'] === 'string' && apiError['code']) ||\n '';\n\n const messageKey = TWO_FACTOR_ERROR_I18N[errorCode] ?? '@auth:twofactor.errors.verify-failed';\n const content = await this.translateService.translateAsync(messageKey);\n\n this.toastService.show({\n color: 'danger',\n content,\n timeOut: 5000,\n });\n\n this.code = '';\n\n if (CHALLENGE_CLEARING_CODES.has(errorCode)) {\n clearTwoFactorChallenge();\n await this.router.navigate(['/auth/login'], {\n queryParams: this.activateRoute.snapshot.queryParams,\n });\n }\n }\n\n private extractApiError(error: unknown): Record<string, unknown> | null {\n if (!error || typeof error !== 'object') {\n return null;\n }\n\n const err = error as Record<string, unknown>;\n if (err['apiError'] && typeof err['apiError'] === 'object') {\n return err['apiError'] as Record<string, unknown>;\n }\n\n if (err['error'] && typeof err['error'] === 'object') {\n return err['error'] as Record<string, unknown>;\n }\n\n return null;\n }\n\n //#endregion\n}\n\n//#endregion\n","<ng-container *translate=\"let t\">\n <div class=\"axp-auth-form\">\n <div class=\"text-center mb-3 lg:mb-5\">\n <h1 class=\"font-bold text-xl mb-1 lg:mb-2\">\n {{ '@auth:twofactor.title' | translate | async }}\n </h1>\n <p class=\"text-base text-neutral-600\">\n {{ '@auth:twofactor.hint' | translate | async }}\n </p>\n </div>\n <div class=\"w-full lg:w-96 mx-auto\">\n <ax-form>\n <div class=\"flex flex-col gap-4 lg:gap-6\">\n <ax-form-field>\n <ax-label class=\"text-start\">{{ '@auth:twofactor.textBoxHint' | translate | async }}</ax-label>\n <ax-text-box\n [name]=\"'twoFactorCode'\"\n id=\"twoFactorCode\"\n [autoComplete]=\"'one-time-code'\"\n [(value)]=\"code\"\n >\n <ax-validation-rule rule=\"required\"></ax-validation-rule>\n </ax-text-box>\n </ax-form-field>\n <ax-button\n class=\"w-full\"\n [text]=\"('@auth:' + submitText) | translate | async\"\n color=\"primary\"\n [disabled]=\"isLoading$ | async\"\n (onClick)=\"handleVerifyClick()\"\n >\n @if (isLoading$ | async) {\n <ax-loading></ax-loading>\n }\n </ax-button>\n <ax-button\n class=\"w-full\"\n look=\"outline\"\n [text]=\"'@auth:twofactor.back-to-login' | translate | async\"\n [disabled]=\"isLoading$ | async\"\n (onClick)=\"handleBackToLogin()\"\n >\n </ax-button>\n </div>\n </ax-form>\n </div>\n </div>\n</ng-container>\n"],"names":["i3","i6","i7"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA;AAEA,MAAM,qBAAqB,GAA2B;AACpD,IAAA,CAAC,0BAA0B,CAAC,YAAY,GAAG,sCAAsC;AACjF,IAAA,CAAC,0BAA0B,CAAC,aAAa,GAAG,uCAAuC;AACnF,IAAA,CAAC,0BAA0B,CAAC,gBAAgB,GAAG,0CAA0C;AACzF,IAAA,CAAC,0BAA0B,CAAC,WAAW,GAAG,qCAAqC;AAC/E,IAAA,CAAC,0BAA0B,CAAC,oBAAoB,GAAG,8CAA8C;AACjG,IAAA,CAAC,0BAA0B,CAAC,UAAU,GAAG,oCAAoC;CAC9E;AAED,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAS;AAC/C,IAAA,0BAA0B,CAAC,gBAAgB;AAC3C,IAAA,0BAA0B,CAAC,oBAAoB;AAC/C,IAAA,0BAA0B,CAAC,UAAU;AACtC,CAAA,CAAC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AAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAA,EAAA,CAAA,gBAAA,EAAA,IAAA,EAAA,WAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,KAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA,CAAA;;2FAcP,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBAPzC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,0BAA0B,EAAA,OAAA,EAE3B,CAAC,GAAG,OAAO,CAAC,EAAA,eAAA,EACJ,uBAAuB,CAAC,KAAK,EAAA,aAAA,EAC/B,iBAAiB,CAAC,IAAI,EAAA,QAAA,EAAA,oqDAAA,EAAA;;sBAiBpC,SAAS;uBAAC,eAAe;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-auth-client-two-factor-code.component-B1334bPg.mjs","sources":["../../../../libs/modules/auth/client/src/lib/pages/two-factor/two-factor-code/two-factor-code.component.ts","../../../../libs/modules/auth/client/src/lib/pages/two-factor/two-factor-code/two-factor-code.component.html"],"sourcesContent":["import { AXButtonModule } from '@acorex/components/button';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXFormComponent, AXFormModule } from '@acorex/components/form';\nimport { AXLabelModule } from '@acorex/components/label';\nimport { AXLoadingModule } from '@acorex/components/loading';\nimport { AXTextBoxModule } from '@acorex/components/text-box';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationModule, AXTranslationService } from '@acorex/core/translation';\nimport { AXValidationModule } from '@acorex/core/validation';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPHomePageService } from '@acorex-platform/framework-client/common';\nimport { AXM_TWO_FACTOR_ERROR_CODES } from '@acorex-platform/module-security-management-client/contracts';\nimport { CommonModule } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n OnInit,\n ViewChild,\n ViewEncapsulation,\n inject,\n} from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { ActivatedRoute, Router, RouterModule } from '@angular/router';\nimport { BehaviorSubject, firstValueFrom } from 'rxjs';\n\nimport { AXMAuthPlatformSettingsService } from '../../../auth-platform-settings.service';\nimport {\n clearTwoFactorChallenge,\n readTwoFactorChallenge,\n} from '../two-factor-challenge.storage';\n\n//#region ----- Constants -----\n\nconst TWO_FACTOR_ERROR_I18N: Record<string, string> = {\n [AXM_TWO_FACTOR_ERROR_CODES.InvalidInput]: '@auth:twofactor.errors.invalid-input',\n [AXM_TWO_FACTOR_ERROR_CODES.IncorrectCode]: '@auth:twofactor.errors.incorrect-code',\n [AXM_TWO_FACTOR_ERROR_CODES.ChallengeExpired]: '@auth:twofactor.errors.challenge-expired',\n [AXM_TWO_FACTOR_ERROR_CODES.RateLimited]: '@auth:twofactor.errors.rate-limited',\n [AXM_TWO_FACTOR_ERROR_CODES.InvalidConfiguration]: '@auth:twofactor.errors.invalid-configuration',\n [AXM_TWO_FACTOR_ERROR_CODES.NotEnabled]: '@auth:twofactor.errors.not-enabled',\n};\n\nconst CHALLENGE_CLEARING_CODES = new Set<string>([\n AXM_TWO_FACTOR_ERROR_CODES.ChallengeExpired,\n AXM_TWO_FACTOR_ERROR_CODES.InvalidConfiguration,\n AXM_TWO_FACTOR_ERROR_CODES.NotEnabled,\n]);\n\n//#endregion\n\n//#region ----- Module Imports -----\n\nconst MODULES = [\n CommonModule,\n FormsModule,\n AXFormModule,\n AXTextBoxModule,\n AXButtonModule,\n AXLabelModule,\n AXDecoratorModule,\n AXTranslationModule,\n AXLoadingModule,\n RouterModule,\n AXValidationModule,\n];\n\n//#endregion\n\n//#region ----- Component -----\n\n@Component({\n selector: 'axp-auth-two-factor-code',\n templateUrl: './two-factor-code.component.html',\n imports: [...MODULES],\n changeDetection: ChangeDetectionStrategy.Eager,\n encapsulation: ViewEncapsulation.None,\n})\nexport class AXPAuthTwoFactorCodeComponent implements OnInit {\n //#region ----- Services & Dependencies -----\n\n private readonly sessionService = inject(AXPSessionService);\n private readonly authPlatformSettings = inject(AXMAuthPlatformSettingsService);\n private readonly homePageService = inject(AXPHomePageService);\n private readonly toastService = inject(AXToastService);\n private readonly translateService = inject(AXTranslationService);\n private readonly router = inject(Router);\n private readonly activateRoute = inject(ActivatedRoute);\n\n //#endregion\n\n //#region ----- Form References -----\n\n @ViewChild(AXFormComponent)\n private form!: AXFormComponent;\n\n //#endregion\n\n //#region ----- State -----\n\n protected code = '';\n protected isLoading$ = new BehaviorSubject<boolean>(false);\n protected submitText = 'twofactor.submit';\n private challengeId = '';\n private rememberMe = false;\n\n //#endregion\n\n //#region ----- Lifecycle -----\n\n ngOnInit(): void {\n const stored = readTwoFactorChallenge();\n if (!stored?.challengeId) {\n void this.router.navigate(['/auth/login'], {\n queryParams: this.activateRoute.snapshot.queryParams,\n });\n return;\n }\n\n this.challengeId = stored.challengeId;\n this.rememberMe = stored.rememberMe;\n }\n\n //#endregion\n\n //#region ----- Event Handlers -----\n\n protected handleBackToLogin(): void {\n clearTwoFactorChallenge();\n void this.router.navigate(['/auth/login'], {\n queryParams: this.activateRoute.snapshot.queryParams,\n });\n }\n\n protected handleVerifyClick(): void {\n const strategyName = this.authPlatformSettings.defaultStrategyName();\n this.sessionService.setStrategy(strategyName);\n const redirectUrl = this.activateRoute.snapshot.queryParams['redirectUrl'];\n\n void this.form.validate().then(async (form) => {\n if (!form.result) {\n return;\n }\n\n const trimmedCode = this.code.trim();\n if (!trimmedCode || !this.challengeId) {\n return;\n }\n\n this.isLoading$.next(true);\n this.submitText = 'processing';\n\n try {\n await this.sessionService.signin({\n strategy: strategyName,\n username: '',\n password: '',\n challengeId: this.challengeId,\n code: trimmedCode,\n rememberMe: this.rememberMe,\n });\n\n const isAuthenticated = await firstValueFrom(this.sessionService.isAuthenticated$);\n if (!isAuthenticated) {\n throw new Error('Authentication failed after two-factor verification');\n }\n\n clearTwoFactorChallenge();\n await this.navigateAfterAuth(redirectUrl);\n } catch (error: unknown) {\n await this.handleVerifyError(error);\n } finally {\n this.submitText = 'twofactor.submit';\n this.isLoading$.next(false);\n }\n });\n }\n\n //#endregion\n\n //#region ----- Private Helpers -----\n\n private async navigateAfterAuth(redirectUrl?: string): Promise<void> {\n if (this.sessionService.tenant?.id == null) {\n await this.router.navigate(['/auth/account/tenant-chooser']);\n return;\n }\n\n if (this.sessionService.application?.id == null) {\n await this.router.navigate(['/auth/account/app-chooser']);\n return;\n }\n\n if (redirectUrl) {\n await this.router.navigate([redirectUrl]);\n return;\n }\n\n await this.homePageService.navigateTo();\n }\n\n private async handleVerifyError(error: unknown): Promise<void> {\n const apiError = this.extractApiError(error);\n const errorCode =\n (typeof apiError?.['error'] === 'string' && apiError['error']) ||\n (typeof apiError?.['code'] === 'string' && apiError['code']) ||\n '';\n\n const messageKey = TWO_FACTOR_ERROR_I18N[errorCode] ?? '@auth:twofactor.errors.verify-failed';\n const content = await this.translateService.translateAsync(messageKey);\n\n this.toastService.show({\n color: 'danger',\n content,\n timeOut: 5000,\n });\n\n this.code = '';\n\n if (CHALLENGE_CLEARING_CODES.has(errorCode)) {\n clearTwoFactorChallenge();\n await this.router.navigate(['/auth/login'], {\n queryParams: this.activateRoute.snapshot.queryParams,\n });\n }\n }\n\n private extractApiError(error: unknown): Record<string, unknown> | null {\n if (!error || typeof error !== 'object') {\n return null;\n }\n\n const err = error as Record<string, unknown>;\n if (err['apiError'] && typeof err['apiError'] === 'object') {\n return err['apiError'] as Record<string, unknown>;\n }\n\n if (err['error'] && typeof err['error'] === 'object') {\n return err['error'] as Record<string, unknown>;\n }\n\n return null;\n }\n\n //#endregion\n}\n\n//#endregion\n","<ng-container *translate=\"let t\">\n <div class=\"axp-auth-form\">\n <div class=\"text-center mb-3 lg:mb-5\">\n <h1 class=\"font-bold text-xl mb-1 lg:mb-2\">\n {{ '@auth:twofactor.title' | translate | async }}\n </h1>\n <p class=\"text-base text-neutral-600\">\n {{ '@auth:twofactor.hint' | translate | async }}\n </p>\n </div>\n <div class=\"w-full lg:w-96 mx-auto\">\n <ax-form>\n <div class=\"flex flex-col gap-4 lg:gap-6\">\n <ax-form-field>\n <ax-label class=\"text-start\">{{ '@auth:twofactor.textBoxHint' | translate | async }}</ax-label>\n <ax-text-box\n [name]=\"'twoFactorCode'\"\n id=\"twoFactorCode\"\n [autoComplete]=\"'one-time-code'\"\n [(value)]=\"code\"\n >\n <ax-validation-rule rule=\"required\"></ax-validation-rule>\n </ax-text-box>\n </ax-form-field>\n <ax-button\n class=\"w-full\"\n [text]=\"('@auth:' + submitText) | translate | async\"\n color=\"primary\"\n [disabled]=\"isLoading$ | async\"\n (onClick)=\"handleVerifyClick()\"\n >\n @if (isLoading$ | async) {\n <ax-loading></ax-loading>\n }\n </ax-button>\n <ax-button\n class=\"w-full\"\n look=\"outline\"\n [text]=\"'@auth:twofactor.back-to-login' | translate | async\"\n [disabled]=\"isLoading$ | async\"\n (onClick)=\"handleBackToLogin()\"\n >\n </ax-button>\n </div>\n </ax-form>\n </div>\n </div>\n</ng-container>\n"],"names":["i3","i6","i7"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA;AAEA,MAAM,qBAAqB,GAA2B;AACpD,IAAA,CAAC,0BAA0B,CAAC,YAAY,GAAG,sCAAsC;AACjF,IAAA,CAAC,0BAA0B,CAAC,aAAa,GAAG,uCAAuC;AACnF,IAAA,CAAC,0BAA0B,CAAC,gBAAgB,GAAG,0CAA0C;AACzF,IAAA,CAAC,0BAA0B,CAAC,WAAW,GAAG,qCAAqC;AAC/E,IAAA,CAAC,0BAA0B,CAAC,oBAAoB,GAAG,8CAA8C;AACjG,IAAA,CAAC,0BAA0B,CAAC,UAAU,GAAG,oCAAoC;CAC9E;AAED,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAS;AAC/C,IAAA,0BAA0B,CAAC,gBAAgB;AAC3C,IAAA,0BAA0B,CAAC,oBAAoB;AAC/C,IAAA,0BAA0B,CAAC,UAAU;AACtC,CAAA,CAAC;AAEF;AAE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EAAA,MAAA,EAAA,IAAA,EAAA,EAAA,CAAA,gBAAA,EAAA,IAAA,EAAA,WAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,KAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA,CAAA;;2FAcP,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBAPzC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,0BAA0B,EAAA,OAAA,EAE3B,CAAC,GAAG,OAAO,CAAC,EAAA,eAAA,EACJ,uBAAuB,CAAC,KAAK,EAAA,aAAA,EAC/B,iBAAiB,CAAC,IAAI,EAAA,QAAA,EAAA,oqDAAA,EAAA;;sBAiBpC,SAAS;uBAAC,eAAe;;;"}
|
|
@@ -6,7 +6,7 @@ function routesFactory() {
|
|
|
6
6
|
const routes = [
|
|
7
7
|
{
|
|
8
8
|
path: 'twofactor',
|
|
9
|
-
loadComponent: () => import('./acorex-platform-module-auth-client-two-factor-code.component-
|
|
9
|
+
loadComponent: () => import('./acorex-platform-module-auth-client-two-factor-code.component-B1334bPg.mjs').then((c) => c.AXPAuthTwoFactorCodeComponent),
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
12
|
path: 'two-step',
|
|
@@ -44,4 +44,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
44
44
|
}] });
|
|
45
45
|
|
|
46
46
|
export { AXPTwoFactorModule };
|
|
47
|
-
//# sourceMappingURL=acorex-platform-module-auth-client-two-factor.module-
|
|
47
|
+
//# sourceMappingURL=acorex-platform-module-auth-client-two-factor.module-C0mkbR4X.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-auth-client-two-factor.module-
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-auth-client-two-factor.module-C0mkbR4X.mjs","sources":["../../../../libs/modules/auth/client/src/lib/pages/two-factor/two-factor.module.ts"],"sourcesContent":["import { NgModule } from '@angular/core';\nimport { ROUTES, Routes } from '@angular/router';\n\nfunction routesFactory() {\n const routes: Routes = [\n {\n path: 'twofactor',\n loadComponent: () =>\n import('./two-factor-code/two-factor-code.component').then((c) => c.AXPAuthTwoFactorCodeComponent),\n },\n {\n path: 'two-step',\n redirectTo: 'twofactor',\n pathMatch: 'full',\n },\n ];\n return routes;\n}\n\n@NgModule({\n declarations: [],\n imports: [],\n exports: [],\n providers: [\n {\n provide: ROUTES,\n multi: true,\n useFactory: routesFactory,\n },\n ],\n})\nexport class AXPTwoFactorModule {}\n"],"names":[],"mappings":";;;;AAGA,SAAS,aAAa,GAAA;AACpB,IAAA,MAAM,MAAM,GAAW;AACrB,QAAA;AACE,YAAA,IAAI,EAAE,WAAW;AACjB,YAAA,aAAa,EAAE,MACb,OAAO,6EAA6C,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,6BAA6B,CAAC;AACrG,SAAA;AACD,QAAA;AACE,YAAA,IAAI,EAAE,UAAU;AAChB,YAAA,UAAU,EAAE,WAAW;AACvB,YAAA,SAAS,EAAE,MAAM;AAClB,SAAA;KACF;AACD,IAAA,OAAO,MAAM;AACf;MAca,kBAAkB,CAAA;8GAAlB,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAAlB,kBAAkB,EAAA,CAAA,CAAA;AAAlB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,EAAA,SAAA,EARlB;AACT,YAAA;AACE,gBAAA,OAAO,EAAE,MAAM;AACf,gBAAA,KAAK,EAAE,IAAI;AACX,gBAAA,UAAU,EAAE,aAAa;AAC1B,aAAA;AACF,SAAA,EAAA,CAAA,CAAA;;2FAEU,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAZ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,SAAS,EAAE;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,MAAM;AACf,4BAAA,KAAK,EAAE,IAAI;AACX,4BAAA,UAAU,EAAE,aAAa;AAC1B,yBAAA;AACF,qBAAA;AACF,iBAAA;;;"}
|
|
@@ -3,7 +3,7 @@ import { AXPLayoutBuilderService } from '@acorex-platform/framework-client/layou
|
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
4
|
import { inject, Injectable } from '@angular/core';
|
|
5
5
|
import { isEmpty } from 'lodash';
|
|
6
|
-
import { t as AXPLoginHistoryService } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-
|
|
6
|
+
import { t as AXPLoginHistoryService } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-DINrCCAx.mjs';
|
|
7
7
|
|
|
8
8
|
//#region ---- View login history command ----
|
|
9
9
|
/** Opens a read-only dialog listing recent sign-in attempts for the current user. */
|
|
@@ -104,4 +104,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
104
104
|
}] });
|
|
105
105
|
|
|
106
106
|
export { AXPViewLoginHistoryCommand };
|
|
107
|
-
//# sourceMappingURL=acorex-platform-module-auth-client-view-login-history.command-
|
|
107
|
+
//# sourceMappingURL=acorex-platform-module-auth-client-view-login-history.command-CerhsvHF.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-auth-client-view-login-history.command-
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-auth-client-view-login-history.command-CerhsvHF.mjs","sources":["../../../../libs/modules/auth/client/src/lib/commands/view-login-history.command.ts"],"sourcesContent":["import { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPLayoutBuilderService } from '@acorex-platform/framework-client/layout/builder';\n\nimport { inject, Injectable } from '@angular/core';\nimport { isEmpty } from 'lodash';\nimport { AXPLoginHistoryEntry, AXPLoginHistoryService } from '../shared/services/login-history.service';\n\n//#region ---- View login history command ----\n\n/** Opens a read-only dialog listing recent sign-in attempts for the current user. */\n@Injectable({ providedIn: 'root' })\nexport class AXPViewLoginHistoryCommand implements AXPCommand {\n //#region ---- Services & Dependencies ----\n\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly loginHistoryService = inject(AXPLoginHistoryService);\n private readonly translateService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command ----\n\n async execute(): AXPCommandExecuteResultPromise<void> {\n const entries = await this.loginHistoryService.getEntries();\n const rows = await this.buildRows(entries);\n\n const dialogTitle = await this.translateService.translateAsync(\n '@auth:profile-page.commands.view-login-history.dialog.title',\n );\n\n await this.layoutBuilder\n .create()\n .dialog((dialog) => {\n dialog.setTitle(dialogTitle).setSize('lg').setCloseButton(true);\n\n if (isEmpty(rows)) {\n dialog.setMessage('@auth:profile-page.commands.view-login-history.empty');\n } else {\n dialog.content((layout) => {\n layout.list((list) => {\n list\n .setDataSource(rows)\n .setColumns([\n {\n name: 'lastLoginDate',\n title: '@auth:profile-page.commands.view-login-history.columns.date',\n width: '180px',\n widget: {\n type: 'date-time-editor',\n path: 'lastLoginDate',\n options: { format: 'datetime', readOnly: true },\n },\n },\n {\n name: 'device',\n title: '@auth:profile-page.commands.view-login-history.columns.device',\n widget: { type: 'text-editor', path: 'device', options: { readOnly: true } },\n },\n {\n name: 'location',\n title: '@auth:profile-page.commands.view-login-history.columns.location',\n widget: { type: 'text-editor', path: 'location', options: { readOnly: true } },\n },\n {\n name: 'ipAddress',\n title: '@auth:profile-page.commands.view-login-history.columns.ip-address',\n width: '140px',\n widget: { type: 'text-editor', path: 'ipAddress', options: { readOnly: true } },\n },\n {\n name: 'browser',\n title: '@auth:profile-page.commands.view-login-history.columns.browser',\n widget: { type: 'text-editor', path: 'browser', options: { readOnly: true } },\n },\n {\n name: 'statusLabel',\n title: '@auth:profile-page.commands.view-login-history.columns.status',\n width: '120px',\n widget: { type: 'text-editor', path: 'statusLabel', options: { readOnly: true } },\n },\n ])\n .setPaging(true)\n .setShowHeader(true)\n .setAllowSelection(false)\n .setMinHeight(360);\n });\n });\n }\n })\n .show();\n\n return {\n success: true,\n kind: 'object',\n data: undefined,\n metadata: { refresh: false },\n };\n }\n\n //#endregion\n\n //#region ---- Utility Methods ----\n\n private async buildRows(\n entries: AXPLoginHistoryEntry[],\n ): Promise<Array<AXPLoginHistoryEntry & { statusLabel: string }>> {\n return Promise.all(\n entries.map(async (entry) => ({\n ...entry,\n statusLabel: await this.translateService.translateAsync(\n `@auth:profile-page.commands.view-login-history.status.${entry.status}`,\n ),\n })),\n );\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;AAQA;AAEA;MAEa,0BAA0B,CAAA;AADvC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,uBAAuB,CAAC;AAC/C,QAAA,IAAA,CAAA,mBAAmB,GAAG,MAAM,CAAC,sBAAsB,CAAC;AACpD,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAqGjE,IAAA;;;AA/FC,IAAA,MAAM,OAAO,GAAA;QACX,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,UAAU,EAAE;QAC3D,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;QAE1C,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAC5D,6DAA6D,CAC9D;QAED,MAAM,IAAI,CAAC;AACR,aAAA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AAC,cAAc,CACrD,CAAA,sDAAA,EAAyD,KAAK,CAAC,MAAM,EAAE,CACxE;SACF,CAAC,CAAC,CACJ;IACH;8GAvGW,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA1B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,0BAA0B,cADb,MAAM,EAAA,CAAA,CAAA;;2FACnB,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBADtC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import * as i1$1 from '@acorex/components/button';
|
|
2
|
+
import { AXButtonModule } from '@acorex/components/button';
|
|
3
|
+
import { AXDecoratorModule } from '@acorex/components/decorators';
|
|
4
|
+
import { AXLoadingModule } from '@acorex/components/loading';
|
|
5
|
+
import * as i3 from '@acorex/components/skeleton';
|
|
6
|
+
import { AXSkeletonModule } from '@acorex/components/skeleton';
|
|
7
|
+
import * as i2 from '@acorex/components/text-box';
|
|
8
|
+
import { AXTextBoxModule } from '@acorex/components/text-box';
|
|
9
|
+
import { AXToastService } from '@acorex/components/toast';
|
|
10
|
+
import { AXFormatService } from '@acorex/core/format';
|
|
11
|
+
import * as i5$1 from '@acorex/core/translation';
|
|
12
|
+
import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
|
|
13
|
+
import { AXPSessionService } from '@acorex-platform/framework-client/auth';
|
|
14
|
+
import { AXPPlatformBrandingService, AXPSettingsService } from '@acorex-platform/framework-client/common';
|
|
15
|
+
import { AXPEntityLogoRegistrationService, axpTenantLogoKey, axpExtractLogoUrl, AXPLogoComponent } from '@acorex-platform/framework-client/core';
|
|
16
|
+
import { AXPUserAvatarComponent } from '@acorex-platform/framework-client/layout/components';
|
|
17
|
+
import { AXPCommandService } from '@acorex-platform/framework-client/runtime';
|
|
18
|
+
import { AXPRegionalSetting } from '@acorex-platform/framework-shared/core';
|
|
19
|
+
import { AXM_MEMBERSHIP_INVITE_WAITING_ROOM_SOURCE, AXMSecurityManagementServerCommands, AXM_JOIN_REQUEST_ERROR_CODES } from '@acorex-platform/module-security-management-client/contracts';
|
|
20
|
+
import * as i5 from '@angular/common';
|
|
21
|
+
import { CommonModule } from '@angular/common';
|
|
22
|
+
import * as i0 from '@angular/core';
|
|
23
|
+
import { inject, signal, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
24
|
+
import * as i1 from '@angular/forms';
|
|
25
|
+
import { FormsModule } from '@angular/forms';
|
|
26
|
+
import { Router, ActivatedRoute, RouterModule } from '@angular/router';
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region ----- Waiting room -----
|
|
30
|
+
class AXPAuthWaitingRoomComponent {
|
|
31
|
+
constructor() {
|
|
32
|
+
//#region ----- Services & Dependencies -----
|
|
33
|
+
this.sessionService = inject(AXPSessionService);
|
|
34
|
+
this.commandService = inject(AXPCommandService);
|
|
35
|
+
this.translationService = inject(AXTranslationService);
|
|
36
|
+
this.toastService = inject(AXToastService);
|
|
37
|
+
this.platformBranding = inject(AXPPlatformBrandingService);
|
|
38
|
+
this.formatService = inject(AXFormatService);
|
|
39
|
+
this.settingsService = inject(AXPSettingsService);
|
|
40
|
+
this.logoRegistration = inject(AXPEntityLogoRegistrationService);
|
|
41
|
+
this.router = inject(Router);
|
|
42
|
+
this.route = inject(ActivatedRoute);
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region ----- State Signals -----
|
|
45
|
+
this.platformTitle = signal('', /* @ts-ignore */
|
|
46
|
+
...(ngDevMode ? [{ debugName: "platformTitle" }] : /* istanbul ignore next */ []));
|
|
47
|
+
this.loading = signal(true, /* @ts-ignore */
|
|
48
|
+
...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
49
|
+
this.busyId = signal(null, /* @ts-ignore */
|
|
50
|
+
...(ngDevMode ? [{ debugName: "busyId" }] : /* istanbul ignore next */ []));
|
|
51
|
+
this.invitations = signal([], /* @ts-ignore */
|
|
52
|
+
...(ngDevMode ? [{ debugName: "invitations" }] : /* istanbul ignore next */ []));
|
|
53
|
+
this.joinRequests = signal([], /* @ts-ignore */
|
|
54
|
+
...(ngDevMode ? [{ debugName: "joinRequests" }] : /* istanbul ignore next */ []));
|
|
55
|
+
/** True when opened from membership-invite notification or user already has other tenants. */
|
|
56
|
+
this.membershipContext = signal(false, /* @ts-ignore */
|
|
57
|
+
...(ngDevMode ? [{ debugName: "membershipContext" }] : /* istanbul ignore next */ []));
|
|
58
|
+
this.uniqueName = signal('', /* @ts-ignore */
|
|
59
|
+
...(ngDevMode ? [{ debugName: "uniqueName" }] : /* istanbul ignore next */ []));
|
|
60
|
+
this.submitBusy = signal(false, /* @ts-ignore */
|
|
61
|
+
...(ngDevMode ? [{ debugName: "submitBusy" }] : /* istanbul ignore next */ []));
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region ----- Computed Properties -----
|
|
64
|
+
this.titleKey = computed(() => this.membershipContext()
|
|
65
|
+
? '@auth:waiting-room.membership-invite.title'
|
|
66
|
+
: '@auth:waiting-room.title', /* @ts-ignore */
|
|
67
|
+
...(ngDevMode ? [{ debugName: "titleKey" }] : /* istanbul ignore next */ []));
|
|
68
|
+
this.descriptionKey = computed(() => this.membershipContext()
|
|
69
|
+
? '@auth:waiting-room.membership-invite.description'
|
|
70
|
+
: '@auth:waiting-room.description', /* @ts-ignore */
|
|
71
|
+
...(ngDevMode ? [{ debugName: "descriptionKey" }] : /* istanbul ignore next */ []));
|
|
72
|
+
this.canSubmitJoinRequest = computed(() => this.uniqueName().trim().length > 0 && !this.submitBusy(), /* @ts-ignore */
|
|
73
|
+
...(ngDevMode ? [{ debugName: "canSubmitJoinRequest" }] : /* istanbul ignore next */ []));
|
|
74
|
+
}
|
|
75
|
+
get user() {
|
|
76
|
+
return this.sessionService.user;
|
|
77
|
+
}
|
|
78
|
+
tenantLogoKey(tenantId) {
|
|
79
|
+
return axpTenantLogoKey(tenantId);
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region ----- Lifecycle -----
|
|
83
|
+
async ngOnInit() {
|
|
84
|
+
const title = await this.platformBranding.resolvePlatformTitle().catch(() => '');
|
|
85
|
+
this.platformTitle.set(title || 'ACoreX');
|
|
86
|
+
// After admin approves a join request, a refresh must leave the waiting room.
|
|
87
|
+
if (await this.redirectIfMembershipAvailable()) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const source = String(this.route.snapshot.queryParamMap.get('source') ?? '').trim();
|
|
91
|
+
const fromInvite = source === AXM_MEMBERSHIP_INVITE_WAITING_ROOM_SOURCE;
|
|
92
|
+
this.membershipContext.set(fromInvite);
|
|
93
|
+
await this.reloadLists();
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region ----- Event Handlers -----
|
|
97
|
+
/**
|
|
98
|
+
* Refresh clears the in-memory tenants catalog cache (hard navigation), then the
|
|
99
|
+
* tenant-chooser guard sends the user back here only when still without membership.
|
|
100
|
+
*/
|
|
101
|
+
async reload() {
|
|
102
|
+
if (typeof window !== 'undefined') {
|
|
103
|
+
window.location.assign('/auth/account/tenant-chooser');
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (await this.redirectIfMembershipAvailable()) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
await this.reloadLists();
|
|
110
|
+
}
|
|
111
|
+
onUniqueNameChange(event) {
|
|
112
|
+
const next = typeof event?.value === 'string' ? event.value : String(event?.value ?? '');
|
|
113
|
+
this.uniqueName.set(next);
|
|
114
|
+
}
|
|
115
|
+
async submitJoinRequest() {
|
|
116
|
+
const uniqueName = this.uniqueName().trim();
|
|
117
|
+
if (!uniqueName || this.submitBusy()) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
this.submitBusy.set(true);
|
|
121
|
+
try {
|
|
122
|
+
const result = await this.commandService.execute(AXMSecurityManagementServerCommands.RequestTenantMembership, { uniqueName });
|
|
123
|
+
if (!result?.success) {
|
|
124
|
+
const text = await this.joinRequestErrorText(result);
|
|
125
|
+
this.toastService.show({ color: 'danger', content: text, timeOut: 4000 });
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const ok = await this.translationService
|
|
129
|
+
.translateAsync('@auth:waiting-room.join-request.submit-success')
|
|
130
|
+
.catch(() => 'Membership request sent. An administrator will review it.');
|
|
131
|
+
this.toastService.show({ color: 'success', content: ok, timeOut: 3000 });
|
|
132
|
+
this.uniqueName.set('');
|
|
133
|
+
await this.reloadJoinRequests();
|
|
134
|
+
}
|
|
135
|
+
finally {
|
|
136
|
+
this.submitBusy.set(false);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
async cancelJoinRequest(item) {
|
|
140
|
+
this.busyId.set(item.tenantUserId);
|
|
141
|
+
try {
|
|
142
|
+
const result = await this.commandService.execute(AXMSecurityManagementServerCommands.CancelMyJoinRequest, { tenantUserId: item.tenantUserId });
|
|
143
|
+
if (!result?.success) {
|
|
144
|
+
const text = await this.joinRequestErrorText(result);
|
|
145
|
+
this.toastService.show({ color: 'danger', content: text, timeOut: 4000 });
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
await this.reloadJoinRequests();
|
|
149
|
+
}
|
|
150
|
+
finally {
|
|
151
|
+
this.busyId.set(null);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
async accept(item) {
|
|
155
|
+
this.busyId.set(item.tenantUserId);
|
|
156
|
+
try {
|
|
157
|
+
let newPassword;
|
|
158
|
+
// First attempt without password; if server requires one, prompt once.
|
|
159
|
+
let result = await this.commandService.execute(AXMSecurityManagementServerCommands.AcceptMyInvitation, { tenantUserId: item.tenantUserId });
|
|
160
|
+
const needsPassword = !result?.success &&
|
|
161
|
+
typeof result?.message?.text === 'string' &&
|
|
162
|
+
result.message.text.toLowerCase().includes('password');
|
|
163
|
+
if (needsPassword) {
|
|
164
|
+
const promptTitle = await this.translationService
|
|
165
|
+
.translateAsync('@auth:waiting-room.set-password-title')
|
|
166
|
+
.catch(() => 'Set Password');
|
|
167
|
+
const promptMessage = await this.translationService
|
|
168
|
+
.translateAsync('@auth:waiting-room.set-password-message')
|
|
169
|
+
.catch(() => 'Choose a password to activate your account (min 6 characters).');
|
|
170
|
+
newPassword = window.prompt(`${promptTitle}\n${promptMessage}`) ?? undefined;
|
|
171
|
+
if (!newPassword || newPassword.length < 6) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
result = await this.commandService.execute(AXMSecurityManagementServerCommands.AcceptMyInvitation, { tenantUserId: item.tenantUserId, newPassword });
|
|
175
|
+
}
|
|
176
|
+
if (!result?.success) {
|
|
177
|
+
const fallback = await this.translationService
|
|
178
|
+
.translateAsync('@auth:waiting-room.accept-failed')
|
|
179
|
+
.catch(() => 'Could not accept the invitation.');
|
|
180
|
+
const text = (typeof result?.message?.text === 'string' && result.message.text) || fallback;
|
|
181
|
+
this.toastService.show({ color: 'danger', title: text, content: text, timeOut: 4000 });
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const ok = await this.translationService
|
|
185
|
+
.translateAsync('@auth:waiting-room.accept-success')
|
|
186
|
+
.catch(() => 'Invitation accepted. Choose a tenant to continue.');
|
|
187
|
+
this.toastService.show({ color: 'success', title: ok, content: ok, timeOut: 3000 });
|
|
188
|
+
// Hard reload clears the in-memory tenants catalog cache so the chooser
|
|
189
|
+
// sees the newly activated membership (no public invalidate API yet).
|
|
190
|
+
if (typeof window !== 'undefined') {
|
|
191
|
+
window.location.assign('/auth/account/tenant-chooser');
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
await this.router.navigate(['/auth/account/tenant-chooser']);
|
|
195
|
+
}
|
|
196
|
+
finally {
|
|
197
|
+
this.busyId.set(null);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
async decline(item) {
|
|
201
|
+
this.busyId.set(item.tenantUserId);
|
|
202
|
+
try {
|
|
203
|
+
const result = await this.commandService.execute(AXMSecurityManagementServerCommands.DeclineInvitation, { tenantUserId: item.tenantUserId });
|
|
204
|
+
if (!result?.success) {
|
|
205
|
+
const fallback = await this.translationService
|
|
206
|
+
.translateAsync('@auth:waiting-room.decline-failed')
|
|
207
|
+
.catch(() => 'Could not decline the invitation.');
|
|
208
|
+
const text = (typeof result?.message?.text === 'string' && result.message.text) || fallback;
|
|
209
|
+
this.toastService.show({ color: 'danger', title: text, content: text, timeOut: 4000 });
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
await this.reloadLists();
|
|
213
|
+
}
|
|
214
|
+
finally {
|
|
215
|
+
this.busyId.set(null);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
async signOut() {
|
|
219
|
+
await this.sessionService.signout().catch(() => undefined);
|
|
220
|
+
await this.router.navigate(['/auth/login']);
|
|
221
|
+
}
|
|
222
|
+
async goBack() {
|
|
223
|
+
await this.router.navigate(['/auth/account/tenant-chooser']);
|
|
224
|
+
}
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region ----- Data Loading -----
|
|
227
|
+
/** Returns true when navigation away from the waiting room was started. */
|
|
228
|
+
async redirectIfMembershipAvailable() {
|
|
229
|
+
const tenants = await this.sessionService.getTenantsList().catch(() => []);
|
|
230
|
+
if (!Array.isArray(tenants) || tenants.length === 0) {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
await this.router.navigate(['/auth/account/tenant-chooser']);
|
|
234
|
+
return true;
|
|
235
|
+
}
|
|
236
|
+
async reloadLists() {
|
|
237
|
+
this.loading.set(true);
|
|
238
|
+
try {
|
|
239
|
+
await Promise.all([this.reloadInvitations(), this.reloadJoinRequests()]);
|
|
240
|
+
}
|
|
241
|
+
finally {
|
|
242
|
+
this.loading.set(false);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
async reloadInvitations() {
|
|
246
|
+
const result = await this.commandService.execute(AXMSecurityManagementServerCommands.ListMyPendingInvitations, {});
|
|
247
|
+
const items = result?.data?.items ?? [];
|
|
248
|
+
const rows = Array.isArray(items) ? items : [];
|
|
249
|
+
this.registerTenantLogos(rows);
|
|
250
|
+
this.invitations.set(await Promise.all(rows.map(async (item) => ({
|
|
251
|
+
...item,
|
|
252
|
+
expiresAtLabel: await this.formatExpiresAt(item.expiresAt),
|
|
253
|
+
}))));
|
|
254
|
+
}
|
|
255
|
+
async reloadJoinRequests() {
|
|
256
|
+
try {
|
|
257
|
+
const result = await this.commandService.execute(AXMSecurityManagementServerCommands.ListMyJoinRequests, {});
|
|
258
|
+
const items = result?.data?.items ?? [];
|
|
259
|
+
const rows = Array.isArray(items) ? items : [];
|
|
260
|
+
this.registerTenantLogos(rows);
|
|
261
|
+
this.joinRequests.set(await Promise.all(rows.map(async (item) => ({
|
|
262
|
+
...item,
|
|
263
|
+
expiresAtLabel: await this.formatExpiresAt(item.expiresAt),
|
|
264
|
+
}))));
|
|
265
|
+
}
|
|
266
|
+
catch {
|
|
267
|
+
this.joinRequests.set([]);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
registerTenantLogos(rows) {
|
|
271
|
+
for (const row of rows) {
|
|
272
|
+
const tenantId = typeof row.tenantId === 'string' ? row.tenantId.trim() : '';
|
|
273
|
+
if (!tenantId) {
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
this.logoRegistration.registerTenant({
|
|
277
|
+
id: tenantId,
|
|
278
|
+
title: row.tenantTitle,
|
|
279
|
+
logo: axpExtractLogoUrl(row.tenantLogo) ?? row.tenantLogo,
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
//#endregion
|
|
284
|
+
//#region ----- Display -----
|
|
285
|
+
async joinRequestErrorText(result) {
|
|
286
|
+
const code = typeof result?.message?.code === 'string' ? result.message.code : '';
|
|
287
|
+
const keyByCode = {
|
|
288
|
+
[AXM_JOIN_REQUEST_ERROR_CODES.AlreadyMember]: '@auth:waiting-room.join-request.errors.already-member',
|
|
289
|
+
[AXM_JOIN_REQUEST_ERROR_CODES.InvitePending]: '@auth:waiting-room.join-request.errors.invite-pending',
|
|
290
|
+
[AXM_JOIN_REQUEST_ERROR_CODES.TenantNotFound]: '@auth:waiting-room.join-request.errors.not-found',
|
|
291
|
+
[AXM_JOIN_REQUEST_ERROR_CODES.NotPending]: '@auth:waiting-room.join-request.errors.not-pending',
|
|
292
|
+
};
|
|
293
|
+
const key = keyByCode[code] ?? '@auth:waiting-room.join-request.submit-failed';
|
|
294
|
+
return this.translationService.translateAsync(key).catch(() => 'Could not send the request.');
|
|
295
|
+
}
|
|
296
|
+
async formatExpiresAt(iso) {
|
|
297
|
+
const parsed = iso ? Date.parse(iso) : Number.NaN;
|
|
298
|
+
if (!Number.isFinite(parsed)) {
|
|
299
|
+
return '';
|
|
300
|
+
}
|
|
301
|
+
const dateFormat = await this.settingsService.get(AXPRegionalSetting.ShortDate);
|
|
302
|
+
const timeFormat = await this.settingsService.get(AXPRegionalSetting.ShortTime);
|
|
303
|
+
const format = `${dateFormat} ${timeFormat}`.trim();
|
|
304
|
+
return String(this.formatService.format(new Date(parsed), 'datetime', { format }) ?? '');
|
|
305
|
+
}
|
|
306
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPAuthWaitingRoomComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
307
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXPAuthWaitingRoomComponent, isStandalone: true, selector: "axp-auth-waiting-room", ngImport: i0, template: "<main class=\"axp-auth-chooser\">\n <div class=\"axp-auth-chooser__inner\">\n <section class=\"axp-auth-chooser__brand\">\n <axp-logo\n logoKey=\"platform\"\n appearance=\"onLight\"\n format=\"full\"\n [size]=\"260\"\n [attr.alt]=\"platformTitle()\"\n ></axp-logo>\n </section>\n\n <section class=\"axp-auth-chooser__card-wrap\">\n <div class=\"axp-auth-chooser__card\">\n <!-- ----- Loading skeleton while invitations are fetched ----- -->\n @if (loading()) {\n <ax-skeleton [animated]=\"true\" class=\"size-[72px] rounded-full shrink-0\"></ax-skeleton>\n <ax-skeleton [animated]=\"true\" class=\"h-6 w-56 max-w-full\"></ax-skeleton>\n }\n <!-- ----- Signed-in identity for the waiting room ----- -->\n @else {\n <axp-user-avatar\n [size]=\"72\"\n [userId]=\"user?.id!\"\n [showPresence]=\"false\"\n ></axp-user-avatar>\n <h2 class=\"md:text-lg font-medium\">\n {{ titleKey() | translate | async }}\n </h2>\n <p class=\"text-neutral-500 text-sm md:text-base font-medium\">\n {{ descriptionKey() | translate | async }}\n </p>\n <p class=\"text-sm text-neutral-600 m-0\">\n {{ user?.title || user?.name }}\n </p>\n }\n\n <div class=\"mt-4 w-full flex flex-col gap-3 text-start\">\n <!-- ----- Request membership by unique tenant name ----- -->\n <h3 class=\"text-sm font-semibold m-0\">\n {{ '@auth:waiting-room.join-request.heading' | translate | async }}\n </h3>\n <p class=\"text-sm text-neutral-500 m-0\">\n {{ '@auth:waiting-room.join-request.help' | translate | async }}\n </p>\n <div class=\"flex flex-col gap-1\">\n <span class=\"text-xs text-neutral-500\">\n {{ '@auth:waiting-room.join-request.unique-name' | translate | async }}\n </span>\n <ax-text-box\n [ngModel]=\"uniqueName()\"\n (onValueChanged)=\"onUniqueNameChange($event)\"\n [placeholder]=\"('@auth:waiting-room.join-request.placeholder' | translate | async) ?? ''\"\n ></ax-text-box>\n </div>\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@auth:waiting-room.join-request.submit' | translate | async\"\n [disabled]=\"!canSubmitJoinRequest()\"\n (onClick)=\"submitJoinRequest()\"\n ></ax-button>\n\n <!-- ----- Pending join requests waiting for admin review ----- -->\n @if (joinRequests().length > 0) {\n <h3 class=\"text-sm font-semibold m-0 mt-2\">\n {{ '@auth:waiting-room.join-request.pending-heading' | translate | async }}\n </h3>\n @for (item of joinRequests(); track item.tenantUserId) {\n <div\n class=\"flex flex-col gap-2 p-3 rounded-md border border-neutral-100 dark:border-neutral-800\"\n [class.opacity-50]=\"busyId() === item.tenantUserId\"\n >\n <div class=\"flex items-center gap-3\">\n <div class=\"shrink-0 size-9 overflow-hidden rounded-md grid place-items-center\">\n <axp-logo\n [logoKey]=\"tenantLogoKey(item.tenantId)\"\n appearance=\"colored\"\n [size]=\"36\"\n class=\"size-9 overflow-hidden\"\n ></axp-logo>\n </div>\n <div class=\"font-medium\">\n {{ item.tenantTitle || item.tenantName || item.tenantId }}\n </div>\n </div>\n <!-- ----- Show request expiry when present ----- -->\n @if (item.expiresAtLabel) {\n <div class=\"text-xs text-neutral-500\">\n {{\n '@auth:waiting-room.expires-at'\n | translate: { params: { datetime: item.expiresAtLabel } }\n | async\n }}\n </div>\n }\n <ax-button\n look=\"outline\"\n color=\"default\"\n [text]=\"'@auth:waiting-room.join-request.cancel' | translate | async\"\n [disabled]=\"!!busyId() || submitBusy()\"\n (onClick)=\"cancelJoinRequest(item)\"\n ></ax-button>\n </div>\n }\n }\n\n <h3 class=\"text-sm font-semibold m-0\">\n {{ '@auth:waiting-room.invitations-heading' | translate | async }}\n </h3>\n\n <!-- ----- Invitation list loading placeholders ----- -->\n @if (loading()) {\n @for (n of [1, 2]; track n) {\n <ax-skeleton [animated]=\"true\" class=\"h-16 w-full rounded-md\"></ax-skeleton>\n }\n }\n <!-- ----- Empty state when there are no pending invitations ----- -->\n @else if (invitations().length === 0) {\n <p class=\"text-sm text-neutral-500 m-0\">\n {{ '@auth:waiting-room.empty' | translate | async }}\n </p>\n }\n <!-- ----- Pending invitation cards with accept / decline ----- -->\n @else {\n @for (item of invitations(); track item.tenantUserId) {\n <div\n class=\"flex flex-col gap-2 p-3 rounded-md border border-neutral-100 dark:border-neutral-800\"\n [class.opacity-50]=\"busyId() === item.tenantUserId\"\n >\n <div class=\"flex items-center gap-3\">\n <div class=\"shrink-0 size-9 overflow-hidden rounded-md grid place-items-center\">\n <axp-logo\n [logoKey]=\"tenantLogoKey(item.tenantId)\"\n appearance=\"colored\"\n [size]=\"36\"\n class=\"size-9 overflow-hidden\"\n ></axp-logo>\n </div>\n <div class=\"font-medium\">\n {{ item.tenantTitle || item.tenantId }}\n </div>\n </div>\n <!-- ----- Show invitation expiry when present ----- -->\n @if (item.expiresAtLabel) {\n <div class=\"text-xs text-neutral-500\">\n {{\n '@auth:waiting-room.expires-at'\n | translate: { params: { datetime: item.expiresAtLabel } }\n | async\n }}\n </div>\n }\n <div class=\"flex gap-2 flex-wrap\">\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@auth:waiting-room.actions.accept' | translate | async\"\n [disabled]=\"!!busyId()\"\n (onClick)=\"accept(item)\"\n ></ax-button>\n <ax-button\n look=\"outline\"\n color=\"default\"\n [text]=\"'@auth:waiting-room.actions.decline' | translate | async\"\n [disabled]=\"!!busyId()\"\n (onClick)=\"decline(item)\"\n ></ax-button>\n </div>\n </div>\n }\n }\n </div>\n\n <div class=\"mt-4 flex gap-2 flex-wrap justify-center\">\n @if (membershipContext()) {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@auth:waiting-room.actions.back' | translate | async\"\n (onClick)=\"goBack()\"\n ></ax-button>\n }\n <ax-button\n look=\"outline\"\n color=\"default\"\n [text]=\"'@auth:waiting-room.actions.sign-out' | translate | async\"\n (onClick)=\"signOut()\"\n ></ax-button>\n <ax-button\n look=\"outline\"\n color=\"default\"\n [text]=\"'@auth:waiting-room.actions.refresh' | translate | async\"\n (onClick)=\"reload()\"\n ></ax-button>\n </div>\n </div>\n </section>\n </div>\n</main>\n", styles: ["@layer properties;.axp-auth-chooser{display:flex;width:100%;flex-direction:column;align-items:center;overflow-y:auto;background-color:rgba(var(--ax-sys-color-lightest-surface));height:100vh;height:100dvh;-webkit-overflow-scrolling:touch}.axp-auth-chooser__inner{display:flex;width:100%;flex-grow:1;flex-direction:column;align-items:center;justify-content:center;gap:calc(var(--spacing, .25rem) * 6);padding-inline:calc(var(--spacing, .25rem) * 4);min-height:100%;box-sizing:border-box;padding-top:max(2.75rem,calc(env(safe-area-inset-top,0px) + 1.75rem));padding-bottom:max(1.5rem,env(safe-area-inset-bottom,0px))}.axp-auth-chooser__brand{display:flex;width:100%;flex-shrink:0;justify-content:center}.axp-auth-chooser__brand axp-logo{width:min(16.25rem,85vw);max-width:100%}.axp-auth-chooser__card-wrap{display:flex;width:100%;flex-shrink:0;justify-content:center}.axp-auth-chooser__card{display:flex;width:100%;flex-direction:column;align-items:center;justify-content:center;gap:calc(var(--spacing, .25rem) * 4);border-radius:var(--radius-lg, .5rem);border-style:var(--tw-border-style);border-width:0px;padding:calc(var(--spacing, .25rem) * 5);text-align:center;--tw-shadow: 0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);max-width:28rem}.axp-auth-chooser__footer{flex-shrink:0;padding-inline:var(--spacing, .25rem);text-align:center}@media(min-width:640px){.axp-auth-chooser__inner{gap:calc(var(--spacing, .25rem) * 8);padding-inline:calc(var(--spacing, .25rem) * 6);padding-top:max(3rem,calc(env(safe-area-inset-top,0px) + 2rem))}.axp-auth-chooser__brand axp-logo{width:min(16.25rem,90vw)}}@media(min-width:768px){.axp-auth-chooser{background-color:var(--color-bg-default)}.axp-auth-chooser__inner{gap:calc(var(--spacing, .25rem) * 10);padding-inline:calc(var(--spacing, .25rem) * 6);padding-top:3.5rem;padding-bottom:2.5rem}.axp-auth-chooser__card{gap:calc(var(--spacing, .25rem) * 2);border-style:var(--tw-border-style);border-width:1px;padding:calc(var(--spacing, .25rem) * 6);--tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / .1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);width:min(90vw,28rem);max-width:28rem}}@media(min-width:1024px){.axp-auth-chooser__inner{padding-inline:0px;padding-top:3.5rem;padding-bottom:2.5rem}.axp-auth-chooser__card{width:min(90vw,28rem)}}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-inset-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: \"*\"; inherits: false;}@property --tw-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: \"*\"; inherits: false;}@property --tw-inset-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: \"*\"; inherits: false;}@property --tw-ring-offset-width{syntax: \"<length>\"; inherits: false; initial-value: 0px;}@property --tw-ring-offset-color{syntax: \"*\"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid;--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n", ""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: RouterModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i1$1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "ngmodule", type: AXLoadingModule }, { kind: "ngmodule", type: AXSkeletonModule }, { kind: "component", type: i3.AXSkeletonComponent, selector: "ax-skeleton", inputs: ["animated"] }, { kind: "ngmodule", type: AXTextBoxModule }, { kind: "component", type: i2.AXTextBoxComponent, selector: "ax-text-box", inputs: ["disabled", "tabIndex", "readonly", "value", "state", "name", "id", "placeholder", "maxLength", "allowNull", "type", "autoComplete", "look", "maskPattern", "customTokens", "class"], outputs: ["onBlur", "onFocus", "valueChange", "stateChange", "onValueChanged", "readonlyChange", "disabledChange", "onKeyDown", "onKeyUp", "onKeyPress", "onMaskChanged"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "component", type: AXPLogoComponent, selector: "axp-logo", inputs: ["logoKey", "appearance", "size", "format"] }, { kind: "component", type: AXPUserAvatarComponent, selector: "axp-user-avatar", inputs: ["size", "userId", "showPresence", "displayName", "displayAvatar"] }, { kind: "pipe", type: i5.AsyncPipe, name: "async" }, { kind: "pipe", type: i5$1.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
308
|
+
}
|
|
309
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPAuthWaitingRoomComponent, decorators: [{
|
|
310
|
+
type: Component,
|
|
311
|
+
args: [{ selector: 'axp-auth-waiting-room', imports: [
|
|
312
|
+
CommonModule,
|
|
313
|
+
FormsModule,
|
|
314
|
+
RouterModule,
|
|
315
|
+
AXButtonModule,
|
|
316
|
+
AXDecoratorModule,
|
|
317
|
+
AXLoadingModule,
|
|
318
|
+
AXSkeletonModule,
|
|
319
|
+
AXTextBoxModule,
|
|
320
|
+
AXTranslationModule,
|
|
321
|
+
AXPLogoComponent,
|
|
322
|
+
AXPUserAvatarComponent,
|
|
323
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<main class=\"axp-auth-chooser\">\n <div class=\"axp-auth-chooser__inner\">\n <section class=\"axp-auth-chooser__brand\">\n <axp-logo\n logoKey=\"platform\"\n appearance=\"onLight\"\n format=\"full\"\n [size]=\"260\"\n [attr.alt]=\"platformTitle()\"\n ></axp-logo>\n </section>\n\n <section class=\"axp-auth-chooser__card-wrap\">\n <div class=\"axp-auth-chooser__card\">\n <!-- ----- Loading skeleton while invitations are fetched ----- -->\n @if (loading()) {\n <ax-skeleton [animated]=\"true\" class=\"size-[72px] rounded-full shrink-0\"></ax-skeleton>\n <ax-skeleton [animated]=\"true\" class=\"h-6 w-56 max-w-full\"></ax-skeleton>\n }\n <!-- ----- Signed-in identity for the waiting room ----- -->\n @else {\n <axp-user-avatar\n [size]=\"72\"\n [userId]=\"user?.id!\"\n [showPresence]=\"false\"\n ></axp-user-avatar>\n <h2 class=\"md:text-lg font-medium\">\n {{ titleKey() | translate | async }}\n </h2>\n <p class=\"text-neutral-500 text-sm md:text-base font-medium\">\n {{ descriptionKey() | translate | async }}\n </p>\n <p class=\"text-sm text-neutral-600 m-0\">\n {{ user?.title || user?.name }}\n </p>\n }\n\n <div class=\"mt-4 w-full flex flex-col gap-3 text-start\">\n <!-- ----- Request membership by unique tenant name ----- -->\n <h3 class=\"text-sm font-semibold m-0\">\n {{ '@auth:waiting-room.join-request.heading' | translate | async }}\n </h3>\n <p class=\"text-sm text-neutral-500 m-0\">\n {{ '@auth:waiting-room.join-request.help' | translate | async }}\n </p>\n <div class=\"flex flex-col gap-1\">\n <span class=\"text-xs text-neutral-500\">\n {{ '@auth:waiting-room.join-request.unique-name' | translate | async }}\n </span>\n <ax-text-box\n [ngModel]=\"uniqueName()\"\n (onValueChanged)=\"onUniqueNameChange($event)\"\n [placeholder]=\"('@auth:waiting-room.join-request.placeholder' | translate | async) ?? ''\"\n ></ax-text-box>\n </div>\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@auth:waiting-room.join-request.submit' | translate | async\"\n [disabled]=\"!canSubmitJoinRequest()\"\n (onClick)=\"submitJoinRequest()\"\n ></ax-button>\n\n <!-- ----- Pending join requests waiting for admin review ----- -->\n @if (joinRequests().length > 0) {\n <h3 class=\"text-sm font-semibold m-0 mt-2\">\n {{ '@auth:waiting-room.join-request.pending-heading' | translate | async }}\n </h3>\n @for (item of joinRequests(); track item.tenantUserId) {\n <div\n class=\"flex flex-col gap-2 p-3 rounded-md border border-neutral-100 dark:border-neutral-800\"\n [class.opacity-50]=\"busyId() === item.tenantUserId\"\n >\n <div class=\"flex items-center gap-3\">\n <div class=\"shrink-0 size-9 overflow-hidden rounded-md grid place-items-center\">\n <axp-logo\n [logoKey]=\"tenantLogoKey(item.tenantId)\"\n appearance=\"colored\"\n [size]=\"36\"\n class=\"size-9 overflow-hidden\"\n ></axp-logo>\n </div>\n <div class=\"font-medium\">\n {{ item.tenantTitle || item.tenantName || item.tenantId }}\n </div>\n </div>\n <!-- ----- Show request expiry when present ----- -->\n @if (item.expiresAtLabel) {\n <div class=\"text-xs text-neutral-500\">\n {{\n '@auth:waiting-room.expires-at'\n | translate: { params: { datetime: item.expiresAtLabel } }\n | async\n }}\n </div>\n }\n <ax-button\n look=\"outline\"\n color=\"default\"\n [text]=\"'@auth:waiting-room.join-request.cancel' | translate | async\"\n [disabled]=\"!!busyId() || submitBusy()\"\n (onClick)=\"cancelJoinRequest(item)\"\n ></ax-button>\n </div>\n }\n }\n\n <h3 class=\"text-sm font-semibold m-0\">\n {{ '@auth:waiting-room.invitations-heading' | translate | async }}\n </h3>\n\n <!-- ----- Invitation list loading placeholders ----- -->\n @if (loading()) {\n @for (n of [1, 2]; track n) {\n <ax-skeleton [animated]=\"true\" class=\"h-16 w-full rounded-md\"></ax-skeleton>\n }\n }\n <!-- ----- Empty state when there are no pending invitations ----- -->\n @else if (invitations().length === 0) {\n <p class=\"text-sm text-neutral-500 m-0\">\n {{ '@auth:waiting-room.empty' | translate | async }}\n </p>\n }\n <!-- ----- Pending invitation cards with accept / decline ----- -->\n @else {\n @for (item of invitations(); track item.tenantUserId) {\n <div\n class=\"flex flex-col gap-2 p-3 rounded-md border border-neutral-100 dark:border-neutral-800\"\n [class.opacity-50]=\"busyId() === item.tenantUserId\"\n >\n <div class=\"flex items-center gap-3\">\n <div class=\"shrink-0 size-9 overflow-hidden rounded-md grid place-items-center\">\n <axp-logo\n [logoKey]=\"tenantLogoKey(item.tenantId)\"\n appearance=\"colored\"\n [size]=\"36\"\n class=\"size-9 overflow-hidden\"\n ></axp-logo>\n </div>\n <div class=\"font-medium\">\n {{ item.tenantTitle || item.tenantId }}\n </div>\n </div>\n <!-- ----- Show invitation expiry when present ----- -->\n @if (item.expiresAtLabel) {\n <div class=\"text-xs text-neutral-500\">\n {{\n '@auth:waiting-room.expires-at'\n | translate: { params: { datetime: item.expiresAtLabel } }\n | async\n }}\n </div>\n }\n <div class=\"flex gap-2 flex-wrap\">\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@auth:waiting-room.actions.accept' | translate | async\"\n [disabled]=\"!!busyId()\"\n (onClick)=\"accept(item)\"\n ></ax-button>\n <ax-button\n look=\"outline\"\n color=\"default\"\n [text]=\"'@auth:waiting-room.actions.decline' | translate | async\"\n [disabled]=\"!!busyId()\"\n (onClick)=\"decline(item)\"\n ></ax-button>\n </div>\n </div>\n }\n }\n </div>\n\n <div class=\"mt-4 flex gap-2 flex-wrap justify-center\">\n @if (membershipContext()) {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@auth:waiting-room.actions.back' | translate | async\"\n (onClick)=\"goBack()\"\n ></ax-button>\n }\n <ax-button\n look=\"outline\"\n color=\"default\"\n [text]=\"'@auth:waiting-room.actions.sign-out' | translate | async\"\n (onClick)=\"signOut()\"\n ></ax-button>\n <ax-button\n look=\"outline\"\n color=\"default\"\n [text]=\"'@auth:waiting-room.actions.refresh' | translate | async\"\n (onClick)=\"reload()\"\n ></ax-button>\n </div>\n </div>\n </section>\n </div>\n</main>\n", styles: ["@layer properties;.axp-auth-chooser{display:flex;width:100%;flex-direction:column;align-items:center;overflow-y:auto;background-color:rgba(var(--ax-sys-color-lightest-surface));height:100vh;height:100dvh;-webkit-overflow-scrolling:touch}.axp-auth-chooser__inner{display:flex;width:100%;flex-grow:1;flex-direction:column;align-items:center;justify-content:center;gap:calc(var(--spacing, .25rem) * 6);padding-inline:calc(var(--spacing, .25rem) * 4);min-height:100%;box-sizing:border-box;padding-top:max(2.75rem,calc(env(safe-area-inset-top,0px) + 1.75rem));padding-bottom:max(1.5rem,env(safe-area-inset-bottom,0px))}.axp-auth-chooser__brand{display:flex;width:100%;flex-shrink:0;justify-content:center}.axp-auth-chooser__brand axp-logo{width:min(16.25rem,85vw);max-width:100%}.axp-auth-chooser__card-wrap{display:flex;width:100%;flex-shrink:0;justify-content:center}.axp-auth-chooser__card{display:flex;width:100%;flex-direction:column;align-items:center;justify-content:center;gap:calc(var(--spacing, .25rem) * 4);border-radius:var(--radius-lg, .5rem);border-style:var(--tw-border-style);border-width:0px;padding:calc(var(--spacing, .25rem) * 5);text-align:center;--tw-shadow: 0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);max-width:28rem}.axp-auth-chooser__footer{flex-shrink:0;padding-inline:var(--spacing, .25rem);text-align:center}@media(min-width:640px){.axp-auth-chooser__inner{gap:calc(var(--spacing, .25rem) * 8);padding-inline:calc(var(--spacing, .25rem) * 6);padding-top:max(3rem,calc(env(safe-area-inset-top,0px) + 2rem))}.axp-auth-chooser__brand axp-logo{width:min(16.25rem,90vw)}}@media(min-width:768px){.axp-auth-chooser{background-color:var(--color-bg-default)}.axp-auth-chooser__inner{gap:calc(var(--spacing, .25rem) * 10);padding-inline:calc(var(--spacing, .25rem) * 6);padding-top:3.5rem;padding-bottom:2.5rem}.axp-auth-chooser__card{gap:calc(var(--spacing, .25rem) * 2);border-style:var(--tw-border-style);border-width:1px;padding:calc(var(--spacing, .25rem) * 6);--tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / .1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);width:min(90vw,28rem);max-width:28rem}}@media(min-width:1024px){.axp-auth-chooser__inner{padding-inline:0px;padding-top:3.5rem;padding-bottom:2.5rem}.axp-auth-chooser__card{width:min(90vw,28rem)}}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-inset-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: \"*\"; inherits: false;}@property --tw-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: \"*\"; inherits: false;}@property --tw-inset-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: \"*\"; inherits: false;}@property --tw-ring-offset-width{syntax: \"<length>\"; inherits: false; initial-value: 0px;}@property --tw-ring-offset-color{syntax: \"*\"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid;--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
324
|
+
}] });
|
|
325
|
+
|
|
326
|
+
export { AXPAuthWaitingRoomComponent };
|
|
327
|
+
//# sourceMappingURL=acorex-platform-module-auth-client-waiting-room.component-Wu8iPiTm.mjs.map
|