@acorex-platform/module-auth-client 0.0.15

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.
Files changed (79) hide show
  1. package/fesm2022/acorex-platform-module-auth-client-acorex-platform-module-auth-client-B7tIKOw6.mjs +3174 -0
  2. package/fesm2022/acorex-platform-module-auth-client-acorex-platform-module-auth-client-B7tIKOw6.mjs.map +1 -0
  3. package/fesm2022/acorex-platform-module-auth-client-app-chooser.component-Cm2ZagaI.mjs +67 -0
  4. package/fesm2022/acorex-platform-module-auth-client-app-chooser.component-Cm2ZagaI.mjs.map +1 -0
  5. package/fesm2022/acorex-platform-module-auth-client-blank.layout-BRGgntib.mjs +18 -0
  6. package/fesm2022/acorex-platform-module-auth-client-blank.layout-BRGgntib.mjs.map +1 -0
  7. package/fesm2022/acorex-platform-module-auth-client-change-password.command-ZyXAjUKw.mjs +168 -0
  8. package/fesm2022/acorex-platform-module-auth-client-change-password.command-ZyXAjUKw.mjs.map +1 -0
  9. package/fesm2022/acorex-platform-module-auth-client-change-photo.command-BC8lw--F.mjs +192 -0
  10. package/fesm2022/acorex-platform-module-auth-client-change-photo.command-BC8lw--F.mjs.map +1 -0
  11. package/fesm2022/acorex-platform-module-auth-client-contracts.mjs +80 -0
  12. package/fesm2022/acorex-platform-module-auth-client-contracts.mjs.map +1 -0
  13. package/fesm2022/acorex-platform-module-auth-client-edit-account-info.command-B-mVlXxg.mjs +129 -0
  14. package/fesm2022/acorex-platform-module-auth-client-edit-account-info.command-B-mVlXxg.mjs.map +1 -0
  15. package/fesm2022/acorex-platform-module-auth-client-edit-signature.command-CcTJJwAX.mjs +32 -0
  16. package/fesm2022/acorex-platform-module-auth-client-edit-signature.command-CcTJJwAX.mjs.map +1 -0
  17. package/fesm2022/acorex-platform-module-auth-client-lock-screen.command-41QnG1TQ.mjs +30 -0
  18. package/fesm2022/acorex-platform-module-auth-client-lock-screen.command-41QnG1TQ.mjs.map +1 -0
  19. package/fesm2022/acorex-platform-module-auth-client-login.module-DYtNYzF6.mjs +57 -0
  20. package/fesm2022/acorex-platform-module-auth-client-login.module-DYtNYzF6.mjs.map +1 -0
  21. package/fesm2022/acorex-platform-module-auth-client-master.layout-DpdD9kgk.mjs +24 -0
  22. package/fesm2022/acorex-platform-module-auth-client-master.layout-DpdD9kgk.mjs.map +1 -0
  23. package/fesm2022/acorex-platform-module-auth-client-menu.provider-Bz-kRip4.mjs +19 -0
  24. package/fesm2022/acorex-platform-module-auth-client-menu.provider-Bz-kRip4.mjs.map +1 -0
  25. package/fesm2022/acorex-platform-module-auth-client-oauth-callback.component-BspBH4Ul.mjs +105 -0
  26. package/fesm2022/acorex-platform-module-auth-client-oauth-callback.component-BspBH4Ul.mjs.map +1 -0
  27. package/fesm2022/acorex-platform-module-auth-client-open-sessions.command-CXSGuqYp.mjs +196 -0
  28. package/fesm2022/acorex-platform-module-auth-client-open-sessions.command-CXSGuqYp.mjs.map +1 -0
  29. package/fesm2022/acorex-platform-module-auth-client-password.component-BuqUhET7.mjs +59 -0
  30. package/fesm2022/acorex-platform-module-auth-client-password.component-BuqUhET7.mjs.map +1 -0
  31. package/fesm2022/acorex-platform-module-auth-client-password.component-Cihg82vM.mjs +529 -0
  32. package/fesm2022/acorex-platform-module-auth-client-password.component-Cihg82vM.mjs.map +1 -0
  33. package/fesm2022/acorex-platform-module-auth-client-pin-code.constants-CRsFG7fg.mjs +7 -0
  34. package/fesm2022/acorex-platform-module-auth-client-pin-code.constants-CRsFG7fg.mjs.map +1 -0
  35. package/fesm2022/acorex-platform-module-auth-client-profile-activity-chart.component-B8lBvZsA.mjs +158 -0
  36. package/fesm2022/acorex-platform-module-auth-client-profile-activity-chart.component-B8lBvZsA.mjs.map +1 -0
  37. package/fesm2022/acorex-platform-module-auth-client-profile-coming-soon.command-DBbFbzAx.mjs +31 -0
  38. package/fesm2022/acorex-platform-module-auth-client-profile-coming-soon.command-DBbFbzAx.mjs.map +1 -0
  39. package/fesm2022/acorex-platform-module-auth-client-profile-delete-account-danger-zone.component-CtJho4ab.mjs +79 -0
  40. package/fesm2022/acorex-platform-module-auth-client-profile-delete-account-danger-zone.component-CtJho4ab.mjs.map +1 -0
  41. package/fesm2022/acorex-platform-module-auth-client-profile-page-component.provider-B-Qtd4_j.mjs +27 -0
  42. package/fesm2022/acorex-platform-module-auth-client-profile-page-component.provider-B-Qtd4_j.mjs.map +1 -0
  43. package/fesm2022/acorex-platform-module-auth-client-profile-page.component-tbhf7K0V.mjs +446 -0
  44. package/fesm2022/acorex-platform-module-auth-client-profile-page.component-tbhf7K0V.mjs.map +1 -0
  45. package/fesm2022/acorex-platform-module-auth-client-register-password.component-hSJyEA6Q.mjs +145 -0
  46. package/fesm2022/acorex-platform-module-auth-client-register-password.component-hSJyEA6Q.mjs.map +1 -0
  47. package/fesm2022/acorex-platform-module-auth-client-register.module-DXm6AQpo.mjs +62 -0
  48. package/fesm2022/acorex-platform-module-auth-client-register.module-DXm6AQpo.mjs.map +1 -0
  49. package/fesm2022/acorex-platform-module-auth-client-remove-pin-code.command-zUZooOtv.mjs +91 -0
  50. package/fesm2022/acorex-platform-module-auth-client-remove-pin-code.command-zUZooOtv.mjs.map +1 -0
  51. package/fesm2022/acorex-platform-module-auth-client-result.component-DYJaB-FD.mjs +36 -0
  52. package/fesm2022/acorex-platform-module-auth-client-result.component-DYJaB-FD.mjs.map +1 -0
  53. package/fesm2022/acorex-platform-module-auth-client-routes-REjaWcqY.mjs +9 -0
  54. package/fesm2022/acorex-platform-module-auth-client-routes-REjaWcqY.mjs.map +1 -0
  55. package/fesm2022/acorex-platform-module-auth-client-session-lock-overlay.component-DqXGuIgN.mjs +346 -0
  56. package/fesm2022/acorex-platform-module-auth-client-session-lock-overlay.component-DqXGuIgN.mjs.map +1 -0
  57. package/fesm2022/acorex-platform-module-auth-client-set-pin-code.command-DXTVbrS0.mjs +33 -0
  58. package/fesm2022/acorex-platform-module-auth-client-set-pin-code.command-DXTVbrS0.mjs.map +1 -0
  59. package/fesm2022/acorex-platform-module-auth-client-set-pin-code.component-5TxB6aFi.mjs +188 -0
  60. package/fesm2022/acorex-platform-module-auth-client-set-pin-code.component-5TxB6aFi.mjs.map +1 -0
  61. package/fesm2022/acorex-platform-module-auth-client-settings.provider-n1qbs6e1.mjs +177 -0
  62. package/fesm2022/acorex-platform-module-auth-client-settings.provider-n1qbs6e1.mjs.map +1 -0
  63. package/fesm2022/acorex-platform-module-auth-client-show-profile-command-CxMz1yy-.mjs +70 -0
  64. package/fesm2022/acorex-platform-module-auth-client-show-profile-command-CxMz1yy-.mjs.map +1 -0
  65. package/fesm2022/acorex-platform-module-auth-client-signout-command-DqqrP5pk.mjs +24 -0
  66. package/fesm2022/acorex-platform-module-auth-client-signout-command-DqqrP5pk.mjs.map +1 -0
  67. package/fesm2022/acorex-platform-module-auth-client-tenant-chooser.component-ihsqCJKN.mjs +59 -0
  68. package/fesm2022/acorex-platform-module-auth-client-tenant-chooser.component-ihsqCJKN.mjs.map +1 -0
  69. package/fesm2022/acorex-platform-module-auth-client-two-factor-code.component-CiENsIEh.mjs +40 -0
  70. package/fesm2022/acorex-platform-module-auth-client-two-factor-code.component-CiENsIEh.mjs.map +1 -0
  71. package/fesm2022/acorex-platform-module-auth-client-two-factor.module-BJqdeuAz.mjs +45 -0
  72. package/fesm2022/acorex-platform-module-auth-client-two-factor.module-BJqdeuAz.mjs.map +1 -0
  73. package/fesm2022/acorex-platform-module-auth-client-view-login-history.command-Dl0os5lD.mjs +108 -0
  74. package/fesm2022/acorex-platform-module-auth-client-view-login-history.command-Dl0os5lD.mjs.map +1 -0
  75. package/fesm2022/acorex-platform-module-auth-client.mjs +2 -0
  76. package/fesm2022/acorex-platform-module-auth-client.mjs.map +1 -0
  77. package/package.json +28 -0
  78. package/types/acorex-platform-module-auth-client-contracts.d.ts +67 -0
  79. package/types/acorex-platform-module-auth-client.d.ts +390 -0
@@ -0,0 +1,188 @@
1
+ import * as i1$1 from '@acorex/components/button';
2
+ import { AXButtonModule } from '@acorex/components/button';
3
+ import * as i3 from '@acorex/components/decorators';
4
+ import { AXDecoratorModule } from '@acorex/components/decorators';
5
+ import { AXFormModule } from '@acorex/components/form';
6
+ import * as i4 from '@acorex/components/otp';
7
+ import { AXOtpComponent, AXOtpModule } from '@acorex/components/otp';
8
+ import { AXBasePageComponent } from '@acorex/components/page';
9
+ import { AXToastService } from '@acorex/components/toast';
10
+ import * as i2 from '@acorex/core/translation';
11
+ import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
12
+ import { RootConfig } from '@acorex-platform/module-security-management-client/contracts';
13
+ import { AXPSessionService } from '@acorex-platform/framework-client/auth';
14
+ import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
15
+ import * as i4$1 from '@angular/common';
16
+ import { CommonModule } from '@angular/common';
17
+ import * as i0 from '@angular/core';
18
+ import { signal, computed, viewChild, inject, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
19
+ import * as i1 from '@angular/forms';
20
+ import { FormsModule } from '@angular/forms';
21
+ import { defaultTo, isNil, get, isEmpty } from 'lodash';
22
+ import { A as AXP_AUTH_PIN_CODE_LENGTH, a as AXP_AUTH_PIN_CODE_PATTERN } from './acorex-platform-module-auth-client-pin-code.constants-CRsFG7fg.mjs';
23
+ import { f as AXPIdleLockService } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-B7tIKOw6.mjs';
24
+
25
+ //#endregion
26
+ class AXMSetPinCodeComponent extends AXBasePageComponent {
27
+ //#endregion
28
+ //#region ---- Lifecycle ----
29
+ constructor() {
30
+ super();
31
+ //#region ---- Constants ----
32
+ this.pinLength = AXP_AUTH_PIN_CODE_LENGTH;
33
+ //#endregion
34
+ //#region ---- State ----
35
+ this.step = signal('enter', ...(ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []));
36
+ this.pinInput = signal('', ...(ngDevMode ? [{ debugName: "pinInput" }] : /* istanbul ignore next */ []));
37
+ this.draftPin = signal('', ...(ngDevMode ? [{ debugName: "draftPin" }] : /* istanbul ignore next */ []));
38
+ this.hasExistingPin = signal(false, ...(ngDevMode ? [{ debugName: "hasExistingPin" }] : /* istanbul ignore next */ []));
39
+ this.isSaving = signal(false, ...(ngDevMode ? [{ debugName: "isSaving" }] : /* istanbul ignore next */ []));
40
+ this.storedPinCode = signal('', ...(ngDevMode ? [{ debugName: "storedPinCode" }] : /* istanbul ignore next */ []));
41
+ this.isAdvancing = false;
42
+ this.canProceed = computed(() => AXP_AUTH_PIN_CODE_PATTERN.test(this.pinInput()), ...(ngDevMode ? [{ debugName: "canProceed" }] : /* istanbul ignore next */ []));
43
+ //#endregion
44
+ //#region ---- View children ----
45
+ this.otpInput = viewChild(AXOtpComponent, ...(ngDevMode ? [{ debugName: "otpInput" }] : /* istanbul ignore next */ []));
46
+ //#endregion
47
+ //#region ---- Services & Dependencies ----
48
+ this.entityService = inject(AXPEntityService);
49
+ this.sessionService = inject(AXPSessionService);
50
+ this.idleLockService = inject(AXPIdleLockService);
51
+ this.toastService = inject(AXToastService);
52
+ this.translateService = inject(AXTranslationService);
53
+ void this.loadExistingPinState();
54
+ }
55
+ //#endregion
56
+ //#region ---- UI Handlers ----
57
+ onPinInputChange(value) {
58
+ this.pinInput.set(defaultTo(value, ''));
59
+ }
60
+ onPinCompleted(event) {
61
+ if (!event.isCompleted || this.isSaving() || this.isAdvancing) {
62
+ return;
63
+ }
64
+ this.pinInput.set(defaultTo(event.value, ''));
65
+ void this.onNext();
66
+ }
67
+ onBack() {
68
+ this.draftPin.set('');
69
+ this.goToStep('enter');
70
+ }
71
+ async onNext() {
72
+ if (this.isAdvancing || this.isSaving()) {
73
+ return;
74
+ }
75
+ this.isAdvancing = true;
76
+ try {
77
+ const pin = this.pinInput();
78
+ if (!AXP_AUTH_PIN_CODE_PATTERN.test(pin)) {
79
+ await this.showError('@auth:profile-page.commands.set-pin-code.messages.invalid-pin');
80
+ this.focusOtp();
81
+ return;
82
+ }
83
+ const currentStep = this.step();
84
+ if (currentStep === 'verify-current') {
85
+ if (pin !== this.storedPinCode()) {
86
+ await this.showError('@auth:profile-page.commands.set-pin-code.messages.incorrect-current');
87
+ this.resetPinInput();
88
+ return;
89
+ }
90
+ this.goToStep('enter');
91
+ return;
92
+ }
93
+ if (currentStep === 'enter') {
94
+ this.draftPin.set(pin);
95
+ this.goToStep('confirm');
96
+ return;
97
+ }
98
+ if (pin !== this.draftPin()) {
99
+ await this.showError('@auth:profile-page.commands.set-pin-code.messages.mismatch');
100
+ this.resetPinInput();
101
+ return;
102
+ }
103
+ await this.savePin(pin);
104
+ }
105
+ finally {
106
+ this.isAdvancing = false;
107
+ }
108
+ }
109
+ //#endregion
110
+ //#region ---- Private Methods ----
111
+ async loadExistingPinState() {
112
+ const userId = this.sessionService.user?.id;
113
+ if (isNil(userId)) {
114
+ return;
115
+ }
116
+ try {
117
+ const user = await this.getUserData().byKey(userId);
118
+ const pinCode = defaultTo(get(user, 'pinCode'), '');
119
+ const hasPin = !isEmpty(pinCode);
120
+ this.storedPinCode.set(pinCode);
121
+ this.hasExistingPin.set(hasPin);
122
+ this.step.set(hasPin ? 'verify-current' : 'enter');
123
+ this.focusOtp();
124
+ }
125
+ catch (error) {
126
+ console.error('Failed to load user PIN state', error);
127
+ this.step.set('enter');
128
+ this.focusOtp();
129
+ }
130
+ }
131
+ goToStep(step) {
132
+ this.step.set(step);
133
+ this.resetPinInput();
134
+ }
135
+ resetPinInput() {
136
+ this.pinInput.set('');
137
+ this.otpInput()?.reset();
138
+ this.focusOtp();
139
+ }
140
+ focusOtp() {
141
+ queueMicrotask(() => {
142
+ this.otpInput()?.focus();
143
+ });
144
+ }
145
+ async savePin(pin) {
146
+ const userId = this.sessionService.user?.id;
147
+ if (isNil(userId)) {
148
+ await this.showError('@auth:profile-page.commands.set-pin-code.messages.not-signed-in');
149
+ return;
150
+ }
151
+ this.isSaving.set(true);
152
+ try {
153
+ await this.getUserData().update(userId, { pinCode: pin });
154
+ if (this.idleLockService.canLock()) {
155
+ await this.idleLockService.notifyPinChanged();
156
+ }
157
+ const successTitle = await this.translateService.translateAsync('@auth:profile-page.commands.set-pin-code.messages.success');
158
+ this.toastService.show({ color: 'success', title: successTitle });
159
+ this.close({ success: true });
160
+ }
161
+ catch (error) {
162
+ console.error('Failed to save PIN code', error);
163
+ await this.showError('@auth:profile-page.commands.set-pin-code.messages.save-failed');
164
+ }
165
+ finally {
166
+ this.isSaving.set(false);
167
+ }
168
+ }
169
+ getUserData() {
170
+ return this.entityService
171
+ .withEntity(RootConfig.module.name, RootConfig.entities.users.name)
172
+ .data();
173
+ }
174
+ async showError(messageKey) {
175
+ const content = await this.translateService.translateAsync(messageKey);
176
+ const title = await this.translateService.translateAsync('@general:messages.generic.error.title');
177
+ this.toastService.show({ color: 'danger', title, content, closeButton: true });
178
+ }
179
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXMSetPinCodeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
180
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXMSetPinCodeComponent, isStandalone: true, selector: "axm-set-pin-code", viewQueries: [{ propertyName: "otpInput", first: true, predicate: AXOtpComponent, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<ax-content>\n <div class=\"axm-set-pin-code__content flex flex-col items-center gap-4 p-6 text-center\">\n <div class=\"axm-set-pin-code__intro flex flex-col gap-2\">\n <h2 class=\"m-0 text-base font-semibold text-on-lightest\">\n @switch (step()) {\n @case ('verify-current') {\n {{ '@auth:profile-page.commands.set-pin-code.steps.verify-current.title' | translate | async }}\n }\n @case ('enter') {\n {{ '@auth:profile-page.commands.set-pin-code.steps.enter.title' | translate | async }}\n }\n @case ('confirm') {\n {{ '@auth:profile-page.commands.set-pin-code.steps.confirm.title' | translate | async }}\n }\n }\n </h2>\n <p class=\"m-0 text-sm text-on-lighter-surface\">\n @switch (step()) {\n @case ('verify-current') {\n {{ '@auth:profile-page.commands.set-pin-code.steps.verify-current.description' | translate | async }}\n }\n @case ('enter') {\n {{ '@auth:profile-page.commands.set-pin-code.steps.enter.description' | translate | async }}\n }\n @case ('confirm') {\n {{ '@auth:profile-page.commands.set-pin-code.steps.confirm.description' | translate | async }}\n }\n }\n </p>\n </div>\n\n <div class=\"axm-set-pin-code__otp w-full max-w-xs\">\n <ax-otp\n class=\"w-full block\"\n type=\"number\"\n [length]=\"pinLength\"\n [ngModel]=\"pinInput()\"\n (ngModelChange)=\"onPinInputChange($event)\"\n (onCompleted)=\"onPinCompleted($event)\"\n ></ax-otp>\n </div>\n </div>\n</ax-content>\n\n<ax-footer>\n <ax-suffix>\n @if (step() === 'confirm') {\n <ax-button\n look=\"solid\"\n color=\"default\"\n [text]=\"'@general:actions.back.title' | translate | async\"\n [disabled]=\"isSaving()\"\n (onClick)=\"onBack()\"\n ></ax-button>\n }\n\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"\n (step() === 'confirm'\n ? '@auth:profile-page.commands.set-pin-code.actions.save'\n : '@general:actions.next.title'\n )\n | translate\n | async\n \"\n [disabled]=\"!canProceed() || isSaving()\"\n (onClick)=\"onNext()\"\n ></ax-button>\n </ax-suffix>\n</ax-footer>\n", styles: [".axm-set-pin-code__content{box-sizing:border-box}.axm-set-pin-code__intro{max-width:20rem}.axm-set-pin-code__otp{box-sizing:border-box}\n/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: AXFormModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i1$1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i3.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXOtpModule }, { kind: "component", type: i4.AXOtpComponent, selector: "ax-otp", inputs: ["state", "disabled", "readonly", "look", "name", "type", "mode", "length"], outputs: ["stateChange", "disabledChange", "lengthChange", "onCompleted"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "pipe", type: i4$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i2.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
181
+ }
182
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXMSetPinCodeComponent, decorators: [{
183
+ type: Component,
184
+ args: [{ selector: 'axm-set-pin-code', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [CommonModule, FormsModule, AXFormModule, AXButtonModule, AXDecoratorModule, AXOtpModule, AXTranslationModule], template: "<ax-content>\n <div class=\"axm-set-pin-code__content flex flex-col items-center gap-4 p-6 text-center\">\n <div class=\"axm-set-pin-code__intro flex flex-col gap-2\">\n <h2 class=\"m-0 text-base font-semibold text-on-lightest\">\n @switch (step()) {\n @case ('verify-current') {\n {{ '@auth:profile-page.commands.set-pin-code.steps.verify-current.title' | translate | async }}\n }\n @case ('enter') {\n {{ '@auth:profile-page.commands.set-pin-code.steps.enter.title' | translate | async }}\n }\n @case ('confirm') {\n {{ '@auth:profile-page.commands.set-pin-code.steps.confirm.title' | translate | async }}\n }\n }\n </h2>\n <p class=\"m-0 text-sm text-on-lighter-surface\">\n @switch (step()) {\n @case ('verify-current') {\n {{ '@auth:profile-page.commands.set-pin-code.steps.verify-current.description' | translate | async }}\n }\n @case ('enter') {\n {{ '@auth:profile-page.commands.set-pin-code.steps.enter.description' | translate | async }}\n }\n @case ('confirm') {\n {{ '@auth:profile-page.commands.set-pin-code.steps.confirm.description' | translate | async }}\n }\n }\n </p>\n </div>\n\n <div class=\"axm-set-pin-code__otp w-full max-w-xs\">\n <ax-otp\n class=\"w-full block\"\n type=\"number\"\n [length]=\"pinLength\"\n [ngModel]=\"pinInput()\"\n (ngModelChange)=\"onPinInputChange($event)\"\n (onCompleted)=\"onPinCompleted($event)\"\n ></ax-otp>\n </div>\n </div>\n</ax-content>\n\n<ax-footer>\n <ax-suffix>\n @if (step() === 'confirm') {\n <ax-button\n look=\"solid\"\n color=\"default\"\n [text]=\"'@general:actions.back.title' | translate | async\"\n [disabled]=\"isSaving()\"\n (onClick)=\"onBack()\"\n ></ax-button>\n }\n\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"\n (step() === 'confirm'\n ? '@auth:profile-page.commands.set-pin-code.actions.save'\n : '@general:actions.next.title'\n )\n | translate\n | async\n \"\n [disabled]=\"!canProceed() || isSaving()\"\n (onClick)=\"onNext()\"\n ></ax-button>\n </ax-suffix>\n</ax-footer>\n", styles: [".axm-set-pin-code__content{box-sizing:border-box}.axm-set-pin-code__intro{max-width:20rem}.axm-set-pin-code__otp{box-sizing:border-box}\n/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */\n"] }]
185
+ }], ctorParameters: () => [], propDecorators: { otpInput: [{ type: i0.ViewChild, args: [i0.forwardRef(() => AXOtpComponent), { isSignal: true }] }] } });
186
+
187
+ export { AXMSetPinCodeComponent };
188
+ //# sourceMappingURL=acorex-platform-module-auth-client-set-pin-code.component-5TxB6aFi.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-auth-client-set-pin-code.component-5TxB6aFi.mjs","sources":["../../../../libs/modules/auth/client/src/lib/pages/account/set-pin-code/set-pin-code.component.ts","../../../../libs/modules/auth/client/src/lib/pages/account/set-pin-code/set-pin-code.component.html"],"sourcesContent":["import { AXButtonModule } from '@acorex/components/button';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXFormModule } from '@acorex/components/form';\nimport { AXOtpCompletedEvent, AXOtpComponent, AXOtpModule } from '@acorex/components/otp';\nimport { AXBasePageComponent } from '@acorex/components/page';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationModule, 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 } from '@acorex-platform/framework-client/auth';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { CommonModule } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n signal,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { defaultTo, get, isEmpty, isNil } from 'lodash';\nimport { AXP_AUTH_PIN_CODE_LENGTH, AXP_AUTH_PIN_CODE_PATTERN } from '../../../shared/constants/pin-code.constants';\nimport { AXPIdleLockService } from '../../../shared/services/idle-lock.service';\n\n//#region ---- Types ----\n\ntype SetPinCodeStep = 'verify-current' | 'enter' | 'confirm';\n\n//#endregion\n\n@Component({\n selector: 'axm-set-pin-code',\n templateUrl: './set-pin-code.component.html',\n styleUrl: './set-pin-code.component.css',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [CommonModule, FormsModule, AXFormModule, AXButtonModule, AXDecoratorModule, AXOtpModule, AXTranslationModule],\n})\nexport class AXMSetPinCodeComponent extends AXBasePageComponent {\n //#region ---- Constants ----\n\n protected readonly pinLength = AXP_AUTH_PIN_CODE_LENGTH;\n\n //#endregion\n\n //#region ---- State ----\n\n protected readonly step = signal<SetPinCodeStep>('enter');\n protected readonly pinInput = signal('');\n protected readonly draftPin = signal('');\n protected readonly hasExistingPin = signal(false);\n protected readonly isSaving = signal(false);\n protected readonly storedPinCode = signal('');\n\n private isAdvancing = false;\n\n protected readonly canProceed = computed(() => AXP_AUTH_PIN_CODE_PATTERN.test(this.pinInput()));\n\n //#endregion\n\n //#region ---- View children ----\n\n private readonly otpInput = viewChild(AXOtpComponent);\n\n //#endregion\n\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly sessionService = inject(AXPSessionService);\n private readonly idleLockService = inject(AXPIdleLockService);\n private readonly toastService = inject(AXToastService);\n private readonly translateService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Lifecycle ----\n\n constructor() {\n super();\n void this.loadExistingPinState();\n }\n\n //#endregion\n\n //#region ---- UI Handlers ----\n\n protected onPinInputChange(value: string): void {\n this.pinInput.set(defaultTo(value, ''));\n }\n\n protected onPinCompleted(event: AXOtpCompletedEvent): void {\n if (!event.isCompleted || this.isSaving() || this.isAdvancing) {\n return;\n }\n\n this.pinInput.set(defaultTo(event.value, ''));\n void this.onNext();\n }\n\n protected onBack(): void {\n this.draftPin.set('');\n this.goToStep('enter');\n }\n\n protected async onNext(): Promise<void> {\n if (this.isAdvancing || this.isSaving()) {\n return;\n }\n\n this.isAdvancing = true;\n\n try {\n const pin = this.pinInput();\n\n if (!AXP_AUTH_PIN_CODE_PATTERN.test(pin)) {\n await this.showError('@auth:profile-page.commands.set-pin-code.messages.invalid-pin');\n this.focusOtp();\n return;\n }\n\n const currentStep = this.step();\n\n if (currentStep === 'verify-current') {\n if (pin !== this.storedPinCode()) {\n await this.showError('@auth:profile-page.commands.set-pin-code.messages.incorrect-current');\n this.resetPinInput();\n return;\n }\n\n this.goToStep('enter');\n return;\n }\n\n if (currentStep === 'enter') {\n this.draftPin.set(pin);\n this.goToStep('confirm');\n return;\n }\n\n if (pin !== this.draftPin()) {\n await this.showError('@auth:profile-page.commands.set-pin-code.messages.mismatch');\n this.resetPinInput();\n return;\n }\n\n await this.savePin(pin);\n } finally {\n this.isAdvancing = false;\n }\n }\n\n //#endregion\n\n //#region ---- Private Methods ----\n\n private async loadExistingPinState(): Promise<void> {\n const userId = this.sessionService.user?.id;\n if (isNil(userId)) {\n return;\n }\n\n try {\n const user = await this.getUserData().byKey(userId);\n const pinCode = defaultTo(get(user, 'pinCode'), '');\n const hasPin = !isEmpty(pinCode);\n\n this.storedPinCode.set(pinCode);\n this.hasExistingPin.set(hasPin);\n this.step.set(hasPin ? 'verify-current' : 'enter');\n this.focusOtp();\n } catch (error) {\n console.error('Failed to load user PIN state', error);\n this.step.set('enter');\n this.focusOtp();\n }\n }\n\n private goToStep(step: SetPinCodeStep): void {\n this.step.set(step);\n this.resetPinInput();\n }\n\n private resetPinInput(): void {\n this.pinInput.set('');\n this.otpInput()?.reset();\n this.focusOtp();\n }\n\n private focusOtp(): void {\n queueMicrotask(() => {\n this.otpInput()?.focus();\n });\n }\n\n private async savePin(pin: string): Promise<void> {\n const userId = this.sessionService.user?.id;\n if (isNil(userId)) {\n await this.showError('@auth:profile-page.commands.set-pin-code.messages.not-signed-in');\n return;\n }\n\n this.isSaving.set(true);\n try {\n await this.getUserData().update(userId, { pinCode: pin });\n\n if (this.idleLockService.canLock()) {\n await this.idleLockService.notifyPinChanged();\n }\n\n const successTitle = await this.translateService.translateAsync(\n '@auth:profile-page.commands.set-pin-code.messages.success',\n );\n this.toastService.show({ color: 'success', title: successTitle });\n this.close({ success: true });\n } catch (error) {\n console.error('Failed to save PIN code', error);\n await this.showError('@auth:profile-page.commands.set-pin-code.messages.save-failed');\n } finally {\n this.isSaving.set(false);\n }\n }\n\n private getUserData() {\n return this.entityService\n .withEntity(SecurityManagementRootConfig.module.name, SecurityManagementRootConfig.entities.users.name)\n .data<string, AXMSecurityManagementUsersEntityModel>();\n }\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","<ax-content>\n <div class=\"axm-set-pin-code__content flex flex-col items-center gap-4 p-6 text-center\">\n <div class=\"axm-set-pin-code__intro flex flex-col gap-2\">\n <h2 class=\"m-0 text-base font-semibold text-on-lightest\">\n @switch (step()) {\n @case ('verify-current') {\n {{ '@auth:profile-page.commands.set-pin-code.steps.verify-current.title' | translate | async }}\n }\n @case ('enter') {\n {{ '@auth:profile-page.commands.set-pin-code.steps.enter.title' | translate | async }}\n }\n @case ('confirm') {\n {{ '@auth:profile-page.commands.set-pin-code.steps.confirm.title' | translate | async }}\n }\n }\n </h2>\n <p class=\"m-0 text-sm text-on-lighter-surface\">\n @switch (step()) {\n @case ('verify-current') {\n {{ '@auth:profile-page.commands.set-pin-code.steps.verify-current.description' | translate | async }}\n }\n @case ('enter') {\n {{ '@auth:profile-page.commands.set-pin-code.steps.enter.description' | translate | async }}\n }\n @case ('confirm') {\n {{ '@auth:profile-page.commands.set-pin-code.steps.confirm.description' | translate | async }}\n }\n }\n </p>\n </div>\n\n <div class=\"axm-set-pin-code__otp w-full max-w-xs\">\n <ax-otp\n class=\"w-full block\"\n type=\"number\"\n [length]=\"pinLength\"\n [ngModel]=\"pinInput()\"\n (ngModelChange)=\"onPinInputChange($event)\"\n (onCompleted)=\"onPinCompleted($event)\"\n ></ax-otp>\n </div>\n </div>\n</ax-content>\n\n<ax-footer>\n <ax-suffix>\n @if (step() === 'confirm') {\n <ax-button\n look=\"solid\"\n color=\"default\"\n [text]=\"'@general:actions.back.title' | translate | async\"\n [disabled]=\"isSaving()\"\n (onClick)=\"onBack()\"\n ></ax-button>\n }\n\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"\n (step() === 'confirm'\n ? '@auth:profile-page.commands.set-pin-code.actions.save'\n : '@general:actions.next.title'\n )\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A,EAAA,QAAA,EAAA,8IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAE,WAAW,kQAAE,mBAAmB,EAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAAC,IAAA,CAAA,SAAA,EAAA,IAAA,EAAA,OAAA,EAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAAC,EAAA,CAAA,gBAAA,EAAA,IAAA,EAAA,WAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA,CAAA;;2FAE3G,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBARlC,SAAS;+BACE,kBAAkB,EAAA,eAAA,EAGX,uBAAuB,CAAC,MAAM,iBAChC,iBAAiB,CAAC,IAAI,EAAA,OAAA,EAC5B,CAAC,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,WAAW,EAAE,mBAAmB,CAAC,EAAA,QAAA,EAAA,i2EAAA,EAAA,MAAA,EAAA,CAAA,8MAAA,CAAA,EAAA;oHA0BjF,cAAc,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;;;"}
@@ -0,0 +1,177 @@
1
+ import { AXPWidgetsCatalog } from '@acorex-platform/framework-shared/core';
2
+ import { AXPAuthSettings, AXPAuthInactiveSessionTerminationOptions } from '@acorex-platform/module-auth-client/contracts';
3
+
4
+ const I18N = '@auth:settings';
5
+ class AXMSettingProvider {
6
+ async provide(context) {
7
+ context
8
+ .addGroup('security-settings', `${I18N}.nav-title`, `${I18N}.description`, 'fa-light fa-lock', `${I18N}.title`, 95)
9
+ // Authentication Section - Tenant Level
10
+ .addSection('authentication', `${I18N}.authentication.title`, `${I18N}.authentication.description`)
11
+ .addSetting({
12
+ key: AXPAuthSettings.TwoFactorAuth,
13
+ title: `${I18N}.authentication.two-factor.title`,
14
+ scope: 'T',
15
+ overridableAt: [],
16
+ isInherited: true,
17
+ defaultValue: false,
18
+ widget: {
19
+ type: AXPWidgetsCatalog.toggle,
20
+ },
21
+ description: `${I18N}.authentication.two-factor.description`,
22
+ })
23
+ .addSetting({
24
+ key: AXPAuthSettings.PasswordComplexity,
25
+ title: `${I18N}.authentication.password.title`,
26
+ scope: 'T',
27
+ overridableAt: [],
28
+ isInherited: true,
29
+ defaultValue: 'Medium',
30
+ widget: {
31
+ type: AXPWidgetsCatalog.select,
32
+ options: {
33
+ valueField: 'value',
34
+ textField: 'text',
35
+ dataSource: [
36
+ {
37
+ text: `${I18N}.authentication.password.options.low`,
38
+ value: 'Low',
39
+ },
40
+ {
41
+ text: `${I18N}.authentication.password.options.medium`,
42
+ value: 'Medium',
43
+ },
44
+ {
45
+ text: `${I18N}.authentication.password.options.high`,
46
+ value: 'High',
47
+ },
48
+ ],
49
+ },
50
+ },
51
+ description: `${I18N}.authentication.password.description`,
52
+ })
53
+ .addSetting({
54
+ key: AXPAuthSettings.PasswordExpiryDays,
55
+ title: `${I18N}.authentication.password-expiry.title`,
56
+ scope: 'T',
57
+ overridableAt: [],
58
+ isInherited: true,
59
+ defaultValue: 90,
60
+ widget: {
61
+ type: AXPWidgetsCatalog.number,
62
+ options: {
63
+ minValue: 30,
64
+ maxValue: 365,
65
+ step: 1,
66
+ },
67
+ },
68
+ description: `${I18N}.authentication.password-expiry.description`,
69
+ })
70
+ .addSetting({
71
+ key: AXPAuthSettings.MaxLoginAttempts,
72
+ title: `${I18N}.authentication.max-attempts.title`,
73
+ scope: 'T',
74
+ overridableAt: [],
75
+ isInherited: true,
76
+ defaultValue: 5,
77
+ widget: {
78
+ type: AXPWidgetsCatalog.number,
79
+ options: {
80
+ minValue: 3,
81
+ maxValue: 10,
82
+ step: 1,
83
+ },
84
+ },
85
+ description: `${I18N}.authentication.max-attempts.description`,
86
+ })
87
+ .addSetting({
88
+ key: AXPAuthSettings.LockoutDuration,
89
+ title: `${I18N}.authentication.lockout.title`,
90
+ scope: 'T',
91
+ overridableAt: [],
92
+ isInherited: true,
93
+ defaultValue: 15,
94
+ widget: {
95
+ type: AXPWidgetsCatalog.number,
96
+ options: {
97
+ minValue: 5,
98
+ maxValue: 60,
99
+ step: 5,
100
+ },
101
+ },
102
+ description: `${I18N}.authentication.lockout.description`,
103
+ })
104
+ .endSection()
105
+ // Auto-Lock — idle lock screen + terminate old sessions
106
+ .addSection('session-management', `${I18N}.session.title`, `${I18N}.session.description`)
107
+ .addSetting({
108
+ key: AXPAuthSettings.LockWhenIdleEnabled,
109
+ title: `${I18N}.session.lock-when-idle.title`,
110
+ scope: 'U',
111
+ overridableAt: [],
112
+ isInherited: true,
113
+ defaultValue: true,
114
+ widget: {
115
+ type: AXPWidgetsCatalog.toggle,
116
+ },
117
+ description: `${I18N}.session.lock-when-idle.description`,
118
+ })
119
+ .addSetting({
120
+ key: AXPAuthSettings.LockWhenIdleMinutes,
121
+ title: `${I18N}.session.lock-when-idle-minutes.title`,
122
+ scope: 'U',
123
+ overridableAt: [],
124
+ isInherited: true,
125
+ defaultValue: 15,
126
+ widget: {
127
+ type: AXPWidgetsCatalog.number,
128
+ options: {
129
+ minValue: 1,
130
+ maxValue: 60,
131
+ step: 1,
132
+ visibility: `{{ context.eval('${AXPAuthSettings.LockWhenIdleEnabled}') }}`,
133
+ },
134
+ },
135
+ description: `${I18N}.session.lock-when-idle-minutes.description`,
136
+ })
137
+ .addSetting({
138
+ key: AXPAuthSettings.InactiveSessionTermination,
139
+ title: `${I18N}.session.terminate-old-sessions.title`,
140
+ description: `${I18N}.session.terminate-old-sessions.description`,
141
+ scope: 'U',
142
+ overridableAt: [],
143
+ isInherited: false,
144
+ defaultValue: AXPAuthInactiveSessionTerminationOptions.OneMonth,
145
+ widget: {
146
+ type: AXPWidgetsCatalog.select,
147
+ options: {
148
+ valueField: 'id',
149
+ textField: 'title',
150
+ dataSource: [
151
+ {
152
+ id: AXPAuthInactiveSessionTerminationOptions.OneWeek,
153
+ title: `${I18N}.session.terminate-old-sessions.options.one-week`,
154
+ },
155
+ {
156
+ id: AXPAuthInactiveSessionTerminationOptions.OneMonth,
157
+ title: `${I18N}.session.terminate-old-sessions.options.one-month`,
158
+ },
159
+ {
160
+ id: AXPAuthInactiveSessionTerminationOptions.ThreeMonths,
161
+ title: `${I18N}.session.terminate-old-sessions.options.three-months`,
162
+ },
163
+ {
164
+ id: AXPAuthInactiveSessionTerminationOptions.SixMonths,
165
+ title: `${I18N}.session.terminate-old-sessions.options.six-months`,
166
+ },
167
+ ],
168
+ },
169
+ },
170
+ })
171
+ .endSection()
172
+ .endGroup();
173
+ }
174
+ }
175
+
176
+ export { AXMSettingProvider };
177
+ //# sourceMappingURL=acorex-platform-module-auth-client-settings.provider-n1qbs6e1.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-auth-client-settings.provider-n1qbs6e1.mjs","sources":["../../../../libs/modules/auth/client/src/lib/settings.provider.ts"],"sourcesContent":["import {\n AXPSettingDefinitionProvider,\n AXPSettingDefinitionProviderContext,\n} from '@acorex-platform/framework-client/common';\nimport { AXPWidgetsCatalog } from '@acorex-platform/framework-shared/core';\nimport { AXPAuthInactiveSessionTerminationOptions, AXPAuthSettings } from '@acorex-platform/module-auth-client/contracts';\n\nconst I18N = '@auth:settings';\n\nexport class AXMSettingProvider implements AXPSettingDefinitionProvider {\n async provide(context: AXPSettingDefinitionProviderContext): Promise<void> {\n context\n .addGroup(\n 'security-settings',\n `${I18N}.nav-title`,\n `${I18N}.description`,\n 'fa-light fa-lock',\n `${I18N}.title`,\n 95,\n )\n // Authentication Section - Tenant Level\n .addSection('authentication', `${I18N}.authentication.title`, `${I18N}.authentication.description`)\n .addSetting({\n key: AXPAuthSettings.TwoFactorAuth,\n title: `${I18N}.authentication.two-factor.title`,\n scope: 'T',\n overridableAt: [],\n isInherited: true,\n defaultValue: false,\n widget: {\n type: AXPWidgetsCatalog.toggle,\n },\n description: `${I18N}.authentication.two-factor.description`,\n })\n .addSetting({\n key: AXPAuthSettings.PasswordComplexity,\n title: `${I18N}.authentication.password.title`,\n scope: 'T',\n overridableAt: [],\n isInherited: true,\n defaultValue: 'Medium',\n widget: {\n type: AXPWidgetsCatalog.select,\n options: {\n valueField: 'value',\n textField: 'text',\n dataSource: [\n {\n text: `${I18N}.authentication.password.options.low`,\n value: 'Low',\n },\n {\n text: `${I18N}.authentication.password.options.medium`,\n value: 'Medium',\n },\n {\n text: `${I18N}.authentication.password.options.high`,\n value: 'High',\n },\n ],\n },\n },\n description: `${I18N}.authentication.password.description`,\n })\n .addSetting({\n key: AXPAuthSettings.PasswordExpiryDays,\n title: `${I18N}.authentication.password-expiry.title`,\n scope: 'T',\n overridableAt: [],\n isInherited: true,\n defaultValue: 90,\n widget: {\n type: AXPWidgetsCatalog.number,\n options: {\n minValue: 30,\n maxValue: 365,\n step: 1,\n },\n },\n description: `${I18N}.authentication.password-expiry.description`,\n })\n .addSetting({\n key: AXPAuthSettings.MaxLoginAttempts,\n title: `${I18N}.authentication.max-attempts.title`,\n scope: 'T',\n overridableAt: [],\n isInherited: true,\n defaultValue: 5,\n widget: {\n type: AXPWidgetsCatalog.number,\n options: {\n minValue: 3,\n maxValue: 10,\n step: 1,\n },\n },\n description: `${I18N}.authentication.max-attempts.description`,\n })\n .addSetting({\n key: AXPAuthSettings.LockoutDuration,\n title: `${I18N}.authentication.lockout.title`,\n scope: 'T',\n overridableAt: [],\n isInherited: true,\n defaultValue: 15,\n widget: {\n type: AXPWidgetsCatalog.number,\n options: {\n minValue: 5,\n maxValue: 60,\n step: 5,\n },\n },\n description: `${I18N}.authentication.lockout.description`,\n })\n .endSection()\n\n // Auto-Lock — idle lock screen + terminate old sessions\n .addSection('session-management', `${I18N}.session.title`, `${I18N}.session.description`)\n .addSetting({\n key: AXPAuthSettings.LockWhenIdleEnabled,\n title: `${I18N}.session.lock-when-idle.title`,\n scope: 'U',\n overridableAt: [],\n isInherited: true,\n defaultValue: true,\n widget: {\n type: AXPWidgetsCatalog.toggle,\n },\n description: `${I18N}.session.lock-when-idle.description`,\n })\n .addSetting({\n key: AXPAuthSettings.LockWhenIdleMinutes,\n title: `${I18N}.session.lock-when-idle-minutes.title`,\n scope: 'U',\n overridableAt: [],\n isInherited: true,\n defaultValue: 15,\n widget: {\n type: AXPWidgetsCatalog.number,\n options: {\n minValue: 1,\n maxValue: 60,\n step: 1,\n visibility: `{{ context.eval('${AXPAuthSettings.LockWhenIdleEnabled}') }}`,\n },\n },\n description: `${I18N}.session.lock-when-idle-minutes.description`,\n })\n .addSetting({\n key: AXPAuthSettings.InactiveSessionTermination,\n title: `${I18N}.session.terminate-old-sessions.title`,\n description: `${I18N}.session.terminate-old-sessions.description`,\n scope: 'U',\n overridableAt: [],\n isInherited: false,\n defaultValue: AXPAuthInactiveSessionTerminationOptions.OneMonth,\n widget: {\n type: AXPWidgetsCatalog.select,\n options: {\n valueField: 'id',\n textField: 'title',\n dataSource: [\n {\n id: AXPAuthInactiveSessionTerminationOptions.OneWeek,\n title: `${I18N}.session.terminate-old-sessions.options.one-week`,\n },\n {\n id: AXPAuthInactiveSessionTerminationOptions.OneMonth,\n title: `${I18N}.session.terminate-old-sessions.options.one-month`,\n },\n {\n id: AXPAuthInactiveSessionTerminationOptions.ThreeMonths,\n title: `${I18N}.session.terminate-old-sessions.options.three-months`,\n },\n {\n id: AXPAuthInactiveSessionTerminationOptions.SixMonths,\n title: `${I18N}.session.terminate-old-sessions.options.six-months`,\n },\n ],\n },\n },\n })\n .endSection()\n .endGroup();\n }\n}\n"],"names":[],"mappings":";;;AAOA,MAAM,IAAI,GAAG,gBAAgB;MAEhB,kBAAkB,CAAA;IAC7B,MAAM,OAAO,CAAC,OAA4C,EAAA;QACxD;AACG,aAAA,QAAQ,CACP,mBAAmB,EACnB,GAAG,IAAI,CAAA,UAAA,CAAY,EACnB,CAAA,EAAG,IAAI,CAAA,YAA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AAI,CAAA,kDAAA,CAAoD;AACnE,yBAAA;AACF,qBAAA;AACF,iBAAA;AACF,aAAA;SACF;AACA,aAAA,UAAU;AACV,aAAA,QAAQ,EAAE;IACf;AACD;;;;"}
@@ -0,0 +1,70 @@
1
+ import { AXPSessionService } from '@acorex-platform/framework-client/auth';
2
+ import { AXPEntityDefinitionRegistryService } from '@acorex-platform/framework-client/layout/entity';
3
+ import * as i0 from '@angular/core';
4
+ import { inject, Injectable } from '@angular/core';
5
+ import { Router } from '@angular/router';
6
+
7
+ class AXPShowProfileCommand {
8
+ constructor() {
9
+ this.entityService = inject(AXPEntityDefinitionRegistryService);
10
+ this.sessionService = inject(AXPSessionService);
11
+ this.router = inject(Router);
12
+ }
13
+ async execute(input) {
14
+ try {
15
+ const user = this.sessionService.user;
16
+ const application = this.sessionService.application;
17
+ const entity = await this.entityService.resolve('HumanCapitalManagement', 'Employee');
18
+ const listQuery = entity.queries?.list?.execute;
19
+ const result = await listQuery({
20
+ filter: {
21
+ field: 'userId',
22
+ operator: {
23
+ type: 'equal',
24
+ },
25
+ value: user?.id,
26
+ },
27
+ take: 1,
28
+ skip: 0,
29
+ });
30
+ const employeeId = result.items[0]?.id;
31
+ if (employeeId) {
32
+ this.router.navigate([`/${application?.name}/m/HumanCapitalManagement/e/Employee`, employeeId, 'view']);
33
+ return {
34
+ success: true,
35
+ data: {
36
+ employeeId,
37
+ },
38
+ };
39
+ }
40
+ else {
41
+ return {
42
+ success: false,
43
+ message: {
44
+ text: 'Employee not found',
45
+ },
46
+ };
47
+ }
48
+ }
49
+ catch (error) {
50
+ console.error(error);
51
+ return {
52
+ success: false,
53
+ message: {
54
+ text: error instanceof Error ? error.message : 'Failed to open profile',
55
+ },
56
+ };
57
+ }
58
+ }
59
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPShowProfileCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
60
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPShowProfileCommand, providedIn: 'root' }); }
61
+ }
62
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPShowProfileCommand, decorators: [{
63
+ type: Injectable,
64
+ args: [{
65
+ providedIn: 'root',
66
+ }]
67
+ }] });
68
+
69
+ export { AXPShowProfileCommand };
70
+ //# sourceMappingURL=acorex-platform-module-auth-client-show-profile-command-CxMz1yy-.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-auth-client-show-profile-command-CxMz1yy-.mjs","sources":["../../../../libs/modules/auth/client/src/lib/commands/show-profile-command.ts"],"sourcesContent":["import { AXPCommand } from '@acorex-platform/framework-shared/runtime';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPExecuteCommandResult } from '@acorex-platform/framework-shared/core';\n\nimport { AXPEntityDefinitionRegistryService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { inject, Injectable } from '@angular/core';\nimport { Router } from '@angular/router';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPShowProfileCommand implements AXPCommand {\n private readonly entityService = inject(AXPEntityDefinitionRegistryService);\n private readonly sessionService = inject(AXPSessionService);\n private readonly router = inject(Router);\n\n async execute(input: any): Promise<AXPExecuteCommandResult<any>> {\n try {\n const user = this.sessionService.user;\n const application = this.sessionService.application;\n const entity = await this.entityService.resolve('HumanCapitalManagement', 'Employee');\n const listQuery = entity.queries?.list?.execute as Function;\n const result = await listQuery({\n filter: {\n field: 'userId',\n operator: {\n type: 'equal',\n },\n value: user?.id,\n },\n take: 1,\n skip: 0,\n });\n const employeeId = result.items[0]?.id;\n if (employeeId) {\n this.router.navigate([`/${application?.name}/m/HumanCapitalManagement/e/Employee`, employeeId, 'view']);\n return {\n success: true,\n data: {\n employeeId,\n },\n };\n } else {\n return {\n success: false,\n message: {\n text: 'Employee not found',\n },\n };\n }\n } catch (error) {\n console.error(error);\n return {\n success: false,\n message: {\n text: error instanceof Error ? error.message : 'Failed to open profile',\n },\n };\n }\n }\n}\n"],"names":[],"mappings":";;;;;;MAYa,qBAAqB,CAAA;AAHlC,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,kCAAkC,CAAC;AAC1D,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AA8CzC,IAAA;IA5CC,MAAM,OAAO,CAAC,KAAU,EAAA;AACtB,QAAA,IAAI;AACF,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI;AACrC,YAAA,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW;AACnD,YAAA,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,wBAAwB,EAAE,UAAU,CAAC;YACrF,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,OAAmB;AAC3D,YAAA,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC;AAC7B,gBAAA,MAAM,EAAE;AACN,oBAAA,KAAK,EAAE,QAAQ;AACf,oBAAA,QAAQ,EAAE;AACR,wBAAA,IAAI,EAAE,OAAO;AACd,qBAAA;oBACD,KAAK,EAAE,IAAI,EAAE,EAAE;AAChB,iBAAA;AACD,gBAAA,IAAI,EAAE,CAAC;AACP,gBAAA,IAAI,EAAE,CAAC;AACR,aAAA,CAAC;YACF,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YACtC,IAAI,UAAU,EAAE;AACd,gBAAA,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAA,CAAA,EAAI,WAAW,EAAE,IAAI,sCAAsC,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;gBACvG,OAAO;AACL,oBAAA,OAAO,EAAE,IAAI;AACb,oBAAA,IAAI,EAAE;wBACJ,UAAU;AACX,qBAAA;iBACF;YACH;iBAAO;gBACL,OAAO;AACL,oBAAA,OAAO,EAAE,KAAK;AACd,oBAAA,OAAO,EAAE;AACP,wBAAA,IAAI,EAAE,oBAAoB;AAC3B,qBAAA;iBACF;YACH;QACF;QAAE,OAAO,KAAK,EAAE;AACd,YAAA,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;YACpB,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE;AACP,oBAAA,IAAI,EAAE,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,wBAAwB;AACxE,iBAAA;aACF;QACH;IACF;8GAhDW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAArB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,cAFpB,MAAM,EAAA,CAAA,CAAA;;2FAEP,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAHjC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
@@ -0,0 +1,24 @@
1
+ import { AXPSessionService } from '@acorex-platform/framework-client/auth';
2
+ import * as i0 from '@angular/core';
3
+ import { inject, Injectable } from '@angular/core';
4
+
5
+ class AXPSignoutCommand {
6
+ constructor() {
7
+ this.sessionService = inject(AXPSessionService);
8
+ }
9
+ async execute() {
10
+ await this.sessionService.signout();
11
+ return { success: true };
12
+ }
13
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPSignoutCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
14
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPSignoutCommand, providedIn: 'root' }); }
15
+ }
16
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPSignoutCommand, decorators: [{
17
+ type: Injectable,
18
+ args: [{
19
+ providedIn: 'root',
20
+ }]
21
+ }] });
22
+
23
+ export { AXPSignoutCommand };
24
+ //# sourceMappingURL=acorex-platform-module-auth-client-signout-command-DqqrP5pk.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-auth-client-signout-command-DqqrP5pk.mjs","sources":["../../../../libs/modules/auth/client/src/lib/commands/signout-command.ts"],"sourcesContent":["import { AXPCommand } from '@acorex-platform/framework-shared/runtime';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPExecuteCommandResult } from '@acorex-platform/framework-shared/core';\n\nimport { inject, Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXPSignoutCommand implements AXPCommand {\n private readonly sessionService = inject(AXPSessionService);\n\n async execute(): Promise<AXPExecuteCommandResult<void>> {\n await this.sessionService.signout();\n return { success: true };\n }\n}\n"],"names":[],"mappings":";;;;MASa,iBAAiB,CAAA;AAH9B,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAM5D,IAAA;AAJC,IAAA,MAAM,OAAO,GAAA;AACX,QAAA,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;AACnC,QAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;IAC1B;8GANW,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAjB,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,iBAAiB,cAFhB,MAAM,EAAA,CAAA,CAAA;;2FAEP,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAH7B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;;;"}
@@ -0,0 +1,59 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, ViewEncapsulation, Component } from '@angular/core';
3
+ import * as i1 from '@acorex/components/avatar';
4
+ import { AXAvatarModule } from '@acorex/components/avatar';
5
+ import { AXButtonModule } from '@acorex/components/button';
6
+ import { AXCheckBoxModule } from '@acorex/components/check-box';
7
+ import { AXDecoratorModule } from '@acorex/components/decorators';
8
+ import { AXFormModule } from '@acorex/components/form';
9
+ import { AXImageModule } from '@acorex/components/image';
10
+ import { AXLabelModule } from '@acorex/components/label';
11
+ import { AXLoadingModule } from '@acorex/components/loading';
12
+ import { AXTextBoxModule } from '@acorex/components/text-box';
13
+ import * as i2 from '@acorex/core/translation';
14
+ import { AXTranslationModule } from '@acorex/core/translation';
15
+ import { AXPSessionService } from '@acorex-platform/framework-client/auth';
16
+ import { AXP_PLATFORM_CONFIG_TOKEN } from '@acorex-platform/framework-client/common';
17
+ import { AXPLogoComponent } from '@acorex-platform/framework-client/core';
18
+ import { AXPUserAvatarComponent } from '@acorex-platform/framework-client/layout/components';
19
+ import * as i4 from '@angular/common';
20
+ import { CommonModule } from '@angular/common';
21
+ import { Router } from '@angular/router';
22
+ import { q as AXPTenantChooserListComponent } from './acorex-platform-module-auth-client-acorex-platform-module-auth-client-B7tIKOw6.mjs';
23
+
24
+ class AXPAuthTenantChooserComponent {
25
+ constructor() {
26
+ this.router = inject(Router);
27
+ this.platformConfig = inject(AXP_PLATFORM_CONFIG_TOKEN);
28
+ this.sessionService = inject(AXPSessionService);
29
+ this.user = this.sessionService.user;
30
+ }
31
+ async handleSignout() {
32
+ await this.sessionService.signout();
33
+ this.router.navigate(['/auth/login']);
34
+ }
35
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPAuthTenantChooserComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
36
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXPAuthTenantChooserComponent, isStandalone: true, selector: "axp-auth-tenant-chooser", ngImport: i0, template: "<main *translate=\"let t\"\n class=\"w-full space-y-10 h-[100vh] flex flex-col items-center justify-center bg-lightest md:bg-default\">\n <section>\n <axp-logo logoKey=\"platform\" appearance=\"onLight\" format=\"full\" [size]=\"160\" [attr.alt]=\"platformConfig.title\"\n class=\"w-36 mx-auto text-2xl font-bold\"></axp-logo>\n </section>\n <section class=\"flex justify-center\">\n <div\n class=\"flex gap-2 justify-center text-center flex-col items-center border rounded-lg shadow-lg p-6 lg:w-[45vw] xl:w-[25vw] w-[90vw]\">\n <ax-avatar class=\"rounded-full\" [size]=\"72\">\n @if (user?.avatar) {\n <!-- <ax-image [src]=\"user?.avatar\"></ax-image> -->\n <axp-user-avatar [size]=\"72\" [userId]=\"user?.id!\"></axp-user-avatar>\n }\n </ax-avatar>\n <h2 class=\"md:text-lg font-medium\">{{ '@auth:welcome.message' | translate | async }}, {{ user?.title }}</h2>\n <p class=\"text-neutral-500 text-sm md:text-base font-medium\">\n {{ '@auth:tenant-chooser.description' | translate | async }}\n </p>\n <div class=\"mt-3 w-full\">\n <axp-tenant-chooser-list></axp-tenant-chooser-list>\n </div>\n </div>\n </section>\n <section>\n <p class=\"text-neutral-400 text-sm\">\n {{ '@auth:tenant-chooser.footer' | translate | async }}\n <a (click)=\"handleSignout()\" class=\"text-primary cursor-pointer hover:underline font-medium\">\n {{ '@auth:backLogin' | translate | async }}\n </a>\n </p>\n </section>\n</main>", styles: [":host{display:contents}.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.2 | 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: AXAvatarModule }, { kind: "component", type: i1.AXAvatarComponent, selector: "ax-avatar", inputs: ["color", "size", "shape", "look"], outputs: ["sizeChange"] }, { 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: AXTranslationModule }, { kind: "directive", type: i2.AXTranslatorDirective, selector: "[translate]" }, { kind: "component", type: AXPUserAvatarComponent, selector: "axp-user-avatar", inputs: ["size", "userId"] }, { kind: "component", type: AXPTenantChooserListComponent, selector: "axp-tenant-chooser-list", inputs: ["simple"], outputs: ["tenantChosen"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }, { kind: "pipe", type: i2.AXTranslatorPipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None }); }
37
+ }
38
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPAuthTenantChooserComponent, decorators: [{
39
+ type: Component,
40
+ args: [{ selector: 'axp-auth-tenant-chooser', imports: [
41
+ CommonModule,
42
+ AXFormModule,
43
+ AXTextBoxModule,
44
+ AXButtonModule,
45
+ AXLabelModule,
46
+ AXCheckBoxModule,
47
+ AXAvatarModule,
48
+ AXImageModule,
49
+ AXDecoratorModule,
50
+ AXPLogoComponent,
51
+ AXLoadingModule,
52
+ AXTranslationModule,
53
+ AXPUserAvatarComponent,
54
+ AXPTenantChooserListComponent,
55
+ ], encapsulation: ViewEncapsulation.None, template: "<main *translate=\"let t\"\n class=\"w-full space-y-10 h-[100vh] flex flex-col items-center justify-center bg-lightest md:bg-default\">\n <section>\n <axp-logo logoKey=\"platform\" appearance=\"onLight\" format=\"full\" [size]=\"160\" [attr.alt]=\"platformConfig.title\"\n class=\"w-36 mx-auto text-2xl font-bold\"></axp-logo>\n </section>\n <section class=\"flex justify-center\">\n <div\n class=\"flex gap-2 justify-center text-center flex-col items-center border rounded-lg shadow-lg p-6 lg:w-[45vw] xl:w-[25vw] w-[90vw]\">\n <ax-avatar class=\"rounded-full\" [size]=\"72\">\n @if (user?.avatar) {\n <!-- <ax-image [src]=\"user?.avatar\"></ax-image> -->\n <axp-user-avatar [size]=\"72\" [userId]=\"user?.id!\"></axp-user-avatar>\n }\n </ax-avatar>\n <h2 class=\"md:text-lg font-medium\">{{ '@auth:welcome.message' | translate | async }}, {{ user?.title }}</h2>\n <p class=\"text-neutral-500 text-sm md:text-base font-medium\">\n {{ '@auth:tenant-chooser.description' | translate | async }}\n </p>\n <div class=\"mt-3 w-full\">\n <axp-tenant-chooser-list></axp-tenant-chooser-list>\n </div>\n </div>\n </section>\n <section>\n <p class=\"text-neutral-400 text-sm\">\n {{ '@auth:tenant-chooser.footer' | translate | async }}\n <a (click)=\"handleSignout()\" class=\"text-primary cursor-pointer hover:underline font-medium\">\n {{ '@auth:backLogin' | translate | async }}\n </a>\n </p>\n </section>\n</main>", styles: [":host{display:contents}.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.2 | MIT License | https://tailwindcss.com */\n"] }]
56
+ }] });
57
+
58
+ export { AXPAuthTenantChooserComponent };
59
+ //# sourceMappingURL=acorex-platform-module-auth-client-tenant-chooser.component-ihsqCJKN.mjs.map