@acorex-platform/module-auth-client 0.0.37 → 0.0.46
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 +179 -0
- package/fesm2022/acorex-platform-module-auth-client-accept-invitation.component-Ct28GG3a.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-acorex-platform-module-auth-client-CRl74b8g.mjs → acorex-platform-module-auth-client-acorex-platform-module-auth-client-DXunSlPC.mjs} +1150 -107
- package/fesm2022/acorex-platform-module-auth-client-acorex-platform-module-auth-client-DXunSlPC.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-app-chooser.component-CjWofUGR.mjs → acorex-platform-module-auth-client-app-chooser.component-CxYe1hmk.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-auth-client-app-chooser.component-CjWofUGR.mjs.map → acorex-platform-module-auth-client-app-chooser.component-CxYe1hmk.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-blank.layout-BCXNPgrp.mjs → acorex-platform-module-auth-client-blank.layout-xSXPWxyw.mjs} +3 -3
- package/fesm2022/acorex-platform-module-auth-client-blank.layout-xSXPWxyw.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-change-password.command-BqU3jYV9.mjs → acorex-platform-module-auth-client-change-password.command-ci4weP0r.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-change-password.command-BqU3jYV9.mjs.map → acorex-platform-module-auth-client-change-password.command-ci4weP0r.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-change-photo.command-CzO3A7OG.mjs → acorex-platform-module-auth-client-change-photo.command-CuieLa-Q.mjs} +71 -21
- package/fesm2022/acorex-platform-module-auth-client-change-photo.command-CuieLa-Q.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client-command-return-url.util-mBmtJ7T2.mjs +69 -0
- package/fesm2022/acorex-platform-module-auth-client-command-return-url.util-mBmtJ7T2.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client-contracts.mjs +12 -7
- package/fesm2022/acorex-platform-module-auth-client-contracts.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-edit-account-info.command-CD9IrimO.mjs → acorex-platform-module-auth-client-edit-account-info.command-DulLUfWs.mjs} +25 -4
- package/fesm2022/acorex-platform-module-auth-client-edit-account-info.command-DulLUfWs.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-get-user-activity.query-B1bKcSVQ.mjs → acorex-platform-module-auth-client-get-user-activity.query-B6se2sJt.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-get-user-activity.query-B1bKcSVQ.mjs.map → acorex-platform-module-auth-client-get-user-activity.query-B6se2sJt.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-lock-screen.command-DKtlBzS7.mjs → acorex-platform-module-auth-client-lock-screen.command-BRGUe-5j.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-lock-screen.command-DKtlBzS7.mjs.map → acorex-platform-module-auth-client-lock-screen.command-BRGUe-5j.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-login.module-CXl61yOu.mjs → acorex-platform-module-auth-client-login.module-DasQfX02.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-login.module-CXl61yOu.mjs.map → acorex-platform-module-auth-client-login.module-DasQfX02.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-auth-client-manage-two-factor.command-t4UEDms3.mjs +445 -0
- package/fesm2022/acorex-platform-module-auth-client-manage-two-factor.command-t4UEDms3.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-master.layout-D7zUm7aL.mjs → acorex-platform-module-auth-client-master.layout-hYj9JwHA.mjs} +5 -5
- package/fesm2022/{acorex-platform-module-auth-client-master.layout-D7zUm7aL.mjs.map → acorex-platform-module-auth-client-master.layout-hYj9JwHA.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-oauth-callback.component-fdWC08nA.mjs → acorex-platform-module-auth-client-oauth-callback.component-DWnljN18.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-oauth-callback.component-fdWC08nA.mjs.map → acorex-platform-module-auth-client-oauth-callback.component-DWnljN18.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-open-sessions.command-DKvyMkhl.mjs → acorex-platform-module-auth-client-open-sessions.command-C9ue1SMV.mjs} +6 -6
- package/fesm2022/{acorex-platform-module-auth-client-open-sessions.command-DKvyMkhl.mjs.map → acorex-platform-module-auth-client-open-sessions.command-C9ue1SMV.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-auth-client-open-waiting-room.command-CR-_ppYd.mjs +28 -0
- package/fesm2022/acorex-platform-module-auth-client-open-waiting-room.command-CR-_ppYd.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-password.component-BE2JkYm_.mjs → acorex-platform-module-auth-client-password.component-Ci5Wy3rO.mjs} +5 -5
- package/fesm2022/{acorex-platform-module-auth-client-password.component-BE2JkYm_.mjs.map → acorex-platform-module-auth-client-password.component-Ci5Wy3rO.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-password.component-BoWDVby5.mjs → acorex-platform-module-auth-client-password.component-CkUMxpZm.mjs} +39 -9
- package/fesm2022/acorex-platform-module-auth-client-password.component-CkUMxpZm.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-platform-settings-unavailable.component-BJMtsa99.mjs → acorex-platform-module-auth-client-platform-settings-unavailable.component-LwuokJiZ.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-auth-client-platform-settings-unavailable.component-BJMtsa99.mjs.map → acorex-platform-module-auth-client-platform-settings-unavailable.component-LwuokJiZ.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-profile-activity-chart.component-CFaRGMKu.mjs → acorex-platform-module-auth-client-profile-activity-chart.component-DTfyVXWu.mjs} +5 -5
- package/fesm2022/{acorex-platform-module-auth-client-profile-activity-chart.component-CFaRGMKu.mjs.map → acorex-platform-module-auth-client-profile-activity-chart.component-DTfyVXWu.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-profile-delete-account-danger-zone.component-Dx2-o9XL.mjs → acorex-platform-module-auth-client-profile-delete-account-danger-zone.component-DWNbDzDd.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-auth-client-profile-delete-account-danger-zone.component-Dx2-o9XL.mjs.map → acorex-platform-module-auth-client-profile-delete-account-danger-zone.component-DWNbDzDd.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-profile-page-component.provider-1Spuexhb.mjs → acorex-platform-module-auth-client-profile-page-component.provider-i1SGrccV.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-auth-client-profile-page-component.provider-1Spuexhb.mjs.map → acorex-platform-module-auth-client-profile-page-component.provider-i1SGrccV.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-profile-page.component-CGs24n0j.mjs → acorex-platform-module-auth-client-profile-page.component-DNtpDf8J.mjs} +9 -7
- package/fesm2022/acorex-platform-module-auth-client-profile-page.component-DNtpDf8J.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client-pwa-install.component-DnDHvNsF.mjs +84 -0
- package/fesm2022/acorex-platform-module-auth-client-pwa-install.component-DnDHvNsF.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-register-password.component-BlOn9609.mjs → acorex-platform-module-auth-client-register-password.component-C_Vu3KS-.mjs} +7 -7
- package/fesm2022/{acorex-platform-module-auth-client-register-password.component-BlOn9609.mjs.map → acorex-platform-module-auth-client-register-password.component-C_Vu3KS-.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-register.module-CpoYf5uG.mjs → acorex-platform-module-auth-client-register.module-KlxTQevf.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-auth-client-register.module-CpoYf5uG.mjs.map → acorex-platform-module-auth-client-register.module-KlxTQevf.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-remove-pin-code.command-Da7ryul6.mjs → acorex-platform-module-auth-client-remove-pin-code.command-0kRQprWO.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-remove-pin-code.command-Da7ryul6.mjs.map → acorex-platform-module-auth-client-remove-pin-code.command-0kRQprWO.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-reset-password.component-D0nxlhJm.mjs → acorex-platform-module-auth-client-reset-password.component-BQfKSqpW.mjs} +6 -6
- package/fesm2022/{acorex-platform-module-auth-client-reset-password.component-D0nxlhJm.mjs.map → acorex-platform-module-auth-client-reset-password.component-BQfKSqpW.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-result.component-Bo1QkwMu.mjs → acorex-platform-module-auth-client-result.component-PhPaEAgh.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-result.component-Bo1QkwMu.mjs.map → acorex-platform-module-auth-client-result.component-PhPaEAgh.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-auth-client-routes-90eFjxx8.mjs +17 -0
- package/fesm2022/acorex-platform-module-auth-client-routes-90eFjxx8.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-session-limit.component-DH58dRba.mjs → acorex-platform-module-auth-client-session-limit.component-Dc6TIn-2.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-session-limit.component-DH58dRba.mjs.map → acorex-platform-module-auth-client-session-limit.component-Dc6TIn-2.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-session-lock-overlay.component-cDCrwNRV.mjs → acorex-platform-module-auth-client-session-lock-overlay.component-CJJmgXqu.mjs} +7 -7
- package/fesm2022/{acorex-platform-module-auth-client-session-lock-overlay.component-cDCrwNRV.mjs.map → acorex-platform-module-auth-client-session-lock-overlay.component-CJJmgXqu.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-set-pin-code.command-FjM1kzUj.mjs → acorex-platform-module-auth-client-set-pin-code.command-CzUeATL1.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-set-pin-code.command-FjM1kzUj.mjs.map → acorex-platform-module-auth-client-set-pin-code.command-CzUeATL1.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-set-pin-code.component-BgEgdFxQ.mjs → acorex-platform-module-auth-client-set-pin-code.component-DFzKiM1U.mjs} +6 -6
- package/fesm2022/{acorex-platform-module-auth-client-set-pin-code.component-BgEgdFxQ.mjs.map → acorex-platform-module-auth-client-set-pin-code.component-DFzKiM1U.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-settings.provider-DGiK-MmW.mjs → acorex-platform-module-auth-client-settings.provider-DsKsZrOC.mjs} +18 -13
- package/fesm2022/acorex-platform-module-auth-client-settings.provider-DsKsZrOC.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-signout-command-B7n_Fn4P.mjs → acorex-platform-module-auth-client-signout-command-D4Qgv7q2.mjs} +7 -1
- package/fesm2022/acorex-platform-module-auth-client-signout-command-D4Qgv7q2.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-tenant-chooser.component-B8CNqHx5.mjs → acorex-platform-module-auth-client-tenant-chooser.component-HqU75mfO.mjs} +5 -5
- package/fesm2022/{acorex-platform-module-auth-client-tenant-chooser.component-B8CNqHx5.mjs.map → acorex-platform-module-auth-client-tenant-chooser.component-HqU75mfO.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-auth-client-two-factor-challenge.storage-mi0UD7Sc.mjs +48 -0
- package/fesm2022/acorex-platform-module-auth-client-two-factor-challenge.storage-mi0UD7Sc.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client-two-factor-code.component-CfZo5Jl0.mjs +200 -0
- package/fesm2022/acorex-platform-module-auth-client-two-factor-code.component-CfZo5Jl0.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-two-factor.module-CI8KC5M_.mjs → acorex-platform-module-auth-client-two-factor.module-DoghMqeQ.mjs} +10 -5
- package/fesm2022/acorex-platform-module-auth-client-two-factor.module-DoghMqeQ.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-view-login-history.command-Cqb27L-l.mjs → acorex-platform-module-auth-client-view-login-history.command-B35cTU-Z.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-view-login-history.command-Cqb27L-l.mjs.map → acorex-platform-module-auth-client-view-login-history.command-B35cTU-Z.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-auth-client-waiting-room.component-IAVIt1fY.mjs +165 -0
- package/fesm2022/acorex-platform-module-auth-client-waiting-room.component-IAVIt1fY.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client-welcome-onboarding-page.component-5NtRLNn3.mjs +813 -0
- package/fesm2022/acorex-platform-module-auth-client-welcome-onboarding-page.component-5NtRLNn3.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client-welcome-onboarding.command-Cms-SKKf.mjs +59 -0
- package/fesm2022/acorex-platform-module-auth-client-welcome-onboarding.command-Cms-SKKf.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client.mjs +1 -1
- package/package.json +2 -2
- package/types/acorex-platform-module-auth-client-contracts.d.ts +13 -3
- package/types/acorex-platform-module-auth-client.d.ts +60 -2
- package/fesm2022/acorex-platform-module-auth-client-acorex-platform-module-auth-client-CRl74b8g.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-blank.layout-BCXNPgrp.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-change-photo.command-CzO3A7OG.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-edit-account-info.command-CD9IrimO.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-password.component-BoWDVby5.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-profile-page.component-CGs24n0j.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-routes-B6iJHJ60.mjs +0 -13
- package/fesm2022/acorex-platform-module-auth-client-routes-B6iJHJ60.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-settings.provider-DGiK-MmW.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-signout-command-B7n_Fn4P.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-two-factor-code.component-BrqfaY8i.mjs +0 -40
- package/fesm2022/acorex-platform-module-auth-client-two-factor-code.component-BrqfaY8i.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-two-factor.module-CI8KC5M_.mjs.map +0 -1
|
@@ -16,10 +16,10 @@ import { AXPSessionService } from '@acorex-platform/framework-client/auth';
|
|
|
16
16
|
import { AXPPlatformBrandingService } from '@acorex-platform/framework-client/common';
|
|
17
17
|
import { AXPLogoComponent } from '@acorex-platform/framework-client/core';
|
|
18
18
|
import { AXPUserAvatarComponent } from '@acorex-platform/framework-client/layout/components';
|
|
19
|
-
import * as
|
|
19
|
+
import * as i3$1 from '@angular/common';
|
|
20
20
|
import { CommonModule } from '@angular/common';
|
|
21
21
|
import { Router } from '@angular/router';
|
|
22
|
-
import {
|
|
22
|
+
import { B as AXPTenantChooserDropdownComponent, D as AXPAppChooserListComponent } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-DXunSlPC.mjs';
|
|
23
23
|
|
|
24
24
|
class AXPAuthAppChooserComponent {
|
|
25
25
|
constructor() {
|
|
@@ -48,7 +48,7 @@ class AXPAuthAppChooserComponent {
|
|
|
48
48
|
this.router.navigate(['/auth/login']);
|
|
49
49
|
}
|
|
50
50
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPAuthAppChooserComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
51
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXPAuthAppChooserComponent, isStandalone: true, selector: "axp-auth-app-chooser", ngImport: i0, template: "<main *translate=\"let t\" class=\"axp-auth-chooser\">\n <div class=\"axp-auth-chooser__inner\">\n <!-- ----- Platform branding ----- -->\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 <!-- ----- Application selection card ----- -->\n <section class=\"axp-auth-chooser__card-wrap\">\n <div class=\"axp-auth-chooser__card\">\n <!-- ----- Profile header while catalog loads ----- -->\n @if (catalogLoading()) {\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 <ax-skeleton [animated]=\"true\" class=\"h-5 w-32 max-w-full\"></ax-skeleton>\n <ax-skeleton [animated]=\"true\" class=\"h-4 w-64 max-w-full\"></ax-skeleton>\n } @else {\n <axp-user-avatar\n [size]=\"72\"\n [userId]=\"$safeNavigationMigration(user?.id)!\"\n [showPresence]=\"false\"\n ></axp-user-avatar>\n <h2 class=\"md:text-lg font-medium\">\n {{ '@auth:welcome.message' | translate | async }}, {{ user?.title }}\n </h2>\n <axp-tenant-chooser-dropdown></axp-tenant-chooser-dropdown>\n <p class=\"text-neutral-500 text-sm md:text-base font-medium\">\n {{ '@auth:application-chooser.description' | translate | async }}\n </p>\n }\n <div class=\"mt-3 w-full overflow-auto max-h-[300px]\">\n <axp-app-chooser-list (loadingChange)=\"handleCatalogLoading($event)\"></axp-app-chooser-list>\n </div>\n </div>\n </section>\n <!-- ----- Navigation footer ----- -->\n <section class=\"axp-auth-chooser__footer\">\n <p class=\"text-neutral-400 text-sm\">\n {{ '@auth:application-chooser.footer' | translate | async }}\n @if (tenants$ | async; as tenants) {\n @if (tenants.length > 1) {\n <a\n (click)=\"tenantChooser()\"\n class=\"text-primary-500 cursor-pointer font-medium hover:underline\"\n >\n {{ '@auth:application-chooser.backCompany' | translate | async }}\n </a>\n }\n <!-- ----- Single-tenant users return to login ----- -->\n @else {\n <a\n (click)=\"handleSignout()\"\n class=\"text-primary-500 font-medium cursor-pointer hover:underline\"\n >\n {{ '@auth:backLogin' | translate | async }}\n </a>\n }\n }\n </p>\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", ".gradient{background:-webkit-linear-gradient(var(--ax-current-v1),var(--ax-current-v2));-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXFormModule }, { kind: "ngmodule", type: AXTextBoxModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "ngmodule", type: AXLabelModule }, { kind: "ngmodule", type: AXCheckBoxModule }, { kind: "ngmodule", type: AXImageModule }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: AXPLogoComponent, selector: "axp-logo", inputs: ["logoKey", "appearance", "size", "format"] }, { kind: "ngmodule", type: AXLoadingModule }, { kind: "ngmodule", type: AXSkeletonModule }, { kind: "component", type: i3.AXSkeletonComponent, selector: "ax-skeleton", inputs: ["animated"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "directive", type: i5.AXTranslatorDirective, selector: "[translate]" }, { kind: "component", type: AXPTenantChooserDropdownComponent, selector: "axp-tenant-chooser-dropdown", inputs: ["inline"] }, { kind: "component", type: AXPAppChooserListComponent, selector: "axp-app-chooser-list", inputs: ["simple"], outputs: ["applicationChosen", "loadingChange"] }, { kind: "component", type: AXPUserAvatarComponent, selector: "axp-user-avatar", inputs: ["size", "userId", "showPresence", "displayName", "displayAvatar"] }, { kind: "pipe", type:
|
|
51
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXPAuthAppChooserComponent, isStandalone: true, selector: "axp-auth-app-chooser", ngImport: i0, template: "<main *translate=\"let t\" class=\"axp-auth-chooser\">\n <div class=\"axp-auth-chooser__inner\">\n <!-- ----- Platform branding ----- -->\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 <!-- ----- Application selection card ----- -->\n <section class=\"axp-auth-chooser__card-wrap\">\n <div class=\"axp-auth-chooser__card\">\n <!-- ----- Profile header while catalog loads ----- -->\n @if (catalogLoading()) {\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 <ax-skeleton [animated]=\"true\" class=\"h-5 w-32 max-w-full\"></ax-skeleton>\n <ax-skeleton [animated]=\"true\" class=\"h-4 w-64 max-w-full\"></ax-skeleton>\n } @else {\n <axp-user-avatar\n [size]=\"72\"\n [userId]=\"$safeNavigationMigration(user?.id)!\"\n [showPresence]=\"false\"\n ></axp-user-avatar>\n <h2 class=\"md:text-lg font-medium\">\n {{ '@auth:welcome.message' | translate | async }}, {{ user?.title }}\n </h2>\n <axp-tenant-chooser-dropdown></axp-tenant-chooser-dropdown>\n <p class=\"text-neutral-500 text-sm md:text-base font-medium\">\n {{ '@auth:application-chooser.description' | translate | async }}\n </p>\n }\n <div class=\"mt-3 w-full overflow-auto max-h-[300px]\">\n <axp-app-chooser-list (loadingChange)=\"handleCatalogLoading($event)\"></axp-app-chooser-list>\n </div>\n </div>\n </section>\n <!-- ----- Navigation footer ----- -->\n <section class=\"axp-auth-chooser__footer\">\n <p class=\"text-neutral-400 text-sm\">\n {{ '@auth:application-chooser.footer' | translate | async }}\n @if (tenants$ | async; as tenants) {\n @if (tenants.length > 1) {\n <a\n (click)=\"tenantChooser()\"\n class=\"text-primary-500 cursor-pointer font-medium hover:underline\"\n >\n {{ '@auth:application-chooser.backCompany' | translate | async }}\n </a>\n }\n <!-- ----- Single-tenant users return to login ----- -->\n @else {\n <a\n (click)=\"handleSignout()\"\n class=\"text-primary-500 font-medium cursor-pointer hover:underline\"\n >\n {{ '@auth:backLogin' | translate | async }}\n </a>\n }\n }\n </p>\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", ".gradient{background:-webkit-linear-gradient(var(--ax-current-v1),var(--ax-current-v2));-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXFormModule }, { kind: "ngmodule", type: AXTextBoxModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "ngmodule", type: AXLabelModule }, { kind: "ngmodule", type: AXCheckBoxModule }, { kind: "ngmodule", type: AXImageModule }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: AXPLogoComponent, selector: "axp-logo", inputs: ["logoKey", "appearance", "size", "format"] }, { kind: "ngmodule", type: AXLoadingModule }, { kind: "ngmodule", type: AXSkeletonModule }, { kind: "component", type: i3.AXSkeletonComponent, selector: "ax-skeleton", inputs: ["animated"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "directive", type: i5.AXTranslatorDirective, selector: "[translate]" }, { kind: "component", type: AXPTenantChooserDropdownComponent, selector: "axp-tenant-chooser-dropdown", inputs: ["inline"] }, { kind: "component", type: AXPAppChooserListComponent, selector: "axp-app-chooser-list", inputs: ["simple"], outputs: ["applicationChosen", "loadingChange"] }, { kind: "component", type: AXPUserAvatarComponent, selector: "axp-user-avatar", inputs: ["size", "userId", "showPresence", "displayName", "displayAvatar"] }, { kind: "pipe", type: i3$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i5.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager, encapsulation: i0.ViewEncapsulation.None }); }
|
|
52
52
|
}
|
|
53
53
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPAuthAppChooserComponent, decorators: [{
|
|
54
54
|
type: Component,
|
|
@@ -72,4 +72,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
72
72
|
}] });
|
|
73
73
|
|
|
74
74
|
export { AXPAuthAppChooserComponent };
|
|
75
|
-
//# sourceMappingURL=acorex-platform-module-auth-client-app-chooser.component-
|
|
75
|
+
//# sourceMappingURL=acorex-platform-module-auth-client-app-chooser.component-CxYe1hmk.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-auth-client-app-chooser.component-
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-auth-client-app-chooser.component-CxYe1hmk.mjs","sources":["../../../../libs/modules/auth/client/src/lib/pages/account/app-chooser/app-chooser.component.ts","../../../../libs/modules/auth/client/src/lib/pages/account/app-chooser/app-chooser.component.html"],"sourcesContent":["import { Component, OnInit, ViewEncapsulation, inject, ChangeDetectionStrategy, signal } from '@angular/core';\n\nimport { AXButtonModule } from '@acorex/components/button';\nimport { AXCheckBoxModule } from '@acorex/components/check-box';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXFormModule } from '@acorex/components/form';\nimport { AXImageModule } from '@acorex/components/image';\nimport { AXLabelModule } from '@acorex/components/label';\nimport { AXLoadingModule } from '@acorex/components/loading';\nimport { AXSkeletonModule } from '@acorex/components/skeleton';\nimport { AXTextBoxModule } from '@acorex/components/text-box';\nimport { AXTranslationModule } from '@acorex/core/translation';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPPlatformBrandingService } from '@acorex-platform/framework-client/common';\nimport { AXPLogoComponent } from '@acorex-platform/framework-client/core';\nimport { AXPUserAvatarComponent } from '@acorex-platform/framework-client/layout/components';\nimport { CommonModule } from '@angular/common';\nimport { Router } from '@angular/router';\nimport { AXPTenantChooserDropdownComponent } from '../tenant-chooser/tenant-chooser-dropdown.component';\nimport { AXPAppChooserListComponent } from './app-chooser-list.component';\n\n@Component({\n selector: 'axp-auth-app-chooser',\n templateUrl: './app-chooser.component.html',\n styleUrls: ['../shared/auth-chooser.layout.css', './app-chooser.component.css'],\n imports: [\n CommonModule,\n AXFormModule,\n AXTextBoxModule,\n AXButtonModule,\n AXLabelModule,\n AXCheckBoxModule,\n AXImageModule,\n AXDecoratorModule,\n AXPLogoComponent,\n AXLoadingModule,\n AXSkeletonModule,\n AXTranslationModule,\n AXPTenantChooserDropdownComponent,\n AXPAppChooserListComponent,\n AXPUserAvatarComponent,\n ],\n changeDetection: ChangeDetectionStrategy.Eager,\n encapsulation: ViewEncapsulation.None,\n})\nexport class AXPAuthAppChooserComponent implements OnInit {\n ngOnInit(): void {\n void this.platformBranding.resolvePlatformTitle().then((title) => this.platformTitle.set(title));\n }\n private router = inject(Router);\n private readonly platformBranding = inject(AXPPlatformBrandingService);\n protected readonly platformTitle = signal('');\n private sessionService = inject(AXPSessionService);\n\n protected user = this.sessionService.user;\n protected tenants$ = this.sessionService.tenants$;\n protected tenant = this.sessionService.tenant;\n protected catalogLoading = signal(true);\n\n handleCatalogLoading(loading: boolean): void {\n this.catalogLoading.set(loading);\n }\n\n tenantChooser() {\n this.router.navigate(['/auth/account/tenant-chooser']);\n }\n\n async handleSignout() {\n await this.sessionService.signout();\n this.router.navigate(['/auth/login']);\n }\n}\n","<main *translate=\"let t\" class=\"axp-auth-chooser\">\n <div class=\"axp-auth-chooser__inner\">\n <!-- ----- Platform branding ----- -->\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 <!-- ----- Application selection card ----- -->\n <section class=\"axp-auth-chooser__card-wrap\">\n <div class=\"axp-auth-chooser__card\">\n <!-- ----- Profile header while catalog loads ----- -->\n @if (catalogLoading()) {\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 <ax-skeleton [animated]=\"true\" class=\"h-5 w-32 max-w-full\"></ax-skeleton>\n <ax-skeleton [animated]=\"true\" class=\"h-4 w-64 max-w-full\"></ax-skeleton>\n } @else {\n <axp-user-avatar\n [size]=\"72\"\n [userId]=\"$safeNavigationMigration(user?.id)!\"\n [showPresence]=\"false\"\n ></axp-user-avatar>\n <h2 class=\"md:text-lg font-medium\">\n {{ '@auth:welcome.message' | translate | async }}, {{ user?.title }}\n </h2>\n <axp-tenant-chooser-dropdown></axp-tenant-chooser-dropdown>\n <p class=\"text-neutral-500 text-sm md:text-base font-medium\">\n {{ '@auth:application-chooser.description' | translate | async }}\n </p>\n }\n <div class=\"mt-3 w-full overflow-auto max-h-[300px]\">\n <axp-app-chooser-list (loadingChange)=\"handleCatalogLoading($event)\"></axp-app-chooser-list>\n </div>\n </div>\n </section>\n <!-- ----- Navigation footer ----- -->\n <section class=\"axp-auth-chooser__footer\">\n <p class=\"text-neutral-400 text-sm\">\n {{ '@auth:application-chooser.footer' | translate | async }}\n @if (tenants$ | async; as tenants) {\n @if (tenants.length > 1) {\n <a\n (click)=\"tenantChooser()\"\n class=\"text-primary-500 cursor-pointer font-medium hover:underline\"\n >\n {{ '@auth:application-chooser.backCompany' | translate | async }}\n </a>\n }\n <!-- ----- Single-tenant users return to login ----- -->\n @else {\n <a\n (click)=\"handleSignout()\"\n class=\"text-primary-500 font-medium cursor-pointer hover:underline\"\n >\n {{ '@auth:backLogin' | translate | async }}\n </a>\n }\n }\n </p>\n </section>\n </div>\n</main>\n"],"names":["i1","i2","i3"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;MA6Ca,0BAA0B,CAAA;AAxBvC,IAAA,WAAA,GAAA;AA4BU,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACd,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,0BAA0B,CAAC;QACnD,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,EAAE;0FAAC;AACrC,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAExC,QAAA,IAAA,CAAA,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI;AAC/B,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ;AACvC,QAAA,IAAA,CAAA,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM;QACnC,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,IAAI;2FAAC;AAcxC,IAAA;IAzBC,QAAQ,GAAA;QACN,KAAK,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAClG;AAWA,IAAA,oBAAoB,CAAC,OAAgB,EAAA;AACnC,QAAA,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC;IAClC;IAEA,aAAa,GAAA;QACX,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,8BAA8B,CAAC,CAAC;IACxD;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jB,gBAAgB;wBAChB,eAAe;wBACf,gBAAgB;wBAChB,mBAAmB;wBACnB,iCAAiC;wBACjC,0BAA0B;wBAC1B,sBAAsB;AACvB,qBAAA,EAAA,eAAA,EACgB,uBAAuB,CAAC,KAAK,EAAA,aAAA,EAC/B,iBAAiB,CAAC,IAAI,EAAA,QAAA,EAAA,gvFAAA,EAAA,MAAA,EAAA,CAAA,4yIAAA,EAAA,qPAAA,CAAA,EAAA;;;"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
-
import * as
|
|
3
|
+
import * as i6 from '@angular/router';
|
|
4
4
|
import { RouterModule } from '@angular/router';
|
|
5
5
|
|
|
6
6
|
class AXPAuthBlankLayoutComponent {
|
|
7
7
|
constructor() { }
|
|
8
8
|
ngOnInit() { }
|
|
9
9
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPAuthBlankLayoutComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
10
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.8", type: AXPAuthBlankLayoutComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<router-outlet></router-outlet>", dependencies: [{ kind: "ngmodule", type: RouterModule }, { kind: "directive", type:
|
|
10
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.8", type: AXPAuthBlankLayoutComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<router-outlet></router-outlet>", dependencies: [{ kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i6.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
|
|
11
11
|
}
|
|
12
12
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPAuthBlankLayoutComponent, decorators: [{
|
|
13
13
|
type: Component,
|
|
@@ -15,4 +15,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
15
15
|
}], ctorParameters: () => [] });
|
|
16
16
|
|
|
17
17
|
export { AXPAuthBlankLayoutComponent };
|
|
18
|
-
//# sourceMappingURL=acorex-platform-module-auth-client-blank.layout-
|
|
18
|
+
//# sourceMappingURL=acorex-platform-module-auth-client-blank.layout-xSXPWxyw.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-auth-client-blank.layout-xSXPWxyw.mjs","sources":["../../../../libs/modules/auth/client/src/lib/shared/layouts/blank/blank.layout.ts","../../../../libs/modules/auth/client/src/lib/shared/layouts/blank/blank.layout.html"],"sourcesContent":["import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';\nimport { RouterModule } from '@angular/router';\n\n@Component({\n templateUrl: 'blank.layout.html',\n changeDetection: ChangeDetectionStrategy.Eager,\n imports: [RouterModule]\n})\nexport class AXPAuthBlankLayoutComponent implements OnInit {\n constructor() { }\n\n ngOnInit() { }\n}\n","<router-outlet></router-outlet>"],"names":["i1"],"mappings":";;;;;MAQa,2BAA2B,CAAA;AACtC,IAAA,WAAA,GAAA,EAAgB;AAEhB,IAAA,QAAQ,KAAK;8GAHF,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAA3B,2BAA2B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,cAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECRxC,iCAA+B,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EDMjB,YAAY,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAAA,EAAA,CAAA,YAAA,EAAA,QAAA,EAAA,eAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,kBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,UAAA,EAAA,YAAA,EAAA,QAAA,EAAA,QAAA,CAAA,EAAA,QAAA,EAAA,CAAA,QAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,KAAA,EAAA,CAAA,CAAA;;2FAEb,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBALvC,SAAS;AAEW,YAAA,IAAA,EAAA,CAAA,EAAA,eAAA,EAAA,uBAAuB,CAAC,KAAK,EAAA,OAAA,EACrC,CAAC,YAAY,CAAC,EAAA,QAAA,EAAA,iCAAA,EAAA;;;"}
|
|
@@ -7,7 +7,7 @@ import { runtimeCommandPayloadData } from '@acorex-platform/framework-shared/cor
|
|
|
7
7
|
import { AXPLayoutBuilderService, resolveLayoutBuilderDialogResult } from '@acorex-platform/framework-client/layout/builder';
|
|
8
8
|
import * as i0 from '@angular/core';
|
|
9
9
|
import { inject, Injectable } from '@angular/core';
|
|
10
|
-
import { l as AXPAuthPasswordComplexityService, m as AXPAuthPasswordChangeTrackingService, n as getPasswordComplexityHintKey, o as getPasswordComplexityValidationMessageKey, p as validatePasswordAgainstComplexity, C as CHANGE_PASSWORD_SECTION_ID, d as PROFILE_SECTION_INSIGHTS_PATCH_METADATA_KEY, q as buildPasswordLastChangedInsights } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-
|
|
10
|
+
import { l as AXPAuthPasswordComplexityService, m as AXPAuthPasswordChangeTrackingService, n as getPasswordComplexityHintKey, o as getPasswordComplexityValidationMessageKey, p as validatePasswordAgainstComplexity, C as CHANGE_PASSWORD_SECTION_ID, d as PROFILE_SECTION_INSIGHTS_PATCH_METADATA_KEY, q as buildPasswordLastChangedInsights } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-DXunSlPC.mjs';
|
|
11
11
|
|
|
12
12
|
//#region ---- Constants ----
|
|
13
13
|
const CHANGE_OWN_PASSWORD_ERROR_I18N = {
|
|
@@ -176,4 +176,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
176
176
|
}] });
|
|
177
177
|
|
|
178
178
|
export { AXPChangePasswordCommand };
|
|
179
|
-
//# sourceMappingURL=acorex-platform-module-auth-client-change-password.command-
|
|
179
|
+
//# sourceMappingURL=acorex-platform-module-auth-client-change-password.command-ci4weP0r.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-auth-client-change-password.command-BqU3jYV9.mjs","sources":["../../../../libs/modules/auth/client/src/lib/commands/change-password.command.ts"],"sourcesContent":["import { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport {\n AXM_CHANGE_OWN_PASSWORD_ERROR_CODES,\n AXMSecurityManagementServerCommands,\n type AXMChangeOwnPasswordResult,\n} from '@acorex-platform/module-security-management-client/contracts';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport { AXPRuntimeCommandResult, runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';\nimport {\n AXPLayoutBuilderService,\n resolveLayoutBuilderDialogResult,\n} from '@acorex-platform/framework-client/layout/builder';\n\nimport { inject, Injectable } from '@angular/core';\nimport {\n getPasswordComplexityHintKey,\n getPasswordComplexityValidationMessageKey,\n validatePasswordAgainstComplexity,\n} from '../shared/utils/password-complexity.utils';\nimport { AXPAuthPasswordComplexityService } from '../shared/services/password-complexity.service';\nimport { AXPAuthPasswordChangeTrackingService } from '../shared/services/password-change-tracking.service';\nimport {\n CHANGE_PASSWORD_SECTION_ID,\n PROFILE_SECTION_INSIGHTS_PATCH_METADATA_KEY,\n buildPasswordLastChangedInsights,\n} from '../pages/account/profile-page/profile-password-insight.util';\n\n//#region ---- Constants ----\n\nconst CHANGE_OWN_PASSWORD_ERROR_I18N: Record<string, string> = {\n [AXM_CHANGE_OWN_PASSWORD_ERROR_CODES.NotSignedIn]:\n '@auth:profile-page.commands.change-password.messages.not-signed-in',\n [AXM_CHANGE_OWN_PASSWORD_ERROR_CODES.IncorrectCurrent]:\n '@auth:profile-page.commands.change-password.messages.incorrect-current',\n [AXM_CHANGE_OWN_PASSWORD_ERROR_CODES.SameAsCurrent]:\n '@auth:profile-page.commands.change-password.messages.same-as-current',\n [AXM_CHANGE_OWN_PASSWORD_ERROR_CODES.InvalidInput]:\n '@auth:profile-page.commands.change-password.messages.save-failed',\n};\n\n//#endregion\n\n//#region ---- Change password command ----\n\n/** Opens a dialog to change the signed-in user's password. */\n@Injectable({ providedIn: 'root' })\nexport class AXPChangePasswordCommand implements AXPCommand {\n //#region ---- Services & Dependencies ----\n\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly commandService = inject(AXPCommandService);\n private readonly sessionService = inject(AXPSessionService);\n private readonly passwordComplexityService = inject(AXPAuthPasswordComplexityService);\n private readonly passwordChangeTrackingService = inject(AXPAuthPasswordChangeTrackingService);\n private readonly toastService = inject(AXToastService);\n private readonly translateService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command ----\n\n async execute(): AXPCommandExecuteResultPromise<void> {\n const passwordComplexity = await this.passwordComplexityService.getLevel();\n const complexityHintKey = getPasswordComplexityHintKey(passwordComplexity);\n const complexityValidationMessageKey = getPasswordComplexityValidationMessageKey(passwordComplexity);\n const complexityValidationMessage = await this.translateService.translateAsync(complexityValidationMessageKey);\n\n const dialogTitle = await this.translateService.translateAsync(\n '@auth:profile-page.commands.change-password.dialog.title',\n );\n\n const result = await this.layoutBuilder\n .create()\n .dialog<AXPRuntimeCommandResult<void> | null>((dialog) => {\n dialog\n .setTitle(dialogTitle)\n .setSize('md')\n .setCloseButton(true)\n .setContext({\n currentPassword: '',\n newPassword: '',\n confirmPassword: '',\n })\n .content((layout) => {\n layout.flex((flex) => {\n flex\n .setDirection('column')\n .setGap('1rem')\n .formField('@auth:profile-page.commands.change-password.fields.current-password.title', (field) => {\n field.setOptions({\n hint: '@auth:profile-page.commands.change-password.fields.current-password.hint',\n hintDisplayMode: 'note',\n });\n field.path('currentPassword');\n field.passwordBox({\n revealToggle: true,\n placeholder: '@auth:profile-page.commands.change-password.fields.current-password.placeholder',\n validations: [{ rule: 'required' }],\n });\n })\n .formField('@auth:profile-page.commands.change-password.fields.new-password.title', (field) => {\n field.setOptions({ hint: complexityHintKey, hintDisplayMode: 'note' });\n field.path('newPassword');\n field.passwordBox({\n revealToggle: true,\n placeholder: '@auth:profile-page.commands.change-password.fields.new-password.placeholder',\n validations: [\n { rule: 'required' },\n {\n rule: 'password-complexity',\n options: {\n message: complexityValidationMessage,\n },\n },\n ],\n });\n })\n .formField('@auth:profile-page.commands.change-password.fields.confirm-password.title', (field) => {\n field.setOptions({\n hint: '@auth:profile-page.commands.change-password.fields.confirm-password.hint',\n hintDisplayMode: 'note',\n });\n field.path('confirmPassword');\n field.passwordBox({\n revealToggle: true,\n placeholder: '@auth:profile-page.commands.change-password.fields.confirm-password.placeholder',\n validations: [{ rule: 'required' }],\n });\n });\n });\n })\n .setActions((actions) => {\n actions.cancel('@general:actions.cancel.title');\n actions.submit('@auth:profile-page.commands.change-password.actions.submit');\n })\n .onAction(async (dialogRef) => {\n if (dialogRef.action() === 'cancel') {\n return null;\n }\n\n const form = dialogRef.context() as {\n currentPassword?: string;\n newPassword?: string;\n confirmPassword?: string;\n };\n\n const currentPassword = form.currentPassword ?? '';\n const newPassword = form.newPassword ?? '';\n const confirmPassword = form.confirmPassword ?? '';\n\n if (newPassword !== confirmPassword) {\n throw new Error('@auth:profile-page.commands.change-password.messages.mismatch');\n }\n\n if (newPassword === currentPassword) {\n throw new Error('@auth:profile-page.commands.change-password.messages.same-as-current');\n }\n\n const submitComplexity = await this.passwordComplexityService.getLevel();\n const submitValidationMessageKey = getPasswordComplexityValidationMessageKey(submitComplexity);\n\n if (!validatePasswordAgainstComplexity(newPassword, submitComplexity)) {\n throw new Error(submitValidationMessageKey);\n }\n\n dialogRef.setLoading(true);\n try {\n const serverResult = await this.commandService.execute(\n AXMSecurityManagementServerCommands.ChangeOwnPassword,\n { currentPassword, newPassword },\n );\n\n if (!serverResult?.success) {\n throw new Error(this.resolveServerErrorKey(serverResult?.message?.code));\n }\n\n const payload = runtimeCommandPayloadData(serverResult) as AXMChangeOwnPasswordResult | undefined;\n const passwordChangedAt = payload?.passwordChangedAt\n ? new Date(payload.passwordChangedAt)\n : new Date();\n const userId = this.sessionService.user?.id;\n if (userId) {\n this.passwordChangeTrackingService.recordChange(userId, passwordChangedAt);\n }\n\n const successTitle = await this.translateService.translateAsync(\n '@auth:profile-page.commands.change-password.messages.success',\n );\n this.toastService.show({ color: 'success', title: successTitle });\n dialogRef.close();\n return {\n success: true,\n kind: 'object',\n data: undefined,\n metadata: {\n refresh: false,\n [PROFILE_SECTION_INSIGHTS_PATCH_METADATA_KEY]: {\n sectionId: CHANGE_PASSWORD_SECTION_ID,\n insights: buildPasswordLastChangedInsights(passwordChangedAt),\n },\n },\n };\n } finally {\n dialogRef.setLoading(false);\n }\n });\n })\n .show();\n\n return resolveLayoutBuilderDialogResult<AXPRuntimeCommandResult<void>>(result) ?? { success: false };\n }\n\n //#endregion\n\n //#region ---- Utility Methods ----\n\n private resolveServerErrorKey(code: string | undefined): string {\n if (code && CHANGE_OWN_PASSWORD_ERROR_I18N[code]) {\n return CHANGE_OWN_PASSWORD_ERROR_I18N[code];\n }\n\n return '@auth:profile-page.commands.change-password.messages.save-failed';\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;;AA8BA;AAEA,MAAM,8BAA8B,GAA2B;AAC7D,IAAA,CAAC,mCAAmC,CAAC,WAAW,GAC9C,oEAAoE;AACtE,IAAA,CAAC,m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ACjE,SAAS,CAAC,KAAK,EAAE;oBACjB,OAAO;AACL,wBAAA,OAAO,EAAE,IAAI;AACb,wBAAA,IAAI,EAAE,QAAQ;AACd,wBAAA,IAAI,EAAE,SAAS;AACf,wBAAA,QAAQ,EAAE;AACR,4BAAA,OAAO,EAAE,KAAK;4BACd,CAAC,2CAA2C,GAAG;AAC7C,gCAAA,SAAS,EAAE,0BAA0B;AACrC,gCAAA,QAAQ,EAAE,gCAAgC,CAAC,iBAAiB,CAAC;AAC9D,6BAAA;AACF,yBAAA;qBACF;gBACH;wBAAU;AACR,oBAAA,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC;gBAC7B;AACF,YAAA,CAAC,CAAC;AACN,QAAA,CAAC;AACA,aAAA,IAAI,EAAE;QAET,OAAO,gCAAgC,CAAgC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE;IACtG;;;AAMQ,IAAA,qBAAqB,CAAC,IAAwB,EAAA;AACpD,QAAA,IAAI,IAAI,IAAI,8BAA8B,CAAC,IAAI,CAAC,EAAE;AAChD,YAAA,OAAO,8BAA8B,CAAC,IAAI,CAAC;QAC7C;AAEA,QAAA,OAAO,kEAAkE;IAC3E;8GAhLW,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAxB,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,wBAAwB,cADX,MAAM,EAAA,CAAA,CAAA;;2FACnB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBADpC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-auth-client-change-password.command-ci4weP0r.mjs","sources":["../../../../libs/modules/auth/client/src/lib/commands/change-password.command.ts"],"sourcesContent":["import { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport {\n AXM_CHANGE_OWN_PASSWORD_ERROR_CODES,\n AXMSecurityManagementServerCommands,\n type AXMChangeOwnPasswordResult,\n} from '@acorex-platform/module-security-management-client/contracts';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport { AXPRuntimeCommandResult, runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';\nimport {\n AXPLayoutBuilderService,\n resolveLayoutBuilderDialogResult,\n} from '@acorex-platform/framework-client/layout/builder';\n\nimport { inject, Injectable } from '@angular/core';\nimport {\n getPasswordComplexityHintKey,\n getPasswordComplexityValidationMessageKey,\n validatePasswordAgainstComplexity,\n} from '../shared/utils/password-complexity.utils';\nimport { AXPAuthPasswordComplexityService } from '../shared/services/password-complexity.service';\nimport { AXPAuthPasswordChangeTrackingService } from '../shared/services/password-change-tracking.service';\nimport {\n CHANGE_PASSWORD_SECTION_ID,\n PROFILE_SECTION_INSIGHTS_PATCH_METADATA_KEY,\n buildPasswordLastChangedInsights,\n} from '../pages/account/profile-page/profile-password-insight.util';\n\n//#region ---- Constants ----\n\nconst CHANGE_OWN_PASSWORD_ERROR_I18N: Record<string, string> = {\n [AXM_CHANGE_OWN_PASSWORD_ERROR_CODES.NotSignedIn]:\n '@auth:profile-page.commands.change-password.messages.not-signed-in',\n [AXM_CHANGE_OWN_PASSWORD_ERROR_CODES.IncorrectCurrent]:\n '@auth:profile-page.commands.change-password.messages.incorrect-current',\n [AXM_CHANGE_OWN_PASSWORD_ERROR_CODES.SameAsCurrent]:\n '@auth:profile-page.commands.change-password.messages.same-as-current',\n [AXM_CHANGE_OWN_PASSWORD_ERROR_CODES.InvalidInput]:\n '@auth:profile-page.commands.change-password.messages.save-failed',\n};\n\n//#endregion\n\n//#region ---- Change password command ----\n\n/** Opens a dialog to change the signed-in user's password. */\n@Injectable({ providedIn: 'root' })\nexport class AXPChangePasswordCommand implements AXPCommand {\n //#region ---- Services & Dependencies ----\n\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly commandService = inject(AXPCommandService);\n private readonly sessionService = inject(AXPSessionService);\n private readonly passwordComplexityService = inject(AXPAuthPasswordComplexityService);\n private readonly passwordChangeTrackingService = inject(AXPAuthPasswordChangeTrackingService);\n private readonly toastService = inject(AXToastService);\n private readonly translateService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command ----\n\n async execute(): AXPCommandExecuteResultPromise<void> {\n const passwordComplexity = await this.passwordComplexityService.getLevel();\n const complexityHintKey = getPasswordComplexityHintKey(passwordComplexity);\n const complexityValidationMessageKey = getPasswordComplexityValidationMessageKey(passwordComplexity);\n const complexityValidationMessage = await this.translateService.translateAsync(complexityValidationMessageKey);\n\n const dialogTitle = await this.translateService.translateAsync(\n '@auth:profile-page.commands.change-password.dialog.title',\n );\n\n const result = await this.layoutBuilder\n .create()\n .dialog<AXPRuntimeCommandResult<void> | null>((dialog) => {\n dialog\n .setTitle(dialogTitle)\n .setSize('md')\n .setCloseButton(true)\n .setContext({\n currentPassword: '',\n newPassword: '',\n confirmPassword: '',\n })\n .content((layout) => {\n layout.flex((flex) => {\n flex\n .setDirection('column')\n .setGap('1rem')\n .formField('@auth:profile-page.commands.change-password.fields.current-password.title', (field) => {\n field.setOptions({\n hint: '@auth:profile-page.commands.change-password.fields.current-password.hint',\n hintDisplayMode: 'note',\n });\n field.path('currentPassword');\n field.passwordBox({\n revealToggle: true,\n placeholder: '@auth:profile-page.commands.change-password.fields.current-password.placeholder',\n validations: [{ rule: 'required' }],\n });\n })\n .formField('@auth:profile-page.commands.change-password.fields.new-password.title', (field) => {\n field.setOptions({ hint: complexityHintKey, hintDisplayMode: 'note' });\n field.path('newPassword');\n field.passwordBox({\n revealToggle: true,\n placeholder: '@auth:profile-page.commands.change-password.fields.new-password.placeholder',\n validations: [\n { rule: 'required' },\n {\n rule: 'password-complexity',\n options: {\n message: complexityValidationMessage,\n },\n },\n ],\n });\n })\n .formField('@auth:profile-page.commands.change-password.fields.confirm-password.title', (field) => {\n field.setOptions({\n hint: '@auth:profile-page.commands.change-password.fields.confirm-password.hint',\n hintDisplayMode: 'note',\n });\n field.path('confirmPassword');\n field.passwordBox({\n revealToggle: true,\n placeholder: '@auth:profile-page.commands.change-password.fields.confirm-password.placeholder',\n validations: [{ rule: 'required' }],\n });\n });\n });\n })\n .setActions((actions) => {\n actions.cancel('@general:actions.cancel.title');\n actions.submit('@auth:profile-page.commands.change-password.actions.submit');\n })\n .onAction(async (dialogRef) => {\n if (dialogRef.action() === 'cancel') {\n return null;\n }\n\n const form = dialogRef.context() as {\n currentPassword?: string;\n newPassword?: string;\n confirmPassword?: string;\n };\n\n const currentPassword = form.currentPassword ?? '';\n const newPassword = form.newPassword ?? '';\n const confirmPassword = form.confirmPassword ?? '';\n\n if (newPassword !== confirmPassword) {\n throw new Error('@auth:profile-page.commands.change-password.messages.mismatch');\n }\n\n if (newPassword === currentPassword) {\n throw new Error('@auth:profile-page.commands.change-password.messages.same-as-current');\n }\n\n const submitComplexity = await this.passwordComplexityService.getLevel();\n const submitValidationMessageKey = getPasswordComplexityValidationMessageKey(submitComplexity);\n\n if (!validatePasswordAgainstComplexity(newPassword, submitComplexity)) {\n throw new Error(submitValidationMessageKey);\n }\n\n dialogRef.setLoading(true);\n try {\n const serverResult = await this.commandService.execute(\n AXMSecurityManagementServerCommands.ChangeOwnPassword,\n { currentPassword, newPassword },\n );\n\n if (!serverResult?.success) {\n throw new Error(this.resolveServerErrorKey(serverResult?.message?.code));\n }\n\n const payload = runtimeCommandPayloadData(serverResult) as AXMChangeOwnPasswordResult | undefined;\n const passwordChangedAt = payload?.passwordChangedAt\n ? new Date(payload.passwordChangedAt)\n : new Date();\n const userId = this.sessionService.user?.id;\n if (userId) {\n this.passwordChangeTrackingService.recordChange(userId, passwordChangedAt);\n }\n\n const successTitle = await this.translateService.translateAsync(\n '@auth:profile-page.commands.change-password.messages.success',\n );\n this.toastService.show({ color: 'success', title: successTitle });\n dialogRef.close();\n return {\n success: true,\n kind: 'object',\n data: undefined,\n metadata: {\n refresh: false,\n [PROFILE_SECTION_INSIGHTS_PATCH_METADATA_KEY]: {\n sectionId: CHANGE_PASSWORD_SECTION_ID,\n insights: buildPasswordLastChangedInsights(passwordChangedAt),\n },\n },\n };\n } finally {\n dialogRef.setLoading(false);\n }\n });\n })\n .show();\n\n return resolveLayoutBuilderDialogResult<AXPRuntimeCommandResult<void>>(result) ?? { success: false };\n }\n\n //#endregion\n\n //#region ---- Utility Methods ----\n\n private resolveServerErrorKey(code: string | undefined): string {\n if (code && CHANGE_OWN_PASSWORD_ERROR_I18N[code]) {\n return CHANGE_OWN_PASSWORD_ERROR_I18N[code];\n }\n\n return '@auth:profile-page.commands.change-password.messages.save-failed';\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;;AA8BA;AAEA,MAAM,8BAA8B,GAA2B;AAC7D,IAAA,CAAC,mCAAmC,CAAC,WAAW,GAC9C,oEAAoE;AACtE,IAAA,CAAC,mCAAmC,CAAC,gBAAgB,GACnD,wEAAwE;AAC1E,IAAA,CAAC,mCAAmC,CAAC,aAAa,GAChD,sEAAsE;AACxE,IAAA,CAAC,mCAAmC,CAAC,YAAY,GAC/C,kEAAkE;CACrE;AAED;AAEA;AAEA;MAEa,wBAAwB,CAAA;AADrC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,uBAAuB,CAAC;AAC/C,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,yBAAyB,GAAG,MAAM,CAAC,gCAA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AAI,EAAE;QAET,OAAO,gCAAgC,CAAgC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE;IACtG;;;AAMQ,IAAA,qBAAqB,CAAC,IAAwB,EAAA;AACpD,QAAA,IAAI,IAAI,IAAI,8BAA8B,CAAC,IAAI,CAAC,EAAE;AAChD,YAAA,OAAO,8BAA8B,CAAC,IAAI,CAAC;QAC7C;AAEA,QAAA,OAAO,kEAAkE;IAC3E;8GAhLW,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAxB,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,wBAAwB,cADX,MAAM,EAAA,CAAA,CAAA;;2FACnB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBADpC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { AXToastService } from '@acorex/components/toast';
|
|
2
2
|
import { AXTranslationService } from '@acorex/core/translation';
|
|
3
|
-
import { extractRequestErrorInfo, platformErrorI18nKey } from '@acorex-platform/framework-client/common';
|
|
3
|
+
import { axpEndCommandSubFlowNavigation, extractRequestErrorInfo, platformErrorI18nKey } from '@acorex-platform/framework-client/common';
|
|
4
4
|
import { AXPSessionService } from '@acorex-platform/framework-client/auth';
|
|
5
|
-
import { AXPImageEditorService } from '@acorex-platform/framework-client/layout/components';
|
|
5
|
+
import { AXPFileChooserService, AXPImageEditorService } from '@acorex-platform/framework-client/layout/components';
|
|
6
6
|
import { AXPLayoutBuilderService } from '@acorex-platform/framework-client/layout/builder';
|
|
7
|
-
import {
|
|
7
|
+
import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
|
|
8
|
+
import { RootConfig } from '@acorex-platform/module-security-management-client/contracts';
|
|
8
9
|
import * as i0 from '@angular/core';
|
|
9
10
|
import { inject, Injectable } from '@angular/core';
|
|
11
|
+
import { Router } from '@angular/router';
|
|
10
12
|
import { isNil } from 'lodash';
|
|
11
|
-
import {
|
|
13
|
+
import { c as captureCommandReturnUrl, i as isWelcomeOnboardingRouterUrl, r as restoreWelcomeOnboardingAfterSubFlow, a as restoreCommandReturnUrlAfterSubFlow } from './acorex-platform-module-auth-client-command-return-url.util-mBmtJ7T2.mjs';
|
|
14
|
+
import { k as AXPUserAvatarSyncService } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-DXunSlPC.mjs';
|
|
12
15
|
|
|
13
16
|
const PROFILE_PHOTO_DIALOG_PREVIEW_SIZE = {
|
|
14
17
|
small: { width: '100%', height: 'auto' },
|
|
@@ -19,12 +22,14 @@ class AXPChangePhotoCommand {
|
|
|
19
22
|
constructor() {
|
|
20
23
|
//#region ---- Services & Dependencies ----
|
|
21
24
|
this.layoutBuilder = inject(AXPLayoutBuilderService);
|
|
22
|
-
this.
|
|
25
|
+
this.entityService = inject(AXPEntityService);
|
|
26
|
+
this.fileChooser = inject(AXPFileChooserService);
|
|
23
27
|
this.imageEditor = inject(AXPImageEditorService);
|
|
24
28
|
this.avatarSync = inject(AXPUserAvatarSyncService);
|
|
25
29
|
this.sessionService = inject(AXPSessionService);
|
|
26
30
|
this.toastService = inject(AXToastService);
|
|
27
31
|
this.translateService = inject(AXTranslationService);
|
|
32
|
+
this.router = inject(Router);
|
|
28
33
|
}
|
|
29
34
|
//#endregion
|
|
30
35
|
//#region ---- Command ----
|
|
@@ -38,23 +43,40 @@ class AXPChangePhotoCommand {
|
|
|
38
43
|
},
|
|
39
44
|
};
|
|
40
45
|
}
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
const returnUrl = captureCommandReturnUrl(this.router, input.subFlowReturnUrl);
|
|
47
|
+
try {
|
|
48
|
+
const mode = input.mode;
|
|
49
|
+
if (mode === 'upload') {
|
|
50
|
+
return await this.executeUploadFlow(userId, returnUrl);
|
|
51
|
+
}
|
|
52
|
+
return await this.executeManageFlow(userId, returnUrl);
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
axpEndCommandSubFlowNavigation();
|
|
44
56
|
}
|
|
45
|
-
return this.executeManageFlow(userId);
|
|
46
57
|
}
|
|
47
|
-
async
|
|
48
|
-
|
|
58
|
+
async restoreAfterSuccessfulSubFlow(returnUrl) {
|
|
59
|
+
if (isWelcomeOnboardingRouterUrl(returnUrl)) {
|
|
60
|
+
await restoreWelcomeOnboardingAfterSubFlow(this.router, returnUrl);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
await restoreCommandReturnUrlAfterSubFlow(this.router, returnUrl);
|
|
64
|
+
}
|
|
65
|
+
async executeUploadFlow(userId, returnUrl) {
|
|
66
|
+
const editedFile = await this.pickAndEditPhoto(userId);
|
|
49
67
|
if (!editedFile) {
|
|
50
68
|
return { success: false };
|
|
51
69
|
}
|
|
52
|
-
|
|
70
|
+
const result = await this.uploadAvatarAndNotify(userId, editedFile);
|
|
71
|
+
if (result.success) {
|
|
72
|
+
await this.restoreAfterSuccessfulSubFlow(returnUrl);
|
|
73
|
+
}
|
|
74
|
+
return result;
|
|
53
75
|
}
|
|
54
|
-
async executeManageFlow(userId) {
|
|
76
|
+
async executeManageFlow(userId, returnUrl) {
|
|
55
77
|
const previewUrl = await this.resolveDialogPreviewUrl(userId);
|
|
56
78
|
if (!previewUrl) {
|
|
57
|
-
return this.executeUploadFlow(userId);
|
|
79
|
+
return this.executeUploadFlow(userId, returnUrl);
|
|
58
80
|
}
|
|
59
81
|
try {
|
|
60
82
|
const result = await this.layoutBuilder
|
|
@@ -130,7 +152,7 @@ class AXPChangePhotoCommand {
|
|
|
130
152
|
}
|
|
131
153
|
}
|
|
132
154
|
if (action === 'change') {
|
|
133
|
-
const editedFile = await this.pickAndEditPhoto();
|
|
155
|
+
const editedFile = await this.pickAndEditPhoto(userId);
|
|
134
156
|
if (!editedFile) {
|
|
135
157
|
return { success: false, keepDialogOpen: true };
|
|
136
158
|
}
|
|
@@ -152,7 +174,11 @@ class AXPChangePhotoCommand {
|
|
|
152
174
|
});
|
|
153
175
|
})
|
|
154
176
|
.show();
|
|
155
|
-
|
|
177
|
+
const outcome = result ?? { success: false };
|
|
178
|
+
if (outcome.success) {
|
|
179
|
+
await this.restoreAfterSuccessfulSubFlow(returnUrl);
|
|
180
|
+
}
|
|
181
|
+
return outcome;
|
|
156
182
|
}
|
|
157
183
|
finally {
|
|
158
184
|
if (previewUrl?.startsWith('blob:')) {
|
|
@@ -226,17 +252,28 @@ class AXPChangePhotoCommand {
|
|
|
226
252
|
content,
|
|
227
253
|
});
|
|
228
254
|
}
|
|
229
|
-
async pickAndEditPhoto() {
|
|
230
|
-
const
|
|
231
|
-
const
|
|
255
|
+
async pickAndEditPhoto(userId) {
|
|
256
|
+
const gravatarEmail = await this.resolveUserEmail(userId);
|
|
257
|
+
const pickResult = await this.fileChooser.pickProfilePhotoImage({ gravatarEmail });
|
|
258
|
+
if (pickResult.gravatarNotFound) {
|
|
259
|
+
await this.toastCommandMessage({
|
|
260
|
+
type: 'error',
|
|
261
|
+
text: '@auth:profile-page.commands.change-photo.messages.gravatar-not-found',
|
|
262
|
+
});
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
const picked = pickResult.file;
|
|
232
266
|
if (!picked) {
|
|
233
267
|
return null;
|
|
234
268
|
}
|
|
269
|
+
if (pickResult.fromGravatar) {
|
|
270
|
+
return picked;
|
|
271
|
+
}
|
|
235
272
|
const editedBlob = await this.imageEditor.open({
|
|
236
273
|
image: picked,
|
|
237
274
|
title: '@auth:profile-page.commands.change-photo.dialog.editor-title',
|
|
238
275
|
look: 'blank',
|
|
239
|
-
|
|
276
|
+
square: true,
|
|
240
277
|
});
|
|
241
278
|
if (!editedBlob) {
|
|
242
279
|
return null;
|
|
@@ -245,6 +282,19 @@ class AXPChangePhotoCommand {
|
|
|
245
282
|
type: editedBlob.type || 'image/png',
|
|
246
283
|
});
|
|
247
284
|
}
|
|
285
|
+
async resolveUserEmail(userId) {
|
|
286
|
+
try {
|
|
287
|
+
const user = await this.entityService
|
|
288
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.users.name)
|
|
289
|
+
.data()
|
|
290
|
+
.byKey(userId);
|
|
291
|
+
const email = user?.email?.trim();
|
|
292
|
+
return email ? email : null;
|
|
293
|
+
}
|
|
294
|
+
catch {
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
248
298
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPChangePhotoCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
249
299
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPChangePhotoCommand, providedIn: 'root' }); }
|
|
250
300
|
}
|
|
@@ -254,4 +304,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
254
304
|
}] });
|
|
255
305
|
|
|
256
306
|
export { AXPChangePhotoCommand };
|
|
257
|
-
//# sourceMappingURL=acorex-platform-module-auth-client-change-photo.command-
|
|
307
|
+
//# sourceMappingURL=acorex-platform-module-auth-client-change-photo.command-CuieLa-Q.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-auth-client-change-photo.command-CuieLa-Q.mjs","sources":["../../../../libs/modules/auth/client/src/lib/commands/change-photo.command.ts"],"sourcesContent":["import { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport {\n AXPRuntimeCommandResult,\n type AXPRuntimeMessage,\n} from '@acorex-platform/framework-shared/core';\nimport {\n axpEndCommandSubFlowNavigation,\n extractRequestErrorInfo,\n platformErrorI18nKey,\n} from '@acorex-platform/framework-client/common';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport {\n AXPFileChooserService,\n AXPImageEditorService,\n} from '@acorex-platform/framework-client/layout/components';\nimport { AXPLayoutBuilderService } from '@acorex-platform/framework-client/layout/builder';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { RootConfig as SecurityManagementRootConfig } from '@acorex-platform/module-security-management-client/contracts';\nimport type { AXMSecurityManagementUsersEntityModel } from '@acorex-platform/module-security-management-client/contracts';\n\nimport { inject, Injectable } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { isNil } from 'lodash';\n\nimport {\n captureCommandReturnUrl,\n isWelcomeOnboardingRouterUrl,\n restoreCommandReturnUrlAfterSubFlow,\n restoreWelcomeOnboardingAfterSubFlow,\n} from '../shared/command-return-url.util';\nimport { AXPUserAvatarSyncService } from '../shared/services/user-avatar-sync.service';\n\n//#region ---- Change photo command ----\n\nexport type AXPChangePhotoCommandMode = 'upload' | 'manage';\n\nexport type AXPChangePhotoCommandInput = {\n mode?: AXPChangePhotoCommandMode;\n /** Explicit return URL for sub-flow restore (welcome onboarding passes its route). */\n subFlowReturnUrl?: string;\n};\n\nconst PROFILE_PHOTO_DIALOG_PREVIEW_SIZE = {\n small: { width: '100%', height: 'auto' },\n large: { width: '100%', height: 'auto' },\n} as const;\n\n/** Self-service profile photo upload, replace, and removal backed by file storage. */\n@Injectable({ providedIn: 'root' })\nexport class AXPChangePhotoCommand implements AXPCommand<AXPChangePhotoCommandInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly entityService = inject(AXPEntityService);\n private readonly fileChooser = inject(AXPFileChooserService);\n private readonly imageEditor = inject(AXPImageEditorService);\n private readonly avatarSync = inject(AXPUserAvatarSyncService);\n private readonly sessionService = inject(AXPSessionService);\n private readonly toastService = inject(AXToastService);\n private readonly translateService = inject(AXTranslationService);\n private readonly router = inject(Router);\n\n //#endregion\n\n //#region ---- Command ----\n\n async execute(input: AXPChangePhotoCommandInput = {}): AXPCommandExecuteResultPromise<void> {\n const userId = this.sessionService.user?.id;\n if (isNil(userId)) {\n return {\n success: false,\n message: {\n text: '@auth:profile-page.commands.change-photo.messages.not-signed-in',\n },\n };\n }\n\n const returnUrl = captureCommandReturnUrl(this.router, input.subFlowReturnUrl);\n\n try {\n const mode = input.mode;\n if (mode === 'upload') {\n return await this.executeUploadFlow(userId, returnUrl);\n }\n\n return await this.executeManageFlow(userId, returnUrl);\n } finally {\n axpEndCommandSubFlowNavigation();\n }\n }\n\n private async restoreAfterSuccessfulSubFlow(returnUrl: string): Promise<void> {\n if (isWelcomeOnboardingRouterUrl(returnUrl)) {\n await restoreWelcomeOnboardingAfterSubFlow(this.router, returnUrl);\n return;\n }\n await restoreCommandReturnUrlAfterSubFlow(this.router, returnUrl);\n }\n\n private async executeUploadFlow(\n userId: string,\n returnUrl: string,\n ): AXPCommandExecuteResultPromise<void> {\n const editedFile = await this.pickAndEditPhoto(userId);\n if (!editedFile) {\n return { success: false };\n }\n\n const result = await this.uploadAvatarAndNotify(userId, editedFile);\n if (result.success) {\n await this.restoreAfterSuccessfulSubFlow(returnUrl);\n }\n return result;\n }\n\n private async executeManageFlow(\n userId: string,\n returnUrl: string,\n ): AXPCommandExecuteResultPromise<void> {\n const previewUrl = await this.resolveDialogPreviewUrl(userId);\n if (!previewUrl) {\n return this.executeUploadFlow(userId, returnUrl);\n }\n\n try {\n const result = await this.layoutBuilder\n .create()\n .dialog<AXPRuntimeCommandResult<void>>((dialog) => {\n dialog\n .setTitle('@auth:profile-page.commands.change-photo.dialog.title')\n .setSize('sm')\n .setCloseButton(true)\n .setContext({ previewUrl })\n .content((layout) => {\n layout.flex((flex) => {\n flex\n .setDirection('column')\n .setGap('1rem')\n .setAlignItems('center')\n .setJustifyContent('center')\n .setOptions({ width: '100%', maxWidth: '100%', overflowX: 'hidden' });\n flex.customWidget('image', {\n path: 'previewUrl',\n type: 'profile-photo',\n readonly: true,\n enablePreviewClick: false,\n responsiveSize: PROFILE_PHOTO_DIALOG_PREVIEW_SIZE,\n });\n });\n })\n .setActions((actions) => {\n actions.custom({\n title: '@auth:profile-page.commands.change-photo.actions.remove',\n color: 'danger',\n position: 'prefix',\n command: { name: 'remove' },\n });\n actions.custom({\n title: '@auth:profile-page.commands.change-photo.actions.change',\n color: 'primary',\n command: { name: 'change' },\n });\n })\n .onAction(async (dialogRef) => {\n const action = dialogRef.action();\n\n if (action === 'remove') {\n dialogRef.setLoading(true);\n try {\n await this.avatarSync.removeAvatar(userId);\n return {\n success: true,\n kind: 'object',\n data: undefined,\n message: {\n type: 'success',\n text: '@auth:profile-page.commands.change-photo.messages.removed',\n },\n };\n } catch (error) {\n const info = extractRequestErrorInfo(error);\n return {\n success: false,\n keepDialogOpen: true,\n message: {\n type: 'error',\n code: info?.code,\n text:\n platformErrorI18nKey(info?.code) ??\n '@auth:profile-page.commands.change-photo.messages.failed',\n details: info?.details,\n },\n };\n } finally {\n dialogRef.setLoading(false);\n }\n }\n\n if (action === 'change') {\n const editedFile = await this.pickAndEditPhoto(userId);\n if (!editedFile) {\n return { success: false, keepDialogOpen: true };\n }\n\n dialogRef.setLoading(true);\n try {\n const uploadResult = await this.uploadAvatarAndNotify(userId, editedFile);\n if (!uploadResult.success) {\n // Dialog stays open — toast middleware has not finished execute yet.\n await this.toastCommandMessage(uploadResult.message);\n return { ...uploadResult, keepDialogOpen: true };\n }\n return uploadResult;\n } finally {\n dialogRef.setLoading(false);\n }\n }\n\n return { success: false, keepDialogOpen: true };\n });\n })\n .show();\n\n const outcome = result ?? { success: false };\n if (outcome.success) {\n await this.restoreAfterSuccessfulSubFlow(returnUrl);\n }\n return outcome;\n } finally {\n if (previewUrl?.startsWith('blob:')) {\n URL.revokeObjectURL(previewUrl);\n }\n }\n }\n\n private async resolveDialogPreviewUrl(userId: string): Promise<string | null> {\n try {\n const blob = await this.avatarSync.getCurrentAvatarBlob(userId);\n if (!blob) {\n return null;\n }\n return URL.createObjectURL(blob);\n } catch {\n return null;\n }\n }\n\n //#endregion\n\n //#region ---- Utility Methods ----\n\n private async uploadAvatarAndNotify(\n userId: string,\n file: File,\n ): AXPCommandExecuteResultPromise<void> {\n try {\n await this.avatarSync.uploadAndSetAvatar(userId, file);\n return { success: true, kind: 'object', data: undefined, message: {\n type: 'success',\n text: '@auth:profile-page.commands.change-photo.messages.success',\n },\n };\n } catch (error) {\n const info = extractRequestErrorInfo(error);\n return {\n success: false,\n message: {\n type: 'error',\n code: info?.code,\n text:\n platformErrorI18nKey(info?.code) ??\n '@auth:profile-page.commands.change-photo.messages.failed',\n details: info?.details,\n },\n };\n }\n }\n\n private async toastCommandMessage(message: AXPRuntimeMessage | undefined): Promise<void> {\n const text = message?.text;\n let content: string | null = null;\n if (typeof text === 'string' && text.trim()) {\n content = text.startsWith('@')\n ? await this.translateService.translateAsync(text)\n : text;\n } else if (text && typeof text === 'object') {\n content = this.translateService.resolve(text);\n } else {\n const codeKey = platformErrorI18nKey(message?.code);\n if (codeKey) {\n content = await this.translateService.translateAsync(codeKey);\n }\n }\n if (!content) {\n return;\n }\n const title = await this.translateService.translateAsync(\n message?.type === 'success'\n ? '@general:messages.generic.success.title'\n : '@general:messages.generic.error.title',\n );\n this.toastService.show({\n color: message?.type === 'success' ? 'success' : 'danger',\n title,\n content,\n });\n }\n\n private async pickAndEditPhoto(userId: string): Promise<File | null> {\n const gravatarEmail = await this.resolveUserEmail(userId);\n const pickResult = await this.fileChooser.pickProfilePhotoImage({ gravatarEmail });\n if (pickResult.gravatarNotFound) {\n await this.toastCommandMessage({\n type: 'error',\n text: '@auth:profile-page.commands.change-photo.messages.gravatar-not-found',\n });\n return null;\n }\n const picked = pickResult.file;\n if (!picked) {\n return null;\n }\n\n if (pickResult.fromGravatar) {\n return picked;\n }\n\n const editedBlob = await this.imageEditor.open({\n image: picked,\n title: '@auth:profile-page.commands.change-photo.dialog.editor-title',\n look: 'blank',\n square: true,\n });\n\n if (!editedBlob) {\n return null;\n }\n\n return new File([editedBlob], picked.name || 'profile-photo.png', {\n type: editedBlob.type || 'image/png',\n });\n }\n\n private async resolveUserEmail(userId: string): Promise<string | null> {\n try {\n const user = await this.entityService\n .withEntity(\n SecurityManagementRootConfig.module.name,\n SecurityManagementRootConfig.entities.users.name,\n )\n .data<string, AXMSecurityManagementUsersEntityModel>()\n .byKey(userId);\n const email = user?.email?.trim();\n return email ? email : null;\n } catch {\n return null;\n }\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":["SecurityManagementRootConfig"],"mappings":";;;;;;;;;;;;;;;AA4CA,MAAM,iCAAiC,GAAG;IACxC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;IACxC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;CAChC;AAEV;MAEa,qBAAqB,CAAA;AADlC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,uBAAuB,CAAC;AAC/C,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAC,qBAAqB,CAAC;AAC3C,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAC,qBAAqB,CAAC;AAC3C,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC;AAC7C,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAC/C,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AA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,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,cADR,MAAM,EAAA,CAAA,CAAA;;2FACnB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBADjC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { axpBeginCommandSubFlowNavigation, normalizeRouterUrl, axpPeekCommandSubFlowReturnUrl } from '@acorex-platform/framework-client/common';
|
|
2
|
+
|
|
3
|
+
//#region ----- Command return URL -----
|
|
4
|
+
/** Captures the active router URL when a long-running command (dialogs, file picker, crop) starts. */
|
|
5
|
+
function captureCommandReturnUrl(router, returnUrlOverride) {
|
|
6
|
+
const override = returnUrlOverride?.trim();
|
|
7
|
+
const url = override?.length ? override : router.url;
|
|
8
|
+
axpBeginCommandSubFlowNavigation(url);
|
|
9
|
+
return url;
|
|
10
|
+
}
|
|
11
|
+
/** True when the URL is the full-page welcome onboarding route (not in-app profile). */
|
|
12
|
+
function isWelcomeOnboardingRouterUrl(url) {
|
|
13
|
+
const normalized = normalizeRouterUrl(url);
|
|
14
|
+
return normalized.includes('/auth/account/welcome-onboarding');
|
|
15
|
+
}
|
|
16
|
+
/** Returns the user to the URL they were on when the command started, if navigation changed mid-flow. */
|
|
17
|
+
async function restoreCommandReturnUrlIfChanged(router, returnUrl) {
|
|
18
|
+
const target = axpPeekCommandSubFlowReturnUrl() ?? returnUrl;
|
|
19
|
+
const trimmed = target.trim();
|
|
20
|
+
if (!trimmed.length) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (normalizeRouterUrl(router.url) === normalizeRouterUrl(trimmed)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
await router.navigateByUrl(trimmed);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Restores the return URL immediately and after session/tab side-effects (e.g. avatar `setSession`).
|
|
30
|
+
*/
|
|
31
|
+
async function restoreCommandReturnUrlAfterSubFlow(router, returnUrl) {
|
|
32
|
+
const delaysMs = [0, 50, 200];
|
|
33
|
+
for (const delay of delaysMs) {
|
|
34
|
+
if (delay === 0) {
|
|
35
|
+
await restoreCommandReturnUrlIfChanged(router, returnUrl);
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
await new Promise((resolve) => {
|
|
39
|
+
setTimeout(() => {
|
|
40
|
+
void restoreCommandReturnUrlIfChanged(router, returnUrl).finally(() => resolve());
|
|
41
|
+
}, delay);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Restores the welcome onboarding route after avatar/account sub-flows.
|
|
47
|
+
* Tab session restore can still redirect to profile after `setSession`; re-assert welcome briefly.
|
|
48
|
+
*/
|
|
49
|
+
async function restoreWelcomeOnboardingAfterSubFlow(router, returnUrl) {
|
|
50
|
+
await restoreCommandReturnUrlAfterSubFlow(router, returnUrl);
|
|
51
|
+
if (!isWelcomeOnboardingRouterUrl(returnUrl)) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const target = normalizeRouterUrl(returnUrl);
|
|
55
|
+
const followUpDelaysMs = [100, 300, 500];
|
|
56
|
+
for (const delay of followUpDelaysMs) {
|
|
57
|
+
await new Promise((resolve) => {
|
|
58
|
+
setTimeout(() => resolve(), delay);
|
|
59
|
+
});
|
|
60
|
+
if (isWelcomeOnboardingRouterUrl(router.url)) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
await router.navigateByUrl(target);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
|
|
68
|
+
export { restoreCommandReturnUrlAfterSubFlow as a, captureCommandReturnUrl as c, isWelcomeOnboardingRouterUrl as i, restoreWelcomeOnboardingAfterSubFlow as r };
|
|
69
|
+
//# sourceMappingURL=acorex-platform-module-auth-client-command-return-url.util-mBmtJ7T2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-auth-client-command-return-url.util-mBmtJ7T2.mjs","sources":["../../../../libs/modules/auth/client/src/lib/shared/command-return-url.util.ts"],"sourcesContent":["import {\n axpBeginCommandSubFlowNavigation,\n axpPeekCommandSubFlowReturnUrl,\n normalizeRouterUrl,\n} from '@acorex-platform/framework-client/common';\nimport type { Router } from '@angular/router';\n\n//#region ----- Command return URL -----\n\n/** Captures the active router URL when a long-running command (dialogs, file picker, crop) starts. */\nexport function captureCommandReturnUrl(router: Router, returnUrlOverride?: string): string {\n const override = returnUrlOverride?.trim();\n const url = override?.length ? override : router.url;\n axpBeginCommandSubFlowNavigation(url);\n return url;\n}\n\n/** True when the URL is the full-page welcome onboarding route (not in-app profile). */\nexport function isWelcomeOnboardingRouterUrl(url: string): boolean {\n const normalized = normalizeRouterUrl(url);\n return normalized.includes('/auth/account/welcome-onboarding');\n}\n\n/** Returns the user to the URL they were on when the command started, if navigation changed mid-flow. */\nexport async function restoreCommandReturnUrlIfChanged(\n router: Router,\n returnUrl: string,\n): Promise<void> {\n const target = axpPeekCommandSubFlowReturnUrl() ?? returnUrl;\n const trimmed = target.trim();\n if (!trimmed.length) {\n return;\n }\n\n if (normalizeRouterUrl(router.url) === normalizeRouterUrl(trimmed)) {\n return;\n }\n\n await router.navigateByUrl(trimmed);\n}\n\n/**\n * Restores the return URL immediately and after session/tab side-effects (e.g. avatar `setSession`).\n */\nexport async function restoreCommandReturnUrlAfterSubFlow(\n router: Router,\n returnUrl: string,\n): Promise<void> {\n const delaysMs = [0, 50, 200];\n for (const delay of delaysMs) {\n if (delay === 0) {\n await restoreCommandReturnUrlIfChanged(router, returnUrl);\n continue;\n }\n\n await new Promise<void>((resolve) => {\n setTimeout(() => {\n void restoreCommandReturnUrlIfChanged(router, returnUrl).finally(() => resolve());\n }, delay);\n });\n }\n}\n\n/**\n * Restores the welcome onboarding route after avatar/account sub-flows.\n * Tab session restore can still redirect to profile after `setSession`; re-assert welcome briefly.\n */\nexport async function restoreWelcomeOnboardingAfterSubFlow(\n router: Router,\n returnUrl: string,\n): Promise<void> {\n await restoreCommandReturnUrlAfterSubFlow(router, returnUrl);\n\n if (!isWelcomeOnboardingRouterUrl(returnUrl)) {\n return;\n }\n\n const target = normalizeRouterUrl(returnUrl);\n const followUpDelaysMs = [100, 300, 500];\n for (const delay of followUpDelaysMs) {\n await new Promise<void>((resolve) => {\n setTimeout(() => resolve(), delay);\n });\n if (isWelcomeOnboardingRouterUrl(router.url)) {\n continue;\n }\n await router.navigateByUrl(target);\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;AAOA;AAEA;AACM,SAAU,uBAAuB,CAAC,MAAc,EAAE,iBAA0B,EAAA;AAChF,IAAA,MAAM,QAAQ,GAAG,iBAAiB,EAAE,IAAI,EAAE;AAC1C,IAAA,MAAM,GAAG,GAAG,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC,GAAG;IACpD,gCAAgC,CAAC,GAAG,CAAC;AACrC,IAAA,OAAO,GAAG;AACZ;AAEA;AACM,SAAU,4BAA4B,CAAC,GAAW,EAAA;AACtD,IAAA,MAAM,UAAU,GAAG,kBAAkB,CAAC,GAAG,CAAC;AAC1C,IAAA,OAAO,UAAU,CAAC,QAAQ,CAAC,kCAAkC,CAAC;AAChE;AAEA;AACO,eAAe,gCAAgC,CACpD,MAAc,EACd,SAAiB,EAAA;AAEjB,IAAA,MAAM,MAAM,GAAG,8BAA8B,EAAE,IAAI,SAAS;AAC5D,IAAA,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE;AAC7B,IAAA,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QACnB;IACF;AAEA,IAAA,IAAI,kBAAkB,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,kBAAkB,CAAC,OAAO,CAAC,EAAE;QAClE;IACF;AAEA,IAAA,MAAM,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC;AACrC;AAEA;;AAEG;AACI,eAAe,mCAAmC,CACvD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
ChangePassword: 'auth:change-password',
|
|
16
|
+
ManageTwoFactor: 'auth:manage-two-factor',
|
|
16
17
|
SetPinCode: 'auth:set-pin-code',
|
|
17
18
|
RemovePinCode: 'auth:remove-pin-code',
|
|
18
19
|
ViewLoginHistory: 'auth:view-login-history',
|
|
19
20
|
EditSignature: 'auth:edit-signature',
|
|
20
21
|
},
|
|
22
|
+
Onboarding: {
|
|
23
|
+
Welcome: 'auth:welcome-onboarding',
|
|
24
|
+
},
|
|
25
|
+
Account: {
|
|
26
|
+
/** Opens `/auth/account/waiting-room` (e.g. from membership-invite inbox action). */
|
|
27
|
+
OpenWaitingRoom: 'auth:open-waiting-room',
|
|
28
|
+
},
|
|
21
29
|
};
|
|
22
30
|
/** Scheduled purge of DeviceSessions idle past the InactiveSessionTermination setting. */
|
|
23
31
|
const AXM_AUTH_INACTIVE_SESSION_TERMINATION_PURGE_COMMAND_KEY = 'auth.inactive-session.terminate';
|
|
@@ -67,7 +75,8 @@ const RootConfig = {
|
|
|
67
75
|
//#region ----- Auth setting keys -----
|
|
68
76
|
var AXPAuthSettings;
|
|
69
77
|
(function (AXPAuthSettings) {
|
|
70
|
-
|
|
78
|
+
/** User-scoped: login requires verified authenticator enrollment when true. */
|
|
79
|
+
AXPAuthSettings["UserTwoFactorEnabled"] = "Auth:Setting:User.TwoFactor.Enabled";
|
|
71
80
|
AXPAuthSettings["PasswordComplexity"] = "Auth:Setting:Authentication.PasswordComplexity";
|
|
72
81
|
AXPAuthSettings["PasswordExpiryDays"] = "Auth:Setting:Authentication.PasswordExpiryDays";
|
|
73
82
|
AXPAuthSettings["MaxLoginAttempts"] = "Auth:Setting:Authentication.MaxLoginAttempts";
|
|
@@ -86,9 +95,10 @@ var AXPAuthSettings;
|
|
|
86
95
|
AXPAuthSettings["LockWhenIdleMinutes"] = "Auth:Setting:SessionManagement.LockWhenIdleMinutes";
|
|
87
96
|
AXPAuthSettings["InactiveSessionTermination"] = "Auth:Setting:SessionManagement.InactiveSessionTermination";
|
|
88
97
|
AXPAuthSettings["MaxActiveDeviceSessions"] = "Auth:Setting:SessionManagement.MaxActiveDeviceSessions";
|
|
98
|
+
/** User-scoped welcome onboarding progress blob. */
|
|
99
|
+
AXPAuthSettings["OnboardingWelcome"] = "Auth:Setting:Onboarding.Welcome";
|
|
89
100
|
})(AXPAuthSettings || (AXPAuthSettings = {}));
|
|
90
101
|
const AXPAuthInactiveSessionTerminationOptions = {
|
|
91
|
-
OneMinute: 'oneMinute',
|
|
92
102
|
OneWeek: 'oneWeek',
|
|
93
103
|
OneMonth: 'oneMonth',
|
|
94
104
|
ThreeMonths: 'threeMonths',
|
|
@@ -96,10 +106,6 @@ const AXPAuthInactiveSessionTerminationOptions = {
|
|
|
96
106
|
};
|
|
97
107
|
/** Shared select options for settings UI + Active Sessions modal (i18n title keys). */
|
|
98
108
|
const AXP_AUTH_INACTIVE_SESSION_TERMINATION_OPTION_DEFINITIONS = [
|
|
99
|
-
{
|
|
100
|
-
id: AXPAuthInactiveSessionTerminationOptions.OneMinute,
|
|
101
|
-
titleKey: '@auth:settings.session.terminate-old-sessions.options.one-minute',
|
|
102
|
-
},
|
|
103
109
|
{
|
|
104
110
|
id: AXPAuthInactiveSessionTerminationOptions.OneWeek,
|
|
105
111
|
titleKey: '@auth:settings.session.terminate-old-sessions.options.one-week',
|
|
@@ -121,7 +127,6 @@ const MS_MINUTE = 60_000;
|
|
|
121
127
|
const MS_DAY = 24 * 60 * MS_MINUTE;
|
|
122
128
|
/** Inactivity window for each stored termination option. */
|
|
123
129
|
const AXP_AUTH_INACTIVE_SESSION_TERMINATION_DURATION_MS = {
|
|
124
|
-
[AXPAuthInactiveSessionTerminationOptions.OneMinute]: MS_MINUTE,
|
|
125
130
|
[AXPAuthInactiveSessionTerminationOptions.OneWeek]: 7 * MS_DAY,
|
|
126
131
|
[AXPAuthInactiveSessionTerminationOptions.OneMonth]: 30 * MS_DAY,
|
|
127
132
|
[AXPAuthInactiveSessionTerminationOptions.ThreeMonths]: 90 * MS_DAY,
|