@powerhousedao/workflow 6.2.3-dev.26 → 6.2.3-dev.28

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 (111) hide show
  1. package/dist/{node/BlockSelector-COZm6-ev.mjs → browser/BlockSelector-D24DIiSX.js} +45 -12
  2. package/dist/browser/{BlockSelector-QQgOCVH3.js.map → BlockSelector-D24DIiSX.js.map} +1 -1
  3. package/dist/browser/{PieceMarkdown-C8Gv88TV.js → PieceMarkdown-B8EEaQgT.js} +2 -2
  4. package/dist/browser/{PieceMarkdown-C8Gv88TV.js.map → PieceMarkdown-B8EEaQgT.js.map} +1 -1
  5. package/dist/browser/{connection-form-XKR4zQgQ.js → connection-form-D-NETdDQ.js} +3 -3
  6. package/dist/browser/{connection-form-XKR4zQgQ.js.map → connection-form-D-NETdDQ.js.map} +1 -1
  7. package/dist/browser/{data-tree-DKrDFeQg.js → data-tree-DA4sc7B7.js} +2 -2
  8. package/dist/browser/{data-tree-DKrDFeQg.js.map → data-tree-DA4sc7B7.js.map} +1 -1
  9. package/dist/browser/{editor-YZw296bf.js → editor-B6N0PCuZ.js} +754 -417
  10. package/dist/browser/editor-B6N0PCuZ.js.map +1 -0
  11. package/dist/browser/{editor-C_E_JTp6.js → editor-BkdwuOC-.js} +4 -4
  12. package/dist/browser/{editor-C_E_JTp6.js.map → editor-BkdwuOC-.js.map} +1 -1
  13. package/dist/browser/{editor-fjwq-8Yq.js → editor-CZ5NvCyv.js} +4 -4
  14. package/dist/browser/{editor-fjwq-8Yq.js.map → editor-CZ5NvCyv.js.map} +1 -1
  15. package/dist/browser/editors/connection-editor/module.js +1 -1
  16. package/dist/browser/editors/workflow-editor/module.js +1 -1
  17. package/dist/browser/editors/workflow-studio/module.js +1 -1
  18. package/dist/browser/index.js +1 -1
  19. package/dist/browser/{runtime-api-xwvg5PzA.js → runtime-api-DDMQc4PB.js} +136 -40
  20. package/dist/browser/runtime-api-DDMQc4PB.js.map +1 -0
  21. package/dist/browser/{trigger-text-CdNxQOHw.js → trigger-text-CUv5Z2Uk.js} +4 -4
  22. package/dist/browser/{trigger-text-CdNxQOHw.js.map → trigger-text-CUv5Z2Uk.js.map} +1 -1
  23. package/dist/{browser/BlockSelector-QQgOCVH3.js → node/BlockSelector-CTmmpYxu.mjs} +45 -12
  24. package/dist/node/{BlockSelector-COZm6-ev.mjs.map → BlockSelector-CTmmpYxu.mjs.map} +1 -1
  25. package/dist/node/{PieceMarkdown-DIxZY5aG.mjs → PieceMarkdown-BMhBGa4t.mjs} +2 -2
  26. package/dist/node/{PieceMarkdown-DIxZY5aG.mjs.map → PieceMarkdown-BMhBGa4t.mjs.map} +1 -1
  27. package/dist/node/{connection-form-BLduFusc.mjs → connection-form-C9vbfSnA.mjs} +3 -3
  28. package/dist/node/{connection-form-BLduFusc.mjs.map → connection-form-C9vbfSnA.mjs.map} +1 -1
  29. package/dist/node/{data-tree-CmiGqG7C.mjs → data-tree-CbqpF3lC.mjs} +2 -2
  30. package/dist/node/{data-tree-CmiGqG7C.mjs.map → data-tree-CbqpF3lC.mjs.map} +1 -1
  31. package/dist/node/{editor-CN4PEGrW.mjs → editor-By9BHI8e.mjs} +4 -4
  32. package/dist/node/{editor-CN4PEGrW.mjs.map → editor-By9BHI8e.mjs.map} +1 -1
  33. package/dist/node/{editor-B2ZoeGue.mjs → editor-DP36YDk5.mjs} +754 -417
  34. package/dist/node/editor-DP36YDk5.mjs.map +1 -0
  35. package/dist/node/{editor-CyNBEKoj.mjs → editor-StBssjcQ.mjs} +4 -4
  36. package/dist/node/{editor-CyNBEKoj.mjs.map → editor-StBssjcQ.mjs.map} +1 -1
  37. package/dist/node/editors/connection-editor/module.mjs +1 -1
  38. package/dist/node/editors/workflow-editor/module.mjs +1 -1
  39. package/dist/node/editors/workflow-studio/module.mjs +1 -1
  40. package/dist/node/index.mjs +1 -1
  41. package/dist/node/pieces/reactor/descriptor.json +72 -16
  42. package/dist/node/pieces/reactor/index.mjs +317 -22
  43. package/dist/node/pieces/reactor/index.mjs.map +1 -1
  44. package/dist/node/{runtime-api-xwvg5PzA.mjs → runtime-api-DDMQc4PB.mjs} +136 -40
  45. package/dist/node/runtime-api-DDMQc4PB.mjs.map +1 -0
  46. package/dist/node/{trigger-text-qj_U3Qzd.mjs → trigger-text-Bzq6VfOQ.mjs} +4 -4
  47. package/dist/node/{trigger-text-qj_U3Qzd.mjs.map → trigger-text-Bzq6VfOQ.mjs.map} +1 -1
  48. package/dist/style.css +59 -3
  49. package/dist/types/editors/shared/controls.d.ts +8 -0
  50. package/dist/types/editors/shared/controls.d.ts.map +1 -1
  51. package/dist/types/editors/shared/icons.d.ts +2 -0
  52. package/dist/types/editors/shared/icons.d.ts.map +1 -1
  53. package/dist/types/editors/workflow-editor/runtime-api.d.ts +2 -1
  54. package/dist/types/editors/workflow-editor/runtime-api.d.ts.map +1 -1
  55. package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts.map +1 -1
  56. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts +3 -2
  57. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts.map +1 -1
  58. package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts.map +1 -1
  59. package/dist/types/editors/workflow-editor/ui/blocks.d.ts +2 -0
  60. package/dist/types/editors/workflow-editor/ui/blocks.d.ts.map +1 -1
  61. package/dist/types/editors/workflow-editor/ui/forms.d.ts +42 -5
  62. package/dist/types/editors/workflow-editor/ui/forms.d.ts.map +1 -1
  63. package/dist/types/editors/workflow-editor/ui/piece-source.d.ts +1 -0
  64. package/dist/types/editors/workflow-editor/ui/piece-source.d.ts.map +1 -1
  65. package/dist/types/editors/workflow-editor/ui/prop-controls.d.ts +61 -0
  66. package/dist/types/editors/workflow-editor/ui/prop-controls.d.ts.map +1 -0
  67. package/dist/types/editors/workflow-editor/ui/prop-layout.d.ts +12 -0
  68. package/dist/types/editors/workflow-editor/ui/prop-layout.d.ts.map +1 -0
  69. package/dist/types/pieces/reactor/lib/actions/document-create.d.ts +3 -1
  70. package/dist/types/pieces/reactor/lib/actions/document-create.d.ts.map +1 -1
  71. package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts +2 -1
  72. package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts.map +1 -1
  73. package/dist/types/pieces/reactor/lib/input-props.d.ts +5 -0
  74. package/dist/types/pieces/reactor/lib/input-props.d.ts.map +1 -0
  75. package/dist/types/pieces/reactor/lib/input-props.test.d.ts +2 -0
  76. package/dist/types/pieces/reactor/lib/input-props.test.d.ts.map +1 -0
  77. package/dist/types/pieces/reactor/lib/input-schema.d.ts +22 -0
  78. package/dist/types/pieces/reactor/lib/input-schema.d.ts.map +1 -0
  79. package/dist/types/pieces/reactor/lib/input-schema.test.d.ts +2 -0
  80. package/dist/types/pieces/reactor/lib/input-schema.test.d.ts.map +1 -0
  81. package/dist/types/pieces/reactor/lib/reactor.d.ts +13 -1
  82. package/dist/types/pieces/reactor/lib/reactor.d.ts.map +1 -1
  83. package/dist/types/pieces/reactor/lib/schema-text.d.ts +7 -0
  84. package/dist/types/pieces/reactor/lib/schema-text.d.ts.map +1 -0
  85. package/dist/types/pieces/reactor/lib/schema-text.test.d.ts +2 -0
  86. package/dist/types/pieces/reactor/lib/schema-text.test.d.ts.map +1 -0
  87. package/dist/types/scripts/ui-stack.d.ts +22 -0
  88. package/dist/types/scripts/ui-stack.d.ts.map +1 -1
  89. package/dist/types/test/ui/harness/prop-controls.d.ts +6 -0
  90. package/dist/types/test/ui/harness/prop-controls.d.ts.map +1 -0
  91. package/dist/types/test/ui/prop-controls.spec.d.ts +2 -0
  92. package/dist/types/test/ui/prop-controls.spec.d.ts.map +1 -0
  93. package/dist/types/test/ui/reactor-steps.spec.d.ts +2 -0
  94. package/dist/types/test/ui/reactor-steps.spec.d.ts.map +1 -0
  95. package/package.json +8 -8
  96. package/dist/browser/editor-YZw296bf.js.map +0 -1
  97. package/dist/browser/runtime-api-xwvg5PzA.js.map +0 -1
  98. package/dist/node/editor-B2ZoeGue.mjs.map +0 -1
  99. package/dist/node/runtime-api-xwvg5PzA.mjs.map +0 -1
  100. package/dist/types/editors/workflow-editor/ui/ActionListEditor.d.ts +0 -6
  101. package/dist/types/editors/workflow-editor/ui/ActionListEditor.d.ts.map +0 -1
  102. package/dist/types/editors/workflow-editor/ui/Autocomplete.d.ts +0 -20
  103. package/dist/types/editors/workflow-editor/ui/Autocomplete.d.ts.map +0 -1
  104. package/dist/types/editors/workflow-editor/ui/action-template.d.ts +0 -2
  105. package/dist/types/editors/workflow-editor/ui/action-template.d.ts.map +0 -1
  106. package/dist/types/editors/workflow-editor/ui/action-template.test.d.ts +0 -2
  107. package/dist/types/editors/workflow-editor/ui/action-template.test.d.ts.map +0 -1
  108. package/dist/types/editors/workflow-editor/ui/reactor-piece-form.d.ts +0 -5
  109. package/dist/types/editors/workflow-editor/ui/reactor-piece-form.d.ts.map +0 -1
  110. package/dist/types/editors/workflow-editor/ui/reactor-piece-form.test.d.ts +0 -2
  111. package/dist/types/editors/workflow-editor/ui/reactor-piece-form.test.d.ts.map +0 -1
@@ -1,17 +1,17 @@
1
1
  import { r as __toESM, t as __commonJSMin } from "./rolldown-runtime-DC62tzP2.js";
2
2
  import { o as planFromAuth, t as connectorIdForPiece } from "./piece-auth-Z4mZEOtL.js";
3
- import { S as REACTOR_PIECE, _ as rotateSecret, a as fetchConnections, b as testTrigger, d as fetchWebhookEndpoint, h as loadBlockOptions, i as fetchBlockOutputTree, l as fetchRuns, m as invalidateConnections, p as getBlockForm, r as createSecret, s as fetchPieceCatalog, u as fetchSecretStat } from "./runtime-api-xwvg5PzA.js";
3
+ import { S as TRIGGER_PRESETS, _ as rotateSecret, a as fetchConnections, b as testTrigger, d as fetchWebhookEndpoint, h as loadBlockOptions, i as fetchBlockOutputTree, l as fetchRuns, m as invalidateConnections, p as getBlockForm, r as createSecret, s as fetchPieceCatalog, u as fetchSecretStat, x as STEP_PRESETS } from "./runtime-api-DDMQc4PB.js";
4
4
  import { y as actions } from "./module-jDZ4pq3W.js";
5
5
  import { t as useConnectionDocumentById } from "./connection-BUum0hJI.js";
6
6
  import { y as actions$1 } from "./module-Bkms70LV.js";
7
7
  import { t as useSelectedWorkflowDocument } from "./workflow-CGtVlhr8.js";
8
- import { A as FieldError, B as textInputClass, E as toneOf, F as Select, H as DocumentErrorBoundary, I as Switch, L as Tabs, M as Hint, N as IconButton, O as useSyncWorkflowRuntimeUrl, P as Segmented, R as invalidClass, S as formatWhen, V as Icon, a as pieceLogo, d as RUN_TONE, h as TONE_TEXT, i as pieceDisplayName, j as FieldLabel, k as Button, m as TONE_DOT, n as BlockSelector, o as useBlockMeta, r as blockMeta, s as usePieceLogos, t as BlockLogo, v as formatAbsolute, y as formatDuration, z as textAreaClass } from "./BlockSelector-QQgOCVH3.js";
9
- import { a as BackButton, i as connectionCallbacks, o as UndoRedo, t as ConnectionForm } from "./connection-form-XKR4zQgQ.js";
10
- import { a as draftFromConfig, c as DataViewer, d as flowOrder, f as layoutWorkflow, i as configFromDraft, l as acyclicTargets, m as reachableFrom, n as describeSchedule, o as switchKind, r as describeTrigger, s as timezoneOf, t as describeCron, u as attachableSteps } from "./trigger-text-CdNxQOHw.js";
8
+ import { A as FieldError, B as textInputClass, E as toneOf, F as Select, H as isIconName, I as Switch, L as Tabs, M as Hint, N as IconButton, O as useSyncWorkflowRuntimeUrl, P as Segmented, R as invalidClass, S as formatWhen, U as DocumentErrorBoundary, V as Icon, a as pieceLogo, d as RUN_TONE, h as TONE_TEXT, i as pieceDisplayName, j as FieldLabel, k as Button, m as TONE_DOT, n as BlockSelector, o as useBlockMeta, r as blockMeta, s as usePieceLogos, t as BlockLogo, v as formatAbsolute, y as formatDuration, z as textAreaClass } from "./BlockSelector-D24DIiSX.js";
9
+ import { a as BackButton, i as connectionCallbacks, o as UndoRedo, t as ConnectionForm } from "./connection-form-D-NETdDQ.js";
10
+ import { a as draftFromConfig, c as DataViewer, d as flowOrder, f as layoutWorkflow, i as configFromDraft, l as acyclicTargets, m as reachableFrom, n as describeSchedule, o as switchKind, r as describeTrigger, s as timezoneOf, t as describeCron, u as attachableSteps } from "./trigger-text-CUv5Z2Uk.js";
11
11
  import { generateId } from "document-model";
12
12
  import { addDocument, useFileNodesInSelectedDrive, useSelectedDocumentId, useSelectedDriveId } from "@powerhousedao/reactor-browser";
13
13
  import * as React$1 from "react";
14
- import React, { Suspense, createContext, forwardRef, lazy, memo, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
14
+ import React, { Fragment, Suspense, createContext, forwardRef, lazy, memo, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
15
15
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
16
16
  import * as ReactDOM$1 from "react-dom";
17
17
  import ReactDOM, { createPortal } from "react-dom";
@@ -6410,261 +6410,555 @@ function ConnectionField(props) {
6410
6410
  });
6411
6411
  }
6412
6412
  //#endregion
6413
- //#region editors/workflow-editor/ui/action-template.ts
6414
- function pascalCase(actionType) {
6415
- return actionType.toLowerCase().split(/[_\s]+/).filter(Boolean).map((part) => part[0].toUpperCase() + part.slice(1)).join("");
6416
- }
6417
- function placeholderFor(type) {
6418
- const bare = type.replace(/!/g, "").trim();
6419
- if (bare.startsWith("[")) return [];
6420
- switch (bare) {
6421
- case "Int":
6422
- case "Float": return 0;
6423
- case "Boolean": return false;
6424
- case "String":
6425
- case "OID":
6426
- case "PHID":
6427
- case "OLabel":
6428
- case "URL":
6429
- case "DateTime":
6430
- case "Date":
6431
- case "EmailAddress":
6432
- case "EthereumAddress":
6433
- case "Currency": return "";
6434
- default: return null;
6435
- }
6413
+ //#region editors/workflow-editor/ui/validation.ts
6414
+ function isEmptyValue(value) {
6415
+ if (value === void 0 || value === null) return true;
6416
+ if (typeof value === "string") return value.trim() === "";
6417
+ if (Array.isArray(value)) return value.length === 0;
6418
+ return false;
6436
6419
  }
6437
- function inputTemplateFromSchema(schema, actionType) {
6438
- const rootName = `${pascalCase(actionType)}Input`;
6439
- const body = new RegExp(`input\\s+${rootName}\\s*\\{([^}]*)\\}`).exec(schema)?.[1];
6440
- if (!body) return null;
6441
- const template = {};
6442
- for (const line of body.split("\n")) {
6443
- const cleaned = line.replace(/#.*$/, "").replace(/"[^"]*"/g, "").trim();
6444
- const fieldMatch = /^(\w+)\s*:\s*([\w[\]!]+)/.exec(cleaned);
6445
- if (!fieldMatch) continue;
6446
- const [, name, type] = fieldMatch;
6447
- if (name === "_") continue;
6448
- template[name] = type.endsWith("!") ? placeholderFor(type) : null;
6449
- }
6450
- return Object.keys(template).length > 0 ? template : {};
6420
+ function isPropVisible(prop, config) {
6421
+ const rule = prop.showWhen;
6422
+ if (!rule) return true;
6423
+ const value = config[rule.prop] ?? void 0;
6424
+ if (value === void 0 && rule.unlessSet && config[rule.unlessSet] !== void 0) return false;
6425
+ return rule.oneOf.includes(value);
6426
+ }
6427
+ function missingRequired(props, config) {
6428
+ const record = config !== null && typeof config === "object" && !Array.isArray(config) ? config : {};
6429
+ return props.filter((prop) => prop.required && prop.type !== "MARKDOWN" && isPropVisible(prop, record) && isEmptyValue(record[prop.name] ?? prop.defaultValue)).map((prop) => prop.displayName);
6430
+ }
6431
+ function missingForBlock(form, config, connectionId) {
6432
+ if (!form || form === "loading") return [];
6433
+ const missing = missingRequired(form.props, config);
6434
+ if (form.auth === "required" && !connectionId) missing.unshift("Connection");
6435
+ return missing;
6451
6436
  }
6452
6437
  //#endregion
6453
- //#region editors/workflow-editor/ui/Autocomplete.tsx
6454
- function parseAutocompleteResult(result) {
6455
- const record = result;
6456
- if (!record || !Array.isArray(record.options)) return { options: [] };
6457
- return {
6458
- options: record.options.filter((option) => typeof option.value === "string").map((option) => ({
6459
- label: typeof option.label === "string" ? option.label : option.value,
6460
- value: option.value,
6461
- inputSchema: typeof option.inputSchema === "string" ? option.inputSchema : void 0
6462
- })),
6463
- placeholder: record.placeholder
6464
- };
6438
+ //#region editors/workflow-editor/ui/prop-controls.tsx
6439
+ const CALLOUT = {
6440
+ INFO: { box: "rounded bg-muted px-2 py-1.5" },
6441
+ WARNING: {
6442
+ box: "rounded border border-solid border-wf-warn/40 bg-wf-warn/10 px-2 py-1.5",
6443
+ icon: "alert"
6444
+ },
6445
+ TIP: {
6446
+ box: "rounded border border-solid border-wf-ok/30 bg-wf-ok/10 px-2 py-1.5",
6447
+ icon: "bolt"
6448
+ },
6449
+ BORDERLESS: { box: "" }
6450
+ };
6451
+ /** A MARKDOWN prop's text, styled by the piece's `variant` (INFO default). */
6452
+ function MarkdownCallout(props) {
6453
+ const callout = CALLOUT[props.variant ?? "INFO"] ?? CALLOUT.INFO;
6454
+ return /* @__PURE__ */ jsxs("div", {
6455
+ className: `flex gap-2 ${callout.box}`,
6456
+ "data-variant": props.variant ?? "INFO",
6457
+ children: [callout.icon ? /* @__PURE__ */ jsx(Icon, {
6458
+ name: callout.icon,
6459
+ className: `mt-0.5 h-3.5 w-3.5 shrink-0 ${callout.icon === "alert" ? "text-wf-warn" : "text-wf-ok"}`
6460
+ }) : null, /* @__PURE__ */ jsx("div", {
6461
+ className: "min-w-0 flex-1",
6462
+ children: props.children
6463
+ })]
6464
+ });
6465
6465
  }
6466
- const inputClass$2 = "w-full rounded border border-foreground/15 px-2 py-1.5 text-sm text-foreground";
6467
- function AutocompleteInput(props) {
6468
- const listId = useId();
6469
- const [text, setText] = useState(props.value);
6470
- const [prevValue, setPrevValue] = useState(props.value);
6471
- if (props.value !== prevValue) {
6472
- setPrevValue(props.value);
6473
- setText(props.value);
6466
+ /** An option's icon, when the piece names one this editor draws. */
6467
+ function optionIcon(name) {
6468
+ return isIconName(name) ? /* @__PURE__ */ jsx(Icon, {
6469
+ name,
6470
+ className: "h-3.5 w-3.5 shrink-0 text-muted-foreground"
6471
+ }) : void 0;
6472
+ }
6473
+ /** STATIC_DROPDOWN with `display: 'cards'`: one selectable card per option. */
6474
+ function OptionCards(props) {
6475
+ const current = props.keyOf(props.value);
6476
+ return /* @__PURE__ */ jsx("div", {
6477
+ id: props.id,
6478
+ role: "radiogroup",
6479
+ className: `grid grid-cols-2 gap-2 ${props.invalid ? "rounded-md ring-1 ring-wf-warn/60" : ""}`,
6480
+ children: props.options.map((option) => {
6481
+ const key = props.keyOf(option.value);
6482
+ const selected = key === current;
6483
+ return /* @__PURE__ */ jsxs("button", {
6484
+ type: "button",
6485
+ role: "radio",
6486
+ "aria-checked": selected,
6487
+ className: `flex min-w-0 flex-col items-start gap-1 rounded-lg border border-solid p-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 ${selected ? "border-foreground/40 bg-accent" : "border-foreground/10 hover:border-foreground/25"}`,
6488
+ onClick: () => props.onChange(selected && props.clearable ? void 0 : option.value),
6489
+ children: [/* @__PURE__ */ jsxs("span", {
6490
+ className: "flex items-center gap-1.5 text-[13px] font-medium text-foreground",
6491
+ children: [optionIcon(option.icon), option.label]
6492
+ }), option.description ? /* @__PURE__ */ jsx("span", {
6493
+ className: "text-xs leading-snug text-muted-foreground",
6494
+ children: option.description
6495
+ }) : null]
6496
+ }, key);
6497
+ })
6498
+ });
6499
+ }
6500
+ /** The declared bounds, for the hint and the check: "Between 0 and 5". */
6501
+ function numberRangeText(min, max) {
6502
+ if (min !== void 0 && max !== void 0) return `Between ${min} and ${max}`;
6503
+ if (min !== void 0) return `At least ${min}`;
6504
+ if (max !== void 0) return `At most ${max}`;
6505
+ return null;
6506
+ }
6507
+ function numberRangeError(value, min, max) {
6508
+ if (typeof value !== "number") return null;
6509
+ if (min !== void 0 && value < min || max !== void 0 && value > max) return `${numberRangeText(min, max)}.`;
6510
+ return null;
6511
+ }
6512
+ /** NUMBER with `display: 'stepper'`: − value +, still accepting expressions. */
6513
+ function NumberStepper(props) {
6514
+ const step = props.step ?? 1;
6515
+ const numeric = typeof props.value === "number" ? props.value : void 0;
6516
+ const clamp = (next) => Math.min(props.max ?? Infinity, Math.max(props.min ?? -Infinity, next));
6517
+ const bump = (direction) => props.onCommit(clamp((numeric ?? props.min ?? 0) + direction * step));
6518
+ const text = props.value === void 0 || props.value === null ? "" : String(props.value);
6519
+ return /* @__PURE__ */ jsxs("div", {
6520
+ className: "flex items-center gap-1",
6521
+ children: [
6522
+ /* @__PURE__ */ jsx(IconButton, {
6523
+ icon: "minus",
6524
+ label: "Decrease",
6525
+ disabled: numeric !== void 0 && props.min !== void 0 && numeric <= props.min,
6526
+ onClick: () => bump(-1)
6527
+ }),
6528
+ /* @__PURE__ */ jsx("input", {
6529
+ id: props.id,
6530
+ className: `${textInputClass} w-24 text-center tabular-nums ${props.invalid ? invalidClass : ""}`,
6531
+ defaultValue: text,
6532
+ inputMode: "decimal",
6533
+ spellCheck: false,
6534
+ onFocus: props.onFocus,
6535
+ onBlur: (event) => {
6536
+ const raw = event.target.value.trim();
6537
+ if (raw === "") return props.onCommit(void 0);
6538
+ if (hasExpressions(raw)) return props.onCommit(raw);
6539
+ const parsed = Number(raw);
6540
+ props.onCommit(Number.isFinite(parsed) ? parsed : raw);
6541
+ }
6542
+ }, text),
6543
+ /* @__PURE__ */ jsx(IconButton, {
6544
+ icon: "plus",
6545
+ label: "Increase",
6546
+ disabled: numeric !== void 0 && props.max !== void 0 && numeric >= props.max,
6547
+ onClick: () => bump(1)
6548
+ })
6549
+ ]
6550
+ });
6551
+ }
6552
+ const DATE_PRESETS = [
6553
+ {
6554
+ value: "any_time",
6555
+ label: "Any time"
6556
+ },
6557
+ {
6558
+ value: "last_24_hours",
6559
+ label: "Last 24 hours"
6560
+ },
6561
+ {
6562
+ value: "last_7_days",
6563
+ label: "Last 7 days"
6564
+ },
6565
+ {
6566
+ value: "last_30_days",
6567
+ label: "Last 30 days"
6568
+ },
6569
+ {
6570
+ value: "last_90_days",
6571
+ label: "Last 90 days"
6572
+ },
6573
+ {
6574
+ value: "this_month",
6575
+ label: "This month"
6576
+ },
6577
+ {
6578
+ value: "custom",
6579
+ label: "Custom"
6474
6580
  }
6475
- const [result, setResult] = useState(null);
6476
- const [error, setError] = useState(null);
6477
- const [loading, setLoading] = useState(false);
6478
- const refresh = () => {
6479
- if (!props.loadOptions || loading) return;
6480
- setLoading(true);
6481
- props.loadOptions().then((raw) => {
6482
- setResult(parseAutocompleteResult(raw));
6483
- setError(null);
6484
- setLoading(false);
6485
- }, (loadError) => {
6486
- setError(loadError instanceof Error ? loadError.message : String(loadError));
6487
- setLoading(false);
6488
- });
6489
- };
6490
- return /* @__PURE__ */ jsxs("div", { children: [
6491
- /* @__PURE__ */ jsx("input", {
6581
+ ];
6582
+ function toLocalInput(iso) {
6583
+ if (!iso) return "";
6584
+ const date = new Date(iso);
6585
+ if (Number.isNaN(date.getTime())) return "";
6586
+ const pad = (n) => String(n).padStart(2, "0");
6587
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`;
6588
+ }
6589
+ function fromLocalInput(local) {
6590
+ if (!local) return void 0;
6591
+ const date = new Date(local);
6592
+ return Number.isNaN(date.getTime()) ? void 0 : date.toISOString();
6593
+ }
6594
+ function asDateRange(value) {
6595
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
6596
+ }
6597
+ function DateRangeField(props) {
6598
+ const range = asDateRange(props.value);
6599
+ const setPreset = (preset) => props.onCommit(preset === "" ? void 0 : preset === "custom" ? {
6600
+ preset,
6601
+ after: range.after,
6602
+ before: range.before
6603
+ } : { preset });
6604
+ return /* @__PURE__ */ jsxs("div", {
6605
+ className: "flex flex-col gap-2",
6606
+ children: [props.dropdown ? /* @__PURE__ */ jsx(Select, {
6492
6607
  id: props.id,
6493
- className: props.className ?? inputClass$2,
6494
- value: text,
6495
- list: listId,
6496
- placeholder: result?.placeholder ?? props.placeholder,
6608
+ options: DATE_PRESETS,
6609
+ value: range.preset ?? "",
6610
+ onChange: setPreset,
6611
+ invalid: props.invalid,
6612
+ clearable: props.clearable,
6613
+ placeholder: "Choose a range"
6614
+ }) : /* @__PURE__ */ jsx("div", {
6615
+ id: props.id,
6616
+ role: "radiogroup",
6617
+ className: "flex flex-wrap gap-1.5",
6618
+ children: DATE_PRESETS.map((preset) => {
6619
+ const selected = range.preset === preset.value;
6620
+ return /* @__PURE__ */ jsx("button", {
6621
+ type: "button",
6622
+ role: "radio",
6623
+ "aria-checked": selected,
6624
+ className: `h-7 rounded-full border border-solid px-2.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 ${selected ? "border-foreground bg-foreground text-background" : "border-foreground/15 text-muted-foreground hover:text-foreground"}`,
6625
+ onClick: () => setPreset(selected && props.clearable ? "" : preset.value),
6626
+ children: preset.label
6627
+ }, preset.value);
6628
+ })
6629
+ }), range.preset === "custom" ? /* @__PURE__ */ jsx("div", {
6630
+ className: "grid grid-cols-2 gap-2",
6631
+ children: ["after", "before"].map((edge) => /* @__PURE__ */ jsxs("label", {
6632
+ className: "flex flex-col gap-1 text-xs text-muted-foreground",
6633
+ children: [edge === "after" ? "From" : "To", /* @__PURE__ */ jsx("input", {
6634
+ type: "datetime-local",
6635
+ className: textInputClass,
6636
+ defaultValue: toLocalInput(range[edge]),
6637
+ onBlur: (event) => props.onCommit({
6638
+ ...range,
6639
+ [edge]: fromLocalInput(event.target.value)
6640
+ })
6641
+ })]
6642
+ }, edge))
6643
+ }) : null]
6644
+ });
6645
+ }
6646
+ const HEX = /^#[0-9a-f]{6}$/i;
6647
+ /** COLOR: a swatch picker beside a text field that also takes expressions. */
6648
+ function ColorField(props) {
6649
+ const text = typeof props.value === "string" ? props.value : "";
6650
+ const [draft, setDraft] = useState(null);
6651
+ const swatchRef = useRef(null);
6652
+ const onCommit = props.onCommit;
6653
+ useEffect(() => {
6654
+ const swatch = swatchRef.current;
6655
+ if (!swatch) return;
6656
+ const commit = () => {
6657
+ setDraft(null);
6658
+ onCommit(swatch.value);
6659
+ };
6660
+ swatch.addEventListener("change", commit);
6661
+ return () => swatch.removeEventListener("change", commit);
6662
+ }, [onCommit]);
6663
+ return /* @__PURE__ */ jsxs("div", {
6664
+ className: "flex items-center gap-2",
6665
+ children: [/* @__PURE__ */ jsx("input", {
6666
+ ref: swatchRef,
6667
+ type: "color",
6668
+ "aria-label": "Pick a colour",
6669
+ className: "h-9 w-10 shrink-0 cursor-pointer rounded-md border border-solid border-foreground/15 bg-card p-1",
6670
+ value: draft ?? (HEX.test(text) ? text : "#000000"),
6671
+ onChange: (event) => setDraft(event.target.value)
6672
+ }), /* @__PURE__ */ jsx("input", {
6673
+ id: props.id,
6674
+ className: `${textInputClass} font-mono text-xs ${props.invalid ? invalidClass : ""}`,
6675
+ defaultValue: text,
6676
+ placeholder: "#1d63d6 or {{steps.…}}",
6497
6677
  spellCheck: false,
6498
- onFocus: refresh,
6499
- onChange: (event) => {
6500
- const next = event.target.value;
6501
- setText(next);
6502
- const picked = result?.options.find((option) => option.value === next);
6503
- if (picked) {
6504
- props.onCommit(next);
6505
- props.onPick?.(picked);
6506
- }
6507
- },
6508
- onBlur: () => {
6509
- if (text !== props.value) props.onCommit(text);
6678
+ onFocus: props.onFocus,
6679
+ onBlur: (event) => {
6680
+ const raw = event.target.value.trim();
6681
+ props.onCommit(raw === "" ? void 0 : raw);
6510
6682
  }
6511
- }),
6512
- /* @__PURE__ */ jsx("datalist", {
6513
- id: listId,
6514
- children: (result?.options ?? []).map((option) => /* @__PURE__ */ jsx("option", {
6515
- value: option.value,
6516
- children: option.label
6517
- }, option.value))
6518
- }),
6519
- error ? /* @__PURE__ */ jsx("p", {
6520
- className: "mt-0.5 text-[11px] text-wf-fail",
6521
- children: error
6522
- }) : null
6523
- ] });
6683
+ }, text)]
6684
+ });
6685
+ }
6686
+ function richTextMode(format) {
6687
+ const value = typeof format === "string" ? format.toLowerCase() : "";
6688
+ if (value === "html") return "html";
6689
+ if (value === "markdown" || value === "md") return "markdown";
6690
+ return "plain";
6524
6691
  }
6525
6692
  //#endregion
6526
- //#region editors/workflow-editor/ui/ActionListEditor.tsx
6527
- function toRows(value) {
6528
- if (!Array.isArray(value)) return [];
6529
- return value.map((entry) => {
6530
- const record = entry ?? {};
6693
+ //#region editors/workflow-editor/ui/prop-layout.tsx
6694
+ const PLACED = /* @__PURE__ */ new Set([
6695
+ "section",
6696
+ "tabs",
6697
+ "builder",
6698
+ "footer"
6699
+ ]);
6700
+ function chipText(value) {
6701
+ if (typeof value === "string") return value;
6702
+ if (typeof value === "number" || typeof value === "boolean") return String(value);
6703
+ if (Array.isArray(value)) return value.map(chipText).join(", ");
6704
+ return "set";
6705
+ }
6706
+ /** Consecutive `width: 'half'` fields share a row, two at a time. */
6707
+ function Rows(props) {
6708
+ const rows = [];
6709
+ let pending = null;
6710
+ const flush = () => {
6711
+ if (pending) rows.push(/* @__PURE__ */ jsx(Fragment, { children: pending.node }, pending.prop.name));
6712
+ pending = null;
6713
+ };
6714
+ for (const item of props.items) {
6715
+ if (item.prop.width !== "half") {
6716
+ flush();
6717
+ rows.push(/* @__PURE__ */ jsx(Fragment, { children: item.node }, item.prop.name));
6718
+ continue;
6719
+ }
6720
+ if (!pending) {
6721
+ pending = item;
6722
+ continue;
6723
+ }
6724
+ const first = pending;
6725
+ pending = null;
6726
+ rows.push(/* @__PURE__ */ jsxs("div", {
6727
+ className: "grid grid-cols-1 gap-4 min-[420px]:grid-cols-2",
6728
+ children: [/* @__PURE__ */ jsx("div", {
6729
+ className: "min-w-0",
6730
+ children: first.node
6731
+ }), /* @__PURE__ */ jsx("div", {
6732
+ className: "min-w-0",
6733
+ children: item.node
6734
+ })]
6735
+ }, `${first.prop.name}+${item.prop.name}`));
6736
+ }
6737
+ flush();
6738
+ return /* @__PURE__ */ jsx(Fragment$1, { children: rows });
6739
+ }
6740
+ function RevealCard(props) {
6741
+ const open = props.layout.values[props.checkbox.name] === true;
6742
+ return /* @__PURE__ */ jsxs("div", {
6743
+ className: "flex flex-col gap-4",
6744
+ children: [props.layout.renderField(props.checkbox), open && props.revealed.length > 0 ? /* @__PURE__ */ jsx("div", {
6745
+ className: "flex flex-col gap-4 border-l-2 border-solid border-foreground/10 pl-3",
6746
+ children: /* @__PURE__ */ jsx(Rows, { items: props.revealed.map((prop) => ({
6747
+ prop,
6748
+ node: props.layout.renderField(prop)
6749
+ })) })
6750
+ }) : null]
6751
+ });
6752
+ }
6753
+ function FieldList(props) {
6754
+ const byName = new Map(props.members.map((prop) => [prop.name, prop]));
6755
+ const revealedBy = /* @__PURE__ */ new Map();
6756
+ for (const prop of props.members) for (const name of prop.reveals ?? []) if (byName.has(name)) revealedBy.set(name, prop);
6757
+ const items = props.members.filter((prop) => !revealedBy.has(prop.name)).map((prop) => {
6758
+ const revealed = (prop.reveals ?? []).map((name) => byName.get(name)).filter((entry) => entry !== void 0);
6531
6759
  return {
6532
- type: typeof record.type === "string" ? record.type : "",
6533
- input: record.input ?? {}
6760
+ prop,
6761
+ node: revealed.length > 0 ? /* @__PURE__ */ jsx(RevealCard, {
6762
+ checkbox: prop,
6763
+ revealed,
6764
+ layout: props.layout
6765
+ }) : props.layout.renderField(prop)
6534
6766
  };
6535
6767
  });
6768
+ return /* @__PURE__ */ jsx(Rows, { items });
6536
6769
  }
6537
- function stringifyInput(input) {
6538
- try {
6539
- return JSON.stringify(input ?? {}, null, 2);
6540
- } catch {
6541
- return "{}";
6542
- }
6770
+ function GroupHeading(props) {
6771
+ const { group } = props;
6772
+ if (!group.label && !group.description) return null;
6773
+ return /* @__PURE__ */ jsxs("div", {
6774
+ className: "flex flex-col gap-0.5",
6775
+ children: [group.label ? /* @__PURE__ */ jsxs("span", {
6776
+ className: "flex items-center gap-1.5 text-[13px] font-semibold text-foreground",
6777
+ children: [isIconName(group.icon) ? /* @__PURE__ */ jsx(Icon, {
6778
+ name: group.icon,
6779
+ className: "h-3.5 w-3.5 text-muted-foreground"
6780
+ }) : null, group.label]
6781
+ }) : null, group.description ? /* @__PURE__ */ jsx("span", {
6782
+ className: "text-xs text-muted-foreground",
6783
+ children: group.description
6784
+ }) : null]
6785
+ });
6543
6786
  }
6544
- const INVALID = Symbol("invalid");
6545
- function parseInput(text) {
6546
- if (text.trim() === "") return {};
6547
- try {
6548
- return JSON.parse(text);
6549
- } catch {
6550
- return INVALID;
6551
- }
6787
+ function Section$1(props) {
6788
+ return /* @__PURE__ */ jsxs("section", {
6789
+ "aria-label": props.group.label,
6790
+ className: "flex flex-col gap-4 rounded-lg border border-solid border-foreground/10 p-4",
6791
+ children: [/* @__PURE__ */ jsx(GroupHeading, { group: props.group }), /* @__PURE__ */ jsx(FieldList, {
6792
+ members: props.members,
6793
+ layout: props.layout
6794
+ })]
6795
+ });
6552
6796
  }
6553
- const inputClass$1 = "w-full rounded border border-foreground/15 px-2 py-1.5 text-sm text-foreground";
6554
- function ActionRowEditor(props) {
6555
- const { row } = props;
6556
- const [jsonText, setJsonText] = useState(() => stringifyInput(row.input));
6557
- const [prevInput, setPrevInput] = useState(row.input);
6558
- if (row.input !== prevInput) {
6559
- setPrevInput(row.input);
6560
- setJsonText(stringifyInput(row.input));
6561
- }
6562
- const [jsonError, setJsonError] = useState(null);
6797
+ function TabbedGroup(props) {
6798
+ const [active, setActive] = useState(props.members[0]?.name ?? "");
6799
+ const current = props.members.find((prop) => prop.name === active) ?? props.members[0];
6800
+ if (!current) return null;
6563
6801
  return /* @__PURE__ */ jsxs("div", {
6564
- className: "rounded border border-foreground/10 p-2",
6802
+ className: "flex flex-col gap-3",
6565
6803
  children: [
6566
- /* @__PURE__ */ jsxs("div", {
6804
+ /* @__PURE__ */ jsx(GroupHeading, { group: props.group }),
6805
+ /* @__PURE__ */ jsx("div", {
6806
+ className: "border-b border-solid border-foreground/10",
6807
+ children: /* @__PURE__ */ jsx(Tabs, {
6808
+ value: current.name,
6809
+ onChange: setActive,
6810
+ tabs: props.members.map((prop) => ({
6811
+ value: prop.name,
6812
+ label: prop.displayName,
6813
+ badge: isEmptyValue(props.layout.values[prop.name]) ? void 0 : /* @__PURE__ */ jsx("span", {
6814
+ "aria-label": "has a value",
6815
+ className: "h-1.5 w-1.5 rounded-full bg-wf-run"
6816
+ })
6817
+ }))
6818
+ })
6819
+ }),
6820
+ props.layout.renderField(current)
6821
+ ]
6822
+ });
6823
+ }
6824
+ function BuilderGroups(props) {
6825
+ const members = props.groups.flatMap((group) => group.props.map((name) => props.byName.get(name)).filter((prop) => prop !== void 0));
6826
+ const [added, setAdded] = useState([]);
6827
+ const inUse = members.filter((prop) => prop.required || added.includes(prop.name) || !isEmptyValue(props.layout.values[prop.name]));
6828
+ const available = members.filter((prop) => !inUse.includes(prop));
6829
+ return /* @__PURE__ */ jsxs("div", {
6830
+ className: "flex flex-col gap-3",
6831
+ children: [
6832
+ props.groups.map((group) => /* @__PURE__ */ jsx(GroupHeading, { group }, group.key)),
6833
+ inUse.map((prop) => /* @__PURE__ */ jsxs("div", {
6567
6834
  className: "flex items-start gap-1",
6568
6835
  children: [/* @__PURE__ */ jsx("div", {
6569
- className: "grow",
6570
- children: /* @__PURE__ */ jsx(AutocompleteInput, {
6571
- className: `${inputClass$1} font-mono text-xs`,
6572
- value: row.type,
6573
- placeholder: "Action type",
6574
- loadOptions: props.loadActionTypes,
6575
- onCommit: (type) => props.onChange({
6576
- ...row,
6577
- type
6578
- }),
6579
- onPick: (option) => {
6580
- const empty = row.input === null || row.input === void 0 || typeof row.input === "object" && Object.keys(row.input).length === 0;
6581
- const template = option.inputSchema ? inputTemplateFromSchema(option.inputSchema, option.value) : null;
6582
- props.onChange({
6583
- type: option.value,
6584
- input: empty && template ? template : row.input
6585
- });
6586
- }
6587
- })
6588
- }), /* @__PURE__ */ jsx("button", {
6589
- type: "button",
6590
- className: "shrink-0 rounded border border-foreground/10 px-2 py-1 text-xs text-muted-foreground/80 hover:text-wf-fail",
6591
- onClick: props.onRemove,
6592
- title: "Remove action",
6593
- children: "✕"
6836
+ className: "min-w-0 flex-1",
6837
+ children: props.layout.renderField(prop)
6838
+ }), prop.required ? null : /* @__PURE__ */ jsx(IconButton, {
6839
+ icon: "close",
6840
+ label: `Remove ${prop.displayName}`,
6841
+ className: "mt-7",
6842
+ onClick: () => {
6843
+ setAdded((names) => names.filter((name) => name !== prop.name));
6844
+ props.layout.onCommit(prop.name, void 0);
6845
+ }
6594
6846
  })]
6595
- }),
6596
- /* @__PURE__ */ jsx("textarea", {
6597
- className: `${inputClass$1} mt-1 min-h-16 font-mono text-xs`,
6598
- value: jsonText,
6599
- spellCheck: false,
6600
- onChange: (event) => setJsonText(event.target.value),
6601
- onBlur: () => {
6602
- const input = parseInput(jsonText);
6603
- if (input === INVALID) {
6604
- setJsonError("Invalid JSON — input not saved");
6605
- return;
6847
+ }, prop.name)),
6848
+ available.length > 0 ? /* @__PURE__ */ jsx("div", {
6849
+ className: "max-w-60",
6850
+ children: /* @__PURE__ */ jsx(Select, {
6851
+ options: available.map((prop) => ({
6852
+ value: prop.name,
6853
+ label: prop.displayName,
6854
+ description: prop.description
6855
+ })),
6856
+ value: "",
6857
+ placeholder: "Add filter",
6858
+ onChange: (name) => {
6859
+ if (name) setAdded((names) => [...names, name]);
6606
6860
  }
6607
- props.onChange({
6608
- ...row,
6609
- input
6610
- });
6611
- setJsonError(null);
6612
- }
6613
- }),
6614
- jsonError ? /* @__PURE__ */ jsx("p", {
6615
- className: "mt-0.5 text-[11px] text-wf-fail",
6616
- children: jsonError
6861
+ })
6617
6862
  }) : null
6618
6863
  ]
6619
6864
  });
6620
6865
  }
6621
- function ActionListEditor(props) {
6622
- const rows = toRows(props.value);
6623
- const commit = (next) => {
6624
- props.onCommit(next.length > 0 ? next : void 0);
6625
- };
6626
- return /* @__PURE__ */ jsxs("div", {
6627
- className: "flex flex-col gap-2",
6628
- children: [rows.map((row, index) => /* @__PURE__ */ jsx(ActionRowEditor, {
6629
- row,
6630
- loadActionTypes: props.loadActionTypes,
6631
- onChange: (next) => commit(rows.map((entry, i) => i === index ? next : entry)),
6632
- onRemove: () => commit(rows.filter((_, i) => i !== index))
6633
- }, index)), /* @__PURE__ */ jsx("button", {
6634
- type: "button",
6635
- className: "self-start rounded border border-foreground/15 px-2 py-1 text-xs font-medium text-muted-foreground",
6636
- onClick: () => commit([...rows, {
6637
- type: "",
6638
- input: {}
6639
- }]),
6640
- children: "+ Add action"
6641
- })]
6866
+ function Summary(props) {
6867
+ const set = props.members.filter((prop) => !isEmptyValue(props.layout.values[prop.name]));
6868
+ if (set.length === 0) return null;
6869
+ return /* @__PURE__ */ jsx("div", {
6870
+ className: "flex flex-wrap gap-1.5",
6871
+ "aria-label": "Filters in use",
6872
+ children: set.map((prop) => /* @__PURE__ */ jsxs("span", {
6873
+ className: "inline-flex h-6 max-w-full items-center gap-1 rounded-full bg-muted pl-2.5 pr-1 text-xs text-foreground",
6874
+ children: [/* @__PURE__ */ jsxs("span", {
6875
+ className: "truncate",
6876
+ children: [
6877
+ prop.displayName,
6878
+ ": ",
6879
+ chipText(props.layout.values[prop.name])
6880
+ ]
6881
+ }), /* @__PURE__ */ jsx("button", {
6882
+ type: "button",
6883
+ "aria-label": `Clear ${prop.displayName}`,
6884
+ className: "flex h-4 w-4 items-center justify-center rounded-full text-muted-foreground hover:bg-foreground/10 hover:text-foreground",
6885
+ onClick: () => props.layout.onCommit(prop.name, void 0),
6886
+ children: /* @__PURE__ */ jsx(Icon, {
6887
+ name: "close",
6888
+ className: "h-3 w-3"
6889
+ })
6890
+ })]
6891
+ }, prop.name))
6642
6892
  });
6643
6893
  }
6644
- //#endregion
6645
- //#region editors/workflow-editor/ui/validation.ts
6646
- function isEmptyValue(value) {
6647
- if (value === void 0 || value === null) return true;
6648
- if (typeof value === "string") return value.trim() === "";
6649
- if (Array.isArray(value)) return value.length === 0;
6650
- return false;
6651
- }
6652
- function isPropVisible(prop, config) {
6653
- const rule = prop.showWhen;
6654
- if (!rule) return true;
6655
- const value = config[rule.prop] ?? void 0;
6656
- if (value === void 0 && rule.unlessSet && config[rule.unlessSet] !== void 0) return false;
6657
- return rule.oneOf.includes(value);
6658
- }
6659
- function missingRequired(props, config) {
6660
- const record = config !== null && typeof config === "object" && !Array.isArray(config) ? config : {};
6661
- return props.filter((prop) => prop.required && prop.type !== "MARKDOWN" && isPropVisible(prop, record) && isEmptyValue(record[prop.name] ?? prop.defaultValue)).map((prop) => prop.displayName);
6662
- }
6663
- function missingForBlock(form, config, connectionId) {
6664
- if (!form || form === "loading") return [];
6665
- const missing = missingRequired(form.props, config);
6666
- if (form.auth === "required" && !connectionId) missing.unshift("Connection");
6667
- return missing;
6894
+ function PropLayout(props) {
6895
+ const groups = (props.groups ?? []).filter((group) => PLACED.has(group.display) || group.display === "summary");
6896
+ const byName = new Map(props.props.map((prop) => [prop.name, prop]));
6897
+ const groupOf = /* @__PURE__ */ new Map();
6898
+ for (const group of groups) {
6899
+ if (!PLACED.has(group.display)) continue;
6900
+ for (const name of group.props) if (byName.has(name) && !groupOf.has(name)) groupOf.set(name, group);
6901
+ }
6902
+ const membersOf = (group) => group.props.map((name) => byName.get(name)).filter((prop) => prop !== void 0);
6903
+ const builderGroups = groups.filter((group) => group.display === "builder");
6904
+ const summaries = groups.filter((group) => group.display === "summary");
6905
+ const sectionMembers = groups.filter((group) => group.display === "section").flatMap(membersOf);
6906
+ const blocks = [];
6907
+ let loose = [];
6908
+ const flushLoose = () => {
6909
+ if (loose.length === 0) return;
6910
+ blocks.push(/* @__PURE__ */ jsx(FieldList, {
6911
+ members: loose,
6912
+ layout: props
6913
+ }, `loose:${loose[0].name}`));
6914
+ loose = [];
6915
+ };
6916
+ const summarised = summaries.length > 0 && sectionMembers.length > 0;
6917
+ const placed = /* @__PURE__ */ new Set();
6918
+ for (const prop of props.props) {
6919
+ const group = groupOf.get(prop.name);
6920
+ if (!group) {
6921
+ loose.push(prop);
6922
+ continue;
6923
+ }
6924
+ const key = group.display === "builder" ? "builder" : group.key;
6925
+ if (placed.has(key)) continue;
6926
+ placed.add(key);
6927
+ flushLoose();
6928
+ if (group.display === "builder") blocks.push(/* @__PURE__ */ jsx(BuilderGroups, {
6929
+ groups: builderGroups,
6930
+ byName,
6931
+ layout: props
6932
+ }, "builder"));
6933
+ else if (group.display === "tabs") blocks.push(/* @__PURE__ */ jsx(TabbedGroup, {
6934
+ group,
6935
+ members: membersOf(group),
6936
+ layout: props
6937
+ }, group.key));
6938
+ else if (group.display === "footer") blocks.push(/* @__PURE__ */ jsxs("div", {
6939
+ className: "flex flex-col gap-4 border-t border-solid border-foreground/10 pt-4",
6940
+ children: [/* @__PURE__ */ jsx(GroupHeading, { group }), /* @__PURE__ */ jsx(FieldList, {
6941
+ members: membersOf(group),
6942
+ layout: props
6943
+ })]
6944
+ }, group.key));
6945
+ else {
6946
+ if (summarised && !placed.has("summary")) {
6947
+ placed.add("summary");
6948
+ blocks.push(/* @__PURE__ */ jsx(Summary, {
6949
+ members: sectionMembers,
6950
+ layout: props
6951
+ }, "summary"));
6952
+ }
6953
+ blocks.push(/* @__PURE__ */ jsx(Section$1, {
6954
+ group,
6955
+ members: membersOf(group),
6956
+ layout: props
6957
+ }, group.key));
6958
+ }
6959
+ }
6960
+ flushLoose();
6961
+ return /* @__PURE__ */ jsx(Fragment$1, { children: blocks });
6668
6962
  }
6669
6963
  //#endregion
6670
6964
  //#region editors/workflow-editor/ui/PropertyForm.tsx
@@ -6690,7 +6984,9 @@ function parseDropdownResult(result) {
6690
6984
  return {
6691
6985
  options: record.options.map((option) => ({
6692
6986
  label: stringifyValue$1(option.label ?? option.value),
6693
- value: option.value
6987
+ value: option.value,
6988
+ ...typeof option.description === "string" && option.description ? { description: option.description } : {},
6989
+ ...typeof option.icon === "string" ? { icon: option.icon } : {}
6694
6990
  })),
6695
6991
  placeholder: record.placeholder,
6696
6992
  disabled: record.disabled
@@ -6741,7 +7037,7 @@ function useResolvedProp(load, parse, key) {
6741
7037
  reload: () => setAttempt((value) => value + 1)
6742
7038
  };
6743
7039
  }
6744
- const PieceMarkdown = lazy(() => import("./PieceMarkdown-C8Gv88TV.js"));
7040
+ const PieceMarkdown = lazy(() => import("./PieceMarkdown-B8EEaQgT.js"));
6745
7041
  const NO_ENDPOINT = "[no endpoint yet — see Endpoint URL above]";
6746
7042
  function fillPiecePlaceholders(text, values) {
6747
7043
  return text.replace(/\{\{\s*webhookUrl\s*\}\}/g, values.webhookUrl ?? NO_ENDPOINT).replace(/\{\{\s*webhookTimeoutSeconds\s*\}\}/g, values.webhookTimeoutSeconds === void 0 ? "{{webhookTimeoutSeconds}}" : String(values.webhookTimeoutSeconds));
@@ -6765,6 +7061,7 @@ function FieldShell(props) {
6765
7061
  htmlFor: props.htmlFor,
6766
7062
  className: "flex min-w-0 items-baseline gap-1.5 text-[13px] font-medium text-foreground",
6767
7063
  children: [
7064
+ optionIcon(prop.icon),
6768
7065
  /* @__PURE__ */ jsx("span", {
6769
7066
  className: "truncate",
6770
7067
  children: prop.displayName
@@ -6814,7 +7111,9 @@ function OptionSelect(props) {
6814
7111
  id: props.id,
6815
7112
  options: props.options.map((option) => ({
6816
7113
  value: keyOf(option.value),
6817
- label: option.label
7114
+ label: option.label,
7115
+ description: option.description,
7116
+ icon: optionIcon(option.icon)
6818
7117
  })),
6819
7118
  value: keyOf(props.value),
6820
7119
  onChange: (key) => props.onChange(key === "" ? void 0 : byKey.get(key)?.value ?? key),
@@ -6824,7 +7123,10 @@ function OptionSelect(props) {
6824
7123
  disabled: props.disabled,
6825
7124
  onRefresh: props.onRefresh,
6826
7125
  clearable: props.clearable,
6827
- emptyText: props.emptyText
7126
+ emptyText: props.emptyText,
7127
+ searchable: props.searchable,
7128
+ actions: props.actions,
7129
+ onQueryChange: props.onQueryChange
6828
7130
  });
6829
7131
  }
6830
7132
  function ArrayRows(props) {
@@ -6939,6 +7241,15 @@ function localInputToIso(value) {
6939
7241
  const date = new Date(value);
6940
7242
  return Number.isNaN(date.getTime()) ? value : date.toISOString();
6941
7243
  }
7244
+ function isDropdownType(type) {
7245
+ return type === "DROPDOWN" || type === "MULTI_SELECT_DROPDOWN";
7246
+ }
7247
+ const SEARCH_DEBOUNCE_MS = 300;
7248
+ const FLIPS_TO_TEXT = /* @__PURE__ */ new Set([
7249
+ "DATE_TIME",
7250
+ "OBJECT",
7251
+ "DROPDOWN"
7252
+ ]);
6942
7253
  const TEXT_MODE_TYPES = /* @__PURE__ */ new Set([
6943
7254
  "SHORT_TEXT",
6944
7255
  "LONG_TEXT",
@@ -6947,7 +7258,8 @@ const TEXT_MODE_TYPES = /* @__PURE__ */ new Set([
6947
7258
  "FILE",
6948
7259
  "JSON",
6949
7260
  "DATE_TIME",
6950
- "OBJECT"
7261
+ "OBJECT",
7262
+ "DROPDOWN"
6951
7263
  ]);
6952
7264
  const SECRET_REF_PREFIX = "secret://v1:";
6953
7265
  function SecretRefField(props) {
@@ -7060,7 +7372,7 @@ function PropField(props) {
7060
7372
  stepId: props.scopeStepId,
7061
7373
  label: prop.displayName,
7062
7374
  insert: (expression) => {
7063
- if ((prop.type === "DATE_TIME" || prop.type === "OBJECT") && !textMode) {
7375
+ if (FLIPS_TO_TEXT.has(prop.type) && !textMode) {
7064
7376
  setTextMode(true);
7065
7377
  setDraft(expression);
7066
7378
  onCommit(expression);
@@ -7079,6 +7391,33 @@ function PropField(props) {
7079
7391
  const dynamicLoad = props.loadOptions && prop.hasDynamicResolver ? () => props.loadOptions(prop.name) : void 0;
7080
7392
  const dropdown = useResolvedProp(prop.type === "DROPDOWN" || prop.type === "MULTI_SELECT_DROPDOWN" ? dynamicLoad : void 0, parseDropdownResult, props.refresherKey);
7081
7393
  const dynamic = useResolvedProp(prop.type === "DYNAMIC" ? dynamicLoad : void 0, parseDescriptorList, props.refresherKey);
7394
+ const [search, setSearch] = useState({
7395
+ query: "",
7396
+ result: null
7397
+ });
7398
+ const searchTimer = useRef(void 0);
7399
+ const [picked, setPicked] = useState(null);
7400
+ const loadOptions = props.loadOptions;
7401
+ const onSearch = prop.refreshOnSearch && loadOptions ? (query) => {
7402
+ clearTimeout(searchTimer.current);
7403
+ if (query.trim() === "") {
7404
+ setSearch({
7405
+ query: "",
7406
+ result: null
7407
+ });
7408
+ return;
7409
+ }
7410
+ setSearch((current) => ({
7411
+ ...current,
7412
+ query
7413
+ }));
7414
+ searchTimer.current = setTimeout(() => {
7415
+ loadOptions(prop.name, query).then((raw) => setSearch((current) => current.query === query ? {
7416
+ query,
7417
+ result: parseDropdownResult(raw)
7418
+ } : current), () => void 0);
7419
+ }, SEARCH_DEBOUNCE_MS);
7420
+ } : void 0;
7082
7421
  const retryButton = (state, reload) => /* @__PURE__ */ jsx(IconButton, {
7083
7422
  icon: "retry",
7084
7423
  label: "Reload",
@@ -7109,36 +7448,17 @@ function PropField(props) {
7109
7448
  invalid,
7110
7449
  secrets: props.secrets
7111
7450
  });
7112
- case "PH_AUTOCOMPLETE": return /* @__PURE__ */ jsx(FieldShell, {
7113
- htmlFor: fieldId,
7114
- prop,
7115
- invalid,
7116
- children: /* @__PURE__ */ jsx(AutocompleteInput, {
7117
- id: fieldId,
7118
- className: `${textInputClass} ${invalid ? invalidClass : ""}`,
7119
- value: typeof value === "string" ? value : stringifyValue$1(value),
7120
- onCommit: (next) => onCommit(next === "" ? void 0 : next),
7121
- loadOptions: props.loadOptions ? () => props.loadOptions(prop.name) : void 0
7122
- })
7123
- });
7124
- case "PH_ACTIONS": return /* @__PURE__ */ jsx(FieldShell, {
7125
- htmlFor: fieldId,
7126
- prop,
7127
- invalid,
7128
- children: /* @__PURE__ */ jsx(ActionListEditor, {
7129
- value,
7130
- onCommit,
7131
- loadActionTypes: props.loadOptions ? () => props.loadOptions("actionType") : void 0
7132
- })
7133
- });
7134
7451
  case "MARKDOWN": {
7135
7452
  const markdown = fillPiecePlaceholders(stringifyValue$1(prop.description ?? prop.defaultValue ?? prop.displayName), { webhookUrl: props.webhookUrl });
7136
- return /* @__PURE__ */ jsx(Suspense, {
7137
- fallback: /* @__PURE__ */ jsx("p", {
7138
- className: "whitespace-pre-wrap rounded-md bg-muted px-3 py-2 text-xs text-muted-foreground",
7139
- children: markdown
7140
- }),
7141
- children: /* @__PURE__ */ jsx(PieceMarkdown, { text: markdown })
7453
+ return /* @__PURE__ */ jsx(MarkdownCallout, {
7454
+ variant: prop.variant,
7455
+ children: /* @__PURE__ */ jsx(Suspense, {
7456
+ fallback: /* @__PURE__ */ jsx("p", {
7457
+ className: "whitespace-pre-wrap text-xs text-muted-foreground",
7458
+ children: markdown
7459
+ }),
7460
+ children: /* @__PURE__ */ jsx(PieceMarkdown, { text: markdown })
7461
+ })
7142
7462
  });
7143
7463
  }
7144
7464
  case "CHECKBOX": return /* @__PURE__ */ jsx(Switch, {
@@ -7147,18 +7467,42 @@ function PropField(props) {
7147
7467
  label: prop.displayName,
7148
7468
  description: prop.description
7149
7469
  });
7150
- case "NUMBER": return /* @__PURE__ */ jsx(FieldShell, {
7151
- htmlFor: fieldId,
7152
- prop,
7153
- invalid,
7154
- picker,
7155
- children: textInput({ commit: (raw) => {
7156
- const trimmed = raw.trim();
7157
- if (trimmed === "") return onCommit(void 0);
7158
- const parsed = Number(trimmed);
7159
- onCommit(Number.isFinite(parsed) ? parsed : trimmed);
7160
- } })
7161
- });
7470
+ case "NUMBER": {
7471
+ const rangeError = numberRangeError(value, prop.min, prop.max);
7472
+ if (prop.display === "stepper") return /* @__PURE__ */ jsx(FieldShell, {
7473
+ htmlFor: fieldId,
7474
+ prop,
7475
+ invalid,
7476
+ picker,
7477
+ error: rangeError,
7478
+ children: /* @__PURE__ */ jsx(NumberStepper, {
7479
+ id: fieldId,
7480
+ value,
7481
+ min: prop.min,
7482
+ max: prop.max,
7483
+ step: prop.step,
7484
+ invalid: invalid || rangeError !== null,
7485
+ onCommit,
7486
+ onFocus: field.focus
7487
+ })
7488
+ });
7489
+ return /* @__PURE__ */ jsx(FieldShell, {
7490
+ htmlFor: fieldId,
7491
+ prop,
7492
+ invalid,
7493
+ picker,
7494
+ error: rangeError,
7495
+ children: textInput({
7496
+ placeholder: prop.placeholder ?? numberRangeText(prop.min, prop.max) ?? void 0,
7497
+ commit: (raw) => {
7498
+ const trimmed = raw.trim();
7499
+ if (trimmed === "") return onCommit(void 0);
7500
+ const parsed = Number(trimmed);
7501
+ onCommit(Number.isFinite(parsed) ? parsed : trimmed);
7502
+ }
7503
+ })
7504
+ });
7505
+ }
7162
7506
  case "SECRET_TEXT": return /* @__PURE__ */ jsx(FieldShell, {
7163
7507
  htmlFor: fieldId,
7164
7508
  prop,
@@ -7215,7 +7559,21 @@ function PropField(props) {
7215
7559
  });
7216
7560
  case "STATIC_DROPDOWN": {
7217
7561
  const options = prop.staticOptions ?? [];
7218
- if (prop.required !== true && prop.defaultValue !== void 0 && options.length >= 2 && options.length <= 3 && options.every((option) => option.label.length <= 22)) return /* @__PURE__ */ jsx(FieldShell, {
7562
+ if (prop.display === "cards") return /* @__PURE__ */ jsx(FieldShell, {
7563
+ htmlFor: fieldId,
7564
+ prop,
7565
+ invalid,
7566
+ children: /* @__PURE__ */ jsx(OptionCards, {
7567
+ id: fieldId,
7568
+ options,
7569
+ value,
7570
+ keyOf: stringifyValue$1,
7571
+ onChange: onCommit,
7572
+ invalid,
7573
+ clearable: !prop.required
7574
+ })
7575
+ });
7576
+ if (!prop.staticDisabled && prop.required !== true && prop.defaultValue !== void 0 && options.length >= 2 && options.length <= 3 && options.every((option) => option.label.length <= 22)) return /* @__PURE__ */ jsx(FieldShell, {
7219
7577
  htmlFor: fieldId,
7220
7578
  prop,
7221
7579
  invalid: false,
@@ -7238,7 +7596,8 @@ function PropField(props) {
7238
7596
  value,
7239
7597
  onChange: onCommit,
7240
7598
  invalid,
7241
- placeholder: prop.placeholder,
7599
+ placeholder: prop.staticPlaceholder ?? prop.placeholder,
7600
+ disabled: prop.staticDisabled && isEmptyValue(value),
7242
7601
  clearable: !prop.required
7243
7602
  })
7244
7603
  });
@@ -7256,26 +7615,59 @@ function PropField(props) {
7256
7615
  })
7257
7616
  });
7258
7617
  case "DROPDOWN": {
7259
- const result = dropdown.state.kind === "ready" ? dropdown.state.result : null;
7260
- const current = stringifyValue$1(value);
7618
+ if (textMode) return /* @__PURE__ */ jsx(FieldShell, {
7619
+ htmlFor: fieldId,
7620
+ prop,
7621
+ invalid,
7622
+ picker: /* @__PURE__ */ jsxs(Fragment$1, { children: [picker, /* @__PURE__ */ jsx("button", {
7623
+ type: "button",
7624
+ className: "inline-flex h-6 shrink-0 items-center rounded-md px-1.5 text-xs font-medium text-muted-foreground hover:bg-accent hover:text-foreground",
7625
+ onClick: () => {
7626
+ setTextMode(false);
7627
+ if (hasExpressions(value)) onCommit(void 0);
7628
+ },
7629
+ children: "Pick from list"
7630
+ })] }),
7631
+ children: textInput({
7632
+ mono: true,
7633
+ placeholder: "{{steps.…}} or an id",
7634
+ commit: (raw) => onCommit(raw.trim() === "" ? void 0 : raw)
7635
+ })
7636
+ });
7637
+ const result = search.result ?? (dropdown.state.kind === "ready" ? dropdown.state.result : null);
7638
+ const listed = result?.options ?? [];
7639
+ const options = picked !== null && stringifyValue$1(picked.value) === stringifyValue$1(value) && !listed.some((option) => stringifyValue$1(option.value) === stringifyValue$1(value)) ? [...listed, picked] : listed;
7261
7640
  return /* @__PURE__ */ jsx(FieldShell, {
7262
7641
  htmlFor: fieldId,
7263
7642
  prop,
7264
7643
  invalid,
7265
7644
  error: loadError(dropdown.state),
7266
- picker: optionsUnavailable ? /* @__PURE__ */ jsx(AvailableSoon, {}) : void 0,
7645
+ picker: optionsUnavailable ? /* @__PURE__ */ jsx(AvailableSoon, {}) : picker,
7267
7646
  children: /* @__PURE__ */ jsx(OptionSelect, {
7268
7647
  id: fieldId,
7269
- options: result?.options ?? [],
7648
+ options,
7270
7649
  value,
7271
- onChange: onCommit,
7650
+ onChange: (next) => {
7651
+ setPicked(listed.find((option) => stringifyValue$1(option.value) === stringifyValue$1(next)) ?? null);
7652
+ onCommit(next);
7653
+ },
7272
7654
  invalid,
7273
7655
  loading: dropdown.state.kind === "loading",
7274
- disabled: result?.disabled && !current || optionsUnavailable,
7656
+ disabled: result?.disabled && !stringifyValue$1(value) || optionsUnavailable,
7275
7657
  onRefresh: dynamicLoad ? dropdown.reload : void 0,
7276
7658
  clearable: !prop.required,
7659
+ searchable: true,
7660
+ onQueryChange: onSearch,
7661
+ actions: [{
7662
+ label: "Use data from an earlier step",
7663
+ icon: "braces",
7664
+ onSelect: () => {
7665
+ setTextMode(true);
7666
+ field.focus();
7667
+ }
7668
+ }],
7277
7669
  emptyText: result?.placeholder ?? "Nothing to choose from yet. Some lists need a connection first.",
7278
- placeholder: optionsUnavailable ? "Options for nested fields are available soon" : result?.placeholder ?? prop.placeholder
7670
+ placeholder: optionsUnavailable ? "Options for nested fields are available soon" : result?.placeholder ?? prop.placeholder ?? "Choose…"
7279
7671
  })
7280
7672
  });
7281
7673
  }
@@ -7337,7 +7729,7 @@ function PropField(props) {
7337
7729
  })
7338
7730
  }) : fields ? /* @__PURE__ */ jsx("p", {
7339
7731
  className: "text-xs text-muted-foreground",
7340
- children: "No properties for the current selection."
7732
+ children: props.waitingOn ? `Pick ${props.waitingOn} first; its fields show here.` : "No properties for the current selection."
7341
7733
  }) : null
7342
7734
  });
7343
7735
  }
@@ -7411,19 +7803,51 @@ function PropField(props) {
7411
7803
  invalid
7412
7804
  })
7413
7805
  });
7806
+ case "DATE_RANGE": return /* @__PURE__ */ jsx(FieldShell, {
7807
+ htmlFor: fieldId,
7808
+ prop,
7809
+ invalid,
7810
+ children: /* @__PURE__ */ jsx(DateRangeField, {
7811
+ id: fieldId,
7812
+ value,
7813
+ dropdown: prop.display === "dropdown",
7814
+ invalid,
7815
+ clearable: !prop.required,
7816
+ onCommit
7817
+ })
7818
+ });
7819
+ case "COLOR": return /* @__PURE__ */ jsx(FieldShell, {
7820
+ htmlFor: fieldId,
7821
+ prop,
7822
+ invalid,
7823
+ picker,
7824
+ children: /* @__PURE__ */ jsx(ColorField, {
7825
+ id: fieldId,
7826
+ value,
7827
+ invalid,
7828
+ onCommit,
7829
+ onFocus: field.focus
7830
+ })
7831
+ });
7832
+ case "RICH_TEXT":
7414
7833
  case "LONG_TEXT":
7834
+ case "CUSTOM":
7415
7835
  case "JSON": {
7416
- const isJson = prop.type === "JSON";
7836
+ const isJson = prop.type === "JSON" || prop.type === "CUSTOM";
7837
+ const mode = prop.type === "RICH_TEXT" ? richTextMode(prop.formatProperty ? props.config?.[prop.formatProperty] : "") : null;
7417
7838
  return /* @__PURE__ */ jsxs(FieldShell, {
7418
7839
  htmlFor: fieldId,
7419
7840
  prop,
7420
7841
  invalid,
7421
- picker,
7842
+ picker: mode ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
7843
+ className: "rounded bg-muted px-1.5 text-[11px] text-muted-foreground",
7844
+ children: mode === "html" ? "HTML" : mode === "markdown" ? "Markdown" : "Plain text"
7845
+ }), picker] }) : picker,
7422
7846
  error: jsonError,
7423
7847
  children: [/* @__PURE__ */ jsx("textarea", {
7424
7848
  id: fieldId,
7425
7849
  ref: fieldRef,
7426
- className: `${textAreaClass} ${isJson ? "font-mono text-xs" : ""} ${invalid ? invalidClass : ""}`,
7850
+ className: `${textAreaClass} ${isJson || mode === "html" ? "font-mono text-xs" : ""} ${mode ? "min-h-32" : ""} ${invalid ? invalidClass : ""}`,
7427
7851
  defaultValue: stringifyValue$1(value),
7428
7852
  placeholder: prop.placeholder,
7429
7853
  spellCheck: false,
@@ -7479,6 +7903,9 @@ function PropertyForm(props) {
7479
7903
  const next = { ...current };
7480
7904
  if (value === void 0) delete next[name];
7481
7905
  else next[name] = value;
7906
+ if (value !== current[name]) {
7907
+ for (const dependent of props.props) if (isDropdownType(dependent.type) && dependent.refreshers?.includes(name)) delete next[dependent.name];
7908
+ }
7482
7909
  setCurrent(next);
7483
7910
  props.onChange(next);
7484
7911
  };
@@ -7491,16 +7918,24 @@ function PropertyForm(props) {
7491
7918
  prop,
7492
7919
  value: current[prop.name] ?? prop.defaultValue,
7493
7920
  onCommit: (value) => commitField(prop.name, value),
7494
- loadOptions: props.loadOptions ? (propName) => props.loadOptions(propName, current) : void 0,
7921
+ loadOptions: props.loadOptions ? (propName, searchValue) => props.loadOptions(propName, current, searchValue) : void 0,
7922
+ config: current,
7495
7923
  secrets: props.secrets,
7496
7924
  scopeStepId: props.scopeStepId,
7497
7925
  refresherKey: refresherKeyFor(prop, current, props.connectionId),
7926
+ waitingOn: props.props.find((sibling) => prop.refreshers?.includes(sibling.name) && isEmptyValue(current[sibling.name]))?.displayName,
7498
7927
  nested: props.nested,
7499
7928
  webhookUrl: props.webhookUrl
7500
7929
  }, prop.name);
7501
7930
  return /* @__PURE__ */ jsxs("div", {
7502
7931
  className: `flex flex-col ${props.nested ? "gap-4" : "gap-5"}`,
7503
- children: [essential.map(field), advanced.length > 0 ? /* @__PURE__ */ jsxs("div", {
7932
+ children: [/* @__PURE__ */ jsx(PropLayout, {
7933
+ props: essential,
7934
+ groups: props.groups,
7935
+ values: current,
7936
+ renderField: field,
7937
+ onCommit: commitField
7938
+ }), advanced.length > 0 ? /* @__PURE__ */ jsxs("div", {
7504
7939
  className: "flex flex-col gap-5 border-t border-solid border-foreground/10 pt-4",
7505
7940
  children: [/* @__PURE__ */ jsxs("button", {
7506
7941
  type: "button",
@@ -7521,7 +7956,13 @@ function PropertyForm(props) {
7521
7956
  }), /* @__PURE__ */ jsx("div", {
7522
7957
  hidden: !showAdvanced,
7523
7958
  className: "flex flex-col gap-5",
7524
- children: advanced.map(field)
7959
+ children: /* @__PURE__ */ jsx(PropLayout, {
7960
+ props: advanced,
7961
+ groups: props.groups,
7962
+ values: current,
7963
+ renderField: field,
7964
+ onCommit: commitField
7965
+ })
7525
7966
  })]
7526
7967
  }) : null]
7527
7968
  });
@@ -7897,19 +8338,33 @@ function ConfigSection(props) {
7897
8338
  return /* @__PURE__ */ jsxs("div", {
7898
8339
  className: "flex flex-col gap-5",
7899
8340
  children: [
8341
+ form?.description || form?.classification === "DESTRUCTIVE" ? /* @__PURE__ */ jsxs("div", {
8342
+ className: "flex flex-col gap-2",
8343
+ children: [form.classification === "DESTRUCTIVE" ? /* @__PURE__ */ jsxs("span", {
8344
+ className: "inline-flex items-center gap-1 self-start rounded-full bg-wf-fail/10 px-2 py-0.5 text-[11px] font-medium text-wf-fail",
8345
+ children: [/* @__PURE__ */ jsx(Icon, {
8346
+ name: "alert",
8347
+ className: "h-3 w-3"
8348
+ }), "Changes or deletes data"]
8349
+ }) : null, form.description ? /* @__PURE__ */ jsx("p", {
8350
+ className: "text-[13px] leading-relaxed text-muted-foreground",
8351
+ children: form.description
8352
+ }) : null]
8353
+ }) : null,
7900
8354
  props.formError ? /* @__PURE__ */ jsx("p", {
7901
8355
  className: "rounded-md bg-wf-fail/10 px-3 py-2 text-xs text-wf-fail",
7902
8356
  children: props.formError
7903
8357
  }) : null,
7904
8358
  form && form.props.length > 0 ? /* @__PURE__ */ jsx(PropertyForm, {
7905
8359
  props: form.props,
8360
+ groups: form.propertyGroups,
7906
8361
  value: configRecord,
7907
8362
  onChange: props.onChange,
7908
8363
  scopeStepId: props.scopeStepId,
7909
8364
  connectionId: props.connectionId,
7910
8365
  secrets: props.designTime?.secrets,
7911
8366
  webhookUrl: props.webhookUrl,
7912
- loadOptions: props.designTime ? (propName, current) => props.designTime.loadOptions(props.blockType, propName, current, props.connectionId) : void 0
8367
+ loadOptions: props.designTime ? (propName, current, searchValue) => props.designTime.loadOptions(props.blockType, propName, current, props.connectionId, searchValue) : void 0
7913
8368
  }) : null,
7914
8369
  form && form.props.length === 0 ? /* @__PURE__ */ jsx("p", {
7915
8370
  className: "text-[13px] text-muted-foreground",
@@ -8387,7 +8842,9 @@ function StepSettings(props) {
8387
8842
  });
8388
8843
  }
8389
8844
  }),
8845
+ props.errorHandling?.retryOnFailure?.defaultValue ? /* @__PURE__ */ jsx(Hint, { children: "This piece suggests retrying the step when it fails." }) : null,
8390
8846
  /* @__PURE__ */ jsxs("fieldset", {
8847
+ hidden: props.errorHandling?.retryOnFailure?.hide === true,
8391
8848
  disabled: true,
8392
8849
  className: "m-0 flex min-w-0 flex-col gap-4 rounded-lg border border-dashed border-foreground/15 p-3",
8393
8850
  children: [/* @__PURE__ */ jsx("legend", {
@@ -8640,6 +9097,7 @@ function StepPanel(props) {
8640
9097
  step,
8641
9098
  model: props.model,
8642
9099
  callbacks,
9100
+ errorHandling: form && form !== "loading" ? form.errorHandling : void 0,
8643
9101
  onRemoved: props.onClose
8644
9102
  })
8645
9103
  })]
@@ -19759,127 +20217,6 @@ function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle
19759
20217
  }
19760
20218
  memo(ResizeControl);
19761
20219
  //#endregion
19762
- //#region editors/workflow-editor/ui/blocks.ts
19763
- const TRIGGER_PRESETS = [
19764
- {
19765
- label: "Manual",
19766
- blockType: "core#manual",
19767
- group: "core",
19768
- description: "Fired on demand with a payload.",
19769
- defaultConfig: {}
19770
- },
19771
- {
19772
- label: "Schedule",
19773
- blockType: "core#schedule",
19774
- group: "core",
19775
- description: "Fires on a cron expression or fixed interval.",
19776
- defaultConfig: {
19777
- mode: "cron",
19778
- cron: "0 9 * * 1-5",
19779
- timezone: "UTC"
19780
- }
19781
- },
19782
- {
19783
- label: "Webhook",
19784
- blockType: "core#webhook",
19785
- group: "core",
19786
- description: "Fires when a provider POSTs to this workflow's URL.",
19787
- defaultConfig: {
19788
- methods: "POST",
19789
- scheme: "none",
19790
- responseMode: "async"
19791
- }
19792
- },
19793
- {
19794
- label: "Document event",
19795
- blockType: `${REACTOR_PIECE}#trigger:document-event`,
19796
- group: "powerhouse",
19797
- description: "Fires when a matching document operation lands.",
19798
- defaultConfig: {}
19799
- },
19800
- {
19801
- label: "Document created",
19802
- blockType: `${REACTOR_PIECE}#trigger:document-created`,
19803
- group: "powerhouse",
19804
- description: "Fires when a document is added to a drive.",
19805
- defaultConfig: {}
19806
- },
19807
- {
19808
- label: "Document deleted",
19809
- blockType: `${REACTOR_PIECE}#trigger:document-deleted`,
19810
- group: "powerhouse",
19811
- description: "Fires when a document is removed from a drive.",
19812
- defaultConfig: {}
19813
- }
19814
- ];
19815
- const STEP_PRESETS = [
19816
- {
19817
- label: "Branch",
19818
- blockType: "core#branch",
19819
- group: "core",
19820
- description: "Routes true/false on a condition.",
19821
- defaultConfig: { condition: "{{trigger.payload.ok}}" }
19822
- },
19823
- {
19824
- label: "Assert",
19825
- blockType: "core#assert",
19826
- group: "core",
19827
- description: "Fails the run when a value is blank, rejected or not allowed.",
19828
- defaultConfig: {
19829
- value: "",
19830
- allowValues: []
19831
- }
19832
- },
19833
- {
19834
- label: "Create document",
19835
- blockType: `${REACTOR_PIECE}#document-create`,
19836
- group: "powerhouse",
19837
- description: "Creates a Powerhouse document.",
19838
- defaultConfig: {
19839
- documentType: "",
19840
- name: ""
19841
- }
19842
- },
19843
- {
19844
- label: "Dispatch actions",
19845
- blockType: `${REACTOR_PIECE}#document-dispatch`,
19846
- group: "powerhouse",
19847
- description: "Sends actions to a document.",
19848
- defaultConfig: {
19849
- documentId: "",
19850
- actions: []
19851
- }
19852
- },
19853
- {
19854
- label: "Get document",
19855
- blockType: `${REACTOR_PIECE}#document-get`,
19856
- group: "powerhouse",
19857
- description: "Reads a document's current state.",
19858
- defaultConfig: { documentId: "" }
19859
- },
19860
- {
19861
- label: "Find documents",
19862
- blockType: `${REACTOR_PIECE}#document-find`,
19863
- group: "powerhouse",
19864
- description: "Lists documents by type and name.",
19865
- defaultConfig: { documentType: "" }
19866
- },
19867
- {
19868
- label: "List document types",
19869
- blockType: `${REACTOR_PIECE}#document-types`,
19870
- group: "powerhouse",
19871
- description: "Document models installed on this reactor.",
19872
- defaultConfig: {}
19873
- },
19874
- {
19875
- label: "Get document schema",
19876
- blockType: `${REACTOR_PIECE}#document-schema`,
19877
- group: "powerhouse",
19878
- description: "Action and state schemas of a document type.",
19879
- defaultConfig: { documentType: "" }
19880
- }
19881
- ];
19882
- //#endregion
19883
20220
  //#region editors/workflow-editor/ui/step-drag.ts
19884
20221
  function moveRejection(model, move) {
19885
20222
  if (move.stepId === move.toParentId) return "self";
@@ -20725,4 +21062,4 @@ function Editor() {
20725
21062
  //#endregion
20726
21063
  export { Editor as default };
20727
21064
 
20728
- //# sourceMappingURL=editor-YZw296bf.js.map
21065
+ //# sourceMappingURL=editor-B6N0PCuZ.js.map