@acorex-platform/module-auth-client 0.0.33 → 0.0.38
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-CTf7qxkQ.mjs → acorex-platform-module-auth-client-acorex-platform-module-auth-client-CRl74b8g.mjs} +275 -92
- package/fesm2022/acorex-platform-module-auth-client-acorex-platform-module-auth-client-CRl74b8g.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-app-chooser.component-TPCkYJej.mjs → acorex-platform-module-auth-client-app-chooser.component-CjWofUGR.mjs} +5 -5
- package/fesm2022/{acorex-platform-module-auth-client-app-chooser.component-TPCkYJej.mjs.map → acorex-platform-module-auth-client-app-chooser.component-CjWofUGR.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-auth-client-blank.layout-BCXNPgrp.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-change-password.command-DHwnPkUO.mjs → acorex-platform-module-auth-client-change-password.command-BqU3jYV9.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-change-password.command-DHwnPkUO.mjs.map → acorex-platform-module-auth-client-change-password.command-BqU3jYV9.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-change-photo.command-BZK_W29M.mjs → acorex-platform-module-auth-client-change-photo.command-CzO3A7OG.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-change-photo.command-BZK_W29M.mjs.map → acorex-platform-module-auth-client-change-photo.command-CzO3A7OG.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-auth-client-contracts.mjs +63 -1
- package/fesm2022/acorex-platform-module-auth-client-contracts.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-auth-client-edit-account-info.command-CD9IrimO.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-auth-client-edit-signature.command-TjOLhvKL.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-get-user-activity.query-DBdELID4.mjs → acorex-platform-module-auth-client-get-user-activity.query-B1bKcSVQ.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-get-user-activity.query-DBdELID4.mjs.map → acorex-platform-module-auth-client-get-user-activity.query-B1bKcSVQ.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-lock-screen.command-BADSRZxj.mjs → acorex-platform-module-auth-client-lock-screen.command-DKtlBzS7.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-lock-screen.command-BADSRZxj.mjs.map → acorex-platform-module-auth-client-lock-screen.command-DKtlBzS7.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-login.module-DushGqH6.mjs → acorex-platform-module-auth-client-login.module-CXl61yOu.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-login.module-DushGqH6.mjs.map → acorex-platform-module-auth-client-login.module-CXl61yOu.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-master.layout-BLUWyFTY.mjs → acorex-platform-module-auth-client-master.layout-D7zUm7aL.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-auth-client-master.layout-BLUWyFTY.mjs.map → acorex-platform-module-auth-client-master.layout-D7zUm7aL.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-auth-client-menu.provider-Bz-kRip4.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-oauth-callback.component-DnQzPUxF.mjs → acorex-platform-module-auth-client-oauth-callback.component-fdWC08nA.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-oauth-callback.component-DnQzPUxF.mjs.map → acorex-platform-module-auth-client-oauth-callback.component-fdWC08nA.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-auth-client-open-sessions.command-DKvyMkhl.mjs +265 -0
- package/fesm2022/acorex-platform-module-auth-client-open-sessions.command-DKvyMkhl.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-password.component-CW0t9fEn.mjs → acorex-platform-module-auth-client-password.component-BE2JkYm_.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-password.component-CW0t9fEn.mjs.map → acorex-platform-module-auth-client-password.component-BE2JkYm_.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-password.component-D5QDAaKY.mjs → acorex-platform-module-auth-client-password.component-BoWDVby5.mjs} +10 -5
- package/fesm2022/acorex-platform-module-auth-client-password.component-BoWDVby5.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client-pin-code.constants-CRsFG7fg.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-platform-settings-unavailable.component-BEVkQ3jh.mjs → acorex-platform-module-auth-client-platform-settings-unavailable.component-BJMtsa99.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-auth-client-platform-settings-unavailable.component-BEVkQ3jh.mjs.map → acorex-platform-module-auth-client-platform-settings-unavailable.component-BJMtsa99.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-profile-activity-chart.component-o7Eq3zuR.mjs → acorex-platform-module-auth-client-profile-activity-chart.component-CFaRGMKu.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-auth-client-profile-activity-chart.component-o7Eq3zuR.mjs.map → acorex-platform-module-auth-client-profile-activity-chart.component-CFaRGMKu.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-auth-client-profile-coming-soon.command-Crh2GsRA.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-profile-delete-account-danger-zone.component-D0QS8joQ.mjs → acorex-platform-module-auth-client-profile-delete-account-danger-zone.component-Dx2-o9XL.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-profile-delete-account-danger-zone.component-D0QS8joQ.mjs.map → acorex-platform-module-auth-client-profile-delete-account-danger-zone.component-Dx2-o9XL.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-profile-page-component.provider-CfQySdD8.mjs → acorex-platform-module-auth-client-profile-page-component.provider-1Spuexhb.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-auth-client-profile-page-component.provider-CfQySdD8.mjs.map → acorex-platform-module-auth-client-profile-page-component.provider-1Spuexhb.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-profile-page.component-CPHQXCpS.mjs → acorex-platform-module-auth-client-profile-page.component-CGs24n0j.mjs} +7 -7
- package/fesm2022/{acorex-platform-module-auth-client-profile-page.component-CPHQXCpS.mjs.map → acorex-platform-module-auth-client-profile-page.component-CGs24n0j.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-register-password.component-BMHOG5m4.mjs → acorex-platform-module-auth-client-register-password.component-BlOn9609.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-auth-client-register-password.component-BMHOG5m4.mjs.map → acorex-platform-module-auth-client-register-password.component-BlOn9609.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-register.module-CFIHZOYj.mjs → acorex-platform-module-auth-client-register.module-CpoYf5uG.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-auth-client-register.module-CFIHZOYj.mjs.map → acorex-platform-module-auth-client-register.module-CpoYf5uG.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-remove-pin-code.command-CdlJF48g.mjs → acorex-platform-module-auth-client-remove-pin-code.command-Da7ryul6.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-remove-pin-code.command-CdlJF48g.mjs.map → acorex-platform-module-auth-client-remove-pin-code.command-Da7ryul6.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-reset-password.component-CcwDb6Wb.mjs → acorex-platform-module-auth-client-reset-password.component-D0nxlhJm.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-reset-password.component-CcwDb6Wb.mjs.map → acorex-platform-module-auth-client-reset-password.component-D0nxlhJm.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-result.component-DWv1hmQR.mjs → acorex-platform-module-auth-client-result.component-Bo1QkwMu.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-result.component-DWv1hmQR.mjs.map → acorex-platform-module-auth-client-result.component-Bo1QkwMu.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-routes-IX2qmeqU.mjs → acorex-platform-module-auth-client-routes-B6iJHJ60.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-routes-IX2qmeqU.mjs.map → acorex-platform-module-auth-client-routes-B6iJHJ60.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-auth-client-session-limit.component-DH58dRba.mjs +195 -0
- package/fesm2022/acorex-platform-module-auth-client-session-limit.component-DH58dRba.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-auth-client-session-lock-overlay.component-CcGFA6Op.mjs → acorex-platform-module-auth-client-session-lock-overlay.component-cDCrwNRV.mjs} +5 -5
- package/fesm2022/{acorex-platform-module-auth-client-session-lock-overlay.component-CcGFA6Op.mjs.map → acorex-platform-module-auth-client-session-lock-overlay.component-cDCrwNRV.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-set-pin-code.command-BSZhRCN7.mjs → acorex-platform-module-auth-client-set-pin-code.command-FjM1kzUj.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-set-pin-code.command-BSZhRCN7.mjs.map → acorex-platform-module-auth-client-set-pin-code.command-FjM1kzUj.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-set-pin-code.component-Bm32dRFz.mjs → acorex-platform-module-auth-client-set-pin-code.component-BgEgdFxQ.mjs} +5 -5
- package/fesm2022/{acorex-platform-module-auth-client-set-pin-code.component-Bm32dRFz.mjs.map → acorex-platform-module-auth-client-set-pin-code.component-BgEgdFxQ.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-settings.provider-Yaoz8yp3.mjs → acorex-platform-module-auth-client-settings.provider-DGiK-MmW.mjs} +27 -25
- package/fesm2022/acorex-platform-module-auth-client-settings.provider-DGiK-MmW.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-auth-client-show-profile-command-BWoDxIdx.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-auth-client-signout-command-B7n_Fn4P.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-tenant-chooser.component-DKTvZ1-I.mjs → acorex-platform-module-auth-client-tenant-chooser.component-B8CNqHx5.mjs} +5 -5
- package/fesm2022/{acorex-platform-module-auth-client-tenant-chooser.component-DKTvZ1-I.mjs.map → acorex-platform-module-auth-client-tenant-chooser.component-B8CNqHx5.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-two-factor-code.component-nsB4v25Z.mjs → acorex-platform-module-auth-client-two-factor-code.component-BrqfaY8i.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-auth-client-two-factor-code.component-nsB4v25Z.mjs.map → acorex-platform-module-auth-client-two-factor-code.component-BrqfaY8i.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-two-factor.module-BnH72Bob.mjs → acorex-platform-module-auth-client-two-factor.module-CI8KC5M_.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-two-factor.module-BnH72Bob.mjs.map → acorex-platform-module-auth-client-two-factor.module-CI8KC5M_.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-auth-client-view-login-history.command-CWmD9wNM.mjs → acorex-platform-module-auth-client-view-login-history.command-Cqb27L-l.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-auth-client-view-login-history.command-CWmD9wNM.mjs.map → acorex-platform-module-auth-client-view-login-history.command-Cqb27L-l.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-auth-client.mjs +1 -1
- package/package.json +2 -2
- package/types/acorex-platform-module-auth-client-contracts.d.ts +30 -2
- package/fesm2022/acorex-platform-module-auth-client-acorex-platform-module-auth-client-CTf7qxkQ.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-open-sessions.command-BHAf7500.mjs +0 -190
- package/fesm2022/acorex-platform-module-auth-client-open-sessions.command-BHAf7500.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-password.component-D5QDAaKY.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-auth-client-settings.provider-Yaoz8yp3.mjs.map +0 -1
|
@@ -7,7 +7,7 @@ import { AXFormModule } from '@acorex/components/form';
|
|
|
7
7
|
import { AXImageModule } from '@acorex/components/image';
|
|
8
8
|
import { AXLabelModule } from '@acorex/components/label';
|
|
9
9
|
import { AXLoadingModule } from '@acorex/components/loading';
|
|
10
|
-
import * as
|
|
10
|
+
import * as i3 from '@acorex/components/skeleton';
|
|
11
11
|
import { AXSkeletonModule } from '@acorex/components/skeleton';
|
|
12
12
|
import { AXTextBoxModule } from '@acorex/components/text-box';
|
|
13
13
|
import * as i5 from '@acorex/core/translation';
|
|
@@ -16,10 +16,10 @@ import { AXPSessionService } from '@acorex-platform/framework-client/auth';
|
|
|
16
16
|
import { AXPPlatformBrandingService } from '@acorex-platform/framework-client/common';
|
|
17
17
|
import { AXPLogoComponent } from '@acorex-platform/framework-client/core';
|
|
18
18
|
import { AXPUserAvatarComponent } from '@acorex-platform/framework-client/layout/components';
|
|
19
|
-
import * as
|
|
19
|
+
import * as i5$1 from '@angular/common';
|
|
20
20
|
import { CommonModule } from '@angular/common';
|
|
21
21
|
import { Router } from '@angular/router';
|
|
22
|
-
import { x as AXPTenantChooserDropdownComponent, y as AXPAppChooserListComponent } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-
|
|
22
|
+
import { x as AXPTenantChooserDropdownComponent, y as AXPAppChooserListComponent } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-CRl74b8g.mjs';
|
|
23
23
|
|
|
24
24
|
class AXPAuthAppChooserComponent {
|
|
25
25
|
constructor() {
|
|
@@ -48,7 +48,7 @@ class AXPAuthAppChooserComponent {
|
|
|
48
48
|
this.router.navigate(['/auth/login']);
|
|
49
49
|
}
|
|
50
50
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPAuthAppChooserComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
51
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXPAuthAppChooserComponent, isStandalone: true, selector: "axp-auth-app-chooser", ngImport: i0, template: "<main *translate=\"let t\" class=\"axp-auth-chooser\">\n <div class=\"axp-auth-chooser__inner\">\n <!-- ----- Platform branding ----- -->\n <section class=\"axp-auth-chooser__brand\">\n <axp-logo\n logoKey=\"platform\"\n appearance=\"onLight\"\n format=\"full\"\n [size]=\"260\"\n [attr.alt]=\"platformTitle()\"\n ></axp-logo>\n </section>\n <!-- ----- Application selection card ----- -->\n <section class=\"axp-auth-chooser__card-wrap\">\n <div class=\"axp-auth-chooser__card\">\n <!-- ----- Profile header while catalog loads ----- -->\n @if (catalogLoading()) {\n <ax-skeleton [animated]=\"true\" class=\"size-[72px] rounded-full shrink-0\"></ax-skeleton>\n <ax-skeleton [animated]=\"true\" class=\"h-6 w-56 max-w-full\"></ax-skeleton>\n <ax-skeleton [animated]=\"true\" class=\"h-5 w-32 max-w-full\"></ax-skeleton>\n <ax-skeleton [animated]=\"true\" class=\"h-4 w-64 max-w-full\"></ax-skeleton>\n } @else {\n <axp-user-avatar\n [size]=\"72\"\n [userId]=\"$safeNavigationMigration(user?.id)!\"\n [showPresence]=\"false\"\n ></axp-user-avatar>\n <h2 class=\"md:text-lg font-medium\">\n {{ '@auth:welcome.message' | translate | async }}, {{ user?.title }}\n </h2>\n <axp-tenant-chooser-dropdown></axp-tenant-chooser-dropdown>\n <p class=\"text-neutral-500 text-sm md:text-base font-medium\">\n {{ '@auth:application-chooser.description' | translate | async }}\n </p>\n }\n <div class=\"mt-3 w-full overflow-auto max-h-[300px]\">\n <axp-app-chooser-list (loadingChange)=\"handleCatalogLoading($event)\"></axp-app-chooser-list>\n </div>\n </div>\n </section>\n <!-- ----- Navigation footer ----- -->\n <section class=\"axp-auth-chooser__footer\">\n <p class=\"text-neutral-400 text-sm\">\n {{ '@auth:application-chooser.footer' | translate | async }}\n @if (tenants$ | async; as tenants) {\n @if (tenants.length > 1) {\n <a\n (click)=\"tenantChooser()\"\n class=\"text-primary-500 cursor-pointer font-medium hover:underline\"\n >\n {{ '@auth:application-chooser.backCompany' | translate | async }}\n </a>\n }\n <!-- ----- Single-tenant users return to login ----- -->\n @else {\n <a\n (click)=\"handleSignout()\"\n class=\"text-primary-500 font-medium cursor-pointer hover:underline\"\n >\n {{ '@auth:backLogin' | translate | async }}\n </a>\n }\n }\n </p>\n </section>\n </div>\n</main>\n", styles: ["@layer properties;.axp-auth-chooser{display:flex;width:100%;flex-direction:column;align-items:center;overflow-y:auto;background-color:rgba(var(--ax-sys-color-lightest-surface));height:100vh;height:100dvh;-webkit-overflow-scrolling:touch}.axp-auth-chooser__inner{display:flex;width:100%;flex-grow:1;flex-direction:column;align-items:center;justify-content:center;gap:calc(var(--spacing, .25rem) * 6);padding-inline:calc(var(--spacing, .25rem) * 4);min-height:100%;box-sizing:border-box;padding-top:max(2.75rem,calc(env(safe-area-inset-top,0px) + 1.75rem));padding-bottom:max(1.5rem,env(safe-area-inset-bottom,0px))}.axp-auth-chooser__brand{display:flex;width:100%;flex-shrink:0;justify-content:center}.axp-auth-chooser__brand axp-logo{width:min(16.25rem,85vw);max-width:100%}.axp-auth-chooser__card-wrap{display:flex;width:100%;flex-shrink:0;justify-content:center}.axp-auth-chooser__card{display:flex;width:100%;flex-direction:column;align-items:center;justify-content:center;gap:calc(var(--spacing, .25rem) * 4);border-radius:var(--radius-lg, .5rem);border-style:var(--tw-border-style);border-width:0px;padding:calc(var(--spacing, .25rem) * 5);text-align:center;--tw-shadow: 0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);max-width:28rem}.axp-auth-chooser__footer{flex-shrink:0;padding-inline:var(--spacing, .25rem);text-align:center}@media(min-width:640px){.axp-auth-chooser__inner{gap:calc(var(--spacing, .25rem) * 8);padding-inline:calc(var(--spacing, .25rem) * 6);padding-top:max(3rem,calc(env(safe-area-inset-top,0px) + 2rem))}.axp-auth-chooser__brand axp-logo{width:min(16.25rem,90vw)}}@media(min-width:768px){.axp-auth-chooser{background-color:var(--color-bg-default)}.axp-auth-chooser__inner{gap:calc(var(--spacing, .25rem) * 10);padding-inline:calc(var(--spacing, .25rem) * 6);padding-top:3.5rem;padding-bottom:2.5rem}.axp-auth-chooser__card{gap:calc(var(--spacing, .25rem) * 2);border-style:var(--tw-border-style);border-width:1px;padding:calc(var(--spacing, .25rem) * 6);--tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / .1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);width:min(90vw,28rem);max-width:28rem}}@media(min-width:1024px){.axp-auth-chooser__inner{padding-inline:0px;padding-top:3.5rem;padding-bottom:2.5rem}.axp-auth-chooser__card{width:min(90vw,28rem)}}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-inset-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: \"*\"; inherits: false;}@property --tw-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: \"*\"; inherits: false;}@property --tw-inset-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: \"*\"; inherits: false;}@property --tw-ring-offset-width{syntax: \"<length>\"; inherits: false; initial-value: 0px;}@property --tw-ring-offset-color{syntax: \"*\"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid;--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n", ".gradient{background:-webkit-linear-gradient(var(--ax-current-v1),var(--ax-current-v2));-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXFormModule }, { kind: "ngmodule", type: AXTextBoxModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "ngmodule", type: AXLabelModule }, { kind: "ngmodule", type: AXCheckBoxModule }, { kind: "ngmodule", type: AXImageModule }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: AXPLogoComponent, selector: "axp-logo", inputs: ["logoKey", "appearance", "size", "format"] }, { kind: "ngmodule", type: AXLoadingModule }, { kind: "ngmodule", type: AXSkeletonModule }, { kind: "component", type:
|
|
51
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXPAuthAppChooserComponent, isStandalone: true, selector: "axp-auth-app-chooser", ngImport: i0, template: "<main *translate=\"let t\" class=\"axp-auth-chooser\">\n <div class=\"axp-auth-chooser__inner\">\n <!-- ----- Platform branding ----- -->\n <section class=\"axp-auth-chooser__brand\">\n <axp-logo\n logoKey=\"platform\"\n appearance=\"onLight\"\n format=\"full\"\n [size]=\"260\"\n [attr.alt]=\"platformTitle()\"\n ></axp-logo>\n </section>\n <!-- ----- Application selection card ----- -->\n <section class=\"axp-auth-chooser__card-wrap\">\n <div class=\"axp-auth-chooser__card\">\n <!-- ----- Profile header while catalog loads ----- -->\n @if (catalogLoading()) {\n <ax-skeleton [animated]=\"true\" class=\"size-[72px] rounded-full shrink-0\"></ax-skeleton>\n <ax-skeleton [animated]=\"true\" class=\"h-6 w-56 max-w-full\"></ax-skeleton>\n <ax-skeleton [animated]=\"true\" class=\"h-5 w-32 max-w-full\"></ax-skeleton>\n <ax-skeleton [animated]=\"true\" class=\"h-4 w-64 max-w-full\"></ax-skeleton>\n } @else {\n <axp-user-avatar\n [size]=\"72\"\n [userId]=\"$safeNavigationMigration(user?.id)!\"\n [showPresence]=\"false\"\n ></axp-user-avatar>\n <h2 class=\"md:text-lg font-medium\">\n {{ '@auth:welcome.message' | translate | async }}, {{ user?.title }}\n </h2>\n <axp-tenant-chooser-dropdown></axp-tenant-chooser-dropdown>\n <p class=\"text-neutral-500 text-sm md:text-base font-medium\">\n {{ '@auth:application-chooser.description' | translate | async }}\n </p>\n }\n <div class=\"mt-3 w-full overflow-auto max-h-[300px]\">\n <axp-app-chooser-list (loadingChange)=\"handleCatalogLoading($event)\"></axp-app-chooser-list>\n </div>\n </div>\n </section>\n <!-- ----- Navigation footer ----- -->\n <section class=\"axp-auth-chooser__footer\">\n <p class=\"text-neutral-400 text-sm\">\n {{ '@auth:application-chooser.footer' | translate | async }}\n @if (tenants$ | async; as tenants) {\n @if (tenants.length > 1) {\n <a\n (click)=\"tenantChooser()\"\n class=\"text-primary-500 cursor-pointer font-medium hover:underline\"\n >\n {{ '@auth:application-chooser.backCompany' | translate | async }}\n </a>\n }\n <!-- ----- Single-tenant users return to login ----- -->\n @else {\n <a\n (click)=\"handleSignout()\"\n class=\"text-primary-500 font-medium cursor-pointer hover:underline\"\n >\n {{ '@auth:backLogin' | translate | async }}\n </a>\n }\n }\n </p>\n </section>\n </div>\n</main>\n", styles: ["@layer properties;.axp-auth-chooser{display:flex;width:100%;flex-direction:column;align-items:center;overflow-y:auto;background-color:rgba(var(--ax-sys-color-lightest-surface));height:100vh;height:100dvh;-webkit-overflow-scrolling:touch}.axp-auth-chooser__inner{display:flex;width:100%;flex-grow:1;flex-direction:column;align-items:center;justify-content:center;gap:calc(var(--spacing, .25rem) * 6);padding-inline:calc(var(--spacing, .25rem) * 4);min-height:100%;box-sizing:border-box;padding-top:max(2.75rem,calc(env(safe-area-inset-top,0px) + 1.75rem));padding-bottom:max(1.5rem,env(safe-area-inset-bottom,0px))}.axp-auth-chooser__brand{display:flex;width:100%;flex-shrink:0;justify-content:center}.axp-auth-chooser__brand axp-logo{width:min(16.25rem,85vw);max-width:100%}.axp-auth-chooser__card-wrap{display:flex;width:100%;flex-shrink:0;justify-content:center}.axp-auth-chooser__card{display:flex;width:100%;flex-direction:column;align-items:center;justify-content:center;gap:calc(var(--spacing, .25rem) * 4);border-radius:var(--radius-lg, .5rem);border-style:var(--tw-border-style);border-width:0px;padding:calc(var(--spacing, .25rem) * 5);text-align:center;--tw-shadow: 0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);max-width:28rem}.axp-auth-chooser__footer{flex-shrink:0;padding-inline:var(--spacing, .25rem);text-align:center}@media(min-width:640px){.axp-auth-chooser__inner{gap:calc(var(--spacing, .25rem) * 8);padding-inline:calc(var(--spacing, .25rem) * 6);padding-top:max(3rem,calc(env(safe-area-inset-top,0px) + 2rem))}.axp-auth-chooser__brand axp-logo{width:min(16.25rem,90vw)}}@media(min-width:768px){.axp-auth-chooser{background-color:var(--color-bg-default)}.axp-auth-chooser__inner{gap:calc(var(--spacing, .25rem) * 10);padding-inline:calc(var(--spacing, .25rem) * 6);padding-top:3.5rem;padding-bottom:2.5rem}.axp-auth-chooser__card{gap:calc(var(--spacing, .25rem) * 2);border-style:var(--tw-border-style);border-width:1px;padding:calc(var(--spacing, .25rem) * 6);--tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / .1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);width:min(90vw,28rem);max-width:28rem}}@media(min-width:1024px){.axp-auth-chooser__inner{padding-inline:0px;padding-top:3.5rem;padding-bottom:2.5rem}.axp-auth-chooser__card{width:min(90vw,28rem)}}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-inset-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: \"*\"; inherits: false;}@property --tw-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: \"*\"; inherits: false;}@property --tw-inset-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: \"*\"; inherits: false;}@property --tw-ring-offset-width{syntax: \"<length>\"; inherits: false; initial-value: 0px;}@property --tw-ring-offset-color{syntax: \"*\"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid;--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n", ".gradient{background:-webkit-linear-gradient(var(--ax-current-v1),var(--ax-current-v2));-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXFormModule }, { kind: "ngmodule", type: AXTextBoxModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "ngmodule", type: AXLabelModule }, { kind: "ngmodule", type: AXCheckBoxModule }, { kind: "ngmodule", type: AXImageModule }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: AXPLogoComponent, selector: "axp-logo", inputs: ["logoKey", "appearance", "size", "format"] }, { kind: "ngmodule", type: AXLoadingModule }, { kind: "ngmodule", type: AXSkeletonModule }, { kind: "component", type: i3.AXSkeletonComponent, selector: "ax-skeleton", inputs: ["animated"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "directive", type: i5.AXTranslatorDirective, selector: "[translate]" }, { kind: "component", type: AXPTenantChooserDropdownComponent, selector: "axp-tenant-chooser-dropdown", inputs: ["inline"] }, { kind: "component", type: AXPAppChooserListComponent, selector: "axp-app-chooser-list", inputs: ["simple"], outputs: ["applicationChosen", "loadingChange"] }, { kind: "component", type: AXPUserAvatarComponent, selector: "axp-user-avatar", inputs: ["size", "userId", "showPresence", "displayName", "displayAvatar"] }, { kind: "pipe", type: i5$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i5.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager, encapsulation: i0.ViewEncapsulation.None }); }
|
|
52
52
|
}
|
|
53
53
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPAuthAppChooserComponent, decorators: [{
|
|
54
54
|
type: Component,
|
|
@@ -72,4 +72,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
72
72
|
}] });
|
|
73
73
|
|
|
74
74
|
export { AXPAuthAppChooserComponent };
|
|
75
|
-
//# sourceMappingURL=acorex-platform-module-auth-client-app-chooser.component-
|
|
75
|
+
//# sourceMappingURL=acorex-platform-module-auth-client-app-chooser.component-CjWofUGR.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-CjWofUGR.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 |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,EAAA,gvFAAA,EAAA,MAAA,EAAA,CAAA,4yIAAA,EAAA,qPAAA,CAAA,EAAA;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-auth-client-blank.layout-BCXNPgrp.mjs","sources":["../../../../libs/modules/auth/client/src/lib/shared/layouts/blank/blank.layout.ts","../../../../libs/modules/auth/client/src/lib/shared/layouts/blank/blank.layout.html"],"sourcesContent":["import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';\nimport { RouterModule } from '@angular/router';\n\n@Component({\n templateUrl: 'blank.layout.html',\n changeDetection: ChangeDetectionStrategy.Eager,\n imports: [RouterModule]\n})\nexport class AXPAuthBlankLayoutComponent implements OnInit {\n constructor() { }\n\n ngOnInit() { }\n}\n","<router-outlet></router-outlet>"],"names":[],"mappings":";;;;;MAQa,2BAA2B,CAAA;AACtC,IAAA,WAAA,GAAA,EAAgB;AAEhB,IAAA,QAAQ,KAAK;8GAHF,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAA3B,2BAA2B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,cAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECRxC,iCAA+B,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EDMjB,YAAY,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,YAAA,EAAA,QAAA,EAAA,eAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,kBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,UAAA,EAAA,YAAA,EAAA,QAAA,EAAA,QAAA,CAAA,EAAA,QAAA,EAAA,CAAA,QAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,KAAA,EAAA,CAAA,CAAA;;2FAEb,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBALvC,SAAS;AAEW,YAAA,IAAA,EAAA,CAAA,EAAA,eAAA,EAAA,uBAAuB,CAAC,KAAK,EAAA,OAAA,EACrC,CAAC,YAAY,CAAC,EAAA,QAAA,EAAA,iCAAA,EAAA
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-auth-client-blank.layout-BCXNPgrp.mjs","sources":["../../../../libs/modules/auth/client/src/lib/shared/layouts/blank/blank.layout.ts","../../../../libs/modules/auth/client/src/lib/shared/layouts/blank/blank.layout.html"],"sourcesContent":["import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';\nimport { RouterModule } from '@angular/router';\n\n@Component({\n templateUrl: 'blank.layout.html',\n changeDetection: ChangeDetectionStrategy.Eager,\n imports: [RouterModule]\n})\nexport class AXPAuthBlankLayoutComponent implements OnInit {\n constructor() { }\n\n ngOnInit() { }\n}\n","<router-outlet></router-outlet>"],"names":[],"mappings":";;;;;MAQa,2BAA2B,CAAA;AACtC,IAAA,WAAA,GAAA,EAAgB;AAEhB,IAAA,QAAQ,KAAK;8GAHF,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAA3B,2BAA2B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,cAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECRxC,iCAA+B,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EDMjB,YAAY,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,YAAA,EAAA,QAAA,EAAA,eAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,kBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,UAAA,EAAA,YAAA,EAAA,QAAA,EAAA,QAAA,CAAA,EAAA,QAAA,EAAA,CAAA,QAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,KAAA,EAAA,CAAA,CAAA;;2FAEb,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBALvC,SAAS;AAEW,YAAA,IAAA,EAAA,CAAA,EAAA,eAAA,EAAA,uBAAuB,CAAC,KAAK,EAAA,OAAA,EACrC,CAAC,YAAY,CAAC,EAAA,QAAA,EAAA,iCAAA,EAAA;;;"}
|
|
@@ -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-CRl74b8g.mjs';
|
|
11
11
|
|
|
12
12
|
//#region ---- Constants ----
|
|
13
13
|
const CHANGE_OWN_PASSWORD_ERROR_I18N = {
|
|
@@ -176,4 +176,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
176
176
|
}] });
|
|
177
177
|
|
|
178
178
|
export { AXPChangePasswordCommand };
|
|
179
|
-
//# sourceMappingURL=acorex-platform-module-auth-client-change-password.command-
|
|
179
|
+
//# sourceMappingURL=acorex-platform-module-auth-client-change-password.command-BqU3jYV9.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-auth-client-change-password.command-DHwnPkUO.mjs","sources":["../../../../libs/modules/auth/client/src/lib/commands/change-password.command.ts"],"sourcesContent":["import { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport {\n AXM_CHANGE_OWN_PASSWORD_ERROR_CODES,\n AXMSecurityManagementServerCommands,\n type AXMChangeOwnPasswordResult,\n} from '@acorex-platform/module-security-management-client/contracts';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport { AXPRuntimeCommandResult, runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';\nimport {\n AXPLayoutBuilderService,\n resolveLayoutBuilderDialogResult,\n} from '@acorex-platform/framework-client/layout/builder';\n\nimport { inject, Injectable } from '@angular/core';\nimport {\n getPasswordComplexityHintKey,\n getPasswordComplexityValidationMessageKey,\n validatePasswordAgainstComplexity,\n} from '../shared/utils/password-complexity.utils';\nimport { AXPAuthPasswordComplexityService } from '../shared/services/password-complexity.service';\nimport { AXPAuthPasswordChangeTrackingService } from '../shared/services/password-change-tracking.service';\nimport {\n CHANGE_PASSWORD_SECTION_ID,\n PROFILE_SECTION_INSIGHTS_PATCH_METADATA_KEY,\n buildPasswordLastChangedInsights,\n} from '../pages/account/profile-page/profile-password-insight.util';\n\n//#region ---- Constants ----\n\nconst CHANGE_OWN_PASSWORD_ERROR_I18N: Record<string, string> = {\n [AXM_CHANGE_OWN_PASSWORD_ERROR_CODES.NotSignedIn]:\n '@auth:profile-page.commands.change-password.messages.not-signed-in',\n [AXM_CHANGE_OWN_PASSWORD_ERROR_CODES.IncorrectCurrent]:\n '@auth:profile-page.commands.change-password.messages.incorrect-current',\n [AXM_CHANGE_OWN_PASSWORD_ERROR_CODES.SameAsCurrent]:\n '@auth:profile-page.commands.change-password.messages.same-as-current',\n [AXM_CHANGE_OWN_PASSWORD_ERROR_CODES.InvalidInput]:\n '@auth:profile-page.commands.change-password.messages.save-failed',\n};\n\n//#endregion\n\n//#region ---- Change password command ----\n\n/** Opens a dialog to change the signed-in user's password. */\n@Injectable({ providedIn: 'root' })\nexport class AXPChangePasswordCommand implements AXPCommand {\n //#region ---- Services & Dependencies ----\n\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly commandService = inject(AXPCommandService);\n private readonly sessionService = inject(AXPSessionService);\n private readonly passwordComplexityService = inject(AXPAuthPasswordComplexityService);\n private readonly passwordChangeTrackingService = inject(AXPAuthPasswordChangeTrackingService);\n private readonly toastService = inject(AXToastService);\n private readonly translateService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command ----\n\n async execute(): AXPCommandExecuteResultPromise<void> {\n const passwordComplexity = await this.passwordComplexityService.getLevel();\n const complexityHintKey = getPasswordComplexityHintKey(passwordComplexity);\n const complexityValidationMessageKey = getPasswordComplexityValidationMessageKey(passwordComplexity);\n const complexityValidationMessage = await this.translateService.translateAsync(complexityValidationMessageKey);\n\n const dialogTitle = await this.translateService.translateAsync(\n '@auth:profile-page.commands.change-password.dialog.title',\n );\n\n const result = await this.layoutBuilder\n .create()\n .dialog<AXPRuntimeCommandResult<void> | null>((dialog) => {\n dialog\n .setTitle(dialogTitle)\n .setSize('md')\n .setCloseButton(true)\n .setContext({\n currentPassword: '',\n newPassword: '',\n confirmPassword: '',\n })\n .content((layout) => {\n layout.flex((flex) => {\n flex\n .setDirection('column')\n .setGap('1rem')\n .formField('@auth:profile-page.commands.change-password.fields.current-password.title', (field) => {\n field.setOptions({\n hint: '@auth:profile-page.commands.change-password.fields.current-password.hint',\n hintDisplayMode: 'note',\n });\n field.path('currentPassword');\n field.passwordBox({\n revealToggle: true,\n placeholder: '@auth:profile-page.commands.change-password.fields.current-password.placeholder',\n validations: [{ rule: 'required' }],\n });\n })\n .formField('@auth:profile-page.commands.change-password.fields.new-password.title', (field) => {\n field.setOptions({ hint: complexityHintKey, hintDisplayMode: 'note' });\n field.path('newPassword');\n field.passwordBox({\n revealToggle: true,\n placeholder: '@auth:profile-page.commands.change-password.fields.new-password.placeholder',\n validations: [\n { rule: 'required' },\n {\n rule: 'password-complexity',\n options: {\n message: complexityValidationMessage,\n },\n },\n ],\n });\n })\n .formField('@auth:profile-page.commands.change-password.fields.confirm-password.title', (field) => {\n field.setOptions({\n hint: '@auth:profile-page.commands.change-password.fields.confirm-password.hint',\n hintDisplayMode: 'note',\n });\n field.path('confirmPassword');\n field.passwordBox({\n revealToggle: true,\n placeholder: '@auth:profile-page.commands.change-password.fields.confirm-password.placeholder',\n validations: [{ rule: 'required' }],\n });\n });\n });\n })\n .setActions((actions) => {\n actions.cancel('@general:actions.cancel.title');\n actions.submit('@auth:profile-page.commands.change-password.actions.submit');\n })\n .onAction(async (dialogRef) => {\n if (dialogRef.action() === 'cancel') {\n return null;\n }\n\n const form = dialogRef.context() as {\n currentPassword?: string;\n newPassword?: string;\n confirmPassword?: string;\n };\n\n const currentPassword = form.currentPassword ?? '';\n const newPassword = form.newPassword ?? '';\n const confirmPassword = form.confirmPassword ?? '';\n\n if (newPassword !== confirmPassword) {\n throw new Error('@auth:profile-page.commands.change-password.messages.mismatch');\n }\n\n if (newPassword === currentPassword) {\n throw new Error('@auth:profile-page.commands.change-password.messages.same-as-current');\n }\n\n const submitComplexity = await this.passwordComplexityService.getLevel();\n const submitValidationMessageKey = getPasswordComplexityValidationMessageKey(submitComplexity);\n\n if (!validatePasswordAgainstComplexity(newPassword, submitComplexity)) {\n throw new Error(submitValidationMessageKey);\n }\n\n dialogRef.setLoading(true);\n try {\n const serverResult = await this.commandService.execute(\n AXMSecurityManagementServerCommands.ChangeOwnPassword,\n { currentPassword, newPassword },\n );\n\n if (!serverResult?.success) {\n throw new Error(this.resolveServerErrorKey(serverResult?.message?.code));\n }\n\n const payload = runtimeCommandPayloadData(serverResult) as AXMChangeOwnPasswordResult | undefined;\n const passwordChangedAt = payload?.passwordChangedAt\n ? new Date(payload.passwordChangedAt)\n : new Date();\n const userId = this.sessionService.user?.id;\n if (userId) {\n this.passwordChangeTrackingService.recordChange(userId, passwordChangedAt);\n }\n\n const successTitle = await this.translateService.translateAsync(\n '@auth:profile-page.commands.change-password.messages.success',\n );\n this.toastService.show({ color: 'success', title: successTitle });\n dialogRef.close();\n return {\n success: true,\n kind: 'object',\n data: undefined,\n metadata: {\n refresh: false,\n [PROFILE_SECTION_INSIGHTS_PATCH_METADATA_KEY]: {\n sectionId: CHANGE_PASSWORD_SECTION_ID,\n insights: buildPasswordLastChangedInsights(passwordChangedAt),\n },\n },\n };\n } finally {\n dialogRef.setLoading(false);\n }\n });\n })\n .show();\n\n return resolveLayoutBuilderDialogResult<AXPRuntimeCommandResult<void>>(result) ?? { success: false };\n }\n\n //#endregion\n\n //#region ---- Utility Methods ----\n\n private resolveServerErrorKey(code: string | undefined): string {\n if (code && CHANGE_OWN_PASSWORD_ERROR_I18N[code]) {\n return CHANGE_OWN_PASSWORD_ERROR_I18N[code];\n }\n\n return '@auth:profile-page.commands.change-password.messages.save-failed';\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;;AA8BA;AAEA,MAAM,8BAA8B,GAA2B;AAC7D,IAAA,CAAC,mCAAmC,CAAC,WAAW,GAC9C,oEAAoE;AACtE,IAAA,CAAC,mCAAmC,CAAC,gBAAgB,GACnD,wEAAwE;AAC1E,IAAA,CAAC,mCAAmC,CAAC,aAAa,GAChD,sEAAsE;AACxE,IAAA,CAAC,mCAAmC,CAAC,YAAY,GAC/C,kEAAkE;CACrE;AAED;AAEA;AAEA;MAEa,wBAAwB,CAAA;AADrC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAA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,EAAE,0BAA0B;AACrC,gCAAA,QAAQ,EAAE,gCAAgC,CAAC,iBAAiB,CAAC;AAC9D,6BAAA;AACF,yBAAA;qBACF;gBACH;wBAAU;AACR,oBAAA,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC;gBAC7B;AACF,YAAA,CAAC,CAAC;AACN,QAAA,CAAC;AACA,aAAA,IAAI,EAAE;QAET,OAAO,gCAAgC,CAAgC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE;IACtG;;;AAMQ,IAAA,qBAAqB,CAAC,IAAwB,EAAA;AACpD,QAAA,IAAI,IAAI,IAAI,8BAA8B,CAAC,IAAI,CAAC,EAAE;AAChD,YAAA,OAAO,8BAA8B,CAAC,IAAI,CAAC;QAC7C;AAEA,QAAA,OAAO,kEAAkE;IAC3E;8GAhLW,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAxB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,wBAAwB,cADX,MAAM,EAAA,CAAA,CAAA;;2FACnB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBADpC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-auth-client-change-password.command-BqU3jYV9.mjs","sources":["../../../../libs/modules/auth/client/src/lib/commands/change-password.command.ts"],"sourcesContent":["import { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport {\n AXM_CHANGE_OWN_PASSWORD_ERROR_CODES,\n AXMSecurityManagementServerCommands,\n type AXMChangeOwnPasswordResult,\n} from '@acorex-platform/module-security-management-client/contracts';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport { AXPRuntimeCommandResult, runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';\nimport {\n AXPLayoutBuilderService,\n resolveLayoutBuilderDialogResult,\n} from '@acorex-platform/framework-client/layout/builder';\n\nimport { inject, Injectable } from '@angular/core';\nimport {\n getPasswordComplexityHintKey,\n getPasswordComplexityValidationMessageKey,\n validatePasswordAgainstComplexity,\n} from '../shared/utils/password-complexity.utils';\nimport { AXPAuthPasswordComplexityService } from '../shared/services/password-complexity.service';\nimport { AXPAuthPasswordChangeTrackingService } from '../shared/services/password-change-tracking.service';\nimport {\n CHANGE_PASSWORD_SECTION_ID,\n PROFILE_SECTION_INSIGHTS_PATCH_METADATA_KEY,\n buildPasswordLastChangedInsights,\n} from '../pages/account/profile-page/profile-password-insight.util';\n\n//#region ---- Constants ----\n\nconst CHANGE_OWN_PASSWORD_ERROR_I18N: Record<string, string> = {\n [AXM_CHANGE_OWN_PASSWORD_ERROR_CODES.NotSignedIn]:\n '@auth:profile-page.commands.change-password.messages.not-signed-in',\n [AXM_CHANGE_OWN_PASSWORD_ERROR_CODES.IncorrectCurrent]:\n '@auth:profile-page.commands.change-password.messages.incorrect-current',\n [AXM_CHANGE_OWN_PASSWORD_ERROR_CODES.SameAsCurrent]:\n '@auth:profile-page.commands.change-password.messages.same-as-current',\n [AXM_CHANGE_OWN_PASSWORD_ERROR_CODES.InvalidInput]:\n '@auth:profile-page.commands.change-password.messages.save-failed',\n};\n\n//#endregion\n\n//#region ---- Change password command ----\n\n/** Opens a dialog to change the signed-in user's password. */\n@Injectable({ providedIn: 'root' })\nexport class AXPChangePasswordCommand implements AXPCommand {\n //#region ---- Services & Dependencies ----\n\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly commandService = inject(AXPCommandService);\n private readonly sessionService = inject(AXPSessionService);\n private readonly passwordComplexityService = inject(AXPAuthPasswordComplexityService);\n private readonly passwordChangeTrackingService = inject(AXPAuthPasswordChangeTrackingService);\n private readonly toastService = inject(AXToastService);\n private readonly translateService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command ----\n\n async execute(): AXPCommandExecuteResultPromise<void> {\n const passwordComplexity = await this.passwordComplexityService.getLevel();\n const complexityHintKey = getPasswordComplexityHintKey(passwordComplexity);\n const complexityValidationMessageKey = getPasswordComplexityValidationMessageKey(passwordComplexity);\n const complexityValidationMessage = await this.translateService.translateAsync(complexityValidationMessageKey);\n\n const dialogTitle = await this.translateService.translateAsync(\n '@auth:profile-page.commands.change-password.dialog.title',\n );\n\n const result = await this.layoutBuilder\n .create()\n .dialog<AXPRuntimeCommandResult<void> | null>((dialog) => {\n dialog\n .setTitle(dialogTitle)\n .setSize('md')\n .setCloseButton(true)\n .setContext({\n currentPassword: '',\n newPassword: '',\n confirmPassword: '',\n })\n .content((layout) => {\n layout.flex((flex) => {\n flex\n .setDirection('column')\n .setGap('1rem')\n .formField('@auth:profile-page.commands.change-password.fields.current-password.title', (field) => {\n field.setOptions({\n hint: '@auth:profile-page.commands.change-password.fields.current-password.hint',\n hintDisplayMode: 'note',\n });\n field.path('currentPassword');\n field.passwordBox({\n revealToggle: true,\n placeholder: '@auth:profile-page.commands.change-password.fields.current-password.placeholder',\n validations: [{ rule: 'required' }],\n });\n })\n .formField('@auth:profile-page.commands.change-password.fields.new-password.title', (field) => {\n field.setOptions({ hint: complexityHintKey, hintDisplayMode: 'note' });\n field.path('newPassword');\n field.passwordBox({\n revealToggle: true,\n placeholder: '@auth:profile-page.commands.change-password.fields.new-password.placeholder',\n validations: [\n { rule: 'required' },\n {\n rule: 'password-complexity',\n options: {\n message: complexityValidationMessage,\n },\n },\n ],\n });\n })\n .formField('@auth:profile-page.commands.change-password.fields.confirm-password.title', (field) => {\n field.setOptions({\n hint: '@auth:profile-page.commands.change-password.fields.confirm-password.hint',\n hintDisplayMode: 'note',\n });\n field.path('confirmPassword');\n field.passwordBox({\n revealToggle: true,\n placeholder: '@auth:profile-page.commands.change-password.fields.confirm-password.placeholder',\n validations: [{ rule: 'required' }],\n });\n });\n });\n })\n .setActions((actions) => {\n actions.cancel('@general:actions.cancel.title');\n actions.submit('@auth:profile-page.commands.change-password.actions.submit');\n })\n .onAction(async (dialogRef) => {\n if (dialogRef.action() === 'cancel') {\n return null;\n }\n\n const form = dialogRef.context() as {\n currentPassword?: string;\n newPassword?: string;\n confirmPassword?: string;\n };\n\n const currentPassword = form.currentPassword ?? '';\n const newPassword = form.newPassword ?? '';\n const confirmPassword = form.confirmPassword ?? '';\n\n if (newPassword !== confirmPassword) {\n throw new Error('@auth:profile-page.commands.change-password.messages.mismatch');\n }\n\n if (newPassword === currentPassword) {\n throw new Error('@auth:profile-page.commands.change-password.messages.same-as-current');\n }\n\n const submitComplexity = await this.passwordComplexityService.getLevel();\n const submitValidationMessageKey = getPasswordComplexityValidationMessageKey(submitComplexity);\n\n if (!validatePasswordAgainstComplexity(newPassword, submitComplexity)) {\n throw new Error(submitValidationMessageKey);\n }\n\n dialogRef.setLoading(true);\n try {\n const serverResult = await this.commandService.execute(\n AXMSecurityManagementServerCommands.ChangeOwnPassword,\n { currentPassword, newPassword },\n );\n\n if (!serverResult?.success) {\n throw new Error(this.resolveServerErrorKey(serverResult?.message?.code));\n }\n\n const payload = runtimeCommandPayloadData(serverResult) as AXMChangeOwnPasswordResult | undefined;\n const passwordChangedAt = payload?.passwordChangedAt\n ? new Date(payload.passwordChangedAt)\n : new Date();\n const userId = this.sessionService.user?.id;\n if (userId) {\n this.passwordChangeTrackingService.recordChange(userId, passwordChangedAt);\n }\n\n const successTitle = await this.translateService.translateAsync(\n '@auth:profile-page.commands.change-password.messages.success',\n );\n this.toastService.show({ color: 'success', title: successTitle });\n dialogRef.close();\n return {\n success: true,\n kind: 'object',\n data: undefined,\n metadata: {\n refresh: false,\n [PROFILE_SECTION_INSIGHTS_PATCH_METADATA_KEY]: {\n sectionId: CHANGE_PASSWORD_SECTION_ID,\n insights: buildPasswordLastChangedInsights(passwordChangedAt),\n },\n },\n };\n } finally {\n dialogRef.setLoading(false);\n }\n });\n })\n .show();\n\n return resolveLayoutBuilderDialogResult<AXPRuntimeCommandResult<void>>(result) ?? { success: false };\n }\n\n //#endregion\n\n //#region ---- Utility Methods ----\n\n private resolveServerErrorKey(code: string | undefined): string {\n if (code && CHANGE_OWN_PASSWORD_ERROR_I18N[code]) {\n return CHANGE_OWN_PASSWORD_ERROR_I18N[code];\n }\n\n return '@auth:profile-page.commands.change-password.messages.save-failed';\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;;AA8BA;AAEA,MAAM,8BAA8B,GAA2B;AAC7D,IAAA,CAAC,mCAAmC,CAAC,WAAW,GAC9C,oEAAoE;AACtE,IAAA,CAAC,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;AA0KjE,IAAA;;;AApKC,IAAA,M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AAI,CAAC;QAC7C;AAEA,QAAA,OAAO,kEAAkE;IAC3E;8GAhLW,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAxB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,wBAAwB,cADX,MAAM,EAAA,CAAA,CAAA;;2FACnB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBADpC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -8,7 +8,7 @@ import { AXFileService } from '@acorex/core/file';
|
|
|
8
8
|
import * as i0 from '@angular/core';
|
|
9
9
|
import { inject, Injectable } from '@angular/core';
|
|
10
10
|
import { isNil } from 'lodash';
|
|
11
|
-
import { k as AXPUserAvatarSyncService } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-
|
|
11
|
+
import { k as AXPUserAvatarSyncService } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-CRl74b8g.mjs';
|
|
12
12
|
|
|
13
13
|
const PROFILE_PHOTO_DIALOG_PREVIEW_SIZE = {
|
|
14
14
|
small: { width: '100%', height: 'auto' },
|
|
@@ -254,4 +254,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
254
254
|
}] });
|
|
255
255
|
|
|
256
256
|
export { AXPChangePhotoCommand };
|
|
257
|
-
//# sourceMappingURL=acorex-platform-module-auth-client-change-photo.command-
|
|
257
|
+
//# sourceMappingURL=acorex-platform-module-auth-client-change-photo.command-CzO3A7OG.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-auth-client-change-photo.command-BZK_W29M.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 { extractRequestErrorInfo, platformErrorI18nKey } from '@acorex-platform/framework-client/common';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPImageEditorService } from '@acorex-platform/framework-client/layout/components';\nimport { AXPLayoutBuilderService } from '@acorex-platform/framework-client/layout/builder';\nimport { AXFileService } from '@acorex/core/file';\n\nimport { inject, Injectable } from '@angular/core';\nimport { isNil } from 'lodash';\n\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};\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 fileService = inject(AXFileService);\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\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 mode = input.mode;\n if (mode === 'upload') {\n return this.executeUploadFlow(userId);\n }\n\n return this.executeManageFlow(userId);\n }\n\n private async executeUploadFlow(userId: string): AXPCommandExecuteResultPromise<void> {\n const editedFile = await this.pickAndEditPhoto();\n if (!editedFile) {\n return { success: false };\n }\n\n return this.uploadAvatarAndNotify(userId, editedFile);\n }\n\n private async executeManageFlow(userId: string): AXPCommandExecuteResultPromise<void> {\n const previewUrl = await this.resolveDialogPreviewUrl(userId);\n if (!previewUrl) {\n return this.executeUploadFlow(userId);\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();\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 return result ?? { success: false };\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(): Promise<File | null> {\n const files = await this.fileService.choose({ accept: 'image/png, image/jpeg, image/webp' });\n const picked = files[0];\n if (!picked) {\n return null;\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 aspectRatio: '1',\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 //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;;;AA0BA,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,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC;AACnC,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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","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 { extractRequestErrorInfo, platformErrorI18nKey } from '@acorex-platform/framework-client/common';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPImageEditorService } from '@acorex-platform/framework-client/layout/components';\nimport { AXPLayoutBuilderService } from '@acorex-platform/framework-client/layout/builder';\nimport { AXFileService } from '@acorex/core/file';\n\nimport { inject, Injectable } from '@angular/core';\nimport { isNil } from 'lodash';\n\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};\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 fileService = inject(AXFileService);\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\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 mode = input.mode;\n if (mode === 'upload') {\n return this.executeUploadFlow(userId);\n }\n\n return this.executeManageFlow(userId);\n }\n\n private async executeUploadFlow(userId: string): AXPCommandExecuteResultPromise<void> {\n const editedFile = await this.pickAndEditPhoto();\n if (!editedFile) {\n return { success: false };\n }\n\n return this.uploadAvatarAndNotify(userId, editedFile);\n }\n\n private async executeManageFlow(userId: string): AXPCommandExecuteResultPromise<void> {\n const previewUrl = await this.resolveDialogPreviewUrl(userId);\n if (!previewUrl) {\n return this.executeUploadFlow(userId);\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();\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 return result ?? { success: false };\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(): Promise<File | null> {\n const files = await this.fileService.choose({ accept: 'image/png, image/jpeg, image/webp' });\n const picked = files[0];\n if (!picked) {\n return null;\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 aspectRatio: '1',\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 //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;;;AA0BA,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,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC;AACnC,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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ommandKeys = {
|
|
|
19
19
|
EditSignature: 'auth:edit-signature',
|
|
20
20
|
},
|
|
21
21
|
};
|
|
22
|
+
/** Scheduled purge of DeviceSessions idle past the InactiveSessionTermination setting. */
|
|
23
|
+
const AXM_AUTH_INACTIVE_SESSION_TERMINATION_PURGE_COMMAND_KEY = 'auth.inactive-session.terminate';
|
|
22
24
|
//#endregion
|
|
23
25
|
|
|
24
26
|
const AXPAuthMenuKeys = {};
|
|
@@ -51,6 +53,15 @@ const RootConfig = {
|
|
|
51
53
|
title: '@auth:module.title',
|
|
52
54
|
icon: 'fa-light fa-shield-keyhole',
|
|
53
55
|
},
|
|
56
|
+
/**
|
|
57
|
+
* Platform schedule: revoke DeviceSessions idle longer than
|
|
58
|
+
* {@link AXPAuthSettings.InactiveSessionTermination} (user override → tenant default).
|
|
59
|
+
* Cron every minute so the 1-minute option is testable.
|
|
60
|
+
*/
|
|
61
|
+
inactiveSessionTermination: {
|
|
62
|
+
providerKey: 'auth',
|
|
63
|
+
defaultCron: '* * * * *',
|
|
64
|
+
},
|
|
54
65
|
};
|
|
55
66
|
|
|
56
67
|
//#region ----- Auth setting keys -----
|
|
@@ -74,13 +85,61 @@ var AXPAuthSettings;
|
|
|
74
85
|
AXPAuthSettings["LockWhenIdleEnabled"] = "Auth:Setting:SessionManagement.LockWhenIdleEnabled";
|
|
75
86
|
AXPAuthSettings["LockWhenIdleMinutes"] = "Auth:Setting:SessionManagement.LockWhenIdleMinutes";
|
|
76
87
|
AXPAuthSettings["InactiveSessionTermination"] = "Auth:Setting:SessionManagement.InactiveSessionTermination";
|
|
88
|
+
AXPAuthSettings["MaxActiveDeviceSessions"] = "Auth:Setting:SessionManagement.MaxActiveDeviceSessions";
|
|
77
89
|
})(AXPAuthSettings || (AXPAuthSettings = {}));
|
|
78
90
|
const AXPAuthInactiveSessionTerminationOptions = {
|
|
91
|
+
OneMinute: 'oneMinute',
|
|
79
92
|
OneWeek: 'oneWeek',
|
|
80
93
|
OneMonth: 'oneMonth',
|
|
81
94
|
ThreeMonths: 'threeMonths',
|
|
82
95
|
SixMonths: 'sixMonths',
|
|
83
96
|
};
|
|
97
|
+
/** Shared select options for settings UI + Active Sessions modal (i18n title keys). */
|
|
98
|
+
const AXP_AUTH_INACTIVE_SESSION_TERMINATION_OPTION_DEFINITIONS = [
|
|
99
|
+
{
|
|
100
|
+
id: AXPAuthInactiveSessionTerminationOptions.OneMinute,
|
|
101
|
+
titleKey: '@auth:settings.session.terminate-old-sessions.options.one-minute',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: AXPAuthInactiveSessionTerminationOptions.OneWeek,
|
|
105
|
+
titleKey: '@auth:settings.session.terminate-old-sessions.options.one-week',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: AXPAuthInactiveSessionTerminationOptions.OneMonth,
|
|
109
|
+
titleKey: '@auth:settings.session.terminate-old-sessions.options.one-month',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: AXPAuthInactiveSessionTerminationOptions.ThreeMonths,
|
|
113
|
+
titleKey: '@auth:settings.session.terminate-old-sessions.options.three-months',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: AXPAuthInactiveSessionTerminationOptions.SixMonths,
|
|
117
|
+
titleKey: '@auth:settings.session.terminate-old-sessions.options.six-months',
|
|
118
|
+
},
|
|
119
|
+
];
|
|
120
|
+
const MS_MINUTE = 60_000;
|
|
121
|
+
const MS_DAY = 24 * 60 * MS_MINUTE;
|
|
122
|
+
/** Inactivity window for each stored termination option. */
|
|
123
|
+
const AXP_AUTH_INACTIVE_SESSION_TERMINATION_DURATION_MS = {
|
|
124
|
+
[AXPAuthInactiveSessionTerminationOptions.OneMinute]: MS_MINUTE,
|
|
125
|
+
[AXPAuthInactiveSessionTerminationOptions.OneWeek]: 7 * MS_DAY,
|
|
126
|
+
[AXPAuthInactiveSessionTerminationOptions.OneMonth]: 30 * MS_DAY,
|
|
127
|
+
[AXPAuthInactiveSessionTerminationOptions.ThreeMonths]: 90 * MS_DAY,
|
|
128
|
+
[AXPAuthInactiveSessionTerminationOptions.SixMonths]: 180 * MS_DAY,
|
|
129
|
+
};
|
|
130
|
+
const AXP_AUTH_INACTIVE_SESSION_TERMINATION_SETTING_DEFAULTS = {
|
|
131
|
+
[AXPAuthSettings.InactiveSessionTermination]: AXPAuthInactiveSessionTerminationOptions.OneMonth,
|
|
132
|
+
};
|
|
133
|
+
function isAuthInactiveSessionTerminationValue(value) {
|
|
134
|
+
return (typeof value === 'string' &&
|
|
135
|
+
Object.values(AXPAuthInactiveSessionTerminationOptions).includes(value));
|
|
136
|
+
}
|
|
137
|
+
function resolveAuthInactiveSessionTerminationDurationMs(value) {
|
|
138
|
+
if (isAuthInactiveSessionTerminationValue(value)) {
|
|
139
|
+
return AXP_AUTH_INACTIVE_SESSION_TERMINATION_DURATION_MS[value];
|
|
140
|
+
}
|
|
141
|
+
return AXP_AUTH_INACTIVE_SESSION_TERMINATION_DURATION_MS[AXP_AUTH_INACTIVE_SESSION_TERMINATION_SETTING_DEFAULTS[AXPAuthSettings.InactiveSessionTermination]];
|
|
142
|
+
}
|
|
84
143
|
/** Stored values for {@link AXPAuthSettings.SignInCredentialType}. */
|
|
85
144
|
const AXPAuthCredentialTypeOptions = {
|
|
86
145
|
UsernamePassword: 'UsernamePassword',
|
|
@@ -95,6 +154,9 @@ const AXP_AUTH_LOCKOUT_SETTING_DEFAULTS = {
|
|
|
95
154
|
[AXPAuthSettings.LockoutDuration]: 3,
|
|
96
155
|
[AXPAuthSettings.CaptchaAttemptThreshold]: 3,
|
|
97
156
|
};
|
|
157
|
+
const AXP_AUTH_MAX_ACTIVE_DEVICE_SESSIONS_SETTING_DEFAULTS = {
|
|
158
|
+
[AXPAuthSettings.MaxActiveDeviceSessions]: 0,
|
|
159
|
+
};
|
|
98
160
|
const AXP_AUTH_SIGN_IN_PAGE_SLOGAN_DEFAULT = {
|
|
99
161
|
'en-US': 'Welcome',
|
|
100
162
|
'fa-IR': 'خوش آمدید',
|
|
@@ -112,5 +174,5 @@ const AXP_AUTH_SIGN_IN_PAGE_DESCRIPTION_DEFAULT = {
|
|
|
112
174
|
* Generated bundle index. Do not edit.
|
|
113
175
|
*/
|
|
114
176
|
|
|
115
|
-
export { AXMAuthCommandKeys, AXMPermissionsKeys, AXPAdministrationPermissionKeys, AXPAuthCredentialTypeOptions, AXPAuthInactiveSessionTerminationOptions, AXPAuthMenuKeys, AXPAuthSettings, AXP_AUTH_LOCKOUT_SETTING_DEFAULTS, AXP_AUTH_SIGN_IN_PAGE_DESCRIPTION_DEFAULT, AXP_AUTH_SIGN_IN_PAGE_SLOGAN_DEFAULT, RootConfig };
|
|
177
|
+
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 };
|
|
116
178
|
//# 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 SetPinCode: 'auth:set-pin-code',\n RemovePinCode: 'auth:remove-pin-code',\n ViewLoginHistory: 'auth:view-login-history',\n EditSignature: 'auth:edit-signature',\n },\n} 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} as const;\n","import type { AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\n\n//#region ----- Auth setting keys -----\n\nexport enum AXPAuthSettings {\n TwoFactorAuth = 'Auth:Setting:Authentication.TwoFactorAuth',\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}\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/** 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_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,UAAU,EAAE,mBAAmB;AAC/B,QAAA,aAAa,EAAE,sBAAsB;AACrC,QAAA,gBAAgB,EAAE,yBAAyB;AAC3C,QAAA,aAAa,EAAE,qBAAqB;AACrC,KAAA;;AAGH;;ACvBO,MAAM,eAAe,GAAG;;ACA/B;;;AAGG;AACI,MAAM,+BAA+B,GAAG;AAC7C,IAAA,MAAM,EAAE,kCAAkC;;AAG5C;;AAEG;AACI,MAAM,kBAAkB,GAAG;AAChC,IAAA,IAAI,EAAE;QACJ,UAAU,EAAE,+BAA+B,CAAC,MAAM;AACnD,KAAA;;;ACdH,MAAM,MAAM,GAAG;AACb,IAAA,IAAI,EAAE,MAA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AAA,WAAW,EAAE,aAAa;AAC1B,IAAA,SAAS,EAAE,WAAW;;AAMxB;AACO,MAAM,4BAA4B,GAAG;AAC1C,IAAA,gBAAgB,EAAE,kBAAkB;AACpC,IAAA,qBAAqB,EAAE,uBAAuB;AAC9C,IAAA,aAAa,EAAE,eAAe;AAC9B,IAAA,cAAc,EAAE,gBAAgB;AAChC,IAAA,SAAS,EAAE,WAAW;AACtB,IAAA,UAAU,EAAE,YAAY;;AAMnB,MAAM,iCAAiC,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;;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;;ACpEA;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/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 SetPinCode: 'auth:set-pin-code',\n RemovePinCode: 'auth:remove-pin-code',\n ViewLoginHistory: 'auth:view-login-history',\n EditSignature: 'auth:edit-signature',\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 TwoFactorAuth = 'Auth:Setting:Authentication.TwoFactorAuth',\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\nexport const AXPAuthInactiveSessionTerminationOptions = {\n OneMinute: 'oneMinute',\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.OneMinute,\n titleKey: '@auth:settings.session.terminate-old-sessions.options.one-minute',\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.OneMinute]: MS_MINUTE,\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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AC;AACpC,IAAA,CAAC,eAAe,CAAC,uBAAuB,GAAG,CAAC;;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;;AC5IA;AAQA;;ACRA;;AAEG;;"}
|
package/fesm2022/acorex-platform-module-auth-client-edit-account-info.command-CD9IrimO.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-auth-client-edit-account-info.command-CD9IrimO.mjs","sources":["../../../../libs/modules/auth/client/src/lib/commands/edit-account-info.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 {RootConfig as SecurityManagementRootConfig} from '@acorex-platform/module-security-management-client/contracts'\nimport {AXMSecurityManagementUsersEntityModel} from '@acorex-platform/module-security-management-client/contracts';\nimport { AXPSessionService, AXPUserProfileIdentityService } from '@acorex-platform/framework-client/auth';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPLayoutBuilderService } from '@acorex-platform/framework-client/layout/builder';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { inject, Injectable } from '@angular/core';\nimport { defaultTo, isEmpty, isNil, trim } from 'lodash';\n\n//#region ---- Edit account info command ----\n\n/** Opens a self-service dialog for users without an employee record (display name editable; username read-only). */\n@Injectable({ providedIn: 'root' })\nexport class AXPEditAccountInfoCommand implements AXPCommand {\n //#region ---- Services & Dependencies ----\n\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly entityService = inject(AXPEntityService);\n private readonly sessionService = inject(AXPSessionService);\n private readonly identityService = inject(AXPUserProfileIdentityService);\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 userId = this.sessionService.user?.id;\n if (isNil(userId)) {\n return {\n success: false,\n message: {\n text: await this.translateService.translateAsync(\n '@auth:profile-page.commands.edit-account-info.messages.not-signed-in',\n ),\n },\n };\n }\n\n const userData = this.entityService\n .withEntity(\n SecurityManagementRootConfig.module.name,\n SecurityManagementRootConfig.entities.users.name,\n )\n .data<string, AXMSecurityManagementUsersEntityModel>();\n\n const user = await userData.byKey(userId);\n if (isNil(user)) {\n return {\n success: false,\n message: {\n text: await this.translateService.translateAsync(\n '@auth:profile-page.commands.edit-account-info.messages.user-not-found',\n ),\n },\n };\n }\n\n const dialogTitle = await this.translateService.translateAsync(\n '@auth:profile-page.commands.edit-account-info.dialog.title',\n );\n\n const result = await this.layoutBuilder\n .create()\n .dialog<AXPRuntimeCommandResult<void>>((dialog) => {\n dialog\n .setTitle(dialogTitle)\n .setSize('md')\n .setCloseButton(true)\n .setContext({\n username: defaultTo(user.username, ''),\n displayName: defaultTo(user.displayName, ''),\n })\n .content((layout) => {\n layout.flex((flex) => {\n flex\n .setDirection('column')\n .setGap('1rem')\n .formField('@general:terms.contact.username', (field) => {\n field.path('username');\n field.disabled(true);\n field.textBox({\n placeholder: '@general:terms.contact.username',\n });\n })\n .formField('@general:terms.common.display-name', (field) => {\n field.path('displayName');\n field.textBox({\n placeholder: '@general:terms.common.display-name',\n validations: [{ rule: 'required' }],\n });\n });\n });\n })\n .setActions((actions) => {\n actions.cancel('@general:actions.cancel.title');\n actions.submit('@general:actions.save.title');\n })\n .onAction(async (dialogRef) => {\n if (dialogRef.action() === 'cancel') {\n return { success: false };\n }\n\n const form = dialogRef.context() as { username?: string; displayName?: string };\n const displayName = trim(defaultTo(form.displayName, ''));\n\n if (isEmpty(displayName)) {\n await this.showError('@auth:profile-page.commands.edit-account-info.messages.required-fields');\n throw new Error('Display name is required');\n }\n\n dialogRef.setLoading(true);\n try {\n await userData.update(userId, { displayName });\n\n await this.identityService.applySessionPatch({\n title: displayName,\n });\n\n const successTitle = await this.translateService.translateAsync(\n '@auth:profile-page.commands.edit-account-info.messages.success',\n );\n this.toastService.show({ color: 'success', title: successTitle });\n dialogRef.close();\n return { success: true, kind: 'object', data: undefined };\n } finally {\n dialogRef.setLoading(false);\n }\n });\n })\n .show();\n\n return result ?? { success: false };\n }\n\n //#endregion\n\n //#region ---- Utility Methods ----\n\n private async showError(messageKey: string): Promise<void> {\n const content = await this.translateService.translateAsync(messageKey);\n const title = await this.translateService.translateAsync('@general:messages.generic.error.title');\n this.toastService.show({ color: 'danger', title, content, closeButton: true });\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":["SecurityManagementRootConfig"],"mappings":";;;;;;;;;;AAaA;AAEA;MAEa,yBAAyB,CAAA;AADtC,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,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,eAAe,GAAG,MAAM,CAAC,6BAA6B,CAAC;AACvD,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AA8HjE,IAAA;;;AAxHC,IAAA,MAAM,OAAO,GAAA;QACX,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE;AAC3C,QAAA,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE;YACjB,OAAO;AACL,gBAAA,OAAO,EAAE,KAA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AAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,yBAAyB,cADZ,MAAM,EAAA,CAAA,CAAA;;2FACnB,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBADrC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-auth-client-edit-account-info.command-CD9IrimO.mjs","sources":["../../../../libs/modules/auth/client/src/lib/commands/edit-account-info.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 {RootConfig as SecurityManagementRootConfig} from '@acorex-platform/module-security-management-client/contracts'\nimport {AXMSecurityManagementUsersEntityModel} from '@acorex-platform/module-security-management-client/contracts';\nimport { AXPSessionService, AXPUserProfileIdentityService } from '@acorex-platform/framework-client/auth';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPLayoutBuilderService } from '@acorex-platform/framework-client/layout/builder';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { inject, Injectable } from '@angular/core';\nimport { defaultTo, isEmpty, isNil, trim } from 'lodash';\n\n//#region ---- Edit account info command ----\n\n/** Opens a self-service dialog for users without an employee record (display name editable; username read-only). */\n@Injectable({ providedIn: 'root' })\nexport class AXPEditAccountInfoCommand implements AXPCommand {\n //#region ---- Services & Dependencies ----\n\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly entityService = inject(AXPEntityService);\n private readonly sessionService = inject(AXPSessionService);\n private readonly identityService = inject(AXPUserProfileIdentityService);\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 userId = this.sessionService.user?.id;\n if (isNil(userId)) {\n return {\n success: false,\n message: {\n text: await this.translateService.translateAsync(\n '@auth:profile-page.commands.edit-account-info.messages.not-signed-in',\n ),\n },\n };\n }\n\n const userData = this.entityService\n .withEntity(\n SecurityManagementRootConfig.module.name,\n SecurityManagementRootConfig.entities.users.name,\n )\n .data<string, AXMSecurityManagementUsersEntityModel>();\n\n const user = await userData.byKey(userId);\n if (isNil(user)) {\n return {\n success: false,\n message: {\n text: await this.translateService.translateAsync(\n '@auth:profile-page.commands.edit-account-info.messages.user-not-found',\n ),\n },\n };\n }\n\n const dialogTitle = await this.translateService.translateAsync(\n '@auth:profile-page.commands.edit-account-info.dialog.title',\n );\n\n const result = await this.layoutBuilder\n .create()\n .dialog<AXPRuntimeCommandResult<void>>((dialog) => {\n dialog\n .setTitle(dialogTitle)\n .setSize('md')\n .setCloseButton(true)\n .setContext({\n username: defaultTo(user.username, ''),\n displayName: defaultTo(user.displayName, ''),\n })\n .content((layout) => {\n layout.flex((flex) => {\n flex\n .setDirection('column')\n .setGap('1rem')\n .formField('@general:terms.contact.username', (field) => {\n field.path('username');\n field.disabled(true);\n field.textBox({\n placeholder: '@general:terms.contact.username',\n });\n })\n .formField('@general:terms.common.display-name', (field) => {\n field.path('displayName');\n field.textBox({\n placeholder: '@general:terms.common.display-name',\n validations: [{ rule: 'required' }],\n });\n });\n });\n })\n .setActions((actions) => {\n actions.cancel('@general:actions.cancel.title');\n actions.submit('@general:actions.save.title');\n })\n .onAction(async (dialogRef) => {\n if (dialogRef.action() === 'cancel') {\n return { success: false };\n }\n\n const form = dialogRef.context() as { username?: string; displayName?: string };\n const displayName = trim(defaultTo(form.displayName, ''));\n\n if (isEmpty(displayName)) {\n await this.showError('@auth:profile-page.commands.edit-account-info.messages.required-fields');\n throw new Error('Display name is required');\n }\n\n dialogRef.setLoading(true);\n try {\n await userData.update(userId, { displayName });\n\n await this.identityService.applySessionPatch({\n title: displayName,\n });\n\n const successTitle = await this.translateService.translateAsync(\n '@auth:profile-page.commands.edit-account-info.messages.success',\n );\n this.toastService.show({ color: 'success', title: successTitle });\n dialogRef.close();\n return { success: true, kind: 'object', data: undefined };\n } finally {\n dialogRef.setLoading(false);\n }\n });\n })\n .show();\n\n return result ?? { success: false };\n }\n\n //#endregion\n\n //#region ---- Utility Methods ----\n\n private async showError(messageKey: string): Promise<void> {\n const content = await this.translateService.translateAsync(messageKey);\n const title = await this.translateService.translateAsync('@general:messages.generic.error.title');\n this.toastService.show({ color: 'danger', title, content, closeButton: true });\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":["SecurityManagementRootConfig"],"mappings":";;;;;;;;;;AAaA;AAEA;MAEa,yBAAyB,CAAA;AADtC,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,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,eAAe,GAAG,MAAM,CAAC,6BAA6B,CAAC;AACvD,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AA8HjE,IAAA;;;AAxHC,IAAA,MAAM,OAAO,GAAA;QACX,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;oBACP,IAAI,EAAE,MAAM,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAC9C,sEAAsE,CACvE;AACF,iBAAA;aACF;QACH;AAEA,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC;AACnB,aAAA,UAAU,CACTA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;kBADrC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-auth-client-edit-signature.command-TjOLhvKL.mjs","sources":["../../../../libs/modules/auth/client/src/lib/commands/edit-signature.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 { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\n\nimport { inject, Injectable } from '@angular/core';\n\n//#region ---- Edit signature command (stub) ----\n\n/**\n * Opens the signature editor for the current user. Full flow will be added in a follow-up iteration.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXPEditSignatureCommand implements AXPCommand {\n //#region ---- Services & Dependencies ----\n\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 text = await this.translateService.translateAsync('@auth:profile-page.commands.edit-signature.coming-soon');\n this.toastService.show({ color: 'primary', title: text });\n return { success: true, kind: 'object', data: undefined };\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;AAOA;AAEA;;AAEG;MAEU,uBAAuB,CAAA;AADpC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAajE,IAAA;;;AAPC,IAAA,MAAM,OAAO,GAAA;QACX,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,wDAAwD,CAAC;AACjH,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzD,QAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;IAC3D;8GAdW,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAvB,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,uBAAuB,cADV,MAAM,EAAA,CAAA,CAAA;;2FACnB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBADnC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-auth-client-edit-signature.command-TjOLhvKL.mjs","sources":["../../../../libs/modules/auth/client/src/lib/commands/edit-signature.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 { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\n\nimport { inject, Injectable } from '@angular/core';\n\n//#region ---- Edit signature command (stub) ----\n\n/**\n * Opens the signature editor for the current user. Full flow will be added in a follow-up iteration.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXPEditSignatureCommand implements AXPCommand {\n //#region ---- Services & Dependencies ----\n\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 text = await this.translateService.translateAsync('@auth:profile-page.commands.edit-signature.coming-soon');\n this.toastService.show({ color: 'primary', title: text });\n return { success: true, kind: 'object', data: undefined };\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;AAOA;AAEA;;AAEG;MAEU,uBAAuB,CAAA;AADpC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAajE,IAAA;;;AAPC,IAAA,MAAM,OAAO,GAAA;QACX,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,wDAAwD,CAAC;AACjH,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzD,QAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;IAC3D;8GAdW,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAvB,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,uBAAuB,cADV,MAAM,EAAA,CAAA,CAAA;;2FACnB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBADnC,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-CRl74b8g.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-B1bKcSVQ.mjs.map
|