@thunderid/react 1.10.0 → 1.11.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/GroupMembers/GroupMembers.cjs +39 -17
- package/dist/cjs/components/admin/GroupMembers/GroupMembers.cjs.map +1 -1
- package/dist/cjs/components/auth/AcceptInvite/BaseAcceptInvite.cjs +1 -1
- package/dist/cjs/components/auth/DeviceGrant/BaseDeviceGrant.cjs +61 -0
- package/dist/cjs/components/auth/DeviceGrant/BaseDeviceGrant.cjs.map +1 -0
- package/dist/cjs/components/auth/DeviceGrant/BaseDeviceGrant.styles.cjs +26 -0
- package/dist/cjs/components/auth/DeviceGrant/BaseDeviceGrant.styles.cjs.map +1 -0
- package/dist/cjs/components/auth/DeviceGrant/DeviceGrant.cjs +192 -0
- package/dist/cjs/components/auth/DeviceGrant/DeviceGrant.cjs.map +1 -0
- package/dist/cjs/components/auth/InviteUser/BaseInviteUser.cjs +1 -1
- package/dist/cjs/components/auth/Recovery/BaseRecovery.cjs +2 -2
- package/dist/cjs/components/auth/SignIn/BaseSignIn.cjs +15 -4
- package/dist/cjs/components/auth/SignIn/BaseSignIn.cjs.map +1 -1
- package/dist/cjs/components/auth/SignUp/BaseSignUp.cjs +2 -2
- package/dist/cjs/components/auth/flow/AuthOptionFactory.cjs +17 -2
- package/dist/cjs/components/auth/flow/AuthOptionFactory.cjs.map +1 -1
- package/dist/cjs/components/auth/flow/Consent.cjs +1 -1
- package/dist/cjs/components/primitives/Alert/Alert.cjs +1 -1
- package/dist/cjs/components/primitives/Card/Card.cjs +1 -1
- package/dist/cjs/components/primitives/Typography/Typography.styles.cjs +3 -0
- package/dist/cjs/components/primitives/Typography/Typography.styles.cjs.map +1 -1
- package/dist/cjs/index.cjs +6 -2
- package/dist/components/account/UserProfile/BaseUserProfile.js +1 -1
- package/dist/components/admin/GroupMembers/GroupMembers.d.ts +4 -0
- package/dist/components/admin/GroupMembers/GroupMembers.d.ts.map +1 -1
- package/dist/components/admin/GroupMembers/GroupMembers.js +40 -18
- package/dist/components/admin/GroupMembers/GroupMembers.js.map +1 -1
- package/dist/components/auth/AcceptInvite/BaseAcceptInvite.js +1 -1
- package/dist/components/auth/DeviceGrant/BaseDeviceGrant.d.ts +17 -0
- package/dist/components/auth/DeviceGrant/BaseDeviceGrant.d.ts.map +1 -0
- package/dist/components/auth/DeviceGrant/BaseDeviceGrant.js +58 -0
- package/dist/components/auth/DeviceGrant/BaseDeviceGrant.js.map +1 -0
- package/dist/components/auth/DeviceGrant/BaseDeviceGrant.styles.d.ts +4 -0
- package/dist/components/auth/DeviceGrant/BaseDeviceGrant.styles.d.ts.map +1 -0
- package/dist/components/auth/DeviceGrant/BaseDeviceGrant.styles.js +24 -0
- package/dist/components/auth/DeviceGrant/BaseDeviceGrant.styles.js.map +1 -0
- package/dist/components/auth/DeviceGrant/DeviceGrant.d.ts +37 -0
- package/dist/components/auth/DeviceGrant/DeviceGrant.d.ts.map +1 -0
- package/dist/components/auth/DeviceGrant/DeviceGrant.js +188 -0
- package/dist/components/auth/DeviceGrant/DeviceGrant.js.map +1 -0
- package/dist/components/auth/InviteUser/BaseInviteUser.js +1 -1
- package/dist/components/auth/Recovery/BaseRecovery.js +2 -2
- package/dist/components/auth/SignIn/BaseSignIn.d.ts +4 -0
- package/dist/components/auth/SignIn/BaseSignIn.d.ts.map +1 -1
- package/dist/components/auth/SignIn/BaseSignIn.js +16 -5
- package/dist/components/auth/SignIn/BaseSignIn.js.map +1 -1
- package/dist/components/auth/SignUp/BaseSignUp.js +2 -2
- package/dist/components/auth/flow/AuthOptionFactory.d.ts.map +1 -1
- package/dist/components/auth/flow/AuthOptionFactory.js +17 -2
- package/dist/components/auth/flow/AuthOptionFactory.js.map +1 -1
- package/dist/components/auth/flow/Consent.js +1 -1
- package/dist/components/primitives/Alert/Alert.js +1 -1
- package/dist/components/primitives/Card/Card.js +1 -1
- package/dist/components/primitives/Typography/Typography.styles.d.ts.map +1 -1
- package/dist/components/primitives/Typography/Typography.styles.js +3 -0
- package/dist/components/primitives/Typography/Typography.styles.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/package.json +2 -2
|
@@ -4,8 +4,8 @@ const require_useTheme = require('../../../contexts/Theme/useTheme.cjs');
|
|
|
4
4
|
const require_useTranslation = require('../../../hooks/useTranslation.cjs');
|
|
5
5
|
const require_Button = require('../../primitives/Button/Button.cjs');
|
|
6
6
|
const require_Typography = require('../../primitives/Typography/Typography.cjs');
|
|
7
|
-
const require_Alert = require('../../primitives/Alert/Alert.cjs');
|
|
8
7
|
const require_Card = require('../../primitives/Card/Card.cjs');
|
|
8
|
+
const require_Alert = require('../../primitives/Alert/Alert.cjs');
|
|
9
9
|
const require_TextField = require('../../primitives/TextField/TextField.cjs');
|
|
10
10
|
const require_Checkbox = require('../../primitives/Checkbox/Checkbox.cjs');
|
|
11
11
|
const require_DatePicker = require('../../primitives/DatePicker/DatePicker.cjs');
|
|
@@ -29,11 +29,12 @@ const getMembershipInvalidatedKeys = ({ groupId }) => [
|
|
|
29
29
|
* <GroupMembers groupId={groupId} />
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
const GroupMembers = ({ administrationMode, editable = false, groupId, preferences,...rest }) => {
|
|
32
|
+
const GroupMembers = ({ administrationMode, editable = false, groupId, ouId, preferences,...rest }) => {
|
|
33
33
|
const { t } = require_useTranslation.default(preferences?.i18n);
|
|
34
34
|
const groupsEndpoint = require_useManagementEndpoint.default("groups");
|
|
35
35
|
const usersEndpoint = require_useManagementEndpoint.default("users");
|
|
36
36
|
const agentsEndpoint = require_useManagementEndpoint.default("agents");
|
|
37
|
+
const filter = (0, __thunderid_browser.toEqualityFilter)("ouId", ouId);
|
|
37
38
|
const members = require_useResourceQuery.default([
|
|
38
39
|
__thunderid_browser.GroupQueryKeys.GROUP_MEMBERS,
|
|
39
40
|
groupId,
|
|
@@ -44,15 +45,29 @@ const GroupMembers = ({ administrationMode, editable = false, groupId, preferenc
|
|
|
44
45
|
groupId,
|
|
45
46
|
limit: 100
|
|
46
47
|
}), { enabled: Boolean(groupId) });
|
|
47
|
-
const users = require_useResourceQuery.default([__thunderid_browser.UserQueryKeys.USERS, {
|
|
48
|
-
|
|
49
|
-
fetcher,
|
|
48
|
+
const users = require_useResourceQuery.default([__thunderid_browser.UserQueryKeys.USERS, {
|
|
49
|
+
filter,
|
|
50
50
|
limit: 100
|
|
51
|
+
}], async (fetcher) => ({
|
|
52
|
+
filter,
|
|
53
|
+
page: await (0, __thunderid_browser.getUsers)({
|
|
54
|
+
...usersEndpoint,
|
|
55
|
+
fetcher,
|
|
56
|
+
filter,
|
|
57
|
+
limit: 100
|
|
58
|
+
})
|
|
51
59
|
}), { enabled: editable });
|
|
52
|
-
const agents = require_useResourceQuery.default([__thunderid_browser.AgentQueryKeys.AGENTS, {
|
|
53
|
-
|
|
54
|
-
fetcher,
|
|
60
|
+
const agents = require_useResourceQuery.default([__thunderid_browser.AgentQueryKeys.AGENTS, {
|
|
61
|
+
filter,
|
|
55
62
|
limit: 100
|
|
63
|
+
}], async (fetcher) => ({
|
|
64
|
+
filter,
|
|
65
|
+
page: await (0, __thunderid_browser.getAgents)({
|
|
66
|
+
...agentsEndpoint,
|
|
67
|
+
fetcher,
|
|
68
|
+
filter,
|
|
69
|
+
limit: 100
|
|
70
|
+
})
|
|
56
71
|
}), { enabled: editable });
|
|
57
72
|
const add = require_useResourceMutation.default(({ groupId: id, members: changes }, fetcher) => (0, __thunderid_browser.addGroupMembers)({
|
|
58
73
|
...groupsEndpoint,
|
|
@@ -67,16 +82,23 @@ const GroupMembers = ({ administrationMode, editable = false, groupId, preferenc
|
|
|
67
82
|
groupId: id,
|
|
68
83
|
members: changes
|
|
69
84
|
}), getMembershipInvalidatedKeys);
|
|
70
|
-
const candidates = (0, react.useMemo)(() =>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
85
|
+
const candidates = (0, react.useMemo)(() => {
|
|
86
|
+
const current = (data) => data && data.filter === filter ? data.page : void 0;
|
|
87
|
+
return {
|
|
88
|
+
agent: (current(agents.data)?.agents ?? []).map((agent) => ({
|
|
89
|
+
id: agent.id,
|
|
90
|
+
label: (0, __thunderid_browser.getAgentName)(agent)
|
|
91
|
+
})),
|
|
92
|
+
user: (current(users.data)?.users ?? []).map((user) => ({
|
|
93
|
+
id: user.id,
|
|
94
|
+
label: (0, __thunderid_browser.resolveManagedIdentityName)(user)
|
|
95
|
+
}))
|
|
96
|
+
};
|
|
97
|
+
}, [
|
|
98
|
+
agents.data,
|
|
99
|
+
filter,
|
|
100
|
+
users.data
|
|
101
|
+
]);
|
|
80
102
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_BaseGroupMembers.default, {
|
|
81
103
|
members: members.data?.members ?? [],
|
|
82
104
|
isLoading: members.isLoading,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupMembers.cjs","names":["GroupQueryKeys","RoleQueryKeys","GroupMembers: FC<GroupMembersProps>","useTranslation","groupsEndpoint: ManagementEndpoint","useManagementEndpoint","usersEndpoint: ManagementEndpoint","agentsEndpoint: ManagementEndpoint","members: ResourceQueryResult<GroupMemberListResponse>","useResourceQuery","users: ResourceQueryResult<ManagedUserListResponse
|
|
1
|
+
{"version":3,"file":"GroupMembers.cjs","names":["GroupQueryKeys","RoleQueryKeys","GroupMembers: FC<GroupMembersProps>","useTranslation","groupsEndpoint: ManagementEndpoint","useManagementEndpoint","usersEndpoint: ManagementEndpoint","agentsEndpoint: ManagementEndpoint","filter: string | undefined","members: ResourceQueryResult<GroupMemberListResponse>","useResourceQuery","users: ResourceQueryResult<FilteredPage<ManagedUserListResponse>>","UserQueryKeys","agents: ResourceQueryResult<FilteredPage<AgentListResponse>>","AgentQueryKeys","add: ResourceMutationResult<Group, GroupMembersVariables>","useResourceMutation","remove: ResourceMutationResult<Group, GroupMembersVariables>","candidates: Partial<Record<'user' | 'agent', IdentityCandidate[]>>","BaseGroupMembers"],"sources":["../../../../../src/components/admin/GroupMembers/GroupMembers.tsx"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n AdministrationMode,\n AgentListResponse,\n AgentQueryKeys,\n BasicAgent,\n Group,\n GroupMember,\n GroupMemberListResponse,\n GroupQueryKeys,\n ManagedUser,\n ManagedUserListResponse,\n ResourceQueryKey,\n RoleQueryKeys,\n UserQueryKeys,\n addGroupMembers,\n getAgentName,\n getAgents,\n getGroupMembers,\n getUsers,\n removeGroupMembers,\n resolveManagedIdentityName,\n toEqualityFilter,\n toManagementErrorMessage,\n} from '@thunderid/browser';\nimport {FC, ReactElement, useMemo} from 'react';\nimport BaseGroupMembers, {BaseGroupMembersProps} from './BaseGroupMembers';\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';\nimport {IdentityCandidate} from '../shared/IdentityPicker';\n\ninterface GroupMembersVariables {\n groupId: string;\n members: Pick<GroupMember, 'id' | 'type'>[];\n}\n\n/**\n * A candidate page with the filter it was listed with.\n */\ninterface FilteredPage<T> {\n filter: string | undefined;\n page: T;\n}\n\n/**\n * Query keys to refetch after a group's membership changes.\n */\nconst getMembershipInvalidatedKeys = ({groupId}: GroupMembersVariables): ResourceQueryKey[] => [\n [GroupQueryKeys.GROUP, groupId],\n [GroupQueryKeys.GROUP_MEMBERS, groupId],\n [GroupQueryKeys.MEMBERSHIPS],\n [RoleQueryKeys.ROLE_ASSIGNMENTS],\n];\n\nexport type GroupMembersProps = Omit<\n BaseGroupMembersProps,\n 'candidates' | 'error' | 'isLoading' | 'isMutating' | 'members' | 'onAdd' | 'onRemove'\n> & {\n /**\n * How a member is removed. `flow` runs the administration flow the server configures for it, which can revoke\n * grants and end sessions first. It needs `baseUrl`.\n * @default 'native'\n */\n administrationMode?: AdministrationMode;\n /**\n * Whether members can be added and removed from this view.\n * @default false\n */\n editable?: boolean;\n groupId: string;\n /**\n * Organization unit the users and agents offered for adding are listed from.\n */\n ouId?: string;\n};\n\n/**\n * Lists the users and agents in a group, and lets the signed-in user add and remove them.\n *\n * @example\n * ```tsx\n * <GroupMembers groupId={groupId} />\n * ```\n */\nconst GroupMembers: FC<GroupMembersProps> = ({\n administrationMode,\n editable = false,\n groupId,\n ouId,\n preferences,\n ...rest\n}: GroupMembersProps): ReactElement => {\n const {t} = useTranslation(preferences?.i18n);\n const groupsEndpoint: ManagementEndpoint = useManagementEndpoint('groups');\n const usersEndpoint: ManagementEndpoint = useManagementEndpoint('users');\n const agentsEndpoint: ManagementEndpoint = useManagementEndpoint('agents');\n const filter: string | undefined = toEqualityFilter('ouId', ouId);\n const members: ResourceQueryResult<GroupMemberListResponse> = useResourceQuery(\n [GroupQueryKeys.GROUP_MEMBERS, groupId, {limit: 100}],\n (fetcher) => getGroupMembers({...groupsEndpoint, fetcher, groupId, limit: 100}),\n {enabled: Boolean(groupId)},\n );\n const users: ResourceQueryResult<FilteredPage<ManagedUserListResponse>> = useResourceQuery(\n [UserQueryKeys.USERS, {filter, limit: 100}],\n async (fetcher) => ({filter, page: await getUsers({...usersEndpoint, fetcher, filter, limit: 100})}),\n {enabled: editable},\n );\n const agents: ResourceQueryResult<FilteredPage<AgentListResponse>> = useResourceQuery(\n [AgentQueryKeys.AGENTS, {filter, limit: 100}],\n async (fetcher) => ({filter, page: await getAgents({...agentsEndpoint, fetcher, filter, limit: 100})}),\n {enabled: editable},\n );\n const add: ResourceMutationResult<Group, GroupMembersVariables> = useResourceMutation(\n ({groupId: id, members: changes}: GroupMembersVariables, fetcher) =>\n addGroupMembers({...groupsEndpoint, fetcher, groupId: id, members: changes}),\n getMembershipInvalidatedKeys,\n );\n const remove: ResourceMutationResult<Group, GroupMembersVariables> = useResourceMutation(\n ({groupId: id, members: changes}: GroupMembersVariables, fetcher) =>\n removeGroupMembers({...groupsEndpoint, administrationMode, fetcher, groupId: id, members: changes}),\n getMembershipInvalidatedKeys,\n );\n\n const candidates: Partial<Record<'user' | 'agent', IdentityCandidate[]>> = useMemo(() => {\n // A page listed for an earlier ouId stays in a query until the next one succeeds, so it is not offered.\n const current = <T,>(data: FilteredPage<T> | undefined): T | undefined =>\n data && data.filter === filter ? data.page : undefined;\n\n return {\n agent: (current(agents.data)?.agents ?? []).map((agent: BasicAgent) => ({\n id: agent.id,\n label: getAgentName(agent),\n })),\n user: (current(users.data)?.users ?? []).map((user: ManagedUser) => ({\n id: user.id,\n label: resolveManagedIdentityName(user),\n })),\n };\n }, [agents.data, filter, users.data]);\n\n return (\n <BaseGroupMembers\n members={members.data?.members ?? []}\n isLoading={members.isLoading}\n isMutating={add.isLoading || remove.isLoading}\n error={\n toManagementErrorMessage(t, members.error, 'admin.groups.members.error') ??\n toManagementErrorMessage(t, add.error ?? remove.error, 'admin.groups.members.update_error')\n }\n candidates={editable ? candidates : undefined}\n onAdd={\n editable\n ? (member: Pick<GroupMember, 'id' | 'type'>): void => void add.mutate({groupId, members: [member]})\n : undefined\n }\n onRemove={\n editable\n ? (member: GroupMember): void => void remove.mutate({groupId, members: [{id: member.id, type: member.type}]})\n : undefined\n }\n preferences={preferences}\n {...rest}\n />\n );\n};\n\nexport default GroupMembers;\n"],"mappings":";;;;;;;;;;;;;;;;;AAmDA,MAAM,gCAAgC,EAAC,cAAwD;CAC7F,CAACA,mCAAe,OAAO,QAAQ;CAC/B,CAACA,mCAAe,eAAe,QAAQ;CACvC,CAACA,mCAAe,YAAY;CAC5B,CAACC,kCAAc,iBAAiB;CACjC;;;;;;;;;AAgCD,MAAMC,gBAAuC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GACL,QAAQ,QAAQ,OAAO,KAAK,EAAE,UAAU,EAAE,EAAE,KAAK,WAAuB;IACtE,IAAI,MAAM;IACV,6CAAoB,MAAM;IAC3B,EAAE;GACH,OAAO,QAAQ,MAAM,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,UAAuB;IACnE,IAAI,KAAK;IACT,2DAAkC,KAAK;IACxC,EAAE;GACJ;IACA;EAAC,OAAO;EAAM;EAAQ,MAAM;EAAK,CAAC;AAErC,QACE,2CAACC;EACC,SAAS,QAAQ,MAAM,WAAW,EAAE;EACpC,WAAW,QAAQ;EACnB,YAAY,IAAI,aAAa,OAAO;EACpC,yDAC2B,GAAG,QAAQ,OAAO,6BAA6B,sDAC/C,GAAG,IAAI,SAAS,OAAO,OAAO,oCAAoC;EAE7F,YAAY,WAAW,aAAa;EACpC,OACE,YACK,WAAmD,KAAK,IAAI,OAAO;GAAC;GAAS,SAAS,CAAC,OAAO;GAAC,CAAC,GACjG;EAEN,UACE,YACK,WAA8B,KAAK,OAAO,OAAO;GAAC;GAAS,SAAS,CAAC;IAAC,IAAI,OAAO;IAAI,MAAM,OAAO;IAAK,CAAC;GAAC,CAAC,GAC3G;EAEO;EACb,GAAI;GACJ;;AAIN,2BAAe"}
|
|
@@ -8,8 +8,8 @@ const require_flowTransformer = require('../../../utils/flowTransformer.cjs');
|
|
|
8
8
|
const require_Spinner = require('../../primitives/Spinner/Spinner.cjs');
|
|
9
9
|
const require_Button = require('../../primitives/Button/Button.cjs');
|
|
10
10
|
const require_Typography = require('../../primitives/Typography/Typography.cjs');
|
|
11
|
-
const require_Alert = require('../../primitives/Alert/Alert.cjs');
|
|
12
11
|
const require_Card = require('../../primitives/Card/Card.cjs');
|
|
12
|
+
const require_Alert = require('../../primitives/Alert/Alert.cjs');
|
|
13
13
|
const require_isConsentApprovalBlocked = require('../../../utils/isConsentApprovalBlocked.cjs');
|
|
14
14
|
const require_AuthOptionFactory = require('../flow/AuthOptionFactory.cjs');
|
|
15
15
|
const require_useOAuthCallback = require('../../../hooks/auth/useOAuthCallback.cjs');
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_useTheme = require('../../../contexts/Theme/useTheme.cjs');
|
|
3
|
+
const require_useTranslation = require('../../../hooks/useTranslation.cjs');
|
|
4
|
+
const require_BaseDeviceGrant_styles = require('./BaseDeviceGrant.styles.cjs');
|
|
5
|
+
const require_Typography = require('../../primitives/Typography/Typography.cjs');
|
|
6
|
+
const require_Card = require('../../primitives/Card/Card.cjs');
|
|
7
|
+
const require_BaseSignIn = require('../SignIn/BaseSignIn.cjs');
|
|
8
|
+
let react = require("react");
|
|
9
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
12
|
+
|
|
13
|
+
//#region src/components/auth/DeviceGrant/BaseDeviceGrant.tsx
|
|
14
|
+
/** Renders the server-described Device Grant prompt independently of SDK orchestration. */
|
|
15
|
+
const BaseDeviceGrant = ({ components, className = "", completeMessage = void 0, completeDescription = void 0, failedMessage = void 0, failedDescription = void 0, error, isLoading, preferences, result = null, variant = "default",...signInProps }) => {
|
|
16
|
+
const { theme } = require_useTheme.default();
|
|
17
|
+
const { t } = require_useTranslation.default(preferences?.i18n);
|
|
18
|
+
const styles = require_BaseDeviceGrant_styles.default(theme);
|
|
19
|
+
if ((error || result) && components.length === 0) {
|
|
20
|
+
const isSuccess = result === "success" && !error;
|
|
21
|
+
const resolvedCompleteMessage = completeMessage ?? t("deviceGrant.messages.complete");
|
|
22
|
+
const resolvedCompleteDescription = completeDescription ?? t("deviceGrant.messages.completeDescription");
|
|
23
|
+
const resolvedFailedMessage = failedMessage ?? t("deviceGrant.messages.failed");
|
|
24
|
+
const resolvedFailedDescription = failedDescription ?? t("deviceGrant.messages.failedDescription");
|
|
25
|
+
const title = isSuccess ? resolvedCompleteMessage : resolvedFailedMessage;
|
|
26
|
+
const description = isSuccess ? resolvedCompleteDescription : !error || error.message === resolvedFailedMessage ? resolvedFailedDescription : error.message;
|
|
27
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Card.default, {
|
|
28
|
+
className: `${styles["terminalCard"]} ${className}`,
|
|
29
|
+
"data-testid": "device-grant-result",
|
|
30
|
+
variant,
|
|
31
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.default, {
|
|
32
|
+
className: styles["terminalTitle"],
|
|
33
|
+
color: isSuccess ? "success" : "error",
|
|
34
|
+
component: "h2",
|
|
35
|
+
fontWeight: 600,
|
|
36
|
+
variant: "h6",
|
|
37
|
+
children: title
|
|
38
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.default, {
|
|
39
|
+
className: styles["terminalDescription"],
|
|
40
|
+
color: "textSecondary",
|
|
41
|
+
component: "p",
|
|
42
|
+
variant: "caption",
|
|
43
|
+
children: description
|
|
44
|
+
})]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return /* @__PURE__ */ (0, react.createElement)(require_BaseSignIn.default, {
|
|
48
|
+
...signInProps,
|
|
49
|
+
className,
|
|
50
|
+
key: components.map((component) => component.id).join("|"),
|
|
51
|
+
components,
|
|
52
|
+
error,
|
|
53
|
+
isLoading,
|
|
54
|
+
preferences
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
var BaseDeviceGrant_default = BaseDeviceGrant;
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
exports.default = BaseDeviceGrant_default;
|
|
61
|
+
//# sourceMappingURL=BaseDeviceGrant.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseDeviceGrant.cjs","names":["BaseDeviceGrant: FC<BaseDeviceGrantProps>","useTheme","useTranslation","useStyles","CardPrimitive","Typography","BaseSignIn"],"sources":["../../../../../src/components/auth/DeviceGrant/BaseDeviceGrant.tsx"],"sourcesContent":["// Copyright 2025-2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {EmbeddedFlowComponent} from '@thunderid/browser';\nimport {FC, ReactElement} from 'react';\nimport useStyles from './BaseDeviceGrant.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport useTranslation from '../../../hooks/useTranslation';\nimport CardPrimitive from '../../primitives/Card/Card';\nimport Typography from '../../primitives/Typography/Typography';\nimport BaseSignIn, {type BaseSignInProps} from '../SignIn/BaseSignIn';\n\nexport type DeviceGrantResult = 'failure' | 'success' | null;\n\nexport interface BaseDeviceGrantProps extends Omit<BaseSignInProps, 'components' | 'onSubmit'> {\n components: EmbeddedFlowComponent[];\n completeMessage?: string;\n completeDescription?: string;\n failedMessage?: string;\n failedDescription?: string;\n onSubmit: NonNullable<BaseSignInProps['onSubmit']>;\n result?: DeviceGrantResult;\n}\n\n/** Renders the server-described Device Grant prompt independently of SDK orchestration. */\nconst BaseDeviceGrant: FC<BaseDeviceGrantProps> = ({\n components,\n className = '',\n completeMessage = undefined,\n completeDescription = undefined,\n failedMessage = undefined,\n failedDescription = undefined,\n error,\n isLoading,\n preferences,\n result = null,\n variant = 'default',\n ...signInProps\n}: BaseDeviceGrantProps): ReactElement => {\n const {theme} = useTheme();\n const {t} = useTranslation(preferences?.i18n);\n const styles = useStyles(theme);\n\n if ((error || result) && components.length === 0) {\n const isSuccess = result === 'success' && !error;\n const resolvedCompleteMessage = completeMessage ?? t('deviceGrant.messages.complete');\n const resolvedCompleteDescription = completeDescription ?? t('deviceGrant.messages.completeDescription');\n const resolvedFailedMessage = failedMessage ?? t('deviceGrant.messages.failed');\n const resolvedFailedDescription = failedDescription ?? t('deviceGrant.messages.failedDescription');\n const title = isSuccess ? resolvedCompleteMessage : resolvedFailedMessage;\n const description = isSuccess\n ? resolvedCompleteDescription\n : !error || error.message === resolvedFailedMessage\n ? resolvedFailedDescription\n : error.message;\n\n return (\n <CardPrimitive\n className={`${styles['terminalCard']} ${className}`}\n data-testid=\"device-grant-result\"\n variant={variant}\n >\n <Typography\n className={styles['terminalTitle']}\n color={isSuccess ? 'success' : 'error'}\n component=\"h2\"\n fontWeight={600}\n variant=\"h6\"\n >\n {title}\n </Typography>\n <Typography className={styles['terminalDescription']} color=\"textSecondary\" component=\"p\" variant=\"caption\">\n {description}\n </Typography>\n </CardPrimitive>\n );\n }\n\n return (\n <BaseSignIn\n {...signInProps}\n className={className}\n key={components.map((component: EmbeddedFlowComponent) => component.id).join('|')}\n components={components}\n error={error}\n isLoading={isLoading}\n preferences={preferences}\n />\n );\n};\n\nexport default BaseDeviceGrant;\n"],"mappings":";;;;;;;;;;;;;;AAyBA,MAAMA,mBAA6C,EACjD,YACA,YAAY,IACZ,kBAAkB,QAClB,sBAAsB,QACtB,gBAAgB,QAChB,oBAAoB,QACpB,OACA,WACA,aACA,SAAS,MACT,UAAU,UACV,GAAG,kBACqC;CACxC,MAAM,EAAC,UAASC,0BAAU;CAC1B,MAAM,EAAC,MAAKC,+BAAe,aAAa,KAAK;CAC7C,MAAM,SAASC,uCAAU,MAAM;AAE/B,MAAK,SAAS,WAAW,WAAW,WAAW,GAAG;EAChD,MAAM,YAAY,WAAW,aAAa,CAAC;EAC3C,MAAM,0BAA0B,mBAAmB,EAAE,gCAAgC;EACrF,MAAM,8BAA8B,uBAAuB,EAAE,2CAA2C;EACxG,MAAM,wBAAwB,iBAAiB,EAAE,8BAA8B;EAC/E,MAAM,4BAA4B,qBAAqB,EAAE,yCAAyC;EAClG,MAAM,QAAQ,YAAY,0BAA0B;EACpD,MAAM,cAAc,YAChB,8BACA,CAAC,SAAS,MAAM,YAAY,wBAC1B,4BACA,MAAM;AAEZ,SACE,4CAACC;GACC,WAAW,GAAG,OAAO,gBAAgB,GAAG;GACxC,eAAY;GACH;cAET,2CAACC;IACC,WAAW,OAAO;IAClB,OAAO,YAAY,YAAY;IAC/B,WAAU;IACV,YAAY;IACZ,SAAQ;cAEP;KACU,EACb,2CAACA;IAAW,WAAW,OAAO;IAAwB,OAAM;IAAgB,WAAU;IAAI,SAAQ;cAC/F;KACU;IACC;;AAIpB,QACE,yCAACC;EACC,GAAI;EACO;EACX,KAAK,WAAW,KAAK,cAAqC,UAAU,GAAG,CAAC,KAAK,IAAI;EACrE;EACL;EACI;EACE;GACb;;AAIN,8BAAe"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_emotion = require('../../../styles/emotion.cjs');
|
|
3
|
+
let react = require("react");
|
|
4
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
5
|
+
|
|
6
|
+
//#region src/components/auth/DeviceGrant/BaseDeviceGrant.styles.ts
|
|
7
|
+
const useStyles = (theme) => (0, react.useMemo)(() => ({
|
|
8
|
+
terminalCard: require_emotion.css`
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
width: 100%;
|
|
11
|
+
max-width: calc(${theme.vars.spacing.unit} * 60);
|
|
12
|
+
margin: 0 auto;
|
|
13
|
+
gap: ${theme.vars.spacing.unit};
|
|
14
|
+
`,
|
|
15
|
+
terminalDescription: require_emotion.css`
|
|
16
|
+
margin: 0;
|
|
17
|
+
`,
|
|
18
|
+
terminalTitle: require_emotion.css`
|
|
19
|
+
margin: 0;
|
|
20
|
+
`
|
|
21
|
+
}), [theme]);
|
|
22
|
+
var BaseDeviceGrant_styles_default = useStyles;
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.default = BaseDeviceGrant_styles_default;
|
|
26
|
+
//# sourceMappingURL=BaseDeviceGrant.styles.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseDeviceGrant.styles.cjs","names":[],"sources":["../../../../../src/components/auth/DeviceGrant/BaseDeviceGrant.styles.ts"],"sourcesContent":["// Copyright 2025-2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\nimport {css} from '../../../styles/emotion';\n\nconst useStyles = (theme: Theme): Record<string, string> =>\n useMemo(\n () => ({\n terminalCard: css`\n box-sizing: border-box;\n width: 100%;\n max-width: calc(${theme.vars.spacing.unit} * 60);\n margin: 0 auto;\n gap: ${theme.vars.spacing.unit};\n `,\n terminalDescription: css`\n margin: 0;\n `,\n terminalTitle: css`\n margin: 0;\n `,\n }),\n [theme],\n );\n\nexport default useStyles;\n"],"mappings":";;;;;;AAOA,MAAM,aAAa,oCAER;CACL,cAAc,mBAAG;;;0BAGG,MAAM,KAAK,QAAQ,KAAK;;eAEnC,MAAM,KAAK,QAAQ,KAAK;;CAEjC,qBAAqB,mBAAG;;;CAGxB,eAAe,mBAAG;;;CAGnB,GACD,CAAC,MAAM,CACR;AAEH,qCAAe"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_useThunderID = require('../../../contexts/ThunderID/useThunderID.cjs');
|
|
3
|
+
const require_useTranslation = require('../../../hooks/useTranslation.cjs');
|
|
4
|
+
const require_flowTransformer = require('../../../utils/flowTransformer.cjs');
|
|
5
|
+
const require_BaseDeviceGrant = require('./BaseDeviceGrant.cjs');
|
|
6
|
+
let __thunderid_browser = require("@thunderid/browser");
|
|
7
|
+
__thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
8
|
+
let react = require("react");
|
|
9
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
12
|
+
|
|
13
|
+
//#region src/components/auth/DeviceGrant/DeviceGrant.tsx
|
|
14
|
+
const clearVerificationParameters = () => {
|
|
15
|
+
if (!window.location.href) return;
|
|
16
|
+
const url = new URL(window.location.href);
|
|
17
|
+
url.searchParams.delete("user_code");
|
|
18
|
+
url.searchParams.delete("applicationId");
|
|
19
|
+
window.history.replaceState(window.history.state, "", url.toString());
|
|
20
|
+
};
|
|
21
|
+
const hasUserCodeInput = (components) => components.some((component) => component.ref === "user_code" || Array.isArray(component.components) && hasUserCodeInput(component.components));
|
|
22
|
+
/**
|
|
23
|
+
* Runs the application's configured Device Grant flow and exposes its state for custom renderers.
|
|
24
|
+
*/
|
|
25
|
+
const DeviceGrant = ({ children = void 0, className = "", onComplete = void 0, onError = void 0, preferences = {}, size = "medium", variant = "default",...baseProps }) => {
|
|
26
|
+
const { applicationId, baseUrl, meta } = require_useThunderID.default();
|
|
27
|
+
const { t } = require_useTranslation.default(preferences?.i18n);
|
|
28
|
+
const [components, setComponents] = (0, react.useState)([]);
|
|
29
|
+
const [additionalData, setAdditionalData] = (0, react.useState)({});
|
|
30
|
+
const [initialValues, setInitialValues] = (0, react.useState)({});
|
|
31
|
+
const [serverFieldErrors, setServerFieldErrors] = (0, react.useState)(null);
|
|
32
|
+
const [executionId, setExecutionId] = (0, react.useState)("");
|
|
33
|
+
const [challengeToken, setChallengeToken] = (0, react.useState)("");
|
|
34
|
+
const [error, setError] = (0, react.useState)(null);
|
|
35
|
+
const [isLoading, setIsLoading] = (0, react.useState)(() => {
|
|
36
|
+
if (applicationId) return true;
|
|
37
|
+
return typeof window !== "undefined" && Boolean(new URL(window.location.href).searchParams.get("applicationId"));
|
|
38
|
+
});
|
|
39
|
+
const [result, setResult] = (0, react.useState)(null);
|
|
40
|
+
const flowStartAttempted = (0, react.useRef)(false);
|
|
41
|
+
const verificationParametersRead = (0, react.useRef)(false);
|
|
42
|
+
const handleError = (0, react.useCallback)((flowError) => {
|
|
43
|
+
setComponents([]);
|
|
44
|
+
setAdditionalData({});
|
|
45
|
+
setServerFieldErrors(null);
|
|
46
|
+
setError(flowError);
|
|
47
|
+
setResult("failure");
|
|
48
|
+
onError?.(flowError);
|
|
49
|
+
}, [onError]);
|
|
50
|
+
const applyResponse = (0, react.useCallback)((response) => {
|
|
51
|
+
const normalized = require_flowTransformer.normalizeFlowResponse(response, t, {
|
|
52
|
+
throwOnError: false,
|
|
53
|
+
resolveTranslations: false
|
|
54
|
+
}, meta);
|
|
55
|
+
setExecutionId(response.executionId);
|
|
56
|
+
setChallengeToken(response.challengeToken ?? "");
|
|
57
|
+
setComponents(normalized.components);
|
|
58
|
+
setAdditionalData(normalized.additionalData);
|
|
59
|
+
setServerFieldErrors(response.data?.fieldErrors ?? null);
|
|
60
|
+
setError(response.error ? new Error(require_flowTransformer.extractErrorMessage(response, t)) : null);
|
|
61
|
+
if (response.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.Complete) {
|
|
62
|
+
setResult("success");
|
|
63
|
+
onComplete?.(response);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (response.flowStatus === __thunderid_browser.EmbeddedSignInFlowStatus.Error) {
|
|
67
|
+
const flowError = new Error(require_flowTransformer.extractErrorMessage(response, t, "deviceGrant.messages.failed"));
|
|
68
|
+
setError(flowError);
|
|
69
|
+
setResult("failure");
|
|
70
|
+
onError?.(flowError);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
setResult(null);
|
|
74
|
+
}, [
|
|
75
|
+
meta,
|
|
76
|
+
onComplete,
|
|
77
|
+
onError,
|
|
78
|
+
t
|
|
79
|
+
]);
|
|
80
|
+
const startFlow = (0, react.useCallback)(async (appId) => {
|
|
81
|
+
setIsLoading(true);
|
|
82
|
+
setError(null);
|
|
83
|
+
try {
|
|
84
|
+
const response = await (0, __thunderid_browser.executeEmbeddedDeviceGrantFlow)({
|
|
85
|
+
baseUrl,
|
|
86
|
+
payload: {
|
|
87
|
+
applicationId: appId,
|
|
88
|
+
flowType: __thunderid_browser.EmbeddedFlowType.DeviceGrant,
|
|
89
|
+
inputs: {}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
clearVerificationParameters();
|
|
93
|
+
applyResponse(response);
|
|
94
|
+
} catch (flowError) {
|
|
95
|
+
handleError(flowError instanceof Error ? flowError : new Error(t("deviceGrant.errors.continue")));
|
|
96
|
+
} finally {
|
|
97
|
+
setIsLoading(false);
|
|
98
|
+
}
|
|
99
|
+
}, [
|
|
100
|
+
applyResponse,
|
|
101
|
+
baseUrl,
|
|
102
|
+
handleError,
|
|
103
|
+
t
|
|
104
|
+
]);
|
|
105
|
+
(0, react.useEffect)(() => {
|
|
106
|
+
const url = new URL(window.location.href);
|
|
107
|
+
if (!verificationParametersRead.current) {
|
|
108
|
+
verificationParametersRead.current = true;
|
|
109
|
+
const userCode = url.searchParams.get("user_code") ?? "";
|
|
110
|
+
if (userCode) setInitialValues({ user_code: userCode });
|
|
111
|
+
}
|
|
112
|
+
const applicationIdFromUrl = url.searchParams.get("applicationId");
|
|
113
|
+
const appId = applicationIdFromUrl?.trim() ? applicationIdFromUrl : applicationId;
|
|
114
|
+
if (flowStartAttempted.current) return;
|
|
115
|
+
if (!appId) {
|
|
116
|
+
flowStartAttempted.current = true;
|
|
117
|
+
handleError(new Error(t("deviceGrant.errors.start")));
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
flowStartAttempted.current = true;
|
|
121
|
+
startFlow(appId);
|
|
122
|
+
}, [
|
|
123
|
+
applicationId,
|
|
124
|
+
handleError,
|
|
125
|
+
startFlow,
|
|
126
|
+
t
|
|
127
|
+
]);
|
|
128
|
+
const submit = async (payload, actionId) => {
|
|
129
|
+
setIsLoading(true);
|
|
130
|
+
setError(null);
|
|
131
|
+
setResult(null);
|
|
132
|
+
try {
|
|
133
|
+
if (!executionId) return;
|
|
134
|
+
applyResponse(await (0, __thunderid_browser.executeEmbeddedDeviceGrantFlow)({
|
|
135
|
+
baseUrl,
|
|
136
|
+
payload: {
|
|
137
|
+
action: payload.action ?? actionId,
|
|
138
|
+
challengeToken,
|
|
139
|
+
executionId,
|
|
140
|
+
inputs: {
|
|
141
|
+
...Object.fromEntries(Object.entries(payload.inputs ?? {}).filter(([key]) => !key.startsWith("__consent_opt__"))),
|
|
142
|
+
...!hasUserCodeInput(components) ? { user_code: void 0 } : {}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}));
|
|
146
|
+
} catch (flowError) {
|
|
147
|
+
handleError(flowError instanceof Error ? flowError : new Error(t("deviceGrant.errors.continue")));
|
|
148
|
+
} finally {
|
|
149
|
+
setIsLoading(false);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
const handleBaseSubmit = (payload, component) => submit(payload, component.id);
|
|
153
|
+
const fieldErrors = (0, react.useMemo)(() => {
|
|
154
|
+
const errors = {};
|
|
155
|
+
(serverFieldErrors ?? []).forEach((fieldError) => {
|
|
156
|
+
if (!(fieldError.identifier in errors)) errors[fieldError.identifier] = fieldError.message;
|
|
157
|
+
});
|
|
158
|
+
return errors;
|
|
159
|
+
}, [serverFieldErrors]);
|
|
160
|
+
if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: children({
|
|
161
|
+
additionalData,
|
|
162
|
+
components,
|
|
163
|
+
error,
|
|
164
|
+
fieldErrors,
|
|
165
|
+
initialValues,
|
|
166
|
+
isLoading,
|
|
167
|
+
meta,
|
|
168
|
+
onSubmit: submit,
|
|
169
|
+
result
|
|
170
|
+
}) });
|
|
171
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_BaseDeviceGrant.default, {
|
|
172
|
+
...baseProps,
|
|
173
|
+
className,
|
|
174
|
+
components,
|
|
175
|
+
additionalData,
|
|
176
|
+
error,
|
|
177
|
+
initialValues,
|
|
178
|
+
isLoading,
|
|
179
|
+
onError: handleError,
|
|
180
|
+
onSubmit: handleBaseSubmit,
|
|
181
|
+
preferences,
|
|
182
|
+
result,
|
|
183
|
+
serverFieldErrors,
|
|
184
|
+
size,
|
|
185
|
+
variant
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
var DeviceGrant_default = DeviceGrant;
|
|
189
|
+
|
|
190
|
+
//#endregion
|
|
191
|
+
exports.default = DeviceGrant_default;
|
|
192
|
+
//# sourceMappingURL=DeviceGrant.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeviceGrant.cjs","names":["DeviceGrant: FC<DeviceGrantProps>","useThunderID","useTranslation","normalizeFlowResponse","extractErrorMessage","EmbeddedSignInFlowStatus","EmbeddedFlowType","errors: Record<string, string>","BaseDeviceGrant"],"sources":["../../../../../src/components/auth/DeviceGrant/DeviceGrant.tsx"],"sourcesContent":["// Copyright 2025-2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {EmbeddedFlowType, EmbeddedSignInFlowStatus, executeEmbeddedDeviceGrantFlow} from '@thunderid/browser';\nimport type {EmbeddedFlowComponent, EmbeddedSignInFlowRequest, FlowMetadataResponse} from '@thunderid/browser';\nimport {useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport type {FC, ReactElement, ReactNode} from 'react';\nimport BaseDeviceGrant, {type BaseDeviceGrantProps, type DeviceGrantResult} from './BaseDeviceGrant';\nimport useThunderID from '../../../contexts/ThunderID/useThunderID';\nimport useTranslation from '../../../hooks/useTranslation';\nimport {extractErrorMessage, normalizeFlowResponse} from '../../../utils/flowTransformer';\n\ntype EmbeddedDeviceGrantFlowResponse = Awaited<ReturnType<typeof executeEmbeddedDeviceGrantFlow>>;\ntype DeviceGrantFieldError = NonNullable<EmbeddedDeviceGrantFlowResponse['data']['fieldErrors']>[number];\n\n/** Values exposed to consumers that provide custom Device Grant UI. */\nexport interface DeviceGrantRenderProps {\n /** Additional values returned for the active flow step. */\n additionalData: Record<string, unknown>;\n /** Components returned by the configured flow. */\n components: EmbeddedFlowComponent[];\n /** Current flow error, when one needs to be shown. */\n error: Error | null;\n /** First server validation message for each field. */\n fieldErrors: Record<string, string>;\n /** Values prefilled from the verification URI. */\n initialValues: Record<string, string>;\n /** Whether a flow request is in progress. */\n isLoading: boolean;\n /** Flow metadata used to resolve application-specific template values. */\n meta: FlowMetadataResponse | null;\n /** Submits user-code input or continues the active flow. */\n onSubmit: (payload: EmbeddedSignInFlowRequest) => Promise<void>;\n /** Terminal flow result when the flow has no configured prompt to render. */\n result: DeviceGrantResult;\n}\n\nexport type DeviceGrantProps = Omit<\n BaseDeviceGrantProps,\n 'children' | 'components' | 'error' | 'initialValues' | 'isLoading' | 'onSubmit' | 'result' | 'serverFieldErrors'\n> & {\n /** Render props for Gate or other consumers that provide their own flow UI. */\n children?: (props: DeviceGrantRenderProps) => ReactNode;\n onComplete?: (response: EmbeddedDeviceGrantFlowResponse) => void;\n};\n\nconst clearVerificationParameters = (): void => {\n if (!window.location.href) return;\n const url = new URL(window.location.href);\n url.searchParams.delete('user_code');\n url.searchParams.delete('applicationId');\n window.history.replaceState(window.history.state, '', url.toString());\n};\n\nconst hasUserCodeInput = (components: EmbeddedFlowComponent[]): boolean =>\n components.some(\n (component: EmbeddedFlowComponent) =>\n component.ref === 'user_code' || (Array.isArray(component.components) && hasUserCodeInput(component.components)),\n );\n\n/**\n * Runs the application's configured Device Grant flow and exposes its state for custom renderers.\n */\nconst DeviceGrant: FC<DeviceGrantProps> = ({\n children = undefined,\n className = '',\n onComplete = undefined,\n onError = undefined,\n preferences = {},\n size = 'medium',\n variant = 'default',\n ...baseProps\n}: DeviceGrantProps): ReactElement => {\n const {applicationId, baseUrl, meta} = useThunderID();\n const {t} = useTranslation(preferences?.i18n);\n const [components, setComponents] = useState<EmbeddedFlowComponent[]>([]);\n const [additionalData, setAdditionalData] = useState<Record<string, unknown>>({});\n const [initialValues, setInitialValues] = useState<Record<string, string>>({});\n const [serverFieldErrors, setServerFieldErrors] = useState<\n EmbeddedDeviceGrantFlowResponse['data']['fieldErrors'] | null\n >(null);\n const [executionId, setExecutionId] = useState('');\n const [challengeToken, setChallengeToken] = useState('');\n const [error, setError] = useState<Error | null>(null);\n const [isLoading, setIsLoading] = useState(() => {\n if (applicationId) return true;\n return typeof window !== 'undefined' && Boolean(new URL(window.location.href).searchParams.get('applicationId'));\n });\n const [result, setResult] = useState<DeviceGrantResult>(null);\n const flowStartAttempted = useRef(false);\n const verificationParametersRead = useRef(false);\n\n const handleError = useCallback(\n (flowError: Error): void => {\n setComponents([]);\n setAdditionalData({});\n setServerFieldErrors(null);\n setError(flowError);\n setResult('failure');\n onError?.(flowError);\n },\n [onError],\n );\n\n const applyResponse = useCallback(\n (response: EmbeddedDeviceGrantFlowResponse): void => {\n const normalized = normalizeFlowResponse(\n response,\n t,\n {\n throwOnError: false,\n resolveTranslations: false,\n },\n meta,\n );\n setExecutionId(response.executionId);\n setChallengeToken(response.challengeToken ?? '');\n setComponents(normalized.components);\n setAdditionalData(normalized.additionalData);\n setServerFieldErrors(response.data?.fieldErrors ?? null);\n setError(response.error ? new Error(extractErrorMessage(response, t)) : null);\n\n if (response.flowStatus === EmbeddedSignInFlowStatus.Complete) {\n setResult('success');\n onComplete?.(response);\n return;\n }\n\n if (response.flowStatus === EmbeddedSignInFlowStatus.Error) {\n const flowError = new Error(extractErrorMessage(response, t, 'deviceGrant.messages.failed'));\n setError(flowError);\n setResult('failure');\n onError?.(flowError);\n return;\n }\n\n setResult(null);\n },\n [meta, onComplete, onError, t],\n );\n\n const startFlow = useCallback(\n async (appId: string): Promise<void> => {\n setIsLoading(true);\n setError(null);\n try {\n const response = await executeEmbeddedDeviceGrantFlow({\n baseUrl,\n payload: {\n applicationId: appId,\n flowType: EmbeddedFlowType.DeviceGrant,\n inputs: {},\n },\n });\n clearVerificationParameters();\n applyResponse(response);\n } catch (flowError) {\n handleError(flowError instanceof Error ? flowError : new Error(t('deviceGrant.errors.continue')));\n } finally {\n setIsLoading(false);\n }\n },\n [applyResponse, baseUrl, handleError, t],\n );\n\n useEffect(() => {\n const url = new URL(window.location.href);\n if (!verificationParametersRead.current) {\n verificationParametersRead.current = true;\n const userCode = url.searchParams.get('user_code') ?? '';\n if (userCode) setInitialValues({user_code: userCode});\n }\n\n const applicationIdFromUrl = url.searchParams.get('applicationId');\n const appId = applicationIdFromUrl?.trim() ? applicationIdFromUrl : applicationId;\n if (flowStartAttempted.current) return;\n if (!appId) {\n flowStartAttempted.current = true;\n handleError(new Error(t('deviceGrant.errors.start')));\n return;\n }\n\n flowStartAttempted.current = true;\n void startFlow(appId);\n }, [applicationId, handleError, startFlow, t]);\n\n const submit = async (payload: EmbeddedSignInFlowRequest, actionId?: string): Promise<void> => {\n setIsLoading(true);\n setError(null);\n setResult(null);\n try {\n if (!executionId) return;\n\n const response = await executeEmbeddedDeviceGrantFlow({\n baseUrl,\n payload: {\n action: payload.action ?? actionId,\n challengeToken,\n executionId,\n inputs: {\n ...Object.fromEntries(\n Object.entries(payload.inputs ?? {}).filter(\n ([key]: [string, unknown]) => !key.startsWith('__consent_opt__'),\n ),\n ),\n ...(!hasUserCodeInput(components) ? {user_code: undefined} : {}),\n },\n },\n });\n applyResponse(response);\n } catch (flowError) {\n handleError(flowError instanceof Error ? flowError : new Error(t('deviceGrant.errors.continue')));\n } finally {\n setIsLoading(false);\n }\n };\n\n const handleBaseSubmit = (payload: EmbeddedSignInFlowRequest, component: EmbeddedFlowComponent): Promise<void> =>\n submit(payload, component.id);\n\n const fieldErrors = useMemo<Record<string, string>>(() => {\n const errors: Record<string, string> = {};\n (serverFieldErrors ?? []).forEach((fieldError: DeviceGrantFieldError) => {\n if (!(fieldError.identifier in errors)) errors[fieldError.identifier] = fieldError.message;\n });\n\n return errors;\n }, [serverFieldErrors]);\n\n if (children) {\n return (\n <>\n {children({\n additionalData,\n components,\n error,\n fieldErrors,\n initialValues,\n isLoading,\n meta,\n onSubmit: submit,\n result,\n })}\n </>\n );\n }\n\n return (\n <BaseDeviceGrant\n {...baseProps}\n className={className}\n components={components}\n additionalData={additionalData}\n error={error}\n initialValues={initialValues}\n isLoading={isLoading}\n onError={handleError}\n onSubmit={handleBaseSubmit}\n preferences={preferences}\n result={result}\n serverFieldErrors={serverFieldErrors}\n size={size}\n variant={variant}\n />\n );\n};\n\nexport default DeviceGrant;\n"],"mappings":";;;;;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mFACG,SAAS;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;EACV;EACD,CAAC,GACD;AAIP,QACE,2CAACC;EACC,GAAI;EACO;EACC;EACI;EACT;EACQ;EACJ;EACX,SAAS;EACT,UAAU;EACG;EACL;EACW;EACb;EACG;GACT;;AAIN,0BAAe"}
|
|
@@ -7,8 +7,8 @@ const require_useTranslation = require('../../../hooks/useTranslation.cjs');
|
|
|
7
7
|
const require_flowTransformer = require('../../../utils/flowTransformer.cjs');
|
|
8
8
|
const require_Spinner = require('../../primitives/Spinner/Spinner.cjs');
|
|
9
9
|
const require_Typography = require('../../primitives/Typography/Typography.cjs');
|
|
10
|
-
const require_Alert = require('../../primitives/Alert/Alert.cjs');
|
|
11
10
|
const require_Card = require('../../primitives/Card/Card.cjs');
|
|
11
|
+
const require_Alert = require('../../primitives/Alert/Alert.cjs');
|
|
12
12
|
const require_AuthOptionFactory = require('../flow/AuthOptionFactory.cjs');
|
|
13
13
|
const require_BaseInviteUser_styles = require('./BaseInviteUser.styles.cjs');
|
|
14
14
|
let __thunderid_browser = require("@thunderid/browser");
|
|
@@ -10,10 +10,10 @@ const require_useTranslation = require('../../../hooks/useTranslation.cjs');
|
|
|
10
10
|
const require_flowTransformer = require('../../../utils/flowTransformer.cjs');
|
|
11
11
|
const require_useForm = require('../../../hooks/useForm.cjs');
|
|
12
12
|
const require_Spinner = require('../../primitives/Spinner/Spinner.cjs');
|
|
13
|
-
const require_composeAffixedInputs = require('../../../utils/composeAffixedInputs.cjs');
|
|
14
13
|
const require_Typography = require('../../primitives/Typography/Typography.cjs');
|
|
15
|
-
const require_Alert = require('../../primitives/Alert/Alert.cjs');
|
|
16
14
|
const require_Card = require('../../primitives/Card/Card.cjs');
|
|
15
|
+
const require_composeAffixedInputs = require('../../../utils/composeAffixedInputs.cjs');
|
|
16
|
+
const require_Alert = require('../../primitives/Alert/Alert.cjs');
|
|
17
17
|
const require_AuthOptionFactory = require('../flow/AuthOptionFactory.cjs');
|
|
18
18
|
const require_BaseSignUp_styles = require('../SignUp/BaseSignUp.styles.cjs');
|
|
19
19
|
const require_getAuthComponentHeadings = require('../../../utils/getAuthComponentHeadings.cjs');
|
|
@@ -10,11 +10,11 @@ const require_useTranslation = require('../../../hooks/useTranslation.cjs');
|
|
|
10
10
|
const require_flowTransformer = require('../../../utils/flowTransformer.cjs');
|
|
11
11
|
const require_useForm = require('../../../hooks/useForm.cjs');
|
|
12
12
|
const require_Spinner = require('../../primitives/Spinner/Spinner.cjs');
|
|
13
|
+
const require_Typography = require('../../primitives/Typography/Typography.cjs');
|
|
14
|
+
const require_Card = require('../../primitives/Card/Card.cjs');
|
|
13
15
|
const require_BaseSignIn_styles = require('./BaseSignIn.styles.cjs');
|
|
14
16
|
const require_composeAffixedInputs = require('../../../utils/composeAffixedInputs.cjs');
|
|
15
|
-
const require_Typography = require('../../primitives/Typography/Typography.cjs');
|
|
16
17
|
const require_Alert = require('../../primitives/Alert/Alert.cjs');
|
|
17
|
-
const require_Card = require('../../primitives/Card/Card.cjs');
|
|
18
18
|
const require_AuthOptionFactory = require('../flow/AuthOptionFactory.cjs');
|
|
19
19
|
let __thunderid_browser = require("@thunderid/browser");
|
|
20
20
|
__thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
@@ -27,7 +27,7 @@ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
|
27
27
|
/**
|
|
28
28
|
* Internal component that consumes FlowContext and renders the sign-in UI.
|
|
29
29
|
*/
|
|
30
|
-
const BaseSignInContent = ({ components = [], onSubmit, onError, error: externalError, id, className = "", inputClassName = "", buttonClassName = "", messageClassName = "", size = "medium", variant = "outlined", isLoading: externalIsLoading, children, additionalData = {}, isTimeoutDisabled = false, serverFieldErrors = null, revalidateOnChangeAfterBlur = false }) => {
|
|
30
|
+
const BaseSignInContent = ({ components = [], onSubmit, onError, error: externalError, id, className = "", inputClassName = "", buttonClassName = "", messageClassName = "", size = "medium", variant = "outlined", isLoading: externalIsLoading, initialValues, children, additionalData = {}, isTimeoutDisabled = false, serverFieldErrors = null, revalidateOnChangeAfterBlur = false }) => {
|
|
31
31
|
const { meta, vendor } = require_useThunderID.default();
|
|
32
32
|
const { theme } = require_useTheme.default();
|
|
33
33
|
const customRenderers = (0, react.useContext)(require_ComponentRendererContext.default);
|
|
@@ -98,7 +98,7 @@ const BaseSignInContent = ({ components = [], onSubmit, onError, error: external
|
|
|
98
98
|
processComponents(flowComponents);
|
|
99
99
|
return fields;
|
|
100
100
|
}, [t]);
|
|
101
|
-
const { values: formValues, touched: touchedFields, errors: formErrors, isValid: isFormValid, setValue: setFormValue, setTouched: setFormTouched, setTouchedFields, setErrors: setFormErrors, clearErrors: clearFormErrors, validateForm, touchAllFields, reset: resetForm, revalidateTouchedFields } = require_useForm.useForm({
|
|
101
|
+
const { values: formValues, touched: touchedFields, errors: formErrors, isValid: isFormValid, setValue: setFormValue, setValues: setFormValues, setTouched: setFormTouched, setTouchedFields, setErrors: setFormErrors, clearErrors: clearFormErrors, validateForm, touchAllFields, reset: resetForm, revalidateTouchedFields } = require_useForm.useForm({
|
|
102
102
|
fields: (0, react.useMemo)(() => components ? extractFormFields(components) : [], [components, extractFormFields]),
|
|
103
103
|
initialValues: {},
|
|
104
104
|
requiredMessage: t("validations.required.field.error"),
|
|
@@ -106,6 +106,17 @@ const BaseSignInContent = ({ components = [], onSubmit, onError, error: external
|
|
|
106
106
|
validateOnBlur: true,
|
|
107
107
|
validateOnChange: false
|
|
108
108
|
});
|
|
109
|
+
const initialValuesKey = (0, react.useMemo)(() => JSON.stringify(Object.entries(initialValues ?? {}).sort(([left], [right]) => left.localeCompare(right))), [initialValues]);
|
|
110
|
+
const appliedInitialValuesKeyRef = (0, react.useRef)(null);
|
|
111
|
+
(0, react.useEffect)(() => {
|
|
112
|
+
if (!initialValues || Object.keys(initialValues).length === 0 || appliedInitialValuesKeyRef.current === initialValuesKey) return;
|
|
113
|
+
appliedInitialValuesKeyRef.current = initialValuesKey;
|
|
114
|
+
setFormValues(initialValues);
|
|
115
|
+
}, [
|
|
116
|
+
initialValues,
|
|
117
|
+
initialValuesKey,
|
|
118
|
+
setFormValues
|
|
119
|
+
]);
|
|
109
120
|
(0, react.useEffect)(() => {
|
|
110
121
|
clearFormErrors();
|
|
111
122
|
if (!serverFieldErrors || serverFieldErrors.length === 0) return;
|