@acorex-platform/module-security-management-client 0.0.38 → 0.0.46

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 (71) hide show
  1. package/fesm2022/{acorex-platform-module-security-management-client-acorex-platform-module-security-management-client-Ddzg9VYV.mjs → acorex-platform-module-security-management-client-acorex-platform-module-security-management-client-D-VISihP.mjs} +116 -37
  2. package/fesm2022/acorex-platform-module-security-management-client-acorex-platform-module-security-management-client-D-VISihP.mjs.map +1 -0
  3. package/fesm2022/acorex-platform-module-security-management-client-cancel-invitation.command-C3iaOEKI.mjs +74 -0
  4. package/fesm2022/acorex-platform-module-security-management-client-cancel-invitation.command-C3iaOEKI.mjs.map +1 -0
  5. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-device-sessions.mjs +22 -0
  6. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-device-sessions.mjs.map +1 -1
  7. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-identity-provider.mjs +22 -0
  8. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-identity-provider.mjs.map +1 -1
  9. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-policy.mjs +21 -0
  10. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-policy.mjs.map +1 -1
  11. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-profile.mjs +21 -0
  12. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-profile.mjs.map +1 -1
  13. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-role-permission.mjs +22 -0
  14. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-role-permission.mjs.map +1 -1
  15. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-roles.mjs +22 -0
  16. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-roles.mjs.map +1 -1
  17. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-user-role.mjs +22 -0
  18. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-user-role.mjs.map +1 -1
  19. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-user-two-factor.mjs +182 -0
  20. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-user-two-factor.mjs.map +1 -0
  21. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-users.mjs +165 -3
  22. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-users.mjs.map +1 -1
  23. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-acorex-platform-module-security-management-client-contracts-entity-catalog-lSVw6AfZ.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-acorex-platform-module-security-management-client-contracts-entity-catalog-B4oiF8FO.mjs} +16 -9
  24. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-acorex-platform-module-security-management-client-contracts-entity-catalog-B4oiF8FO.mjs.map +1 -0
  25. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-device-sessions.entity-Dvpk0Zbp.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-device-sessions.entity-CU-5X-qu.mjs} +18 -2
  26. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-device-sessions.entity-CU-5X-qu.mjs.map +1 -0
  27. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-identity-provider.entity-Tdv5yyXZ.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-identity-provider.entity-Bld1buTd.mjs} +18 -2
  28. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-identity-provider.entity-Bld1buTd.mjs.map +1 -0
  29. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-policy.entity-CseeIcOT.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-policy.entity-DZVzHzVM.mjs} +17 -2
  30. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-policy.entity-DZVzHzVM.mjs.map +1 -0
  31. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-profile.entity-DY1FIReo.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-profile.entity-BCy5fNc9.mjs} +17 -2
  32. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-profile.entity-BCy5fNc9.mjs.map +1 -0
  33. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-role-permission.entity-Bu6GOmpN.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-role-permission.entity-DcvYjfZm.mjs} +18 -2
  34. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-role-permission.entity-DcvYjfZm.mjs.map +1 -0
  35. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-roles.entity-Gm_ZliWA.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-roles.entity-lNKDIDry.mjs} +18 -2
  36. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-roles.entity-lNKDIDry.mjs.map +1 -0
  37. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-user-role.entity-QDvbO4dK.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-user-role.entity-DKII6o5N.mjs} +18 -2
  38. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-user-role.entity-DKII6o5N.mjs.map +1 -0
  39. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-user-two-factor.entity-ge21b3mE.mjs +100 -0
  40. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-user-two-factor.entity-ge21b3mE.mjs.map +1 -0
  41. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-users.entity-5Or50mGu.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-users.entity-CJ7x5rjC.mjs} +161 -5
  42. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-users.entity-CJ7x5rjC.mjs.map +1 -0
  43. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog.mjs +1 -1
  44. package/fesm2022/acorex-platform-module-security-management-client-contracts.mjs +179 -1
  45. package/fesm2022/acorex-platform-module-security-management-client-contracts.mjs.map +1 -1
  46. package/fesm2022/{acorex-platform-module-security-management-client-index-C1rCxs2K.mjs → acorex-platform-module-security-management-client-index-CT-N83bV.mjs} +2 -2
  47. package/fesm2022/{acorex-platform-module-security-management-client-index-C1rCxs2K.mjs.map → acorex-platform-module-security-management-client-index-CT-N83bV.mjs.map} +1 -1
  48. package/fesm2022/acorex-platform-module-security-management-client-invitation-target.util-BAXQZwLW.mjs +41 -0
  49. package/fesm2022/acorex-platform-module-security-management-client-invitation-target.util-BAXQZwLW.mjs.map +1 -0
  50. package/fesm2022/acorex-platform-module-security-management-client-invite-user.command-kFXjLdxy.mjs +143 -0
  51. package/fesm2022/acorex-platform-module-security-management-client-invite-user.command-kFXjLdxy.mjs.map +1 -0
  52. package/fesm2022/acorex-platform-module-security-management-client-local-entities.mjs +1 -0
  53. package/fesm2022/acorex-platform-module-security-management-client-local-entities.mjs.map +1 -1
  54. package/fesm2022/acorex-platform-module-security-management-client-resend-invitation.command-D9Ijk565.mjs +76 -0
  55. package/fesm2022/acorex-platform-module-security-management-client-resend-invitation.command-D9Ijk565.mjs.map +1 -0
  56. package/fesm2022/acorex-platform-module-security-management-client-reset-two-factor.command-psTDKoNf.mjs +96 -0
  57. package/fesm2022/acorex-platform-module-security-management-client-reset-two-factor.command-psTDKoNf.mjs.map +1 -0
  58. package/fesm2022/acorex-platform-module-security-management-client.mjs +1 -1
  59. package/package.json +5 -1
  60. package/types/acorex-platform-module-security-management-client-contracts-entities-user-two-factor.d.ts +9 -0
  61. package/types/acorex-platform-module-security-management-client-contracts.d.ts +224 -4
  62. package/fesm2022/acorex-platform-module-security-management-client-acorex-platform-module-security-management-client-Ddzg9VYV.mjs.map +0 -1
  63. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-acorex-platform-module-security-management-client-contracts-entity-catalog-lSVw6AfZ.mjs.map +0 -1
  64. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-device-sessions.entity-Dvpk0Zbp.mjs.map +0 -1
  65. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-identity-provider.entity-Tdv5yyXZ.mjs.map +0 -1
  66. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-policy.entity-CseeIcOT.mjs.map +0 -1
  67. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-profile.entity-DY1FIReo.mjs.map +0 -1
  68. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-role-permission.entity-Bu6GOmpN.mjs.map +0 -1
  69. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-roles.entity-Gm_ZliWA.mjs.map +0 -1
  70. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-user-role.entity-QDvbO4dK.mjs.map +0 -1
  71. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-users.entity-5Or50mGu.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-security-management-client-invite-user.command-kFXjLdxy.mjs","sources":["../../../../libs/modules/security-management/client/src/lib/commands/invite-user.command.ts"],"sourcesContent":["import { AXDialogService } from '@acorex/components/dialog';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport {\n AXPLayoutBuilderService,\n resolveLayoutBuilderDialogResult,\n} from '@acorex-platform/framework-client/layout/builder';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport type { AXPCommand, AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport {\n AXM_USER_INVITE_COMMAND,\n AXMSecurityManagementServerCommands,\n type AXMInviteUserResult,\n} from '@acorex-platform/module-security-management-client/contracts';\nimport { inject, Injectable } from '@angular/core';\n\n//#region ---- Types ----\n\ninterface InviteFormResult {\n email: string;\n displayName?: string;\n applicationIds?: string[];\n}\n\n//#endregion\n\n//#region ---- Invite user command ----\n\n@Injectable({ providedIn: 'root' })\nexport class AXPInviteUserCommand implements AXPCommand {\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly commandService = inject(AXPCommandService);\n private readonly dialogService = inject(AXDialogService);\n private readonly toastService = inject(AXToastService);\n private readonly translationService = inject(AXTranslationService);\n\n async execute(): AXPCommandExecuteResultPromise {\n const form = await this.openInviteDialog();\n if (!form) {\n return { success: true, kind: 'object', data: { outcome: 'cancelled' } };\n }\n\n const webOrigin = typeof window !== 'undefined' ? window.location.origin : undefined;\n // Nested server call must skip toast middleware — this command owns UX toasts.\n let result = await this.commandService.executeRemote(AXMSecurityManagementServerCommands.InviteUser, {\n email: form.email,\n displayName: form.displayName,\n applicationIds: form.applicationIds,\n webOrigin,\n });\n\n const payload = (result as { data?: AXMInviteUserResult })?.data;\n if (result?.success && payload?.userAlreadyExists && !payload.sent) {\n const title = await this.translationService\n .translateAsync('@security-management:users.entities.user.actions.invite.existing-warning-title')\n .catch(() => 'User Already Exists');\n const message = await this.translationService\n .translateAsync('@security-management:users.entities.user.actions.invite.existing-warning-message', {\n params: { email: form.email },\n })\n .catch(() => `A user with email ${form.email} already exists. Send an invitation to join this tenant?`);\n const confirmed = await this.dialogService.confirm(title, message, 'warning', 'horizontal');\n if (!confirmed.result) {\n return { success: true, kind: 'object', data: { outcome: 'cancelled' } };\n }\n result = await this.commandService.executeRemote(AXMSecurityManagementServerCommands.InviteUser, {\n email: form.email,\n displayName: form.displayName,\n applicationIds: form.applicationIds,\n confirmExisting: true,\n webOrigin,\n });\n }\n\n if (result?.success) {\n const [toastTitle, toastContent] = await Promise.all([\n this.translationService\n .translateAsync('@security-management:users.entities.user.actions.invite.success.title')\n .catch(() => 'Invitation Sent'),\n this.translationService\n .translateAsync('@security-management:users.entities.user.actions.invite.success.description')\n .catch(() => 'The invitation email was sent.'),\n ]);\n this.toastService.show({ color: 'success', title: toastTitle, content: toastContent, timeOut: 3000 });\n return { success: true, kind: 'object', data: result.data };\n }\n\n const [toastTitle, fallback] = await Promise.all([\n this.translationService\n .translateAsync('@security-management:users.entities.user.actions.invite.error.title')\n .catch(() => 'Invite Failed'),\n this.translationService\n .translateAsync('@security-management:users.entities.user.actions.invite.error.description')\n .catch(() => 'Failed to invite user.'),\n ]);\n const toastContent =\n (typeof result?.message?.text === 'string' && result.message.text) || fallback;\n this.toastService.show({ color: 'danger', title: toastTitle, content: toastContent, timeOut: 4000 });\n // No `message` — outer command toast middleware would duplicate this toast.\n return { success: false };\n }\n\n private async openInviteDialog(): Promise<InviteFormResult | null> {\n const result = await this.layoutBuilder\n .create()\n .dialog<InviteFormResult | null>((dialog) => {\n dialog\n .setTitle('@security-management:users.entities.user.actions.invite.dialog.title')\n .setSize('md')\n .setCloseButton(true)\n .setContext({ email: '', displayName: '', applicationIds: [] })\n .content((flex) => {\n flex\n .setDirection('column')\n .setGap('12px')\n .formField('@security-management:users.entities.user.actions.invite.fields.email', (field) => {\n field.path('email');\n field.textBox({ validations: [{ rule: 'required' }, { rule: 'email' }] });\n })\n .formField('@security-management:users.entities.user.actions.invite.fields.display-name', (field) => {\n field.path('displayName');\n field.textBox({});\n })\n .formField('@security-management:users.entities.user.actions.invite.fields.applications', (field) => {\n field.path('applicationIds');\n field.lookupBox({\n entity: 'ApplicationManagement.Application',\n multiple: true,\n look: 'select',\n });\n });\n })\n .setActions((actions) => {\n actions.cancel('@general:actions.cancel.title');\n actions.submit('@security-management:users.entities.user.actions.invite.dialog.submit');\n })\n .onAction(async (dialogRef) => {\n if (dialogRef.action() === 'cancel') {\n return null;\n }\n const ctx = dialogRef.context() as InviteFormResult;\n const email = (ctx.email ?? '').trim();\n if (!email) {\n throw new Error('@security-management:users.entities.user.actions.invite.errors.email-required');\n }\n return {\n email,\n displayName: (ctx.displayName ?? '').trim() || undefined,\n applicationIds: Array.isArray(ctx.applicationIds) ? ctx.applicationIds : undefined,\n };\n });\n })\n .show();\n\n return resolveLayoutBuilderDialogResult<InviteFormResult>(result);\n }\n}\n\nexport { AXM_USER_INVITE_COMMAND };\n\n//#endregion\n"],"names":[],"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gBACtC,IAAI,CAAC,KAAK,EAAE;AACV,oBAAA,MAAM,IAAI,KAAK,CAAC,+EAA+E,CAAC;gBAClG;gBACA,OAAO;oBACL,KAAK;AACL,oBAAA,WAAW,EAAE,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,SAAS;AACxD,oBAAA,cAAc,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC,cAAc,GAAG,SAAS;iBACnF;AACH,YAAA,CAAC,CAAC;AACN,QAAA,CAAC;AACA,aAAA,IAAI,EAAE;AAET,QAAA,OAAO,gCAAgC,CAAmB,MAAM,CAAC;IACnE;8GA9HW,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAApB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,cADP,MAAM,EAAA,CAAA,CAAA;;2FACnB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBADhC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
@@ -23,6 +23,7 @@ function provideSecurityManagementLocalEntities() {
23
23
  [RootConfig.entities.roles.name]: () => import('@acorex-platform/module-security-management-client/contracts/entities/roles').then((m) => m.rolesFactory()),
24
24
  [RootConfig.entities.userRole.name]: () => import('@acorex-platform/module-security-management-client/contracts/entities/user-role').then((m) => m.userRoleFactory()),
25
25
  [RootConfig.entities.users.name]: () => import('@acorex-platform/module-security-management-client/contracts/entities/users').then((m) => m.usersFactory()),
26
+ [RootConfig.entities.userTwoFactor.name]: () => import('@acorex-platform/module-security-management-client/contracts/entities/user-two-factor').then((m) => m.userTwoFactorFactory()),
26
27
  },
27
28
  });
28
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-security-management-client-local-entities.mjs","sources":["../../../../libs/modules/security-management/client/src/lib/provide-local-entities.ts","../../../../libs/modules/security-management/client/src/lib/acorex-platform-module-security-management-client-local-entities.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { provideLocalEntityCatalog } from '@acorex-platform/framework-client/layout/entity';\nimport { RootConfig } from '@acorex-platform/module-security-management-client/contracts';\n\n//#endregion\n\n//#region ----- Provide local entities -----\n\n/**\n * Registers security-management layouts on the client from packaged factories.\n * Each `import()` targets a secondary entry so unused entities stay out of the\n * bundle. Do not add this to the demo app; demo continues to load layouts via\n * `Domain:GetEntityLayout`.\n */\nexport function provideSecurityManagementLocalEntities() {\n return provideLocalEntityCatalog({\n moduleName: RootConfig.module.name,\n loaders: {\n [RootConfig.entities.deviceSessions.name]: () =>\n import('@acorex-platform/module-security-management-client/contracts/entities/device-sessions').then((m) => m.deviceSessionsFactory()),\n [RootConfig.entities.identityProvider.name]: () =>\n import('@acorex-platform/module-security-management-client/contracts/entities/identity-provider').then((m) => m.identityProviderFactory()),\n [RootConfig.entities.policy.name]: () =>\n import('@acorex-platform/module-security-management-client/contracts/entities/policy').then((m) => m.policyFactory()),\n [RootConfig.entities.profile.name]: () =>\n import('@acorex-platform/module-security-management-client/contracts/entities/profile').then((m) => m.profileFactory()),\n [RootConfig.entities.rolePermission.name]: () =>\n import('@acorex-platform/module-security-management-client/contracts/entities/role-permission').then((m) => m.rolePermissionFactory()),\n [RootConfig.entities.roles.name]: () =>\n import('@acorex-platform/module-security-management-client/contracts/entities/roles').then((m) => m.rolesFactory()),\n [RootConfig.entities.userRole.name]: () =>\n import('@acorex-platform/module-security-management-client/contracts/entities/user-role').then((m) => m.userRoleFactory()),\n [RootConfig.entities.users.name]: () =>\n import('@acorex-platform/module-security-management-client/contracts/entities/users').then((m) => m.usersFactory()),\n },\n });\n}\n\nexport { securityManagementLocalEntityCatalog } from '@acorex-platform/module-security-management-client/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;AACrH,YAAA,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,GAAG,MACnC,OAAO,iFAAiF,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,eAAe,EAAE,CAAC;AAC5H,YAAA,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,GAAG,MAChC,OAAO,6EAA6E,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,YAAY,EAAE,CAAC;AACtH,SAAA;AACF,KAAA,CAAC;AACJ;AAIA;;ACzCA;;AAEG;;"}
1
+ {"version":3,"file":"acorex-platform-module-security-management-client-local-entities.mjs","sources":["../../../../libs/modules/security-management/client/src/lib/provide-local-entities.ts","../../../../libs/modules/security-management/client/src/lib/acorex-platform-module-security-management-client-local-entities.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { provideLocalEntityCatalog } from '@acorex-platform/framework-client/layout/entity';\nimport { RootConfig } from '@acorex-platform/module-security-management-client/contracts';\n\n//#endregion\n\n//#region ----- Provide local entities -----\n\n/**\n * Registers security-management layouts on the client from packaged factories.\n * Each `import()` targets a secondary entry so unused entities stay out of the\n * bundle. Do not add this to the demo app; demo continues to load layouts via\n * `Domain:GetEntityLayout`.\n */\nexport function provideSecurityManagementLocalEntities() {\n return provideLocalEntityCatalog({\n moduleName: RootConfig.module.name,\n loaders: {\n [RootConfig.entities.deviceSessions.name]: () =>\n import('@acorex-platform/module-security-management-client/contracts/entities/device-sessions').then((m) => m.deviceSessionsFactory()),\n [RootConfig.entities.identityProvider.name]: () =>\n import('@acorex-platform/module-security-management-client/contracts/entities/identity-provider').then((m) => m.identityProviderFactory()),\n [RootConfig.entities.policy.name]: () =>\n import('@acorex-platform/module-security-management-client/contracts/entities/policy').then((m) => m.policyFactory()),\n [RootConfig.entities.profile.name]: () =>\n import('@acorex-platform/module-security-management-client/contracts/entities/profile').then((m) => m.profileFactory()),\n [RootConfig.entities.rolePermission.name]: () =>\n import('@acorex-platform/module-security-management-client/contracts/entities/role-permission').then((m) => m.rolePermissionFactory()),\n [RootConfig.entities.roles.name]: () =>\n import('@acorex-platform/module-security-management-client/contracts/entities/roles').then((m) => m.rolesFactory()),\n [RootConfig.entities.userRole.name]: () =>\n import('@acorex-platform/module-security-management-client/contracts/entities/user-role').then((m) => m.userRoleFactory()),\n [RootConfig.entities.users.name]: () =>\n import('@acorex-platform/module-security-management-client/contracts/entities/users').then((m) => m.usersFactory()),\n [RootConfig.entities.userTwoFactor.name]: () =>\n import('@acorex-platform/module-security-management-client/contracts/entities/user-two-factor').then(\n (m) => m.userTwoFactorFactory(),\n ),\n },\n });\n}\n\nexport { securityManagementLocalEntityCatalog } from '@acorex-platform/module-security-management-client/contracts/entity-catalog';\n\n//#endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './provide-local-entities';\n"],"names":[],"mappings":";;;;AAAA;AAKA;AAEA;AAEA;;;;;AAKG;SACa,sCAAsC,GAAA;AACpD,IAAA,OAAO,yBAAyB,CAAC;AAC/B,QAAA,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI;AAClC,QAAA,OAAO,EAAE;AACP,YAAA,CAAC,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,GAAG,MACzC,OAAO,uFAAuF,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,qBAAqB,EAAE,CAAC;AACxI,YAAA,CAAC,UAAU,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,GAAG,MAC3C,OAAO,yFAAyF,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,uBAAuB,EAAE,CAAC;AAC5I,YAAA,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,GAAG,MACjC,OAAO,8EAA8E,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,aAAa,EAAE,CAAC;AACvH,YAAA,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,GAAG,MAClC,OAAO,+EAA+E,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,cAAc,EAAE,CAAC;AACzH,YAAA,CAAC,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,GAAG,MACzC,OAAO,uFAAuF,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,qBAAqB,EAAE,CAAC;AACxI,YAAA,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,GAAG,MAChC,OAAO,6EAA6E,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,YAAY,EAAE,CAAC;AACrH,YAAA,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,GAAG,MACnC,OAAO,iFAAiF,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,eAAe,EAAE,CAAC;AAC5H,YAAA,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,GAAG,MAChC,OAAO,6EAA6E,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,YAAY,EAAE,CAAC;AACrH,YAAA,CAAC,UAAU,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,GAAG,MACxC,OAAO,uFAAuF,CAAC,CAAC,IAAI,CAClG,CAAC,CAAC,KAAK,CAAC,CAAC,oBAAoB,EAAE,CAChC;AACJ,SAAA;AACF,KAAA,CAAC;AACJ;AAIA;;AC7CA;;AAEG;;"}
@@ -0,0 +1,76 @@
1
+ import { AXDialogService } from '@acorex/components/dialog';
2
+ import { AXToastService } from '@acorex/components/toast';
3
+ import { AXTranslationService } from '@acorex/core/translation';
4
+ import { AXPCommandService } from '@acorex-platform/framework-client/runtime';
5
+ import { AXMSecurityManagementServerCommands } from '@acorex-platform/module-security-management-client/contracts';
6
+ export { AXM_USER_RESEND_INVITATION_COMMAND } from '@acorex-platform/module-security-management-client/contracts';
7
+ import * as i0 from '@angular/core';
8
+ import { inject, Injectable } from '@angular/core';
9
+ import { r as resolveInvitationCommandTargets } from './acorex-platform-module-security-management-client-invitation-target.util-BAXQZwLW.mjs';
10
+
11
+ //#region ---- AXPResendInvitationCommand ----
12
+ class AXPResendInvitationCommand {
13
+ constructor() {
14
+ this.dialogService = inject(AXDialogService);
15
+ this.toastService = inject(AXToastService);
16
+ this.translationService = inject(AXTranslationService);
17
+ this.commandService = inject(AXPCommandService);
18
+ }
19
+ async execute(input = {}) {
20
+ const { tenantUserId, userId } = resolveInvitationCommandTargets(input);
21
+ if (!tenantUserId && !userId) {
22
+ return { success: false, message: { text: 'Tenant user id is required.' } };
23
+ }
24
+ const who = input.data?.displayName || input.data?.email || String(tenantUserId || userId);
25
+ const confirmTitle = await this.translationService
26
+ .translateAsync('@security-management:users.entities.user.actions.resend-invitation.confirm-title')
27
+ .catch(() => 'resend-invitation');
28
+ const confirmMessage = await this.translationService
29
+ .translateAsync('@security-management:users.entities.user.actions.resend-invitation.confirm-message', {
30
+ params: { user: who },
31
+ })
32
+ .catch(() => `Continue for ${who}?`);
33
+ const confirmed = await this.dialogService.confirm(confirmTitle, confirmMessage, 'primary', 'horizontal');
34
+ if (!confirmed.result) {
35
+ return { success: false };
36
+ }
37
+ const webOrigin = typeof window !== 'undefined' ? window.location.origin : undefined;
38
+ const result = await this.commandService.executeRemote(AXMSecurityManagementServerCommands.ResendInvitation, {
39
+ tenantUserId,
40
+ userId,
41
+ webOrigin,
42
+ });
43
+ if (result?.success) {
44
+ const [toastTitle, toastContent] = await Promise.all([
45
+ this.translationService
46
+ .translateAsync('@security-management:users.entities.user.actions.resend-invitation.success.title')
47
+ .catch(() => 'Success'),
48
+ this.translationService
49
+ .translateAsync('@security-management:users.entities.user.actions.resend-invitation.success.description')
50
+ .catch(() => 'Done.'),
51
+ ]);
52
+ this.toastService.show({ color: 'success', title: toastTitle, content: toastContent, timeOut: 3000 });
53
+ return { success: true, kind: 'object', data: undefined };
54
+ }
55
+ const [toastTitle, fallback] = await Promise.all([
56
+ this.translationService
57
+ .translateAsync('@security-management:users.entities.user.actions.resend-invitation.error.title')
58
+ .catch(() => 'Failed'),
59
+ this.translationService
60
+ .translateAsync('@security-management:users.entities.user.actions.resend-invitation.error.description')
61
+ .catch(() => 'The action failed.'),
62
+ ]);
63
+ const toastContent = (typeof result?.message?.text === 'string' && result.message.text) || fallback;
64
+ this.toastService.show({ color: 'danger', title: toastTitle, content: toastContent, timeOut: 4000 });
65
+ return { success: false };
66
+ }
67
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPResendInvitationCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
68
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPResendInvitationCommand, providedIn: 'root' }); }
69
+ }
70
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPResendInvitationCommand, decorators: [{
71
+ type: Injectable,
72
+ args: [{ providedIn: 'root' }]
73
+ }] });
74
+
75
+ export { AXPResendInvitationCommand };
76
+ //# sourceMappingURL=acorex-platform-module-security-management-client-resend-invitation.command-D9Ijk565.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-security-management-client-resend-invitation.command-D9Ijk565.mjs","sources":["../../../../libs/modules/security-management/client/src/lib/commands/resend-invitation.command.ts"],"sourcesContent":["import { AXDialogService } from '@acorex/components/dialog';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport type { AXPCommand, AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport {\n AXM_USER_RESEND_INVITATION_COMMAND,\n AXMSecurityManagementServerCommands,\n} from '@acorex-platform/module-security-management-client/contracts';\nimport { inject, Injectable } from '@angular/core';\nimport {\n resolveInvitationCommandTargets,\n type AXPInvitationTargetCommandInput,\n} from './invitation-target.util';\n\nexport type { AXPInvitationTargetCommandInput };\n\n//#region ---- AXPResendInvitationCommand ----\n\n@Injectable({ providedIn: 'root' })\nexport class AXPResendInvitationCommand implements AXPCommand<AXPInvitationTargetCommandInput> {\n private readonly dialogService = inject(AXDialogService);\n private readonly toastService = inject(AXToastService);\n private readonly translationService = inject(AXTranslationService);\n private readonly commandService = inject(AXPCommandService);\n\n async execute(input: AXPInvitationTargetCommandInput = {}): AXPCommandExecuteResultPromise {\n const { tenantUserId, userId } = resolveInvitationCommandTargets(input);\n if (!tenantUserId && !userId) {\n return { success: false, message: { text: 'Tenant user id is required.' } };\n }\n\n const who = input.data?.displayName || input.data?.email || String(tenantUserId || userId);\n const confirmTitle = await this.translationService\n .translateAsync('@security-management:users.entities.user.actions.resend-invitation.confirm-title')\n .catch(() => 'resend-invitation');\n const confirmMessage = await this.translationService\n .translateAsync('@security-management:users.entities.user.actions.resend-invitation.confirm-message', {\n params: { user: who },\n })\n .catch(() => `Continue for ${who}?`);\n\n const confirmed = await this.dialogService.confirm(confirmTitle, confirmMessage, 'primary', 'horizontal');\n if (!confirmed.result) {\n return { success: false };\n }\n\n const webOrigin = typeof window !== 'undefined' ? window.location.origin : undefined;\n const result = await this.commandService.executeRemote(AXMSecurityManagementServerCommands.ResendInvitation, {\n tenantUserId,\n userId,\n webOrigin,\n });\n\n if (result?.success) {\n const [toastTitle, toastContent] = await Promise.all([\n this.translationService\n .translateAsync('@security-management:users.entities.user.actions.resend-invitation.success.title')\n .catch(() => 'Success'),\n this.translationService\n .translateAsync('@security-management:users.entities.user.actions.resend-invitation.success.description')\n .catch(() => 'Done.'),\n ]);\n this.toastService.show({ color: 'success', title: toastTitle, content: toastContent, timeOut: 3000 });\n return { success: true, kind: 'object', data: undefined };\n }\n\n const [toastTitle, fallback] = await Promise.all([\n this.translationService\n .translateAsync('@security-management:users.entities.user.actions.resend-invitation.error.title')\n .catch(() => 'Failed'),\n this.translationService\n .translateAsync('@security-management:users.entities.user.actions.resend-invitation.error.description')\n .catch(() => 'The action failed.'),\n ]);\n const toastContent =\n (typeof result?.message?.text === 'string' && result.message.text) || fallback;\n this.toastService.show({ color: 'danger', title: toastTitle, content: toastContent, timeOut: 4000 });\n return { success: false };\n }\n}\n\nexport { AXM_USER_RESEND_INVITATION_COMMAND };\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;AAiBA;MAGa,0BAA0B,CAAA;AADvC,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC;AACvC,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAwD5D,IAAA;AAtDC,IAAA,MAAM,OAAO,CAAC,KAAA,GAAyC,EAAE,EAAA;QACvD,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,+BAA+B,CAAC,KAAK,CAAC;AACvE,QAAA,IAAI,CAAC,YAAY,IAAI,CAAC,MAAM,EAAE;AAC5B,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,6BAA6B,EAAE,EAAE;QAC7E;QAEA,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,EAAE,WAAW,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC;AAC1F,QAAA,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC;aAC7B,cAAc,CAAC,kFAAkF;AACjG,aAAA,KAAK,CAAC,MAAM,mBAAmB,CAAC;AACnC,QAAA,MAAM,c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AS,EAAE;QAC3D;QAEA,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;AAC/C,YAAA,IAAI,CAAC;iBACF,cAAc,CAAC,gFAAgF;AAC/F,iBAAA,KAAK,CAAC,MAAM,QAAQ,CAAC;AACxB,YAAA,IAAI,CAAC;iBACF,cAAc,CAAC,sFAAsF;AACrG,iBAAA,KAAK,CAAC,MAAM,oBAAoB,CAAC;AACrC,SAAA,CAAC;QACF,MAAM,YAAY,GAChB,CAAC,OAAO,MAAM,EAAE,OAAO,EAAE,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ;QAChF,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACpG,QAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IAC3B;8GA3DW,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA1B,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,0BAA0B,cADb,MAAM,EAAA,CAAA,CAAA;;2FACnB,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBADtC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
@@ -0,0 +1,96 @@
1
+ import { AXDialogService } from '@acorex/components/dialog';
2
+ import { AXToastService } from '@acorex/components/toast';
3
+ import { AXTranslationService } from '@acorex/core/translation';
4
+ import { AXPCommandService } from '@acorex-platform/framework-client/runtime';
5
+ import { AXM_TWO_FACTOR_ERROR_CODES, AXMSecurityManagementServerCommands } from '@acorex-platform/module-security-management-client/contracts';
6
+ export { AXM_USER_RESET_TWO_FACTOR_COMMAND } from '@acorex-platform/module-security-management-client/contracts';
7
+ import * as i0 from '@angular/core';
8
+ import { inject, Injectable } from '@angular/core';
9
+
10
+ //#endregion
11
+ //#region ----- Constants -----
12
+ const I18N = '@security-management:users.entities.user.actions.reset-two-factor';
13
+ const TWO_FACTOR_ERROR_I18N = {
14
+ [AXM_TWO_FACTOR_ERROR_CODES.InvalidInput]: `${I18N}.errors.invalid-input`,
15
+ [AXM_TWO_FACTOR_ERROR_CODES.UserNotFound]: `${I18N}.errors.user-not-found`,
16
+ [AXM_TWO_FACTOR_ERROR_CODES.Forbidden]: `${I18N}.errors.forbidden`,
17
+ [AXM_TWO_FACTOR_ERROR_CODES.NotEnabled]: `${I18N}.errors.not-enabled`,
18
+ };
19
+ //#endregion
20
+ //#region ----- Client command -----
21
+ /**
22
+ * Admin Action on User detail: if 2FA is not enabled, warn and stop;
23
+ * otherwise confirm, then call server AdminResetTwoFactor.
24
+ */
25
+ class AXPResetTwoFactorCommand {
26
+ constructor() {
27
+ //#region ----- Services & Dependencies -----
28
+ this.dialogService = inject(AXDialogService);
29
+ this.toastService = inject(AXToastService);
30
+ this.translationService = inject(AXTranslationService);
31
+ this.commandService = inject(AXPCommandService);
32
+ }
33
+ //#endregion
34
+ //#region ----- Command -----
35
+ async execute(input = {}) {
36
+ const userId = input.userId ?? input.data?.id;
37
+ if (!userId) {
38
+ return { success: false, message: { text: `${I18N}.errors.invalid-input` } };
39
+ }
40
+ const who = input.data?.displayName ||
41
+ input.data?.username ||
42
+ input.data?.email ||
43
+ String(userId);
44
+ // Preflight: stop before confirm when 2FA was never enabled for this user.
45
+ const preflight = await this.commandService.executeRemote(AXMSecurityManagementServerCommands.AdminResetTwoFactor, { userId: String(userId), dryRun: true });
46
+ if (!preflight?.success) {
47
+ await this.showFailureToast(preflight?.message?.code);
48
+ return { success: false };
49
+ }
50
+ const confirmTitle = await this.translationService.translateAsync(`${I18N}.confirm-title`);
51
+ const confirmMessage = await this.translationService.translateAsync(`${I18N}.confirm-message`, {
52
+ params: { user: who },
53
+ });
54
+ const confirmed = await this.dialogService.confirm(confirmTitle, confirmMessage, 'danger', 'horizontal');
55
+ if (!confirmed.result) {
56
+ return { success: false };
57
+ }
58
+ const result = await this.commandService.executeRemote(AXMSecurityManagementServerCommands.AdminResetTwoFactor, { userId: String(userId) });
59
+ if (result?.success) {
60
+ const [toastTitle, toastContent] = await Promise.all([
61
+ this.translationService.translateAsync(`${I18N}.success.title`),
62
+ this.translationService.translateAsync(`${I18N}.success.description`),
63
+ ]);
64
+ this.toastService.show({ color: 'success', title: toastTitle, content: toastContent, timeOut: 3000 });
65
+ return { success: true, kind: 'object', data: undefined };
66
+ }
67
+ await this.showFailureToast(result?.message?.code);
68
+ return { success: false };
69
+ }
70
+ //#endregion
71
+ //#region ----- Helpers -----
72
+ async showFailureToast(code) {
73
+ const codeKey = typeof code === 'string' ? code : '';
74
+ const errorKey = TWO_FACTOR_ERROR_I18N[codeKey] || `${I18N}.error.description`;
75
+ const isNotEnabled = codeKey === AXM_TWO_FACTOR_ERROR_CODES.NotEnabled;
76
+ const [toastTitle, toastContent] = await Promise.all([
77
+ this.translationService.translateAsync(isNotEnabled ? `${I18N}.errors.not-enabled-title` : `${I18N}.error.title`),
78
+ this.translationService.translateAsync(errorKey),
79
+ ]);
80
+ this.toastService.show({
81
+ color: isNotEnabled ? 'warning' : 'danger',
82
+ title: toastTitle,
83
+ content: toastContent,
84
+ timeOut: 4000,
85
+ });
86
+ }
87
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPResetTwoFactorCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
88
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPResetTwoFactorCommand, providedIn: 'root' }); }
89
+ }
90
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPResetTwoFactorCommand, decorators: [{
91
+ type: Injectable,
92
+ args: [{ providedIn: 'root' }]
93
+ }] });
94
+
95
+ export { AXPResetTwoFactorCommand };
96
+ //# sourceMappingURL=acorex-platform-module-security-management-client-reset-two-factor.command-psTDKoNf.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-security-management-client-reset-two-factor.command-psTDKoNf.mjs","sources":["../../../../libs/modules/security-management/client/src/lib/commands/reset-two-factor.command.ts"],"sourcesContent":["import { AXDialogService } from '@acorex/components/dialog';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport {\n AXM_TWO_FACTOR_ERROR_CODES,\n AXM_USER_RESET_TWO_FACTOR_COMMAND,\n AXMSecurityManagementServerCommands,\n} from '@acorex-platform/module-security-management-client/contracts';\nimport { inject, Injectable } from '@angular/core';\n\n//#region ----- Types -----\n\nexport interface AXPResetTwoFactorCommandInput {\n userId?: string;\n data?: {\n id?: string;\n displayName?: string;\n username?: string;\n email?: string;\n };\n}\n\n//#endregion\n\n//#region ----- Constants -----\n\nconst I18N = '@security-management:users.entities.user.actions.reset-two-factor';\n\nconst TWO_FACTOR_ERROR_I18N: Record<string, string> = {\n [AXM_TWO_FACTOR_ERROR_CODES.InvalidInput]: `${I18N}.errors.invalid-input`,\n [AXM_TWO_FACTOR_ERROR_CODES.UserNotFound]: `${I18N}.errors.user-not-found`,\n [AXM_TWO_FACTOR_ERROR_CODES.Forbidden]: `${I18N}.errors.forbidden`,\n [AXM_TWO_FACTOR_ERROR_CODES.NotEnabled]: `${I18N}.errors.not-enabled`,\n};\n\n//#endregion\n\n//#region ----- Client command -----\n\n/**\n * Admin Action on User detail: if 2FA is not enabled, warn and stop;\n * otherwise confirm, then call server AdminResetTwoFactor.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXPResetTwoFactorCommand implements AXPCommand<AXPResetTwoFactorCommandInput> {\n //#region ----- Services & Dependencies -----\n\n private readonly dialogService = inject(AXDialogService);\n private readonly toastService = inject(AXToastService);\n private readonly translationService = inject(AXTranslationService);\n private readonly commandService = inject(AXPCommandService);\n\n //#endregion\n\n //#region ----- Command -----\n\n async execute(input: AXPResetTwoFactorCommandInput = {}): AXPCommandExecuteResultPromise {\n const userId = input.userId ?? input.data?.id;\n if (!userId) {\n return { success: false, message: { text: `${I18N}.errors.invalid-input` } };\n }\n\n const who =\n input.data?.displayName ||\n input.data?.username ||\n input.data?.email ||\n String(userId);\n\n // Preflight: stop before confirm when 2FA was never enabled for this user.\n const preflight = await this.commandService.executeRemote(\n AXMSecurityManagementServerCommands.AdminResetTwoFactor,\n { userId: String(userId), dryRun: true },\n );\n if (!preflight?.success) {\n await this.showFailureToast(preflight?.message?.code);\n return { success: false };\n }\n\n const confirmTitle = await this.translationService.translateAsync(`${I18N}.confirm-title`);\n const confirmMessage = await this.translationService.translateAsync(`${I18N}.confirm-message`, {\n params: { user: who },\n });\n\n const confirmed = await this.dialogService.confirm(confirmTitle, confirmMessage, 'danger', 'horizontal');\n if (!confirmed.result) {\n return { success: false };\n }\n\n const result = await this.commandService.executeRemote(\n AXMSecurityManagementServerCommands.AdminResetTwoFactor,\n { userId: String(userId) },\n );\n\n if (result?.success) {\n const [toastTitle, toastContent] = await Promise.all([\n this.translationService.translateAsync(`${I18N}.success.title`),\n this.translationService.translateAsync(`${I18N}.success.description`),\n ]);\n this.toastService.show({ color: 'success', title: toastTitle, content: toastContent, timeOut: 3000 });\n return { success: true, kind: 'object', data: undefined };\n }\n\n await this.showFailureToast(result?.message?.code);\n return { success: false };\n }\n\n //#endregion\n\n //#region ----- Helpers -----\n\n private async showFailureToast(code: unknown): Promise<void> {\n const codeKey = typeof code === 'string' ? code : '';\n const errorKey = TWO_FACTOR_ERROR_I18N[codeKey] || `${I18N}.error.description`;\n const isNotEnabled = codeKey === AXM_TWO_FACTOR_ERROR_CODES.NotEnabled;\n const [toastTitle, toastContent] = await Promise.all([\n this.translationService.translateAsync(\n isNotEnabled ? `${I18N}.errors.not-enabled-title` : `${I18N}.error.title`,\n ),\n this.translationService.translateAsync(errorKey),\n ]);\n this.toastService.show({\n color: isNotEnabled ? 'warning' : 'danger',\n title: toastTitle,\n content: toastContent,\n timeOut: 4000,\n });\n }\n\n //#endregion\n}\n\nexport { AXM_USER_RESET_TWO_FACTOR_COMMAND };\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;AAwBA;AAEA;AAEA,MAAM,IAAI,GAAG,mEAAmE;AAEhF,MAAM,qBAAqB,GAA2B;AACpD,IAAA,CAAC,0BAA0B,CAAC,YAAY,GAAG,CAAA,EAAG,IAAI,CAAA,qBAAA,CAAuB;AACzE,IAAA,CAAC,0BAA0B,CAAC,YAAY,GAAG,CAAA,EAAG,IAAI,CAAA,sBAAA,CAAwB;AAC1E,IAAA,CAAC,0BAA0B,CAAC,SAAS,GAAG,CAAA,EAAG,IAAI,CAAA,iBAAA,CAAmB;AAClE,IAAA,CAAC,0BAA0B,CAAC,UAAU,GAAG,CAAA,EAAG,IAAI,CAAA,mBAAA,CAAqB;CACtE;AAED;AAEA;AAEA;;;AAGG;MAEU,wBAAwB,CAAA;AADrC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC;AACvC,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AA+E5D,IAAA;;;AAzEC,IAAA,MAAM,OAAO,CAAC,KAAA,GAAuC,EAAE,EAAA;QAC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,CAAC,GAAG,CAAC;AACnD,YAAA,IAAI,CAAC,kBAAkB,CAAC,cAAc,CACpC,YAAY,GAAG,CAAA,EAAG,IAAI,2BAA2B,GAAG,CAAA,EAAG,IAAI,cAAc,CAC1E;AACD,YAAA,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,QAAQ,CAAC;AACjD,SAAA,CAAC;AACF,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;YACrB,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,QAAQ;AAC1C,YAAA,KAAK,EAAE,UAAU;AACjB,YAAA,OAAO,EAAE,YAAY;AACrB,YAAA,OAAO,EAAE,IAAI;AACd,SAAA,CAAC;IACJ;8GAlFW,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,2 +1,2 @@
1
- export { A as AXMAssignPermissionsCommand, a as AXMDeviceSessionsService, b as AXMPermissionsModule, c as AXMRolePermissionGrantService, d as AXMRolePermissionsPageComponent, e as AXMRolePermissionsPageComponentProvider, f as AXMSecurityManagementModule, g as AXPPermissionsEditorComponent, h as AXPPermissionsWidget, i as AXPPermissionsWidgetColumnComponent, j as AXPPermissionsWidgetEditComponent, k as AXPPermissionsWidgetViewComponent } from './acorex-platform-module-security-management-client-acorex-platform-module-security-management-client-Ddzg9VYV.mjs';
1
+ export { A as AXMAssignPermissionsCommand, a as AXMDeviceSessionsService, b as AXMPermissionsModule, c as AXMRolePermissionGrantService, d as AXMRolePermissionsPageComponent, e as AXMRolePermissionsPageComponentProvider, f as AXMSecurityManagementModule, g as AXPPermissionsEditorComponent, h as AXPPermissionsWidget, i as AXPPermissionsWidgetColumnComponent, j as AXPPermissionsWidgetEditComponent, k as AXPPermissionsWidgetViewComponent } from './acorex-platform-module-security-management-client-acorex-platform-module-security-management-client-D-VISihP.mjs';
2
2
  //# sourceMappingURL=acorex-platform-module-security-management-client.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acorex-platform/module-security-management-client",
3
- "version": "0.0.38",
3
+ "version": "0.0.46",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^21.0.0 || ^22.0.0",
@@ -51,6 +51,10 @@
51
51
  "types": "./types/acorex-platform-module-security-management-client-contracts-entities-user-role.d.ts",
52
52
  "default": "./fesm2022/acorex-platform-module-security-management-client-contracts-entities-user-role.mjs"
53
53
  },
54
+ "./contracts/entities/user-two-factor": {
55
+ "types": "./types/acorex-platform-module-security-management-client-contracts-entities-user-two-factor.d.ts",
56
+ "default": "./fesm2022/acorex-platform-module-security-management-client-contracts-entities-user-two-factor.mjs"
57
+ },
54
58
  "./contracts/entities/users": {
55
59
  "types": "./types/acorex-platform-module-security-management-client-contracts-entities-users.d.ts",
56
60
  "default": "./fesm2022/acorex-platform-module-security-management-client-contracts-entities-users.mjs"
@@ -0,0 +1,9 @@
1
+ import { AXPEntity } from '@acorex-platform/framework-shared/entity';
2
+
3
+ /**
4
+ * Schema-only entity for authenticator enrollment.
5
+ * No secret fields in UI; all mutations go through dedicated 2FA commands.
6
+ */
7
+ declare function userTwoFactorFactory(): Promise<AXPEntity | null>;
8
+
9
+ export { userTwoFactorFactory };
@@ -1,5 +1,5 @@
1
- import { AXPContextDefinition, AXPExpression } from '@acorex-platform/framework-shared/core';
2
- import { AXPEntityModel } from '@acorex-platform/framework-shared/entity';
1
+ import { AXPContextDefinition, AXPModuleManifest, AXPExpression } from '@acorex-platform/framework-shared/core';
2
+ import { AXPEntityModel, AXPEntity } from '@acorex-platform/framework-shared/entity';
3
3
 
4
4
  declare const AXM_SECURITY_CONTEXT_DEFINITIONS: AXPContextDefinition[];
5
5
 
@@ -153,6 +153,12 @@ declare const RootConfig: {
153
153
  readonly titlePlural: `@${string}:identity-providers.entities.identity-provider.plural`;
154
154
  readonly icon: "fa-light fa-id-badge";
155
155
  };
156
+ readonly userTwoFactor: {
157
+ readonly name: "UserTwoFactor";
158
+ readonly title: `@${string}:user-two-factor.entities.user-two-factor.title`;
159
+ readonly titlePlural: `@${string}:user-two-factor.entities.user-two-factor.plural`;
160
+ readonly icon: "fa-light fa-shield-keyhole";
161
+ };
156
162
  };
157
163
  readonly queries: {
158
164
  readonly reports: {
@@ -165,6 +171,12 @@ declare const RootConfig: {
165
171
  };
166
172
  };
167
173
 
174
+ /**
175
+ * Security Management Module Manifest.
176
+ * Defines module metadata, features, and provider references.
177
+ */
178
+ declare const SecurityManagementManifest: AXPModuleManifest;
179
+
168
180
  /** Status provider key for `accessState` on SecurityManagement.User (transitions define editable paths in the status UI). */
169
181
  declare const AXM_USER_ACCESS_STATE_DEFINITION_KEY = "security-management.access-state.user";
170
182
 
@@ -213,10 +225,51 @@ interface AXMUserPasswordResetInfo {
213
225
  sentAt: string;
214
226
  }
215
227
 
228
+ /**
229
+ * Invitation challenge / audit metadata on TenantManagement.TenantUser.
230
+ * The raw token is never persisted — only a SHA-256 hash while the invite is pending.
231
+ */
232
+ interface AXMUserInvitationInfo {
233
+ /** Present only while `TenantUser.statusId` is pending; cleared after resolve. */
234
+ tokenHash?: string;
235
+ expiresAt: string;
236
+ sentAt: string;
237
+ invitedByUserId: string;
238
+ applicationIds?: string[];
239
+ /** Always `invite` for rows created/updated by Invite (not create-in-tenant). */
240
+ source: 'invite';
241
+ /** Set when the invitee accepts; distinguishes accepted invite from create-in-tenant. */
242
+ acceptedAt?: string;
243
+ }
244
+ /** How a User identity row was created (directory provenance). */
245
+ type AXMUserCreatedVia = 'invite' | 'create-in-tenant' | 'register' | 'seed' | 'idp';
246
+ /**
247
+ * In-app inbox definition for membership invites to users who already have a tenant.
248
+ * Inbox row action opens the auth waiting room (Approve/Decline live there).
249
+ */
250
+ declare const AXM_MEMBERSHIP_INVITATION_NOTIFICATION_DEFINITION_KEY: "security-management.membership-invitation";
251
+ /** Query `source` value when opening waiting room from a membership-invite notification. */
252
+ declare const AXM_MEMBERSHIP_INVITE_WAITING_ROOM_SOURCE: "membership-invite";
253
+
216
254
  declare const AXMSecurityManagementServerCommands: {
217
255
  readonly SendPasswordResetEmail: "SecurityManagement:Server:SendPasswordResetEmail";
218
256
  readonly CompletePasswordReset: "SecurityManagement:Server:CompletePasswordReset";
219
257
  readonly ChangeOwnPassword: "SecurityManagement:Server:ChangeOwnPassword";
258
+ readonly InviteUser: "SecurityManagement:Server:InviteUser";
259
+ readonly ResendInvitation: "SecurityManagement:Server:ResendInvitation";
260
+ readonly CancelInvitation: "SecurityManagement:Server:CancelInvitation";
261
+ readonly AcceptInvitation: "SecurityManagement:Server:AcceptInvitation";
262
+ readonly ListMyPendingInvitations: "SecurityManagement:Server:ListMyPendingInvitations";
263
+ readonly DeclineInvitation: "SecurityManagement:Server:DeclineInvitation";
264
+ readonly AcceptMyInvitation: "SecurityManagement:Server:AcceptMyInvitation";
265
+ readonly StartTwoFactorEnrollment: "SecurityManagement:Server:StartTwoFactorEnrollment";
266
+ readonly ConfirmTwoFactorEnrollment: "SecurityManagement:Server:ConfirmTwoFactorEnrollment";
267
+ readonly DisableTwoFactor: "SecurityManagement:Server:DisableTwoFactor";
268
+ readonly GenerateTwoFactorRecoveryCodes: "SecurityManagement:Server:GenerateTwoFactorRecoveryCodes";
269
+ readonly GetTwoFactorStatus: "SecurityManagement:Server:GetTwoFactorStatus";
270
+ readonly AdminResetTwoFactor: "SecurityManagement:Server:AdminResetTwoFactor";
271
+ /** Public — completes login after password challenge (TOTP or recovery). */
272
+ readonly VerifyTwoFactorLogin: "SecurityManagement:Server:VerifyTwoFactorLogin";
220
273
  };
221
274
  /** Stable codes for self-service password change (client maps to i18n). */
222
275
  declare const AXM_CHANGE_OWN_PASSWORD_ERROR_CODES: {
@@ -227,6 +280,12 @@ declare const AXM_CHANGE_OWN_PASSWORD_ERROR_CODES: {
227
280
  };
228
281
  /** Client/UI action key (confirm dialog → server send). */
229
282
  declare const AXM_USER_SEND_PASSWORD_RESET_COMMAND = "SecurityManagement:User:SendPasswordResetEmail";
283
+ /** Client/UI action key (confirm dialog → server admin reset 2FA). */
284
+ declare const AXM_USER_RESET_TWO_FACTOR_COMMAND = "SecurityManagement:User:ResetTwoFactor";
285
+ /** Client/UI action keys for invite flows. */
286
+ declare const AXM_USER_INVITE_COMMAND = "SecurityManagement:User:Invite";
287
+ declare const AXM_USER_RESEND_INVITATION_COMMAND = "SecurityManagement:User:ResendInvitation";
288
+ declare const AXM_USER_CANCEL_INVITATION_COMMAND = "SecurityManagement:User:CancelInvitation";
230
289
  interface AXMSendPasswordResetEmailInput {
231
290
  /** Admin path: target user id. */
232
291
  userId?: string;
@@ -246,6 +305,137 @@ interface AXMChangeOwnPasswordInput {
246
305
  interface AXMChangeOwnPasswordResult {
247
306
  passwordChangedAt: string;
248
307
  }
308
+ interface AXMInviteUserInput {
309
+ email: string;
310
+ displayName?: string;
311
+ applicationIds?: string[];
312
+ /** Client sets true after warning that the identity already exists. */
313
+ confirmExisting?: boolean;
314
+ webOrigin?: string;
315
+ }
316
+ interface AXMInviteUserResult {
317
+ userId: string;
318
+ tenantUserId: string;
319
+ userAlreadyExists: boolean;
320
+ sent: boolean;
321
+ }
322
+ interface AXMResendInvitationInput {
323
+ tenantUserId?: string;
324
+ userId?: string;
325
+ webOrigin?: string;
326
+ }
327
+ interface AXMCancelInvitationInput {
328
+ tenantUserId?: string;
329
+ userId?: string;
330
+ }
331
+ /** Stable codes for public invitation accept (client maps invalid/expired to the page, not a toast). */
332
+ declare const AXM_ACCEPT_INVITATION_ERROR_CODES: {
333
+ readonly Invalid: "ACCEPT_INVITATION_INVALID";
334
+ readonly Expired: "ACCEPT_INVITATION_EXPIRED";
335
+ readonly PasswordRequired: "ACCEPT_INVITATION_PASSWORD_REQUIRED";
336
+ };
337
+ type AXMAcceptInvitationReason = 'valid' | 'invalid' | 'expired';
338
+ interface AXMAcceptInvitationInput {
339
+ token: string;
340
+ newPassword?: string;
341
+ /** Check the token only. Does not set a password or consume the link. */
342
+ preview?: boolean;
343
+ }
344
+ interface AXMAcceptInvitationPreviewResult {
345
+ usable: boolean;
346
+ reason: AXMAcceptInvitationReason;
347
+ }
348
+ interface AXMPendingInvitationItem {
349
+ tenantUserId: string;
350
+ tenantId: string;
351
+ tenantTitle?: string;
352
+ invitedByUserId?: string;
353
+ expiresAt?: string;
354
+ sentAt?: string;
355
+ applicationIds?: string[];
356
+ }
357
+ interface AXMListMyPendingInvitationsResult {
358
+ items: AXMPendingInvitationItem[];
359
+ }
360
+ interface AXMAcceptMyInvitationInput {
361
+ tenantUserId: string;
362
+ newPassword?: string;
363
+ }
364
+ interface AXMDeclineInvitationInput {
365
+ tenantUserId: string;
366
+ }
367
+ /** Stable codes for two-factor self-service and login challenge (client maps to i18n). */
368
+ declare const AXM_TWO_FACTOR_ERROR_CODES: {
369
+ readonly NotSignedIn: "TWO_FACTOR_NOT_SIGNED_IN";
370
+ readonly InvalidInput: "TWO_FACTOR_INVALID_INPUT";
371
+ readonly IncorrectPassword: "TWO_FACTOR_INCORRECT_PASSWORD";
372
+ readonly IncorrectCode: "TWO_FACTOR_INCORRECT_CODE";
373
+ readonly AlreadyEnabled: "TWO_FACTOR_ALREADY_ENABLED";
374
+ readonly NotEnabled: "TWO_FACTOR_NOT_ENABLED";
375
+ readonly EnrollmentExpired: "TWO_FACTOR_ENROLLMENT_EXPIRED";
376
+ readonly ChallengeExpired: "TWO_FACTOR_CHALLENGE_EXPIRED";
377
+ readonly RateLimited: "TWO_FACTOR_RATE_LIMITED";
378
+ readonly InvalidConfiguration: "TWO_FACTOR_INVALID_CONFIGURATION";
379
+ readonly ProofRequired: "TWO_FACTOR_PROOF_REQUIRED";
380
+ readonly UserNotFound: "TWO_FACTOR_USER_NOT_FOUND";
381
+ readonly Forbidden: "TWO_FACTOR_FORBIDDEN";
382
+ };
383
+ interface AXMStartTwoFactorEnrollmentInput {
384
+ password: string;
385
+ }
386
+ interface AXMStartTwoFactorEnrollmentResult {
387
+ enrollmentId: string;
388
+ otpauthUri: string;
389
+ /** Base32 secret for manual entry (client renders QR via ax-qrcode). */
390
+ secretBase32: string;
391
+ expiresAt: string;
392
+ }
393
+ interface AXMConfirmTwoFactorEnrollmentInput {
394
+ enrollmentId: string;
395
+ code: string;
396
+ }
397
+ interface AXMConfirmTwoFactorEnrollmentResult {
398
+ enabled: true;
399
+ verifiedAt: string;
400
+ }
401
+ interface AXMDisableTwoFactorInput {
402
+ /** At least one of password or totpCode is required. */
403
+ password?: string;
404
+ totpCode?: string;
405
+ }
406
+ interface AXMDisableTwoFactorResult {
407
+ enabled: false;
408
+ }
409
+ interface AXMGenerateTwoFactorRecoveryCodesInput {
410
+ /** At least one of password or totpCode is required. */
411
+ password?: string;
412
+ totpCode?: string;
413
+ }
414
+ interface AXMGenerateTwoFactorRecoveryCodesResult {
415
+ /** Plaintext codes shown once only (display format ABCD-EFGH). */
416
+ codes: string[];
417
+ }
418
+ interface AXMGetTwoFactorStatusResult {
419
+ enabled: boolean;
420
+ enrolled: boolean;
421
+ verifiedAt?: string | null;
422
+ hasRecoveryCodes: boolean;
423
+ unusedRecoveryCodeCount: number;
424
+ }
425
+ interface AXMAdminResetTwoFactorInput {
426
+ userId: string;
427
+ /** When true, only validates that 2FA is enabled; does not wipe or revoke sessions. */
428
+ dryRun?: boolean;
429
+ }
430
+ interface AXMAdminResetTwoFactorResult {
431
+ reset: boolean;
432
+ }
433
+ interface AXMVerifyTwoFactorLoginInput {
434
+ challengeId: string;
435
+ /** TOTP (6 digits) or recovery code. */
436
+ code: string;
437
+ rememberMe?: boolean;
438
+ }
249
439
 
250
440
  declare enum AXMSessionStatusTypes {
251
441
  revoked = "revoked",
@@ -409,6 +599,36 @@ interface AXMSecurityManagementUserRoleEntityModel extends AXPEntityModel<string
409
599
  roleIds: string[];
410
600
  }
411
601
 
602
+ type AXMUserTwoFactorMethod = 'authenticator';
603
+ interface AXMUserTwoFactorRecoveryCode {
604
+ hash: string;
605
+ /** Salt / hashing metadata (e.g. full pbkdf2 encoded string already embeds salt — optional extra). */
606
+ salt?: string;
607
+ usedAt?: string | null;
608
+ }
609
+ /**
610
+ * Persisted authenticator enrollment for one user.
611
+ * Secrets must never be returned on client/entity APIs.
612
+ */
613
+ interface AXMSecurityManagementUserTwoFactorEntityModel extends AXPEntityModel<string> {
614
+ userId: string;
615
+ method: AXMUserTwoFactorMethod;
616
+ encryptedSecret: string;
617
+ iv: string;
618
+ authTag: string;
619
+ keyVersion: number;
620
+ verifiedAt: string;
621
+ /** Last accepted TOTP time-step (floor(unix/period)); replay guard. */
622
+ lastAcceptedStep?: number | null;
623
+ recoveryCodes?: AXMUserTwoFactorRecoveryCode[];
624
+ }
625
+
626
+ /**
627
+ * Schema-only entity for authenticator enrollment.
628
+ * No secret fields in UI; all mutations go through dedicated 2FA commands.
629
+ */
630
+ declare function userTwoFactorFactory(): Promise<AXPEntity | null>;
631
+
412
632
  interface AXMSecurityManagementUsersEntityModel extends AXPEntityModel<string> {
413
633
  id: string;
414
634
  username: string;
@@ -448,5 +668,5 @@ interface AXMSecurityManagementUsersEntityModel extends AXPEntityModel<string> {
448
668
  passwordReset?: AXMUserPasswordResetInfo | null;
449
669
  }
450
670
 
451
- export { AXMSecurityManagementServerCommands, AXMSessionStatusTypes, AXMUserAccessState, AXMUserEffectiveState, AXM_CHANGE_OWN_PASSWORD_ERROR_CODES, AXM_IDENTITY_PROVIDER_PROTOCOL, AXM_SECURITY_CONTEXT_DEFINITIONS, AXM_USER_ACCESS_STATE_DEFINITION_KEY, AXM_USER_EFFECTIVE_STATE_DEFINITION_KEY, AXM_USER_SEND_PASSWORD_RESET_COMMAND, AXPAdministrationPermissionKeys, AXPSecurityManagementFeatureKeys, AXPSecurityManagementMenuKeys, AXPSecurityManagementPermissionKeys, ROLE_PERMISSIONS_PAGE_COMPONENT_KEY, RootConfig, USER_ROLES_PAGE_COMPONENT_KEY, resolveAXMUserEffectiveState };
452
- export type { AXMChangeOwnPasswordInput, AXMChangeOwnPasswordResult, AXMCompletePasswordResetInput, AXMIdentityProviderEntityModel, AXMIdentityProviderProtocol, AXMPolicyEffect, AXMPolicyEffectRule, AXMPolicyScope, AXMSecurityManagementDeviceSessionsEntityModel, AXMSecurityManagementPolicyEntityModel, AXMSecurityManagementProfileEntityModel, AXMSecurityManagementRolePermissionEntityModel, AXMSecurityManagementRolesEntityModel, AXMSecurityManagementUserRoleEntityModel, AXMSecurityManagementUsersEntityModel, AXMSendPasswordResetEmailInput, AXMUserPasswordResetInfo };
671
+ export { AXMSecurityManagementServerCommands, AXMSessionStatusTypes, AXMUserAccessState, AXMUserEffectiveState, AXM_ACCEPT_INVITATION_ERROR_CODES, AXM_CHANGE_OWN_PASSWORD_ERROR_CODES, AXM_IDENTITY_PROVIDER_PROTOCOL, AXM_MEMBERSHIP_INVITATION_NOTIFICATION_DEFINITION_KEY, AXM_MEMBERSHIP_INVITE_WAITING_ROOM_SOURCE, AXM_SECURITY_CONTEXT_DEFINITIONS, AXM_TWO_FACTOR_ERROR_CODES, AXM_USER_ACCESS_STATE_DEFINITION_KEY, AXM_USER_CANCEL_INVITATION_COMMAND, AXM_USER_EFFECTIVE_STATE_DEFINITION_KEY, AXM_USER_INVITE_COMMAND, AXM_USER_RESEND_INVITATION_COMMAND, AXM_USER_RESET_TWO_FACTOR_COMMAND, AXM_USER_SEND_PASSWORD_RESET_COMMAND, AXPAdministrationPermissionKeys, AXPSecurityManagementFeatureKeys, AXPSecurityManagementMenuKeys, AXPSecurityManagementPermissionKeys, ROLE_PERMISSIONS_PAGE_COMPONENT_KEY, RootConfig, SecurityManagementManifest, USER_ROLES_PAGE_COMPONENT_KEY, resolveAXMUserEffectiveState, userTwoFactorFactory };
672
+ export type { AXMAcceptInvitationInput, AXMAcceptInvitationPreviewResult, AXMAcceptInvitationReason, AXMAcceptMyInvitationInput, AXMAdminResetTwoFactorInput, AXMAdminResetTwoFactorResult, AXMCancelInvitationInput, AXMChangeOwnPasswordInput, AXMChangeOwnPasswordResult, AXMCompletePasswordResetInput, AXMConfirmTwoFactorEnrollmentInput, AXMConfirmTwoFactorEnrollmentResult, AXMDeclineInvitationInput, AXMDisableTwoFactorInput, AXMDisableTwoFactorResult, AXMGenerateTwoFactorRecoveryCodesInput, AXMGenerateTwoFactorRecoveryCodesResult, AXMGetTwoFactorStatusResult, AXMIdentityProviderEntityModel, AXMIdentityProviderProtocol, AXMInviteUserInput, AXMInviteUserResult, AXMListMyPendingInvitationsResult, AXMPendingInvitationItem, AXMPolicyEffect, AXMPolicyEffectRule, AXMPolicyScope, AXMResendInvitationInput, AXMSecurityManagementDeviceSessionsEntityModel, AXMSecurityManagementPolicyEntityModel, AXMSecurityManagementProfileEntityModel, AXMSecurityManagementRolePermissionEntityModel, AXMSecurityManagementRolesEntityModel, AXMSecurityManagementUserRoleEntityModel, AXMSecurityManagementUserTwoFactorEntityModel, AXMSecurityManagementUsersEntityModel, AXMSendPasswordResetEmailInput, AXMStartTwoFactorEnrollmentInput, AXMStartTwoFactorEnrollmentResult, AXMUserCreatedVia, AXMUserInvitationInfo, AXMUserPasswordResetInfo, AXMUserTwoFactorMethod, AXMUserTwoFactorRecoveryCode, AXMVerifyTwoFactorLoginInput };