@fluidgrids/fe-sdk 0.0.0-stage → 2026.1203.7

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,708 @@
1
+ "use client";
2
+ import { t as Icon } from "./Icon-BtQ0HXLh.js";
3
+ import { t as ThemeProvider } from "./theme-provider-CntfC4_i.js";
4
+ import { t as WorkflowPreviewCanvas } from "./workflow-preview-canvas-CO8yzdE3.js";
5
+ import { t as extractTemplateGraph } from "./template-graph-DLF9dygU.js";
6
+ import { t as FluidGridsMark } from "./FluidGridsMark-CE2blT7K.js";
7
+ import { i as themeKey, n as applyFluidGridsTheme, r as sanitizeThemeValue } from "./fluidgridsTheme-DUhvOgoy.js";
8
+ import { useEffect, useMemo, useState } from "react";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ import "@xyflow/react/dist/style.css";
11
+ import { ErrorBoundary } from "@burdenoff/fe-libs/shared/components";
12
+
13
+ // src/pages/embed-canvas.ts
14
+ /**
15
+ * How the public embed viewer shows a workflow (BOFF-15400): read-only, with
16
+ * the whole graph fitted to the frame. Store pages put the viewer in a small
17
+ * frame, so opening at 100% showed one node of a wide workflow.
18
+ *
19
+ * Since BOFF-17536 (FG-R2-AS-07) the viewer draws with the read-only
20
+ * `WorkflowPreviewCanvas` instead of the full builder, which is always
21
+ * read-only and fits every node on load. These are its camera settings: no
22
+ * zoom past 100%, so a two-node workflow is not blown up, and a margin that
23
+ * keeps the edge cards clear of the "Powered by FluidGrids" mark.
24
+ */
25
+ const EMBED_CANVAS_PROPS = {
26
+ maxZoom: 1,
27
+ fitPadding: .2
28
+ };
29
+
30
+ // src/pages/embed-message.ts
31
+ /** Most steps an embedded workflow may carry. */
32
+ const MAX_EMBED_NODES = 500;
33
+ /** Most connections an embedded workflow may carry. */
34
+ const MAX_EMBED_EDGES = 2e3;
35
+ /** Largest embedded workflow, measured as JSON characters. */
36
+ const MAX_EMBED_JSON_LENGTH = 1e6;
37
+ const MAX_ID_LENGTH = 200;
38
+ const MAX_NAME_LENGTH = 200;
39
+ const DEFAULT_NAME = "Workflow";
40
+ /**
41
+ * Whether a message came from the page that framed this one. A page that is
42
+ * not framed has no host, so it accepts no messages at all.
43
+ */
44
+ function isMessageFromHost(event, win) {
45
+ return win.parent !== win && event.source === win.parent;
46
+ }
47
+ function isRecord$1(value) {
48
+ return typeof value === "object" && value !== null && !Array.isArray(value);
49
+ }
50
+ function isId(value) {
51
+ return typeof value === "string" && value.length > 0 && value.length <= MAX_ID_LENGTH;
52
+ }
53
+ function isOptionalShortString(value) {
54
+ return value === void 0 || value === null || typeof value === "string" && value.length <= MAX_ID_LENGTH;
55
+ }
56
+ function checkNode(node, index) {
57
+ const at = `Step ${index + 1}`;
58
+ if (!isRecord$1(node)) return `${at} is not an object`;
59
+ if (!isId(node.id)) return `${at} has no valid id`;
60
+ if (!isOptionalShortString(node.type)) return `${at} has an invalid type`;
61
+ if (node.position !== void 0) {
62
+ if (!isRecord$1(node.position)) return `${at} has an invalid position`;
63
+ const { x, y } = node.position;
64
+ if (x !== void 0 && !Number.isFinite(x) || y !== void 0 && !Number.isFinite(y)) return `${at} has an invalid position`;
65
+ }
66
+ if (node.data !== void 0 && !isRecord$1(node.data)) return `${at} has invalid data`;
67
+ return null;
68
+ }
69
+ function checkEdge(edge, index) {
70
+ const at = `Connection ${index + 1}`;
71
+ if (!isRecord$1(edge)) return `${at} is not an object`;
72
+ if (!isId(edge.source) || !isId(edge.target)) return `${at} needs a source and a target step id`;
73
+ if (!isOptionalShortString(edge.id) || !isOptionalShortString(edge.sourceHandle) || !isOptionalShortString(edge.targetHandle)) return `${at} has an invalid id or handle`;
74
+ return null;
75
+ }
76
+ /**
77
+ * Validate the `workflow` of an `openWorkflow` message and return a plain
78
+ * JSON copy of it. The copy drops anything structured cloning can carry but
79
+ * a workflow cannot (cycles, Maps, Dates as objects, typed arrays), so the
80
+ * canvas only ever sees plain data.
81
+ */
82
+ function parseEmbeddedWorkflow(raw) {
83
+ if (!isRecord$1(raw)) return {
84
+ ok: false,
85
+ message: "openWorkflow message carried no workflow"
86
+ };
87
+ const { nodes, edges } = raw;
88
+ if (!Array.isArray(nodes) || nodes.length === 0) return {
89
+ ok: false,
90
+ message: "openWorkflow message carried no nodes"
91
+ };
92
+ if (nodes.length > 500) return {
93
+ ok: false,
94
+ message: `Workflow has more than ${500} steps`
95
+ };
96
+ if (edges !== void 0 && !Array.isArray(edges)) return {
97
+ ok: false,
98
+ message: "Workflow connections must be a list"
99
+ };
100
+ const edgeList = edges ?? [];
101
+ if (edgeList.length > 2e3) return {
102
+ ok: false,
103
+ message: `Workflow has more than ${MAX_EMBED_EDGES} connections`
104
+ };
105
+ const ids = /* @__PURE__ */ new Set();
106
+ for (const [index, node] of nodes.entries()) {
107
+ const problem = checkNode(node, index);
108
+ if (problem) return {
109
+ ok: false,
110
+ message: problem
111
+ };
112
+ const id = node.id;
113
+ if (ids.has(id)) return {
114
+ ok: false,
115
+ message: `Step id "${id}" is used more than once`
116
+ };
117
+ ids.add(id);
118
+ }
119
+ for (const [index, edge] of edgeList.entries()) {
120
+ const problem = checkEdge(edge, index);
121
+ if (problem) return {
122
+ ok: false,
123
+ message: problem
124
+ };
125
+ }
126
+ let json;
127
+ try {
128
+ json = JSON.stringify({
129
+ nodes,
130
+ edges: edgeList
131
+ });
132
+ } catch {
133
+ return {
134
+ ok: false,
135
+ message: "Workflow is not plain JSON data"
136
+ };
137
+ }
138
+ if (json.length > 1e6) return {
139
+ ok: false,
140
+ message: "Workflow is too large to embed"
141
+ };
142
+ const graph = JSON.parse(json);
143
+ return {
144
+ ok: true,
145
+ workflow: {
146
+ name: typeof raw.name === "string" && raw.name.trim() ? raw.name.trim().slice(0, MAX_NAME_LENGTH) : DEFAULT_NAME,
147
+ graph
148
+ }
149
+ };
150
+ }
151
+
152
+ // src/pages/embed-params.ts
153
+ function parseEmbedParams(search) {
154
+ const params = new URLSearchParams(search);
155
+ return {
156
+ productId: params.get("productId") || null,
157
+ theme: normalizeTheme(params.get("theme")),
158
+ showCta: params.get("cta") !== "false",
159
+ themeTokens: parseThemeTokens(params)
160
+ };
161
+ }
162
+ /**
163
+ * The theme the viewer applies: the token params on top of the forced mode,
164
+ * the bare mode, or null to leave the visitor's theme alone.
165
+ */
166
+ function embedTheme(params) {
167
+ if (!params.themeTokens) return params.theme;
168
+ return params.theme ? {
169
+ mode: params.theme,
170
+ ...params.themeTokens
171
+ } : params.themeTokens;
172
+ }
173
+ function normalizeTheme(value) {
174
+ return value === "light" || value === "dark" ? value : null;
175
+ }
176
+ const BARE_HEX = /^(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
177
+ /**
178
+ * `accent` → `colors.primary`, `radius` → every radius token (`radius.base`,
179
+ * `radius.card`, `radius.button`, `radius.input`), `font` → `font.body`.
180
+ * The single `radius` knob sets all four because the card, button and input
181
+ * radii are their own CSS variables (`--radius-card`, `--radius-button`,
182
+ * `--radius-input`) with fixed defaults, not derived from `--radius`: setting
183
+ * only the base would leave the node cards, buttons and inputs unchanged. Each value goes through the same validation as a host theme,
184
+ * and an invalid one is ignored (the viewer is public, so a crafted URL must
185
+ * not reach the document's styles).
186
+ */
187
+ function parseThemeTokens(params) {
188
+ const tokens = {};
189
+ const accentParam = params.get("accent")?.trim();
190
+ if (accentParam) {
191
+ const accent = sanitizeThemeValue("color", BARE_HEX.test(accentParam) ? `#${accentParam}` : accentParam);
192
+ if (accent) tokens.colors = { primary: accent };
193
+ }
194
+ const radius = sanitizeThemeValue("length", params.get("radius"));
195
+ if (radius) tokens.radius = {
196
+ base: radius,
197
+ card: radius,
198
+ button: radius,
199
+ input: radius
200
+ };
201
+ const font = sanitizeThemeValue("font", params.get("font"));
202
+ if (font) tokens.font = { body: font };
203
+ return tokens.colors || tokens.radius || tokens.font ? tokens : null;
204
+ }
205
+
206
+ // src/theme/useFluidGridsTheme.ts
207
+ /**
208
+ * Apply a {@link FluidGridsTheme} to the document while the calling component
209
+ * is mounted, and restore the previous look on unmount or change.
210
+ *
211
+ * Re-applies only when the theme's content changes, so passing a new inline
212
+ * object with the same values on every render is fine. Passing `undefined`
213
+ * applies nothing. See `applyFluidGridsTheme` for the document-wide scope.
214
+ */
215
+ function useFluidGridsTheme(theme) {
216
+ const key = themeKey(theme);
217
+ const [active, setActive] = useState(() => ({
218
+ key,
219
+ theme
220
+ }));
221
+ if (active.key !== key) setActive({
222
+ key,
223
+ theme
224
+ });
225
+ useEffect(() => {
226
+ if (!active.key) return void 0;
227
+ return applyFluidGridsTheme(active.theme);
228
+ }, [active]);
229
+ }
230
+
231
+ // src/pages/EmbedRunOverlay.tsx
232
+ function isRecord(value) {
233
+ return typeof value === "object" && value !== null && !Array.isArray(value);
234
+ }
235
+ function asString(value) {
236
+ return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
237
+ }
238
+ function asNumber(value) {
239
+ return typeof value === "number" && Number.isFinite(value) ? value : null;
240
+ }
241
+ function formatUsd(usd) {
242
+ if (usd === 0) return "$0.00";
243
+ if (usd < .01) return `$${usd.toFixed(4)}`;
244
+ return `$${usd.toFixed(2)}`;
245
+ }
246
+ function formatDuration(ms) {
247
+ if (ms < 1e3) return `${Math.round(ms)}ms`;
248
+ return `${(ms / 1e3).toFixed(1)}s`;
249
+ }
250
+ /**
251
+ * Defensively parses a sanitized demo run snapshot received over postMessage.
252
+ * Returns null if the payload is not a valid run object.
253
+ */
254
+ function parseEmbedRunSnapshot(raw) {
255
+ if (!isRecord(raw)) return null;
256
+ const runId = asString(raw.runId) ?? asString(raw.id);
257
+ const status = asString(raw.status) ?? "COMPLETED";
258
+ if (!runId) return null;
259
+ const rawSteps = Array.isArray(raw.steps) ? raw.steps : [];
260
+ const steps = [];
261
+ for (const item of rawSteps) {
262
+ if (!isRecord(item)) continue;
263
+ const label = asString(item.label) ?? asString(item.tool) ?? asString(item.kind) ?? `Step ${steps.length + 1}`;
264
+ const costUsd = asNumber(item.costUsd) ?? (asNumber(item.costMicroUsd) !== null ? asNumber(item.costMicroUsd) / 1e6 : null);
265
+ steps.push({
266
+ index: asNumber(item.index) ?? steps.length,
267
+ kind: asString(item.kind) ?? "step",
268
+ label,
269
+ tool: asString(item.tool),
270
+ model: asString(item.model),
271
+ status: asString(item.status),
272
+ summary: asString(item.summary),
273
+ durationMs: asNumber(item.durationMs),
274
+ costUsd
275
+ });
276
+ }
277
+ let cost = null;
278
+ if (isRecord(raw.cost)) {
279
+ const rawCalls = Array.isArray(raw.cost.calls) ? raw.cost.calls : [];
280
+ const calls = [];
281
+ for (const call of rawCalls) {
282
+ if (!isRecord(call)) continue;
283
+ const model = asString(call.model);
284
+ if (!model) continue;
285
+ const callCost = asNumber(call.costUsd) ?? (asNumber(call.costMicroUsd) !== null ? asNumber(call.costMicroUsd) / 1e6 : 0);
286
+ calls.push({
287
+ provider: asString(call.provider) ?? "unknown",
288
+ model,
289
+ promptTokens: asNumber(call.promptTokens) ?? 0,
290
+ completionTokens: asNumber(call.completionTokens) ?? 0,
291
+ costUsd: callCost
292
+ });
293
+ }
294
+ const totalCostUsd = asNumber(raw.cost.totalCostUsd) ?? (asNumber(raw.cost.totalCostMicroUsd) !== null ? asNumber(raw.cost.totalCostMicroUsd) / 1e6 : calls.reduce((acc, c) => acc + c.costUsd, 0));
295
+ const promptTokens = asNumber(raw.cost.promptTokens) ?? calls.reduce((acc, c) => acc + c.promptTokens, 0);
296
+ const completionTokens = asNumber(raw.cost.completionTokens) ?? calls.reduce((acc, c) => acc + c.completionTokens, 0);
297
+ cost = {
298
+ totalCostUsd,
299
+ totalTokens: asNumber(raw.cost.totalTokens) ?? promptTokens + completionTokens,
300
+ promptTokens,
301
+ completionTokens,
302
+ calls
303
+ };
304
+ }
305
+ let evaluation = null;
306
+ if (isRecord(raw.evaluation) && asNumber(raw.evaluation.score) !== null) evaluation = {
307
+ datasetName: asString(raw.evaluation.datasetName),
308
+ score: asNumber(raw.evaluation.score),
309
+ minScore: asNumber(raw.evaluation.minScore),
310
+ passed: Boolean(raw.evaluation.passed),
311
+ evaluatedAt: asString(raw.evaluation.evaluatedAt)
312
+ };
313
+ let guardrail = null;
314
+ if (isRecord(raw.guardrail) && asString(raw.guardrail.verdict)) guardrail = {
315
+ verdict: asString(raw.guardrail.verdict),
316
+ ruleName: asString(raw.guardrail.ruleName),
317
+ reason: asString(raw.guardrail.reason)
318
+ };
319
+ return {
320
+ runId,
321
+ workflowName: asString(raw.workflowName),
322
+ status,
323
+ startedAt: asString(raw.startedAt),
324
+ finishedAt: asString(raw.finishedAt),
325
+ durationMs: asNumber(raw.durationMs),
326
+ steps,
327
+ cost,
328
+ evaluation,
329
+ guardrail
330
+ };
331
+ }
332
+ /**
333
+ * Read-only run overlay rendered on WorkflowEmbedPage in postMessage mode
334
+ * (BOFF-10424). Shows agent trace steps, per-call AI cost, and optional eval
335
+ * and guardrail verdicts without exposing any mutation controls.
336
+ */
337
+ function EmbedRunOverlay({ run }) {
338
+ const [expanded, setExpanded] = useState(true);
339
+ const [activeTab, setActiveTab] = useState("trace");
340
+ return /* @__PURE__ */ jsxs("aside", {
341
+ "aria-label": "Run snapshot overlay",
342
+ "data-testid": "embed-run-overlay",
343
+ className: "absolute bottom-3 right-3 z-20 flex max-h-[70vh] w-[min(380px,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-lg border border-border bg-card/95 text-foreground shadow-lg backdrop-blur-sm",
344
+ children: [/* @__PURE__ */ jsxs("div", {
345
+ className: "flex items-center justify-between gap-2 border-b border-border px-3 py-2",
346
+ children: [/* @__PURE__ */ jsxs("div", {
347
+ className: "flex min-w-0 items-center gap-2",
348
+ children: [
349
+ /* @__PURE__ */ jsx(Icon, {
350
+ icon: "mdi:timeline-text-outline",
351
+ className: "size-4 shrink-0 text-primary"
352
+ }),
353
+ /* @__PURE__ */ jsx("span", {
354
+ className: "truncate text-xs font-semibold text-foreground",
355
+ children: "Run snapshot"
356
+ }),
357
+ /* @__PURE__ */ jsx("span", {
358
+ className: "rounded-full border border-border bg-muted px-1.5 py-0.5 font-mono text-[10px] text-foreground",
359
+ children: run.status
360
+ }),
361
+ run.durationMs !== null && run.durationMs !== void 0 && /* @__PURE__ */ jsx("span", {
362
+ className: "text-[11px] text-muted-foreground",
363
+ children: formatDuration(run.durationMs)
364
+ })
365
+ ]
366
+ }), /* @__PURE__ */ jsx("button", {
367
+ type: "button",
368
+ onClick: () => setExpanded((prev) => !prev),
369
+ "aria-expanded": expanded,
370
+ "aria-label": expanded ? "Collapse run overlay" : "Expand run overlay",
371
+ className: "rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground",
372
+ children: /* @__PURE__ */ jsx(Icon, {
373
+ icon: expanded ? "mdi:chevron-down" : "mdi:chevron-up",
374
+ className: "size-4"
375
+ })
376
+ })]
377
+ }), expanded && /* @__PURE__ */ jsxs("div", {
378
+ className: "flex min-h-0 flex-1 flex-col",
379
+ children: [
380
+ (run.evaluation || run.guardrail) && /* @__PURE__ */ jsxs("div", {
381
+ className: "flex flex-wrap gap-1.5 border-b border-border bg-muted/40 px-3 py-1.5 text-[11px]",
382
+ children: [run.evaluation && /* @__PURE__ */ jsxs("span", {
383
+ "data-testid": "embed-run-eval-badge",
384
+ className: `inline-flex items-center gap-1 rounded-full border px-2 py-0.5 font-medium ${run.evaluation.passed ? "border-[var(--color-status-success-border)] bg-[var(--color-status-success-bg)] text-[var(--color-status-success-text)]" : "border-[var(--color-status-error-border)] bg-[var(--color-status-error-bg)] text-[var(--color-status-error-text)]"}`,
385
+ children: [
386
+ "Eval ",
387
+ (run.evaluation.score * 100).toFixed(0),
388
+ "%",
389
+ run.evaluation.passed ? " passed" : " failed"
390
+ ]
391
+ }), run.guardrail && /* @__PURE__ */ jsxs("span", {
392
+ "data-testid": "embed-run-guardrail-badge",
393
+ className: "inline-flex items-center gap-1 rounded-full border border-border bg-card px-2 py-0.5 font-medium text-foreground",
394
+ children: ["Guardrail: ", run.guardrail.verdict]
395
+ })]
396
+ }),
397
+ /* @__PURE__ */ jsxs("div", {
398
+ role: "tablist",
399
+ "aria-label": "Run details tabs",
400
+ className: "flex gap-1 border-b border-border px-3 py-1.5",
401
+ children: [/* @__PURE__ */ jsxs("button", {
402
+ type: "button",
403
+ role: "tab",
404
+ "aria-selected": activeTab === "trace",
405
+ "data-testid": "embed-run-tab-trace",
406
+ onClick: () => setActiveTab("trace"),
407
+ className: `rounded px-2.5 py-1 text-xs font-medium transition-colors ${activeTab === "trace" ? "bg-primary text-primary-foreground" : "text-muted-foreground hover:bg-muted hover:text-foreground"}`,
408
+ children: [
409
+ "Trace (",
410
+ run.steps.length,
411
+ ")"
412
+ ]
413
+ }), /* @__PURE__ */ jsxs("button", {
414
+ type: "button",
415
+ role: "tab",
416
+ "aria-selected": activeTab === "cost",
417
+ "data-testid": "embed-run-tab-cost",
418
+ onClick: () => setActiveTab("cost"),
419
+ className: `rounded px-2.5 py-1 text-xs font-medium transition-colors ${activeTab === "cost" ? "bg-primary text-primary-foreground" : "text-muted-foreground hover:bg-muted hover:text-foreground"}`,
420
+ children: ["Cost ", run.cost ? `(${formatUsd(run.cost.totalCostUsd)})` : ""]
421
+ })]
422
+ }),
423
+ /* @__PURE__ */ jsx("div", {
424
+ className: "min-h-0 flex-1 overflow-y-auto p-3 text-xs",
425
+ children: activeTab === "trace" ? run.steps.length === 0 ? /* @__PURE__ */ jsx("p", {
426
+ className: "text-muted-foreground",
427
+ children: "No trace steps recorded in this snapshot."
428
+ }) : /* @__PURE__ */ jsx("ol", {
429
+ className: "space-y-2",
430
+ "data-testid": "embed-run-trace-list",
431
+ children: run.steps.map((step) => /* @__PURE__ */ jsxs("li", {
432
+ className: "rounded-md border border-border bg-background/60 p-2",
433
+ children: [
434
+ /* @__PURE__ */ jsxs("div", {
435
+ className: "flex items-center justify-between gap-2",
436
+ children: [/* @__PURE__ */ jsxs("span", {
437
+ className: "font-medium text-foreground",
438
+ children: [
439
+ step.index + 1,
440
+ ". ",
441
+ step.label
442
+ ]
443
+ }), /* @__PURE__ */ jsx("span", {
444
+ className: "rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",
445
+ children: step.kind
446
+ })]
447
+ }),
448
+ (step.model || step.tool || step.durationMs !== null) && /* @__PURE__ */ jsxs("div", {
449
+ className: "mt-1 flex flex-wrap gap-x-2 gap-y-0.5 text-[11px] text-muted-foreground",
450
+ children: [
451
+ step.model && /* @__PURE__ */ jsx("span", { children: step.model }),
452
+ step.tool && /* @__PURE__ */ jsxs("span", { children: ["tool: ", step.tool] }),
453
+ step.durationMs !== null && step.durationMs !== void 0 && /* @__PURE__ */ jsx("span", { children: formatDuration(step.durationMs) }),
454
+ step.costUsd !== null && step.costUsd !== void 0 && /* @__PURE__ */ jsx("span", { children: formatUsd(step.costUsd) })
455
+ ]
456
+ }),
457
+ step.summary && /* @__PURE__ */ jsx("p", {
458
+ className: "mt-1 whitespace-pre-wrap text-[11px] text-muted-foreground",
459
+ children: step.summary
460
+ })
461
+ ]
462
+ }, `${step.index}-${step.label}`))
463
+ }) : run.cost ? /* @__PURE__ */ jsxs("div", {
464
+ className: "space-y-2",
465
+ "data-testid": "embed-run-cost-panel",
466
+ children: [/* @__PURE__ */ jsxs("div", {
467
+ className: "grid grid-cols-2 gap-2 rounded-md border border-border bg-muted/40 p-2",
468
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
469
+ className: "text-[10px] uppercase tracking-wide text-muted-foreground",
470
+ children: "Total cost"
471
+ }), /* @__PURE__ */ jsx("div", {
472
+ className: "font-mono text-sm font-semibold text-foreground",
473
+ children: formatUsd(run.cost.totalCostUsd)
474
+ })] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
475
+ className: "text-[10px] uppercase tracking-wide text-muted-foreground",
476
+ children: "Total tokens"
477
+ }), /* @__PURE__ */ jsx("div", {
478
+ className: "font-mono text-sm font-semibold text-foreground",
479
+ children: run.cost.totalTokens.toLocaleString()
480
+ })] })]
481
+ }), run.cost.calls.length > 0 ? /* @__PURE__ */ jsx("ul", {
482
+ className: "space-y-1.5",
483
+ children: run.cost.calls.map((call, idx) => /* @__PURE__ */ jsxs("li", {
484
+ className: "flex items-center justify-between gap-2 rounded border border-border bg-background/60 px-2 py-1.5",
485
+ children: [/* @__PURE__ */ jsxs("div", {
486
+ className: "min-w-0",
487
+ children: [/* @__PURE__ */ jsx("div", {
488
+ className: "truncate font-mono text-[11px] font-medium text-foreground",
489
+ children: call.model
490
+ }), /* @__PURE__ */ jsxs("div", {
491
+ className: "text-[10px] text-muted-foreground",
492
+ children: [
493
+ call.provider,
494
+ " · ",
495
+ call.promptTokens,
496
+ " in /",
497
+ " ",
498
+ call.completionTokens,
499
+ " out"
500
+ ]
501
+ })]
502
+ }), /* @__PURE__ */ jsx("span", {
503
+ className: "shrink-0 font-mono text-[11px] text-foreground",
504
+ children: formatUsd(call.costUsd)
505
+ })]
506
+ }, `${call.provider}-${call.model}-${idx}`))
507
+ }) : /* @__PURE__ */ jsx("p", {
508
+ className: "text-muted-foreground",
509
+ children: "No per-call cost breakdown recorded."
510
+ })]
511
+ }) : /* @__PURE__ */ jsx("p", {
512
+ className: "text-muted-foreground",
513
+ children: "No AI cost data recorded in this snapshot."
514
+ })
515
+ })
516
+ ]
517
+ })]
518
+ });
519
+ }
520
+
521
+ // src/pages/WorkflowEmbed.tsx
522
+ /**
523
+ * WorkflowEmbedPage — public, read-only, chrome-less workflow viewer meant to
524
+ * be served from an iframe-able route (`/embed/workflow`) so any website can
525
+ * embed a FluidGrids workflow (n8n-demo style).
526
+ *
527
+ * Two ways to supply the workflow:
528
+ * 1. `?productId=<store product id>` — the page fetches the WORKFLOW store
529
+ * product's `content.definitionJson` from the global public gateway
530
+ * (the `product` query is `@rbac(public: true)`, no auth needed).
531
+ * 2. postMessage from the host page:
532
+ * { type: "fluidgrids:embed:openWorkflow",
533
+ * workflow: { name?, nodes, edges } }
534
+ * The page announces readiness with { type: "fluidgrids:embed:ready" }
535
+ * and reports { type: "fluidgrids:embed:loaded" | "fluidgrids:embed:error" }.
536
+ *
537
+ * Extra query params (parsed by `parseEmbedParams`):
538
+ * - `theme=light|dark` — force a theme without touching the visitor's stored
539
+ * preference (attributes are forced, never persisted).
540
+ * - `accent=<colour>` — primary colour (`2563eb`, `%232563eb`, `oklch(62% 0.2 250)`).
541
+ * - `radius=<length>` — corner radius (`8px`, `0.75rem`) for the base, card
542
+ * (node cards, panels), button and input radius tokens at once.
543
+ * - `font=<font-family>` — body font list (`Inter,sans-serif`).
544
+ * Token values are validated like a host theme; invalid ones are ignored.
545
+ * - `cta=false` — hide the "Use this template" button (productId mode only).
546
+ *
547
+ * Branding: every state of the viewer shows exactly one "Powered by
548
+ * FluidGrids" mark. The page draws it once, above every state (the read-only
549
+ * preview canvas, and the loading, error and waiting notes), since the
550
+ * preview canvas carries no mark of its own. Burdenoff does no
551
+ * white-labelling, so no parameter, prop or message hides it; the retired
552
+ * `badge=false` parameter is ignored.
553
+ *
554
+ * Security (BOFF-16941): the page is meant to be framed by any site, so it
555
+ * cannot allow-list parent origins. Instead it accepts messages only from the
556
+ * window that framed it (`event.source === window.parent`), so another frame
557
+ * or an opener cannot drive it, and it validates every workflow against the
558
+ * shape the read-only preview canvas draws, with size caps, before it reaches
559
+ * state (`parseEmbeddedWorkflow`). The canvas renders display-only JSON
560
+ * through React and never evaluates formulas or opens node configuration.
561
+ */
562
+ function WorkflowEmbedPage({ globalGraphqlUrl }) {
563
+ const params = useMemo(() => parseEmbedParams(window.location.search), []);
564
+ const { productId, showCta } = params;
565
+ const [workflow, setWorkflow] = useState(null);
566
+ const [runSnapshot, setRunSnapshot] = useState(null);
567
+ const [revision, setRevision] = useState(0);
568
+ const [loading, setLoading] = useState(Boolean(productId));
569
+ const [error, setError] = useState(null);
570
+ useFluidGridsTheme(embedTheme(params));
571
+ useEffect(() => {
572
+ const handler = (event) => {
573
+ if (!isMessageFromHost(event, window)) return;
574
+ const data = event.data;
575
+ if (data?.type === "fluidgrids:embed:setRun") {
576
+ setRunSnapshot(parseEmbedRunSnapshot(data.run));
577
+ return;
578
+ }
579
+ if (data?.type !== "fluidgrids:embed:openWorkflow") return;
580
+ const parsed = parseEmbeddedWorkflow(data.workflow);
581
+ if (!parsed.ok) {
582
+ postToParent({
583
+ type: "fluidgrids:embed:error",
584
+ message: parsed.message
585
+ });
586
+ return;
587
+ }
588
+ setWorkflow(parsed.workflow);
589
+ setRunSnapshot(parseEmbedRunSnapshot(data.run));
590
+ setRevision((r) => r + 1);
591
+ setError(null);
592
+ setLoading(false);
593
+ postToParent({
594
+ type: "fluidgrids:embed:loaded",
595
+ nodeCount: parsed.workflow.graph.nodes.length
596
+ });
597
+ };
598
+ window.addEventListener("message", handler);
599
+ postToParent({ type: "fluidgrids:embed:ready" });
600
+ return () => window.removeEventListener("message", handler);
601
+ }, []);
602
+ useEffect(() => {
603
+ if (!productId) return;
604
+ let mounted = true;
605
+ const load = async () => {
606
+ try {
607
+ if (!globalGraphqlUrl) throw new Error("Embed viewer is missing its gateway endpoint.");
608
+ const json = await (await fetch(globalGraphqlUrl, {
609
+ method: "POST",
610
+ headers: { "content-type": "application/json" },
611
+ body: JSON.stringify({
612
+ query: `query WorkflowEmbedProduct($id: ID!) {
613
+ product(id: $id) { id name description type content }
614
+ }`,
615
+ variables: { id: productId }
616
+ })
617
+ })).json();
618
+ if (json.errors?.length) throw new Error(json.errors[0]?.message ?? "Failed to load workflow");
619
+ const product = json.data?.product;
620
+ if (!product) throw new Error("Workflow not found.");
621
+ if (product.type && product.type !== "WORKFLOW") throw new Error("This store product is not a workflow.");
622
+ const graph = extractTemplateGraph(product.content);
623
+ if (!graph) throw new Error("This workflow has nothing to preview.");
624
+ if (!mounted) return;
625
+ setWorkflow({
626
+ name: product.name ?? "Workflow",
627
+ graph
628
+ });
629
+ setRevision((r) => r + 1);
630
+ setLoading(false);
631
+ postToParent({
632
+ type: "fluidgrids:embed:loaded",
633
+ nodeCount: graph.nodes.length
634
+ });
635
+ } catch (e) {
636
+ if (!mounted) return;
637
+ const message = e instanceof Error ? e.message : "Failed to load workflow.";
638
+ setError(message);
639
+ setLoading(false);
640
+ postToParent({
641
+ type: "fluidgrids:embed:error",
642
+ message
643
+ });
644
+ }
645
+ };
646
+ load();
647
+ return () => {
648
+ mounted = false;
649
+ };
650
+ }, [productId, globalGraphqlUrl]);
651
+ const openInAppUrl = productId ? `${window.location.origin}/workflows/templates/${encodeURIComponent(productId)}/preview` : null;
652
+ return /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsxs("div", {
653
+ className: "relative h-screen w-screen overflow-hidden bg-background",
654
+ children: [
655
+ /* @__PURE__ */ jsx(FluidGridsMark, {}),
656
+ /* @__PURE__ */ jsx(ErrorBoundary, {
657
+ fallback: () => /* @__PURE__ */ jsx(CenteredNote, {
658
+ icon: "mdi:alert-circle-outline",
659
+ text: "Something went wrong rendering this workflow."
660
+ }),
661
+ children: loading ? /* @__PURE__ */ jsx(CenteredNote, {
662
+ icon: "svg-spinners:ring-resize",
663
+ text: "Loading workflow…"
664
+ }) : error ? /* @__PURE__ */ jsx(CenteredNote, {
665
+ icon: "mdi:alert-circle-outline",
666
+ text: error
667
+ }) : workflow ? /* @__PURE__ */ jsx(WorkflowPreviewCanvas, {
668
+ definition: workflow.graph,
669
+ ariaLabel: workflow.name,
670
+ ...EMBED_CANVAS_PROPS
671
+ }, revision) : /* @__PURE__ */ jsx(CenteredNote, {
672
+ icon: "mdi:sitemap-outline",
673
+ text: "Waiting for a workflow…"
674
+ })
675
+ }),
676
+ showCta && openInAppUrl && workflow ? /* @__PURE__ */ jsxs("a", {
677
+ href: openInAppUrl,
678
+ target: "_blank",
679
+ rel: "noopener noreferrer",
680
+ className: "absolute left-3 top-3 z-10 flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground shadow-sm transition-opacity hover:opacity-90",
681
+ children: [/* @__PURE__ */ jsx(Icon, {
682
+ icon: "mdi:plus",
683
+ className: "size-3.5"
684
+ }), "Use this template"]
685
+ }) : null,
686
+ workflow && runSnapshot ? /* @__PURE__ */ jsx(EmbedRunOverlay, { run: runSnapshot }) : null
687
+ ]
688
+ }) });
689
+ }
690
+ /** A full-page status note for the states that have no canvas. */
691
+ function CenteredNote({ icon, text }) {
692
+ return /* @__PURE__ */ jsxs("div", {
693
+ className: "flex h-full flex-col items-center justify-center gap-2 p-8 text-center",
694
+ children: [/* @__PURE__ */ jsx(Icon, {
695
+ icon,
696
+ className: "size-6 text-muted-foreground"
697
+ }), /* @__PURE__ */ jsx("p", {
698
+ className: "text-sm text-muted-foreground",
699
+ children: text
700
+ })]
701
+ });
702
+ }
703
+ function postToParent(payload) {
704
+ if (window.parent === window) return;
705
+ window.parent.postMessage(payload, "*");
706
+ }
707
+
708
+ export { useFluidGridsTheme as n, WorkflowEmbedPage as t };