@acorex-platform/module-auth-client 0.0.18 → 0.0.20
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-acorex-platform-module-auth-client-mW7tx8C0.mjs → acorex-platform-module-auth-client-acorex-platform-module-auth-client-CYmUn-lw.mjs} +940 -608
- package/fesm2022/acorex-platform-module-auth-client-acorex-platform-module-auth-client-CYmUn-lw.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client-app-chooser.component-BVbu-f8h.mjs +75 -0
- package/fesm2022/acorex-platform-module-auth-client-app-chooser.component-BVbu-f8h.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-blank.layout-BRGgntib.mjs → acorex-platform-module-auth-client-blank.layout-BCXNPgrp.mjs} +6 -6
- package/fesm2022/acorex-platform-module-auth-client-blank.layout-BCXNPgrp.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-change-password.command-O8Mgxoqj.mjs → acorex-platform-module-auth-client-change-password.command-DIM_d7RO.mjs} +51 -41
- package/fesm2022/acorex-platform-module-auth-client-change-password.command-DIM_d7RO.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client-change-photo.command-CYGqrJV0.mjs +257 -0
- package/fesm2022/acorex-platform-module-auth-client-change-photo.command-CYGqrJV0.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client-contracts.mjs +46 -10
- package/fesm2022/acorex-platform-module-auth-client-contracts.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-edit-account-info.command-B-mVlXxg.mjs → acorex-platform-module-auth-client-edit-account-info.command-CD9IrimO.mjs} +5 -5
- package/fesm2022/acorex-platform-module-auth-client-edit-account-info.command-CD9IrimO.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-edit-signature.command-CcTJJwAX.mjs → acorex-platform-module-auth-client-edit-signature.command-TjOLhvKL.mjs} +5 -5
- package/fesm2022/acorex-platform-module-auth-client-edit-signature.command-TjOLhvKL.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client-get-user-activity.query-BTpibxe9.mjs +80 -0
- package/fesm2022/acorex-platform-module-auth-client-get-user-activity.query-BTpibxe9.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-lock-screen.command-PMoJJxe7.mjs → acorex-platform-module-auth-client-lock-screen.command-Br9O4b5c.mjs} +6 -6
- package/fesm2022/acorex-platform-module-auth-client-lock-screen.command-Br9O4b5c.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-login.module-C4S0RjM7.mjs → acorex-platform-module-auth-client-login.module-DJVL3bAF.mjs} +8 -21
- package/fesm2022/acorex-platform-module-auth-client-login.module-DJVL3bAF.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client-master.layout-DZUYm22p.mjs +39 -0
- package/fesm2022/acorex-platform-module-auth-client-master.layout-DZUYm22p.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-oauth-callback.component-CEMvfjj4.mjs → acorex-platform-module-auth-client-oauth-callback.component-DnQzPUxF.mjs} +11 -15
- package/fesm2022/acorex-platform-module-auth-client-oauth-callback.component-DnQzPUxF.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client-open-sessions.command-LZKM9fgo.mjs +200 -0
- package/fesm2022/acorex-platform-module-auth-client-open-sessions.command-LZKM9fgo.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-password.component-CIr6IBG6.mjs → acorex-platform-module-auth-client-password.component-CNKRWfuG.mjs} +86 -45
- package/fesm2022/acorex-platform-module-auth-client-password.component-CNKRWfuG.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client-password.component-CW0t9fEn.mjs +87 -0
- package/fesm2022/acorex-platform-module-auth-client-password.component-CW0t9fEn.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client-platform-settings-unavailable.component-BEVkQ3jh.mjs +47 -0
- package/fesm2022/acorex-platform-module-auth-client-platform-settings-unavailable.component-BEVkQ3jh.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-profile-activity-chart.component-DTY1eEI_.mjs → acorex-platform-module-auth-client-profile-activity-chart.component-CtSrYARX.mjs} +38 -46
- package/fesm2022/acorex-platform-module-auth-client-profile-activity-chart.component-CtSrYARX.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-profile-coming-soon.command-DBbFbzAx.mjs → acorex-platform-module-auth-client-profile-coming-soon.command-Crh2GsRA.mjs} +5 -5
- package/fesm2022/acorex-platform-module-auth-client-profile-coming-soon.command-Crh2GsRA.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-profile-delete-account-danger-zone.component-C6u3AB4N.mjs → acorex-platform-module-auth-client-profile-delete-account-danger-zone.component-D0QS8joQ.mjs} +18 -13
- package/fesm2022/{acorex-platform-module-auth-client-profile-delete-account-danger-zone.component-C6u3AB4N.mjs.map → acorex-platform-module-auth-client-profile-delete-account-danger-zone.component-D0QS8joQ.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-profile-page-component.provider-Dhmzo4ME.mjs → acorex-platform-module-auth-client-profile-page-component.provider-6lNx6bKI.mjs} +7 -7
- package/fesm2022/{acorex-platform-module-auth-client-profile-page-component.provider-Dhmzo4ME.mjs.map → acorex-platform-module-auth-client-profile-page-component.provider-6lNx6bKI.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-auth-client-profile-page.component-CdxseoJX.mjs +650 -0
- package/fesm2022/acorex-platform-module-auth-client-profile-page.component-CdxseoJX.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-register-password.component-ia6tdvTc.mjs → acorex-platform-module-auth-client-register-password.component-D-tBrCJv.mjs} +15 -14
- package/fesm2022/acorex-platform-module-auth-client-register-password.component-D-tBrCJv.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-register.module--DG9m8iC.mjs → acorex-platform-module-auth-client-register.module-BrXqva0B.mjs} +23 -23
- package/fesm2022/acorex-platform-module-auth-client-register.module-BrXqva0B.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-remove-pin-code.command-qtswigkv.mjs → acorex-platform-module-auth-client-remove-pin-code.command-uK04-h15.mjs} +7 -7
- package/fesm2022/acorex-platform-module-auth-client-remove-pin-code.command-uK04-h15.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client-reset-password.component-CcwDb6Wb.mjs +115 -0
- package/fesm2022/acorex-platform-module-auth-client-reset-password.component-CcwDb6Wb.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-result.component-DYJaB-FD.mjs → acorex-platform-module-auth-client-result.component-DWv1hmQR.mjs} +6 -6
- package/fesm2022/acorex-platform-module-auth-client-result.component-DWv1hmQR.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-routes-DVN2Y2Ps.mjs → acorex-platform-module-auth-client-routes-IX2qmeqU.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-routes-DVN2Y2Ps.mjs.map → acorex-platform-module-auth-client-routes-IX2qmeqU.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-auth-client-session-lock-overlay.component-BhsTAmVe.mjs +361 -0
- package/fesm2022/acorex-platform-module-auth-client-session-lock-overlay.component-BhsTAmVe.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client-set-pin-code.command-BJT7F-xz.mjs +116 -0
- package/fesm2022/acorex-platform-module-auth-client-set-pin-code.command-BJT7F-xz.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-set-pin-code.component-BHVqbYFv.mjs → acorex-platform-module-auth-client-set-pin-code.component-Cq4skm_3.mjs} +29 -20
- package/fesm2022/acorex-platform-module-auth-client-set-pin-code.component-Cq4skm_3.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-settings.provider-n1qbs6e1.mjs → acorex-platform-module-auth-client-settings.provider-Yaoz8yp3.mjs} +139 -11
- package/fesm2022/acorex-platform-module-auth-client-settings.provider-Yaoz8yp3.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-show-profile-command-CxMz1yy-.mjs → acorex-platform-module-auth-client-show-profile-command-BWoDxIdx.mjs} +5 -6
- package/fesm2022/acorex-platform-module-auth-client-show-profile-command-BWoDxIdx.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-signout-command-DqqrP5pk.mjs → acorex-platform-module-auth-client-signout-command-B7n_Fn4P.mjs} +5 -5
- package/fesm2022/acorex-platform-module-auth-client-signout-command-B7n_Fn4P.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client-tenant-chooser.component-CHmg7D5H.mjs +67 -0
- package/fesm2022/acorex-platform-module-auth-client-tenant-chooser.component-CHmg7D5H.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client-two-factor-code.component-nsB4v25Z.mjs +40 -0
- package/fesm2022/acorex-platform-module-auth-client-two-factor-code.component-nsB4v25Z.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-two-factor.module-FAqKbmBb.mjs → acorex-platform-module-auth-client-two-factor.module-_jYo6xXr.mjs} +8 -11
- package/fesm2022/acorex-platform-module-auth-client-two-factor.module-_jYo6xXr.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-view-login-history.command-B42BHIAL.mjs → acorex-platform-module-auth-client-view-login-history.command-ovj5rdHL.mjs} +13 -11
- package/fesm2022/acorex-platform-module-auth-client-view-login-history.command-ovj5rdHL.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client.mjs +1 -1
- package/package.json +1 -1
- package/types/acorex-platform-module-auth-client-contracts.d.ts +43 -9
- package/types/acorex-platform-module-auth-client.d.ts +63 -56
- package/fesm2022/acorex-platform-module-auth-client-acorex-platform-module-auth-client-mW7tx8C0.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-app-chooser.component-IPLp1kVv.mjs +0 -67
- package/fesm2022/acorex-platform-module-auth-client-app-chooser.component-IPLp1kVv.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-blank.layout-BRGgntib.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-change-password.command-O8Mgxoqj.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-change-photo.command-BcNq9mTU.mjs +0 -192
- package/fesm2022/acorex-platform-module-auth-client-change-photo.command-BcNq9mTU.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-edit-account-info.command-B-mVlXxg.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-edit-signature.command-CcTJJwAX.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-lock-screen.command-PMoJJxe7.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-login.module-C4S0RjM7.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-master.layout-DXwb5VSr.mjs +0 -24
- package/fesm2022/acorex-platform-module-auth-client-master.layout-DXwb5VSr.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-oauth-callback.component-CEMvfjj4.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-open-sessions.command-BsS9b6Xk.mjs +0 -196
- package/fesm2022/acorex-platform-module-auth-client-open-sessions.command-BsS9b6Xk.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-password.component-CIr6IBG6.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-password.component-DnFItGdA.mjs +0 -88
- package/fesm2022/acorex-platform-module-auth-client-password.component-DnFItGdA.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-profile-activity-chart.component-DTY1eEI_.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-profile-coming-soon.command-DBbFbzAx.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-profile-page.component-CJ9AA3ZN.mjs +0 -446
- package/fesm2022/acorex-platform-module-auth-client-profile-page.component-CJ9AA3ZN.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-register-password.component-ia6tdvTc.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-register.module--DG9m8iC.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-remove-pin-code.command-qtswigkv.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-reset-password.component-CTlrt_18.mjs +0 -115
- package/fesm2022/acorex-platform-module-auth-client-reset-password.component-CTlrt_18.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-result.component-DYJaB-FD.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-session-lock-overlay.component-CN1JqPBW.mjs +0 -346
- package/fesm2022/acorex-platform-module-auth-client-session-lock-overlay.component-CN1JqPBW.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-set-pin-code.command-mBEdso1T.mjs +0 -33
- package/fesm2022/acorex-platform-module-auth-client-set-pin-code.command-mBEdso1T.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-set-pin-code.component-BHVqbYFv.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-settings.provider-n1qbs6e1.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-show-profile-command-CxMz1yy-.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-signout-command-DqqrP5pk.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-tenant-chooser.component-B_9s4F36.mjs +0 -59
- package/fesm2022/acorex-platform-module-auth-client-tenant-chooser.component-B_9s4F36.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-two-factor-code.component-DAxlYlhM.mjs +0 -40
- package/fesm2022/acorex-platform-module-auth-client-two-factor-code.component-DAxlYlhM.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-two-factor.module-FAqKbmBb.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-view-login-history.command-B42BHIAL.mjs.map +0 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, signal, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { AXButtonModule } from '@acorex/components/button';
|
|
4
|
+
import { AXCheckBoxModule } from '@acorex/components/check-box';
|
|
5
|
+
import { AXDecoratorModule } from '@acorex/components/decorators';
|
|
6
|
+
import { AXFormModule } from '@acorex/components/form';
|
|
7
|
+
import { AXImageModule } from '@acorex/components/image';
|
|
8
|
+
import { AXLabelModule } from '@acorex/components/label';
|
|
9
|
+
import { AXLoadingModule } from '@acorex/components/loading';
|
|
10
|
+
import * as i1 from '@acorex/components/skeleton';
|
|
11
|
+
import { AXSkeletonModule } from '@acorex/components/skeleton';
|
|
12
|
+
import { AXTextBoxModule } from '@acorex/components/text-box';
|
|
13
|
+
import * as i5 from '@acorex/core/translation';
|
|
14
|
+
import { AXTranslationModule } from '@acorex/core/translation';
|
|
15
|
+
import { AXPSessionService } from '@acorex-platform/framework-client/auth';
|
|
16
|
+
import { AXPPlatformBrandingService } from '@acorex-platform/framework-client/common';
|
|
17
|
+
import { AXPLogoComponent } from '@acorex-platform/framework-client/core';
|
|
18
|
+
import { AXPUserAvatarComponent } from '@acorex-platform/framework-client/layout/components';
|
|
19
|
+
import * as i3 from '@angular/common';
|
|
20
|
+
import { CommonModule } from '@angular/common';
|
|
21
|
+
import { Router } from '@angular/router';
|
|
22
|
+
import { w as AXPTenantChooserDropdownComponent, x as AXPAppChooserListComponent } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-CYmUn-lw.mjs';
|
|
23
|
+
|
|
24
|
+
class AXPAuthAppChooserComponent {
|
|
25
|
+
constructor() {
|
|
26
|
+
this.router = inject(Router);
|
|
27
|
+
this.platformBranding = inject(AXPPlatformBrandingService);
|
|
28
|
+
this.platformTitle = signal('', /* @ts-ignore */
|
|
29
|
+
...(ngDevMode ? [{ debugName: "platformTitle" }] : /* istanbul ignore next */ []));
|
|
30
|
+
this.sessionService = inject(AXPSessionService);
|
|
31
|
+
this.user = this.sessionService.user;
|
|
32
|
+
this.tenants$ = this.sessionService.tenants$;
|
|
33
|
+
this.tenant = this.sessionService.tenant;
|
|
34
|
+
this.catalogLoading = signal(true, /* @ts-ignore */
|
|
35
|
+
...(ngDevMode ? [{ debugName: "catalogLoading" }] : /* istanbul ignore next */ []));
|
|
36
|
+
}
|
|
37
|
+
ngOnInit() {
|
|
38
|
+
void this.platformBranding.resolvePlatformTitle().then((title) => this.platformTitle.set(title));
|
|
39
|
+
}
|
|
40
|
+
handleCatalogLoading(loading) {
|
|
41
|
+
this.catalogLoading.set(loading);
|
|
42
|
+
}
|
|
43
|
+
tenantChooser() {
|
|
44
|
+
this.router.navigate(['/auth/account/tenant-chooser']);
|
|
45
|
+
}
|
|
46
|
+
async handleSignout() {
|
|
47
|
+
await this.sessionService.signout();
|
|
48
|
+
this.router.navigate(['/auth/login']);
|
|
49
|
+
}
|
|
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: i1.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" }, { 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.AsyncPipe, name: "async" }, { kind: "pipe", type: i5.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager, encapsulation: i0.ViewEncapsulation.None }); }
|
|
52
|
+
}
|
|
53
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPAuthAppChooserComponent, decorators: [{
|
|
54
|
+
type: Component,
|
|
55
|
+
args: [{ selector: 'axp-auth-app-chooser', imports: [
|
|
56
|
+
CommonModule,
|
|
57
|
+
AXFormModule,
|
|
58
|
+
AXTextBoxModule,
|
|
59
|
+
AXButtonModule,
|
|
60
|
+
AXLabelModule,
|
|
61
|
+
AXCheckBoxModule,
|
|
62
|
+
AXImageModule,
|
|
63
|
+
AXDecoratorModule,
|
|
64
|
+
AXPLogoComponent,
|
|
65
|
+
AXLoadingModule,
|
|
66
|
+
AXSkeletonModule,
|
|
67
|
+
AXTranslationModule,
|
|
68
|
+
AXPTenantChooserDropdownComponent,
|
|
69
|
+
AXPAppChooserListComponent,
|
|
70
|
+
AXPUserAvatarComponent,
|
|
71
|
+
], changeDetection: ChangeDetectionStrategy.Eager, encapsulation: ViewEncapsulation.None, 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"] }]
|
|
72
|
+
}] });
|
|
73
|
+
|
|
74
|
+
export { AXPAuthAppChooserComponent };
|
|
75
|
+
//# sourceMappingURL=acorex-platform-module-auth-client-app-chooser.component-BVbu-f8h.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-auth-client-app-chooser.component-BVbu-f8h.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":["i2"],"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,CAA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AS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,sBAAsB,EAAA,OAAA,EAGvB;wBACP,YAAY;wBACZ,YAAY;wBACZ,eAAe;wBACf,cAAc;wBACd,aAAa;wBACb,gBAAgB;wBAChB,aAAa;wBACb,iBAAiB;wBACjB,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,18 +1,18 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component } from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/router';
|
|
4
4
|
import { RouterModule } from '@angular/router';
|
|
5
5
|
|
|
6
6
|
class AXPAuthBlankLayoutComponent {
|
|
7
7
|
constructor() { }
|
|
8
8
|
ngOnInit() { }
|
|
9
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
10
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
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: i1.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
|
|
11
11
|
}
|
|
12
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
12
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPAuthBlankLayoutComponent, decorators: [{
|
|
13
13
|
type: Component,
|
|
14
|
-
args: [{ imports: [RouterModule], template: "<router-outlet></router-outlet>" }]
|
|
14
|
+
args: [{ changeDetection: ChangeDetectionStrategy.Eager, imports: [RouterModule], template: "<router-outlet></router-outlet>" }]
|
|
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-BCXNPgrp.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-auth-client-blank.layout-BCXNPgrp.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":[],"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,EAAA,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;;;;;"}
|
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
import { AXToastService } from '@acorex/components/toast';
|
|
2
2
|
import { AXTranslationService } from '@acorex/core/translation';
|
|
3
|
-
import {
|
|
3
|
+
import { AXM_CHANGE_OWN_PASSWORD_ERROR_CODES, AXMSecurityManagementServerCommands } from '@acorex-platform/module-security-management-client/contracts';
|
|
4
4
|
import { AXPSessionService } from '@acorex-platform/framework-client/auth';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { AXPCommandService } from '@acorex-platform/framework-client/runtime';
|
|
6
|
+
import { runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';
|
|
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 {
|
|
11
|
-
import { h as AXPAuthPasswordComplexityService, i as AXPAuthPasswordChangeTrackingService, j as getPasswordComplexityHintKey, k as getPasswordComplexityValidationMessageKey, l as validatePasswordAgainstComplexity } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-mW7tx8C0.mjs';
|
|
10
|
+
import { k as AXPAuthPasswordComplexityService, l as AXPAuthPasswordChangeTrackingService, m as getPasswordComplexityHintKey, n as getPasswordComplexityValidationMessageKey, o as validatePasswordAgainstComplexity, C as CHANGE_PASSWORD_SECTION_ID, d as PROFILE_SECTION_INSIGHTS_PATCH_METADATA_KEY, p as buildPasswordLastChangedInsights } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-CYmUn-lw.mjs';
|
|
12
11
|
|
|
12
|
+
//#region ---- Constants ----
|
|
13
|
+
const CHANGE_OWN_PASSWORD_ERROR_I18N = {
|
|
14
|
+
[AXM_CHANGE_OWN_PASSWORD_ERROR_CODES.NotSignedIn]: '@auth:profile-page.commands.change-password.messages.not-signed-in',
|
|
15
|
+
[AXM_CHANGE_OWN_PASSWORD_ERROR_CODES.IncorrectCurrent]: '@auth:profile-page.commands.change-password.messages.incorrect-current',
|
|
16
|
+
[AXM_CHANGE_OWN_PASSWORD_ERROR_CODES.SameAsCurrent]: '@auth:profile-page.commands.change-password.messages.same-as-current',
|
|
17
|
+
[AXM_CHANGE_OWN_PASSWORD_ERROR_CODES.InvalidInput]: '@auth:profile-page.commands.change-password.messages.save-failed',
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
13
20
|
//#region ---- Change password command ----
|
|
14
21
|
/** Opens a dialog to change the signed-in user's password. */
|
|
15
22
|
class AXPChangePasswordCommand {
|
|
16
23
|
constructor() {
|
|
17
24
|
//#region ---- Services & Dependencies ----
|
|
18
25
|
this.layoutBuilder = inject(AXPLayoutBuilderService);
|
|
19
|
-
this.
|
|
26
|
+
this.commandService = inject(AXPCommandService);
|
|
20
27
|
this.sessionService = inject(AXPSessionService);
|
|
21
28
|
this.passwordComplexityService = inject(AXPAuthPasswordComplexityService);
|
|
22
29
|
this.passwordChangeTrackingService = inject(AXPAuthPasswordChangeTrackingService);
|
|
@@ -97,50 +104,52 @@ class AXPChangePasswordCommand {
|
|
|
97
104
|
})
|
|
98
105
|
.onAction(async (dialogRef) => {
|
|
99
106
|
if (dialogRef.action() === 'cancel') {
|
|
100
|
-
return
|
|
107
|
+
return null;
|
|
101
108
|
}
|
|
102
109
|
const form = dialogRef.context();
|
|
103
110
|
const currentPassword = form.currentPassword ?? '';
|
|
104
111
|
const newPassword = form.newPassword ?? '';
|
|
105
112
|
const confirmPassword = form.confirmPassword ?? '';
|
|
106
113
|
if (newPassword !== confirmPassword) {
|
|
107
|
-
|
|
108
|
-
throw new Error('Password confirmation mismatch');
|
|
114
|
+
throw new Error('@auth:profile-page.commands.change-password.messages.mismatch');
|
|
109
115
|
}
|
|
110
116
|
if (newPassword === currentPassword) {
|
|
111
|
-
|
|
112
|
-
throw new Error('New password matches current password');
|
|
117
|
+
throw new Error('@auth:profile-page.commands.change-password.messages.same-as-current');
|
|
113
118
|
}
|
|
114
119
|
const submitComplexity = await this.passwordComplexityService.getLevel();
|
|
115
120
|
const submitValidationMessageKey = getPasswordComplexityValidationMessageKey(submitComplexity);
|
|
116
121
|
if (!validatePasswordAgainstComplexity(newPassword, submitComplexity)) {
|
|
117
|
-
|
|
118
|
-
throw new Error('Password does not meet complexity requirements');
|
|
119
|
-
}
|
|
120
|
-
const userId = this.sessionService.user?.id;
|
|
121
|
-
if (isNil(userId)) {
|
|
122
|
-
await this.showError('@auth:profile-page.commands.change-password.messages.not-signed-in');
|
|
123
|
-
throw new Error('No signed-in user');
|
|
122
|
+
throw new Error(submitValidationMessageKey);
|
|
124
123
|
}
|
|
125
124
|
dialogRef.setLoading(true);
|
|
126
125
|
try {
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
126
|
+
const serverResult = await this.commandService.execute(AXMSecurityManagementServerCommands.ChangeOwnPassword, { currentPassword, newPassword });
|
|
127
|
+
if (!serverResult?.success) {
|
|
128
|
+
throw new Error(this.resolveServerErrorKey(serverResult?.message?.code));
|
|
129
|
+
}
|
|
130
|
+
const payload = runtimeCommandPayloadData(serverResult);
|
|
131
|
+
const passwordChangedAt = payload?.passwordChangedAt
|
|
132
|
+
? new Date(payload.passwordChangedAt)
|
|
133
|
+
: new Date();
|
|
134
|
+
const userId = this.sessionService.user?.id;
|
|
135
|
+
if (userId) {
|
|
136
|
+
this.passwordChangeTrackingService.recordChange(userId, passwordChangedAt);
|
|
134
137
|
}
|
|
135
|
-
await userData.update(userId, {
|
|
136
|
-
password: await hashPassword(newPassword),
|
|
137
|
-
passwordChangedAt: new Date().toISOString(),
|
|
138
|
-
});
|
|
139
|
-
this.passwordChangeTrackingService.recordChange(userId);
|
|
140
138
|
const successTitle = await this.translateService.translateAsync('@auth:profile-page.commands.change-password.messages.success');
|
|
141
139
|
this.toastService.show({ color: 'success', title: successTitle });
|
|
142
140
|
dialogRef.close();
|
|
143
|
-
return {
|
|
141
|
+
return {
|
|
142
|
+
success: true,
|
|
143
|
+
kind: 'object',
|
|
144
|
+
data: undefined,
|
|
145
|
+
metadata: {
|
|
146
|
+
refresh: false,
|
|
147
|
+
[PROFILE_SECTION_INSIGHTS_PATCH_METADATA_KEY]: {
|
|
148
|
+
sectionId: CHANGE_PASSWORD_SECTION_ID,
|
|
149
|
+
insights: buildPasswordLastChangedInsights(passwordChangedAt),
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
};
|
|
144
153
|
}
|
|
145
154
|
finally {
|
|
146
155
|
dialogRef.setLoading(false);
|
|
@@ -148,22 +157,23 @@ class AXPChangePasswordCommand {
|
|
|
148
157
|
});
|
|
149
158
|
})
|
|
150
159
|
.show();
|
|
151
|
-
return result ?? { success: false };
|
|
160
|
+
return resolveLayoutBuilderDialogResult(result) ?? { success: false };
|
|
152
161
|
}
|
|
153
162
|
//#endregion
|
|
154
163
|
//#region ---- Utility Methods ----
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
164
|
+
resolveServerErrorKey(code) {
|
|
165
|
+
if (code && CHANGE_OWN_PASSWORD_ERROR_I18N[code]) {
|
|
166
|
+
return CHANGE_OWN_PASSWORD_ERROR_I18N[code];
|
|
167
|
+
}
|
|
168
|
+
return '@auth:profile-page.commands.change-password.messages.save-failed';
|
|
159
169
|
}
|
|
160
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
161
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
170
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPChangePasswordCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
171
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPChangePasswordCommand, providedIn: 'root' }); }
|
|
162
172
|
}
|
|
163
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
173
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPChangePasswordCommand, decorators: [{
|
|
164
174
|
type: Injectable,
|
|
165
175
|
args: [{ providedIn: 'root' }]
|
|
166
176
|
}] });
|
|
167
177
|
|
|
168
178
|
export { AXPChangePasswordCommand };
|
|
169
|
-
//# sourceMappingURL=acorex-platform-module-auth-client-change-password.command-
|
|
179
|
+
//# sourceMappingURL=acorex-platform-module-auth-client-change-password.command-DIM_d7RO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-auth-client-change-password.command-DIM_d7RO.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;AAC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;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;;;;;"}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { AXToastService } from '@acorex/components/toast';
|
|
2
|
+
import { AXTranslationService } from '@acorex/core/translation';
|
|
3
|
+
import { extractRequestErrorInfo, platformErrorI18nKey } from '@acorex-platform/framework-client/common';
|
|
4
|
+
import { AXPSessionService } from '@acorex-platform/framework-client/auth';
|
|
5
|
+
import { AXPImageEditorService } from '@acorex-platform/framework-client/layout/components';
|
|
6
|
+
import { AXPLayoutBuilderService } from '@acorex-platform/framework-client/layout/builder';
|
|
7
|
+
import { AXFileService } from '@acorex/core/file';
|
|
8
|
+
import * as i0 from '@angular/core';
|
|
9
|
+
import { inject, Injectable } from '@angular/core';
|
|
10
|
+
import { isNil } from 'lodash';
|
|
11
|
+
import { j as AXPUserAvatarSyncService } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-CYmUn-lw.mjs';
|
|
12
|
+
|
|
13
|
+
const PROFILE_PHOTO_DIALOG_PREVIEW_SIZE = {
|
|
14
|
+
small: { width: '100%', height: 'auto' },
|
|
15
|
+
large: { width: '100%', height: 'auto' },
|
|
16
|
+
};
|
|
17
|
+
/** Self-service profile photo upload, replace, and removal backed by file storage. */
|
|
18
|
+
class AXPChangePhotoCommand {
|
|
19
|
+
constructor() {
|
|
20
|
+
//#region ---- Services & Dependencies ----
|
|
21
|
+
this.layoutBuilder = inject(AXPLayoutBuilderService);
|
|
22
|
+
this.fileService = inject(AXFileService);
|
|
23
|
+
this.imageEditor = inject(AXPImageEditorService);
|
|
24
|
+
this.avatarSync = inject(AXPUserAvatarSyncService);
|
|
25
|
+
this.sessionService = inject(AXPSessionService);
|
|
26
|
+
this.toastService = inject(AXToastService);
|
|
27
|
+
this.translateService = inject(AXTranslationService);
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region ---- Command ----
|
|
31
|
+
async execute(input = {}) {
|
|
32
|
+
const userId = this.sessionService.user?.id;
|
|
33
|
+
if (isNil(userId)) {
|
|
34
|
+
return {
|
|
35
|
+
success: false,
|
|
36
|
+
message: {
|
|
37
|
+
text: '@auth:profile-page.commands.change-photo.messages.not-signed-in',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const mode = input.mode;
|
|
42
|
+
if (mode === 'upload') {
|
|
43
|
+
return this.executeUploadFlow(userId);
|
|
44
|
+
}
|
|
45
|
+
return this.executeManageFlow(userId);
|
|
46
|
+
}
|
|
47
|
+
async executeUploadFlow(userId) {
|
|
48
|
+
const editedFile = await this.pickAndEditPhoto();
|
|
49
|
+
if (!editedFile) {
|
|
50
|
+
return { success: false };
|
|
51
|
+
}
|
|
52
|
+
return this.uploadAvatarAndNotify(userId, editedFile);
|
|
53
|
+
}
|
|
54
|
+
async executeManageFlow(userId) {
|
|
55
|
+
const previewUrl = await this.resolveDialogPreviewUrl(userId);
|
|
56
|
+
if (!previewUrl) {
|
|
57
|
+
return this.executeUploadFlow(userId);
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
const result = await this.layoutBuilder
|
|
61
|
+
.create()
|
|
62
|
+
.dialog((dialog) => {
|
|
63
|
+
dialog
|
|
64
|
+
.setTitle('@auth:profile-page.commands.change-photo.dialog.title')
|
|
65
|
+
.setSize('sm')
|
|
66
|
+
.setCloseButton(true)
|
|
67
|
+
.setContext({ previewUrl })
|
|
68
|
+
.content((layout) => {
|
|
69
|
+
layout.flex((flex) => {
|
|
70
|
+
flex
|
|
71
|
+
.setDirection('column')
|
|
72
|
+
.setGap('1rem')
|
|
73
|
+
.setAlignItems('center')
|
|
74
|
+
.setJustifyContent('center')
|
|
75
|
+
.setOptions({ width: '100%', maxWidth: '100%', overflowX: 'hidden' });
|
|
76
|
+
flex.customWidget('image', {
|
|
77
|
+
path: 'previewUrl',
|
|
78
|
+
type: 'profile-photo',
|
|
79
|
+
readonly: true,
|
|
80
|
+
enablePreviewClick: false,
|
|
81
|
+
responsiveSize: PROFILE_PHOTO_DIALOG_PREVIEW_SIZE,
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
})
|
|
85
|
+
.setActions((actions) => {
|
|
86
|
+
actions.custom({
|
|
87
|
+
title: '@auth:profile-page.commands.change-photo.actions.remove',
|
|
88
|
+
color: 'danger',
|
|
89
|
+
position: 'prefix',
|
|
90
|
+
command: { name: 'remove' },
|
|
91
|
+
});
|
|
92
|
+
actions.custom({
|
|
93
|
+
title: '@auth:profile-page.commands.change-photo.actions.change',
|
|
94
|
+
color: 'primary',
|
|
95
|
+
command: { name: 'change' },
|
|
96
|
+
});
|
|
97
|
+
})
|
|
98
|
+
.onAction(async (dialogRef) => {
|
|
99
|
+
const action = dialogRef.action();
|
|
100
|
+
if (action === 'remove') {
|
|
101
|
+
dialogRef.setLoading(true);
|
|
102
|
+
try {
|
|
103
|
+
await this.avatarSync.removeAvatar(userId);
|
|
104
|
+
return {
|
|
105
|
+
success: true,
|
|
106
|
+
kind: 'object',
|
|
107
|
+
data: undefined,
|
|
108
|
+
message: {
|
|
109
|
+
type: 'success',
|
|
110
|
+
text: '@auth:profile-page.commands.change-photo.messages.removed',
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
const info = extractRequestErrorInfo(error);
|
|
116
|
+
return {
|
|
117
|
+
success: false,
|
|
118
|
+
keepDialogOpen: true,
|
|
119
|
+
message: {
|
|
120
|
+
type: 'error',
|
|
121
|
+
code: info?.code,
|
|
122
|
+
text: platformErrorI18nKey(info?.code) ??
|
|
123
|
+
'@auth:profile-page.commands.change-photo.messages.failed',
|
|
124
|
+
details: info?.details,
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
finally {
|
|
129
|
+
dialogRef.setLoading(false);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (action === 'change') {
|
|
133
|
+
const editedFile = await this.pickAndEditPhoto();
|
|
134
|
+
if (!editedFile) {
|
|
135
|
+
return { success: false, keepDialogOpen: true };
|
|
136
|
+
}
|
|
137
|
+
dialogRef.setLoading(true);
|
|
138
|
+
try {
|
|
139
|
+
const uploadResult = await this.uploadAvatarAndNotify(userId, editedFile);
|
|
140
|
+
if (!uploadResult.success) {
|
|
141
|
+
// Dialog stays open — toast middleware has not finished execute yet.
|
|
142
|
+
await this.toastCommandMessage(uploadResult.message);
|
|
143
|
+
return { ...uploadResult, keepDialogOpen: true };
|
|
144
|
+
}
|
|
145
|
+
return uploadResult;
|
|
146
|
+
}
|
|
147
|
+
finally {
|
|
148
|
+
dialogRef.setLoading(false);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return { success: false, keepDialogOpen: true };
|
|
152
|
+
});
|
|
153
|
+
})
|
|
154
|
+
.show();
|
|
155
|
+
return result ?? { success: false };
|
|
156
|
+
}
|
|
157
|
+
finally {
|
|
158
|
+
if (previewUrl?.startsWith('blob:')) {
|
|
159
|
+
URL.revokeObjectURL(previewUrl);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
async resolveDialogPreviewUrl(userId) {
|
|
164
|
+
try {
|
|
165
|
+
const blob = await this.avatarSync.getCurrentAvatarBlob(userId);
|
|
166
|
+
if (!blob) {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
return URL.createObjectURL(blob);
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region ---- Utility Methods ----
|
|
177
|
+
async uploadAvatarAndNotify(userId, file) {
|
|
178
|
+
try {
|
|
179
|
+
await this.avatarSync.uploadAndSetAvatar(userId, file);
|
|
180
|
+
return { success: true, kind: 'object', data: undefined, message: {
|
|
181
|
+
type: 'success',
|
|
182
|
+
text: '@auth:profile-page.commands.change-photo.messages.success',
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
const info = extractRequestErrorInfo(error);
|
|
188
|
+
return {
|
|
189
|
+
success: false,
|
|
190
|
+
message: {
|
|
191
|
+
type: 'error',
|
|
192
|
+
code: info?.code,
|
|
193
|
+
text: platformErrorI18nKey(info?.code) ??
|
|
194
|
+
'@auth:profile-page.commands.change-photo.messages.failed',
|
|
195
|
+
details: info?.details,
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
async toastCommandMessage(message) {
|
|
201
|
+
const text = message?.text;
|
|
202
|
+
let content = null;
|
|
203
|
+
if (typeof text === 'string' && text.trim()) {
|
|
204
|
+
content = text.startsWith('@')
|
|
205
|
+
? await this.translateService.translateAsync(text)
|
|
206
|
+
: text;
|
|
207
|
+
}
|
|
208
|
+
else if (text && typeof text === 'object') {
|
|
209
|
+
content = this.translateService.resolve(text);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
const codeKey = platformErrorI18nKey(message?.code);
|
|
213
|
+
if (codeKey) {
|
|
214
|
+
content = await this.translateService.translateAsync(codeKey);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
if (!content) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const title = await this.translateService.translateAsync(message?.type === 'success'
|
|
221
|
+
? '@general:messages.generic.success.title'
|
|
222
|
+
: '@general:messages.generic.error.title');
|
|
223
|
+
this.toastService.show({
|
|
224
|
+
color: message?.type === 'success' ? 'success' : 'danger',
|
|
225
|
+
title,
|
|
226
|
+
content,
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
async pickAndEditPhoto() {
|
|
230
|
+
const files = await this.fileService.choose({ accept: 'image/png, image/jpeg, image/webp' });
|
|
231
|
+
const picked = files[0];
|
|
232
|
+
if (!picked) {
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
const editedBlob = await this.imageEditor.open({
|
|
236
|
+
image: picked,
|
|
237
|
+
title: '@auth:profile-page.commands.change-photo.dialog.editor-title',
|
|
238
|
+
look: 'blank',
|
|
239
|
+
aspectRatio: '1',
|
|
240
|
+
});
|
|
241
|
+
if (!editedBlob) {
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
return new File([editedBlob], picked.name || 'profile-photo.png', {
|
|
245
|
+
type: editedBlob.type || 'image/png',
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPChangePhotoCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
249
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPChangePhotoCommand, providedIn: 'root' }); }
|
|
250
|
+
}
|
|
251
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPChangePhotoCommand, decorators: [{
|
|
252
|
+
type: Injectable,
|
|
253
|
+
args: [{ providedIn: 'root' }]
|
|
254
|
+
}] });
|
|
255
|
+
|
|
256
|
+
export { AXPChangePhotoCommand };
|
|
257
|
+
//# sourceMappingURL=acorex-platform-module-auth-client-change-photo.command-CYGqrJV0.mjs.map
|