@acorex-platform/module-auth-client 2.0.0-next.5 → 2.0.0-next.50
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-CWE43xt1.mjs → acorex-platform-module-auth-client-acorex-platform-module-auth-client-Cq9R3s5A.mjs} +82 -67
- package/fesm2022/acorex-platform-module-auth-client-acorex-platform-module-auth-client-Cq9R3s5A.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-app-chooser.component-D14L5cdt.mjs → acorex-platform-module-auth-client-app-chooser.component-D99xVLtc.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-app-chooser.component-D14L5cdt.mjs.map → acorex-platform-module-auth-client-app-chooser.component-D99xVLtc.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-change-password.command-DN0yaJ9l.mjs → acorex-platform-module-auth-client-change-password.command-CAJir6Go.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-change-password.command-DN0yaJ9l.mjs.map → acorex-platform-module-auth-client-change-password.command-CAJir6Go.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-change-photo.command-CWeeauFw.mjs → acorex-platform-module-auth-client-change-photo.command-C-RYaG1B.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-change-photo.command-CWeeauFw.mjs.map → acorex-platform-module-auth-client-change-photo.command-C-RYaG1B.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-auth-client-contracts.mjs +17 -2
- package/fesm2022/acorex-platform-module-auth-client-contracts.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-get-user-activity.query-DI0JR1cS.mjs → acorex-platform-module-auth-client-get-user-activity.query-Bug-SR6J.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-get-user-activity.query-DI0JR1cS.mjs.map → acorex-platform-module-auth-client-get-user-activity.query-Bug-SR6J.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-lock-screen.command-BnS3p6z3.mjs → acorex-platform-module-auth-client-lock-screen.command-Uros3kRx.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-lock-screen.command-BnS3p6z3.mjs.map → acorex-platform-module-auth-client-lock-screen.command-Uros3kRx.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-login.module-DVbaukL7.mjs → acorex-platform-module-auth-client-login.module-B-NNlaEN.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-login.module-DVbaukL7.mjs.map → acorex-platform-module-auth-client-login.module-B-NNlaEN.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-manage-two-factor.command-7e4HVcyU.mjs → acorex-platform-module-auth-client-manage-two-factor.command-CD5kAdfT.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-manage-two-factor.command-7e4HVcyU.mjs.map → acorex-platform-module-auth-client-manage-two-factor.command-CD5kAdfT.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-open-sessions.command-CMNlOr22.mjs → acorex-platform-module-auth-client-open-sessions.command-Do8kp-x5.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-open-sessions.command-CMNlOr22.mjs.map → acorex-platform-module-auth-client-open-sessions.command-Do8kp-x5.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-password.component-DekdMba0.mjs → acorex-platform-module-auth-client-password.component-DLtE_j1b.mjs} +30 -14
- package/fesm2022/acorex-platform-module-auth-client-password.component-DLtE_j1b.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-profile-activity-chart.component-DUpEusRs.mjs → acorex-platform-module-auth-client-profile-activity-chart.component-DuNBjC-O.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-profile-activity-chart.component-DUpEusRs.mjs.map → acorex-platform-module-auth-client-profile-activity-chart.component-DuNBjC-O.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-profile-page-component.provider-DaFESP6l.mjs → acorex-platform-module-auth-client-profile-page-component.provider-DCRYHTan.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-profile-page-component.provider-DaFESP6l.mjs.map → acorex-platform-module-auth-client-profile-page-component.provider-DCRYHTan.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-profile-page.component-ClNuHd7p.mjs → acorex-platform-module-auth-client-profile-page.component-jkPWFgK_.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-profile-page.component-ClNuHd7p.mjs.map → acorex-platform-module-auth-client-profile-page.component-jkPWFgK_.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-register-password.component-Cu_R4Y5F.mjs → acorex-platform-module-auth-client-register-password.component-CEa_p9cm.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-register-password.component-Cu_R4Y5F.mjs.map → acorex-platform-module-auth-client-register-password.component-CEa_p9cm.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-register.module-DwbrjF2b.mjs → acorex-platform-module-auth-client-register.module-aoUzVW_4.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-register.module-DwbrjF2b.mjs.map → acorex-platform-module-auth-client-register.module-aoUzVW_4.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-remove-pin-code.command-CC5IWpwS.mjs → acorex-platform-module-auth-client-remove-pin-code.command-BMoNBdxW.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-remove-pin-code.command-CC5IWpwS.mjs.map → acorex-platform-module-auth-client-remove-pin-code.command-BMoNBdxW.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-routes-Dw8YhBrw.mjs → acorex-platform-module-auth-client-routes-DAwpb1Ca.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-routes-Dw8YhBrw.mjs.map → acorex-platform-module-auth-client-routes-DAwpb1Ca.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-session-lock-overlay.component-8Bj33U4_.mjs → acorex-platform-module-auth-client-session-lock-overlay.component-BJ6P7d-t.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-session-lock-overlay.component-8Bj33U4_.mjs.map → acorex-platform-module-auth-client-session-lock-overlay.component-BJ6P7d-t.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-set-pin-code.command-BEyXf2XA.mjs → acorex-platform-module-auth-client-set-pin-code.command-CNCfNhTn.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-set-pin-code.command-BEyXf2XA.mjs.map → acorex-platform-module-auth-client-set-pin-code.command-CNCfNhTn.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-set-pin-code.component-CRft8IKd.mjs → acorex-platform-module-auth-client-set-pin-code.component-9jRCg4WY.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-set-pin-code.component-CRft8IKd.mjs.map → acorex-platform-module-auth-client-set-pin-code.component-9jRCg4WY.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-settings.provider-DsKsZrOC.mjs → acorex-platform-module-auth-client-settings.provider-Z2Lr-p1J.mjs} +37 -3
- package/fesm2022/acorex-platform-module-auth-client-settings.provider-Z2Lr-p1J.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-tenant-chooser.component-B0kWYel9.mjs → acorex-platform-module-auth-client-tenant-chooser.component-V3KZwLtP.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-tenant-chooser.component-B0kWYel9.mjs.map → acorex-platform-module-auth-client-tenant-chooser.component-V3KZwLtP.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-tenant-request.component-B-qx-HIi.mjs → acorex-platform-module-auth-client-tenant-request.component-CG74dqMX.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-tenant-request.component-B-qx-HIi.mjs.map → acorex-platform-module-auth-client-tenant-request.component-CG74dqMX.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-two-factor-code.component-DkIXfsXi.mjs → acorex-platform-module-auth-client-two-factor-code.component-DYq_OSj5.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-two-factor-code.component-DkIXfsXi.mjs.map → acorex-platform-module-auth-client-two-factor-code.component-DYq_OSj5.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-two-factor.module-DMlxcFuT.mjs → acorex-platform-module-auth-client-two-factor.module-Da2azaCv.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-two-factor.module-DMlxcFuT.mjs.map → acorex-platform-module-auth-client-two-factor.module-Da2azaCv.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-view-login-history.command-BHbkWOO3.mjs → acorex-platform-module-auth-client-view-login-history.command-Nmc5ORJQ.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-view-login-history.command-BHbkWOO3.mjs.map → acorex-platform-module-auth-client-view-login-history.command-Nmc5ORJQ.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-welcome-onboarding-page.component-DcVVR1Zp.mjs → acorex-platform-module-auth-client-welcome-onboarding-page.component-Cg_QMkvo.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-welcome-onboarding-page.component-DcVVR1Zp.mjs.map → acorex-platform-module-auth-client-welcome-onboarding-page.component-Cg_QMkvo.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-welcome-onboarding.command-BpZt3m22.mjs → acorex-platform-module-auth-client-welcome-onboarding.command-BZEt6U3g.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-welcome-onboarding.command-BpZt3m22.mjs.map → acorex-platform-module-auth-client-welcome-onboarding.command-BZEt6U3g.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-auth-client.mjs +1 -1
- package/i18n/en-AU/auth.json +6 -0
- package/i18n/en-US/auth.json +6 -0
- package/i18n/fa-IR/auth.json +6 -0
- package/package.json +3 -3
- package/types/acorex-platform-module-auth-client-contracts.d.ts +15 -2
- package/types/acorex-platform-module-auth-client.d.ts +2 -0
- package/fesm2022/acorex-platform-module-auth-client-acorex-platform-module-auth-client-CWE43xt1.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-password.component-DekdMba0.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-settings.provider-DsKsZrOC.mjs.map +0 -1
|
@@ -19,7 +19,7 @@ import { AXPUserAvatarComponent } from '@acorex-platform/framework-client/layout
|
|
|
19
19
|
import * as i5$1 from '@angular/common';
|
|
20
20
|
import { CommonModule } from '@angular/common';
|
|
21
21
|
import { Router } from '@angular/router';
|
|
22
|
-
import { z as AXPTenantChooserDropdownComponent, B as AXPAppChooserListComponent } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-
|
|
22
|
+
import { z as AXPTenantChooserDropdownComponent, B as AXPAppChooserListComponent } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-Cq9R3s5A.mjs';
|
|
23
23
|
|
|
24
24
|
class AXPAuthAppChooserComponent {
|
|
25
25
|
constructor() {
|
|
@@ -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-D99xVLtc.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-D99xVLtc.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;AACn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,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;;;"}
|
|
@@ -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-Cq9R3s5A.mjs';
|
|
11
11
|
|
|
12
12
|
//#region ---- Constants ----
|
|
13
13
|
const CHANGE_OWN_PASSWORD_ERROR_I18N = {
|
|
@@ -201,4 +201,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
201
201
|
}] });
|
|
202
202
|
|
|
203
203
|
export { AXPChangePasswordCommand };
|
|
204
|
-
//# sourceMappingURL=acorex-platform-module-auth-client-change-password.command-
|
|
204
|
+
//# sourceMappingURL=acorex-platform-module-auth-client-change-password.command-CAJir6Go.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-auth-client-change-password.command-DN0yaJ9l.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 type AXMGetOwnPasswordStatusResult,\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 or set 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, hasPassword] = await Promise.all([\n this.passwordComplexityService.getLevel(),\n this.loadHasPassword(),\n ]);\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 hasPassword\n ? '@auth:profile-page.commands.change-password.dialog.title'\n : '@auth:profile-page.commands.change-password.dialog.set-title',\n );\n const submitLabel = hasPassword\n ? '@auth:profile-page.commands.change-password.actions.submit'\n : '@auth:profile-page.commands.change-password.actions.set-submit';\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.setDirection('column').setGap('1rem');\n\n if (hasPassword) {\n flex.formField(\n '@auth:profile-page.commands.change-password.fields.current-password.title',\n (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:\n '@auth:profile-page.commands.change-password.fields.current-password.placeholder',\n validations: [{ rule: 'required' }],\n });\n },\n );\n }\n\n flex\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:\n '@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(submitLabel);\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 (hasPassword && 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 hasPassword ? { currentPassword, newPassword } : { 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 hasPassword\n ? '@auth:profile-page.commands.change-password.messages.success'\n : '@auth:profile-page.commands.change-password.messages.set-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 async loadHasPassword(): Promise<boolean> {\n try {\n const result = await this.commandService.execute(\n AXMSecurityManagementServerCommands.GetOwnPasswordStatus,\n {},\n );\n if (!result?.success) {\n // Fail closed: keep current-password field when status is unknown.\n return true;\n }\n const payload = runtimeCommandPayloadData(result) as AXMGetOwnPasswordStatusResult | undefined;\n return payload?.hasPassword === true;\n } catch {\n return true;\n }\n }\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":";;;;;;;;;;;AA+BA;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,gCAAgC,CAAC;AACpE,QAAA,IAAA,CAAA,6BAA6B,GAAG,MAAM,CAAC,oCAAoC,CAAC;AAC5E,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AA6MjE,IAAA;;;AAvMC,IAAA,MAAM,OAAO,GAAA;QACX,MAAM,CAAC,kBAAkB,EAAE,WAAW,CAAC,GAAG,MAAM,OAAO,C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ET,OAAO,gCAAgC,CAAgC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE;IACtG;;;AAMQ,IAAA,MAAM,eAAe,GAAA;AAC3B,QAAA,IAAI;AACF,YAAA,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC9C,mCAAmC,CAAC,oBAAoB,EACxD,EAAE,CACH;AACD,YAAA,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE;;AAEpB,gBAAA,OAAO,IAAI;YACb;AACA,YAAA,MAAM,OAAO,GAAG,yBAAyB,CAAC,MAAM,CAA8C;AAC9F,YAAA,OAAO,OAAO,EAAE,WAAW,KAAK,IAAI;QACtC;AAAE,QAAA,MAAM;AACN,YAAA,OAAO,IAAI;QACb;IACF;AAEQ,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;8GAnNW,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-CAJir6Go.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 type AXMGetOwnPasswordStatusResult,\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 or set 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, hasPassword] = await Promise.all([\n this.passwordComplexityService.getLevel(),\n this.loadHasPassword(),\n ]);\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 hasPassword\n ? '@auth:profile-page.commands.change-password.dialog.title'\n : '@auth:profile-page.commands.change-password.dialog.set-title',\n );\n const submitLabel = hasPassword\n ? '@auth:profile-page.commands.change-password.actions.submit'\n : '@auth:profile-page.commands.change-password.actions.set-submit';\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.setDirection('column').setGap('1rem');\n\n if (hasPassword) {\n flex.formField(\n '@auth:profile-page.commands.change-password.fields.current-password.title',\n (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:\n '@auth:profile-page.commands.change-password.fields.current-password.placeholder',\n validations: [{ rule: 'required' }],\n });\n },\n );\n }\n\n flex\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:\n '@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(submitLabel);\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 (hasPassword && 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 hasPassword ? { currentPassword, newPassword } : { 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 hasPassword\n ? '@auth:profile-page.commands.change-password.messages.success'\n : '@auth:profile-page.commands.change-password.messages.set-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 async loadHasPassword(): Promise<boolean> {\n try {\n const result = await this.commandService.execute(\n AXMSecurityManagementServerCommands.GetOwnPasswordStatus,\n {},\n );\n if (!result?.success) {\n // Fail closed: keep current-password field when status is unknown.\n return true;\n }\n const payload = runtimeCommandPayloadData(result) as AXMGetOwnPasswordStatusResult | undefined;\n return payload?.hasPassword === true;\n } catch {\n return true;\n }\n }\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":";;;;;;;;;;;AA+BA;AAEA,MAAM,8BAA8B,GAA2B;AAC7D,IAAA,CAAC,mCAAmC,CAAC,WAAW,GAC9C,oEAAoE;AACtE,IAAA,CAAC,mCAAmC,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,IAAI;QACb;IACF;AAEQ,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;8GAnNW,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;;;"}
|
|
@@ -11,7 +11,7 @@ import { inject, Injectable } from '@angular/core';
|
|
|
11
11
|
import { Router } from '@angular/router';
|
|
12
12
|
import { isNil } from 'lodash';
|
|
13
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-
|
|
14
|
+
import { k as AXPUserAvatarSyncService } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-Cq9R3s5A.mjs';
|
|
15
15
|
|
|
16
16
|
const PROFILE_PHOTO_DIALOG_PREVIEW_SIZE = {
|
|
17
17
|
small: { width: '100%', height: 'auto' },
|
|
@@ -304,4 +304,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
304
304
|
}] });
|
|
305
305
|
|
|
306
306
|
export { AXPChangePhotoCommand };
|
|
307
|
-
//# sourceMappingURL=acorex-platform-module-auth-client-change-photo.command-
|
|
307
|
+
//# sourceMappingURL=acorex-platform-module-auth-client-change-photo.command-C-RYaG1B.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-auth-client-change-photo.command-CWeeauFw.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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EACxCA,UAA4B,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI;AAEjD,iBAAA,IAAI;iBACJ,KAAK,CAAC,MAAM,CAAC;YAChB,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;YACjC,OAAO,KAAK,GAAG,KAAK,GAAG,IAAI;QAC7B;AAAE,QAAA,MAAM;AACN,YAAA,OAAO,IAAI;QACb;IACF;8GApTW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAArB,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,qBAAqB,cADR,MAAM,EAAA,CAAA,CAAA;;2FACnB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBADjC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-auth-client-change-photo.command-C-RYaG1B.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;AA4SzC,IAAA;;;AAtSC,IAAA,MAAM,OAAO,CAAC,KAAA,GAAoC,EAAE,EAAA;QAClD,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE;AAC3C,QAAA,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE;YACjB,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE;AACP,oBAAA,IAA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52
|
+
//#region ---- Query keys ----
|
|
53
|
+
const AXMAuthQueryKeys = {
|
|
54
|
+
Captcha: {
|
|
55
|
+
/** Connected captcha IntegrationConnections for platform Default Captcha Provider select. */
|
|
56
|
+
ListConnectedProviders: 'Auth:Query:Captcha.ListConnectedProviders',
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
//#endregion
|
|
60
|
+
|
|
52
61
|
const config = {
|
|
53
62
|
i18n: 'auth',
|
|
54
63
|
module: 'Auth',
|
|
@@ -82,6 +91,11 @@ var AXPAuthSettings;
|
|
|
82
91
|
AXPAuthSettings["MaxLoginAttempts"] = "Auth:Setting:Authentication.MaxLoginAttempts";
|
|
83
92
|
AXPAuthSettings["LockoutDuration"] = "Auth:Setting:Authentication.LockoutDuration";
|
|
84
93
|
AXPAuthSettings["CaptchaAttemptThreshold"] = "Auth:Setting:Authentication.CaptchaAttemptThreshold";
|
|
94
|
+
/**
|
|
95
|
+
* Platform: Integration provider id used for login captcha
|
|
96
|
+
* (e.g. `google-recaptcha`). Empty = captcha disabled until selected.
|
|
97
|
+
*/
|
|
98
|
+
AXPAuthSettings["DefaultCaptchaProvider"] = "Auth:Setting:Authentication.DefaultCaptchaProvider";
|
|
85
99
|
/** Platform sign-in page branding (multi-language string). */
|
|
86
100
|
AXPAuthSettings["SignInPageSlogan"] = "Auth:Setting:SignInPage.Slogan";
|
|
87
101
|
AXPAuthSettings["SignInPageDescription"] = "Auth:Setting:SignInPage.Description";
|
|
@@ -157,7 +171,8 @@ const AXPAuthCredentialTypeOptions = {
|
|
|
157
171
|
const AXP_AUTH_LOCKOUT_SETTING_DEFAULTS = {
|
|
158
172
|
[AXPAuthSettings.MaxLoginAttempts]: 5,
|
|
159
173
|
[AXPAuthSettings.LockoutDuration]: 3,
|
|
160
|
-
[AXPAuthSettings.CaptchaAttemptThreshold]:
|
|
174
|
+
[AXPAuthSettings.CaptchaAttemptThreshold]: 1,
|
|
175
|
+
[AXPAuthSettings.DefaultCaptchaProvider]: '',
|
|
161
176
|
};
|
|
162
177
|
const AXP_AUTH_MAX_ACTIVE_DEVICE_SESSIONS_SETTING_DEFAULTS = {
|
|
163
178
|
[AXPAuthSettings.MaxActiveDeviceSessions]: 0,
|
|
@@ -179,5 +194,5 @@ const AXP_AUTH_SIGN_IN_PAGE_DESCRIPTION_DEFAULT = {
|
|
|
179
194
|
* Generated bundle index. Do not edit.
|
|
180
195
|
*/
|
|
181
196
|
|
|
182
|
-
export { AXMAuthCommandKeys, AXMPermissionsKeys, AXM_AUTH_INACTIVE_SESSION_TERMINATION_PURGE_COMMAND_KEY, AXPAdministrationPermissionKeys, AXPAuthCredentialTypeOptions, AXPAuthInactiveSessionTerminationOptions, AXPAuthMenuKeys, AXPAuthSettings, AXP_AUTH_INACTIVE_SESSION_TERMINATION_DURATION_MS, AXP_AUTH_INACTIVE_SESSION_TERMINATION_OPTION_DEFINITIONS, AXP_AUTH_INACTIVE_SESSION_TERMINATION_SETTING_DEFAULTS, AXP_AUTH_LOCKOUT_SETTING_DEFAULTS, AXP_AUTH_MAX_ACTIVE_DEVICE_SESSIONS_SETTING_DEFAULTS, AXP_AUTH_SIGN_IN_PAGE_DESCRIPTION_DEFAULT, AXP_AUTH_SIGN_IN_PAGE_SLOGAN_DEFAULT, RootConfig, isAuthInactiveSessionTerminationValue, resolveAuthInactiveSessionTerminationDurationMs };
|
|
197
|
+
export { AXMAuthCommandKeys, AXMAuthQueryKeys, AXMPermissionsKeys, AXM_AUTH_INACTIVE_SESSION_TERMINATION_PURGE_COMMAND_KEY, AXPAdministrationPermissionKeys, AXPAuthCredentialTypeOptions, AXPAuthInactiveSessionTerminationOptions, AXPAuthMenuKeys, AXPAuthSettings, AXP_AUTH_INACTIVE_SESSION_TERMINATION_DURATION_MS, AXP_AUTH_INACTIVE_SESSION_TERMINATION_OPTION_DEFINITIONS, AXP_AUTH_INACTIVE_SESSION_TERMINATION_SETTING_DEFAULTS, AXP_AUTH_LOCKOUT_SETTING_DEFAULTS, AXP_AUTH_MAX_ACTIVE_DEVICE_SESSIONS_SETTING_DEFAULTS, AXP_AUTH_SIGN_IN_PAGE_DESCRIPTION_DEFAULT, AXP_AUTH_SIGN_IN_PAGE_SLOGAN_DEFAULT, RootConfig, isAuthInactiveSessionTerminationValue, resolveAuthInactiveSessionTerminationDurationMs };
|
|
183
198
|
//# sourceMappingURL=acorex-platform-module-auth-client-contracts.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-auth-client-contracts.mjs","sources":["../../../../libs/modules/auth/contracts/src/commands.keys.ts","../../../../libs/modules/auth/contracts/src/menu.keys.ts","../../../../libs/modules/auth/contracts/src/permission.keys.ts","../../../../libs/modules/auth/contracts/src/root-config.ts","../../../../libs/modules/auth/contracts/src/settings.keys.ts","../../../../libs/modules/auth/contracts/src/index.ts","../../../../libs/modules/auth/contracts/src/acorex-platform-module-auth-client-contracts.ts"],"sourcesContent":["//#region ---- Command keys ----\n\nexport const AXMAuthCommandKeys = {\n Profile: {\n Show: 'auth:profile',\n ChangePhoto: 'auth:change-photo',\n EditAccountInfo: 'auth:edit-account-info',\n ComingSoon: 'auth:profile-coming-soon',\n },\n Session: {\n Signout: 'auth:signout',\n OpenSessions: 'auth:open-sessions',\n LockScreen: 'auth:lock-screen',\n },\n Security: {\n ChangePassword: 'auth:change-password',\n ManageTwoFactor: 'auth:manage-two-factor',\n SetPinCode: 'auth:set-pin-code',\n RemovePinCode: 'auth:remove-pin-code',\n ViewLoginHistory: 'auth:view-login-history',\n EditSignature: 'auth:edit-signature',\n },\n Onboarding: {\n Welcome: 'auth:welcome-onboarding',\n },\n Account: {\n /** Opens `/auth/account/waiting-room` (e.g. from membership-invite inbox action). */\n OpenWaitingRoom: 'auth:open-waiting-room',\n },\n} as const;\n\n/** Scheduled purge of DeviceSessions idle past the InactiveSessionTermination setting. */\nexport const AXM_AUTH_INACTIVE_SESSION_TERMINATION_PURGE_COMMAND_KEY =\n 'auth.inactive-session.terminate' as const;\n\n//#endregion\n","export const AXPAuthMenuKeys = {} as const;\n\n","/**\n * Auth stub — maps legacy Management to Administration Access.\n * Prefer {@link AXPAdministrationPermissionKeys} from security-management contracts when wiring real checks.\n */\nexport const AXPAdministrationPermissionKeys = {\n Access: 'Administration:Permission:Access',\n} as const;\n\n/**\n * @deprecated Prefer Administration Access / conceptual keys.\n */\nexport const AXMPermissionsKeys = {\n Auth: {\n Management: AXPAdministrationPermissionKeys.Access,\n },\n} as const;\n","const config = {\n i18n: 'auth',\n module: 'Auth',\n};\n\nexport const RootConfig = {\n config,\n module: {\n route: 'auth',\n name: config.module,\n title: '@auth:module.title',\n icon: 'fa-light fa-shield-keyhole',\n },\n /**\n * Platform schedule: revoke DeviceSessions idle longer than\n * {@link AXPAuthSettings.InactiveSessionTermination} (user override → tenant default).\n * Cron every minute so the 1-minute option is testable.\n */\n inactiveSessionTermination: {\n providerKey: 'auth',\n defaultCron: '* * * * *',\n },\n} as const;\n","import type { AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\n\n//#region ----- Auth setting keys -----\n\nexport enum AXPAuthSettings {\n /** User-scoped: login requires verified authenticator enrollment when true. */\n UserTwoFactorEnabled = 'Auth:Setting:User.TwoFactor.Enabled',\n PasswordComplexity = 'Auth:Setting:Authentication.PasswordComplexity',\n PasswordExpiryDays = 'Auth:Setting:Authentication.PasswordExpiryDays',\n MaxLoginAttempts = 'Auth:Setting:Authentication.MaxLoginAttempts',\n LockoutDuration = 'Auth:Setting:Authentication.LockoutDuration',\n CaptchaAttemptThreshold = 'Auth:Setting:Authentication.CaptchaAttemptThreshold',\n\n /** Platform sign-in page branding (multi-language string). */\n SignInPageSlogan = 'Auth:Setting:SignInPage.Slogan',\n SignInPageDescription = 'Auth:Setting:SignInPage.Description',\n\n /** Platform sign-up policy. */\n SignUpEnabled = 'Auth:Setting:SignUp.Enabled',\n SignUpUrl = 'Auth:Setting:SignUp.Url',\n\n /** Platform sign-in credential UX + default strategy. */\n SignInCredentialType = 'Auth:Setting:SignIn.CredentialType',\n SignInDefaultStrategy = 'Auth:Setting:SignIn.DefaultStrategy',\n\n LockWhenIdleEnabled = 'Auth:Setting:SessionManagement.LockWhenIdleEnabled',\n LockWhenIdleMinutes = 'Auth:Setting:SessionManagement.LockWhenIdleMinutes',\n InactiveSessionTermination = 'Auth:Setting:SessionManagement.InactiveSessionTermination',\n MaxActiveDeviceSessions = 'Auth:Setting:SessionManagement.MaxActiveDeviceSessions',\n\n /** User-scoped welcome onboarding progress blob. */\n OnboardingWelcome = 'Auth:Setting:Onboarding.Welcome',\n}\n\nexport const AXPAuthInactiveSessionTerminationOptions = {\n OneWeek: 'oneWeek',\n OneMonth: 'oneMonth',\n ThreeMonths: 'threeMonths',\n SixMonths: 'sixMonths',\n} as const;\n\nexport type AXPAuthInactiveSessionTerminationValue =\n (typeof AXPAuthInactiveSessionTerminationOptions)[keyof typeof AXPAuthInactiveSessionTerminationOptions];\n\n/** Shared select options for settings UI + Active Sessions modal (i18n title keys). */\nexport const AXP_AUTH_INACTIVE_SESSION_TERMINATION_OPTION_DEFINITIONS: ReadonlyArray<{\n id: AXPAuthInactiveSessionTerminationValue;\n titleKey: string;\n}> = [\n {\n id: AXPAuthInactiveSessionTerminationOptions.OneWeek,\n titleKey: '@auth:settings.session.terminate-old-sessions.options.one-week',\n },\n {\n id: AXPAuthInactiveSessionTerminationOptions.OneMonth,\n titleKey: '@auth:settings.session.terminate-old-sessions.options.one-month',\n },\n {\n id: AXPAuthInactiveSessionTerminationOptions.ThreeMonths,\n titleKey: '@auth:settings.session.terminate-old-sessions.options.three-months',\n },\n {\n id: AXPAuthInactiveSessionTerminationOptions.SixMonths,\n titleKey: '@auth:settings.session.terminate-old-sessions.options.six-months',\n },\n];\n\nconst MS_MINUTE = 60_000;\nconst MS_DAY = 24 * 60 * MS_MINUTE;\n\n/** Inactivity window for each stored termination option. */\nexport const AXP_AUTH_INACTIVE_SESSION_TERMINATION_DURATION_MS: Record<\n AXPAuthInactiveSessionTerminationValue,\n number\n> = {\n [AXPAuthInactiveSessionTerminationOptions.OneWeek]: 7 * MS_DAY,\n [AXPAuthInactiveSessionTerminationOptions.OneMonth]: 30 * MS_DAY,\n [AXPAuthInactiveSessionTerminationOptions.ThreeMonths]: 90 * MS_DAY,\n [AXPAuthInactiveSessionTerminationOptions.SixMonths]: 180 * MS_DAY,\n};\n\nexport const AXP_AUTH_INACTIVE_SESSION_TERMINATION_SETTING_DEFAULTS = {\n [AXPAuthSettings.InactiveSessionTermination]: AXPAuthInactiveSessionTerminationOptions.OneMonth,\n} as const;\n\nexport function isAuthInactiveSessionTerminationValue(\n value: unknown,\n): value is AXPAuthInactiveSessionTerminationValue {\n return (\n typeof value === 'string' &&\n (Object.values(AXPAuthInactiveSessionTerminationOptions) as string[]).includes(value)\n );\n}\n\nexport function resolveAuthInactiveSessionTerminationDurationMs(\n value: unknown,\n): number {\n if (isAuthInactiveSessionTerminationValue(value)) {\n return AXP_AUTH_INACTIVE_SESSION_TERMINATION_DURATION_MS[value];\n }\n return AXP_AUTH_INACTIVE_SESSION_TERMINATION_DURATION_MS[\n AXP_AUTH_INACTIVE_SESSION_TERMINATION_SETTING_DEFAULTS[AXPAuthSettings.InactiveSessionTermination]\n ];\n}\n\n/** Stored values for {@link AXPAuthSettings.SignInCredentialType}. */\nexport const AXPAuthCredentialTypeOptions = {\n UsernamePassword: 'UsernamePassword',\n UsernameEmailPassword: 'UsernameEmailPassword',\n EmailPassword: 'EmailPassword',\n MobilePassword: 'MobilePassword',\n EmailCode: 'EmailCode',\n MobileCode: 'MobileCode',\n} as const;\n\nexport type AXPAuthCredentialTypeValue =\n (typeof AXPAuthCredentialTypeOptions)[keyof typeof AXPAuthCredentialTypeOptions];\n\nexport const AXP_AUTH_LOCKOUT_SETTING_DEFAULTS = {\n [AXPAuthSettings.MaxLoginAttempts]: 5,\n [AXPAuthSettings.LockoutDuration]: 3,\n [AXPAuthSettings.CaptchaAttemptThreshold]: 3,\n} as const;\n\nexport const AXP_AUTH_MAX_ACTIVE_DEVICE_SESSIONS_SETTING_DEFAULTS = {\n [AXPAuthSettings.MaxActiveDeviceSessions]: 0,\n} as const;\n\nexport const AXP_AUTH_SIGN_IN_PAGE_SLOGAN_DEFAULT: AXPMultiLanguageString = {\n 'en-US': 'Welcome',\n 'fa-IR': 'خوش آمدید',\n};\n\nexport const AXP_AUTH_SIGN_IN_PAGE_DESCRIPTION_DEFAULT: AXPMultiLanguageString = {\n 'en-US': 'Sign in to continue to your applications.',\n 'fa-IR': 'برای ادامه به برنامههای خود وارد شوید.',\n};\n\n//#endregion\n","//#region ---- Contracts barrel ----\n\nexport * from './commands.keys';\nexport * from './menu.keys';\nexport * from './permission.keys';\nexport * from './root-config';\nexport * from './settings.keys';\n\n//#endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAA;AAEO,MAAM,kBAAkB,GAAG;AAChC,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,cAAc;AACpB,QAAA,WAAW,EAAE,mBAAmB;AAChC,QAAA,eAAe,EAAE,wBAAwB;AACzC,QAAA,UAAU,EAAE,0BAA0B;AACvC,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,OAAO,EAAE,cAAc;AACvB,QAAA,YAAY,EAAE,oBAAoB;AAClC,QAAA,UAAU,EAAE,kBAAkB;AAC/B,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,cAAc,EAAE,sBAAsB;AACtC,QAAA,eAAe,EAAE,wBAAwB;AACzC,QAAA,UAAU,EAAE,mBAAmB;AAC/B,QAAA,aAAa,EAAE,sBAAsB;AACrC,QAAA,gBAAgB,EAAE,yBAAyB;AAC3C,QAAA,aAAa,EAAE,qBAAqB;AACrC,KAAA;AACD,IAAA,UAAU,EAAE;AACV,QAAA,OAAO,EAAE,yBAAyB;AACnC,KAAA;AACD,IAAA,OAAO,EAAE;;AAEP,QAAA,eAAe,EAAE,wBAAwB;AAC1C,KAAA;;AAG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,OAAO,EAAE,2CAA2C;AACpD,IAAA,OAAO,EAAE,yCAAyC;;AAGpD;;AC1IA;AAQA;;ACRA;;AAEG;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-auth-client-contracts.mjs","sources":["../../../../libs/modules/auth/contracts/src/commands.keys.ts","../../../../libs/modules/auth/contracts/src/menu.keys.ts","../../../../libs/modules/auth/contracts/src/permission.keys.ts","../../../../libs/modules/auth/contracts/src/queries.keys.ts","../../../../libs/modules/auth/contracts/src/root-config.ts","../../../../libs/modules/auth/contracts/src/settings.keys.ts","../../../../libs/modules/auth/contracts/src/index.ts","../../../../libs/modules/auth/contracts/src/acorex-platform-module-auth-client-contracts.ts"],"sourcesContent":["//#region ---- Command keys ----\n\nexport const AXMAuthCommandKeys = {\n Profile: {\n Show: 'auth:profile',\n ChangePhoto: 'auth:change-photo',\n EditAccountInfo: 'auth:edit-account-info',\n ComingSoon: 'auth:profile-coming-soon',\n },\n Session: {\n Signout: 'auth:signout',\n OpenSessions: 'auth:open-sessions',\n LockScreen: 'auth:lock-screen',\n },\n Security: {\n ChangePassword: 'auth:change-password',\n ManageTwoFactor: 'auth:manage-two-factor',\n SetPinCode: 'auth:set-pin-code',\n RemovePinCode: 'auth:remove-pin-code',\n ViewLoginHistory: 'auth:view-login-history',\n EditSignature: 'auth:edit-signature',\n },\n Onboarding: {\n Welcome: 'auth:welcome-onboarding',\n },\n Account: {\n /** Opens `/auth/account/waiting-room` (e.g. from membership-invite inbox action). */\n OpenWaitingRoom: 'auth:open-waiting-room',\n },\n} as const;\n\n/** Scheduled purge of DeviceSessions idle past the InactiveSessionTermination setting. */\nexport const AXM_AUTH_INACTIVE_SESSION_TERMINATION_PURGE_COMMAND_KEY =\n 'auth.inactive-session.terminate' as const;\n\n//#endregion\n","export const AXPAuthMenuKeys = {} as const;\n\n","/**\n * Auth stub — maps legacy Management to Administration Access.\n * Prefer {@link AXPAdministrationPermissionKeys} from security-management contracts when wiring real checks.\n */\nexport const AXPAdministrationPermissionKeys = {\n Access: 'Administration:Permission:Access',\n} as const;\n\n/**\n * @deprecated Prefer Administration Access / conceptual keys.\n */\nexport const AXMPermissionsKeys = {\n Auth: {\n Management: AXPAdministrationPermissionKeys.Access,\n },\n} as const;\n","//#region ---- Query keys ----\n\nexport const AXMAuthQueryKeys = {\n Captcha: {\n /** Connected captcha IntegrationConnections for platform Default Captcha Provider select. */\n ListConnectedProviders: 'Auth:Query:Captcha.ListConnectedProviders',\n },\n} as const;\n\n//#endregion\n","const config = {\n i18n: 'auth',\n module: 'Auth',\n};\n\nexport const RootConfig = {\n config,\n module: {\n route: 'auth',\n name: config.module,\n title: '@auth:module.title',\n icon: 'fa-light fa-shield-keyhole',\n },\n /**\n * Platform schedule: revoke DeviceSessions idle longer than\n * {@link AXPAuthSettings.InactiveSessionTermination} (user override → tenant default).\n * Cron every minute so the 1-minute option is testable.\n */\n inactiveSessionTermination: {\n providerKey: 'auth',\n defaultCron: '* * * * *',\n },\n} as const;\n","import type { AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\n\n//#region ----- Auth setting keys -----\n\nexport enum AXPAuthSettings {\n /** User-scoped: login requires verified authenticator enrollment when true. */\n UserTwoFactorEnabled = 'Auth:Setting:User.TwoFactor.Enabled',\n PasswordComplexity = 'Auth:Setting:Authentication.PasswordComplexity',\n PasswordExpiryDays = 'Auth:Setting:Authentication.PasswordExpiryDays',\n MaxLoginAttempts = 'Auth:Setting:Authentication.MaxLoginAttempts',\n LockoutDuration = 'Auth:Setting:Authentication.LockoutDuration',\n CaptchaAttemptThreshold = 'Auth:Setting:Authentication.CaptchaAttemptThreshold',\n /**\n * Platform: Integration provider id used for login captcha\n * (e.g. `google-recaptcha`). Empty = captcha disabled until selected.\n */\n DefaultCaptchaProvider = 'Auth:Setting:Authentication.DefaultCaptchaProvider',\n\n /** Platform sign-in page branding (multi-language string). */\n SignInPageSlogan = 'Auth:Setting:SignInPage.Slogan',\n SignInPageDescription = 'Auth:Setting:SignInPage.Description',\n\n /** Platform sign-up policy. */\n SignUpEnabled = 'Auth:Setting:SignUp.Enabled',\n SignUpUrl = 'Auth:Setting:SignUp.Url',\n\n /** Platform sign-in credential UX + default strategy. */\n SignInCredentialType = 'Auth:Setting:SignIn.CredentialType',\n SignInDefaultStrategy = 'Auth:Setting:SignIn.DefaultStrategy',\n\n LockWhenIdleEnabled = 'Auth:Setting:SessionManagement.LockWhenIdleEnabled',\n LockWhenIdleMinutes = 'Auth:Setting:SessionManagement.LockWhenIdleMinutes',\n InactiveSessionTermination = 'Auth:Setting:SessionManagement.InactiveSessionTermination',\n MaxActiveDeviceSessions = 'Auth:Setting:SessionManagement.MaxActiveDeviceSessions',\n\n /** User-scoped welcome onboarding progress blob. */\n OnboardingWelcome = 'Auth:Setting:Onboarding.Welcome',\n}\n\nexport const AXPAuthInactiveSessionTerminationOptions = {\n OneWeek: 'oneWeek',\n OneMonth: 'oneMonth',\n ThreeMonths: 'threeMonths',\n SixMonths: 'sixMonths',\n} as const;\n\nexport type AXPAuthInactiveSessionTerminationValue =\n (typeof AXPAuthInactiveSessionTerminationOptions)[keyof typeof AXPAuthInactiveSessionTerminationOptions];\n\n/** Shared select options for settings UI + Active Sessions modal (i18n title keys). */\nexport const AXP_AUTH_INACTIVE_SESSION_TERMINATION_OPTION_DEFINITIONS: ReadonlyArray<{\n id: AXPAuthInactiveSessionTerminationValue;\n titleKey: string;\n}> = [\n {\n id: AXPAuthInactiveSessionTerminationOptions.OneWeek,\n titleKey: '@auth:settings.session.terminate-old-sessions.options.one-week',\n },\n {\n id: AXPAuthInactiveSessionTerminationOptions.OneMonth,\n titleKey: '@auth:settings.session.terminate-old-sessions.options.one-month',\n },\n {\n id: AXPAuthInactiveSessionTerminationOptions.ThreeMonths,\n titleKey: '@auth:settings.session.terminate-old-sessions.options.three-months',\n },\n {\n id: AXPAuthInactiveSessionTerminationOptions.SixMonths,\n titleKey: '@auth:settings.session.terminate-old-sessions.options.six-months',\n },\n];\n\nconst MS_MINUTE = 60_000;\nconst MS_DAY = 24 * 60 * MS_MINUTE;\n\n/** Inactivity window for each stored termination option. */\nexport const AXP_AUTH_INACTIVE_SESSION_TERMINATION_DURATION_MS: Record<\n AXPAuthInactiveSessionTerminationValue,\n number\n> = {\n [AXPAuthInactiveSessionTerminationOptions.OneWeek]: 7 * MS_DAY,\n [AXPAuthInactiveSessionTerminationOptions.OneMonth]: 30 * MS_DAY,\n [AXPAuthInactiveSessionTerminationOptions.ThreeMonths]: 90 * MS_DAY,\n [AXPAuthInactiveSessionTerminationOptions.SixMonths]: 180 * MS_DAY,\n};\n\nexport const AXP_AUTH_INACTIVE_SESSION_TERMINATION_SETTING_DEFAULTS = {\n [AXPAuthSettings.InactiveSessionTermination]: AXPAuthInactiveSessionTerminationOptions.OneMonth,\n} as const;\n\nexport function isAuthInactiveSessionTerminationValue(\n value: unknown,\n): value is AXPAuthInactiveSessionTerminationValue {\n return (\n typeof value === 'string' &&\n (Object.values(AXPAuthInactiveSessionTerminationOptions) as string[]).includes(value)\n );\n}\n\nexport function resolveAuthInactiveSessionTerminationDurationMs(\n value: unknown,\n): number {\n if (isAuthInactiveSessionTerminationValue(value)) {\n return AXP_AUTH_INACTIVE_SESSION_TERMINATION_DURATION_MS[value];\n }\n return AXP_AUTH_INACTIVE_SESSION_TERMINATION_DURATION_MS[\n AXP_AUTH_INACTIVE_SESSION_TERMINATION_SETTING_DEFAULTS[AXPAuthSettings.InactiveSessionTermination]\n ];\n}\n\n/** Stored values for {@link AXPAuthSettings.SignInCredentialType}. */\nexport const AXPAuthCredentialTypeOptions = {\n UsernamePassword: 'UsernamePassword',\n UsernameEmailPassword: 'UsernameEmailPassword',\n EmailPassword: 'EmailPassword',\n MobilePassword: 'MobilePassword',\n EmailCode: 'EmailCode',\n MobileCode: 'MobileCode',\n} as const;\n\nexport type AXPAuthCredentialTypeValue =\n (typeof AXPAuthCredentialTypeOptions)[keyof typeof AXPAuthCredentialTypeOptions];\n\nexport const AXP_AUTH_LOCKOUT_SETTING_DEFAULTS = {\n [AXPAuthSettings.MaxLoginAttempts]: 5,\n [AXPAuthSettings.LockoutDuration]: 3,\n [AXPAuthSettings.CaptchaAttemptThreshold]: 1,\n [AXPAuthSettings.DefaultCaptchaProvider]: '',\n} as const;\n\nexport const AXP_AUTH_MAX_ACTIVE_DEVICE_SESSIONS_SETTING_DEFAULTS = {\n [AXPAuthSettings.MaxActiveDeviceSessions]: 0,\n} as const;\n\nexport const AXP_AUTH_SIGN_IN_PAGE_SLOGAN_DEFAULT: AXPMultiLanguageString = {\n 'en-US': 'Welcome',\n 'fa-IR': 'خوش آمدید',\n};\n\nexport const AXP_AUTH_SIGN_IN_PAGE_DESCRIPTION_DEFAULT: AXPMultiLanguageString = {\n 'en-US': 'Sign in to continue to your applications.',\n 'fa-IR': 'برای ادامه به برنامههای خود وارد شوید.',\n};\n\n//#endregion\n","//#region ---- Contracts barrel ----\n\nexport * from './commands.keys';\nexport * from './menu.keys';\nexport * from './permission.keys';\nexport * from './queries.keys';\nexport * from './root-config';\nexport * from './settings.keys';\n\n//#endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAA;AAEO,MAAM,kBAAkB,GAAG;AAChC,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,cAAc;AACpB,QAAA,WAAW,EAAE,mBAAmB;AAChC,QAAA,eAAe,EAAE,wBAAwB;AACzC,QAAA,UAAU,EAAE,0BAA0B;AACvC,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,OAAO,EAAE,cAAc;AACvB,QAAA,YAAY,EAAE,oBAAoB;AAClC,QAAA,UAAU,EAAE,kBAAkB;AAC/B,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,cAAc,EAAE,sBAAsB;AACtC,QAAA,eAAe,EAAE,wBAAwB;AACzC,QAAA,UAAU,EAAE,mBAAmB;AAC/B,QAAA,aAAa,EAAE,sBAAsB;AACrC,QAAA,gBAAgB,EAAE,yBAAyB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GAAG;AAC/C,IAAA,CAAC,eAAe,CAAC,gBAAgB,GAAG,CAAC;AACrC,IAAA,CAAC,eAAe,CAAC,eAAe,GAAG,CAAC;AACpC,IAAA,CAAC,eAAe,CAAC,uBAAuB,GAAG,CAAC;AAC5C,IAAA,CAAC,eAAe,CAAC,sBAAsB,GAAG,EAAE;;AAGvC,MAAM,oDAAoD,GAAG;AAClE,IAAA,CAAC,eAAe,CAAC,uBAAuB,GAAG,CAAC;;AAGvC,MAAM,oCAAoC,GAA2B;AAC1E,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,OAAO,EAAE,WAAW;;AAGf,MAAM,yCAAyC,GAA2B;AAC/E,IAAA,OAAO,EAAE,2CAA2C;AACpD,IAAA,OAAO,EAAE,yCAAyC;;AAGpD;;AChJA;AASA;;ACTA;;AAEG;;"}
|
|
@@ -4,7 +4,7 @@ import { AXPEntityService } from '@acorex-platform/framework-client/layout/entit
|
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
5
|
import { inject, Injectable } from '@angular/core';
|
|
6
6
|
import { isEmpty } from 'lodash';
|
|
7
|
-
import { g as resolveDefaultUserActivityDateRange, h as resolveSmartUserActivityDateRange, i as buildUserActivityDataSourceItem } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-
|
|
7
|
+
import { g as resolveDefaultUserActivityDateRange, h as resolveSmartUserActivityDateRange, i as buildUserActivityDataSourceItem } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-Cq9R3s5A.mjs';
|
|
8
8
|
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region ---- Helpers ----
|
|
@@ -87,4 +87,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
87
87
|
}] });
|
|
88
88
|
|
|
89
89
|
export { AXMGetUserActivityQuery };
|
|
90
|
-
//# sourceMappingURL=acorex-platform-module-auth-client-get-user-activity.query-
|
|
90
|
+
//# sourceMappingURL=acorex-platform-module-auth-client-get-user-activity.query-Bug-SR6J.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-auth-client-get-user-activity.query-
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-auth-client-get-user-activity.query-Bug-SR6J.mjs","sources":["../../../../libs/modules/auth/client/src/lib/features/queries/get-user-activity.query.ts"],"sourcesContent":["import {\n runtimeQueryFailure,\n runtimeQuerySuccessObject,\n} from '@acorex-platform/framework-shared/core';\nimport type { AXPQuery, AXPQueryFetchResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXDataSourceFilterOption } from '@acorex/cdk/common';\nimport {\n AXMSecurityManagementDeviceSessionsEntityModel,\n RootConfig as SecurityManagementRootConfig,\n} from '@acorex-platform/module-security-management-client/contracts';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { isEmpty } from 'lodash';\n\nimport {\n AXPUserActivityDataSourceItem,\n AXPUserActivityLoadParams,\n} from '../../shared/datasources/user-activity/user-activity.types';\nimport {\n buildUserActivityDataSourceItem,\n resolveDefaultUserActivityDateRange,\n resolveSmartUserActivityDateRange,\n} from '../../shared/datasources/user-activity/user-activity.utils';\n\n//#region ---- Types ----\n\nexport interface AXMGetUserActivityQueryInput {\n userId: string;\n startDate?: string | Date;\n endDate?: string | Date;\n}\n\n//#endregion\n\n//#region ---- Helpers ----\n\nfunction coerceDate(value: string | Date | undefined, fallback: Date): Date {\n if (value instanceof Date && !Number.isNaN(value.getTime())) {\n return value;\n }\n if (typeof value === 'string' && value.trim()) {\n const parsed = new Date(value);\n if (!Number.isNaN(parsed.getTime())) {\n return parsed;\n }\n }\n return fallback;\n}\n\n//#endregion\n\n//#region ---- Query ----\n\n/**\n * User activity heatmap — replaces the `auth-user-activity` DI data source.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMGetUserActivityQuery\n implements AXPQuery<AXMGetUserActivityQueryInput, AXPUserActivityDataSourceItem | null>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n\n //#endregion\n\n //#region ---- Query Execution ----\n\n async fetch(\n input?: AXMGetUserActivityQueryInput | null,\n ): AXPQueryFetchResultPromise<AXPUserActivityDataSourceItem | null> {\n try {\n if (isEmpty(input?.userId)) {\n return runtimeQuerySuccessObject(null);\n }\n\n const sessions = await this.loadUserSessions(input!.userId);\n let range: { startDate: Date; endDate: Date };\n if (input?.startDate != null && input?.endDate != null) {\n const fallback = resolveDefaultUserActivityDateRange();\n range = {\n startDate: coerceDate(input.startDate, fallback.startDate),\n endDate: coerceDate(input.endDate, fallback.endDate),\n };\n } else {\n range = resolveSmartUserActivityDateRange(sessions, input!.userId);\n }\n const params: AXPUserActivityLoadParams = {\n userId: input!.userId,\n startDate: range.startDate,\n endDate: range.endDate,\n };\n\n const item = buildUserActivityDataSourceItem(params, sessions);\n return runtimeQuerySuccessObject(item);\n } catch (error) {\n return runtimeQueryFailure(\n error instanceof Error ? error.message : 'Unknown error occurred',\n );\n }\n }\n\n //#endregion\n\n //#region ---- Private Methods ----\n\n private async loadUserSessions(\n userId: string,\n ): Promise<AXMSecurityManagementDeviceSessionsEntityModel[]> {\n const response = await this.entityService\n .withEntity(\n SecurityManagementRootConfig.module.name,\n SecurityManagementRootConfig.entities.deviceSessions.name,\n )\n .data<string, AXMSecurityManagementDeviceSessionsEntityModel>()\n .query({\n skip: 0,\n take: 1000,\n filter: {\n field: 'userId',\n operator: { type: 'equal' },\n value: userId,\n } as AXDataSourceFilterOption,\n });\n\n return response.items ?? [];\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":["SecurityManagementRootConfig"],"mappings":";;;;;;;;AAiCA;AAEA;AAEA,SAAS,UAAU,CAAC,KAAgC,EAAE,QAAc,EAAA;AAClE,IAAA,IAAI,KAAK,YAAY,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE;AAC3D,QAAA,OAAO,KAAK;IAC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1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, Injectable } from '@angular/core';
|
|
3
|
-
import { j as AXPIdleLockService } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-
|
|
3
|
+
import { j as AXPIdleLockService } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-Cq9R3s5A.mjs';
|
|
4
4
|
|
|
5
5
|
//#region ---- Lock screen command ----
|
|
6
6
|
/** Locks the session overlay when Lock When Idle is enabled. */
|
|
@@ -27,4 +27,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
27
27
|
}] });
|
|
28
28
|
|
|
29
29
|
export { AXPLockScreenCommand };
|
|
30
|
-
//# sourceMappingURL=acorex-platform-module-auth-client-lock-screen.command-
|
|
30
|
+
//# sourceMappingURL=acorex-platform-module-auth-client-lock-screen.command-Uros3kRx.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-auth-client-lock-screen.command-
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-auth-client-lock-screen.command-Uros3kRx.mjs","sources":["../../../../libs/modules/auth/client/src/lib/commands/lock-screen.command.ts"],"sourcesContent":["import { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\n\nimport { inject, Injectable } from '@angular/core';\nimport { AXPIdleLockService } from '../shared/services/idle-lock.service';\n\n//#region ---- Lock screen command ----\n\n/** Locks the session overlay when Lock When Idle is enabled. */\n@Injectable({ providedIn: 'root' })\nexport class AXPLockScreenCommand implements AXPCommand {\n //#region ---- Services & Dependencies ----\n\n private readonly idleLockService = inject(AXPIdleLockService);\n\n //#endregion\n\n //#region ---- Command ----\n\n async execute(): AXPCommandExecuteResultPromise<void> {\n await this.idleLockService.refreshLockState();\n\n if (this.idleLockService.canLock()) {\n this.idleLockService.lockScreen();\n }\n\n return { success: true, kind: 'object', data: undefined };\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;AAMA;AAEA;MAEa,oBAAoB,CAAA;AADjC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,eAAe,GAAG,MAAM,CAAC,kBAAkB,CAAC;AAiB9D,IAAA;;;AAXC,IAAA,MAAM,OAAO,GAAA;AACX,QAAA,MAAM,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE;AAE7C,QAAA,IAAI,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,EAAE;AAClC,YAAA,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE;QACnC;AAEA,QAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;IAC3D;8GAjBW,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAApB,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,oBAAoB,cADP,MAAM,EAAA,CAAA,CAAA;;2FACnB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBADhC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, NgModule } from '@angular/core';
|
|
3
3
|
import { ROUTES } from '@angular/router';
|
|
4
|
-
import { w as AXM_LOGIN_GUARD_TOKEN } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-
|
|
4
|
+
import { w as AXM_LOGIN_GUARD_TOKEN } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-Cq9R3s5A.mjs';
|
|
5
5
|
|
|
6
6
|
function routesFacory() {
|
|
7
7
|
const loginGuard = inject(AXM_LOGIN_GUARD_TOKEN);
|
|
@@ -9,7 +9,7 @@ function routesFacory() {
|
|
|
9
9
|
{
|
|
10
10
|
path: 'login',
|
|
11
11
|
canActivate: [loginGuard],
|
|
12
|
-
loadComponent: () => import('./acorex-platform-module-auth-client-password.component-
|
|
12
|
+
loadComponent: () => import('./acorex-platform-module-auth-client-password.component-DLtE_j1b.mjs').then((c) => c.AXPLoginPasswordComponent),
|
|
13
13
|
},
|
|
14
14
|
];
|
|
15
15
|
return routes;
|
|
@@ -41,4 +41,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
41
41
|
}] });
|
|
42
42
|
|
|
43
43
|
export { AXPSignInModule };
|
|
44
|
-
//# sourceMappingURL=acorex-platform-module-auth-client-login.module-
|
|
44
|
+
//# sourceMappingURL=acorex-platform-module-auth-client-login.module-B-NNlaEN.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-auth-client-login.module-
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-auth-client-login.module-B-NNlaEN.mjs","sources":["../../../../libs/modules/auth/client/src/lib/pages/login/login.module.ts"],"sourcesContent":["import { NgModule, inject } from '@angular/core';\nimport { ROUTES, Routes } from '@angular/router';\nimport { AXM_LOGIN_GUARD_TOKEN } from '../../auth.config';\n\nfunction routesFacory() {\n const loginGuard = inject(AXM_LOGIN_GUARD_TOKEN);\n const routes: Routes = [\n {\n path: 'login',\n canActivate: [loginGuard],\n loadComponent: () =>\n import('./password/password.component').then((c) => c.AXPLoginPasswordComponent),\n },\n ];\n return routes;\n}\n\n@NgModule({\n imports: [],\n exports: [],\n providers: [\n {\n provide: ROUTES,\n multi: true,\n useFactory: routesFacory,\n },\n ],\n})\nexport class AXPSignInModule {}\n"],"names":[],"mappings":";;;;;AAIA,SAAS,YAAY,GAAA;AACnB,IAAA,MAAM,UAAU,GAAG,MAAM,CAAC,qBAAqB,CAAC;AAChD,IAAA,MAAM,MAAM,GAAW;AACrB,QAAA;AACE,YAAA,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,CAAC,UAAU,CAAC;AACzB,YAAA,aAAa,EAAE,MACb,OAAO,sEAA+B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,yBAAyB,CAAC;AACnF,SAAA;KACF;AACD,IAAA,OAAO,MAAM;AACf;MAaa,eAAe,CAAA;8GAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAAf,eAAe,EAAA,CAAA,CAAA;AAAf,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,EAAA,SAAA,EARf;AACT,YAAA;AACE,gBAAA,OAAO,EAAE,MAAM;AACf,gBAAA,KAAK,EAAE,IAAI;AACX,gBAAA,UAAU,EAAE,YAAY;AACzB,aAAA;AACF,SAAA,EAAA,CAAA,CAAA;;2FAEU,eAAe,EAAA,UAAA,EAAA,CAAA;kBAX3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,SAAS,EAAE;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,MAAM;AACf,4BAAA,KAAK,EAAE,IAAI;AACX,4BAAA,UAAU,EAAE,YAAY;AACzB,yBAAA;AACF,qBAAA;AACF,iBAAA;;;"}
|
|
@@ -8,7 +8,7 @@ import { runtimeCommandPayloadData } from '@acorex-platform/framework-shared/cor
|
|
|
8
8
|
import { AXM_TWO_FACTOR_ERROR_CODES, AXMSecurityManagementServerCommands } from '@acorex-platform/module-security-management-client/contracts';
|
|
9
9
|
import * as i0 from '@angular/core';
|
|
10
10
|
import { inject, Injectable } from '@angular/core';
|
|
11
|
-
import { T as TWO_FACTOR_SECTION_ID, d as PROFILE_SECTION_INSIGHTS_PATCH_METADATA_KEY, s as buildTwoFactorStatusInsights } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-
|
|
11
|
+
import { T as TWO_FACTOR_SECTION_ID, d as PROFILE_SECTION_INSIGHTS_PATCH_METADATA_KEY, s as buildTwoFactorStatusInsights } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-Cq9R3s5A.mjs';
|
|
12
12
|
|
|
13
13
|
//#region ----- Constants -----
|
|
14
14
|
const I18N = '@auth:profile-page.commands.manage-two-factor';
|
|
@@ -442,4 +442,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
442
442
|
}] });
|
|
443
443
|
|
|
444
444
|
export { AXPManageTwoFactorCommand };
|
|
445
|
-
//# sourceMappingURL=acorex-platform-module-auth-client-manage-two-factor.command-
|
|
445
|
+
//# sourceMappingURL=acorex-platform-module-auth-client-manage-two-factor.command-CD5kAdfT.mjs.map
|