@fluidgrids/fe-sdk 0.0.0-stage → 2026.1203.8

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 (323) hide show
  1. package/README.md +564 -2
  2. package/dist/ActivityOptionsFields-C2u-hY2U.js +142 -0
  3. package/dist/AiStudioPage-B_hNTj-_.js +1137 -0
  4. package/dist/ApprovalInboxPage-ClITra3n.js +1312 -0
  5. package/dist/ChoiceSelect-LkK-uS9J.js +65 -0
  6. package/dist/ConfirmActionDialog-DHWTDRbp.js +31 -0
  7. package/dist/ConnectionFormDialog-C0kDgcrZ.js +153 -0
  8. package/dist/CreateFluidgridsTagDocument-Dtp9KPLJ.js +1055 -0
  9. package/dist/DataSinkDashboardPage-b4ezeqa6.js +278 -0
  10. package/dist/DataTablesPage-C1d9YGHz.js +5575 -0
  11. package/dist/DateTimeField-B1qR4ruo.js +51 -0
  12. package/dist/Disclosure-BNKij7-v.js +45 -0
  13. package/dist/ElementLibraryPage-8jNO6YmE.js +2256 -0
  14. package/dist/ElementLibrarySequenceDocument-B-W8SPzn.js +3979 -0
  15. package/dist/EnsureThemeProvider-BvlNjAd0.js +24 -0
  16. package/dist/EntityTagBadge-1OlP6p0c.js +25 -0
  17. package/dist/EntityTagPicker-BBrU5cE0.js +137 -0
  18. package/dist/ExecuteStepDocument-B4j1mdRT.js +189 -0
  19. package/dist/ExecutionDetailDocument-D6QuM-kp.js +875 -0
  20. package/dist/ExecutionDetailPage-D4CBtFdo.js +12217 -0
  21. package/dist/ExecutionDetailPage-DvQ667OE.d.ts +10 -0
  22. package/dist/ExecutionStatusBadge-BsDVor9t.js +221 -0
  23. package/dist/ExecutionsListDocument-Dan7ZiqB.js +459 -0
  24. package/dist/ExecutionsListPage-B3XT8ITL.js +4307 -0
  25. package/dist/FailureTriagePanel-DOJMaJ0n.js +1285 -0
  26. package/dist/FileDownloadUrlDocument-CVOYKcL5.js +92 -0
  27. package/dist/FluidGridsDocsLink-bX0Hnhxr.js +66 -0
  28. package/dist/FluidGridsMark-CE2blT7K.js +74 -0
  29. package/dist/HeldLoadRegion-BtTxbvOW.js +34 -0
  30. package/dist/HistoryPage-BLoRpJ1R.d.ts +6 -0
  31. package/dist/HistoryPage-BSBISXoj.js +2835 -0
  32. package/dist/Icon-BtQ0HXLh.js +160 -0
  33. package/dist/InsightsPage-D7ybj8N9.js +11245 -0
  34. package/dist/IsolationSetting-vy911E8b.js +1153 -0
  35. package/dist/LibraryParts-DOeNgR8A.js +413 -0
  36. package/dist/ManagedAiPolicyAuthority-BxwJ3ptd.js +40 -0
  37. package/dist/ManagedAiPolicyAuthority-DM3t3wNr.d.ts +18 -0
  38. package/dist/ManagedAiPolicyAuthorityContext-CNkxIOZ1.js +10 -0
  39. package/dist/McpTriggerServers-BCPCAOWB.js +459 -0
  40. package/dist/MissingNodesInstallModal-rO_SEDrC.js +224 -0
  41. package/dist/NavigationV2Provider-DCDt35eG.js +17 -0
  42. package/dist/NodeSchemaIntrospectionDocument-C1vAIcHd.js +95 -0
  43. package/dist/NodesPage-DEbnz9iU.d.ts +6 -0
  44. package/dist/NodesPage-O7KeeKtd.js +653 -0
  45. package/dist/OfflineIcon-TwMKYWjA.js +207 -0
  46. package/dist/OpenTemplateAsCodeButton-BhWJWIF3.js +94 -0
  47. package/dist/PaidTemplateConfirm-_G3ag6S4.js +28 -0
  48. package/dist/PublishCustomNodeAction-CIySbK4c.js +134 -0
  49. package/dist/RecordTaskDialog-BkpCDvhR.js +2078 -0
  50. package/dist/RunActionsMenu-DodOgIQm.js +59 -0
  51. package/dist/RunnerStatusPill-C1v967iq.js +24 -0
  52. package/dist/RunnersPage-dB0RSdY_.js +1929 -0
  53. package/dist/SandboxRuntimeExhaustedNotice-BFOIF93C.js +120 -0
  54. package/dist/SchedulesPage-DPWr1yvf.js +1607 -0
  55. package/dist/SearchBox-BGtYjvfs.js +49 -0
  56. package/dist/SequenceEditor-CFiHeHkR.js +497 -0
  57. package/dist/SettingsPage-0CQBNPZV.js +8695 -0
  58. package/dist/StewardPages-DAJhepen.js +47 -0
  59. package/dist/StewardRunImportPanel-Kva2DO0u.js +2844 -0
  60. package/dist/StoreTemplateCardCompact-CHn5kP7A.js +2166 -0
  61. package/dist/TagFilterSelect-CyA8QrS7.js +42 -0
  62. package/dist/TaskQueuesPage-DdnDCyat.js +3571 -0
  63. package/dist/TechnicalDetails-B0Oi4aZw.js +19 -0
  64. package/dist/TemplateConfigurationModal-CdvCYJLM.js +332 -0
  65. package/dist/TemplateDetailPanel-CbiKciuB.js +222 -0
  66. package/dist/TemplatePreview-cx7-NOeG.js +868 -0
  67. package/dist/TemplatesPage-BG3H-6v6.d.ts +10 -0
  68. package/dist/TemplatesPage-BVQpGYIV.js +3251 -0
  69. package/dist/TerminateExecutionDocument-B_HKNVrN.js +581 -0
  70. package/dist/TranslationBridge-Bd4aJKMs.d.ts +11 -0
  71. package/dist/TranslationBridge-Da-TPgQm.js +68 -0
  72. package/dist/TriggerWorkflowDocument-D9Km2Vv2.js +460 -0
  73. package/dist/UiSequencePickerSequenceDocument-BSYnSDV7.js +607 -0
  74. package/dist/UiStepScreenshot-Qh4QMyUp.js +146 -0
  75. package/dist/UsageTimeSeriesDocument-DcInx9-z.js +177 -0
  76. package/dist/VariablesPage-ChfGuW22.js +2243 -0
  77. package/dist/VersionDiffDialog-Bd2AeUwf.js +1702 -0
  78. package/dist/VersionLifecycleBar-BBeWVtz-.js +143 -0
  79. package/dist/WebhookDeliveriesPage-D66bua0j.js +1563 -0
  80. package/dist/WorkflowBuilder-B6wQD1TK.js +539 -0
  81. package/dist/WorkflowBuilder-DR4ku8Tr.js +1611 -0
  82. package/dist/WorkflowDefinitionDocument-DZLbTPUZ.js +321 -0
  83. package/dist/WorkflowEmbed-BXfFGy0i.js +708 -0
  84. package/dist/WorkflowEmbed-Cbqe1s1z.d.ts +6 -0
  85. package/dist/WorkflowPinnedDataDocument-BODT5omd.js +782 -0
  86. package/dist/WorkflowProposalCard-BruukdeF.js +96 -0
  87. package/dist/WorkflowProposalDocument-BdUbsrd0.js +620 -0
  88. package/dist/WorkflowSearchRedirect-C7zJ2MKH.js +40 -0
  89. package/dist/WorkflowSettingsDrawer-MVU1BKfY.d.ts +18 -0
  90. package/dist/WorkflowSettingsDrawer-gazs97WR.js +196 -0
  91. package/dist/WorkflowShareDialog-e8jJtLjU.js +469 -0
  92. package/dist/WorkflowVersionsDocument-DRVOp8Uj.js +3213 -0
  93. package/dist/WorkflowsList--hR2_8gf.js +4593 -0
  94. package/dist/WorkflowsList-CcNDQge5.d.ts +6 -0
  95. package/dist/WorkflowsListPageDocument-CnzcQm_o.js +934 -0
  96. package/dist/addonCatalog-CbZS4deh.js +58 -0
  97. package/dist/addonCatalog-sjlonAmR.d.ts +15 -0
  98. package/dist/addons.d.ts +3 -0
  99. package/dist/addons.js +4 -0
  100. package/dist/agent-form-Bfvm32j1.js +83 -0
  101. package/dist/agent-tools.d.ts +3 -0
  102. package/dist/agent-tools.js +5 -0
  103. package/dist/agentTools-CyL7DLOF.js +320 -0
  104. package/dist/ai-usage-BrxDgvdR.js +240 -0
  105. package/dist/aiCreditsBridge-BuE92tKo.js +49 -0
  106. package/dist/api-BKq-nIOZ.js +2286 -0
  107. package/dist/api-Ol7I8NxE.js +8289 -0
  108. package/dist/apollo-type-policies.d.ts +11 -0
  109. package/dist/apollo-type-policies.js +64 -0
  110. package/dist/askAboutBridge-ByYsQams.js +106 -0
  111. package/dist/askQuestions-Cmx7VnMm.js +742 -0
  112. package/dist/assert-rules-lfYEMc99.js +318 -0
  113. package/dist/assistant.d.ts +94 -0
  114. package/dist/assistant.js +99 -0
  115. package/dist/attach-node-helpers-HDKQOtrD.js +32 -0
  116. package/dist/badge-CXfPhoMH.js +26 -0
  117. package/dist/basil.generated-BK-EHbwN.js +10 -0
  118. package/dist/browser-steps-DMpS5TyB.js +533 -0
  119. package/dist/builderTimings-pvGnK1m-.js +510 -0
  120. package/dist/button-DG7y_FVJ.js +48 -0
  121. package/dist/canvasNoteTools-BxuP_AYO.js +137 -0
  122. package/dist/card-Bomy_1UG.js +44 -0
  123. package/dist/catalogGrid-BOrfMgi-.js +41 -0
  124. package/dist/channel-CPyQ1NR1.js +212 -0
  125. package/dist/chips-CvNrYJZa.js +27 -0
  126. package/dist/client-holder-C0M5Cfwl.js +68 -0
  127. package/dist/cn-QqidFIgr.js +10 -0
  128. package/dist/code-editor-diagnostics-Zr0cIcx1.js +46 -0
  129. package/dist/code-editor-field-x_JrY8KR.js +113 -0
  130. package/dist/codec-client-DPuD6mw7.js +515 -0
  131. package/dist/conditionBuilder-DwfEF0Q-.js +1144 -0
  132. package/dist/config-DO68jw5k.js +322 -0
  133. package/dist/constants-DgbVc24O.d.ts +296 -0
  134. package/dist/constants-DlRnHBfQ.js +217 -0
  135. package/dist/convert-browser-action-pfecelF7.js +347 -0
  136. package/dist/convert-dialog-B_o22NiJ.js +382 -0
  137. package/dist/create-workflow-first-Azg3JUdX.js +120 -0
  138. package/dist/definition-canvas-Bsda-rDT.js +31 -0
  139. package/dist/dialog-BVd152GS.js +94 -0
  140. package/dist/durable-nodes-BXyYCLxT.js +91 -0
  141. package/dist/duration-CDb7-mT_.js +33 -0
  142. package/dist/edge-mapper-wEAdGVU2.js +4477 -0
  143. package/dist/element-library-DkSlg_VE.js +727 -0
  144. package/dist/entities-I_0kio3q.js +38 -0
  145. package/dist/error-advice-QLr5NCm7.js +65 -0
  146. package/dist/errors-ClKb5sEt.js +188 -0
  147. package/dist/executions.d.ts +3 -0
  148. package/dist/executions.js +5 -0
  149. package/dist/feature-flags-B2qetXKd.js +385 -0
  150. package/dist/field-label-DPZRmE_B.js +153 -0
  151. package/dist/firstWorkflow-C_h0KMB2.js +133 -0
  152. package/dist/flags.d.ts +3 -0
  153. package/dist/flags.js +4 -0
  154. package/dist/flow-builder-DIvLOhz0.js +28038 -0
  155. package/dist/flow-store-holder-CUN7Terz.js +52 -0
  156. package/dist/fluent.generated-CA_e6-4l.js +14 -0
  157. package/dist/fluidgridsEvents-bbEQbwU6.js +175 -0
  158. package/dist/fluidgridsTheme-DUhvOgoy.js +297 -0
  159. package/dist/global-client-BQPuFrFa.js +433 -0
  160. package/dist/global-operations-BG6YgxrM.js +136 -0
  161. package/dist/graphql-types-UTYtujY9.js +21358 -0
  162. package/dist/history.d.ts +3 -0
  163. package/dist/history.js +4 -0
  164. package/dist/index-AoJAa5vU.d.ts +164958 -0
  165. package/dist/index-DEMT3iAM.d.ts +120 -0
  166. package/dist/index-ROZzNGyY.d.ts +76 -0
  167. package/dist/index.d.ts +20 -0
  168. package/dist/index.js +8123 -0
  169. package/dist/ion.generated-mbajjcAg.js +10 -0
  170. package/dist/label-Lzb8ZXf_.js +29 -0
  171. package/dist/labels-rXd9gYQz.js +1236 -0
  172. package/dist/liveCanvas-D5ytXDp8.js +103 -0
  173. package/dist/logos.generated-X6_0kjVR.js +21 -0
  174. package/dist/logs-panel-Cw0DkG0l.js +468 -0
  175. package/dist/lucide.generated-B6NVd3GT.js +29 -0
  176. package/dist/marksStore-a9oIMMot.js +175 -0
  177. package/dist/mcp-trigger-D0nRdvq5.js +307 -0
  178. package/dist/mdi.generated-D1BV74d6.js +292 -0
  179. package/dist/menus-CU3hDGYl.js +160 -0
  180. package/dist/mynaui.generated-DMWr5cXz.js +66 -0
  181. package/dist/navigation-v2.d.ts +3 -0
  182. package/dist/navigation-v2.js +5 -0
  183. package/dist/node-detail-view-Cgm5H1P-.js +1372 -0
  184. package/dist/node-editor-tab-body-CZ0fVuVP.js +187 -0
  185. package/dist/node-operation-selection-CdV3KI_V.js +3534 -0
  186. package/dist/node-registry-refresh-s3okf83X.js +27 -0
  187. package/dist/node-role-TMbnkmeP.js +132 -0
  188. package/dist/node-type-icon-BZa8n4iG.js +33 -0
  189. package/dist/nodes.d.ts +3 -0
  190. package/dist/nodes.js +4 -0
  191. package/dist/notesKey-5EaREBGA.js +12 -0
  192. package/dist/observability.d.ts +3 -0
  193. package/dist/observability.js +5 -0
  194. package/dist/offset-pages-zghoClB3.js +55 -0
  195. package/dist/operations-BBmT9ToP.js +663 -0
  196. package/dist/operations-WxRJWeqO.js +3133 -0
  197. package/dist/output-files-Ba8bu5lv.js +196 -0
  198. package/dist/page-operation-DrWuhd6Y.js +129 -0
  199. package/dist/page-twins.d.ts +13 -0
  200. package/dist/page-twins.js +186 -0
  201. package/dist/pageControlSpecs-DZJ9K37m.js +134 -0
  202. package/dist/pageControlsBridge-0pX9s-3k.js +54 -0
  203. package/dist/pageControlsBridge-DAuT3w7L.d.ts +36 -0
  204. package/dist/panels-PfBBAToE.js +346 -0
  205. package/dist/parts-B7fBcw-B.js +346 -0
  206. package/dist/popover-Dms9Vz3j.js +3389 -0
  207. package/dist/preloadable-lazy-Pp47mqQ9.js +65 -0
  208. package/dist/proactive.d.ts +66 -0
  209. package/dist/proactive.js +237 -0
  210. package/dist/quick-config-panel-DFd77xho.js +451 -0
  211. package/dist/quota-DeA_CJ2e.js +175 -0
  212. package/dist/quota.d.ts +3 -0
  213. package/dist/quota.js +4 -0
  214. package/dist/read-only-context-Dt9N9SIG.js +18 -0
  215. package/dist/relative-time-Dxt8ZIIu.js +55 -0
  216. package/dist/results-CwK_yDxK.js +325 -0
  217. package/dist/rolldown-runtime-hDbaFkMy.js +18 -0
  218. package/dist/route-data.d.ts +12 -0
  219. package/dist/route-data.js +69 -0
  220. package/dist/route-match-C-0_EnAt.d.ts +5 -0
  221. package/dist/route-match-DMkUICYV.js +41 -0
  222. package/dist/route-preload-C4DlGoCd.js +120 -0
  223. package/dist/run-display-UjLAoYqQ.js +81 -0
  224. package/dist/run-history-arGiHzGU.js +285 -0
  225. package/dist/run-list-links-DJn4Mf1T.js +98 -0
  226. package/dist/run-mode-USmM0-Uo.js +82 -0
  227. package/dist/run-parity-CWXqEJqM.js +144 -0
  228. package/dist/runsQuota-B6SyTbne.js +100 -0
  229. package/dist/runsQuota-DsniKiSg.d.ts +20 -0
  230. package/dist/safe-expression-Cw7-SCsm.js +1251 -0
  231. package/dist/save-status-store-C7nEYpfb.js +631 -0
  232. package/dist/schedule-panel-B4GYXzXQ.js +13774 -0
  233. package/dist/schedule-rules-ggVKRkBH.js +358 -0
  234. package/dist/secrets-Re_wSiE3.js +153 -0
  235. package/dist/settings.d.ts +4 -0
  236. package/dist/settings.js +6 -0
  237. package/dist/shared-DAWGGMSM.js +177 -0
  238. package/dist/sidebar-node-editor-6eSSgCzc.js +178 -0
  239. package/dist/solar.generated-CGYuUQAC.js +10 -0
  240. package/dist/stableTabbedDialog-BBhrfXGe.js +20 -0
  241. package/dist/start-url-CT6Yz96K.js +24 -0
  242. package/dist/status-CessxGpm.js +55 -0
  243. package/dist/store-icon-OctYp5zP.js +155 -0
  244. package/dist/styles-WGmTnZ2n.js +26 -0
  245. package/dist/styles.css +139 -0
  246. package/dist/svg-spinners.generated-CIPT7IhM.js +10 -0
  247. package/dist/template-code-CzN6JWNV.js +191 -0
  248. package/dist/template-graph-DLF9dygU.js +20 -0
  249. package/dist/template-preview-DcIIKOOL.js +32 -0
  250. package/dist/template-price-CdUHZRMF.js +40 -0
  251. package/dist/templates.d.ts +3 -0
  252. package/dist/templates.js +5 -0
  253. package/dist/theme-provider-CntfC4_i.js +23 -0
  254. package/dist/transient-DgZfhDfN.js +57 -0
  255. package/dist/typed-calls-C5tO03wq.js +26 -0
  256. package/dist/ui-script-By74Guk3.js +1094 -0
  257. package/dist/ui-script-editor-CqPu2bCN.js +2447 -0
  258. package/dist/ui-step-fix-8uM2_Hft.js +67 -0
  259. package/dist/ui-step-fix-store-CcO1FdRx.js +19 -0
  260. package/dist/ui-step-run-context-o7bLE6KP.js +46 -0
  261. package/dist/ui-target-editor-D2JhB_lD.js +673 -0
  262. package/dist/uiMarkTools-CSznnO1i.js +1054 -0
  263. package/dist/upgradePrompt-BAFBKKW5.js +72 -0
  264. package/dist/use-bare-node-registry-O6mKJO_n.js +11498 -0
  265. package/dist/use-browser-available-hj8wc3Kb.js +241 -0
  266. package/dist/use-edge-mapper-schemas-Bonofxow.js +496 -0
  267. package/dist/use-extension-bridge-B9ZreOkQ.js +608 -0
  268. package/dist/use-mobile-BTqCUjzS.js +27 -0
  269. package/dist/use-sdk-query-C697xZVv.js +116 -0
  270. package/dist/use-workflow-code-editor-CFoRFrZ5.js +753 -0
  271. package/dist/useActionParam-B2tU2BlY.js +85 -0
  272. package/dist/useAgentTokenStream-Bko_J0d0.js +4217 -0
  273. package/dist/useBrowserClients-3v95-gSh.js +103 -0
  274. package/dist/useCodeWorkflowInsights-w0tz9Ap_.js +600 -0
  275. package/dist/useConnections-DsgEJs05.js +439 -0
  276. package/dist/useDebouncedValue-BFekcv6n.js +18 -0
  277. package/dist/useDurableParity-8fnMZmBc.js +1787 -0
  278. package/dist/useEntityTags-D0spL6Ut.js +460 -0
  279. package/dist/useExecutions-2u5nGJJk.js +681 -0
  280. package/dist/useFluidGridsAnalytics-VM8lAi2x.js +238 -0
  281. package/dist/useGlobalStoreClient-BTdhkA2I.js +24 -0
  282. package/dist/useHumanRequests-zlYDp3l1.js +221 -0
  283. package/dist/useNavigationV2-C2WeqN7d.js +29 -0
  284. package/dist/useNavigationV2-DANUmg12.d.ts +9 -0
  285. package/dist/useObservability-BRlQ0tOA.js +285 -0
  286. package/dist/useRequestedProposal-B7uPXfZB.js +51 -0
  287. package/dist/useRunHistory-CXCMUPyf.js +2759 -0
  288. package/dist/useRunLive-D0JvVZT2.js +1060 -0
  289. package/dist/useRunnerList-Dbi59i1K.js +446 -0
  290. package/dist/useRunners-URUc5quU.js +173 -0
  291. package/dist/useRunsPage-DG656UCK.js +2709 -0
  292. package/dist/useVariables-BIelxcWr.js +463 -0
  293. package/dist/useVersionHistoryData-CTjqVw7l.js +292 -0
  294. package/dist/useWorkflowCodeExport-pqxyLHD1.js +522 -0
  295. package/dist/useWorkflowListExport-hcZNvTaB.js +232 -0
  296. package/dist/useWorkflowOrganization-CpBbOrs7.js +1772 -0
  297. package/dist/useWorkflowProposal-BH0VdNMA.js +3280 -0
  298. package/dist/useWorkflows-Cvg-Z_IE.js +1606 -0
  299. package/dist/utils-fvBb5qOD.js +89 -0
  300. package/dist/webhook-deliveries-AvQujaZy.js +99 -0
  301. package/dist/workflow-builder-CJygVkVv.d.ts +2 -0
  302. package/dist/workflow-builder.d.ts +3 -0
  303. package/dist/workflow-builder.js +8 -0
  304. package/dist/workflow-code-transfer-Bsy0JKAZ.js +323 -0
  305. package/dist/workflow-embed.d.ts +3 -0
  306. package/dist/workflow-embed.js +4 -0
  307. package/dist/workflow-git-sync--K9ZsPDC.js +263 -0
  308. package/dist/workflow-host.d.ts +6 -0
  309. package/dist/workflow-host.js +11 -0
  310. package/dist/workflow-pages-D-7ByLTB.d.ts +68 -0
  311. package/dist/workflow-pages.d.ts +3 -0
  312. package/dist/workflow-pages.js +115 -0
  313. package/dist/workflow-preview-canvas-CO8yzdE3.js +848 -0
  314. package/dist/workflow-preview.d.ts +65 -0
  315. package/dist/workflow-preview.js +4 -0
  316. package/dist/workflow-route.d.ts +33 -0
  317. package/dist/workflow-route.js +4 -0
  318. package/dist/workflow-save-state-D0l-DkLf.js +767 -0
  319. package/dist/workflow-transfer-CQnQC-ke.js +104 -0
  320. package/dist/workflowRouteData-BkfVOc-O.js +169 -0
  321. package/dist/workflows-list.d.ts +10 -0
  322. package/dist/workflows-list.js +5 -0
  323. package/package.json +320 -4
@@ -0,0 +1,1144 @@
1
+ "use client";
2
+ import { r as useTr } from "./TranslationBridge-Da-TPgQm.js";
3
+ import { n as useEdgeMapperView, r as hasMapperFields } from "./use-edge-mapper-schemas-Bonofxow.js";
4
+ import { useCallback, useEffect, useMemo, useState } from "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { useReactFlow } from "@xyflow/react";
7
+ import { AlertCircle, ChevronDown, ChevronRight, Copy, Info, Layers, Plus, Trash2 } from "lucide-react";
8
+ import { toast } from "sonner";
9
+ import { Badge, Button, Card, CardContent, CardDescription, CardHeader, CardTitle, EmptyState, Input, Label, ScrollArea, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Tabs, TabsContent, TabsList, TabsTrigger, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@burdenoff/fe-libs/ui";
10
+
11
+ // src/builder/components/flow-builder/components/edges/conditionBuilder/custom-condition-edge.tsx
12
+ const OPERATORS = {
13
+ string: [
14
+ {
15
+ value: "==",
16
+ label: "Equals"
17
+ },
18
+ {
19
+ value: "contains",
20
+ label: "Contains"
21
+ },
22
+ {
23
+ value: "startsWith",
24
+ label: "Starts with"
25
+ },
26
+ {
27
+ value: "endsWith",
28
+ label: "Ends with"
29
+ },
30
+ {
31
+ value: "isNull",
32
+ label: "Is Null"
33
+ },
34
+ {
35
+ value: "isNotNull",
36
+ label: "Is Not Null"
37
+ }
38
+ ],
39
+ number: [
40
+ {
41
+ value: "==",
42
+ label: "Equals"
43
+ },
44
+ {
45
+ value: "!=",
46
+ label: "Not equals"
47
+ },
48
+ {
49
+ value: ">",
50
+ label: "Greater than"
51
+ },
52
+ {
53
+ value: ">=",
54
+ label: "Greater than or equal"
55
+ },
56
+ {
57
+ value: "<",
58
+ label: "Less than"
59
+ },
60
+ {
61
+ value: "<=",
62
+ label: "Less than or equal"
63
+ },
64
+ {
65
+ value: "isNull",
66
+ label: "Is Null"
67
+ },
68
+ {
69
+ value: "isNotNull",
70
+ label: "Is Not Null"
71
+ }
72
+ ],
73
+ integer: [
74
+ {
75
+ value: "==",
76
+ label: "Equals"
77
+ },
78
+ {
79
+ value: "!=",
80
+ label: "Not equals"
81
+ },
82
+ {
83
+ value: ">",
84
+ label: "Greater than"
85
+ },
86
+ {
87
+ value: ">=",
88
+ label: "Greater than or equal"
89
+ },
90
+ {
91
+ value: "<",
92
+ label: "Less than"
93
+ },
94
+ {
95
+ value: "<=",
96
+ label: "Less than or equal"
97
+ },
98
+ {
99
+ value: "isNull",
100
+ label: "Is Null"
101
+ },
102
+ {
103
+ value: "isNotNull",
104
+ label: "Is Not Null"
105
+ }
106
+ ],
107
+ boolean: [
108
+ {
109
+ value: "isTrue",
110
+ label: "Is True"
111
+ },
112
+ {
113
+ value: "isFalse",
114
+ label: "Is False"
115
+ },
116
+ {
117
+ value: "isNull",
118
+ label: "Is Null"
119
+ },
120
+ {
121
+ value: "isNotNull",
122
+ label: "Is Not Null"
123
+ }
124
+ ],
125
+ array: [
126
+ {
127
+ value: "isEmpty",
128
+ label: "Is Empty Array"
129
+ },
130
+ {
131
+ value: "isNotEmpty",
132
+ label: "Is Not Empty Array"
133
+ },
134
+ {
135
+ value: "contains",
136
+ label: "Contains Element"
137
+ },
138
+ {
139
+ value: "isNull",
140
+ label: "Is Null"
141
+ },
142
+ {
143
+ value: "isNotNull",
144
+ label: "Is Not Null"
145
+ }
146
+ ],
147
+ object: [
148
+ {
149
+ value: "isEmpty",
150
+ label: "Is Empty Object"
151
+ },
152
+ {
153
+ value: "isNotEmpty",
154
+ label: "Is Not Empty Object"
155
+ },
156
+ {
157
+ value: "hasProperty",
158
+ label: "Has Property"
159
+ },
160
+ {
161
+ value: "isNull",
162
+ label: "Is Null"
163
+ },
164
+ {
165
+ value: "isNotNull",
166
+ label: "Is Not Null"
167
+ }
168
+ ]
169
+ };
170
+ const parseSchema = (schema, currentPath = "", fields = []) => {
171
+ if (!schema || typeof schema !== "object") return fields;
172
+ const knownTypes = [
173
+ "string",
174
+ "number",
175
+ "integer",
176
+ "boolean",
177
+ "array",
178
+ "object"
179
+ ];
180
+ if (schema.type === "object" && schema.properties) for (const key in schema.properties) {
181
+ const property = schema.properties[key];
182
+ const newPath = currentPath ? `${currentPath}.${key}` : key;
183
+ if (property?.type && knownTypes.includes(property.type)) fields.push({
184
+ path: newPath,
185
+ type: property.type
186
+ });
187
+ if (property?.type === "object" && property.properties) parseSchema(property, newPath, fields);
188
+ if (property?.type === "array" && property.items && property.items.type === "object") {
189
+ fields.push({
190
+ path: newPath,
191
+ type: "array"
192
+ });
193
+ if (property.items.properties) for (const itemKey in property.items.properties) {
194
+ const itemProperty = property.items.properties[itemKey];
195
+ const itemPath = `${newPath}.${itemKey}`;
196
+ if (itemProperty?.type && knownTypes.includes(itemProperty.type)) fields.push({
197
+ path: itemPath,
198
+ type: itemProperty.type
199
+ });
200
+ if (itemProperty?.type === "object" && itemProperty.properties) parseSchema(itemProperty, itemPath, fields);
201
+ }
202
+ }
203
+ }
204
+ fields.sort((a, b) => a.path.localeCompare(b.path));
205
+ return Array.from(new Map(fields.map((f) => [f.path, f])).values());
206
+ };
207
+ const getOperatorsForType = (type) => OPERATORS[type] || [{
208
+ value: "isNull",
209
+ label: "Is Null"
210
+ }, {
211
+ value: "isNotNull",
212
+ label: "Is Not Null"
213
+ }];
214
+ const generateId = () => Date.now().toString(36) + Math.random().toString(36).substring(2);
215
+ const createEmptyGroup = (id) => ({
216
+ id: id || generateId(),
217
+ type: "group",
218
+ combinator: "AND",
219
+ children: []
220
+ });
221
+ const createEmptyRule = (id) => ({
222
+ id: id || generateId(),
223
+ type: "rule",
224
+ field: "",
225
+ operator: "",
226
+ value: ""
227
+ });
228
+ const findAndModifyNode = (node, targetId, modification) => {
229
+ if (node.id === targetId) return modification(node);
230
+ if (node.type === "group") {
231
+ let childrenChanged = false;
232
+ const newChildren = node.children.map((child) => {
233
+ const modifiedChild = findAndModifyNode(child, targetId, modification);
234
+ if (modifiedChild !== child) childrenChanged = true;
235
+ return modifiedChild;
236
+ }).filter((child) => child !== null);
237
+ if (childrenChanged) return {
238
+ ...node,
239
+ children: newChildren
240
+ };
241
+ }
242
+ return node;
243
+ };
244
+ const findAndAddNode = (node, parentId, nodeToAdd) => {
245
+ if (node.id === parentId && node.type === "group") return {
246
+ ...node,
247
+ children: [...node.children, nodeToAdd]
248
+ };
249
+ if (node.type === "group") {
250
+ let childrenChanged = false;
251
+ const newChildren = node.children.map((child) => {
252
+ const updatedChild = findAndAddNode(child, parentId, nodeToAdd);
253
+ if (updatedChild !== child) childrenChanged = true;
254
+ return updatedChild;
255
+ });
256
+ if (childrenChanged) return {
257
+ ...node,
258
+ children: newChildren
259
+ };
260
+ }
261
+ return node;
262
+ };
263
+ const ConditionNodeDisplay = ({ node, path, fieldMap, parsedFields, onUpdateNode, onRemoveNode, onAddRule, onAddGroup, onDuplicateNode, level }) => {
264
+ const tr = useTr();
265
+ const [isExpanded, setIsExpanded] = useState(true);
266
+ const translateOperatorLabel = (label) => {
267
+ switch (label) {
268
+ case "Equals": return tr("fluidgrids.builder.conditionBuilder.operatorEquals", "Equals");
269
+ case "Not equals": return tr("fluidgrids.builder.conditionBuilder.operatorNotEquals", "Not equals");
270
+ case "Contains": return tr("fluidgrids.builder.conditionBuilder.operatorContains", "Contains");
271
+ case "Starts with": return tr("fluidgrids.builder.conditionBuilder.operatorStartsWith", "Starts with");
272
+ case "Ends with": return tr("fluidgrids.builder.conditionBuilder.operatorEndsWith", "Ends with");
273
+ case "Greater than": return tr("fluidgrids.builder.conditionBuilder.operatorGreaterThan", "Greater than");
274
+ case "Greater than or equal": return tr("fluidgrids.builder.conditionBuilder.operatorGreaterThanOrEqual", "Greater than or equal");
275
+ case "Less than": return tr("fluidgrids.builder.conditionBuilder.operatorLessThan", "Less than");
276
+ case "Less than or equal": return tr("fluidgrids.builder.conditionBuilder.operatorLessThanOrEqual", "Less than or equal");
277
+ case "Is True": return tr("fluidgrids.builder.conditionBuilder.operatorIsTrue", "Is True");
278
+ case "Is False": return tr("fluidgrids.builder.conditionBuilder.operatorIsFalse", "Is False");
279
+ case "Is Null": return tr("fluidgrids.builder.conditionBuilder.operatorIsNull", "Is Null");
280
+ case "Is Not Null": return tr("fluidgrids.builder.conditionBuilder.operatorIsNotNull", "Is Not Null");
281
+ case "Is Empty Array": return tr("fluidgrids.builder.conditionBuilder.operatorIsEmptyArray", "Is Empty Array");
282
+ case "Is Not Empty Array": return tr("fluidgrids.builder.conditionBuilder.operatorIsNotEmptyArray", "Is Not Empty Array");
283
+ case "Contains Element": return tr("fluidgrids.builder.conditionBuilder.operatorContainsElement", "Contains Element");
284
+ case "Is Empty Object": return tr("fluidgrids.builder.conditionBuilder.operatorIsEmptyObject", "Is Empty Object");
285
+ case "Is Not Empty Object": return tr("fluidgrids.builder.conditionBuilder.operatorIsNotEmptyObject", "Is Not Empty Object");
286
+ case "Has Property": return tr("fluidgrids.builder.conditionBuilder.operatorHasProperty", "Has Property");
287
+ default: return label;
288
+ }
289
+ };
290
+ const handleUpdate = useCallback((updates) => {
291
+ onUpdateNode(node.id, updates);
292
+ }, [node.id, onUpdateNode]);
293
+ const handleRemove = useCallback(() => {
294
+ onRemoveNode(node.id);
295
+ }, [node.id, onRemoveNode]);
296
+ const handleDuplicate = useCallback(() => {
297
+ if (onDuplicateNode) onDuplicateNode(node.id);
298
+ }, [node.id, onDuplicateNode]);
299
+ if (node.type === "rule") {
300
+ const { field, operator, value } = node;
301
+ const selectedFieldType = fieldMap.get(field);
302
+ const availableOperators = selectedFieldType ? getOperatorsForType(selectedFieldType) : [];
303
+ const needsValue = field && operator && ![
304
+ "isTrue",
305
+ "isFalse",
306
+ "isEmpty",
307
+ "isNotEmpty",
308
+ "isNull",
309
+ "isNotNull"
310
+ ].includes(operator);
311
+ const renderValueInputForRule = () => {
312
+ if (!needsValue) return null;
313
+ switch (selectedFieldType) {
314
+ case "number":
315
+ case "integer": return /* @__PURE__ */ jsx(Input, {
316
+ type: "number",
317
+ placeholder: tr("fluidgrids.builder.conditionBuilder.numberValuePlaceholder", "Number"),
318
+ value: typeof value === "boolean" ? "" : value ?? "",
319
+ onChange: (e) => handleUpdate({ value: e.target.value === "" ? null : Number(e.target.value) }),
320
+ className: "w-full flex-grow"
321
+ });
322
+ case "boolean": return /* @__PURE__ */ jsx("span", {
323
+ className: "text-sm text-muted-foreground italic p-2",
324
+ children: tr("fluidgrids.builder.conditionBuilder.booleanValueHint", "Use 'Is True' / 'Is False'")
325
+ });
326
+ default: return /* @__PURE__ */ jsx(Input, {
327
+ type: "text",
328
+ placeholder: tr("fluidgrids.builder.conditionBuilder.textValuePlaceholder", "Value"),
329
+ value: typeof value === "boolean" ? String(value) : value ?? "",
330
+ onChange: (e) => handleUpdate({ value: e.target.value }),
331
+ className: "w-full flex-grow"
332
+ });
333
+ }
334
+ };
335
+ return /* @__PURE__ */ jsx(Card, {
336
+ className: "overflow-hidden border-muted-foreground/20 shadow-sm transition-all hover:shadow-md",
337
+ children: /* @__PURE__ */ jsx(CardContent, {
338
+ className: "p-3",
339
+ children: /* @__PURE__ */ jsxs("div", {
340
+ className: "flex flex-col sm:flex-row items-stretch sm:items-center gap-2",
341
+ children: [
342
+ /* @__PURE__ */ jsx("div", {
343
+ className: "w-full sm:w-[30%]",
344
+ children: /* @__PURE__ */ jsxs(Select, {
345
+ value: field,
346
+ onValueChange: (val) => handleUpdate({
347
+ field: val,
348
+ operator: "",
349
+ value: ""
350
+ }),
351
+ children: [/* @__PURE__ */ jsx(SelectTrigger, {
352
+ className: "h-9",
353
+ children: /* @__PURE__ */ jsx(SelectValue, { placeholder: tr("fluidgrids.builder.conditionBuilder.selectFieldPlaceholder", "Select field") })
354
+ }), /* @__PURE__ */ jsx(SelectContent, {
355
+ className: "max-h-[300px] z-[100000]",
356
+ children: parsedFields.map((f) => /* @__PURE__ */ jsx(SelectItem, {
357
+ value: f.path,
358
+ children: /* @__PURE__ */ jsxs("div", {
359
+ className: "flex items-center gap-2 w-full",
360
+ children: [/* @__PURE__ */ jsx("span", {
361
+ className: "overflow-visible whitespace-normal break-words",
362
+ children: f.path
363
+ }), /* @__PURE__ */ jsx(Badge, {
364
+ variant: "outline",
365
+ className: "ml-auto shrink-0 text-xs",
366
+ children: f.type
367
+ })]
368
+ })
369
+ }, f.path))
370
+ })]
371
+ })
372
+ }),
373
+ /* @__PURE__ */ jsx("div", {
374
+ className: "w-full sm:w-[25%]",
375
+ children: /* @__PURE__ */ jsxs(Select, {
376
+ value: operator,
377
+ onValueChange: (val) => handleUpdate({
378
+ operator: val,
379
+ value: ""
380
+ }),
381
+ disabled: !field,
382
+ children: [/* @__PURE__ */ jsx(SelectTrigger, {
383
+ className: "h-9",
384
+ children: /* @__PURE__ */ jsx(SelectValue, { placeholder: tr("fluidgrids.builder.conditionBuilder.operatorPlaceholder", "Operator") })
385
+ }), /* @__PURE__ */ jsx(SelectContent, {
386
+ className: "z-[100000]",
387
+ children: availableOperators.map((op) => /* @__PURE__ */ jsx(SelectItem, {
388
+ value: op.value,
389
+ children: translateOperatorLabel(op.label)
390
+ }, op.value))
391
+ })]
392
+ })
393
+ }),
394
+ /* @__PURE__ */ jsxs("div", {
395
+ className: `w-full ${needsValue ? "sm:w-[35%]" : "sm:w-[25%]"} flex items-center`,
396
+ children: [renderValueInputForRule(), !needsValue && operator && /* @__PURE__ */ jsx("span", {
397
+ className: "text-sm text-muted-foreground italic p-2",
398
+ children: tr("fluidgrids.builder.conditionBuilder.noValueNeeded", "No value needed")
399
+ })]
400
+ }),
401
+ /* @__PURE__ */ jsxs("div", {
402
+ className: "w-full sm:w-[10%] flex justify-end sm:justify-center gap-1",
403
+ children: [/* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
404
+ asChild: true,
405
+ children: /* @__PURE__ */ jsx(Button, {
406
+ variant: "ghost",
407
+ size: "icon",
408
+ onClick: handleDuplicate,
409
+ className: "h-8 w-8",
410
+ children: /* @__PURE__ */ jsx(Copy, { className: "h-4 w-4" })
411
+ })
412
+ }), /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: tr("fluidgrids.builder.conditionBuilder.duplicateRuleTooltip", "Duplicate rule") }) })] }) }), /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
413
+ asChild: true,
414
+ children: /* @__PURE__ */ jsx(Button, {
415
+ variant: "ghost",
416
+ size: "icon",
417
+ onClick: handleRemove,
418
+ className: "h-8 w-8 text-destructive hover:text-destructive/90 hover:bg-destructive/10",
419
+ children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" })
420
+ })
421
+ }), /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: tr("fluidgrids.builder.conditionBuilder.removeRuleTooltip", "Remove rule") }) })] }) })]
422
+ })
423
+ ]
424
+ })
425
+ })
426
+ });
427
+ }
428
+ if (node.type === "group") {
429
+ const { combinator, children } = node;
430
+ const isRoot = path.length === 1 && path[0] === "root";
431
+ const hasChildren = children.length > 0;
432
+ const handleCombinatorChange = (value) => {
433
+ handleUpdate({ combinator: value });
434
+ };
435
+ const handleAddRuleClick = () => onAddRule(node.id);
436
+ const handleAddGroupClick = () => onAddGroup(node.id);
437
+ const toggleExpanded = () => setIsExpanded(!isExpanded);
438
+ const getBgColor = () => {
439
+ if (isRoot) return "bg-background";
440
+ return level % 2 === 0 ? "bg-muted/30" : "bg-background";
441
+ };
442
+ return /* @__PURE__ */ jsx("div", {
443
+ className: `rounded-lg border ${isRoot ? "border-primary/30" : "border-muted-foreground/20"} ${getBgColor()} transition-all`,
444
+ children: /* @__PURE__ */ jsxs("div", {
445
+ className: "p-3",
446
+ children: [/* @__PURE__ */ jsxs("div", {
447
+ className: "flex items-center gap-2 mb-2",
448
+ children: [
449
+ hasChildren && /* @__PURE__ */ jsx(Button, {
450
+ variant: "ghost",
451
+ size: "icon",
452
+ onClick: toggleExpanded,
453
+ className: "h-7 w-7 p-0",
454
+ children: isExpanded ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
455
+ }),
456
+ /* @__PURE__ */ jsxs("div", {
457
+ className: "flex items-center",
458
+ children: [/* @__PURE__ */ jsx(Badge, {
459
+ variant: combinator === "AND" ? "default" : "secondary",
460
+ className: "mr-2 px-2 py-0.5 text-xs font-medium",
461
+ children: combinator === "AND" ? tr("fluidgrids.builder.conditionBuilder.combinatorAnd", "AND") : tr("fluidgrids.builder.conditionBuilder.combinatorOr", "OR")
462
+ }), /* @__PURE__ */ jsxs(Select, {
463
+ value: combinator,
464
+ onValueChange: handleCombinatorChange,
465
+ children: [/* @__PURE__ */ jsx(SelectTrigger, {
466
+ className: "w-[80px] h-7 text-xs",
467
+ children: /* @__PURE__ */ jsx(SelectValue, {})
468
+ }), /* @__PURE__ */ jsxs(SelectContent, { children: [/* @__PURE__ */ jsx(SelectItem, {
469
+ value: "AND",
470
+ children: tr("fluidgrids.builder.conditionBuilder.combinatorAnd", "AND")
471
+ }), /* @__PURE__ */ jsx(SelectItem, {
472
+ value: "OR",
473
+ children: tr("fluidgrids.builder.conditionBuilder.combinatorOr", "OR")
474
+ })] })]
475
+ })]
476
+ }),
477
+ /* @__PURE__ */ jsxs("div", {
478
+ className: "flex items-center gap-1 ml-auto",
479
+ children: [
480
+ /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
481
+ asChild: true,
482
+ children: /* @__PURE__ */ jsxs(Button, {
483
+ onClick: handleAddRuleClick,
484
+ variant: "outline",
485
+ size: "sm",
486
+ className: "h-7 text-xs",
487
+ children: [
488
+ /* @__PURE__ */ jsx(Plus, { className: "mr-1 h-3 w-3" }),
489
+ " ",
490
+ tr("fluidgrids.builder.conditionBuilder.addRuleButton", "Rule")
491
+ ]
492
+ })
493
+ }), /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: tr("fluidgrids.builder.conditionBuilder.addRuleTooltip", "Add a new rule") }) })] }) }),
494
+ /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
495
+ asChild: true,
496
+ children: /* @__PURE__ */ jsxs(Button, {
497
+ onClick: handleAddGroupClick,
498
+ variant: "outline",
499
+ size: "sm",
500
+ className: "h-7 text-xs",
501
+ children: [
502
+ /* @__PURE__ */ jsx(Layers, { className: "mr-1 h-3 w-3" }),
503
+ " ",
504
+ tr("fluidgrids.builder.conditionBuilder.addGroupButton", "Group")
505
+ ]
506
+ })
507
+ }), /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: tr("fluidgrids.builder.conditionBuilder.addGroupTooltip", "Add a nested group") }) })] }) }),
508
+ !isRoot && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
509
+ asChild: true,
510
+ children: /* @__PURE__ */ jsx(Button, {
511
+ variant: "ghost",
512
+ size: "icon",
513
+ onClick: handleRemove,
514
+ className: "h-7 w-7 text-destructive hover:text-destructive/90 hover:bg-destructive/10",
515
+ children: /* @__PURE__ */ jsx(Trash2, { className: "h-3 w-3" })
516
+ })
517
+ }), /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: tr("fluidgrids.builder.conditionBuilder.removeGroupTooltip", "Remove group") }) })] }) })
518
+ ]
519
+ })
520
+ ]
521
+ }), isExpanded && /* @__PURE__ */ jsxs("div", {
522
+ className: `space-y-3 mt-3 ${!isRoot ? "pl-4 border-l-2 border-muted/50" : ""}`,
523
+ children: [children.length === 0 && /* @__PURE__ */ jsxs("div", {
524
+ className: "flex items-center gap-2 p-3 text-sm text-muted-foreground bg-muted/20 rounded-md",
525
+ children: [/* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" }), /* @__PURE__ */ jsx("p", { children: tr("fluidgrids.builder.conditionBuilder.emptyGroupMessage", "Group is empty. Add a rule or group to get started.") })]
526
+ }), children.map((childNode) => /* @__PURE__ */ jsx(ConditionNodeDisplay, {
527
+ node: childNode,
528
+ path: [...path, childNode.id],
529
+ fieldMap,
530
+ parsedFields,
531
+ onUpdateNode,
532
+ onRemoveNode,
533
+ onAddRule,
534
+ onAddGroup,
535
+ onDuplicateNode,
536
+ level: level + 1
537
+ }, childNode.id))]
538
+ })]
539
+ })
540
+ });
541
+ }
542
+ return null;
543
+ };
544
+ const ConditionBuilder$1 = ({ outputSchema, initialCondition, onConditionChange, predefinedFields }) => {
545
+ const tr = useTr();
546
+ const [conditionTree, setConditionTree] = useState(() => initialCondition || createEmptyGroup("root"));
547
+ const [showDebug, setShowDebug] = useState(false);
548
+ const parsedFields = useMemo(() => {
549
+ if (predefinedFields && predefinedFields.length > 0) return predefinedFields;
550
+ return parseSchema(outputSchema);
551
+ }, [outputSchema, predefinedFields]);
552
+ const fieldMap = useMemo(() => {
553
+ return new Map(parsedFields.map((f) => [f.path, f.type]));
554
+ }, [parsedFields]);
555
+ useEffect(() => {
556
+ onConditionChange(conditionTree);
557
+ }, [conditionTree, onConditionChange]);
558
+ const handleUpdateNode = useCallback((nodeId, updates) => {
559
+ setConditionTree((prevTree) => {
560
+ return findAndModifyNode(prevTree, nodeId, (node) => {
561
+ const validUpdates = {};
562
+ if ("field" in updates) validUpdates.field = updates.field;
563
+ if ("operator" in updates) validUpdates.operator = updates.operator;
564
+ if ("value" in updates) validUpdates.value = updates.value;
565
+ if ("combinator" in updates) validUpdates.combinator = updates.combinator;
566
+ if ("children" in updates) validUpdates.children = updates.children;
567
+ return {
568
+ ...node,
569
+ ...validUpdates
570
+ };
571
+ });
572
+ });
573
+ }, []);
574
+ const handleRemoveNode = useCallback((id) => {
575
+ if (id === "root") {
576
+ console.warn("Cannot remove the root node.");
577
+ return;
578
+ }
579
+ setConditionTree((prevTree) => {
580
+ return findAndModifyNode(prevTree, id, () => null);
581
+ });
582
+ }, []);
583
+ const handleAddRule = useCallback((parentId) => {
584
+ const newRule = createEmptyRule();
585
+ setConditionTree((prevTree) => findAndAddNode(prevTree, parentId, newRule));
586
+ }, []);
587
+ const handleAddGroup = useCallback((parentId) => {
588
+ const newGroup = createEmptyGroup();
589
+ setConditionTree((prevTree) => findAndAddNode(prevTree, parentId, newGroup));
590
+ }, []);
591
+ const handleDuplicateNode = useCallback((id) => {
592
+ setConditionTree((prevTree) => {
593
+ let nodeToDuplicate = null;
594
+ findAndModifyNode(prevTree, id, (node) => {
595
+ nodeToDuplicate = JSON.parse(JSON.stringify(node));
596
+ return node;
597
+ });
598
+ if (!nodeToDuplicate) return prevTree;
599
+ const findParent = (node, targetId) => {
600
+ if (node.type === "group") for (const child of node.children) {
601
+ if (child.id === targetId) return node.id;
602
+ const result = findParent(child, targetId);
603
+ if (result) return result;
604
+ }
605
+ return null;
606
+ };
607
+ const parentId = findParent(prevTree, id) || "root";
608
+ const assignNewIds = (node) => {
609
+ const newId = generateId();
610
+ if (node.type === "rule") return {
611
+ ...node,
612
+ id: newId
613
+ };
614
+ else return {
615
+ ...node,
616
+ id: newId,
617
+ children: node.children.map((child) => assignNewIds(child))
618
+ };
619
+ };
620
+ const duplicateWithNewIds = assignNewIds(nodeToDuplicate);
621
+ return findAndAddNode(prevTree, parentId, duplicateWithNewIds);
622
+ });
623
+ }, []);
624
+ const handleCopyToClipboard = useCallback(() => {
625
+ navigator.clipboard.writeText(JSON.stringify(conditionTree, null, 2)).then(() => {
626
+ toast.info(tr("fluidgrids.builder.conditionBuilder.copiedToClipboardToast", "Condition tree copied to clipboard!"));
627
+ }).catch((err) => {
628
+ console.error("Failed to copy: ", err);
629
+ });
630
+ }, [conditionTree, tr]);
631
+ return /* @__PURE__ */ jsxs("div", {
632
+ className: "space-y-4 p-4 bg-background border rounded-lg shadow-sm",
633
+ children: [
634
+ /* @__PURE__ */ jsxs("div", {
635
+ className: "flex items-center justify-between mb-4",
636
+ children: [/* @__PURE__ */ jsxs("div", {
637
+ className: "flex items-center gap-2",
638
+ children: [/* @__PURE__ */ jsx("h2", {
639
+ className: "text-lg font-semibold",
640
+ children: tr("fluidgrids.builder.conditionBuilder.title", "Condition Builder")
641
+ }), /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
642
+ asChild: true,
643
+ children: /* @__PURE__ */ jsx(Button, {
644
+ variant: "ghost",
645
+ size: "icon",
646
+ className: "h-6 w-6",
647
+ children: /* @__PURE__ */ jsx(Info, { className: "h-4 w-4" })
648
+ })
649
+ }), /* @__PURE__ */ jsx(TooltipContent, {
650
+ className: "max-w-sm",
651
+ children: /* @__PURE__ */ jsx("p", { children: tr("fluidgrids.builder.conditionBuilder.infoTooltip", "Build complex query conditions by adding rules and groups. Rules are individual conditions, while groups combine multiple conditions with AND/OR logic.") })
652
+ })] }) })]
653
+ }), /* @__PURE__ */ jsxs("div", {
654
+ className: "flex items-center gap-2",
655
+ children: [/* @__PURE__ */ jsx(Button, {
656
+ variant: "outline",
657
+ size: "sm",
658
+ onClick: () => setShowDebug(!showDebug),
659
+ className: "text-xs",
660
+ children: showDebug ? tr("fluidgrids.builder.conditionBuilder.hideJsonButton", "Hide JSON") : tr("fluidgrids.builder.conditionBuilder.showJsonButton", "Show JSON")
661
+ }), /* @__PURE__ */ jsxs(Button, {
662
+ variant: "outline",
663
+ size: "sm",
664
+ onClick: handleCopyToClipboard,
665
+ className: "text-xs",
666
+ children: [
667
+ /* @__PURE__ */ jsx(Copy, { className: "h-3 w-3 mr-1" }),
668
+ " ",
669
+ tr("fluidgrids.builder.conditionBuilder.copyJsonButton", "Copy JSON")
670
+ ]
671
+ })]
672
+ })]
673
+ }),
674
+ /* @__PURE__ */ jsx("div", {
675
+ className: "relative",
676
+ children: /* @__PURE__ */ jsx(ScrollArea, {
677
+ className: "max-h-[600px] pr-4",
678
+ children: /* @__PURE__ */ jsx(ConditionNodeDisplay, {
679
+ node: conditionTree,
680
+ path: ["root"],
681
+ fieldMap,
682
+ parsedFields,
683
+ onUpdateNode: handleUpdateNode,
684
+ onRemoveNode: handleRemoveNode,
685
+ onAddRule: handleAddRule,
686
+ onAddGroup: handleAddGroup,
687
+ onDuplicateNode: handleDuplicateNode,
688
+ level: 0
689
+ })
690
+ })
691
+ }),
692
+ showDebug && /* @__PURE__ */ jsxs("div", {
693
+ className: "mt-6 border-t pt-4",
694
+ children: [/* @__PURE__ */ jsxs("div", {
695
+ className: "flex items-center justify-between mb-2",
696
+ children: [/* @__PURE__ */ jsx(Label, {
697
+ className: "text-sm font-medium",
698
+ children: tr("fluidgrids.builder.conditionBuilder.debugJsonLabel", "Condition Tree JSON:")
699
+ }), /* @__PURE__ */ jsxs(Button, {
700
+ variant: "ghost",
701
+ size: "sm",
702
+ onClick: handleCopyToClipboard,
703
+ className: "h-7 text-xs",
704
+ children: [
705
+ /* @__PURE__ */ jsx(Copy, { className: "h-3 w-3 mr-1" }),
706
+ " ",
707
+ tr("fluidgrids.builder.conditionBuilder.copyButton", "Copy")
708
+ ]
709
+ })]
710
+ }), /* @__PURE__ */ jsx("div", {
711
+ className: "relative",
712
+ children: /* @__PURE__ */ jsx(ScrollArea, {
713
+ className: "h-[200px]",
714
+ children: /* @__PURE__ */ jsx("pre", {
715
+ className: "p-4 bg-muted rounded-md text-xs font-mono",
716
+ children: /* @__PURE__ */ jsx("code", { children: JSON.stringify(conditionTree, null, 2) })
717
+ })
718
+ })
719
+ })]
720
+ })
721
+ ]
722
+ });
723
+ };
724
+
725
+ // src/builder/components/flow-builder/components/edges/conditionBuilder/graphql-condition-builder.tsx
726
+ const Alert = ({ children, variant, className }) => /* @__PURE__ */ jsx("div", {
727
+ className: `relative w-full rounded-lg border p-4 ${variant === "destructive" ? "border-destructive/50 text-destructive bg-destructive/10" : "border-border"} ${className || ""}`,
728
+ children: /* @__PURE__ */ jsx("div", {
729
+ className: "flex gap-3",
730
+ children
731
+ })
732
+ });
733
+ const AlertTitle = ({ children }) => /* @__PURE__ */ jsx("h5", {
734
+ className: "mb-1 font-medium leading-none tracking-tight",
735
+ children
736
+ });
737
+ const AlertDescription = ({ children }) => /* @__PURE__ */ jsx("div", {
738
+ className: "text-sm opacity-90",
739
+ children
740
+ });
741
+ const findTypeInSchema = (types, typeName) => {
742
+ return types[typeName];
743
+ };
744
+ const mapGraphQLTypeToJSONType = (graphqlType) => {
745
+ return {
746
+ String: "string",
747
+ Int: "integer",
748
+ Float: "number",
749
+ Boolean: "boolean",
750
+ ID: "string"
751
+ }[graphqlType] || "string";
752
+ };
753
+ const extractFields = (schemaToExtract) => {
754
+ const extractedFields = [];
755
+ const processObject = (obj, path = "") => {
756
+ if (!obj || typeof obj !== "object") return;
757
+ if (obj.type) extractedFields.push({
758
+ path,
759
+ type: obj.type
760
+ });
761
+ if (obj.type === "object" && obj.properties) Object.keys(obj.properties).forEach((key) => {
762
+ const newPath = path ? `${path}.${key}` : key;
763
+ const property = obj.properties[key];
764
+ extractedFields.push({
765
+ path: newPath,
766
+ type: property.type
767
+ });
768
+ if (property.type === "object" && property.properties) processObject(property, newPath);
769
+ if (property.type === "array" && property.items) {
770
+ extractedFields.push({
771
+ path: newPath,
772
+ type: "array"
773
+ });
774
+ if (property.items.type === "object" && property.items.properties) Object.keys(property.items.properties).forEach((itemKey) => {
775
+ const itemPath = `${newPath}.${itemKey}`;
776
+ const itemProperty = property.items.properties[itemKey];
777
+ extractedFields.push({
778
+ path: itemPath,
779
+ type: itemProperty.type
780
+ });
781
+ if (itemProperty.type === "object" && itemProperty.properties) processObject(itemProperty, itemPath);
782
+ });
783
+ }
784
+ });
785
+ };
786
+ processObject(schemaToExtract);
787
+ extractedFields.sort((a, b) => a.path.localeCompare(b.path));
788
+ return extractedFields.filter((field, index, self) => field.path && self.findIndex((f) => f.path === field.path) === index);
789
+ };
790
+ const buildSchemaForOperation = (types, typeObj) => {
791
+ if (typeObj.name === "GmailSearchResult") return {
792
+ type: "object",
793
+ properties: {
794
+ emails: {
795
+ type: "array",
796
+ items: {
797
+ type: "object",
798
+ properties: {
799
+ metadata: {
800
+ type: "object",
801
+ properties: {
802
+ id: { type: "string" },
803
+ threadId: { type: "string" },
804
+ subject: { type: "string" },
805
+ from: { type: "string" },
806
+ to: { type: "string" },
807
+ date: { type: "string" },
808
+ labels: {
809
+ type: "array",
810
+ items: { type: "string" }
811
+ }
812
+ }
813
+ },
814
+ snippet: { type: "string" },
815
+ body: { type: "string" },
816
+ error: { type: "string" }
817
+ }
818
+ }
819
+ },
820
+ error: { type: "string" }
821
+ }
822
+ };
823
+ if (typeObj.name === "GmailBatchActionResult") return {
824
+ type: "object",
825
+ properties: {
826
+ succeededIds: {
827
+ type: "array",
828
+ items: { type: "string" }
829
+ },
830
+ failedItems: {
831
+ type: "array",
832
+ items: {
833
+ type: "object",
834
+ properties: {
835
+ messageId: { type: "string" },
836
+ error: { type: "string" }
837
+ }
838
+ }
839
+ }
840
+ }
841
+ };
842
+ const builtSchema = {
843
+ type: "object",
844
+ properties: {}
845
+ };
846
+ const buildNestedSchema = (nestedTypeObj) => {
847
+ if (!nestedTypeObj) return { type: "string" };
848
+ const result = { type: nestedTypeObj.kind === "scalar" ? mapGraphQLTypeToJSONType(nestedTypeObj.name) : "object" };
849
+ if (nestedTypeObj.kind === "type" && nestedTypeObj.fields) {
850
+ result.properties = {};
851
+ Object.keys(nestedTypeObj.fields).forEach((fieldName) => {
852
+ const field = nestedTypeObj.fields[fieldName];
853
+ const fieldType = field.type;
854
+ const fieldTypeObj = findTypeInSchema(types, fieldType);
855
+ if (!fieldTypeObj) return;
856
+ if (fieldTypeObj.kind === "scalar") result.properties[fieldName] = {
857
+ type: mapGraphQLTypeToJSONType(fieldTypeObj.name),
858
+ description: field.description || ""
859
+ };
860
+ else if (fieldTypeObj.kind === "type" && field.isList) result.properties[fieldName] = {
861
+ type: "array",
862
+ description: field.description || "",
863
+ items: buildNestedSchema(fieldTypeObj)
864
+ };
865
+ else if (fieldTypeObj.kind === "type") result.properties[fieldName] = buildNestedSchema(fieldTypeObj);
866
+ });
867
+ }
868
+ return result;
869
+ };
870
+ if (typeObj.kind === "type" && typeObj.fields) Object.keys(typeObj.fields).forEach((fieldName) => {
871
+ const field = typeObj.fields[fieldName];
872
+ const fieldType = field.type;
873
+ const fieldTypeObj = findTypeInSchema(types, fieldType);
874
+ if (!fieldTypeObj) return;
875
+ if (fieldTypeObj.kind === "scalar") builtSchema.properties[fieldName] = {
876
+ type: mapGraphQLTypeToJSONType(fieldTypeObj.name),
877
+ description: field.description || ""
878
+ };
879
+ else if (field.isList) builtSchema.properties[fieldName] = {
880
+ type: "array",
881
+ items: buildNestedSchema(fieldTypeObj)
882
+ };
883
+ else if (fieldTypeObj.kind === "type") builtSchema.properties[fieldName] = buildNestedSchema(fieldTypeObj);
884
+ });
885
+ return builtSchema;
886
+ };
887
+ const GraphQLConditionBuilder = ({ introspectionData, operationName, initialCondition, onConditionChange }) => {
888
+ const tr = useTr();
889
+ const { schema, fields, error } = useMemo(() => {
890
+ try {
891
+ if (!introspectionData || !operationName) return {
892
+ schema: null,
893
+ fields: [],
894
+ error: null
895
+ };
896
+ const queryType = introspectionData.queryType;
897
+ const mutationType = introspectionData.mutationType;
898
+ const queryTypeObj = introspectionData.types[queryType];
899
+ const mutationTypeObj = mutationType ? introspectionData.types[mutationType] : void 0;
900
+ if (queryTypeObj && queryTypeObj.fields && queryTypeObj.fields[operationName]) {
901
+ const returnType = queryTypeObj.fields[operationName].type;
902
+ const returnTypeObj = findTypeInSchema(introspectionData.types, returnType);
903
+ if (!returnTypeObj) return {
904
+ schema: null,
905
+ fields: [],
906
+ error: `Return type "${returnType}" not found in schema`
907
+ };
908
+ const builtSchema = buildSchemaForOperation(introspectionData.types, returnTypeObj);
909
+ return {
910
+ schema: builtSchema,
911
+ fields: extractFields(builtSchema),
912
+ error: null
913
+ };
914
+ }
915
+ if (mutationTypeObj && mutationTypeObj.fields && mutationTypeObj.fields[operationName]) {
916
+ const returnType = mutationTypeObj.fields[operationName].type;
917
+ const returnTypeObj = findTypeInSchema(introspectionData.types, returnType);
918
+ if (!returnTypeObj) return {
919
+ schema: null,
920
+ fields: [],
921
+ error: `Return type "${returnType}" not found in schema`
922
+ };
923
+ const builtSchema = buildSchemaForOperation(introspectionData.types, returnTypeObj);
924
+ return {
925
+ schema: builtSchema,
926
+ fields: extractFields(builtSchema),
927
+ error: null
928
+ };
929
+ }
930
+ return {
931
+ schema: null,
932
+ fields: [],
933
+ error: `Operation "${operationName}" not found in schema`
934
+ };
935
+ } catch (err) {
936
+ console.error("Error building schema:", err);
937
+ return {
938
+ schema: null,
939
+ fields: [],
940
+ error: "Failed to build schema from introspection data"
941
+ };
942
+ }
943
+ }, [introspectionData, operationName]);
944
+ useEffect(() => {
945
+ if (schema) {}
946
+ }, [schema, fields]);
947
+ if (error) return /* @__PURE__ */ jsxs(Alert, {
948
+ variant: "destructive",
949
+ children: [
950
+ /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" }),
951
+ /* @__PURE__ */ jsx(AlertTitle, { children: tr("fluidgrids.builder.graphqlConditionBuilder.errorTitle", "Error") }),
952
+ /* @__PURE__ */ jsx(AlertDescription, { children: error })
953
+ ]
954
+ });
955
+ if (!schema) return /* @__PURE__ */ jsx("div", { children: tr("fluidgrids.builder.graphqlConditionBuilder.loadingSchema", "Loading schema...") });
956
+ return /* @__PURE__ */ jsx(ConditionBuilder$1, {
957
+ outputSchema: schema,
958
+ initialCondition,
959
+ onConditionChange,
960
+ predefinedFields: fields
961
+ });
962
+ };
963
+
964
+ // src/builder/components/flow-builder/components/edges/conditionBuilder/custom-condition-tree-converter.ts
965
+ function buildConditionString(conditionJson) {
966
+ const getFallback = (operator, isLast) => {
967
+ if (!isLast) return "{}";
968
+ if (operator === "contains") return `''`;
969
+ return "0";
970
+ };
971
+ const parseField = (field, operator) => {
972
+ const parts = field.split(".");
973
+ if (parts[0] === "emails" && parts.length > 1) {
974
+ const arrayPath = parts[0];
975
+ const remainingPath = parts.slice(1).join(".");
976
+ if (operator === "contains" || operator === "==") return `output.${arrayPath}.some(item => item.${remainingPath})`;
977
+ else if (operator === "!=" || operator === "isNotNull") return `output.${arrayPath}.some(item => item.${remainingPath})`;
978
+ else return `output.${arrayPath}[0]?.${remainingPath}`;
979
+ }
980
+ return `output${parts.map((key, i) => {
981
+ const isLast = i === parts.length - 1;
982
+ return `.get('${key}', ${getFallback(operator, isLast)})`;
983
+ }).join("")}`;
984
+ };
985
+ const parseRule = (rule) => {
986
+ const { field, operator, value } = rule;
987
+ const parts = field.split(".");
988
+ if (parts[0] === "emails" && parts.length > 1) {
989
+ const remainingPath = parts.slice(1).join(".");
990
+ const stringValue = typeof value === "string" ? `'${value}'` : value;
991
+ if (operator === "contains") return `output.emails.some(item => item.${remainingPath}?.includes(${stringValue}))`;
992
+ else if (operator === "==") return `output.emails.some(item => item.${remainingPath} === ${stringValue})`;
993
+ else if (operator === "!=") return `output.emails.some(item => item.${remainingPath} !== ${stringValue})`;
994
+ else if (operator === ">") return `output.emails.some(item => item.${remainingPath} > ${stringValue})`;
995
+ else if (operator === ">=") return `output.emails.some(item => item.${remainingPath} >= ${stringValue})`;
996
+ else if (operator === "<") return `output.emails.some(item => item.${remainingPath} < ${stringValue})`;
997
+ else if (operator === "<=") return `output.emails.some(item => item.${remainingPath} <= ${stringValue})`;
998
+ else if (operator === "isNull") return `output.emails.some(item => item.${remainingPath} === null || item.${remainingPath} === undefined)`;
999
+ else if (operator === "isNotNull") return `output.emails.some(item => item.${remainingPath} !== null && item.${remainingPath} !== undefined)`;
1000
+ else if (operator === "hasProperty") return `output.emails.some(item => '${value}' in item.${remainingPath})`;
1001
+ }
1002
+ const fieldStr = parseField(field, operator);
1003
+ const stringValue = typeof value === "string" ? `'${value}'` : value;
1004
+ const opMap = {
1005
+ contains: "includes",
1006
+ "==": "==",
1007
+ "!=": "!=",
1008
+ ">": ">",
1009
+ "<": "<",
1010
+ ">=": ">=",
1011
+ "<=": "<=",
1012
+ hasProperty: "hasProperty"
1013
+ };
1014
+ if (operator === "contains") return `${fieldStr}.includes(${stringValue})`;
1015
+ else if (operator === "hasProperty") return `'${value}' in output${field.split(".").map((part) => `.get('${part}', {})`).join("")}`;
1016
+ else return `${fieldStr} ${opMap[operator] ?? operator} ${stringValue}`;
1017
+ };
1018
+ const parseGroup = (group) => {
1019
+ const combinator = group.combinator.toLowerCase();
1020
+ return group.children.map((child) => {
1021
+ if (child.type === "rule") return parseRule(child);
1022
+ else return `(${parseGroup(child)})`;
1023
+ }).join(` ${combinator} `);
1024
+ };
1025
+ return parseGroup(conditionJson);
1026
+ }
1027
+
1028
+ // src/builder/components/flow-builder/components/edges/conditionBuilder/index.tsx
1029
+ function convertToIntrospectionData(schema) {
1030
+ if (!schema.queryType) return null;
1031
+ return {
1032
+ queryType: schema.queryType,
1033
+ mutationType: schema.mutationType ?? void 0,
1034
+ types: Object.fromEntries(Object.entries(schema.types).map(([key, value]) => [key, {
1035
+ name: value.name,
1036
+ kind: value.kind,
1037
+ fields: value.fields ? Object.fromEntries(Object.entries(value.fields).map(([fieldKey, fieldValue]) => [fieldKey, {
1038
+ type: fieldValue.type,
1039
+ isList: fieldValue.isList,
1040
+ isNonNull: fieldValue.isNonNull
1041
+ }])) : void 0
1042
+ }]))
1043
+ };
1044
+ }
1045
+ function ConditionBuilder({ sourceNode, sourceOperation, edgeId, schema }) {
1046
+ const tr = useTr();
1047
+ const { setEdges } = useReactFlow();
1048
+ const [conditionTree, setConditionTree] = useState(null);
1049
+ const [conditionString, setConditionString] = useState("");
1050
+ const sourceView = useEdgeMapperView(edgeId, sourceNode?.id ?? "", "");
1051
+ const derivedSchema = hasMapperFields(sourceView.sourceSchema) ? sourceView.sourceSchema : null;
1052
+ const selectedOperation = !schema && derivedSchema ? sourceView.sourceOperation : sourceOperation || sourceNode?.data?.operation_name || "";
1053
+ const rawSchema = schema || derivedSchema || sourceNode?.data?.schema || sourceNode?.data?.nodeData?.schema || null;
1054
+ const introspectionData = useMemo(() => {
1055
+ if (!rawSchema) return null;
1056
+ return convertToIntrospectionData(rawSchema);
1057
+ }, [rawSchema]);
1058
+ const handleConditionChange = (newTree) => {
1059
+ setConditionTree(newTree);
1060
+ try {
1061
+ const condString = buildConditionString(newTree);
1062
+ setConditionString(condString);
1063
+ } catch (error) {
1064
+ console.error("Error building condition string:", error);
1065
+ }
1066
+ };
1067
+ useEffect(() => {
1068
+ setEdges((edges) => {
1069
+ return edges.map((edge) => {
1070
+ if (edge.id === edgeId) return {
1071
+ ...edge,
1072
+ condition: conditionString
1073
+ };
1074
+ else return edge;
1075
+ });
1076
+ });
1077
+ }, [
1078
+ conditionString,
1079
+ edgeId,
1080
+ setEdges
1081
+ ]);
1082
+ if (!introspectionData) return /* @__PURE__ */ jsx(EmptyState, {
1083
+ kind: "first-use",
1084
+ illustration: "data-tables",
1085
+ size: "panel",
1086
+ className: "min-h-[200px]",
1087
+ icon: /* @__PURE__ */ jsx(AlertCircle, {
1088
+ className: "size-6",
1089
+ "aria-hidden": "true"
1090
+ }),
1091
+ title: tr("fluidgrids.builder.conditionBuilder.noSchema", "No schema available for this node. Configure the node schema first.")
1092
+ });
1093
+ return /* @__PURE__ */ jsx("div", {
1094
+ className: "container mx-auto py-8",
1095
+ children: introspectionData && selectedOperation && /* @__PURE__ */ jsxs(Tabs, {
1096
+ defaultValue: "builder",
1097
+ className: "w-full",
1098
+ children: [
1099
+ /* @__PURE__ */ jsxs(TabsList, {
1100
+ className: "mb-4",
1101
+ children: [/* @__PURE__ */ jsx(TabsTrigger, {
1102
+ value: "builder",
1103
+ children: tr("fluidgrids.builder.conditionBuilder.tabBuilder", "Condition Builder")
1104
+ }), /* @__PURE__ */ jsx(TabsTrigger, {
1105
+ value: "output",
1106
+ children: tr("fluidgrids.builder.conditionBuilder.tabOutput", "Generated Output")
1107
+ })]
1108
+ }),
1109
+ /* @__PURE__ */ jsx(TabsContent, {
1110
+ value: "builder",
1111
+ children: /* @__PURE__ */ jsx(GraphQLConditionBuilder, {
1112
+ introspectionData,
1113
+ operationName: selectedOperation,
1114
+ initialCondition: conditionTree || {
1115
+ id: "root",
1116
+ type: "group",
1117
+ combinator: "AND",
1118
+ children: []
1119
+ },
1120
+ onConditionChange: handleConditionChange
1121
+ })
1122
+ }),
1123
+ /* @__PURE__ */ jsx(TabsContent, {
1124
+ value: "output",
1125
+ children: /* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsxs(CardHeader, { children: [/* @__PURE__ */ jsx(CardTitle, { children: tr("fluidgrids.builder.conditionBuilder.generatedConditionTitle", "Generated Condition") }), /* @__PURE__ */ jsxs(CardDescription, { children: [
1126
+ tr("fluidgrids.builder.conditionBuilder.generatedConditionDescriptionStart", "The condition string that will be used to filter"),
1127
+ " ",
1128
+ selectedOperation,
1129
+ " ",
1130
+ tr("fluidgrids.builder.conditionBuilder.generatedConditionDescriptionEnd", "results")
1131
+ ] })] }), /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx(ScrollArea, {
1132
+ className: "h-[300px] w-full rounded-md border p-4",
1133
+ children: /* @__PURE__ */ jsx("pre", {
1134
+ className: "font-mono text-sm",
1135
+ children: conditionString || tr("fluidgrids.builder.conditionBuilder.noConditionYet", "No condition generated yet")
1136
+ })
1137
+ }) })] })
1138
+ })
1139
+ ]
1140
+ })
1141
+ });
1142
+ }
1143
+
1144
+ export { ConditionBuilder as default };