@thunderid/react 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/account/UserProfile/BaseUserProfile.cjs +1 -1
- package/dist/cjs/components/admin/AgentDetails/AgentDetails.cjs +13 -2
- package/dist/cjs/components/admin/AgentDetails/AgentDetails.cjs.map +1 -1
- package/dist/cjs/components/admin/AgentDetails/BaseAgentDetails.cjs +25 -7
- package/dist/cjs/components/admin/AgentDetails/BaseAgentDetails.cjs.map +1 -1
- package/dist/cjs/components/admin/ApplicationDetails/ApplicationDetails.cjs +15 -2
- package/dist/cjs/components/admin/ApplicationDetails/ApplicationDetails.cjs.map +1 -1
- package/dist/cjs/components/admin/ApplicationDetails/BaseApplicationDetails.cjs +24 -7
- package/dist/cjs/components/admin/ApplicationDetails/BaseApplicationDetails.cjs.map +1 -1
- package/dist/cjs/components/admin/GroupMembers/GroupMembers.cjs +2 -1
- package/dist/cjs/components/admin/GroupMembers/GroupMembers.cjs.map +1 -1
- package/dist/cjs/components/admin/RoleAssignments/RoleAssignments.cjs +2 -1
- package/dist/cjs/components/admin/RoleAssignments/RoleAssignments.cjs.map +1 -1
- package/dist/cjs/components/admin/UserDetails/BaseUserDetails.cjs +32 -14
- package/dist/cjs/components/admin/UserDetails/BaseUserDetails.cjs.map +1 -1
- package/dist/cjs/components/admin/UserDetails/UserDetails.cjs +14 -2
- package/dist/cjs/components/admin/UserDetails/UserDetails.cjs.map +1 -1
- package/dist/cjs/components/admin/shared/AccountLifecycleParts.cjs +105 -0
- package/dist/cjs/components/admin/shared/AccountLifecycleParts.cjs.map +1 -0
- package/dist/cjs/components/admin/shared/ApplicationFormFields.cjs +1 -1
- package/dist/cjs/components/auth/AcceptInvite/BaseAcceptInvite.cjs +4 -5
- package/dist/cjs/components/auth/AcceptInvite/BaseAcceptInvite.cjs.map +1 -1
- package/dist/cjs/components/auth/SignIn/SignIn.cjs +5 -5
- package/dist/cjs/components/auth/SignIn/SignIn.cjs.map +1 -1
- package/dist/cjs/components/auth/flow/AuthOptionFactory.cjs +4 -5
- package/dist/cjs/components/auth/flow/AuthOptionFactory.cjs.map +1 -1
- package/dist/cjs/components/auth/flow/Consent.cjs +53 -28
- package/dist/cjs/components/auth/flow/Consent.cjs.map +1 -1
- package/dist/cjs/components/auth/flow/ConsentAuthorizationDetail.cjs +104 -0
- package/dist/cjs/components/auth/flow/ConsentAuthorizationDetail.cjs.map +1 -0
- package/dist/cjs/components/auth/flow/ConsentAuthorizationDetail.styles.cjs +59 -0
- package/dist/cjs/components/auth/flow/ConsentAuthorizationDetail.styles.cjs.map +1 -0
- package/dist/cjs/components/auth/flow/ConsentDetailField.cjs +171 -0
- package/dist/cjs/components/auth/flow/ConsentDetailField.cjs.map +1 -0
- package/dist/cjs/components/auth/flow/ConsentDetailField.styles.cjs +85 -0
- package/dist/cjs/components/auth/flow/ConsentDetailField.styles.cjs.map +1 -0
- package/dist/cjs/components/auth/flow/ConsentDetailText.cjs +63 -0
- package/dist/cjs/components/auth/flow/ConsentDetailText.cjs.map +1 -0
- package/dist/cjs/components/auth/flow/ConsentDetailText.styles.cjs +83 -0
- package/dist/cjs/components/auth/flow/ConsentDetailText.styles.cjs.map +1 -0
- package/dist/cjs/components/auth/flow/FieldFactory.cjs +1 -1
- package/dist/cjs/components/auth/flow/resolveConsentText.cjs +25 -0
- package/dist/cjs/components/auth/flow/resolveConsentText.cjs.map +1 -0
- package/dist/cjs/components/primitives/KeyValueInput/KeyValueInput.cjs +1 -1
- package/dist/cjs/components/primitives/MultiInput/MultiInput.cjs +1 -1
- package/dist/cjs/components/primitives/PasswordField/PasswordField.cjs +1 -1
- package/dist/cjs/hooks/auth/useConsentDetailField.cjs +357 -0
- package/dist/cjs/hooks/auth/useConsentDetailField.cjs.map +1 -0
- package/dist/cjs/hooks/management/useAccountLifecycle.cjs +59 -0
- package/dist/cjs/hooks/management/useAccountLifecycle.cjs.map +1 -0
- package/dist/cjs/index.cjs +66 -1
- package/dist/cjs/utils/formatConsentDetailValue.cjs +26 -0
- package/dist/cjs/utils/formatConsentDetailValue.cjs.map +1 -0
- package/dist/cjs/utils/getConsentDetailLayout.cjs +44 -0
- package/dist/cjs/utils/getConsentDetailLayout.cjs.map +1 -0
- package/dist/cjs/utils/getConsentDetailListDisplay.cjs +30 -0
- package/dist/cjs/utils/getConsentDetailListDisplay.cjs.map +1 -0
- package/dist/cjs/utils/isConsentApprovalBlocked.cjs +41 -0
- package/dist/cjs/utils/isConsentApprovalBlocked.cjs.map +1 -0
- package/dist/cjs/utils/isConsentDetailPlainList.cjs +24 -0
- package/dist/cjs/utils/isConsentDetailPlainList.cjs.map +1 -0
- package/dist/cjs/utils/isConsentDetailStructured.cjs +15 -0
- package/dist/cjs/utils/isConsentDetailStructured.cjs.map +1 -0
- package/dist/cjs/utils/isConsentDetailTextClamped.cjs +25 -0
- package/dist/cjs/utils/isConsentDetailTextClamped.cjs.map +1 -0
- package/dist/components/account/UserProfile/BaseUserProfile.js +1 -1
- package/dist/components/admin/AgentDetails/AgentDetails.d.ts +8 -1
- package/dist/components/admin/AgentDetails/AgentDetails.d.ts.map +1 -1
- package/dist/components/admin/AgentDetails/AgentDetails.js +13 -2
- package/dist/components/admin/AgentDetails/AgentDetails.js.map +1 -1
- package/dist/components/admin/AgentDetails/BaseAgentDetails.d.ts +21 -1
- package/dist/components/admin/AgentDetails/BaseAgentDetails.d.ts.map +1 -1
- package/dist/components/admin/AgentDetails/BaseAgentDetails.js +25 -7
- package/dist/components/admin/AgentDetails/BaseAgentDetails.js.map +1 -1
- package/dist/components/admin/ApplicationDetails/ApplicationDetails.d.ts +15 -1
- package/dist/components/admin/ApplicationDetails/ApplicationDetails.d.ts.map +1 -1
- package/dist/components/admin/ApplicationDetails/ApplicationDetails.js +15 -2
- package/dist/components/admin/ApplicationDetails/ApplicationDetails.js.map +1 -1
- package/dist/components/admin/ApplicationDetails/BaseApplicationDetails.d.ts +20 -1
- package/dist/components/admin/ApplicationDetails/BaseApplicationDetails.d.ts.map +1 -1
- package/dist/components/admin/ApplicationDetails/BaseApplicationDetails.js +24 -7
- package/dist/components/admin/ApplicationDetails/BaseApplicationDetails.js.map +1 -1
- package/dist/components/admin/GroupMembers/GroupMembers.d.ts +7 -0
- package/dist/components/admin/GroupMembers/GroupMembers.d.ts.map +1 -1
- package/dist/components/admin/GroupMembers/GroupMembers.js +2 -1
- package/dist/components/admin/GroupMembers/GroupMembers.js.map +1 -1
- package/dist/components/admin/RoleAssignments/RoleAssignments.d.ts +7 -0
- package/dist/components/admin/RoleAssignments/RoleAssignments.d.ts.map +1 -1
- package/dist/components/admin/RoleAssignments/RoleAssignments.js +2 -1
- package/dist/components/admin/RoleAssignments/RoleAssignments.js.map +1 -1
- package/dist/components/admin/UserDetails/BaseUserDetails.d.ts +22 -1
- package/dist/components/admin/UserDetails/BaseUserDetails.d.ts.map +1 -1
- package/dist/components/admin/UserDetails/BaseUserDetails.js +32 -14
- package/dist/components/admin/UserDetails/BaseUserDetails.js.map +1 -1
- package/dist/components/admin/UserDetails/UserDetails.d.ts +15 -1
- package/dist/components/admin/UserDetails/UserDetails.d.ts.map +1 -1
- package/dist/components/admin/UserDetails/UserDetails.js +14 -2
- package/dist/components/admin/UserDetails/UserDetails.js.map +1 -1
- package/dist/components/admin/shared/AccountLifecycleParts.d.ts +32 -0
- package/dist/components/admin/shared/AccountLifecycleParts.d.ts.map +1 -0
- package/dist/components/admin/shared/AccountLifecycleParts.js +101 -0
- package/dist/components/admin/shared/AccountLifecycleParts.js.map +1 -0
- package/dist/components/admin/shared/ApplicationFormFields.js +1 -1
- package/dist/components/auth/AcceptInvite/BaseAcceptInvite.d.ts.map +1 -1
- package/dist/components/auth/AcceptInvite/BaseAcceptInvite.js +5 -6
- package/dist/components/auth/AcceptInvite/BaseAcceptInvite.js.map +1 -1
- package/dist/components/auth/SignIn/SignIn.d.ts.map +1 -1
- package/dist/components/auth/SignIn/SignIn.js +6 -6
- package/dist/components/auth/SignIn/SignIn.js.map +1 -1
- package/dist/components/auth/flow/AuthOptionFactory.d.ts.map +1 -1
- package/dist/components/auth/flow/AuthOptionFactory.js +5 -6
- package/dist/components/auth/flow/AuthOptionFactory.js.map +1 -1
- package/dist/components/auth/flow/Consent.d.ts +6 -0
- package/dist/components/auth/flow/Consent.d.ts.map +1 -1
- package/dist/components/auth/flow/Consent.js +54 -29
- package/dist/components/auth/flow/Consent.js.map +1 -1
- package/dist/components/auth/flow/ConsentAuthorizationDetail.d.ts +68 -0
- package/dist/components/auth/flow/ConsentAuthorizationDetail.d.ts.map +1 -0
- package/dist/components/auth/flow/ConsentAuthorizationDetail.js +100 -0
- package/dist/components/auth/flow/ConsentAuthorizationDetail.js.map +1 -0
- package/dist/components/auth/flow/ConsentAuthorizationDetail.styles.d.ts +10 -0
- package/dist/components/auth/flow/ConsentAuthorizationDetail.styles.d.ts.map +1 -0
- package/dist/components/auth/flow/ConsentAuthorizationDetail.styles.js +57 -0
- package/dist/components/auth/flow/ConsentAuthorizationDetail.styles.js.map +1 -0
- package/dist/components/auth/flow/ConsentDetailField.d.ts +39 -0
- package/dist/components/auth/flow/ConsentDetailField.d.ts.map +1 -0
- package/dist/components/auth/flow/ConsentDetailField.js +168 -0
- package/dist/components/auth/flow/ConsentDetailField.js.map +1 -0
- package/dist/components/auth/flow/ConsentDetailField.styles.d.ts +11 -0
- package/dist/components/auth/flow/ConsentDetailField.styles.d.ts.map +1 -0
- package/dist/components/auth/flow/ConsentDetailField.styles.js +83 -0
- package/dist/components/auth/flow/ConsentDetailField.styles.js.map +1 -0
- package/dist/components/auth/flow/ConsentDetailText.d.ts +53 -0
- package/dist/components/auth/flow/ConsentDetailText.d.ts.map +1 -0
- package/dist/components/auth/flow/ConsentDetailText.js +58 -0
- package/dist/components/auth/flow/ConsentDetailText.js.map +1 -0
- package/dist/components/auth/flow/ConsentDetailText.styles.d.ts +20 -0
- package/dist/components/auth/flow/ConsentDetailText.styles.d.ts.map +1 -0
- package/dist/components/auth/flow/ConsentDetailText.styles.js +80 -0
- package/dist/components/auth/flow/ConsentDetailText.styles.js.map +1 -0
- package/dist/components/auth/flow/FieldFactory.js +1 -1
- package/dist/components/auth/flow/resolveConsentText.d.ts +13 -0
- package/dist/components/auth/flow/resolveConsentText.d.ts.map +1 -0
- package/dist/components/auth/flow/resolveConsentText.js +23 -0
- package/dist/components/auth/flow/resolveConsentText.js.map +1 -0
- package/dist/components/primitives/KeyValueInput/KeyValueInput.js +1 -1
- package/dist/components/primitives/MultiInput/MultiInput.js +1 -1
- package/dist/components/primitives/PasswordField/PasswordField.js +1 -1
- package/dist/hooks/auth/useConsentDetailField.d.ts +130 -0
- package/dist/hooks/auth/useConsentDetailField.d.ts.map +1 -0
- package/dist/hooks/auth/useConsentDetailField.js +354 -0
- package/dist/hooks/auth/useConsentDetailField.js.map +1 -0
- package/dist/hooks/management/useAccountLifecycle.d.ts +49 -0
- package/dist/hooks/management/useAccountLifecycle.d.ts.map +1 -0
- package/dist/hooks/management/useAccountLifecycle.js +56 -0
- package/dist/hooks/management/useAccountLifecycle.js.map +1 -0
- package/dist/index.d.ts +16 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -3
- package/dist/utils/formatConsentDetailValue.d.ts +16 -0
- package/dist/utils/formatConsentDetailValue.d.ts.map +1 -0
- package/dist/utils/formatConsentDetailValue.js +25 -0
- package/dist/utils/formatConsentDetailValue.js.map +1 -0
- package/dist/utils/getConsentDetailLayout.d.ts +32 -0
- package/dist/utils/getConsentDetailLayout.d.ts.map +1 -0
- package/dist/utils/getConsentDetailLayout.js +43 -0
- package/dist/utils/getConsentDetailLayout.js.map +1 -0
- package/dist/utils/getConsentDetailListDisplay.d.ts +30 -0
- package/dist/utils/getConsentDetailListDisplay.d.ts.map +1 -0
- package/dist/utils/getConsentDetailListDisplay.js +30 -0
- package/dist/utils/getConsentDetailListDisplay.js.map +1 -0
- package/dist/utils/isConsentApprovalBlocked.d.ts +17 -0
- package/dist/utils/isConsentApprovalBlocked.d.ts.map +1 -0
- package/dist/utils/isConsentApprovalBlocked.js +39 -0
- package/dist/utils/isConsentApprovalBlocked.js.map +1 -0
- package/dist/utils/isConsentDetailPlainList.d.ts +15 -0
- package/dist/utils/isConsentDetailPlainList.d.ts.map +1 -0
- package/dist/utils/isConsentDetailPlainList.js +23 -0
- package/dist/utils/isConsentDetailPlainList.js.map +1 -0
- package/dist/utils/isConsentDetailStructured.d.ts +10 -0
- package/dist/utils/isConsentDetailStructured.d.ts.map +1 -0
- package/dist/utils/isConsentDetailStructured.js +14 -0
- package/dist/utils/isConsentDetailStructured.js.map +1 -0
- package/dist/utils/isConsentDetailTextClamped.d.ts +20 -0
- package/dist/utils/isConsentDetailTextClamped.d.ts.map +1 -0
- package/dist/utils/isConsentDetailTextClamped.js +24 -0
- package/dist/utils/isConsentDetailTextClamped.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_useThunderID = require('../../contexts/ThunderID/useThunderID.cjs');
|
|
3
|
+
const require_useResourceQuery = require('./useResourceQuery.cjs');
|
|
4
|
+
const require_useResourceMutation = require('./useResourceMutation.cjs');
|
|
5
|
+
let __thunderid_browser = require("@thunderid/browser");
|
|
6
|
+
__thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
7
|
+
let react = require("react");
|
|
8
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
9
|
+
|
|
10
|
+
//#region src/hooks/management/useAccountLifecycle.ts
|
|
11
|
+
/**
|
|
12
|
+
* Offers the account lifecycle actions (suspend, unsuspend, unlock) of a user, agent or application and
|
|
13
|
+
* runs them. These actions have no management API endpoint: they run only through the administration
|
|
14
|
+
* flows the server configures, so an action is offered only when its flow is configured.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const lifecycle = useAccountLifecycle({enabled: true, invalidatedKeys: [[UserQueryKeys.USER, id]], kind: 'user', status, subject: id});
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
const useAccountLifecycle = ({ enabled, invalidatedKeys, kind, status, subject }) => {
|
|
22
|
+
const { baseUrl } = require_useThunderID.default();
|
|
23
|
+
const flows = require_useResourceQuery.default([
|
|
24
|
+
"administration-flows",
|
|
25
|
+
"account-lifecycle",
|
|
26
|
+
kind
|
|
27
|
+
], (fetcher) => (0, __thunderid_browser.resolveAdministrationFlows)({
|
|
28
|
+
baseUrl,
|
|
29
|
+
fetcher
|
|
30
|
+
}, Object.values(__thunderid_browser.AccountLifecycleFlowConfigKey[kind])), { enabled });
|
|
31
|
+
const execution = require_useResourceMutation.default(({ action, operatorNote }, fetcher) => (0, __thunderid_browser.runAccountLifecycleAction)({
|
|
32
|
+
action,
|
|
33
|
+
baseUrl,
|
|
34
|
+
fetcher,
|
|
35
|
+
kind,
|
|
36
|
+
operatorNote,
|
|
37
|
+
subject
|
|
38
|
+
}), () => invalidatedKeys);
|
|
39
|
+
return {
|
|
40
|
+
actions: (0, react.useMemo)(() => enabled && flows.data ? (0, __thunderid_browser.getAccountLifecycleActions)(kind, status, flows.data) : [], [
|
|
41
|
+
enabled,
|
|
42
|
+
flows.data,
|
|
43
|
+
kind,
|
|
44
|
+
status
|
|
45
|
+
]),
|
|
46
|
+
error: execution.error,
|
|
47
|
+
isRunning: execution.isLoading,
|
|
48
|
+
loadError: flows.error,
|
|
49
|
+
run: (action, operatorNote) => void execution.mutate({
|
|
50
|
+
action,
|
|
51
|
+
operatorNote
|
|
52
|
+
})
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
var useAccountLifecycle_default = useAccountLifecycle;
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
exports.default = useAccountLifecycle_default;
|
|
59
|
+
//# sourceMappingURL=useAccountLifecycle.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAccountLifecycle.cjs","names":["useThunderID","flows: ResourceQueryResult<Record<string, string>>","useResourceQuery","AccountLifecycleFlowConfigKey","execution: ResourceMutationResult<AccountLifecycleResult, AccountLifecycleVariables>","useResourceMutation"],"sources":["../../../../src/hooks/management/useAccountLifecycle.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n AccessStatusValue,\n AccountLifecycleAction,\n AccountLifecycleFlowConfigKey,\n AccountLifecycleResult,\n AccountLifecycleSubjectKind,\n ResourceQueryKey,\n getAccountLifecycleActions,\n resolveAdministrationFlows,\n runAccountLifecycleAction,\n} from '@thunderid/browser';\nimport {useMemo} from 'react';\nimport useResourceMutation, {ResourceMutationResult} from './useResourceMutation';\nimport useResourceQuery, {ResourceQueryResult} from './useResourceQuery';\nimport useThunderID from '../../contexts/ThunderID/useThunderID';\n\ninterface AccountLifecycleVariables {\n action: AccountLifecycleAction;\n operatorNote?: string;\n}\n\nexport interface AccountLifecycleOptions {\n /**\n * Whether to offer the actions at all. The configured flows are read only when it is on.\n */\n enabled: boolean;\n /**\n * Query keys to refetch after an action, such as the record and the list it appears in.\n */\n invalidatedKeys: ResourceQueryKey[];\n kind: AccountLifecycleSubjectKind;\n /**\n * The identity's effective access status, from the read that rendered it.\n */\n status: AccessStatusValue | undefined;\n /**\n * Identifier of the user, agent or application.\n */\n subject: string;\n}\n\nexport interface AccountLifecycleState {\n /**\n * The actions to offer now: allowed by the status and backed by a configured flow.\n */\n actions: AccountLifecycleAction[];\n /**\n * Why the last action failed.\n */\n error: Error | null;\n isRunning: boolean;\n /**\n * Why the configured flows could not be read, so no action can be offered.\n */\n loadError: Error | null;\n run: (action: AccountLifecycleAction, operatorNote?: string) => void;\n}\n\n/**\n * Offers the account lifecycle actions (suspend, unsuspend, unlock) of a user, agent or application and\n * runs them. These actions have no management API endpoint: they run only through the administration\n * flows the server configures, so an action is offered only when its flow is configured.\n *\n * @example\n * ```tsx\n * const lifecycle = useAccountLifecycle({enabled: true, invalidatedKeys: [[UserQueryKeys.USER, id]], kind: 'user', status, subject: id});\n * ```\n */\nconst useAccountLifecycle = ({\n enabled,\n invalidatedKeys,\n kind,\n status,\n subject,\n}: AccountLifecycleOptions): AccountLifecycleState => {\n const {baseUrl} = useThunderID();\n const flows: ResourceQueryResult<Record<string, string>> = useResourceQuery(\n ['administration-flows', 'account-lifecycle', kind],\n (fetcher) => resolveAdministrationFlows({baseUrl, fetcher}, Object.values(AccountLifecycleFlowConfigKey[kind])),\n {enabled},\n );\n const execution: ResourceMutationResult<AccountLifecycleResult, AccountLifecycleVariables> = useResourceMutation(\n ({action, operatorNote}: AccountLifecycleVariables, fetcher) =>\n runAccountLifecycleAction({action, baseUrl, fetcher, kind, operatorNote, subject}),\n () => invalidatedKeys,\n );\n\n const actions: AccountLifecycleAction[] = useMemo(\n () => (enabled && flows.data ? getAccountLifecycleActions(kind, status, flows.data) : []),\n [enabled, flows.data, kind, status],\n );\n\n return {\n actions,\n error: execution.error,\n isRunning: execution.isLoading,\n loadError: flows.error,\n run: (action: AccountLifecycleAction, operatorNote?: string): void => void execution.mutate({action, operatorNote}),\n };\n};\n\nexport default useAccountLifecycle;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuEA,MAAM,uBAAuB,EAC3B,SACA,iBACA,MACA,QACA,cACoD;CACpD,MAAM,EAAC,YAAWA,8BAAc;CAChC,MAAMC,QAAqDC,iCACzD;EAAC;EAAwB;EAAqB;EAAK,GAClD,gEAAuC;EAAC;EAAS;EAAQ,EAAE,OAAO,OAAOC,kDAA8B,MAAM,CAAC,EAC/G,EAAC,SAAQ,CACV;CACD,MAAMC,YAAuFC,qCAC1F,EAAC,QAAQ,gBAA0C,+DACxB;EAAC;EAAQ;EAAS;EAAS;EAAM;EAAc;EAAQ,CAAC,QAC9E,gBACP;AAOD,QAAO;EACL,kCALO,WAAW,MAAM,2DAAkC,MAAM,QAAQ,MAAM,KAAK,GAAG,EAAE,EACxF;GAAC;GAAS,MAAM;GAAM;GAAM;GAAO,CACpC;EAIC,OAAO,UAAU;EACjB,WAAW,UAAU;EACrB,WAAW,MAAM;EACjB,MAAM,QAAgC,iBAAgC,KAAK,UAAU,OAAO;GAAC;GAAQ;GAAa,CAAC;EACpH;;AAGH,kCAAe"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -49,15 +49,23 @@ const require_FormControl = require('./components/primitives/FormControl/FormCon
|
|
|
49
49
|
const require_InputLabel = require('./components/primitives/InputLabel/InputLabel.cjs');
|
|
50
50
|
const require_Toggle = require('./components/primitives/Toggle/Toggle.cjs');
|
|
51
51
|
const require_ConsentCheckboxList = require('./components/auth/flow/ConsentCheckboxList.cjs');
|
|
52
|
+
const require_isConsentDetailTextClamped = require('./utils/isConsentDetailTextClamped.cjs');
|
|
53
|
+
const require_formatConsentDetailValue = require('./utils/formatConsentDetailValue.cjs');
|
|
54
|
+
const require_isConsentDetailStructured = require('./utils/isConsentDetailStructured.cjs');
|
|
55
|
+
const require_getConsentDetailLayout = require('./utils/getConsentDetailLayout.cjs');
|
|
56
|
+
const require_useConsentDetailField = require('./hooks/auth/useConsentDetailField.cjs');
|
|
57
|
+
const require_TextField = require('./components/primitives/TextField/TextField.cjs');
|
|
58
|
+
const require_ConsentDetailField = require('./components/auth/flow/ConsentDetailField.cjs');
|
|
59
|
+
const require_ConsentAuthorizationDetail = require('./components/auth/flow/ConsentAuthorizationDetail.cjs');
|
|
52
60
|
const require_Eye = require('./components/primitives/Icons/Eye.cjs');
|
|
53
61
|
const require_EyeOff = require('./components/primitives/Icons/EyeOff.cjs');
|
|
54
62
|
const require_LogOut = require('./components/primitives/Icons/LogOut.cjs');
|
|
55
63
|
const require_User = require('./components/primitives/Icons/User.cjs');
|
|
64
|
+
const require_isConsentApprovalBlocked = require('./utils/isConsentApprovalBlocked.cjs');
|
|
56
65
|
const require_Consent = require('./components/auth/flow/Consent.cjs');
|
|
57
66
|
const require_Checkbox = require('./components/primitives/Checkbox/Checkbox.cjs');
|
|
58
67
|
const require_DatePicker = require('./components/primitives/DatePicker/DatePicker.cjs');
|
|
59
68
|
const require_OtpField = require('./components/primitives/OtpField/OtpField.cjs');
|
|
60
|
-
const require_TextField = require('./components/primitives/TextField/TextField.cjs');
|
|
61
69
|
const require_PasswordField = require('./components/primitives/PasswordField/PasswordField.cjs');
|
|
62
70
|
const require_Select = require('./components/primitives/Select/Select.cjs');
|
|
63
71
|
const require_FieldFactory = require('./components/auth/flow/FieldFactory.cjs');
|
|
@@ -176,6 +184,12 @@ Object.defineProperty(exports, 'AVATAR_URI_SCHEME', {
|
|
|
176
184
|
}
|
|
177
185
|
});
|
|
178
186
|
exports.AcceptInvite = require_AcceptInvite.default;
|
|
187
|
+
Object.defineProperty(exports, 'AccountLifecycleFlowConfigKey', {
|
|
188
|
+
enumerable: true,
|
|
189
|
+
get: function () {
|
|
190
|
+
return __thunderid_browser.AccountLifecycleFlowConfigKey;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
179
193
|
Object.defineProperty(exports, 'AdministrationFlowConfigKey', {
|
|
180
194
|
enumerable: true,
|
|
181
195
|
get: function () {
|
|
@@ -262,6 +276,19 @@ exports.BaseUserSelect = require_BaseUserSelect.default;
|
|
|
262
276
|
exports.BaseUserTypeSelect = require_BaseUserTypeSelect.default;
|
|
263
277
|
exports.BuildingAlt = require_BuildingAlt.default;
|
|
264
278
|
exports.Button = require_Button.default;
|
|
279
|
+
exports.CONSENT_DETAIL_DISPLAY_LIMITS = require_getConsentDetailLayout.CONSENT_DETAIL_DISPLAY_LIMITS;
|
|
280
|
+
Object.defineProperty(exports, 'CONSENT_INVALID_KEY_PREFIX', {
|
|
281
|
+
enumerable: true,
|
|
282
|
+
get: function () {
|
|
283
|
+
return __thunderid_browser.CONSENT_INVALID_KEY_PREFIX;
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
Object.defineProperty(exports, 'CONSENT_MODIFIED_KEY_PREFIX', {
|
|
287
|
+
enumerable: true,
|
|
288
|
+
get: function () {
|
|
289
|
+
return __thunderid_browser.CONSENT_MODIFIED_KEY_PREFIX;
|
|
290
|
+
}
|
|
291
|
+
});
|
|
265
292
|
exports.Callback = require_Callback.Callback;
|
|
266
293
|
exports.Card = require_Card.default;
|
|
267
294
|
exports.ChangeCredential = require_ChangeCredential.default;
|
|
@@ -269,7 +296,9 @@ exports.Checkbox = require_Checkbox.default;
|
|
|
269
296
|
exports.CircleAlert = require_CircleAlert.default;
|
|
270
297
|
exports.CircleCheck = require_CircleCheck.default;
|
|
271
298
|
exports.Consent = require_Consent.default;
|
|
299
|
+
exports.ConsentAuthorizationDetail = require_ConsentAuthorizationDetail.default;
|
|
272
300
|
exports.ConsentCheckboxList = require_ConsentCheckboxList.default;
|
|
301
|
+
exports.ConsentDetailField = require_ConsentDetailField.default;
|
|
273
302
|
exports.DataTable = require_DataTable.default;
|
|
274
303
|
exports.DatePicker = require_DatePicker.default;
|
|
275
304
|
exports.Divider = require_Divider.default;
|
|
@@ -816,12 +845,19 @@ Object.defineProperty(exports, 'findAdministrationFlows', {
|
|
|
816
845
|
return __thunderid_browser.findAdministrationFlows;
|
|
817
846
|
}
|
|
818
847
|
});
|
|
848
|
+
exports.formatConsentDetailValue = require_formatConsentDetailValue.default;
|
|
819
849
|
Object.defineProperty(exports, 'generateAvatarDataUri', {
|
|
820
850
|
enumerable: true,
|
|
821
851
|
get: function () {
|
|
822
852
|
return __thunderid_browser.generateAvatarDataUri;
|
|
823
853
|
}
|
|
824
854
|
});
|
|
855
|
+
Object.defineProperty(exports, 'getAccountLifecycleActions', {
|
|
856
|
+
enumerable: true,
|
|
857
|
+
get: function () {
|
|
858
|
+
return __thunderid_browser.getAccountLifecycleActions;
|
|
859
|
+
}
|
|
860
|
+
});
|
|
825
861
|
Object.defineProperty(exports, 'getAction', {
|
|
826
862
|
enumerable: true,
|
|
827
863
|
get: function () {
|
|
@@ -942,6 +978,25 @@ Object.defineProperty(exports, 'getConnectionsMeta', {
|
|
|
942
978
|
return __thunderid_browser.getConnectionsMeta;
|
|
943
979
|
}
|
|
944
980
|
});
|
|
981
|
+
exports.getConsentDetailLayout = require_getConsentDetailLayout.default;
|
|
982
|
+
Object.defineProperty(exports, 'getConsentElementDecision', {
|
|
983
|
+
enumerable: true,
|
|
984
|
+
get: function () {
|
|
985
|
+
return __thunderid_browser.getConsentElementDecision;
|
|
986
|
+
}
|
|
987
|
+
});
|
|
988
|
+
Object.defineProperty(exports, 'getConsentInvalidKey', {
|
|
989
|
+
enumerable: true,
|
|
990
|
+
get: function () {
|
|
991
|
+
return __thunderid_browser.getConsentInvalidKey;
|
|
992
|
+
}
|
|
993
|
+
});
|
|
994
|
+
Object.defineProperty(exports, 'getConsentModifiedKey', {
|
|
995
|
+
enumerable: true,
|
|
996
|
+
get: function () {
|
|
997
|
+
return __thunderid_browser.getConsentModifiedKey;
|
|
998
|
+
}
|
|
999
|
+
});
|
|
945
1000
|
exports.getConsentOptionalKey = require_ConsentCheckboxList.getConsentOptionalKey;
|
|
946
1001
|
Object.defineProperty(exports, 'getDesignTheme', {
|
|
947
1002
|
enumerable: true,
|
|
@@ -1311,6 +1366,9 @@ Object.defineProperty(exports, 'isAvatarUri', {
|
|
|
1311
1366
|
return __thunderid_browser.isAvatarUri;
|
|
1312
1367
|
}
|
|
1313
1368
|
});
|
|
1369
|
+
exports.isConsentApprovalBlocked = require_isConsentApprovalBlocked.default;
|
|
1370
|
+
exports.isConsentDetailStructured = require_isConsentDetailStructured.default;
|
|
1371
|
+
exports.isConsentDetailTextClamped = require_isConsentDetailTextClamped.default;
|
|
1314
1372
|
Object.defineProperty(exports, 'isEmojiUri', {
|
|
1315
1373
|
enumerable: true,
|
|
1316
1374
|
get: function () {
|
|
@@ -1468,6 +1526,12 @@ Object.defineProperty(exports, 'revertGatewayConfiguration', {
|
|
|
1468
1526
|
return __thunderid_browser.revertGatewayConfiguration;
|
|
1469
1527
|
}
|
|
1470
1528
|
});
|
|
1529
|
+
Object.defineProperty(exports, 'runAccountLifecycleAction', {
|
|
1530
|
+
enumerable: true,
|
|
1531
|
+
get: function () {
|
|
1532
|
+
return __thunderid_browser.runAccountLifecycleAction;
|
|
1533
|
+
}
|
|
1534
|
+
});
|
|
1471
1535
|
Object.defineProperty(exports, 'runAdministrationFlow', {
|
|
1472
1536
|
enumerable: true,
|
|
1473
1537
|
get: function () {
|
|
@@ -1717,6 +1781,7 @@ Object.defineProperty(exports, 'updateVariable', {
|
|
|
1717
1781
|
}
|
|
1718
1782
|
});
|
|
1719
1783
|
exports.useBrowserUrl = require_useBrowserUrl.default;
|
|
1784
|
+
exports.useConsentDetailField = require_useConsentDetailField.default;
|
|
1720
1785
|
exports.useFetchAuthFlows = require_useFetchAuthFlows.default;
|
|
1721
1786
|
exports.useFetchUserTypes = require_useFetchUserTypes.default;
|
|
1722
1787
|
exports.useFetchUsers = require_useFetchUsers.default;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/utils/formatConsentDetailValue.ts
|
|
3
|
+
/**
|
|
4
|
+
* Formats an authorization detail field value for display. Strings are shown as-is, a list of
|
|
5
|
+
* plain values comma-separated, and any other JSON value as JSON, compact unless `indent` is given.
|
|
6
|
+
*
|
|
7
|
+
* @param value - Field value.
|
|
8
|
+
* @param indent - Spaces to indent structured JSON by, so it reads as a block rather than one long line.
|
|
9
|
+
* @returns Display text.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* formatConsentDetailValue(['initiate', 'status']) // returns 'initiate, status'
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
const formatConsentDetailValue = (value, indent) => {
|
|
17
|
+
if (value === null || value === void 0) return "";
|
|
18
|
+
if (typeof value === "string") return value;
|
|
19
|
+
if (Array.isArray(value) && value.every((item) => typeof item !== "object" || item === null)) return value.map((item) => String(item)).join(", ");
|
|
20
|
+
return JSON.stringify(value, null, indent);
|
|
21
|
+
};
|
|
22
|
+
var formatConsentDetailValue_default = formatConsentDetailValue;
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.default = formatConsentDetailValue_default;
|
|
26
|
+
//# sourceMappingURL=formatConsentDetailValue.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatConsentDetailValue.cjs","names":[],"sources":["../../../src/utils/formatConsentDetailValue.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Formats an authorization detail field value for display. Strings are shown as-is, a list of\n * plain values comma-separated, and any other JSON value as JSON, compact unless `indent` is given.\n *\n * @param value - Field value.\n * @param indent - Spaces to indent structured JSON by, so it reads as a block rather than one long line.\n * @returns Display text.\n *\n * @example\n * ```typescript\n * formatConsentDetailValue(['initiate', 'status']) // returns 'initiate, status'\n * ```\n */\nconst formatConsentDetailValue = (value: unknown, indent?: number): string => {\n if (value === null || value === undefined) return '';\n if (typeof value === 'string') return value;\n if (Array.isArray(value) && value.every((item: unknown) => typeof item !== 'object' || item === null)) {\n return value.map((item: unknown) => String(item)).join(', ');\n }\n return JSON.stringify(value, null, indent);\n};\n\nexport default formatConsentDetailValue;\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,MAAM,4BAA4B,OAAgB,WAA4B;AAC5E,KAAI,UAAU,QAAQ,UAAU,OAAW,QAAO;AAClD,KAAI,OAAO,UAAU,SAAU,QAAO;AACtC,KAAI,MAAM,QAAQ,MAAM,IAAI,MAAM,OAAO,SAAkB,OAAO,SAAS,YAAY,SAAS,KAAK,CACnG,QAAO,MAAM,KAAK,SAAkB,OAAO,KAAK,CAAC,CAAC,KAAK,KAAK;AAE9D,QAAO,KAAK,UAAU,OAAO,MAAM,OAAO;;AAG5C,uCAAe"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const require_formatConsentDetailValue = require('./formatConsentDetailValue.cjs');
|
|
2
|
+
const require_isConsentDetailStructured = require('./isConsentDetailStructured.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/utils/getConsentDetailLayout.ts
|
|
5
|
+
/**
|
|
6
|
+
* Limits a consent screen applies to authorization detail content so that a long or large value never
|
|
7
|
+
* crowds the layout. Text longer than a `*Chars` limit is clamped to its `*Lines` limit behind a toggle,
|
|
8
|
+
* and a list longer than `listItems` shows that many items behind a toggle.
|
|
9
|
+
*/
|
|
10
|
+
const CONSENT_DETAIL_DISPLAY_LIMITS = Object.freeze({
|
|
11
|
+
inlineLabelChars: 32,
|
|
12
|
+
inlineValueChars: 32,
|
|
13
|
+
listItems: 8,
|
|
14
|
+
structuredLines: 8,
|
|
15
|
+
summaryChars: 160,
|
|
16
|
+
summaryLines: 3,
|
|
17
|
+
valueChars: 160,
|
|
18
|
+
valueLines: 4
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* Chooses how a consent screen lays out one authorization detail field. A short label and a short value
|
|
22
|
+
* sit side by side; a long label, a long value, a long list or a structured value is stacked, the label
|
|
23
|
+
* above the value, so neither squeezes the other.
|
|
24
|
+
*
|
|
25
|
+
* @param row - Field to lay out.
|
|
26
|
+
* @returns `inline` or `stacked`.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* getConsentDetailLayout({label: 'Pay to', path: 'creditorName', value: 'Merchant A'}) // returns 'inline'
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
const getConsentDetailLayout = (row) => {
|
|
34
|
+
if ((row.label || row.path).length > CONSENT_DETAIL_DISPLAY_LIMITS.inlineLabelChars || require_isConsentDetailStructured.default(row.value)) return "stacked";
|
|
35
|
+
const items = Array.isArray(row.value) ? [...row.value] : [row.value];
|
|
36
|
+
if (row.modification === "addItems" && Array.isArray(row.options)) items.push(...row.options);
|
|
37
|
+
return require_formatConsentDetailValue.default(items).length > CONSENT_DETAIL_DISPLAY_LIMITS.inlineValueChars ? "stacked" : "inline";
|
|
38
|
+
};
|
|
39
|
+
var getConsentDetailLayout_default = getConsentDetailLayout;
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
exports.CONSENT_DETAIL_DISPLAY_LIMITS = CONSENT_DETAIL_DISPLAY_LIMITS;
|
|
43
|
+
exports.default = getConsentDetailLayout_default;
|
|
44
|
+
//# sourceMappingURL=getConsentDetailLayout.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getConsentDetailLayout.cjs","names":["CONSENT_DETAIL_DISPLAY_LIMITS: Readonly<{\n inlineLabelChars: number;\n inlineValueChars: number;\n listItems: number;\n structuredLines: number;\n summaryChars: number;\n summaryLines: number;\n valueChars: number;\n valueLines: number;\n}>","isConsentDetailStructured","items: unknown[]","formatConsentDetailValue"],"sources":["../../../src/utils/getConsentDetailLayout.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {type ConsentDetailRow} from '@thunderid/browser';\nimport formatConsentDetailValue from './formatConsentDetailValue';\nimport isConsentDetailStructured from './isConsentDetailStructured';\n\n/**\n * Limits a consent screen applies to authorization detail content so that a long or large value never\n * crowds the layout. Text longer than a `*Chars` limit is clamped to its `*Lines` limit behind a toggle,\n * and a list longer than `listItems` shows that many items behind a toggle.\n */\nexport const CONSENT_DETAIL_DISPLAY_LIMITS: Readonly<{\n inlineLabelChars: number;\n inlineValueChars: number;\n listItems: number;\n structuredLines: number;\n summaryChars: number;\n summaryLines: number;\n valueChars: number;\n valueLines: number;\n}> = Object.freeze({\n inlineLabelChars: 32,\n inlineValueChars: 32,\n listItems: 8,\n structuredLines: 8,\n summaryChars: 160,\n summaryLines: 3,\n valueChars: 160,\n valueLines: 4,\n});\n\n/**\n * Chooses how a consent screen lays out one authorization detail field. A short label and a short value\n * sit side by side; a long label, a long value, a long list or a structured value is stacked, the label\n * above the value, so neither squeezes the other.\n *\n * @param row - Field to lay out.\n * @returns `inline` or `stacked`.\n *\n * @example\n * ```typescript\n * getConsentDetailLayout({label: 'Pay to', path: 'creditorName', value: 'Merchant A'}) // returns 'inline'\n * ```\n */\nconst getConsentDetailLayout = (row: ConsentDetailRow): 'inline' | 'stacked' => {\n const label: string = row.label || row.path;\n if (label.length > CONSENT_DETAIL_DISPLAY_LIMITS.inlineLabelChars || isConsentDetailStructured(row.value)) {\n return 'stacked';\n }\n\n const items: unknown[] = Array.isArray(row.value) ? [...(row.value as unknown[])] : [row.value];\n if (row.modification === 'addItems' && Array.isArray(row.options)) {\n items.push(...row.options);\n }\n const text: string = formatConsentDetailValue(items);\n\n return text.length > CONSENT_DETAIL_DISPLAY_LIMITS.inlineValueChars ? 'stacked' : 'inline';\n};\n\nexport default getConsentDetailLayout;\n"],"mappings":";;;;;;;;;AAYA,MAAaA,gCASR,OAAO,OAAO;CACjB,kBAAkB;CAClB,kBAAkB;CAClB,WAAW;CACX,iBAAiB;CACjB,cAAc;CACd,cAAc;CACd,YAAY;CACZ,YAAY;CACb,CAAC;;;;;;;;;;;;;;AAeF,MAAM,0BAA0B,QAAgD;AAE9E,MADsB,IAAI,SAAS,IAAI,MAC7B,SAAS,8BAA8B,oBAAoBC,0CAA0B,IAAI,MAAM,CACvG,QAAO;CAGT,MAAMC,QAAmB,MAAM,QAAQ,IAAI,MAAM,GAAG,CAAC,GAAI,IAAI,MAAoB,GAAG,CAAC,IAAI,MAAM;AAC/F,KAAI,IAAI,iBAAiB,cAAc,MAAM,QAAQ,IAAI,QAAQ,CAC/D,OAAM,KAAK,GAAG,IAAI,QAAQ;AAI5B,QAFqBC,yCAAyB,MAAM,CAExC,SAAS,8BAA8B,mBAAmB,YAAY;;AAGpF,qCAAe"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const require_getConsentDetailLayout = require('./getConsentDetailLayout.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/utils/getConsentDetailListDisplay.ts
|
|
4
|
+
/**
|
|
5
|
+
* Tells how many items of an authorization detail list a consent screen shows. A list longer than
|
|
6
|
+
* `CONSENT_DETAIL_DISPLAY_LIMITS.listItems` shows that many items while collapsed, the rest behind a toggle.
|
|
7
|
+
*
|
|
8
|
+
* @param itemCount - Number of items in the list.
|
|
9
|
+
* @param expanded - Whether the user expanded the list.
|
|
10
|
+
* @returns The items to show and hide.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* getConsentDetailListDisplay(10, false) // returns {hiddenCount: 2, isCollapsible: true, visibleCount: 8}
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
const getConsentDetailListDisplay = (itemCount, expanded) => {
|
|
18
|
+
const isCollapsible = itemCount > require_getConsentDetailLayout.CONSENT_DETAIL_DISPLAY_LIMITS.listItems;
|
|
19
|
+
const visibleCount = isCollapsible && !expanded ? require_getConsentDetailLayout.CONSENT_DETAIL_DISPLAY_LIMITS.listItems : itemCount;
|
|
20
|
+
return {
|
|
21
|
+
hiddenCount: itemCount - visibleCount,
|
|
22
|
+
isCollapsible,
|
|
23
|
+
visibleCount
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
var getConsentDetailListDisplay_default = getConsentDetailListDisplay;
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
exports.default = getConsentDetailListDisplay_default;
|
|
30
|
+
//# sourceMappingURL=getConsentDetailListDisplay.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getConsentDetailListDisplay.cjs","names":["isCollapsible: boolean","CONSENT_DETAIL_DISPLAY_LIMITS","visibleCount: number"],"sources":["../../../src/utils/getConsentDetailListDisplay.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {CONSENT_DETAIL_DISPLAY_LIMITS} from './getConsentDetailLayout';\n\n/**\n * How a consent screen shows a list of authorization detail items, given the\n * `CONSENT_DETAIL_DISPLAY_LIMITS.listItems` limit.\n *\n * @experimental This interface may change in future versions\n */\nexport interface ConsentDetailListDisplay {\n /** Number of items hidden behind the toggle; `0` while expanded or when the list fits. */\n hiddenCount: number;\n /** Whether the list is longer than the limit, so it is shown behind a toggle. */\n isCollapsible: boolean;\n /** Number of items to show. */\n visibleCount: number;\n}\n\n/**\n * Tells how many items of an authorization detail list a consent screen shows. A list longer than\n * `CONSENT_DETAIL_DISPLAY_LIMITS.listItems` shows that many items while collapsed, the rest behind a toggle.\n *\n * @param itemCount - Number of items in the list.\n * @param expanded - Whether the user expanded the list.\n * @returns The items to show and hide.\n *\n * @example\n * ```typescript\n * getConsentDetailListDisplay(10, false) // returns {hiddenCount: 2, isCollapsible: true, visibleCount: 8}\n * ```\n */\nconst getConsentDetailListDisplay = (itemCount: number, expanded: boolean): ConsentDetailListDisplay => {\n const isCollapsible: boolean = itemCount > CONSENT_DETAIL_DISPLAY_LIMITS.listItems;\n const visibleCount: number = isCollapsible && !expanded ? CONSENT_DETAIL_DISPLAY_LIMITS.listItems : itemCount;\n\n return {hiddenCount: itemCount - visibleCount, isCollapsible, visibleCount};\n};\n\nexport default getConsentDetailListDisplay;\n"],"mappings":";;;;;;;;;;;;;;;;AAiCA,MAAM,+BAA+B,WAAmB,aAAgD;CACtG,MAAMA,gBAAyB,YAAYC,6DAA8B;CACzE,MAAMC,eAAuB,iBAAiB,CAAC,WAAWD,6DAA8B,YAAY;AAEpG,QAAO;EAAC,aAAa,YAAY;EAAc;EAAe;EAAa;;AAG7E,0CAAe"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_ConsentCheckboxList = require('../components/auth/flow/ConsentCheckboxList.cjs');
|
|
3
|
+
let __thunderid_browser = require("@thunderid/browser");
|
|
4
|
+
__thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
5
|
+
|
|
6
|
+
//#region src/utils/isConsentApprovalBlocked.ts
|
|
7
|
+
/**
|
|
8
|
+
* Reports whether any field the user may modify on an authorization detail element shows text that cannot
|
|
9
|
+
* be submitted. The element must not be approved while this holds, since its decision would not carry what
|
|
10
|
+
* the user sees.
|
|
11
|
+
*
|
|
12
|
+
* @param purposeId - The identifier of the consent purpose the element belongs to.
|
|
13
|
+
* @param element - The authorization detail element.
|
|
14
|
+
* @param inputs - Form values, holding the invalid marker of each field under its invalid key.
|
|
15
|
+
* @returns Whether a field of the element is invalid.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* hasInvalidConsentModification('p1', element, {'__consent_invalid__p1__d-1__amount': 'true'}) // returns true
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
const hasInvalidConsentModification = (purposeId, element, inputs) => (element.rows ?? []).some((row) => Boolean(row.modification) && inputs[(0, __thunderid_browser.getConsentInvalidKey)(purposeId, element.name, row.path)] === "true");
|
|
23
|
+
/**
|
|
24
|
+
* Reports whether the consent cannot be approved yet: an authorization detail the user has not declined
|
|
25
|
+
* shows, in a field the user may modify, text that cannot be submitted. Denying stays possible.
|
|
26
|
+
*
|
|
27
|
+
* @param purposes - The consent purposes on the screen.
|
|
28
|
+
* @param formValues - Form values, holding each element's approval and each field's invalid marker.
|
|
29
|
+
* @returns Whether approval must wait until the user corrects the field.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* isConsentApprovalBlocked(purposes, {'__consent_invalid__p1__d-1__amount': 'true'}) // returns true
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
const isConsentApprovalBlocked = (purposes, formValues) => purposes.some((purpose) => (purpose.optional ?? []).some((element) => formValues[require_ConsentCheckboxList.getConsentOptionalKey(purpose.purposeId, element.name)] !== "false" && hasInvalidConsentModification(purpose.purposeId, element, formValues)));
|
|
37
|
+
var isConsentApprovalBlocked_default = isConsentApprovalBlocked;
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
exports.default = isConsentApprovalBlocked_default;
|
|
41
|
+
//# sourceMappingURL=isConsentApprovalBlocked.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isConsentApprovalBlocked.cjs","names":["getConsentOptionalKey"],"sources":["../../../src/utils/isConsentApprovalBlocked.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n type ConsentDetailRow,\n type ConsentPurposeData,\n getConsentInvalidKey,\n type PromptElement,\n} from '@thunderid/browser';\nimport {getConsentOptionalKey} from '../components/auth/flow/ConsentCheckboxList';\n\n/**\n * Reports whether any field the user may modify on an authorization detail element shows text that cannot\n * be submitted. The element must not be approved while this holds, since its decision would not carry what\n * the user sees.\n *\n * @param purposeId - The identifier of the consent purpose the element belongs to.\n * @param element - The authorization detail element.\n * @param inputs - Form values, holding the invalid marker of each field under its invalid key.\n * @returns Whether a field of the element is invalid.\n *\n * @example\n * ```typescript\n * hasInvalidConsentModification('p1', element, {'__consent_invalid__p1__d-1__amount': 'true'}) // returns true\n * ```\n */\nconst hasInvalidConsentModification = (\n purposeId: string,\n element: PromptElement,\n inputs: Record<string, unknown>,\n): boolean =>\n (element.rows ?? []).some(\n (row: ConsentDetailRow) =>\n Boolean(row.modification) && inputs[getConsentInvalidKey(purposeId, element.name, row.path)] === 'true',\n );\n\n/**\n * Reports whether the consent cannot be approved yet: an authorization detail the user has not declined\n * shows, in a field the user may modify, text that cannot be submitted. Denying stays possible.\n *\n * @param purposes - The consent purposes on the screen.\n * @param formValues - Form values, holding each element's approval and each field's invalid marker.\n * @returns Whether approval must wait until the user corrects the field.\n *\n * @example\n * ```typescript\n * isConsentApprovalBlocked(purposes, {'__consent_invalid__p1__d-1__amount': 'true'}) // returns true\n * ```\n */\nconst isConsentApprovalBlocked = (purposes: ConsentPurposeData[], formValues: Record<string, unknown>): boolean =>\n purposes.some((purpose: ConsentPurposeData) =>\n (purpose.optional ?? []).some(\n (element: PromptElement) =>\n formValues[getConsentOptionalKey(purpose.purposeId, element.name)] !== 'false' &&\n hasInvalidConsentModification(purpose.purposeId, element, formValues),\n ),\n );\n\nexport default isConsentApprovalBlocked;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,iCACJ,WACA,SACA,YAEC,QAAQ,QAAQ,EAAE,EAAE,MAClB,QACC,QAAQ,IAAI,aAAa,IAAI,qDAA4B,WAAW,QAAQ,MAAM,IAAI,KAAK,MAAM,OACpG;;;;;;;;;;;;;;AAeH,MAAM,4BAA4B,UAAgC,eAChE,SAAS,MAAM,aACZ,QAAQ,YAAY,EAAE,EAAE,MACtB,YACC,WAAWA,kDAAsB,QAAQ,WAAW,QAAQ,KAAK,MAAM,WACvE,8BAA8B,QAAQ,WAAW,SAAS,WAAW,CACxE,CACF;AAEH,uCAAe"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/utils/isConsentDetailPlainList.ts
|
|
3
|
+
/**
|
|
4
|
+
* Whether a field value is a list of plain values, strings, numbers or booleans, which a consent screen shows
|
|
5
|
+
* as a list rather than as structured JSON.
|
|
6
|
+
*
|
|
7
|
+
* @param value - Field value.
|
|
8
|
+
* @returns `true` when the value is a list of plain values.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* isConsentDetailPlainList(['initiate', 'status']) // returns true
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
const isConsentDetailPlainList = (value) => Array.isArray(value) && value.every((item) => [
|
|
16
|
+
"string",
|
|
17
|
+
"number",
|
|
18
|
+
"boolean"
|
|
19
|
+
].includes(typeof item));
|
|
20
|
+
var isConsentDetailPlainList_default = isConsentDetailPlainList;
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.default = isConsentDetailPlainList_default;
|
|
24
|
+
//# sourceMappingURL=isConsentDetailPlainList.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isConsentDetailPlainList.cjs","names":[],"sources":["../../../src/utils/isConsentDetailPlainList.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Whether a field value is a list of plain values, strings, numbers or booleans, which a consent screen shows\n * as a list rather than as structured JSON.\n *\n * @param value - Field value.\n * @returns `true` when the value is a list of plain values.\n *\n * @example\n * ```typescript\n * isConsentDetailPlainList(['initiate', 'status']) // returns true\n * ```\n */\nconst isConsentDetailPlainList = (value: unknown): value is (string | number | boolean)[] =>\n Array.isArray(value) && value.every((item: unknown) => ['string', 'number', 'boolean'].includes(typeof item));\n\nexport default isConsentDetailPlainList;\n"],"mappings":";;;;;;;;;;;;;;AAeA,MAAM,4BAA4B,UAChC,MAAM,QAAQ,MAAM,IAAI,MAAM,OAAO,SAAkB;CAAC;CAAU;CAAU;CAAU,CAAC,SAAS,OAAO,KAAK,CAAC;AAE/G,uCAAe"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/utils/isConsentDetailStructured.ts
|
|
3
|
+
/**
|
|
4
|
+
* Whether a field value is structured JSON, an object or a list holding objects, rather than a plain
|
|
5
|
+
* value or a list of plain values.
|
|
6
|
+
*
|
|
7
|
+
* @param value - Field value.
|
|
8
|
+
* @returns `true` when the value is shown as a formatted JSON block.
|
|
9
|
+
*/
|
|
10
|
+
const isConsentDetailStructured = (value) => typeof value === "object" && value !== null && !Array.isArray(value) || Array.isArray(value) && value.some((item) => typeof item === "object" && item !== null);
|
|
11
|
+
var isConsentDetailStructured_default = isConsentDetailStructured;
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.default = isConsentDetailStructured_default;
|
|
15
|
+
//# sourceMappingURL=isConsentDetailStructured.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isConsentDetailStructured.cjs","names":[],"sources":["../../../src/utils/isConsentDetailStructured.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Whether a field value is structured JSON, an object or a list holding objects, rather than a plain\n * value or a list of plain values.\n *\n * @param value - Field value.\n * @returns `true` when the value is shown as a formatted JSON block.\n */\nconst isConsentDetailStructured = (value: unknown): boolean =>\n (typeof value === 'object' && value !== null && !Array.isArray(value)) ||\n (Array.isArray(value) && value.some((item: unknown) => typeof item === 'object' && item !== null));\n\nexport default isConsentDetailStructured;\n"],"mappings":";;;;;;;;;AAUA,MAAM,6BAA6B,UAChC,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM,IACpE,MAAM,QAAQ,MAAM,IAAI,MAAM,MAAM,SAAkB,OAAO,SAAS,YAAY,SAAS,KAAK;AAEnG,wCAAe"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/utils/isConsentDetailTextClamped.ts
|
|
3
|
+
/**
|
|
4
|
+
* Whether authorization detail text is long enough to be clamped behind a toggle: longer than `maxChars`, or
|
|
5
|
+
* spanning more than `maxLines` lines.
|
|
6
|
+
*
|
|
7
|
+
* @param text - Text to show.
|
|
8
|
+
* @param maxChars - Number of characters above which the text is clamped, such as
|
|
9
|
+
* `CONSENT_DETAIL_DISPLAY_LIMITS.valueChars`.
|
|
10
|
+
* @param maxLines - Number of lines above which the text is clamped, such as
|
|
11
|
+
* `CONSENT_DETAIL_DISPLAY_LIMITS.valueLines`.
|
|
12
|
+
* @returns `true` when the text is clamped while collapsed.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* isConsentDetailTextClamped('Merchant A', CONSENT_DETAIL_DISPLAY_LIMITS.valueChars, CONSENT_DETAIL_DISPLAY_LIMITS.valueLines)
|
|
17
|
+
* // returns false
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
const isConsentDetailTextClamped = (text, maxChars, maxLines) => text.length > maxChars || text.split("\n").length > maxLines;
|
|
21
|
+
var isConsentDetailTextClamped_default = isConsentDetailTextClamped;
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
exports.default = isConsentDetailTextClamped_default;
|
|
25
|
+
//# sourceMappingURL=isConsentDetailTextClamped.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isConsentDetailTextClamped.cjs","names":[],"sources":["../../../src/utils/isConsentDetailTextClamped.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Whether authorization detail text is long enough to be clamped behind a toggle: longer than `maxChars`, or\n * spanning more than `maxLines` lines.\n *\n * @param text - Text to show.\n * @param maxChars - Number of characters above which the text is clamped, such as\n * `CONSENT_DETAIL_DISPLAY_LIMITS.valueChars`.\n * @param maxLines - Number of lines above which the text is clamped, such as\n * `CONSENT_DETAIL_DISPLAY_LIMITS.valueLines`.\n * @returns `true` when the text is clamped while collapsed.\n *\n * @example\n * ```typescript\n * isConsentDetailTextClamped('Merchant A', CONSENT_DETAIL_DISPLAY_LIMITS.valueChars, CONSENT_DETAIL_DISPLAY_LIMITS.valueLines)\n * // returns false\n * ```\n */\nconst isConsentDetailTextClamped = (text: string, maxChars: number, maxLines: number): boolean =>\n text.length > maxChars || text.split('\\n').length > maxLines;\n\nexport default isConsentDetailTextClamped;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,MAAM,8BAA8B,MAAc,UAAkB,aAClE,KAAK,SAAS,YAAY,KAAK,MAAM,KAAK,CAAC,SAAS;AAEtD,yCAAe"}
|
|
@@ -5,9 +5,9 @@ import Button_default from "../../primitives/Button/Button.js";
|
|
|
5
5
|
import Typography_default from "../../primitives/Typography/Typography.js";
|
|
6
6
|
import Alert_default from "../../primitives/Alert/Alert.js";
|
|
7
7
|
import Card_default from "../../primitives/Card/Card.js";
|
|
8
|
+
import TextField_default from "../../primitives/TextField/TextField.js";
|
|
8
9
|
import Checkbox_default from "../../primitives/Checkbox/Checkbox.js";
|
|
9
10
|
import DatePicker_default from "../../primitives/DatePicker/DatePicker.js";
|
|
10
|
-
import TextField_default from "../../primitives/TextField/TextField.js";
|
|
11
11
|
import Divider_default from "../../primitives/Divider/Divider.js";
|
|
12
12
|
import BaseUserProfile_styles_default from "./BaseUserProfile.styles.js";
|
|
13
13
|
import getMappedUserProfileValue_default from "../../../utils/getMappedUserProfileValue.js";
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { BaseAgentDetailsProps } from './BaseAgentDetails';
|
|
3
|
-
export type AgentDetailsProps = Omit<BaseAgentDetailsProps, 'agent' | 'error' | 'groups' | 'isDeleting' | 'isLoading' | 'onDelete' | 'roles'> & {
|
|
3
|
+
export type AgentDetailsProps = Omit<BaseAgentDetailsProps, 'agent' | 'error' | 'groups' | 'isDeleting' | 'isLoading' | 'isRunningLifecycleAction' | 'lifecycleActions' | 'onDelete' | 'onLifecycleAction' | 'roles'> & {
|
|
4
4
|
agentId: string;
|
|
5
5
|
/**
|
|
6
6
|
* Whether the agent can be deleted from this view.
|
|
7
7
|
* @default false
|
|
8
8
|
*/
|
|
9
9
|
deletable?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the agent can be suspended, unsuspended and unlocked from this view. Each action runs through its
|
|
12
|
+
* administration flow and is offered only when the server configures that flow. Reading the configured
|
|
13
|
+
* flows needs a token that may read the server configuration.
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
lifecycleActions?: boolean;
|
|
10
17
|
/**
|
|
11
18
|
* Called after the agent has been deleted.
|
|
12
19
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentDetails.d.ts","sourceRoot":"","sources":["../../../../src/components/admin/AgentDetails/AgentDetails.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAC,EAAE,EAAe,MAAM,OAAO,CAAC;AACvC,OAAyB,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"AgentDetails.d.ts","sourceRoot":"","sources":["../../../../src/components/admin/AgentDetails/AgentDetails.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAC,EAAE,EAAe,MAAM,OAAO,CAAC;AACvC,OAAyB,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AAO3E,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,qBAAqB,EACnB,OAAO,GACP,OAAO,GACP,QAAQ,GACR,YAAY,GACZ,WAAW,GACX,0BAA0B,GAC1B,kBAAkB,GAClB,UAAU,GACV,mBAAmB,GACnB,OAAO,CACV,GAAG;IACF,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF;;;;;;;;GAQG;AACH,QAAA,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CA4DvC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -2,6 +2,7 @@ import useTranslation_default from "../../../hooks/useTranslation.js";
|
|
|
2
2
|
import useManagementEndpoint_default from "../../../hooks/management/useManagementEndpoint.js";
|
|
3
3
|
import useResourceQuery_default from "../../../hooks/management/useResourceQuery.js";
|
|
4
4
|
import useResourceMutation_default from "../../../hooks/management/useResourceMutation.js";
|
|
5
|
+
import useAccountLifecycle_default from "../../../hooks/management/useAccountLifecycle.js";
|
|
5
6
|
import BaseAgentDetails_default from "./BaseAgentDetails.js";
|
|
6
7
|
import { AgentQueryKeys, GroupQueryKeys, RoleQueryKeys, deleteAgent, getAgent, getAgentGroups, getAgentRoles, toManagementErrorMessage } from "@thunderid/browser";
|
|
7
8
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -16,7 +17,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
16
17
|
* <AgentDetails agentId={agentId} deletable onDeleted={() => navigate('/agents')} />
|
|
17
18
|
* ```
|
|
18
19
|
*/
|
|
19
|
-
const AgentDetails = ({ agentId, deletable = false, onDeleted, preferences,...rest }) => {
|
|
20
|
+
const AgentDetails = ({ agentId, deletable = false, lifecycleActions = false, onDeleted, preferences,...rest }) => {
|
|
20
21
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
21
22
|
const endpoint = useManagementEndpoint_default("agents");
|
|
22
23
|
const agent = useResourceQuery_default([AgentQueryKeys.AGENT, agentId], (fetcher) => getAgent({
|
|
@@ -51,14 +52,24 @@ const AgentDetails = ({ agentId, deletable = false, onDeleted, preferences,...re
|
|
|
51
52
|
agentId: id,
|
|
52
53
|
fetcher
|
|
53
54
|
}), () => [[AgentQueryKeys.AGENTS]], { onSuccess: onDeleted });
|
|
55
|
+
const lifecycle = useAccountLifecycle_default({
|
|
56
|
+
enabled: lifecycleActions,
|
|
57
|
+
invalidatedKeys: [[AgentQueryKeys.AGENT, agentId], [AgentQueryKeys.AGENTS]],
|
|
58
|
+
kind: "agent",
|
|
59
|
+
status: agent.data?.status?.value,
|
|
60
|
+
subject: agentId
|
|
61
|
+
});
|
|
54
62
|
return /* @__PURE__ */ jsx(BaseAgentDetails_default, {
|
|
55
63
|
agent: agent.data,
|
|
56
64
|
groups: groups.data?.groups,
|
|
57
65
|
roles: roles.data?.roles,
|
|
58
66
|
isLoading: agent.isLoading,
|
|
59
|
-
error: toManagementErrorMessage(t, agent.error, "admin.agents.details.error") ?? toManagementErrorMessage(t, deletion.error, "admin.agents.details.delete.error"),
|
|
67
|
+
error: toManagementErrorMessage(t, agent.error, "admin.agents.details.error") ?? toManagementErrorMessage(t, deletion.error, "admin.agents.details.delete.error") ?? toManagementErrorMessage(t, lifecycle.error, "admin.common.lifecycle.error") ?? toManagementErrorMessage(t, lifecycle.loadError, "admin.common.lifecycle.load_error"),
|
|
60
68
|
isDeleting: deletion.isLoading,
|
|
61
69
|
onDelete: deletable ? () => void deletion.mutate(agentId) : void 0,
|
|
70
|
+
lifecycleActions: lifecycle.actions,
|
|
71
|
+
isRunningLifecycleAction: lifecycle.isRunning,
|
|
72
|
+
onLifecycleAction: lifecycleActions ? lifecycle.run : void 0,
|
|
62
73
|
preferences,
|
|
63
74
|
...rest
|
|
64
75
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentDetails.js","names":["AgentDetails: FC<AgentDetailsProps>","useTranslation","endpoint: ManagementEndpoint","useManagementEndpoint","agent: ResourceQueryResult<Agent>","useResourceQuery","groups: ResourceQueryResult<MembershipGroupListResponse>","roles: ResourceQueryResult<AgentRoleListResponse>","deletion: ResourceMutationResult<void, string>","useResourceMutation","BaseAgentDetails"],"sources":["../../../../src/components/admin/AgentDetails/AgentDetails.tsx"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n Agent,\n AgentQueryKeys,\n AgentRoleListResponse,\n GroupQueryKeys,\n MembershipGroupListResponse,\n RoleQueryKeys,\n deleteAgent,\n getAgent,\n getAgentGroups,\n getAgentRoles,\n toManagementErrorMessage,\n} from '@thunderid/browser';\nimport {FC, ReactElement} from 'react';\nimport BaseAgentDetails, {BaseAgentDetailsProps} from './BaseAgentDetails';\nimport useManagementEndpoint, {ManagementEndpoint} from '../../../hooks/management/useManagementEndpoint';\nimport useResourceMutation, {ResourceMutationResult} from '../../../hooks/management/useResourceMutation';\nimport useResourceQuery, {ResourceQueryResult} from '../../../hooks/management/useResourceQuery';\nimport useTranslation from '../../../hooks/useTranslation';\n\nexport type AgentDetailsProps = Omit<\n BaseAgentDetailsProps,\n 'agent'
|
|
1
|
+
{"version":3,"file":"AgentDetails.js","names":["AgentDetails: FC<AgentDetailsProps>","useTranslation","endpoint: ManagementEndpoint","useManagementEndpoint","agent: ResourceQueryResult<Agent>","useResourceQuery","groups: ResourceQueryResult<MembershipGroupListResponse>","roles: ResourceQueryResult<AgentRoleListResponse>","deletion: ResourceMutationResult<void, string>","useResourceMutation","lifecycle: AccountLifecycleState","useAccountLifecycle","BaseAgentDetails"],"sources":["../../../../src/components/admin/AgentDetails/AgentDetails.tsx"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n Agent,\n AgentQueryKeys,\n AgentRoleListResponse,\n GroupQueryKeys,\n MembershipGroupListResponse,\n RoleQueryKeys,\n deleteAgent,\n getAgent,\n getAgentGroups,\n getAgentRoles,\n toManagementErrorMessage,\n} from '@thunderid/browser';\nimport {FC, ReactElement} from 'react';\nimport BaseAgentDetails, {BaseAgentDetailsProps} from './BaseAgentDetails';\nimport useAccountLifecycle, {AccountLifecycleState} from '../../../hooks/management/useAccountLifecycle';\nimport useManagementEndpoint, {ManagementEndpoint} from '../../../hooks/management/useManagementEndpoint';\nimport useResourceMutation, {ResourceMutationResult} from '../../../hooks/management/useResourceMutation';\nimport useResourceQuery, {ResourceQueryResult} from '../../../hooks/management/useResourceQuery';\nimport useTranslation from '../../../hooks/useTranslation';\n\nexport type AgentDetailsProps = Omit<\n BaseAgentDetailsProps,\n | 'agent'\n | 'error'\n | 'groups'\n | 'isDeleting'\n | 'isLoading'\n | 'isRunningLifecycleAction'\n | 'lifecycleActions'\n | 'onDelete'\n | 'onLifecycleAction'\n | 'roles'\n> & {\n agentId: string;\n /**\n * Whether the agent can be deleted from this view.\n * @default false\n */\n deletable?: boolean;\n /**\n * Whether the agent can be suspended, unsuspended and unlocked from this view. Each action runs through its\n * administration flow and is offered only when the server configures that flow. Reading the configured\n * flows needs a token that may read the server configuration.\n * @default false\n */\n lifecycleActions?: boolean;\n /**\n * Called after the agent has been deleted.\n */\n onDeleted?: () => void;\n};\n\n/**\n * Shows an agent with the groups and roles it holds, and optionally lets the signed-in user delete\n * it.\n *\n * @example\n * ```tsx\n * <AgentDetails agentId={agentId} deletable onDeleted={() => navigate('/agents')} />\n * ```\n */\nconst AgentDetails: FC<AgentDetailsProps> = ({\n agentId,\n deletable = false,\n lifecycleActions = false,\n onDeleted,\n preferences,\n ...rest\n}: AgentDetailsProps): ReactElement => {\n const {t} = useTranslation(preferences?.i18n);\n const endpoint: ManagementEndpoint = useManagementEndpoint('agents');\n const agent: ResourceQueryResult<Agent> = useResourceQuery(\n [AgentQueryKeys.AGENT, agentId],\n (fetcher) => getAgent({...endpoint, agentId, fetcher}),\n {enabled: Boolean(agentId)},\n );\n const groups: ResourceQueryResult<MembershipGroupListResponse> = useResourceQuery(\n [GroupQueryKeys.MEMBERSHIPS, 'agent', agentId, {limit: 100}],\n (fetcher) => getAgentGroups({...endpoint, agentId, fetcher, limit: 100}),\n {enabled: Boolean(agentId)},\n );\n const roles: ResourceQueryResult<AgentRoleListResponse> = useResourceQuery(\n [RoleQueryKeys.ROLE_ASSIGNMENTS, 'agent', agentId, {limit: 100}],\n (fetcher) => getAgentRoles({...endpoint, agentId, fetcher, limit: 100}),\n {enabled: Boolean(agentId)},\n );\n const deletion: ResourceMutationResult<void, string> = useResourceMutation(\n (id: string, fetcher) => deleteAgent({...endpoint, agentId: id, fetcher}),\n () => [[AgentQueryKeys.AGENTS]],\n {onSuccess: onDeleted},\n );\n\n const lifecycle: AccountLifecycleState = useAccountLifecycle({\n enabled: lifecycleActions,\n invalidatedKeys: [[AgentQueryKeys.AGENT, agentId], [AgentQueryKeys.AGENTS]],\n kind: 'agent',\n status: agent.data?.status?.value,\n subject: agentId,\n });\n\n return (\n <BaseAgentDetails\n agent={agent.data}\n groups={groups.data?.groups}\n roles={roles.data?.roles}\n isLoading={agent.isLoading}\n error={\n toManagementErrorMessage(t, agent.error, 'admin.agents.details.error') ??\n toManagementErrorMessage(t, deletion.error, 'admin.agents.details.delete.error') ??\n toManagementErrorMessage(t, lifecycle.error, 'admin.common.lifecycle.error') ??\n toManagementErrorMessage(t, lifecycle.loadError, 'admin.common.lifecycle.load_error')\n }\n isDeleting={deletion.isLoading}\n onDelete={deletable ? (): void => void deletion.mutate(agentId) : undefined}\n lifecycleActions={lifecycle.actions}\n isRunningLifecycleAction={lifecycle.isRunning}\n onLifecycleAction={lifecycleActions ? lifecycle.run : undefined}\n preferences={preferences}\n {...rest}\n />\n );\n};\n\nexport default AgentDetails;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiEA,MAAMA,gBAAuC,EAC3C,SACA,YAAY,OACZ,mBAAmB,OACnB,WACA,YACA,GAAG,WACkC;CACrC,MAAM,EAAC,MAAKC,uBAAe,aAAa,KAAK;CAC7C,MAAMC,WAA+BC,8BAAsB,SAAS;CACpE,MAAMC,QAAoCC,yBACxC,CAAC,eAAe,OAAO,QAAQ,GAC9B,YAAY,SAAS;EAAC,GAAG;EAAU;EAAS;EAAQ,CAAC,EACtD,EAAC,SAAS,QAAQ,QAAQ,EAAC,CAC5B;CACD,MAAMC,SAA2DD,yBAC/D;EAAC,eAAe;EAAa;EAAS;EAAS,EAAC,OAAO,KAAI;EAAC,GAC3D,YAAY,eAAe;EAAC,GAAG;EAAU;EAAS;EAAS,OAAO;EAAI,CAAC,EACxE,EAAC,SAAS,QAAQ,QAAQ,EAAC,CAC5B;CACD,MAAME,QAAoDF,yBACxD;EAAC,cAAc;EAAkB;EAAS;EAAS,EAAC,OAAO,KAAI;EAAC,GAC/D,YAAY,cAAc;EAAC,GAAG;EAAU;EAAS;EAAS,OAAO;EAAI,CAAC,EACvE,EAAC,SAAS,QAAQ,QAAQ,EAAC,CAC5B;CACD,MAAMG,WAAiDC,6BACpD,IAAY,YAAY,YAAY;EAAC,GAAG;EAAU,SAAS;EAAI;EAAQ,CAAC,QACnE,CAAC,CAAC,eAAe,OAAO,CAAC,EAC/B,EAAC,WAAW,WAAU,CACvB;CAED,MAAMC,YAAmCC,4BAAoB;EAC3D,SAAS;EACT,iBAAiB,CAAC,CAAC,eAAe,OAAO,QAAQ,EAAE,CAAC,eAAe,OAAO,CAAC;EAC3E,MAAM;EACN,QAAQ,MAAM,MAAM,QAAQ;EAC5B,SAAS;EACV,CAAC;AAEF,QACE,oBAACC;EACC,OAAO,MAAM;EACb,QAAQ,OAAO,MAAM;EACrB,OAAO,MAAM,MAAM;EACnB,WAAW,MAAM;EACjB,OACE,yBAAyB,GAAG,MAAM,OAAO,6BAA6B,IACtE,yBAAyB,GAAG,SAAS,OAAO,oCAAoC,IAChF,yBAAyB,GAAG,UAAU,OAAO,+BAA+B,IAC5E,yBAAyB,GAAG,UAAU,WAAW,oCAAoC;EAEvF,YAAY,SAAS;EACrB,UAAU,kBAAwB,KAAK,SAAS,OAAO,QAAQ,GAAG;EAClE,kBAAkB,UAAU;EAC5B,0BAA0B,UAAU;EACpC,mBAAmB,mBAAmB,UAAU,MAAM;EACzC;EACb,GAAI;GACJ;;AAIN,2BAAe"}
|