@acorex-platform/module-auth-client 1.0.1 → 1.0.2
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-Dgo6MzxI.mjs → acorex-platform-module-auth-client-acorex-platform-module-auth-client-CBRlR1xT.mjs} +106 -80
- package/fesm2022/acorex-platform-module-auth-client-acorex-platform-module-auth-client-CBRlR1xT.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-app-chooser.component-nSUtqF_D.mjs → acorex-platform-module-auth-client-app-chooser.component-DpGdObrH.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-app-chooser.component-nSUtqF_D.mjs.map → acorex-platform-module-auth-client-app-chooser.component-DpGdObrH.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-change-password.command-Bman8avz.mjs → acorex-platform-module-auth-client-change-password.command-Bt4yOMMt.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-change-password.command-Bman8avz.mjs.map → acorex-platform-module-auth-client-change-password.command-Bt4yOMMt.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-change-photo.command-DFS8TE__.mjs → acorex-platform-module-auth-client-change-photo.command-tZ3TnzBz.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-change-photo.command-DFS8TE__.mjs.map → acorex-platform-module-auth-client-change-photo.command-tZ3TnzBz.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-get-user-activity.query-ZTJMfhir.mjs → acorex-platform-module-auth-client-get-user-activity.query-BxoUkan6.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-get-user-activity.query-ZTJMfhir.mjs.map → acorex-platform-module-auth-client-get-user-activity.query-BxoUkan6.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-lock-screen.command-CUs7Q6yh.mjs → acorex-platform-module-auth-client-lock-screen.command-QXW3UCik.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-lock-screen.command-CUs7Q6yh.mjs.map → acorex-platform-module-auth-client-lock-screen.command-QXW3UCik.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-login.module-DFWtA7S3.mjs → acorex-platform-module-auth-client-login.module-dy4_aiwN.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-login.module-DFWtA7S3.mjs.map → acorex-platform-module-auth-client-login.module-dy4_aiwN.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-manage-two-factor.command-BXK7Lvpw.mjs → acorex-platform-module-auth-client-manage-two-factor.command-Cal6EJe0.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-manage-two-factor.command-BXK7Lvpw.mjs.map → acorex-platform-module-auth-client-manage-two-factor.command-Cal6EJe0.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-open-sessions.command-DToDT9eb.mjs → acorex-platform-module-auth-client-open-sessions.command-ZG33hlfh.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-open-sessions.command-DToDT9eb.mjs.map → acorex-platform-module-auth-client-open-sessions.command-ZG33hlfh.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-password.component-DAp_-zko.mjs → acorex-platform-module-auth-client-password.component-D0pwQEaB.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-password.component-DAp_-zko.mjs.map → acorex-platform-module-auth-client-password.component-D0pwQEaB.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-profile-activity-chart.component-CLW52NUu.mjs → acorex-platform-module-auth-client-profile-activity-chart.component-DJKJdwUC.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-profile-activity-chart.component-CLW52NUu.mjs.map → acorex-platform-module-auth-client-profile-activity-chart.component-DJKJdwUC.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-profile-page-component.provider-D5xhGDPH.mjs → acorex-platform-module-auth-client-profile-page-component.provider-CSNCpJTo.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-profile-page-component.provider-D5xhGDPH.mjs.map → acorex-platform-module-auth-client-profile-page-component.provider-CSNCpJTo.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-profile-page.component-Dc7gRTQD.mjs → acorex-platform-module-auth-client-profile-page.component-BM6a4K1A.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-profile-page.component-Dc7gRTQD.mjs.map → acorex-platform-module-auth-client-profile-page.component-BM6a4K1A.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-register-password.component-C4zu5hpL.mjs → acorex-platform-module-auth-client-register-password.component-BxQNY-Nh.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-register-password.component-C4zu5hpL.mjs.map → acorex-platform-module-auth-client-register-password.component-BxQNY-Nh.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-register.module-Dz-SOKXN.mjs → acorex-platform-module-auth-client-register.module-BLQWaJky.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-register.module-Dz-SOKXN.mjs.map → acorex-platform-module-auth-client-register.module-BLQWaJky.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-remove-pin-code.command-LKjypQTk.mjs → acorex-platform-module-auth-client-remove-pin-code.command-DyO4Oj2C.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-remove-pin-code.command-LKjypQTk.mjs.map → acorex-platform-module-auth-client-remove-pin-code.command-DyO4Oj2C.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-PQ91EQjh.mjs → acorex-platform-module-auth-client-session-lock-overlay.component-5opoeMsk.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-session-lock-overlay.component-PQ91EQjh.mjs.map → acorex-platform-module-auth-client-session-lock-overlay.component-5opoeMsk.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-set-pin-code.command-BdtPwfLH.mjs → acorex-platform-module-auth-client-set-pin-code.command-CRb8NATb.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-set-pin-code.command-BdtPwfLH.mjs.map → acorex-platform-module-auth-client-set-pin-code.command-CRb8NATb.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-set-pin-code.component-L3DlTawo.mjs → acorex-platform-module-auth-client-set-pin-code.component-6NqaEKMs.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-set-pin-code.component-L3DlTawo.mjs.map → acorex-platform-module-auth-client-set-pin-code.component-6NqaEKMs.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-tenant-chooser.component-cRTVB-7T.mjs → acorex-platform-module-auth-client-tenant-chooser.component-C8AopfZ4.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-tenant-chooser.component-cRTVB-7T.mjs.map → acorex-platform-module-auth-client-tenant-chooser.component-C8AopfZ4.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-DDzjCHid.mjs → acorex-platform-module-auth-client-two-factor-code.component-DAMphXPJ.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-two-factor-code.component-DDzjCHid.mjs.map → acorex-platform-module-auth-client-two-factor-code.component-DAMphXPJ.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-two-factor.module-BC8AJTp4.mjs → acorex-platform-module-auth-client-two-factor.module-xzAzTU4n.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-two-factor.module-BC8AJTp4.mjs.map → acorex-platform-module-auth-client-two-factor.module-xzAzTU4n.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-view-login-history.command-EHXTmZtV.mjs → acorex-platform-module-auth-client-view-login-history.command-CLWGDmsI.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-view-login-history.command-EHXTmZtV.mjs.map → acorex-platform-module-auth-client-view-login-history.command-CLWGDmsI.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-welcome-onboarding-page.component-CQUpjsZw.mjs → acorex-platform-module-auth-client-welcome-onboarding-page.component-CdgoC07Q.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-welcome-onboarding-page.component-CQUpjsZw.mjs.map → acorex-platform-module-auth-client-welcome-onboarding-page.component-CdgoC07Q.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-welcome-onboarding.command-D8cyXb5q.mjs → acorex-platform-module-auth-client-welcome-onboarding.command-BNOEiB5l.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-welcome-onboarding.command-D8cyXb5q.mjs.map → acorex-platform-module-auth-client-welcome-onboarding.command-BNOEiB5l.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-auth-client.mjs +1 -1
- package/i18n/en-AU/auth.json +2 -1
- package/i18n/en-US/auth.json +2 -1
- package/i18n/fa-IR/auth.json +2 -1
- package/package.json +3 -3
- package/fesm2022/acorex-platform-module-auth-client-acorex-platform-module-auth-client-Dgo6MzxI.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-CBRlR1xT.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-DpGdObrH.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-DpGdObrH.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"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AA,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-CBRlR1xT.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-Bt4yOMMt.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-auth-client-change-password.command-Bman8avz.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,mC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E,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-Bt4yOMMt.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,QA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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-CBRlR1xT.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-tZ3TnzBz.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-auth-client-change-photo.command-DFS8TE__.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,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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-tZ3TnzBz.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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,MAAM,IAAI,CAAC;AACrB,iBAAA,UAAU,CACTA,UAA4B,CAAC,MAAM,CAAC,IAAI,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;;;"}
|
|
@@ -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-CBRlR1xT.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-BxoUkan6.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-BxoUkan6.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":["SecurityManagementRoot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AA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,cADV,MAAM,EAAA,CAAA,CAAA;;2FACnB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBADnC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -1,6 +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-CBRlR1xT.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-QXW3UCik.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-QXW3UCik.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-CBRlR1xT.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-D0pwQEaB.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-dy4_aiwN.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-dy4_aiwN.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-CBRlR1xT.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-Cal6EJe0.mjs.map
|