treege 3.0.0-beta.7 → 3.0.0-beta.71

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 (209) hide show
  1. package/LICENSE +18 -12
  2. package/README.md +476 -81
  3. package/dist/DefaultSubmitButton-C_141kVj.js +1802 -0
  4. package/dist/ThemeContext-BGeTYtnw.js +948 -0
  5. package/dist/editor/components/input/ComboboxWithCreate.d.ts +2 -1
  6. package/dist/editor/components/styles/EditorStyles.d.ts +2 -0
  7. package/dist/editor/constants/defaultNode.d.ts +1 -1
  8. package/dist/editor/constants/edgeTypes.d.ts +3 -2
  9. package/dist/editor/constants/inputTypeIcons.d.ts +3 -0
  10. package/dist/editor/constants/nodeSpacing.d.ts +25 -0
  11. package/dist/editor/constants/nodeTypes.d.ts +4 -5
  12. package/dist/editor/context/OpenApiContext.d.ts +79 -0
  13. package/dist/editor/context/TreegeEditorRuntimeProvider.d.ts +78 -0
  14. package/dist/editor/features/TreegeEditor/TreegeEditor.d.ts +1 -1
  15. package/dist/editor/features/TreegeEditor/controls/MiniMapControl.d.ts +6 -0
  16. package/dist/editor/features/TreegeEditor/dialogs/AuthorizeDialog.d.ts +20 -0
  17. package/dist/editor/features/TreegeEditor/dialogs/ChangeNodeTypeDialog.d.ts +2 -0
  18. package/dist/editor/features/TreegeEditor/dialogs/DeleteNodeDialog.d.ts +2 -0
  19. package/dist/editor/features/TreegeEditor/dialogs/HeadersDialog.d.ts +19 -0
  20. package/dist/editor/features/TreegeEditor/dialogs/OpenApiDialog.d.ts +6 -0
  21. package/dist/editor/features/TreegeEditor/edges/ConditionalEdge.d.ts +2 -2
  22. package/dist/editor/features/TreegeEditor/edges/DefaultEdge.d.ts +3 -0
  23. package/dist/editor/features/TreegeEditor/forms/JsonTemplateEditor.d.ts +13 -0
  24. package/dist/editor/features/TreegeEditor/forms/OptionsMappingFields.d.ts +34 -0
  25. package/dist/editor/features/TreegeEditor/forms/OptionsSourceForm.d.ts +7 -0
  26. package/dist/editor/features/TreegeEditor/forms/SensitiveHeaderWarning.d.ts +13 -0
  27. package/dist/editor/features/TreegeEditor/forms/SubmitConfigForm.d.ts +7 -0
  28. package/dist/editor/features/TreegeEditor/inputs/ApiUrlCombobox.d.ts +20 -0
  29. package/dist/editor/features/TreegeEditor/inputs/ComboboxPattern.d.ts +2 -1
  30. package/dist/editor/features/TreegeEditor/inputs/OptionImageField.d.ts +6 -0
  31. package/dist/editor/features/TreegeEditor/inputs/SelectNodeGroup.d.ts +22 -1
  32. package/dist/editor/features/TreegeEditor/layout/AutoLayout.d.ts +15 -0
  33. package/dist/editor/features/TreegeEditor/nodes/TreegeNode.d.ts +5 -0
  34. package/dist/editor/features/TreegeEditor/nodes/components/BottomHandleDropdown.d.ts +25 -0
  35. package/dist/editor/features/TreegeEditor/nodes/components/NodeGroupBadge.d.ts +6 -0
  36. package/dist/editor/features/TreegeEditor/nodes/components/NodeImage.d.ts +5 -0
  37. package/dist/editor/features/TreegeEditor/nodes/components/NodeImageButton.d.ts +6 -0
  38. package/dist/editor/features/TreegeEditor/nodes/components/NodeInputPreview.d.ts +12 -0
  39. package/dist/editor/features/TreegeEditor/nodes/components/NodeLabelInput.d.ts +10 -0
  40. package/dist/editor/features/TreegeEditor/nodes/components/NodeMoreMenu.d.ts +6 -0
  41. package/dist/editor/features/TreegeEditor/nodes/components/NodeRequiredButton.d.ts +6 -0
  42. package/dist/editor/features/TreegeEditor/nodes/components/NodeStackOrderButtons.d.ts +6 -0
  43. package/dist/editor/features/TreegeEditor/nodes/components/NodeTypeBadge.d.ts +7 -0
  44. package/dist/editor/features/TreegeEditor/nodes/components/NodeTypePickerMenuContent.d.ts +12 -0
  45. package/dist/editor/features/TreegeEditor/nodes/layout/NodeWrapper.d.ts +4 -2
  46. package/dist/editor/features/TreegeEditor/panel/AIGeneratorDialog.d.ts +16 -0
  47. package/dist/editor/features/TreegeEditor/panel/ActionsPanel.d.ts +7 -2
  48. package/dist/editor/features/TreegeEditor/panel/MultiSelectionPanel.d.ts +7 -0
  49. package/dist/editor/hooks/useAvailableParentFields.d.ts +13 -0
  50. package/dist/editor/hooks/useFlowActions.d.ts +6 -2
  51. package/dist/editor/hooks/useFlowConnections.d.ts +14 -0
  52. package/dist/editor/hooks/useHistoryStore.d.ts +26 -0
  53. package/dist/editor/hooks/useIsStackedEdge.d.ts +8 -0
  54. package/dist/editor/hooks/useKeyValueRows.d.ts +15 -0
  55. package/dist/editor/hooks/useNodesSelection.d.ts +5 -5
  56. package/dist/editor/hooks/useStackPosition.d.ts +14 -0
  57. package/dist/editor/hooks/useTranslate.d.ts +1 -1
  58. package/dist/editor/hooks/useUndoRedo.d.ts +31 -0
  59. package/dist/editor/types/ai.d.ts +65 -0
  60. package/dist/editor/types/editor.d.ts +97 -10
  61. package/dist/editor/types/openapi.d.ts +106 -0
  62. package/dist/editor/utils/aiFlowGenerator.d.ts +5 -0
  63. package/dist/editor/utils/cleanNodeConfig.d.ts +5 -0
  64. package/dist/editor/utils/dagreLayout.d.ts +8 -0
  65. package/dist/editor/utils/edge.d.ts +50 -0
  66. package/dist/editor/utils/groupColor.d.ts +14 -0
  67. package/dist/editor/utils/image.d.ts +7 -0
  68. package/dist/editor/utils/inputTypeIcon.d.ts +6 -0
  69. package/dist/editor/utils/jsonBindTarget.d.ts +15 -0
  70. package/dist/editor/utils/openApiPayload.d.ts +12 -0
  71. package/dist/editor/utils/openapi.d.ts +35 -0
  72. package/dist/editor/utils/sensitiveHeaders.d.ts +20 -0
  73. package/dist/editor/utils/stackPositionIndex.d.ts +9 -0
  74. package/dist/editor-CkCA6_WX.js +6407 -0
  75. package/dist/editor.js +3 -7
  76. package/dist/main.js +6 -52
  77. package/dist/renderer/context/TreegeRenderRuntimeProvider.d.ts +135 -0
  78. package/dist/renderer/context/TreegeRendererProvider.d.ts +15 -0
  79. package/dist/renderer/features/TreegeRenderer/native/TreegeRenderer.d.ts +19 -11
  80. package/dist/renderer/features/TreegeRenderer/native/components/DefaultFormWrapper.d.ts +7 -7
  81. package/dist/renderer/features/TreegeRenderer/native/components/DefaultInputWrapper.d.ts +9 -0
  82. package/dist/renderer/features/TreegeRenderer/native/components/DefaultInputs.d.ts +20 -15
  83. package/dist/renderer/features/TreegeRenderer/native/components/DefaultLoadingSkeleton.d.ts +8 -0
  84. package/dist/renderer/features/TreegeRenderer/native/components/DefaultStep.d.ts +3 -0
  85. package/dist/renderer/features/TreegeRenderer/native/components/DefaultSubmitButton.d.ts +9 -7
  86. package/dist/renderer/features/TreegeRenderer/native/components/DefaultSubmitButtonWrapper.d.ts +11 -0
  87. package/dist/renderer/features/TreegeRenderer/native/components/DefaultUI.d.ts +8 -7
  88. package/dist/renderer/features/TreegeRenderer/native/components/DependencyHint.d.ts +15 -0
  89. package/dist/renderer/features/TreegeRenderer/native/components/OptionItemContent.d.ts +17 -0
  90. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAddressInput.d.ts +3 -0
  91. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAutocompleteInput.d.ts +3 -0
  92. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultCheckboxInput.d.ts +3 -0
  93. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateInput.d.ts +3 -0
  94. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateRangeInput.d.ts +3 -0
  95. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultFileInput.d.ts +3 -0
  96. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHiddenInput.d.ts +3 -0
  97. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHttpInput.d.ts +3 -0
  98. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultNumberInput.d.ts +3 -0
  99. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultPasswordInput.d.ts +3 -0
  100. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultRadioInput.d.ts +3 -0
  101. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSelectInput.d.ts +3 -0
  102. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSubmitInput.d.ts +11 -0
  103. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSwitchInput.d.ts +3 -0
  104. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextInput.d.ts +3 -0
  105. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextareaInput.d.ts +3 -0
  106. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeInput.d.ts +3 -0
  107. package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeRangeInput.d.ts +3 -0
  108. package/dist/renderer/features/TreegeRenderer/useTreegeRenderer.d.ts +97 -24
  109. package/dist/renderer/features/TreegeRenderer/web/TreegeRenderer.d.ts +1 -1
  110. package/dist/renderer/features/TreegeRenderer/web/components/DefaultFormWrapper.d.ts +3 -2
  111. package/dist/renderer/features/TreegeRenderer/web/components/DefaultInputWrapper.d.ts +9 -0
  112. package/dist/renderer/features/TreegeRenderer/web/components/DefaultLoadingSkeleton.d.ts +7 -0
  113. package/dist/renderer/features/TreegeRenderer/web/components/DefaultStep.d.ts +3 -0
  114. package/dist/renderer/features/TreegeRenderer/web/components/DefaultSubmitButton.d.ts +5 -1
  115. package/dist/renderer/features/TreegeRenderer/web/components/DependencyHint.d.ts +22 -0
  116. package/dist/renderer/features/TreegeRenderer/web/components/OptionItemContent.d.ts +17 -0
  117. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAddressInput.d.ts +1 -1
  118. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAutocompleteInput.d.ts +1 -1
  119. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultCheckboxInput.d.ts +1 -1
  120. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateInput.d.ts +1 -1
  121. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateRangeInput.d.ts +1 -1
  122. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultFileInput.d.ts +1 -1
  123. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHiddenInput.d.ts +1 -1
  124. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHttpInput.d.ts +1 -1
  125. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultNumberInput.d.ts +1 -1
  126. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultPasswordInput.d.ts +1 -1
  127. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultRadioInput.d.ts +1 -1
  128. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSelectInput.d.ts +1 -1
  129. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSubmitInput.d.ts +11 -0
  130. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSwitchInput.d.ts +1 -1
  131. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextAreaInput.d.ts +1 -1
  132. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextInput.d.ts +1 -1
  133. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeInput.d.ts +1 -1
  134. package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeRangeInput.d.ts +1 -1
  135. package/dist/renderer/features/TreegeRenderer/web/components/styles/RendererStyles.d.ts +2 -0
  136. package/dist/renderer/hooks/useInputOptions.d.ts +28 -0
  137. package/dist/renderer/hooks/useRenderNode.d.ts +61 -0
  138. package/dist/renderer/hooks/useSubmitHandler.d.ts +36 -0
  139. package/dist/renderer/hooks/useTranslate.d.ts +7 -5
  140. package/dist/renderer/index.d.ts +4 -2
  141. package/dist/renderer/index.native.d.ts +19 -0
  142. package/dist/renderer/types/renderer.d.ts +279 -42
  143. package/dist/renderer/utils/flow.d.ts +1 -18
  144. package/dist/renderer/utils/form.d.ts +54 -2
  145. package/dist/renderer/utils/http.d.ts +161 -0
  146. package/dist/renderer/utils/jsonTemplate.d.ts +30 -0
  147. package/dist/renderer/utils/node.d.ts +29 -1
  148. package/dist/renderer/utils/sanitize.d.ts +85 -0
  149. package/dist/renderer/utils/sanitize.native.d.ts +69 -0
  150. package/dist/renderer/utils/step.d.ts +27 -0
  151. package/dist/renderer/utils/submit.d.ts +49 -0
  152. package/dist/renderer/utils/templateDependencies.d.ts +17 -0
  153. package/dist/renderer-D5xQw7hp.js +255 -0
  154. package/dist/renderer-native.d.ts +2 -0
  155. package/dist/renderer-native.js +3826 -0
  156. package/dist/renderer.js +5 -45
  157. package/dist/shared/components/ui/badge.d.ts +2 -2
  158. package/dist/shared/components/ui/button.d.ts +3 -3
  159. package/dist/shared/components/ui/collapsible.d.ts +1 -1
  160. package/dist/shared/components/ui/command.d.ts +1 -1
  161. package/dist/shared/components/ui/dropdown-menu.d.ts +1 -1
  162. package/dist/shared/components/ui/field.d.ts +24 -0
  163. package/dist/shared/components/ui/form.d.ts +1 -1
  164. package/dist/shared/components/ui/item.d.ts +23 -0
  165. package/dist/shared/components/ui/popover.d.ts +10 -2
  166. package/dist/shared/components/ui/select.d.ts +3 -1
  167. package/dist/shared/components/ui/sheet.d.ts +1 -1
  168. package/dist/shared/components/ui/skeleton.d.ts +3 -0
  169. package/dist/shared/components/ui/toggle-group.d.ts +7 -0
  170. package/dist/shared/components/ui/toggle.d.ts +9 -0
  171. package/dist/shared/components/ui/tooltip.d.ts +1 -1
  172. package/dist/shared/constants/colors.d.ts +45 -0
  173. package/dist/shared/constants/inputType.d.ts +6 -0
  174. package/dist/shared/constants/node.d.ts +0 -1
  175. package/dist/shared/context/PortalContainerContext.d.ts +5 -0
  176. package/dist/shared/context/ThemeContext.d.ts +2 -0
  177. package/dist/shared/context/ThemeContext.native.d.ts +22 -0
  178. package/dist/shared/hooks/useMediaQuery.d.ts +12 -0
  179. package/dist/shared/hooks/useThemeColors.d.ts +37 -0
  180. package/dist/shared/locales/ar.json.d.ts +253 -19
  181. package/dist/shared/locales/de.json.d.ts +254 -20
  182. package/dist/shared/locales/en.json.d.ts +255 -21
  183. package/dist/shared/locales/es.json.d.ts +254 -20
  184. package/dist/shared/locales/fr.json.d.ts +254 -20
  185. package/dist/shared/locales/it.json.d.ts +254 -20
  186. package/dist/shared/locales/pt.json.d.ts +254 -20
  187. package/dist/shared/types/edge.d.ts +6 -0
  188. package/dist/shared/types/node.d.ts +146 -18
  189. package/dist/shared/utils/httpRecord.d.ts +20 -0
  190. package/dist/shared/utils/inputTypeGuards.d.ts +7 -0
  191. package/dist/shared/utils/nodeTypeGuards.d.ts +1 -6
  192. package/dist/useRenderNode-eqCek6JX.js +536 -0
  193. package/package.json +54 -22
  194. package/dist/ThemeContext-BIvs8Kw-.js +0 -758
  195. package/dist/TreegeEditor-Lv5Tn9_F.js +0 -2152
  196. package/dist/TreegeRenderer-D3EvsEfJ.js +0 -1413
  197. package/dist/editor/context/TreegeEditorContext.d.ts +0 -12
  198. package/dist/editor/features/TreegeEditor/forms/FlowNodeForm.d.ts +0 -2
  199. package/dist/editor/features/TreegeEditor/inputs/SelectInputType.d.ts +0 -7
  200. package/dist/editor/features/TreegeEditor/nodes/FlowNode.d.ts +0 -6
  201. package/dist/editor/features/TreegeEditor/nodes/GroupNode.d.ts +0 -6
  202. package/dist/editor/features/TreegeEditor/nodes/InputNode.d.ts +0 -6
  203. package/dist/editor/features/TreegeEditor/nodes/UINode.d.ts +0 -6
  204. package/dist/editor/hooks/useEdgesSelection.d.ts +0 -11
  205. package/dist/renderer/context/TreegeConfigContext.d.ts +0 -39
  206. package/dist/renderer/context/TreegeRendererContext.d.ts +0 -25
  207. package/dist/renderer/features/TreegeRenderer/native/components/DefaultGroup.d.ts +0 -7
  208. package/dist/renderer/features/TreegeRenderer/web/components/DefaultGroup.d.ts +0 -6
  209. /package/dist/editor/components/{data-display/logo.d.ts → branding/Logo.d.ts} +0 -0
@@ -1,7 +1,8 @@
1
1
  import { Node } from '@xyflow/react';
2
- import { FormEvent, ReactNode } from 'react';
2
+ import { ComponentType, FormEvent, ReactNode } from 'react';
3
3
  import { SerializableFile } from '../utils/file';
4
- import { Flow, InputNodeData, InputType, TreegeNodeData, UINodeData, UIType } from '../../shared/types/node';
4
+ import { FlowStep } from '../utils/step';
5
+ import { Flow, GroupNodeData, HttpHeaders, InputNodeData, InputOption, InputType, TreegeNodeData, UINodeData, UIType } from '../../shared/types/node';
5
6
  /**
6
7
  * Type mapping for input values based on input type
7
8
  */
@@ -18,6 +19,7 @@ export type InputValueTypeMap = {
18
19
  password: string;
19
20
  radio: string;
20
21
  select: string | string[];
22
+ submit: undefined;
21
23
  switch: boolean;
22
24
  text: string;
23
25
  textarea: string;
@@ -28,30 +30,132 @@ export type InputValueTypeMap = {
28
30
  * Form values stored during rendering
29
31
  */
30
32
  export type FormValues = Record<string, any>;
33
+ export type Meta = {
34
+ httpResponse?: unknown;
35
+ };
31
36
  /**
32
37
  * Union of all possible input value types
33
38
  */
34
- export type InputValue = string | number | boolean | string[] | SerializableFile | SerializableFile[] | [string, string] | [string | undefined, string | undefined] | null;
39
+ export type InputValue = string | number | boolean | string[] | SerializableFile | SerializableFile[] | [string, string] | [string | undefined, string | undefined] | null | undefined;
35
40
  /**
36
- * Props for input components with dynamic value typing
37
- * All form state is provided via props for easier custom component implementation
41
+ * A field the input's dynamic options depend on that is not yet filled.
38
42
  */
39
- export type InputRenderProps<T extends InputType = InputType> = {
40
- node: Node<InputNodeData>;
43
+ export type MissingDependency = {
44
+ /**
45
+ * The referenced node id.
46
+ */
47
+ id: string;
48
+ /**
49
+ * The referenced field's translated, end-user-facing label.
50
+ */
51
+ label: string;
52
+ };
53
+ /**
54
+ * HTML-spreadable props for an input control — safe to spread directly onto a
55
+ * DOM element: `<input {...field} />`. Intentionally excludes `label`,
56
+ * `helperText`, and `error` (not valid DOM attributes); those live in
57
+ * `InputExtraProps`.
58
+ */
59
+ export type InputFieldProps<T extends InputType = InputType> = {
60
+ /**
61
+ * Unique field id (nodeId). Use for the element `id`.
62
+ */
63
+ id: string;
41
64
  /**
42
- * Current value of the input field (typed based on input type when T is specified)
65
+ * Field name (resolved using priority: name > label > nodeId).
66
+ */
67
+ name: string;
68
+ /**
69
+ * Current value of the input (typed by input type when T is specified).
43
70
  */
44
71
  value: InputValueTypeMap[T];
45
72
  /**
46
- * Function to update the input value
47
- * @param value - The new value (typed based on input type when T is specified)
73
+ * Translated placeholder (already processed with current language).
74
+ */
75
+ placeholder?: string;
76
+ /**
77
+ * Whether the field is required.
78
+ */
79
+ required?: boolean;
80
+ /**
81
+ * Set when the field has a validation error.
82
+ */
83
+ "aria-invalid"?: boolean;
84
+ };
85
+ /**
86
+ * Treege-specific props that are NOT DOM attributes: state setters, resolved
87
+ * translations, validation and runtime metadata. Passed as the second argument
88
+ * of an input renderer so the first one (`InputFieldProps`) stays spreadable.
89
+ */
90
+ export type InputExtraProps<T extends InputType = InputType> = {
91
+ /**
92
+ * The node data for this input field.
93
+ */
94
+ node: Node<InputNodeData>;
95
+ /**
96
+ * Function to update the input value.
97
+ * @param value - The new value (typed by input type when T is specified)
48
98
  */
49
99
  setValue: (value: InputValueTypeMap[T]) => void;
50
100
  /**
51
- * Validation error message for this field (if any)
101
+ * Validation error message for this field (if any).
52
102
  */
53
103
  error?: string;
104
+ /** Translated label (already processed with current language). */
105
+ label?: string;
106
+ /**
107
+ * Translated helper text (already processed with current language).
108
+ */
109
+ helperText?: string;
110
+ /**
111
+ * Fields this input's dynamic options depend on that are not yet filled
112
+ * (its unresolved `{{nodeId}}` template variables). Empty when none — use it
113
+ * to hint the user which fields to complete before this input can load.
114
+ */
115
+ missingDependencies: MissingDependency[];
116
+ /**
117
+ * Missing required fields on form submit (for submit inputs).
118
+ */
119
+ missingRequiredFields?: string[];
120
+ /**
121
+ * Whether the form is currently being submitted (for submit inputs).
122
+ */
123
+ isSubmitting?: boolean;
124
+ /**
125
+ * Editor-only extension slot: when provided, option-based renderers (radio,
126
+ * checkbox) call this for each option to paint inline extras next to it
127
+ * (e.g. value preview, edit / delete buttons). `variant` is a renderer-side
128
+ * layout hint (e.g. `"card"` for radio cards). Returning `null` skips the
129
+ * slot for that option. Left undefined in runtime so the renderers stay
130
+ * runtime-pure.
131
+ */
132
+ renderOptionExtras?: (option: {
133
+ option: InputOption;
134
+ index: number;
135
+ variant?: string;
136
+ }) => ReactNode;
137
+ /**
138
+ * Editor-only layout flag. When `true`, option-based renderers force their
139
+ * option labels to a single truncated line (block + max-w-full + truncate)
140
+ * and reserve room on the right for the `renderOptionExtras` overlay.
141
+ * Defaults to `false` (multi-line, runtime-pure).
142
+ */
143
+ compactOptions?: boolean;
54
144
  };
145
+ /**
146
+ * Props passed to an input renderer: the spreadable `field` props (DOM-safe, so
147
+ * `field` can be spread onto a control — `<input {...field} />`) and the Treege
148
+ * `extra` props (state setters, translations, metadata).
149
+ */
150
+ export type InputRenderProps<T extends InputType = InputType> = {
151
+ field: InputFieldProps<T>;
152
+ extra: InputExtraProps<T>;
153
+ };
154
+ /**
155
+ * An input renderer — a React component, so it can use hooks and is rendered
156
+ * directly (`<Renderer field={field} extra={extra} />`) without a wrapper.
157
+ */
158
+ export type InputRenderer<T extends InputType = InputType> = ComponentType<InputRenderProps<T>>;
55
159
  export type UiRenderProps = {
56
160
  node: Node<UINodeData>;
57
161
  };
@@ -66,7 +170,69 @@ export type NodeRenderProps = {
66
170
  * Each input type gets its own properly typed InputRenderProps
67
171
  */
68
172
  export type InputRenderers = {
69
- [K in InputType]?: (props: InputRenderProps<K>) => ReactNode;
173
+ [K in InputType]?: InputRenderer<K>;
174
+ };
175
+ /**
176
+ * Props passed to a step renderer. Steps are derived at runtime from the flow's
177
+ * groups: each contiguous slice of visible nodes sharing the same `parentId`
178
+ * (or no parent — orphan steps) becomes one step.
179
+ */
180
+ export type StepRenderProps = {
181
+ /** The step being rendered (its group id and ordered child nodes). */
182
+ step: FlowStep;
183
+ /** Hidden group node carrying the step's metadata (label) — undefined for orphan steps. */
184
+ groupNode?: Node<GroupNodeData>;
185
+ /** Zero-based index of this step in the current step sequence. */
186
+ stepIndex: number;
187
+ /** Total number of steps currently visible. Recomputes when branching changes. */
188
+ totalSteps: number;
189
+ /** True when this is the first step (Back should be hidden/disabled). */
190
+ isFirstStep: boolean;
191
+ /**
192
+ * Whether a Back button should be shown. True on any step past the first, and
193
+ * also on the first step when the consumer passes an `onBack` prop (to bridge
194
+ * back-navigation to an outer flow, e.g. a parent modal's steps). Prefer this
195
+ * over `isFirstStep` to decide whether to render the Back control.
196
+ */
197
+ canGoBack: boolean;
198
+ /**
199
+ * True when this is the last visible step. The renderer turns Continue
200
+ * into a submit action on the last step.
201
+ */
202
+ isLastStep: boolean;
203
+ /** Whether all required visible inputs of the step are filled. */
204
+ canContinue: boolean;
205
+ /**
206
+ * True when the step contains an explicit `submit` input node. Such a node is
207
+ * declarative — it renders no button itself; the step renders the single
208
+ * submit button (reusing the node's label). Exposed for custom step
209
+ * implementations that need to know a submit node is present.
210
+ */
211
+ hasSubmitInput?: boolean;
212
+ /**
213
+ * Translated labels of the current step's required fields still empty. Lines
214
+ * up with `canContinue`, so the action button can show a tooltip explaining
215
+ * why Continue/Submit is disabled — on every step, not just the last.
216
+ */
217
+ missingFields?: string[];
218
+ /** Submission in progress (passed through from `useTreegeRenderer`). */
219
+ isSubmitting?: boolean;
220
+ /**
221
+ * Go back: advances to the previous step, or — on the first step, when the
222
+ * consumer passed an `onBack` prop — invokes that callback instead. No-op on
223
+ * the first step when no `onBack` prop was provided.
224
+ */
225
+ onBack: () => void;
226
+ /**
227
+ * Advance to the next step (or trigger submit on the last step). The wrapper
228
+ * passes `isLastStep` so the implementation can decide between an in-flow
229
+ * advance and a form submit.
230
+ */
231
+ onContinue: () => void;
232
+ /** Translated label of the group, or empty string for orphan steps. */
233
+ label?: string;
234
+ /** The rendered child nodes belonging to this step. */
235
+ children: ReactNode;
70
236
  };
71
237
  /**
72
238
  * Custom renderer components
@@ -82,21 +248,36 @@ export type TreegeRendererComponents = {
82
248
  */
83
249
  ui?: Partial<Record<UIType, (props: NodeRenderProps) => ReactNode>>;
84
250
  /**
85
- * Custom group container renderer
251
+ * Custom step renderer — wraps the current step's nodes and renders the
252
+ * Back/Continue navigation. Defaults are provided by `DefaultStep` (web/native).
86
253
  */
87
- group?: (props: NodeRenderProps) => ReactNode;
254
+ step?: (props: StepRenderProps) => ReactNode;
88
255
  /**
89
- * Custom form wrapper
256
+ * Custom form wrapper. `id` (when provided via the `formId` prop) should be
257
+ * forwarded to the underlying `<form>` element to keep external submit
258
+ * buttons working.
90
259
  */
91
260
  form?: (props: {
92
261
  children: ReactNode;
93
- onSubmit: (e: FormEvent) => void;
262
+ id?: string;
263
+ onSubmit: (e: FormEvent<HTMLFormElement>) => void;
94
264
  }) => ReactNode;
95
265
  /**
96
- * Custom submit button (pure button without wrapper)
266
+ * Custom submit button (supports both web and native variants)
267
+ * Web variant: { label?: string; disabled?: boolean; isSubmitting?: boolean; ...otherHTMLAttributes }
268
+ * Native variant: { children?: ReactNode; disabled?: boolean; isSubmitting?: boolean; onPress?: () => void }
97
269
  */
98
270
  submitButton?: (props: {
99
271
  label?: string;
272
+ disabled?: boolean;
273
+ isSubmitting?: boolean;
274
+ [key: string]: unknown;
275
+ } | {
276
+ children?: ReactNode;
277
+ disabled?: boolean;
278
+ isSubmitting?: boolean;
279
+ onPress?: () => void;
280
+ [key: string]: unknown;
100
281
  }) => ReactNode;
101
282
  /**
102
283
  * Custom submit button wrapper (e.g., for tooltip with missing fields)
@@ -105,9 +286,14 @@ export type TreegeRendererComponents = {
105
286
  children: ReactNode;
106
287
  missingFields?: string[];
107
288
  }) => ReactNode;
289
+ /**
290
+ * Custom loading skeleton, rendered in place of the form while the
291
+ * `isLoading` prop is true. Defaults to `DefaultLoadingSkeleton` (web).
292
+ */
293
+ loadingSkeleton?: () => ReactNode;
108
294
  };
109
295
  /**
110
- * Configuration options that can be set globally via TreegeConfigProvider
296
+ * Configuration options that can be set globally via TreegeRendererProvider
111
297
  * or locally via TreegeRenderer config prop
112
298
  */
113
299
  export type TreegeRendererConfig = {
@@ -115,6 +301,15 @@ export type TreegeRendererConfig = {
115
301
  * Custom component renderers
116
302
  */
117
303
  components?: TreegeRendererComponents;
304
+ /**
305
+ * Global HTTP headers applied to every request issued by the renderer
306
+ * (HTTP inputs, submit buttons). Field-level headers with the same key
307
+ * (case-insensitive) take precedence over these.
308
+ *
309
+ * @example
310
+ * headers={{ Authorization: `Bearer ${accessToken}` }}
311
+ */
312
+ headers?: HttpHeaders;
118
313
  /**
119
314
  * Google Maps API key for address autocomplete
120
315
  * If not provided, falls back to free Nominatim (OpenStreetMap)
@@ -135,53 +330,95 @@ export type TreegeRendererConfig = {
135
330
  * @default "onSubmit"
136
331
  */
137
332
  validationMode?: "onChange" | "onSubmit";
333
+ /**
334
+ * Whether to display the "Powered by Treege" credit at the bottom of the form.
335
+ * @default true
336
+ */
337
+ showPoweredBy?: boolean;
338
+ /**
339
+ * Base URL prepended to every **relative** HTTP url issued by the renderer
340
+ * (HTTP inputs, dynamic options, and submit). Use this to keep the tree
341
+ * JSON environment-agnostic — store relative paths in the tree and supply
342
+ * the host here per environment:
343
+ *
344
+ * @example
345
+ * // In the tree: "url": "/v2/entities/{{nodeId}}/sub-entities"
346
+ * <TreegeRenderer flow={tree} baseUrl={import.meta.env.VITE_API_URL} />
347
+ *
348
+ * Absolute urls (starting with `http://` or `https://`) are left untouched,
349
+ * so a field can still point at an external API. Template variables are
350
+ * resolved first, then the base URL is applied to the result.
351
+ */
352
+ baseUrl?: string;
138
353
  };
139
354
  /**
140
355
  * Props for the TreegeRenderer component
356
+ *
357
+ * Inherits all configuration fields from TreegeRendererConfig (components,
358
+ * headers, googleApiKey, language, theme, validationMode) and adds the
359
+ * instance-specific ones (flow, callbacks, initial values, etc.).
141
360
  */
142
- export type TreegeRendererProps = {
361
+ export interface TreegeRendererProps extends TreegeRendererConfig {
143
362
  /**
144
- * Custom component renderers
363
+ * Additional class name for the renderer container
145
364
  */
146
- components?: TreegeRendererComponents;
365
+ className?: string;
147
366
  /**
148
- * Flow or array of flows
149
- * - If a single Flow: renders that flow
150
- * - If an array: first flow is the main flow, others are sub-flows available for FlowNodes
367
+ * Flow to render. `null` / `undefined` renders nothing.
151
368
  */
152
- flows?: Flow | Flow[] | null;
369
+ flow?: Flow | null;
153
370
  /**
154
- * Google Maps API key for address autocomplete
155
- * If not provided, falls back to free Nominatim (OpenStreetMap)
371
+ * Sets the `id` attribute on the underlying `<form>` element, so a submit
372
+ * button rendered outside the renderer can target it via the native HTML
373
+ * `form` attribute: `<button type="submit" form={formId}>`. Web only.
156
374
  */
157
- googleApiKey?: string;
375
+ formId?: string;
158
376
  /**
159
- * Initial form values
377
+ * Initial form values — use this to pre-fill the form when editing a record
378
+ * that was already submitted.
379
+ *
380
+ * Keys can be either `node.id` OR the same name-based keys you receive back in
381
+ * `onChange` / `onSubmit`, so the previously-submitted object can be fed
382
+ * straight back in without any remapping.
383
+ *
384
+ * Reactive: if this changes after mount (e.g. an async-fetched record resolves
385
+ * later), the form is re-seeded automatically. A new object literal of
386
+ * identical content does NOT reset the form, so in-progress user edits are
387
+ * preserved.
160
388
  */
161
389
  initialValues?: FormValues;
162
390
  /**
163
- * Current language for translations
391
+ * When true, renders a loading skeleton instead of the form. Useful while
392
+ * the flow is being fetched. Customizable via `components.loadingSkeleton`.
164
393
  */
165
- language?: string;
394
+ isLoading?: boolean;
395
+ /**
396
+ * When true, forces the submit/continue button into its loading state
397
+ * (spinner + disabled). Use this to keep the button busy while an async
398
+ * `onSubmit` is still resolving on the consumer side. It is OR-ed with the
399
+ * renderer's own internal submitting state, so it only ever adds to it.
400
+ */
401
+ isSubmitting?: boolean;
402
+ /**
403
+ * Called when the user clicks Back on the FIRST step. Provide this to bridge
404
+ * back-navigation to an outer flow (e.g. a parent modal's steps): when set, a
405
+ * Back button is shown on the first step and triggers this callback instead
406
+ * of being a no-op. Has no effect on later steps, which always navigate back
407
+ * internally.
408
+ */
409
+ onBack?: () => void;
166
410
  /**
167
411
  * Callback when form values change
168
412
  */
169
413
  onChange?: (values: FormValues) => void;
170
414
  /**
171
415
  * Callback when form is submitted
416
+ * @param values - Form values (keyed by field name or node ID)
417
+ * @param meta - Optional metadata about the submission (e.g., HTTP response data)
172
418
  */
173
- onSubmit?: (values: FormValues) => void;
174
- /**
175
- * Theme for the renderer
176
- * @default "dark"
177
- */
178
- theme?: "dark" | "light";
419
+ onSubmit?: (values: FormValues, meta?: Meta) => void;
179
420
  /**
180
421
  * Custom validation function
181
422
  */
182
423
  validate?: (values: FormValues, nodes: Node<TreegeNodeData>[]) => Record<string, string>;
183
- /**
184
- * Validation mode
185
- */
186
- validationMode?: "onChange" | "onSubmit";
187
- };
424
+ }
@@ -1,7 +1,7 @@
1
1
  import { Edge, Node } from '@xyflow/react';
2
2
  import { FormValues } from '../types/renderer';
3
3
  import { ConditionalEdgeData } from '../../shared/types/edge';
4
- import { Flow, TreegeNodeData } from '../../shared/types/node';
4
+ import { TreegeNodeData } from '../../shared/types/node';
5
5
  /**
6
6
  * Result from computing the flow render state
7
7
  * Contains everything needed to render the form and determine its state
@@ -72,20 +72,3 @@ export declare const findStartNode: (nodes: Node<TreegeNodeData>[], edges: Edge[
72
72
  * @returns Complete flow render state (visible nodes, end-of-path flag, etc.)
73
73
  */
74
74
  export declare const getFlowRenderState: (nodes: Node<TreegeNodeData>[], edges: Edge<ConditionalEdgeData>[], formValues: FormValues) => FlowRenderState;
75
- /**
76
- * Merge multiple flows into a single flow by recursively replacing FlowNodes with their target flow's nodes
77
- *
78
- * This function takes a flow or an array of flows, automatically detects the main flow, then:
79
- * 1. Replaces each FlowNode with the nodes from its target flow
80
- * 2. Preserves the order of nodes by inserting sub-flow nodes at the FlowNode position
81
- * 3. Redirects edges that point to FlowNodes to the first node of the target flow
82
- * 4. Connects the last nodes of sub-flows to the nodes that followed the FlowNode
83
- *
84
- * Main flow detection:
85
- * - The main flow is automatically identified as the one that references other flows but is not referenced itself
86
- * - This allows flows to be passed in any order without breaking the merge logic
87
- *
88
- * @param flows - A single Flow or an array of flows (can be null/undefined)
89
- * @returns A single merged Flow containing all nodes and edges
90
- */
91
- export declare const mergeFlows: (flows?: Flow | Flow[] | null) => Flow;
@@ -17,10 +17,62 @@ export declare const isFieldEmpty: (value: unknown) => boolean;
17
17
  * @returns True if the field has been filled (any value except undefined/null), false otherwise
18
18
  */
19
19
  export declare const checkFormFieldHasValue: (fieldName: string | undefined, formValues: FormValues) => boolean;
20
+ /**
21
+ * Resolve the default value for a single input node given the current form
22
+ * values. Mirrors the seeding rules used at mount:
23
+ * - `static`: returns the configured `staticValue`
24
+ * - `reference`: returns the (raw, untransformed) value of the referenced field
25
+ * if that field currently has a value
26
+ *
27
+ * Returns `undefined` when the node has no applicable default. The raw
28
+ * reference value is intentionally returned untransformed — transformations are
29
+ * handled separately by `calculateReferenceFieldUpdates`.
30
+ *
31
+ * @param node - The input node
32
+ * @param values - Current form values (keyed by node id)
33
+ * @returns The default value to apply, or `undefined`
34
+ */
35
+ export declare const resolveNodeDefaultValue: (node: Node<InputNodeData>, values: FormValues) => unknown;
36
+ /**
37
+ * Build the initial (nodeId-keyed) form state from consumer-provided values.
38
+ *
39
+ * Consumers can pass `initialValues` keyed either by `node.id` OR by the same
40
+ * key shape they receive back in `onChange`/`onSubmit` (resolved via
41
+ * `resolveNodeKey`: name > label > node.id). This lets an edit screen feed the
42
+ * previously-submitted object straight back in without any remapping.
43
+ *
44
+ * After normalizing provided values, node `defaultValue`s (static / reference)
45
+ * are applied to any field still left unset — matching a fresh mount.
46
+ *
47
+ * @param initialValues - Values provided by the consumer (id- or name-keyed)
48
+ * @param inputNodes - All input nodes of the flow
49
+ * @returns Form values keyed strictly by node id
50
+ */
51
+ export declare const buildInitialFormValues: (initialValues: FormValues, inputNodes: Node<InputNodeData>[]) => FormValues;
20
52
  /**
21
53
  * Convert internal form values (keyed by nodeId) to external format (keyed by name)
22
54
  * When multiple nodes share the same name, later values overwrite earlier ones
23
- * example: convertFormValuesToNamedFormat({ id1: 'Alice', id2: 'Bob' }, [ { id: 'id1', data: { name: 'firstName' } }, { id: 'id2', data: { name: 'lastName' } } ])
24
- * returns { firstName: 'Alice', lastName: 'Bob' }
55
+ * Priority for key naming: name > label (en) > nodeId
56
+ * example: convertFormValuesToNamedFormat({ id1: 'Alice', id2: 'Bob' }, [ { id: 'id1', data: { name: 'firstName' } }, { id: 'id2', data: { label: { en: 'Last Name' } } } ])
57
+ * returns { firstName: 'Alice', 'Last Name': 'Bob' }
25
58
  */
26
59
  export declare const convertFormValuesToNamedFormat: (formValues: FormValues, nodes: Node<InputNodeData>[]) => Record<string, unknown>;
60
+ /**
61
+ * Apply transformation to a reference field value
62
+ * @param value - The source value to transform
63
+ * @param transformFunction - The transformation function to apply
64
+ * @param objectMapping - Optional mapping for toObject transformation
65
+ * @returns The transformed value
66
+ */
67
+ export declare const applyReferenceTransformation: (value: unknown, transformFunction: "toString" | "toNumber" | "toBoolean" | "toArray" | "toObject" | null | undefined, objectMapping?: Array<{
68
+ sourceKey: string;
69
+ targetKey: string;
70
+ }>) => unknown;
71
+ /**
72
+ * Calculate updated values for fields with reference defaults
73
+ * @param inputNodes - Array of input nodes
74
+ * @param formValues - Current form values
75
+ * @param prevFormValues - Previous form values (for change detection)
76
+ * @returns Object containing fields that need to be updated
77
+ */
78
+ export declare const calculateReferenceFieldUpdates: (inputNodes: Node<InputNodeData>[], formValues: FormValues, prevFormValues: FormValues) => FormValues;
@@ -0,0 +1,161 @@
1
+ import { FormValues } from '../types/renderer';
2
+ import { HttpHeaders, InputOption, OptionsSourceMapping, QueryParams } from '../../shared/types/node';
3
+ /**
4
+ * Merge multiple lists of HTTP headers. Later sources override earlier ones
5
+ * when they specify the same key (case-insensitive comparison, since HTTP
6
+ * header names are case-insensitive). The casing of the latest occurrence
7
+ * is preserved in the output.
8
+ */
9
+ export declare const mergeHttpHeaders: (...sources: (HttpHeaders | undefined)[]) => HttpHeaders;
10
+ /**
11
+ * Resolve `{{templateVar}}` placeholders in every value of a header/query-param
12
+ * record, leaving the keys untouched. Returns `undefined` for `undefined` so
13
+ * callers can pass the result straight into `mergeHttpHeaders`/`makeHttpRequest`.
14
+ */
15
+ export declare const resolveTemplateRecord: (record: Record<string, string> | undefined, values: FormValues, options?: {
16
+ encode?: boolean;
17
+ json?: boolean;
18
+ }) => Record<string, string> | undefined;
19
+ /**
20
+ * Append query parameters to a URL. Entries with an empty key are skipped,
21
+ * keys and values are URL-encoded, and `?` or `&` is chosen automatically
22
+ * based on whether the URL already has a query string. Values are expected
23
+ * to already have their template variables resolved.
24
+ */
25
+ export declare const appendQueryParams: (url: string, params?: QueryParams) => string;
26
+ /**
27
+ * Prepend a base URL to a relative URL. Absolute urls (starting with
28
+ * `http://` or `https://`, case-insensitive) and protocol-relative urls
29
+ * (`//host/...`) are returned untouched, so individual fields can still
30
+ * target an external API. A single slash is enforced at the join so a
31
+ * trailing slash on the base and/or a leading slash on the path don't
32
+ * produce `//`. When no base URL is configured, the url is returned as-is.
33
+ *
34
+ * Expects the url to already have its template variables resolved.
35
+ */
36
+ export declare const resolveUrl: (url: string, baseUrl?: string) => string;
37
+ /**
38
+ * Result of an HTTP request
39
+ */
40
+ export interface HttpRequestResult {
41
+ /**
42
+ * Whether the request was successful (2xx status code)
43
+ */
44
+ success: boolean;
45
+ /**
46
+ * Response data (parsed JSON or raw text)
47
+ */
48
+ data?: unknown;
49
+ /**
50
+ * Error message if request failed
51
+ */
52
+ error?: string;
53
+ /**
54
+ * HTTP status code
55
+ */
56
+ status?: number;
57
+ /**
58
+ * HTTP status text
59
+ */
60
+ statusText?: string;
61
+ }
62
+ /**
63
+ * Options for making an HTTP request
64
+ */
65
+ export interface HttpRequestOptions {
66
+ /**
67
+ * The URL to call (should already have variables replaced)
68
+ */
69
+ url: string;
70
+ /**
71
+ * HTTP method
72
+ */
73
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
74
+ /**
75
+ * Request headers
76
+ */
77
+ headers?: HttpHeaders;
78
+ /**
79
+ * Query parameters appended to the URL (values should already have their
80
+ * template variables resolved; keys/values are URL-encoded here)
81
+ */
82
+ queryParams?: QueryParams;
83
+ /**
84
+ * Request body (for POST/PUT/PATCH)
85
+ */
86
+ body?: string;
87
+ /**
88
+ * Optional abort signal to cancel the request
89
+ */
90
+ signal?: AbortSignal;
91
+ }
92
+ /**
93
+ * Make an HTTP request with common error handling and response parsing
94
+ *
95
+ * This is a shared utility used by both HTTP inputs and submit buttons
96
+ * to ensure consistent behavior across the library.
97
+ *
98
+ * @param options - Request options
99
+ * @returns Promise with request result
100
+ */
101
+ export declare const makeHttpRequest: (options: HttpRequestOptions) => Promise<HttpRequestResult>;
102
+ /**
103
+ * Replace template variables in a string with actual values from form data
104
+ *
105
+ * Uses {{fieldId}} syntax for all replacements (URLs, JSON bodies, etc.)
106
+ *
107
+ * Smart JSON handling:
108
+ * - Strings: automatically wrapped in quotes and escaped
109
+ * - Numbers/Booleans: converted to JSON-safe format
110
+ * - Arrays/Objects: JSON.stringify
111
+ *
112
+ * @param template - The template string containing variables
113
+ * @param values - Form values to substitute
114
+ * @param options - Replacement options
115
+ * @param options.encode - Whether to URL-encode the replaced values (for URLs)
116
+ * @param options.json - Whether to use smart JSON handling (for request bodies)
117
+ * @returns The string with variables replaced
118
+ *
119
+ * @example
120
+ * // For URLs (with encoding)
121
+ * replaceTemplateVariables("https://api.com/users/{{userId}}", { userId: "john doe" }, { encode: true })
122
+ * // => "https://api.com/users/john%20doe"
123
+ *
124
+ * // For JSON bodies (smart handling)
125
+ * replaceTemplateVariables('{"name": {{userName}}}', { userName: "John" }, { json: true })
126
+ * // => '{"name": "John"}'
127
+ *
128
+ * replaceTemplateVariables('{"age": {{userAge}}}', { userAge: 25 }, { json: true })
129
+ * // => '{"age": 25}'
130
+ */
131
+ export declare const replaceTemplateVariables: (template: string | undefined, values: FormValues, options?: {
132
+ encode?: boolean;
133
+ json?: boolean;
134
+ }) => string;
135
+ /**
136
+ * Replace template variables in response data (for redirect URLs)
137
+ *
138
+ * Supports {{response.field}} format to access response data
139
+ *
140
+ * @param template - The template string containing variables
141
+ * @param responseData - Response data object
142
+ * @returns The string with variables replaced
143
+ */
144
+ export declare const replaceResponseVariables: (template: string | undefined, responseData: unknown) => string;
145
+ /**
146
+ * Extract a value from an object using a path that supports dot notation
147
+ * and array indexing. Examples:
148
+ * - "data.users" → obj.data.users
149
+ * - "results[0].name" → obj.results[0].name
150
+ *
151
+ * @param obj - The object to extract value from
152
+ * @param path - The path expression (empty string returns the object as-is)
153
+ * @returns The value at the path, or undefined if not found
154
+ */
155
+ export declare const getValueByPath: (obj: unknown, path: string) => unknown;
156
+ /**
157
+ * Project a list-shaped HTTP response into InputOption objects, applying
158
+ * a field-to-property mapping. Returns an empty array when the data is not
159
+ * iterable or required fields are missing.
160
+ */
161
+ export declare const extractOptionsFromResponse: (response: unknown, responsePath: string | undefined, mapping: OptionsSourceMapping) => InputOption[];