@thunderid/react 1.15.1 → 1.17.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.
Files changed (55) hide show
  1. package/dist/cjs/components/management/AgentCreate/AgentCreate.cjs.map +1 -1
  2. package/dist/cjs/components/management/AgentDetails/BaseAgentDetails.cjs +1 -1
  3. package/dist/cjs/components/management/AgentDetails/BaseAgentDetails.cjs.map +1 -1
  4. package/dist/cjs/components/management/FlowVariables/BaseFlowVariables.cjs +210 -0
  5. package/dist/cjs/components/management/FlowVariables/BaseFlowVariables.cjs.map +1 -0
  6. package/dist/cjs/components/management/FlowVariables/FlowVariableField.cjs +162 -0
  7. package/dist/cjs/components/management/FlowVariables/FlowVariableField.cjs.map +1 -0
  8. package/dist/cjs/components/management/FlowVariables/FlowVariables.styles.cjs +123 -0
  9. package/dist/cjs/components/management/FlowVariables/FlowVariables.styles.cjs.map +1 -0
  10. package/dist/cjs/components/management/FlowVariables/FlowVariablesForm.cjs +50 -0
  11. package/dist/cjs/components/management/FlowVariables/FlowVariablesForm.cjs.map +1 -0
  12. package/dist/cjs/components/management/SharedFlowList/BaseSharedFlowList.cjs +78 -0
  13. package/dist/cjs/components/management/SharedFlowList/BaseSharedFlowList.cjs.map +1 -0
  14. package/dist/cjs/components/management/SharedFlowList/SharedFlowList.cjs +69 -0
  15. package/dist/cjs/components/management/SharedFlowList/SharedFlowList.cjs.map +1 -0
  16. package/dist/cjs/hooks/management/useFlowVariables.cjs +107 -0
  17. package/dist/cjs/hooks/management/useFlowVariables.cjs.map +1 -0
  18. package/dist/cjs/index.cjs +48 -0
  19. package/dist/components/management/AgentCreate/AgentCreate.d.ts +2 -2
  20. package/dist/components/management/AgentCreate/AgentCreate.d.ts.map +1 -1
  21. package/dist/components/management/AgentCreate/AgentCreate.js.map +1 -1
  22. package/dist/components/management/AgentDetails/BaseAgentDetails.js +1 -1
  23. package/dist/components/management/AgentDetails/BaseAgentDetails.js.map +1 -1
  24. package/dist/components/management/FlowVariables/BaseFlowVariables.d.ts +124 -0
  25. package/dist/components/management/FlowVariables/BaseFlowVariables.d.ts.map +1 -0
  26. package/dist/components/management/FlowVariables/BaseFlowVariables.js +206 -0
  27. package/dist/components/management/FlowVariables/BaseFlowVariables.js.map +1 -0
  28. package/dist/components/management/FlowVariables/FlowVariableField.d.ts +46 -0
  29. package/dist/components/management/FlowVariables/FlowVariableField.d.ts.map +1 -0
  30. package/dist/components/management/FlowVariables/FlowVariableField.js +158 -0
  31. package/dist/components/management/FlowVariables/FlowVariableField.js.map +1 -0
  32. package/dist/components/management/FlowVariables/FlowVariables.styles.d.ts +11 -0
  33. package/dist/components/management/FlowVariables/FlowVariables.styles.d.ts.map +1 -0
  34. package/dist/components/management/FlowVariables/FlowVariables.styles.js +121 -0
  35. package/dist/components/management/FlowVariables/FlowVariables.styles.js.map +1 -0
  36. package/dist/components/management/FlowVariables/FlowVariablesForm.d.ts +30 -0
  37. package/dist/components/management/FlowVariables/FlowVariablesForm.d.ts.map +1 -0
  38. package/dist/components/management/FlowVariables/FlowVariablesForm.js +47 -0
  39. package/dist/components/management/FlowVariables/FlowVariablesForm.js.map +1 -0
  40. package/dist/components/management/SharedFlowList/BaseSharedFlowList.d.ts +53 -0
  41. package/dist/components/management/SharedFlowList/BaseSharedFlowList.d.ts.map +1 -0
  42. package/dist/components/management/SharedFlowList/BaseSharedFlowList.js +76 -0
  43. package/dist/components/management/SharedFlowList/BaseSharedFlowList.js.map +1 -0
  44. package/dist/components/management/SharedFlowList/SharedFlowList.d.ts +32 -0
  45. package/dist/components/management/SharedFlowList/SharedFlowList.d.ts.map +1 -0
  46. package/dist/components/management/SharedFlowList/SharedFlowList.js +65 -0
  47. package/dist/components/management/SharedFlowList/SharedFlowList.js.map +1 -0
  48. package/dist/hooks/management/useFlowVariables.d.ts +84 -0
  49. package/dist/hooks/management/useFlowVariables.d.ts.map +1 -0
  50. package/dist/hooks/management/useFlowVariables.js +104 -0
  51. package/dist/hooks/management/useFlowVariables.js.map +1 -0
  52. package/dist/index.d.ts +14 -2
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +8 -2
  55. package/package.json +2 -2
@@ -0,0 +1,123 @@
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/management/FlowVariables/FlowVariables.styles.ts
7
+ /**
8
+ * Creates the styles of the flow variables form.
9
+ *
10
+ * @param theme - The theme object containing design tokens.
11
+ * @param colorScheme - The current color scheme, used for memoization.
12
+ * @returns The CSS class names for each part.
13
+ */
14
+ const useStyles = (theme, colorScheme) => (0, react.useMemo)(() => {
15
+ const unit = theme.vars.spacing.unit;
16
+ const chip = require_emotion.css`
17
+ display: inline-flex;
18
+ align-items: center;
19
+ flex-shrink: 0;
20
+ padding: 2px calc(${unit} * 1.25);
21
+ border-radius: 999px;
22
+ border: 1px solid ${theme.vars.colors.border};
23
+ font-size: ${theme.vars.typography.fontSizes.xs};
24
+ font-weight: ${theme.vars.typography.fontWeights.medium};
25
+ color: ${theme.vars.colors.text.secondary};
26
+ white-space: nowrap;
27
+ `;
28
+ return {
29
+ actions: require_emotion.css`
30
+ display: flex;
31
+ align-items: center;
32
+ gap: ${unit};
33
+ `,
34
+ actionsSpacer: require_emotion.css`
35
+ flex-grow: 1;
36
+ `,
37
+ card: require_emotion.css`
38
+ display: flex;
39
+ flex-direction: column;
40
+ gap: calc(${unit} * 2);
41
+ padding: calc(${unit} * 2.5) calc(${unit} * 3);
42
+ background: ${theme.vars.colors.background.surface};
43
+ border: 1px solid ${theme.vars.colors.border};
44
+ border-radius: ${theme.vars.borderRadius.large};
45
+ `,
46
+ cardLocked: require_emotion.css`
47
+ background: ${theme.vars.colors.background.disabled};
48
+ `,
49
+ chip,
50
+ chipCustomized: require_emotion.css`
51
+ ${chip}
52
+ border-color: ${theme.vars.colors.success.main};
53
+ color: ${theme.vars.colors.success.main};
54
+ `,
55
+ description: require_emotion.css`
56
+ margin: calc(${unit} / 4) 0 0;
57
+ color: ${theme.vars.colors.text.secondary};
58
+ font-size: ${theme.vars.typography.fontSizes.sm};
59
+ `,
60
+ empty: require_emotion.css`
61
+ margin: 0;
62
+ color: ${theme.vars.colors.text.secondary};
63
+ `,
64
+ form: require_emotion.css`
65
+ display: flex;
66
+ flex-direction: column;
67
+ gap: calc(${unit} * 2.5);
68
+ max-width: 880px;
69
+ `,
70
+ header: require_emotion.css`
71
+ display: flex;
72
+ align-items: flex-start;
73
+ gap: calc(${unit} * 1.5);
74
+ `,
75
+ headerText: require_emotion.css`
76
+ flex-grow: 1;
77
+ min-width: 0;
78
+ `,
79
+ hint: require_emotion.css`
80
+ display: flex;
81
+ flex-wrap: wrap;
82
+ align-items: center;
83
+ gap: calc(${unit} * 1.25);
84
+ margin: 0;
85
+ color: ${theme.vars.colors.text.secondary};
86
+ font-size: ${theme.vars.typography.fontSizes.xs};
87
+ `,
88
+ label: require_emotion.css`
89
+ font-size: ${theme.vars.typography.fontSizes.md};
90
+ font-weight: ${theme.vars.typography.fontWeights.medium};
91
+ color: ${theme.vars.colors.text.primary};
92
+ `,
93
+ link: require_emotion.css`
94
+ padding: 0;
95
+ border: 0;
96
+ background: none;
97
+ font: inherit;
98
+ font-weight: ${theme.vars.typography.fontWeights.medium};
99
+ color: ${theme.vars.colors.primary.main};
100
+ cursor: pointer;
101
+ &:hover {
102
+ text-decoration: underline;
103
+ }
104
+ `,
105
+ lockedLine: require_emotion.css`
106
+ display: flex;
107
+ align-items: center;
108
+ gap: calc(${unit} * 1.25);
109
+ color: ${theme.vars.colors.text.secondary};
110
+ font-size: ${theme.vars.typography.fontSizes.sm};
111
+ `,
112
+ scope: require_emotion.css`
113
+ display: flex;
114
+ align-items: center;
115
+ gap: calc(${unit} * 1.5);
116
+ `
117
+ };
118
+ }, [theme, colorScheme]);
119
+ var FlowVariables_styles_default = useStyles;
120
+
121
+ //#endregion
122
+ exports.default = FlowVariables_styles_default;
123
+ //# sourceMappingURL=FlowVariables.styles.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlowVariables.styles.cjs","names":["unit: string","chip: string"],"sources":["../../../../../src/components/management/FlowVariables/FlowVariables.styles.ts"],"sourcesContent":["// Copyright 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\n/**\n * Creates the styles of the flow variables form.\n *\n * @param theme - The theme object containing design tokens.\n * @param colorScheme - The current color scheme, used for memoization.\n * @returns The CSS class names for each part.\n */\nconst useStyles = (theme: Theme, colorScheme: string): Record<string, string> =>\n useMemo(() => {\n const unit: string = theme.vars.spacing.unit;\n const chip: string = css`\n display: inline-flex;\n align-items: center;\n flex-shrink: 0;\n padding: 2px calc(${unit} * 1.25);\n border-radius: 999px;\n border: 1px solid ${theme.vars.colors.border};\n font-size: ${theme.vars.typography.fontSizes.xs};\n font-weight: ${theme.vars.typography.fontWeights.medium};\n color: ${theme.vars.colors.text.secondary};\n white-space: nowrap;\n `;\n\n return {\n actions: css`\n display: flex;\n align-items: center;\n gap: ${unit};\n `,\n actionsSpacer: css`\n flex-grow: 1;\n `,\n card: css`\n display: flex;\n flex-direction: column;\n gap: calc(${unit} * 2);\n padding: calc(${unit} * 2.5) calc(${unit} * 3);\n background: ${theme.vars.colors.background.surface};\n border: 1px solid ${theme.vars.colors.border};\n border-radius: ${theme.vars.borderRadius.large};\n `,\n cardLocked: css`\n background: ${theme.vars.colors.background.disabled};\n `,\n chip,\n chipCustomized: css`\n ${chip}\n border-color: ${theme.vars.colors.success.main};\n color: ${theme.vars.colors.success.main};\n `,\n description: css`\n margin: calc(${unit} / 4) 0 0;\n color: ${theme.vars.colors.text.secondary};\n font-size: ${theme.vars.typography.fontSizes.sm};\n `,\n empty: css`\n margin: 0;\n color: ${theme.vars.colors.text.secondary};\n `,\n form: css`\n display: flex;\n flex-direction: column;\n gap: calc(${unit} * 2.5);\n max-width: 880px;\n `,\n header: css`\n display: flex;\n align-items: flex-start;\n gap: calc(${unit} * 1.5);\n `,\n headerText: css`\n flex-grow: 1;\n min-width: 0;\n `,\n hint: css`\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: calc(${unit} * 1.25);\n margin: 0;\n color: ${theme.vars.colors.text.secondary};\n font-size: ${theme.vars.typography.fontSizes.xs};\n `,\n label: css`\n font-size: ${theme.vars.typography.fontSizes.md};\n font-weight: ${theme.vars.typography.fontWeights.medium};\n color: ${theme.vars.colors.text.primary};\n `,\n link: css`\n padding: 0;\n border: 0;\n background: none;\n font: inherit;\n font-weight: ${theme.vars.typography.fontWeights.medium};\n color: ${theme.vars.colors.primary.main};\n cursor: pointer;\n &:hover {\n text-decoration: underline;\n }\n `,\n lockedLine: css`\n display: flex;\n align-items: center;\n gap: calc(${unit} * 1.25);\n color: ${theme.vars.colors.text.secondary};\n font-size: ${theme.vars.typography.fontSizes.sm};\n `,\n scope: css`\n display: flex;\n align-items: center;\n gap: calc(${unit} * 1.5);\n `,\n };\n }, [theme, colorScheme]);\n\nexport default useStyles;\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,aAAa,OAAc,yCACjB;CACZ,MAAMA,OAAe,MAAM,KAAK,QAAQ;CACxC,MAAMC,OAAe,mBAAG;;;;0BAIF,KAAK;;0BAEL,MAAM,KAAK,OAAO,OAAO;mBAChC,MAAM,KAAK,WAAW,UAAU,GAAG;qBACjC,MAAM,KAAK,WAAW,YAAY,OAAO;eAC/C,MAAM,KAAK,OAAO,KAAK,UAAU;;;AAI5C,QAAO;EACL,SAAS,mBAAG;;;eAGH,KAAK;;EAEd,eAAe,mBAAG;;;EAGlB,MAAM,mBAAG;;;oBAGK,KAAK;wBACD,KAAK,eAAe,KAAK;sBAC3B,MAAM,KAAK,OAAO,WAAW,QAAQ;4BAC/B,MAAM,KAAK,OAAO,OAAO;yBAC5B,MAAM,KAAK,aAAa,MAAM;;EAEjD,YAAY,mBAAG;sBACC,MAAM,KAAK,OAAO,WAAW,SAAS;;EAEtD;EACA,gBAAgB,mBAAG;UACf,KAAK;wBACS,MAAM,KAAK,OAAO,QAAQ,KAAK;iBACtC,MAAM,KAAK,OAAO,QAAQ,KAAK;;EAE1C,aAAa,mBAAG;uBACC,KAAK;iBACX,MAAM,KAAK,OAAO,KAAK,UAAU;qBAC7B,MAAM,KAAK,WAAW,UAAU,GAAG;;EAElD,OAAO,mBAAG;;iBAEC,MAAM,KAAK,OAAO,KAAK,UAAU;;EAE5C,MAAM,mBAAG;;;oBAGK,KAAK;;;EAGnB,QAAQ,mBAAG;;;oBAGG,KAAK;;EAEnB,YAAY,mBAAG;;;;EAIf,MAAM,mBAAG;;;;oBAIK,KAAK;;iBAER,MAAM,KAAK,OAAO,KAAK,UAAU;qBAC7B,MAAM,KAAK,WAAW,UAAU,GAAG;;EAElD,OAAO,mBAAG;qBACK,MAAM,KAAK,WAAW,UAAU,GAAG;uBACjC,MAAM,KAAK,WAAW,YAAY,OAAO;iBAC/C,MAAM,KAAK,OAAO,KAAK,QAAQ;;EAE1C,MAAM,mBAAG;;;;;uBAKQ,MAAM,KAAK,WAAW,YAAY,OAAO;iBAC/C,MAAM,KAAK,OAAO,QAAQ,KAAK;;;;;;EAM1C,YAAY,mBAAG;;;oBAGD,KAAK;iBACR,MAAM,KAAK,OAAO,KAAK,UAAU;qBAC7B,MAAM,KAAK,WAAW,UAAU,GAAG;;EAElD,OAAO,mBAAG;;;oBAGI,KAAK;;EAEpB;GACA,CAAC,OAAO,YAAY,CAAC;AAE1B,mCAAe"}
@@ -0,0 +1,50 @@
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ const require_useTranslation = require('../../../hooks/useTranslation.cjs');
3
+ const require_Spinner = require('../../primitives/Spinner/Spinner.cjs');
4
+ const require_BaseFlowVariables = require('./BaseFlowVariables.cjs');
5
+ const require_useFlowVariables = require('../../../hooks/management/useFlowVariables.cjs');
6
+ let __thunderid_browser = require("@thunderid/browser");
7
+ __thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
8
+ let react_jsx_runtime = require("react/jsx-runtime");
9
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
10
+
11
+ //#region src/components/management/FlowVariables/FlowVariablesForm.tsx
12
+ /**
13
+ * Lets a delegated admin override the variables a flow declares for their organization unit. It loads the
14
+ * variables the flow shares with the unit and the values the unit has set, shows them as a form, and saves
15
+ * the values that differ from their defaults.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * <FlowVariablesForm flowId={flowId} ouId={ouId} onSaved={() => toast('Saved')} />
20
+ * ```
21
+ */
22
+ const FlowVariablesForm = ({ flowId, onSaved, ouId, preferences, title,...rest }) => {
23
+ const { t } = require_useTranslation.default(preferences?.i18n);
24
+ const { connections, definitions, error, isLoaded, isSaving, overlay, overrides, save, saveError } = require_useFlowVariables.default({
25
+ flowId,
26
+ onSaved,
27
+ ouId
28
+ });
29
+ const handleSubmit = (_values, changed) => {
30
+ save(changed);
31
+ };
32
+ if (!isLoaded && !error) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Spinner.default, {});
33
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_BaseFlowVariables.default, {
34
+ title: title ?? t("admin.flowVariables.title"),
35
+ variables: definitions,
36
+ connections,
37
+ initialValues: overrides,
38
+ overlay,
39
+ isSubmitting: isSaving,
40
+ error: error ? (0, __thunderid_browser.toManagementErrorMessage)(t, error, "admin.flowVariables.load_error") : (0, __thunderid_browser.toManagementErrorMessage)(t, saveError, "admin.flowVariables.error"),
41
+ onSubmit: handleSubmit,
42
+ preferences,
43
+ ...rest
44
+ });
45
+ };
46
+ var FlowVariablesForm_default = FlowVariablesForm;
47
+
48
+ //#endregion
49
+ exports.default = FlowVariablesForm_default;
50
+ //# sourceMappingURL=FlowVariablesForm.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlowVariablesForm.cjs","names":["FlowVariablesForm: FC<FlowVariablesFormProps>","useTranslation","useFlowVariables","Spinner","BaseFlowVariables"],"sources":["../../../../../src/components/management/FlowVariables/FlowVariablesForm.tsx"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {FlowVariableValues, toManagementErrorMessage} from '@thunderid/browser';\nimport {FC, ReactElement} from 'react';\nimport BaseFlowVariables, {BaseFlowVariablesProps} from './BaseFlowVariables';\nimport useFlowVariables, {UseFlowVariablesResult} from '../../../hooks/management/useFlowVariables';\nimport useTranslation from '../../../hooks/useTranslation';\nimport Spinner from '../../primitives/Spinner/Spinner';\n\nexport type FlowVariablesFormProps = Omit<\n BaseFlowVariablesProps,\n 'connections' | 'error' | 'initialValues' | 'isSubmitting' | 'onSubmit' | 'overlay' | 'variables'\n> & {\n /**\n * Identifier of the flow whose variables are configured.\n */\n flowId: string;\n /**\n * Called with the saved overrides.\n */\n onSaved?: (values: FlowVariableValues) => void;\n /**\n * The organization unit the overrides belong to.\n */\n ouId: string;\n};\n\n/**\n * Lets a delegated admin override the variables a flow declares for their organization unit. It loads the\n * variables the flow shares with the unit and the values the unit has set, shows them as a form, and saves\n * the values that differ from their defaults.\n *\n * @example\n * ```tsx\n * <FlowVariablesForm flowId={flowId} ouId={ouId} onSaved={() => toast('Saved')} />\n * ```\n */\nconst FlowVariablesForm: FC<FlowVariablesFormProps> = ({\n flowId,\n onSaved,\n ouId,\n preferences,\n title,\n ...rest\n}: FlowVariablesFormProps): ReactElement => {\n const {t} = useTranslation(preferences?.i18n);\n const {\n connections,\n definitions,\n error,\n isLoaded,\n isSaving,\n overlay,\n overrides,\n save,\n saveError,\n }: UseFlowVariablesResult = useFlowVariables({flowId, onSaved, ouId});\n\n // Only what differs from the default is an override; the rest keeps following the default.\n const handleSubmit = (_values: FlowVariableValues, changed: FlowVariableValues): void => {\n void save(changed);\n };\n\n if (!isLoaded && !error) {\n return <Spinner />;\n }\n\n return (\n <BaseFlowVariables\n title={title ?? t('admin.flowVariables.title')}\n variables={definitions}\n connections={connections}\n initialValues={overrides}\n overlay={overlay}\n isSubmitting={isSaving}\n error={\n error\n ? toManagementErrorMessage(t, error, 'admin.flowVariables.load_error')\n : toManagementErrorMessage(t, saveError, 'admin.flowVariables.error')\n }\n onSubmit={handleSubmit}\n preferences={preferences}\n {...rest}\n />\n );\n};\n\nexport default FlowVariablesForm;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsCA,MAAMA,qBAAiD,EACrD,QACA,SACA,MACA,aACA,MACA,GAAG,WACuC;CAC1C,MAAM,EAAC,MAAKC,+BAAe,aAAa,KAAK;CAC7C,MAAM,EACJ,aACA,aACA,OACA,UACA,UACA,SACA,WACA,MACA,cAC0BC,iCAAiB;EAAC;EAAQ;EAAS;EAAK,CAAC;CAGrE,MAAM,gBAAgB,SAA6B,YAAsC;AACvF,EAAK,KAAK,QAAQ;;AAGpB,KAAI,CAAC,YAAY,CAAC,MAChB,QAAO,2CAACC,4BAAU;AAGpB,QACE,2CAACC;EACC,OAAO,SAAS,EAAE,4BAA4B;EAC9C,WAAW;EACE;EACb,eAAe;EACN;EACT,cAAc;EACd,OACE,0DAC6B,GAAG,OAAO,iCAAiC,qDAC3C,GAAG,WAAW,4BAA4B;EAEzE,UAAU;EACG;EACb,GAAI;GACJ;;AAIN,gCAAe"}
@@ -0,0 +1,78 @@
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ const require_useTranslation = require('../../../hooks/useTranslation.cjs');
3
+ const require_DataTable = require('../../primitives/DataTable/DataTable.cjs');
4
+ const require_AdminSection = require('../shared/AdminSection.cjs');
5
+ let react_jsx_runtime = require("react/jsx-runtime");
6
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
7
+
8
+ //#region src/components/management/SharedFlowList/BaseSharedFlowList.tsx
9
+ /**
10
+ * Lists flows with their handle and type. Holds no data of its own: pass the page of flows and handle selection
11
+ * and pagination.
12
+ */
13
+ const BaseSharedFlowList = ({ actions, children, className, description, error = null, flows, isLoading = false, limit = 20, offset = 0, onPageChange, onSelect, preferences, selectedFlowId, title, totalResults }) => {
14
+ const { t } = require_useTranslation.default(preferences?.i18n);
15
+ const columns = [
16
+ {
17
+ header: t("admin.flows.list.columns.name"),
18
+ id: "name",
19
+ render: (flow) => flow.name
20
+ },
21
+ {
22
+ header: t("admin.flows.list.columns.handle"),
23
+ id: "handle",
24
+ render: (flow) => flow.handle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: flow.handle }) : null
25
+ },
26
+ {
27
+ header: t("admin.flows.list.columns.type"),
28
+ id: "type",
29
+ render: (flow) => flow.flowType
30
+ }
31
+ ];
32
+ if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
33
+ className,
34
+ children: children({
35
+ columns,
36
+ error,
37
+ flows,
38
+ isLoading,
39
+ limit,
40
+ offset,
41
+ onPageChange,
42
+ onSelect,
43
+ rows: flows,
44
+ selectedRowId: selectedFlowId,
45
+ totalResults: totalResults ?? flows.length
46
+ })
47
+ });
48
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AdminSection.default, {
49
+ block: "shared-flow-list",
50
+ className,
51
+ title: title ?? t("admin.flows.list.title"),
52
+ description,
53
+ actions,
54
+ preferences,
55
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_DataTable.default, {
56
+ caption: title?.length ? title : t("admin.flows.list.title"),
57
+ columns,
58
+ rows: flows,
59
+ getRowId: (flow) => flow.id,
60
+ isLoading,
61
+ error,
62
+ emptyText: t("admin.flows.list.empty"),
63
+ onRowClick: onSelect,
64
+ selectedRowId: selectedFlowId,
65
+ pagination: onPageChange ? {
66
+ limit,
67
+ offset,
68
+ onChange: onPageChange,
69
+ total: totalResults ?? flows.length
70
+ } : void 0
71
+ })
72
+ });
73
+ };
74
+ var BaseSharedFlowList_default = BaseSharedFlowList;
75
+
76
+ //#endregion
77
+ exports.default = BaseSharedFlowList_default;
78
+ //# sourceMappingURL=BaseSharedFlowList.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseSharedFlowList.cjs","names":["BaseSharedFlowList: FC<BaseSharedFlowListProps>","useTranslation","columns: DataTableColumn<ManagedFlow>[]","AdminSection","DataTable"],"sources":["../../../../../src/components/management/SharedFlowList/BaseSharedFlowList.tsx"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {ManagedFlow, Preferences} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode} from 'react';\nimport useTranslation from '../../../hooks/useTranslation';\nimport DataTable, {DataTableColumn} from '../../primitives/DataTable/DataTable';\nimport {AdminListRenderProps} from '../shared/AdminListRenderProps';\nimport AdminSection from '../shared/AdminSection';\n\n/**\n * What {@link BaseSharedFlowList} hands its `children` render function. `flows` and `rows` are the same array.\n */\nexport type BaseSharedFlowListRenderProps = AdminListRenderProps<ManagedFlow> & {\n flows: ManagedFlow[];\n};\n\nexport interface BaseSharedFlowListProps {\n /**\n * Controls rendered next to the title.\n */\n actions?: ReactNode;\n /**\n * Renders custom UI in place of the default table. Receives the flows, the default columns, the loading and\n * error state, and the pagination and selection handlers.\n */\n children?: (props: BaseSharedFlowListRenderProps) => ReactNode;\n className?: string;\n description?: string;\n error?: string | null;\n flows: ManagedFlow[];\n isLoading?: boolean;\n /**\n * Page size.\n * @default 20\n */\n limit?: number;\n offset?: number;\n /**\n * Called with the offset of the page to show. Pagination is hidden when omitted.\n */\n onPageChange?: (offset: number) => void;\n /**\n * Called when a flow is chosen. Rows are selectable only when set.\n */\n onSelect?: (flow: ManagedFlow) => void;\n preferences?: Preferences;\n selectedFlowId?: string;\n /**\n * Heading of the list. Pass an empty string to hide it.\n */\n title?: string;\n totalResults?: number;\n}\n\n/**\n * Lists flows with their handle and type. Holds no data of its own: pass the page of flows and handle selection\n * and pagination.\n */\nconst BaseSharedFlowList: FC<BaseSharedFlowListProps> = ({\n actions,\n children,\n className,\n description,\n error = null,\n flows,\n isLoading = false,\n limit = 20,\n offset = 0,\n onPageChange,\n onSelect,\n preferences,\n selectedFlowId,\n title,\n totalResults,\n}: BaseSharedFlowListProps): ReactElement => {\n const {t} = useTranslation(preferences?.i18n);\n\n const columns: DataTableColumn<ManagedFlow>[] = [\n {\n header: t('admin.flows.list.columns.name'),\n id: 'name',\n render: (flow: ManagedFlow): ReactNode => flow.name,\n },\n {\n header: t('admin.flows.list.columns.handle'),\n id: 'handle',\n render: (flow: ManagedFlow): ReactNode => (flow.handle ? <code>{flow.handle}</code> : null),\n },\n {\n header: t('admin.flows.list.columns.type'),\n id: 'type',\n render: (flow: ManagedFlow): ReactNode => flow.flowType,\n },\n ];\n\n if (children) {\n return (\n <div className={className}>\n {children({\n columns,\n error,\n flows,\n isLoading,\n limit,\n offset,\n onPageChange,\n onSelect,\n rows: flows,\n selectedRowId: selectedFlowId,\n totalResults: totalResults ?? flows.length,\n })}\n </div>\n );\n }\n\n return (\n <AdminSection\n block=\"shared-flow-list\"\n className={className}\n title={title ?? t('admin.flows.list.title')}\n description={description}\n actions={actions}\n preferences={preferences}\n >\n <DataTable\n caption={title?.length ? title : t('admin.flows.list.title')}\n columns={columns}\n rows={flows}\n getRowId={(flow: ManagedFlow): string => flow.id}\n isLoading={isLoading}\n error={error}\n emptyText={t('admin.flows.list.empty')}\n onRowClick={onSelect}\n selectedRowId={selectedFlowId}\n pagination={\n onPageChange ? {limit, offset, onChange: onPageChange, total: totalResults ?? flows.length} : undefined\n }\n />\n </AdminSection>\n );\n};\n\nexport default BaseSharedFlowList;\n"],"mappings":";;;;;;;;;;;;AA2DA,MAAMA,sBAAmD,EACvD,SACA,UACA,WACA,aACA,QAAQ,MACR,OACA,YAAY,OACZ,QAAQ,IACR,SAAS,GACT,cACA,UACA,aACA,gBACA,OACA,mBAC2C;CAC3C,MAAM,EAAC,MAAKC,+BAAe,aAAa,KAAK;CAE7C,MAAMC,UAA0C;EAC9C;GACE,QAAQ,EAAE,gCAAgC;GAC1C,IAAI;GACJ,SAAS,SAAiC,KAAK;GAChD;EACD;GACE,QAAQ,EAAE,kCAAkC;GAC5C,IAAI;GACJ,SAAS,SAAkC,KAAK,SAAS,2CAAC,oBAAM,KAAK,SAAc,GAAG;GACvF;EACD;GACE,QAAQ,EAAE,gCAAgC;GAC1C,IAAI;GACJ,SAAS,SAAiC,KAAK;GAChD;EACF;AAED,KAAI,SACF,QACE,2CAAC;EAAe;YACb,SAAS;GACR;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,MAAM;GACN,eAAe;GACf,cAAc,gBAAgB,MAAM;GACrC,CAAC;GACE;AAIV,QACE,2CAACC;EACC,OAAM;EACK;EACX,OAAO,SAAS,EAAE,yBAAyB;EAC9B;EACJ;EACI;YAEb,2CAACC;GACC,SAAS,OAAO,SAAS,QAAQ,EAAE,yBAAyB;GACnD;GACT,MAAM;GACN,WAAW,SAA8B,KAAK;GACnC;GACJ;GACP,WAAW,EAAE,yBAAyB;GACtC,YAAY;GACZ,eAAe;GACf,YACE,eAAe;IAAC;IAAO;IAAQ,UAAU;IAAc,OAAO,gBAAgB,MAAM;IAAO,GAAG;IAEhG;GACW;;AAInB,iCAAe"}
@@ -0,0 +1,69 @@
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ const require_useTranslation = require('../../../hooks/useTranslation.cjs');
3
+ const require_useManagementEndpoint = require('../../../hooks/management/useManagementEndpoint.cjs');
4
+ const require_useResourceQuery = require('../../../hooks/management/useResourceQuery.cjs');
5
+ const require_BaseSharedFlowList = require('./BaseSharedFlowList.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/management/SharedFlowList/SharedFlowList.tsx
14
+ const MAX_FETCH = 100;
15
+ /**
16
+ * Lists the flows shared with an organization unit, or the ones it owns, or both, a page at a time. Choosing a flow reports it
17
+ * through `onSelect`, so the application decides what to open, for example `FlowVariablesForm` for that flow.
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * <SharedFlowList ouId={ouId} onSelect={(flow) => setSelectedFlowId(flow.id)} />
22
+ * {selectedFlowId && <FlowVariablesForm flowId={selectedFlowId} ouId={ouId} />}
23
+ * ```
24
+ */
25
+ const SharedFlowList = ({ flowType, limit = 20, ouId, ownership = "shared", preferences,...rest }) => {
26
+ const { t } = require_useTranslation.default(preferences?.i18n);
27
+ const [offset, setOffset] = (0, react.useState)(0);
28
+ const endpoint = require_useManagementEndpoint.default("flows");
29
+ const narrowed = ownership !== "all";
30
+ const { data, error, isLoading } = require_useResourceQuery.default([__thunderid_browser.FlowQueryKeys.FLOWS, narrowed ? {
31
+ flowType,
32
+ ouId,
33
+ ownership
34
+ } : {
35
+ flowType,
36
+ limit,
37
+ offset,
38
+ ouId
39
+ }], (fetcher) => (0, __thunderid_browser.getFlows)({
40
+ ...endpoint,
41
+ fetcher,
42
+ flowType,
43
+ ouId,
44
+ ...narrowed ? {
45
+ limit: MAX_FETCH,
46
+ offset: 0
47
+ } : {
48
+ limit,
49
+ offset
50
+ }
51
+ }));
52
+ const matching = (0, react.useMemo)(() => (data?.flows ?? []).filter((flow) => ownership === "all" || flow.isOwnedByOU === (ownership === "owned")), [data, ownership]);
53
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_BaseSharedFlowList.default, {
54
+ flows: narrowed ? matching.slice(offset, offset + limit) : matching,
55
+ totalResults: narrowed ? matching.length : data?.totalResults,
56
+ isLoading,
57
+ error: (0, __thunderid_browser.toManagementErrorMessage)(t, error, "admin.flows.list.error"),
58
+ limit,
59
+ offset,
60
+ onPageChange: setOffset,
61
+ preferences,
62
+ ...rest
63
+ });
64
+ };
65
+ var SharedFlowList_default = SharedFlowList;
66
+
67
+ //#endregion
68
+ exports.default = SharedFlowList_default;
69
+ //# sourceMappingURL=SharedFlowList.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SharedFlowList.cjs","names":["SharedFlowList: FC<SharedFlowListProps>","useTranslation","endpoint: ManagementEndpoint","useManagementEndpoint","narrowed: boolean","useResourceQuery","FlowQueryKeys","matching: ManagedFlow[]","BaseSharedFlowList"],"sources":["../../../../../src/components/management/SharedFlowList/SharedFlowList.tsx"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n FlowQueryKeys,\n ManagedFlow,\n ManagedFlowListResponse,\n getFlows,\n toManagementErrorMessage,\n} from '@thunderid/browser';\nimport {FC, ReactElement, useMemo, useState} from 'react';\nimport BaseSharedFlowList, {BaseSharedFlowListProps} from './BaseSharedFlowList';\nimport useManagementEndpoint, {ManagementEndpoint} from '../../../hooks/management/useManagementEndpoint';\nimport useResourceQuery, {ResourceQueryResult} from '../../../hooks/management/useResourceQuery';\nimport useTranslation from '../../../hooks/useTranslation';\n\nexport type SharedFlowListProps = Omit<\n BaseSharedFlowListProps,\n 'error' | 'flows' | 'isLoading' | 'offset' | 'onPageChange' | 'totalResults'\n> & {\n /**\n * Restricts the list to one flow type, for example `AUTHENTICATION`.\n */\n flowType?: string;\n /**\n * The organization unit to list the flows of: the ones it owns and the ones shared with it.\n */\n ouId: string;\n /**\n * Which of those flows to list: the ones shared with the unit, the ones it owns, or both. The server reports\n * the ownership of each flow, and the list narrows to it, so a narrowed list reads the first page of at most\n * 100 flows and pages through the matches.\n * @default 'shared'\n */\n ownership?: 'all' | 'owned' | 'shared';\n};\n\nconst MAX_FETCH = 100;\n\n/**\n * Lists the flows shared with an organization unit, or the ones it owns, or both, a page at a time. Choosing a flow reports it\n * through `onSelect`, so the application decides what to open, for example `FlowVariablesForm` for that flow.\n *\n * @example\n * ```tsx\n * <SharedFlowList ouId={ouId} onSelect={(flow) => setSelectedFlowId(flow.id)} />\n * {selectedFlowId && <FlowVariablesForm flowId={selectedFlowId} ouId={ouId} />}\n * ```\n */\nconst SharedFlowList: FC<SharedFlowListProps> = ({\n flowType,\n limit = 20,\n ouId,\n ownership = 'shared',\n preferences,\n ...rest\n}: SharedFlowListProps): ReactElement => {\n const {t} = useTranslation(preferences?.i18n);\n const [offset, setOffset] = useState<number>(0);\n const endpoint: ManagementEndpoint = useManagementEndpoint('flows');\n const narrowed: boolean = ownership !== 'all';\n const {data, error, isLoading}: ResourceQueryResult<ManagedFlowListResponse> = useResourceQuery(\n [FlowQueryKeys.FLOWS, narrowed ? {flowType, ouId, ownership} : {flowType, limit, offset, ouId}],\n (fetcher) =>\n getFlows({\n ...endpoint,\n fetcher,\n flowType,\n ouId,\n ...(narrowed ? {limit: MAX_FETCH, offset: 0} : {limit, offset}),\n }),\n );\n const matching: ManagedFlow[] = useMemo(\n () =>\n (data?.flows ?? []).filter(\n (flow: ManagedFlow) => ownership === 'all' || flow.isOwnedByOU === (ownership === 'owned'),\n ),\n [data, ownership],\n );\n\n return (\n <BaseSharedFlowList\n flows={narrowed ? matching.slice(offset, offset + limit) : matching}\n totalResults={narrowed ? matching.length : data?.totalResults}\n isLoading={isLoading}\n error={toManagementErrorMessage(t, error, 'admin.flows.list.error')}\n limit={limit}\n offset={offset}\n onPageChange={setOffset}\n preferences={preferences}\n {...rest}\n />\n );\n};\n\nexport default SharedFlowList;\n"],"mappings":";;;;;;;;;;;;;AAqCA,MAAM,YAAY;;;;;;;;;;;AAYlB,MAAMA,kBAA2C,EAC/C,UACA,QAAQ,IACR,MACA,YAAY,UACZ,YACA,GAAG,WACoC;CACvC,MAAM,EAAC,MAAKC,+BAAe,aAAa,KAAK;CAC7C,MAAM,CAAC,QAAQ,iCAA8B,EAAE;CAC/C,MAAMC,WAA+BC,sCAAsB,QAAQ;CACnE,MAAMC,WAAoB,cAAc;CACxC,MAAM,EAAC,MAAM,OAAO,cAA2DC,iCAC7E,CAACC,kCAAc,OAAO,WAAW;EAAC;EAAU;EAAM;EAAU,GAAG;EAAC;EAAU;EAAO;EAAQ;EAAK,CAAC,GAC9F,8CACU;EACP,GAAG;EACH;EACA;EACA;EACA,GAAI,WAAW;GAAC,OAAO;GAAW,QAAQ;GAAE,GAAG;GAAC;GAAO;GAAO;EAC/D,CAAC,CACL;CACD,MAAMC,qCAED,MAAM,SAAS,EAAE,EAAE,QACjB,SAAsB,cAAc,SAAS,KAAK,iBAAiB,cAAc,SACnF,EACH,CAAC,MAAM,UAAU,CAClB;AAED,QACE,2CAACC;EACC,OAAO,WAAW,SAAS,MAAM,QAAQ,SAAS,MAAM,GAAG;EAC3D,cAAc,WAAW,SAAS,SAAS,MAAM;EACtC;EACX,yDAAgC,GAAG,OAAO,yBAAyB;EAC5D;EACC;EACR,cAAc;EACD;EACb,GAAI;GACJ;;AAIN,6BAAe"}
@@ -0,0 +1,107 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_useManagementEndpoint = require('./useManagementEndpoint.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/useFlowVariables.ts
11
+ /**
12
+ * Loads the variables a flow declares for an organization unit and the values the unit has set, and saves
13
+ * them. The data behind {@link FlowVariablesForm}, for building the form with any UI.
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * const {definitions, overrides, save} = useFlowVariables({flowId, ouId});
18
+ * ```
19
+ */
20
+ const useFlowVariables = ({ enabled = true, fetcher, flowId, onSaved, ouId }) => {
21
+ const flowsEndpoint = require_useManagementEndpoint.default("flows");
22
+ const connectionsEndpoint = require_useManagementEndpoint.default("connections");
23
+ const ready = enabled && Boolean(flowId) && Boolean(ouId);
24
+ const flowQuery = require_useResourceQuery.default([
25
+ __thunderid_browser.FlowVariableQueryKeys.DEFINITIONS,
26
+ flowId ?? "",
27
+ ouId ?? ""
28
+ ], (resolved) => (0, __thunderid_browser.getFlow)({
29
+ ...flowsEndpoint,
30
+ fetcher: resolved,
31
+ flowId,
32
+ ouId
33
+ }), {
34
+ enabled: ready,
35
+ fetcher
36
+ });
37
+ const valuesQuery = require_useResourceQuery.default([
38
+ __thunderid_browser.FlowVariableQueryKeys.VALUES,
39
+ flowId ?? "",
40
+ ouId ?? ""
41
+ ], (resolved) => (0, __thunderid_browser.getFlowVariables)({
42
+ ...flowsEndpoint,
43
+ fetcher: resolved,
44
+ flowId,
45
+ ouId
46
+ }), {
47
+ enabled: ready,
48
+ fetcher
49
+ });
50
+ const overlayQuery = require_useResourceQuery.default([
51
+ __thunderid_browser.FlowVariableQueryKeys.DEFINITIONS,
52
+ "overlay",
53
+ flowId ?? "",
54
+ ouId ?? ""
55
+ ], (resolved) => (0, __thunderid_browser.getFlowOverlayRules)({
56
+ ...flowsEndpoint,
57
+ fetcher: resolved,
58
+ flowId,
59
+ ouId
60
+ }), {
61
+ enabled: ready,
62
+ fetcher
63
+ });
64
+ const definitions = (0, react.useMemo)(() => (0, __thunderid_browser.getFlowVariableDefinitions)(flowQuery.data), [flowQuery.data]);
65
+ const needsConnections = definitions.some((definition) => definition.type === "CONNECTION_SELECT");
66
+ const connectionsQuery = require_useResourceQuery.default([
67
+ __thunderid_browser.FlowVariableQueryKeys.DEFINITIONS,
68
+ "connections",
69
+ ouId ?? ""
70
+ ], (resolved) => (0, __thunderid_browser.getConnections)({
71
+ ...connectionsEndpoint,
72
+ fetcher: resolved,
73
+ limit: 100,
74
+ ouId
75
+ }), {
76
+ enabled: ready && needsConnections,
77
+ fetcher
78
+ });
79
+ const mutation = require_useResourceMutation.default((values, resolved) => (0, __thunderid_browser.updateFlowVariables)({
80
+ ...flowsEndpoint,
81
+ fetcher: resolved,
82
+ flowId,
83
+ ouId,
84
+ variables: values
85
+ }), () => [[__thunderid_browser.FlowVariableQueryKeys.VALUES]], {
86
+ fetcher,
87
+ onSuccess: (response) => onSaved?.(response.values)
88
+ });
89
+ return {
90
+ connections: connectionsQuery.data?.connections ?? [],
91
+ definitions,
92
+ error: flowQuery.error ?? valuesQuery.error ?? overlayQuery.error ?? connectionsQuery.error,
93
+ flow: flowQuery.data,
94
+ isLoaded: Boolean(flowQuery.data) && Boolean(valuesQuery.data) && Boolean(overlayQuery.data),
95
+ isLoading: flowQuery.isLoading || valuesQuery.isLoading || overlayQuery.isLoading || connectionsQuery.isLoading,
96
+ isSaving: mutation.isLoading,
97
+ overlay: overlayQuery.data,
98
+ overrides: valuesQuery.data?.values ?? {},
99
+ save: mutation.mutate,
100
+ saveError: mutation.error
101
+ };
102
+ };
103
+ var useFlowVariables_default = useFlowVariables;
104
+
105
+ //#endregion
106
+ exports.default = useFlowVariables_default;
107
+ //# sourceMappingURL=useFlowVariables.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFlowVariables.cjs","names":["flowsEndpoint: ManagementEndpoint","useManagementEndpoint","connectionsEndpoint: ManagementEndpoint","ready: boolean","flowQuery: ResourceQueryResult<ManagedFlowDefinition>","useResourceQuery","FlowVariableQueryKeys","valuesQuery: ResourceQueryResult<FlowVariables>","overlayQuery: ResourceQueryResult<ResolvedOverlay>","definitions: FlowVariableDefinition[]","needsConnections: boolean","connectionsQuery: ResourceQueryResult<{connections: ConnectionInstance[]}>","mutation: ResourceMutationResult<FlowVariables, FlowVariableValues>","useResourceMutation"],"sources":["../../../../src/hooks/management/useFlowVariables.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n ApiFetcher,\n ConnectionInstance,\n FlowVariableDefinition,\n FlowVariableQueryKeys,\n FlowVariableValues,\n FlowVariables,\n ManagedFlowDefinition,\n ResolvedOverlay,\n getConnections,\n getFlowOverlayRules,\n getFlow,\n getFlowVariableDefinitions,\n getFlowVariables,\n updateFlowVariables,\n} from '@thunderid/browser';\nimport {useMemo} from 'react';\nimport useManagementEndpoint, {ManagementEndpoint} from './useManagementEndpoint';\nimport useResourceMutation, {ResourceMutationResult} from './useResourceMutation';\nimport useResourceQuery, {ResourceQueryResult} from './useResourceQuery';\n\n/**\n * Options of {@link useFlowVariables}.\n */\nexport interface UseFlowVariablesOptions {\n /**\n * Set to `false` to skip fetching, for example until the identifiers are known.\n * @default true\n */\n enabled?: boolean;\n /**\n * Transport for this hook only. Takes precedence over `ThunderIDProvider`'s `http.fetcher`.\n */\n fetcher?: ApiFetcher;\n /**\n * Identifier of the flow.\n */\n flowId: string | undefined;\n /**\n * Called with the saved overrides.\n */\n onSaved?: (values: FlowVariableValues) => void;\n /**\n * The organization unit whose overrides are read and saved.\n */\n ouId: string | undefined;\n}\n\n/**\n * What {@link useFlowVariables} returns.\n */\nexport interface UseFlowVariablesResult {\n /**\n * The connections a `CONNECTION_SELECT` variable can take: the ones the organization unit owns and the ones shared\n * into it. Empty until loaded, and when no variable needs them.\n */\n connections: ConnectionInstance[];\n /**\n * The variables the flow declares for the organization unit.\n */\n definitions: FlowVariableDefinition[];\n /**\n * Why the variables could not be loaded.\n */\n error: Error | null;\n /**\n * The flow as the organization unit sees it.\n */\n flow: ManagedFlowDefinition | undefined;\n /**\n * Whether the variables, the unit's values and its rules have all arrived. A form built before then would be reset when\n * the values land.\n */\n isLoaded: boolean;\n isLoading: boolean;\n isSaving: boolean;\n /**\n * What the organization unit may do with each variable: set its own value, or only see the owner's.\n */\n overlay: ResolvedOverlay | undefined;\n /**\n * The values the organization unit has set. A variable it has not set is absent, and its default applies.\n */\n overrides: FlowVariableValues;\n /**\n * Replaces the unit's overrides. A variable left out returns to its default. Never rejects: read `saveError`.\n */\n save: (values: FlowVariableValues) => Promise<FlowVariables | undefined>;\n /**\n * Why the last save failed.\n */\n saveError: Error | null;\n}\n\n/**\n * Loads the variables a flow declares for an organization unit and the values the unit has set, and saves\n * them. The data behind {@link FlowVariablesForm}, for building the form with any UI.\n *\n * @example\n * ```tsx\n * const {definitions, overrides, save} = useFlowVariables({flowId, ouId});\n * ```\n */\nconst useFlowVariables = ({\n enabled = true,\n fetcher,\n flowId,\n onSaved,\n ouId,\n}: UseFlowVariablesOptions): UseFlowVariablesResult => {\n const flowsEndpoint: ManagementEndpoint = useManagementEndpoint('flows');\n const connectionsEndpoint: ManagementEndpoint = useManagementEndpoint('connections');\n const ready: boolean = enabled && Boolean(flowId) && Boolean(ouId);\n\n const flowQuery: ResourceQueryResult<ManagedFlowDefinition> = useResourceQuery(\n [FlowVariableQueryKeys.DEFINITIONS, flowId ?? '', ouId ?? ''],\n (resolved: ApiFetcher) => getFlow({...flowsEndpoint, fetcher: resolved, flowId: flowId!, ouId}),\n {enabled: ready, fetcher},\n );\n const valuesQuery: ResourceQueryResult<FlowVariables> = useResourceQuery(\n [FlowVariableQueryKeys.VALUES, flowId ?? '', ouId ?? ''],\n (resolved: ApiFetcher) => getFlowVariables({...flowsEndpoint, fetcher: resolved, flowId: flowId!, ouId: ouId!}),\n {enabled: ready, fetcher},\n );\n\n const overlayQuery: ResourceQueryResult<ResolvedOverlay> = useResourceQuery(\n [FlowVariableQueryKeys.DEFINITIONS, 'overlay', flowId ?? '', ouId ?? ''],\n (resolved: ApiFetcher) => getFlowOverlayRules({...flowsEndpoint, fetcher: resolved, flowId: flowId!, ouId: ouId!}),\n {enabled: ready, fetcher},\n );\n\n const definitions: FlowVariableDefinition[] = useMemo(\n () => getFlowVariableDefinitions(flowQuery.data),\n [flowQuery.data],\n );\n const needsConnections: boolean = definitions.some(\n (definition: FlowVariableDefinition) => definition.type === 'CONNECTION_SELECT',\n );\n\n const connectionsQuery: ResourceQueryResult<{connections: ConnectionInstance[]}> = useResourceQuery(\n [FlowVariableQueryKeys.DEFINITIONS, 'connections', ouId ?? ''],\n (resolved: ApiFetcher) => getConnections({...connectionsEndpoint, fetcher: resolved, limit: 100, ouId}),\n {enabled: ready && needsConnections, fetcher},\n );\n\n const mutation: ResourceMutationResult<FlowVariables, FlowVariableValues> = useResourceMutation(\n (values: FlowVariableValues, resolved: ApiFetcher) =>\n updateFlowVariables({...flowsEndpoint, fetcher: resolved, flowId: flowId!, ouId: ouId!, variables: values}),\n () => [[FlowVariableQueryKeys.VALUES]],\n {fetcher, onSuccess: (response: FlowVariables) => onSaved?.(response.values)},\n );\n\n return {\n connections: connectionsQuery.data?.connections ?? [],\n definitions,\n error: flowQuery.error ?? valuesQuery.error ?? overlayQuery.error ?? connectionsQuery.error,\n flow: flowQuery.data,\n isLoaded: Boolean(flowQuery.data) && Boolean(valuesQuery.data) && Boolean(overlayQuery.data),\n isLoading: flowQuery.isLoading || valuesQuery.isLoading || overlayQuery.isLoading || connectionsQuery.isLoading,\n isSaving: mutation.isLoading,\n overlay: overlayQuery.data,\n overrides: valuesQuery.data?.values ?? {},\n save: mutation.mutate,\n saveError: mutation.error,\n };\n};\n\nexport default useFlowVariables;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA0GA,MAAM,oBAAoB,EACxB,UAAU,MACV,SACA,QACA,SACA,WACqD;CACrD,MAAMA,gBAAoCC,sCAAsB,QAAQ;CACxE,MAAMC,sBAA0CD,sCAAsB,cAAc;CACpF,MAAME,QAAiB,WAAW,QAAQ,OAAO,IAAI,QAAQ,KAAK;CAElE,MAAMC,YAAwDC,iCAC5D;EAACC,0CAAsB;EAAa,UAAU;EAAI,QAAQ;EAAG,GAC5D,8CAAiC;EAAC,GAAG;EAAe,SAAS;EAAkB;EAAS;EAAK,CAAC,EAC/F;EAAC,SAAS;EAAO;EAAQ,CAC1B;CACD,MAAMC,cAAkDF,iCACtD;EAACC,0CAAsB;EAAQ,UAAU;EAAI,QAAQ;EAAG,GACvD,uDAA0C;EAAC,GAAG;EAAe,SAAS;EAAkB;EAAe;EAAM,CAAC,EAC/G;EAAC,SAAS;EAAO;EAAQ,CAC1B;CAED,MAAME,eAAqDH,iCACzD;EAACC,0CAAsB;EAAa;EAAW,UAAU;EAAI,QAAQ;EAAG,GACvE,0DAA6C;EAAC,GAAG;EAAe,SAAS;EAAkB;EAAe;EAAM,CAAC,EAClH;EAAC,SAAS;EAAO;EAAQ,CAC1B;CAED,MAAMG,2FAC6B,UAAU,KAAK,EAChD,CAAC,UAAU,KAAK,CACjB;CACD,MAAMC,mBAA4B,YAAY,MAC3C,eAAuC,WAAW,SAAS,oBAC7D;CAED,MAAMC,mBAA6EN,iCACjF;EAACC,0CAAsB;EAAa;EAAe,QAAQ;EAAG,GAC7D,qDAAwC;EAAC,GAAG;EAAqB,SAAS;EAAU,OAAO;EAAK;EAAK,CAAC,EACvG;EAAC,SAAS,SAAS;EAAkB;EAAQ,CAC9C;CAED,MAAMM,WAAsEC,qCACzE,QAA4B,0DACP;EAAC,GAAG;EAAe,SAAS;EAAkB;EAAe;EAAO,WAAW;EAAO,CAAC,QACvG,CAAC,CAACP,0CAAsB,OAAO,CAAC,EACtC;EAAC;EAAS,YAAY,aAA4B,UAAU,SAAS,OAAO;EAAC,CAC9E;AAED,QAAO;EACL,aAAa,iBAAiB,MAAM,eAAe,EAAE;EACrD;EACA,OAAO,UAAU,SAAS,YAAY,SAAS,aAAa,SAAS,iBAAiB;EACtF,MAAM,UAAU;EAChB,UAAU,QAAQ,UAAU,KAAK,IAAI,QAAQ,YAAY,KAAK,IAAI,QAAQ,aAAa,KAAK;EAC5F,WAAW,UAAU,aAAa,YAAY,aAAa,aAAa,aAAa,iBAAiB;EACtG,UAAU,SAAS;EACnB,SAAS,aAAa;EACtB,WAAW,YAAY,MAAM,UAAU,EAAE;EACzC,MAAM,SAAS;EACf,WAAW,SAAS;EACrB;;AAGH,+BAAe"}
@@ -117,6 +117,12 @@ const require_BaseUserDetails = require('./components/management/UserDetails/Bas
117
117
  const require_UserDetails = require('./components/management/UserDetails/UserDetails.cjs');
118
118
  const require_BaseGroupList = require('./components/management/GroupList/BaseGroupList.cjs');
119
119
  const require_GroupList = require('./components/management/GroupList/GroupList.cjs');
120
+ const require_FlowVariableField = require('./components/management/FlowVariables/FlowVariableField.cjs');
121
+ const require_BaseFlowVariables = require('./components/management/FlowVariables/BaseFlowVariables.cjs');
122
+ const require_useFlowVariables = require('./hooks/management/useFlowVariables.cjs');
123
+ const require_FlowVariablesForm = require('./components/management/FlowVariables/FlowVariablesForm.cjs');
124
+ const require_BaseSharedFlowList = require('./components/management/SharedFlowList/BaseSharedFlowList.cjs');
125
+ const require_SharedFlowList = require('./components/management/SharedFlowList/SharedFlowList.cjs');
120
126
  const require_BaseGroupCreate = require('./components/management/GroupCreate/BaseGroupCreate.cjs');
121
127
  const require_GroupCreate = require('./components/management/GroupCreate/GroupCreate.cjs');
122
128
  const require_BaseGroupMembers = require('./components/management/GroupMembers/BaseGroupMembers.cjs');
@@ -287,6 +293,7 @@ exports.BaseApplicationList = require_BaseApplicationList.default;
287
293
  exports.BaseAuthFlowSelect = require_BaseAuthFlowSelect.default;
288
294
  exports.BaseChangeCredential = require_BaseChangeCredential.default;
289
295
  exports.BaseDeviceGrant = require_BaseDeviceGrant.default;
296
+ exports.BaseFlowVariables = require_BaseFlowVariables.default;
290
297
  exports.BaseGroupCreate = require_BaseGroupCreate.default;
291
298
  exports.BaseGroupDetails = require_BaseGroupDetails.default;
292
299
  exports.BaseGroupList = require_BaseGroupList.default;
@@ -307,6 +314,7 @@ exports.BaseRoleCreate = require_BaseRoleCreate.default;
307
314
  exports.BaseRoleDetails = require_BaseRoleDetails.default;
308
315
  exports.BaseRoleList = require_BaseRoleList.default;
309
316
  exports.BaseRolePermissions = require_BaseRolePermissions.default;
317
+ exports.BaseSharedFlowList = require_BaseSharedFlowList.default;
310
318
  exports.BaseSharingPolicies = require_BaseSharingPolicies.default;
311
319
  exports.BaseSignIn = require_BaseSignIn.default;
312
320
  exports.BaseSignInButton = require_BaseSignInButton.default;
@@ -431,7 +439,21 @@ exports.FieldFactory = require_FieldFactory.FieldFactory;
431
439
  exports.FlowContext = require_FlowContext.default;
432
440
  exports.FlowMetaProvider = require_FlowMetaProvider.default;
433
441
  exports.FlowProvider = require_FlowProvider.default;
442
+ Object.defineProperty(exports, 'FlowQueryKeys', {
443
+ enumerable: true,
444
+ get: function () {
445
+ return __thunderid_browser.FlowQueryKeys;
446
+ }
447
+ });
434
448
  exports.FlowTimer = require_FlowTimer.default;
449
+ exports.FlowVariableField = require_FlowVariableField.default;
450
+ Object.defineProperty(exports, 'FlowVariableQueryKeys', {
451
+ enumerable: true,
452
+ get: function () {
453
+ return __thunderid_browser.FlowVariableQueryKeys;
454
+ }
455
+ });
456
+ exports.FlowVariablesForm = require_FlowVariablesForm.default;
435
457
  exports.FormControl = require_FormControl.default;
436
458
  exports.GitHubButton = require_GitHubButton.default;
437
459
  exports.GoogleButton = require_GoogleButton.default;
@@ -489,6 +511,7 @@ Object.defineProperty(exports, 'RoleQueryKeys', {
489
511
  }
490
512
  });
491
513
  exports.Select = require_Select.default;
514
+ exports.SharedFlowList = require_SharedFlowList.default;
492
515
  exports.SharingPolicies = require_SharingPolicies.default;
493
516
  exports.SignIn = require_SignIn.default;
494
517
  exports.SignInButton = require_SignInButton.default;
@@ -1248,6 +1271,18 @@ Object.defineProperty(exports, 'getFlowUsages', {
1248
1271
  return __thunderid_browser.getFlowUsages;
1249
1272
  }
1250
1273
  });
1274
+ Object.defineProperty(exports, 'getFlowVariableDefinitions', {
1275
+ enumerable: true,
1276
+ get: function () {
1277
+ return __thunderid_browser.getFlowVariableDefinitions;
1278
+ }
1279
+ });
1280
+ Object.defineProperty(exports, 'getFlowVariableOptions', {
1281
+ enumerable: true,
1282
+ get: function () {
1283
+ return __thunderid_browser.getFlowVariableOptions;
1284
+ }
1285
+ });
1251
1286
  Object.defineProperty(exports, 'getFlowVariables', {
1252
1287
  enumerable: true,
1253
1288
  get: function () {
@@ -1807,6 +1842,12 @@ Object.defineProperty(exports, 'resolveFlowTemplateLiterals', {
1807
1842
  return __thunderid_browser.resolveFlowTemplateLiterals;
1808
1843
  }
1809
1844
  });
1845
+ Object.defineProperty(exports, 'resolveFlowVariableRule', {
1846
+ enumerable: true,
1847
+ get: function () {
1848
+ return __thunderid_browser.resolveFlowVariableRule;
1849
+ }
1850
+ });
1810
1851
  Object.defineProperty(exports, 'resolveLocaleDisplayName', {
1811
1852
  enumerable: true,
1812
1853
  get: function () {
@@ -2164,6 +2205,7 @@ exports.useFetchAuthFlows = require_useFetchAuthFlows.default;
2164
2205
  exports.useFetchUserTypes = require_useFetchUserTypes.default;
2165
2206
  exports.useFetchUsers = require_useFetchUsers.default;
2166
2207
  exports.useFlow = require_useFlow.default;
2208
+ exports.useFlowVariables = require_useFlowVariables.default;
2167
2209
  exports.useForm = require_useForm.default;
2168
2210
  exports.useGrantedPermissions = require_useGrantedPermissions.default;
2169
2211
  exports.useI18n = require_useI18n.default;
@@ -2175,6 +2217,12 @@ exports.useThunderID = require_useThunderID.default;
2175
2217
  exports.useTranslation = require_useTranslation.default;
2176
2218
  exports.useUser = require_useUser.default;
2177
2219
  exports.validateFieldValue = require_FieldFactory.validateFieldValue;
2220
+ Object.defineProperty(exports, 'validateFlowVariableValue', {
2221
+ enumerable: true,
2222
+ get: function () {
2223
+ return __thunderid_browser.validateFlowVariableValue;
2224
+ }
2225
+ });
2178
2226
  Object.defineProperty(exports, 'verifyDeviceCode', {
2179
2227
  enumerable: true,
2180
2228
  get: function () {
@@ -1,4 +1,4 @@
1
- import { Agent } from '@thunderid/browser';
1
+ import { Agent, AgentOwner } from '@thunderid/browser';
2
2
  import { FC } from 'react';
3
3
  import { BaseAgentCreateProps } from './BaseAgentCreate';
4
4
  export type AgentCreateProps = Omit<BaseAgentCreateProps, 'agentTypes' | 'error' | 'isSubmitting' | 'onSubmit'> & {
@@ -14,7 +14,7 @@ export type AgentCreateProps = Omit<BaseAgentCreateProps, 'agentTypes' | 'error'
14
14
  /**
15
15
  * The person responsible for the agent. Defaults to the server's choice, usually the creator.
16
16
  */
17
- owner?: string;
17
+ owner?: AgentOwner;
18
18
  };
19
19
  /**
20
20
  * Registers an agent through the management API.
@@ -1 +1 @@
1
- {"version":3,"file":"AgentCreate.d.ts","sourceRoot":"","sources":["../../../../src/components/management/AgentCreate/AgentCreate.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,EASN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAC,EAAE,EAAwB,MAAM,OAAO,CAAC;AAChD,OAAwB,EAAwB,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AAO/F,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,oBAAoB,EAAE,YAAY,GAAG,OAAO,GAAG,cAAc,GAAG,UAAU,CAAC,GAAG;IAChH;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACnC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;;GAOG;AACH,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAiDrC,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"AgentCreate.d.ts","sourceRoot":"","sources":["../../../../src/components/management/AgentCreate/AgentCreate.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,EACL,UAAU,EASX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAC,EAAE,EAAwB,MAAM,OAAO,CAAC;AAChD,OAAwB,EAAwB,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AAO/F,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,oBAAoB,EAAE,YAAY,GAAG,OAAO,GAAG,cAAc,GAAG,UAAU,CAAC,GAAG;IAChH;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACnC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF;;;;;;;GAOG;AACH,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAiDrC,CAAC;AAEF,eAAe,WAAW,CAAC"}