@thunderid/react 1.16.0 → 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.
- package/dist/cjs/components/management/FlowVariables/BaseFlowVariables.cjs +210 -0
- package/dist/cjs/components/management/FlowVariables/BaseFlowVariables.cjs.map +1 -0
- package/dist/cjs/components/management/FlowVariables/FlowVariableField.cjs +162 -0
- package/dist/cjs/components/management/FlowVariables/FlowVariableField.cjs.map +1 -0
- package/dist/cjs/components/management/FlowVariables/FlowVariables.styles.cjs +123 -0
- package/dist/cjs/components/management/FlowVariables/FlowVariables.styles.cjs.map +1 -0
- package/dist/cjs/components/management/FlowVariables/FlowVariablesForm.cjs +50 -0
- package/dist/cjs/components/management/FlowVariables/FlowVariablesForm.cjs.map +1 -0
- package/dist/cjs/components/management/SharedFlowList/BaseSharedFlowList.cjs +78 -0
- package/dist/cjs/components/management/SharedFlowList/BaseSharedFlowList.cjs.map +1 -0
- package/dist/cjs/components/management/SharedFlowList/SharedFlowList.cjs +69 -0
- package/dist/cjs/components/management/SharedFlowList/SharedFlowList.cjs.map +1 -0
- package/dist/cjs/hooks/management/useFlowVariables.cjs +107 -0
- package/dist/cjs/hooks/management/useFlowVariables.cjs.map +1 -0
- package/dist/cjs/index.cjs +48 -0
- package/dist/components/management/FlowVariables/BaseFlowVariables.d.ts +124 -0
- package/dist/components/management/FlowVariables/BaseFlowVariables.d.ts.map +1 -0
- package/dist/components/management/FlowVariables/BaseFlowVariables.js +206 -0
- package/dist/components/management/FlowVariables/BaseFlowVariables.js.map +1 -0
- package/dist/components/management/FlowVariables/FlowVariableField.d.ts +46 -0
- package/dist/components/management/FlowVariables/FlowVariableField.d.ts.map +1 -0
- package/dist/components/management/FlowVariables/FlowVariableField.js +158 -0
- package/dist/components/management/FlowVariables/FlowVariableField.js.map +1 -0
- package/dist/components/management/FlowVariables/FlowVariables.styles.d.ts +11 -0
- package/dist/components/management/FlowVariables/FlowVariables.styles.d.ts.map +1 -0
- package/dist/components/management/FlowVariables/FlowVariables.styles.js +121 -0
- package/dist/components/management/FlowVariables/FlowVariables.styles.js.map +1 -0
- package/dist/components/management/FlowVariables/FlowVariablesForm.d.ts +30 -0
- package/dist/components/management/FlowVariables/FlowVariablesForm.d.ts.map +1 -0
- package/dist/components/management/FlowVariables/FlowVariablesForm.js +47 -0
- package/dist/components/management/FlowVariables/FlowVariablesForm.js.map +1 -0
- package/dist/components/management/SharedFlowList/BaseSharedFlowList.d.ts +53 -0
- package/dist/components/management/SharedFlowList/BaseSharedFlowList.d.ts.map +1 -0
- package/dist/components/management/SharedFlowList/BaseSharedFlowList.js +76 -0
- package/dist/components/management/SharedFlowList/BaseSharedFlowList.js.map +1 -0
- package/dist/components/management/SharedFlowList/SharedFlowList.d.ts +32 -0
- package/dist/components/management/SharedFlowList/SharedFlowList.d.ts.map +1 -0
- package/dist/components/management/SharedFlowList/SharedFlowList.js +65 -0
- package/dist/components/management/SharedFlowList/SharedFlowList.js.map +1 -0
- package/dist/hooks/management/useFlowVariables.d.ts +84 -0
- package/dist/hooks/management/useFlowVariables.d.ts.map +1 -0
- package/dist/hooks/management/useFlowVariables.js +104 -0
- package/dist/hooks/management/useFlowVariables.js.map +1 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/package.json +2 -2
|
@@ -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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AO,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"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -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 () {
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { ConnectionInstance, FlowVariableDefinition, FlowVariableOption, FlowVariableValue, FlowVariableValues, Preferences, ResolvedFlowVariableRule, ResolvedOverlay } from '@thunderid/browser';
|
|
2
|
+
import { FC, ReactElement, ReactNode } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* What {@link BaseFlowVariables} hands its `children` render function, so the form can be built with any UI.
|
|
5
|
+
*/
|
|
6
|
+
export interface BaseFlowVariablesRenderProps {
|
|
7
|
+
error: string | null;
|
|
8
|
+
/**
|
|
9
|
+
* The message to show under each variable that is not valid, keyed by identifier.
|
|
10
|
+
*/
|
|
11
|
+
errors: Record<string, string>;
|
|
12
|
+
/**
|
|
13
|
+
* The choices of a select variable, narrowed to what the unit may pick.
|
|
14
|
+
*/
|
|
15
|
+
getOptions: (definition: FlowVariableDefinition) => FlowVariableOption[];
|
|
16
|
+
/**
|
|
17
|
+
* What the unit may do with a variable: whether it can set its own value, and the default it starts from.
|
|
18
|
+
*/
|
|
19
|
+
getRule: (definition: FlowVariableDefinition) => ResolvedFlowVariableRule;
|
|
20
|
+
/**
|
|
21
|
+
* Sets the value of one variable.
|
|
22
|
+
*/
|
|
23
|
+
handleChange: (identifier: string, value: FlowVariableValue) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Submits the current values. Does nothing while they are not valid.
|
|
26
|
+
*/
|
|
27
|
+
handleSubmit: () => void;
|
|
28
|
+
isSubmitting: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Whether the values can be submitted.
|
|
31
|
+
*/
|
|
32
|
+
isValid: boolean;
|
|
33
|
+
onCancel?: () => void;
|
|
34
|
+
/**
|
|
35
|
+
* Returns every variable the unit may set to its default.
|
|
36
|
+
*/
|
|
37
|
+
resetToDefaults: () => void;
|
|
38
|
+
values: FlowVariableValues;
|
|
39
|
+
variables: FlowVariableDefinition[];
|
|
40
|
+
}
|
|
41
|
+
export interface BaseFlowVariablesProps {
|
|
42
|
+
/**
|
|
43
|
+
* Renders custom UI in place of the default form. Receives the variables, their values and setters, and the
|
|
44
|
+
* submit handler.
|
|
45
|
+
*/
|
|
46
|
+
children?: (props: BaseFlowVariablesRenderProps) => ReactNode;
|
|
47
|
+
className?: string;
|
|
48
|
+
/**
|
|
49
|
+
* The connections a `CONNECTION_SELECT` variable can take.
|
|
50
|
+
*/
|
|
51
|
+
connections?: Pick<ConnectionInstance, 'categories' | 'id' | 'name' | 'type'>[];
|
|
52
|
+
description?: string;
|
|
53
|
+
error?: string | null;
|
|
54
|
+
/**
|
|
55
|
+
* The values the form starts with, over each variable's default. A variable left out starts at its default.
|
|
56
|
+
*/
|
|
57
|
+
initialValues?: FlowVariableValues;
|
|
58
|
+
isSubmitting?: boolean;
|
|
59
|
+
onCancel?: () => void;
|
|
60
|
+
/**
|
|
61
|
+
* Called when the user asks to create a connection, from the hint under a connection variable. Without it, the
|
|
62
|
+
* hint does not offer one.
|
|
63
|
+
*/
|
|
64
|
+
onCreateConnection?: () => void;
|
|
65
|
+
/**
|
|
66
|
+
* Called with every value after one changes.
|
|
67
|
+
*/
|
|
68
|
+
onChange?: (values: FlowVariableValues) => void;
|
|
69
|
+
/**
|
|
70
|
+
* Called when the form is submitted and valid, with every value and the overrides: the values of the variables
|
|
71
|
+
* the unit may set that differ from their default. Without it the form has no save button, which suits a preview.
|
|
72
|
+
*/
|
|
73
|
+
onSubmit?: (values: FlowVariableValues, overrides: FlowVariableValues) => void;
|
|
74
|
+
/**
|
|
75
|
+
* What the unit may do with each variable, as `getFlowOverlayRules` returns it. Without it every variable is
|
|
76
|
+
* editable, which suits a preview.
|
|
77
|
+
*/
|
|
78
|
+
overlay?: ResolvedOverlay;
|
|
79
|
+
/**
|
|
80
|
+
* The name of the organization unit the variables are set for, used in the notice and the connection hint.
|
|
81
|
+
*/
|
|
82
|
+
ouName?: string;
|
|
83
|
+
/**
|
|
84
|
+
* The name of whoever owns the flow, shown on a variable the unit may not set.
|
|
85
|
+
*/
|
|
86
|
+
ownerName?: string;
|
|
87
|
+
preferences?: Preferences;
|
|
88
|
+
/**
|
|
89
|
+
* Shows the variables without letting them be changed.
|
|
90
|
+
*/
|
|
91
|
+
readOnly?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Wraps the card of each variable, so a host can add its own controls around it, such as selecting or removing the
|
|
94
|
+
* variable while it is being designed. Receives the card, the variable and its position.
|
|
95
|
+
*/
|
|
96
|
+
renderField?: (field: ReactElement, definition: FlowVariableDefinition, index: number) => ReactNode;
|
|
97
|
+
/**
|
|
98
|
+
* Content at the end of the label row of each variable, for a control a host adds while designing the variables.
|
|
99
|
+
*/
|
|
100
|
+
renderFieldAction?: (definition: FlowVariableDefinition, index: number) => ReactNode;
|
|
101
|
+
/**
|
|
102
|
+
* Shows a notice that the settings apply to the organization unit only. Needs `ouName` to be useful.
|
|
103
|
+
*/
|
|
104
|
+
showScopeNotice?: boolean;
|
|
105
|
+
title?: string;
|
|
106
|
+
/**
|
|
107
|
+
* The variables to render, as the flow declares them.
|
|
108
|
+
*/
|
|
109
|
+
variables: FlowVariableDefinition[];
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* A form for the variables a flow declares, each in a card with its label, its description, whether it is
|
|
113
|
+
* customized or follows the default, and the input its type calls for. It is what a delegated admin sees when
|
|
114
|
+
* overriding a flow, and what the flow editor previews. Holds no data of its own: pass the variables and handle
|
|
115
|
+
* the submission.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```tsx
|
|
119
|
+
* <BaseFlowVariables variables={variables} connections={connections} overlay={overlay} onSubmit={save} />
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
declare const BaseFlowVariables: FC<BaseFlowVariablesProps>;
|
|
123
|
+
export default BaseFlowVariables;
|
|
124
|
+
//# sourceMappingURL=BaseFlowVariables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseFlowVariables.d.ts","sourceRoot":"","sources":["../../../../src/components/management/FlowVariables/BaseFlowVariables.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAElB,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,wBAAwB,EACxB,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAC,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