@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,3251 @@
1
+ "use client";
2
+ import { t as __exportAll } from "./rolldown-runtime-hDbaFkMy.js";
3
+ import { t as OfflineIcon } from "./OfflineIcon-TwMKYWjA.js";
4
+ import { c as useDuplicateWorkflow, g as useWorkflowDefinitions, u as useLazyWorkflowDefinition } from "./useWorkflows-Cvg-Z_IE.js";
5
+ import { C as storeContextHeaders, a as sortOptions, c as withGalleryState, i as sortLabel, l as useTemplateImportFlow, m as useWorkflowTemplates, n as effectiveSort, o as storeCategoryLabel, r as readGalleryUrl, s as storeSortBy, t as StoreTemplateCardCompact, w as BrowseWorkflowTemplatesDocument } from "./StoreTemplateCardCompact-CHn5kP7A.js";
6
+ import { n as FluidGridsContext, t as useFluidGridsAnalytics } from "./useFluidGridsAnalytics-VM8lAi2x.js";
7
+ import { r as getFluidGridsConfig } from "./config-DO68jw5k.js";
8
+ import { t as useGlobalStoreClient } from "./useGlobalStoreClient-BTdhkA2I.js";
9
+ import { RU as WorkflowStatus, YH as WorkflowExportFormat } from "./graphql-types-UTYtujY9.js";
10
+ import { i as SdkPermissionButton, t as FLUIDGRIDS_PERMISSIONS } from "./constants-DlRnHBfQ.js";
11
+ import { t as Card$1 } from "./card-Bomy_1UG.js";
12
+ import { t as Button$2 } from "./button-DG7y_FVJ.js";
13
+ import { t as Badge$1 } from "./badge-CXfPhoMH.js";
14
+ import { t as cn } from "./cn-QqidFIgr.js";
15
+ import { r as useTr } from "./TranslationBridge-Da-TPgQm.js";
16
+ import { t as templatePreviewCandidates } from "./template-preview-DcIIKOOL.js";
17
+ import { t as StoreIcon } from "./store-icon-OctYp5zP.js";
18
+ import { n as isPaidTemplate, t as formatTemplatePrice } from "./template-price-CdUHZRMF.js";
19
+ import { n as useNavigationV2 } from "./useNavigationV2-C2WeqN7d.js";
20
+ import { i as CreateWorkflowRefusalDialog, t as fetchWorkflowCodeExport } from "./useWorkflowCodeExport-pqxyLHD1.js";
21
+ import { o as emitTemplateUsed } from "./fluidgridsEvents-bbEQbwU6.js";
22
+ import { n as useFluidGridsPageControls } from "./pageControlsBridge-0pX9s-3k.js";
23
+ import { r as templatesControls } from "./pageControlSpecs-DZJ9K37m.js";
24
+ import { l as findQuotaRefusal, n as BILLING_PLANS_PATH } from "./quota-DeA_CJ2e.js";
25
+ import { a as refusalOfQuota } from "./create-workflow-first-Azg3JUdX.js";
26
+ import { t as FluidGridsDocsLink } from "./FluidGridsDocsLink-bX0Hnhxr.js";
27
+ import { c as StoreTemplateCardSkeleton, i as PageIntro, l as TemplateCardsSkeleton, r as GalleryChipsSkeleton } from "./parts-B7fBcw-B.js";
28
+ import { _ as usePhaseDFlags } from "./feature-flags-B2qetXKd.js";
29
+ import { t as fetchWorkflowCodeSource } from "./use-workflow-code-editor-CFoRFrZ5.js";
30
+ import { t as fetchConnectionNames } from "./useConnections-DsgEJs05.js";
31
+ import { d as isLosslessReport } from "./workflow-code-transfer-Bsy0JKAZ.js";
32
+ import { a as contentTypeOf, n as TemplateCodeError, o as isTier2Definition, r as assertTemplateSources, t as TEMPLATE_SOURCES_MAX_BYTES } from "./template-code-CzN6JWNV.js";
33
+ import { s as throwIfResultError, t as describeOperationError } from "./errors-ClKb5sEt.js";
34
+ import { n as formatRunVersion } from "./run-display-UjLAoYqQ.js";
35
+ import { t as NodeTypeIcon } from "./node-type-icon-BZa8n4iG.js";
36
+ import { t as TechnicalDetails } from "./TechnicalDetails-B0Oi4aZw.js";
37
+ import { t as PaidTemplateConfirm } from "./PaidTemplateConfirm-_G3ag6S4.js";
38
+ import { n as CATALOG_GRID_COLUMNS, t as BIG_SCREEN_LARGE_CARD_COLUMNS } from "./catalogGrid-BOrfMgi-.js";
39
+ import { r as useFgAskAssistant } from "./askAboutBridge-ByYsQams.js";
40
+ import { l as StatePanel } from "./results-CwK_yDxK.js";
41
+ import { t as HeldLoadRegion } from "./HeldLoadRegion-BtTxbvOW.js";
42
+ import { useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
43
+ import { useNavigate, useSearchParams } from "react-router";
44
+ import { useQuery } from "@apollo/client/react";
45
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
46
+ import { AlertCircle, ArrowUpDown, ChevronDown, Download, Eye, Search, Sparkles, Star } from "lucide-react";
47
+ import { toast } from "sonner";
48
+ import { Badge, Card, CardHeader, Checkbox, CompactMarkOr, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger, EmptyState, GALLERY_PAGE_SIZE, GalleryCategoryRail, GalleryPager, Input, Label, LoadRegion, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Skeleton, TOP_CATEGORY_COUNT, Textarea, clampPage, pageRange, totalPagesFor, useLoadingSystem } from "@burdenoff/fe-libs/ui";
49
+ import { gql } from "@apollo/client";
50
+ import { Button as Button$1 } from "@burdenoff/fe-libs/button";
51
+ import { v4 } from "uuid";
52
+
53
+ // src/generated/documents/global/SubmitWorkflowTemplateDocument.ts
54
+ const SubmitWorkflowTemplateDocument = {
55
+ "kind": "Document",
56
+ "definitions": [{
57
+ "kind": "OperationDefinition",
58
+ "operation": "mutation",
59
+ "name": {
60
+ "kind": "Name",
61
+ "value": "SubmitWorkflowTemplate"
62
+ },
63
+ "variableDefinitions": [{
64
+ "kind": "VariableDefinition",
65
+ "variable": {
66
+ "kind": "Variable",
67
+ "name": {
68
+ "kind": "Name",
69
+ "value": "input"
70
+ }
71
+ },
72
+ "type": {
73
+ "kind": "NonNullType",
74
+ "type": {
75
+ "kind": "NamedType",
76
+ "name": {
77
+ "kind": "Name",
78
+ "value": "SubmitWorkflowTemplateInput"
79
+ }
80
+ }
81
+ },
82
+ "directives": []
83
+ }],
84
+ "directives": [],
85
+ "selectionSet": {
86
+ "kind": "SelectionSet",
87
+ "selections": [{
88
+ "kind": "Field",
89
+ "name": {
90
+ "kind": "Name",
91
+ "value": "submitWorkflowTemplate"
92
+ },
93
+ "arguments": [{
94
+ "kind": "Argument",
95
+ "name": {
96
+ "kind": "Name",
97
+ "value": "input"
98
+ },
99
+ "value": {
100
+ "kind": "Variable",
101
+ "name": {
102
+ "kind": "Name",
103
+ "value": "input"
104
+ }
105
+ }
106
+ }],
107
+ "directives": [],
108
+ "selectionSet": {
109
+ "kind": "SelectionSet",
110
+ "selections": [
111
+ {
112
+ "kind": "Field",
113
+ "name": {
114
+ "kind": "Name",
115
+ "value": "id"
116
+ },
117
+ "arguments": [],
118
+ "directives": []
119
+ },
120
+ {
121
+ "kind": "Field",
122
+ "name": {
123
+ "kind": "Name",
124
+ "value": "slug"
125
+ },
126
+ "arguments": [],
127
+ "directives": []
128
+ },
129
+ {
130
+ "kind": "Field",
131
+ "name": {
132
+ "kind": "Name",
133
+ "value": "name"
134
+ },
135
+ "arguments": [],
136
+ "directives": []
137
+ },
138
+ {
139
+ "kind": "Field",
140
+ "name": {
141
+ "kind": "Name",
142
+ "value": "description"
143
+ },
144
+ "arguments": [],
145
+ "directives": []
146
+ },
147
+ {
148
+ "kind": "Field",
149
+ "name": {
150
+ "kind": "Name",
151
+ "value": "category"
152
+ },
153
+ "arguments": [],
154
+ "directives": []
155
+ },
156
+ {
157
+ "kind": "Field",
158
+ "name": {
159
+ "kind": "Name",
160
+ "value": "tags"
161
+ },
162
+ "arguments": [],
163
+ "directives": []
164
+ },
165
+ {
166
+ "kind": "Field",
167
+ "name": {
168
+ "kind": "Name",
169
+ "value": "icon"
170
+ },
171
+ "arguments": [],
172
+ "directives": []
173
+ },
174
+ {
175
+ "kind": "Field",
176
+ "name": {
177
+ "kind": "Name",
178
+ "value": "status"
179
+ },
180
+ "arguments": [],
181
+ "directives": []
182
+ },
183
+ {
184
+ "kind": "Field",
185
+ "name": {
186
+ "kind": "Name",
187
+ "value": "version"
188
+ },
189
+ "arguments": [],
190
+ "directives": []
191
+ },
192
+ {
193
+ "kind": "Field",
194
+ "name": {
195
+ "kind": "Name",
196
+ "value": "revision"
197
+ },
198
+ "arguments": [],
199
+ "directives": []
200
+ },
201
+ {
202
+ "kind": "Field",
203
+ "name": {
204
+ "kind": "Name",
205
+ "value": "authorName"
206
+ },
207
+ "arguments": [],
208
+ "directives": []
209
+ },
210
+ {
211
+ "kind": "Field",
212
+ "name": {
213
+ "kind": "Name",
214
+ "value": "sourceWorkflowKey"
215
+ },
216
+ "arguments": [],
217
+ "directives": []
218
+ },
219
+ {
220
+ "kind": "Field",
221
+ "name": {
222
+ "kind": "Name",
223
+ "value": "sourceWorkflowVersion"
224
+ },
225
+ "arguments": [],
226
+ "directives": []
227
+ },
228
+ {
229
+ "kind": "Field",
230
+ "name": {
231
+ "kind": "Name",
232
+ "value": "nodeCount"
233
+ },
234
+ "arguments": [],
235
+ "directives": []
236
+ },
237
+ {
238
+ "kind": "Field",
239
+ "name": {
240
+ "kind": "Name",
241
+ "value": "submittedAt"
242
+ },
243
+ "arguments": [],
244
+ "directives": []
245
+ },
246
+ {
247
+ "kind": "Field",
248
+ "name": {
249
+ "kind": "Name",
250
+ "value": "reviewedAt"
251
+ },
252
+ "arguments": [],
253
+ "directives": []
254
+ },
255
+ {
256
+ "kind": "Field",
257
+ "name": {
258
+ "kind": "Name",
259
+ "value": "reviewNotes"
260
+ },
261
+ "arguments": [],
262
+ "directives": []
263
+ },
264
+ {
265
+ "kind": "Field",
266
+ "name": {
267
+ "kind": "Name",
268
+ "value": "rejectedReason"
269
+ },
270
+ "arguments": [],
271
+ "directives": []
272
+ },
273
+ {
274
+ "kind": "Field",
275
+ "name": {
276
+ "kind": "Name",
277
+ "value": "publishedAt"
278
+ },
279
+ "arguments": [],
280
+ "directives": []
281
+ },
282
+ {
283
+ "kind": "Field",
284
+ "name": {
285
+ "kind": "Name",
286
+ "value": "downloads"
287
+ },
288
+ "arguments": [],
289
+ "directives": []
290
+ },
291
+ {
292
+ "kind": "Field",
293
+ "name": {
294
+ "kind": "Name",
295
+ "value": "code"
296
+ },
297
+ "arguments": [],
298
+ "directives": [],
299
+ "selectionSet": {
300
+ "kind": "SelectionSet",
301
+ "selections": [
302
+ {
303
+ "kind": "Field",
304
+ "name": {
305
+ "kind": "Name",
306
+ "value": "tier"
307
+ },
308
+ "arguments": [],
309
+ "directives": []
310
+ },
311
+ {
312
+ "kind": "Field",
313
+ "name": {
314
+ "kind": "Name",
315
+ "value": "format"
316
+ },
317
+ "arguments": [],
318
+ "directives": []
319
+ },
320
+ {
321
+ "kind": "Field",
322
+ "name": {
323
+ "kind": "Name",
324
+ "value": "fileCount"
325
+ },
326
+ "arguments": [],
327
+ "directives": []
328
+ },
329
+ {
330
+ "kind": "Field",
331
+ "name": {
332
+ "kind": "Name",
333
+ "value": "bytes"
334
+ },
335
+ "arguments": [],
336
+ "directives": []
337
+ }
338
+ ]
339
+ }
340
+ },
341
+ {
342
+ "kind": "Field",
343
+ "name": {
344
+ "kind": "Name",
345
+ "value": "createdAt"
346
+ },
347
+ "arguments": [],
348
+ "directives": []
349
+ },
350
+ {
351
+ "kind": "Field",
352
+ "name": {
353
+ "kind": "Name",
354
+ "value": "updatedAt"
355
+ },
356
+ "arguments": [],
357
+ "directives": []
358
+ }
359
+ ]
360
+ }
361
+ }]
362
+ }
363
+ }]
364
+ };
365
+
366
+ // src/generated/documents/global/WithdrawWorkflowTemplateSubmissionDocument.ts
367
+ const WithdrawWorkflowTemplateSubmissionDocument = {
368
+ "kind": "Document",
369
+ "definitions": [{
370
+ "kind": "OperationDefinition",
371
+ "operation": "mutation",
372
+ "name": {
373
+ "kind": "Name",
374
+ "value": "WithdrawWorkflowTemplateSubmission"
375
+ },
376
+ "variableDefinitions": [{
377
+ "kind": "VariableDefinition",
378
+ "variable": {
379
+ "kind": "Variable",
380
+ "name": {
381
+ "kind": "Name",
382
+ "value": "id"
383
+ }
384
+ },
385
+ "type": {
386
+ "kind": "NonNullType",
387
+ "type": {
388
+ "kind": "NamedType",
389
+ "name": {
390
+ "kind": "Name",
391
+ "value": "ID"
392
+ }
393
+ }
394
+ },
395
+ "directives": []
396
+ }],
397
+ "directives": [],
398
+ "selectionSet": {
399
+ "kind": "SelectionSet",
400
+ "selections": [{
401
+ "kind": "Field",
402
+ "name": {
403
+ "kind": "Name",
404
+ "value": "withdrawWorkflowTemplateSubmission"
405
+ },
406
+ "arguments": [{
407
+ "kind": "Argument",
408
+ "name": {
409
+ "kind": "Name",
410
+ "value": "id"
411
+ },
412
+ "value": {
413
+ "kind": "Variable",
414
+ "name": {
415
+ "kind": "Name",
416
+ "value": "id"
417
+ }
418
+ }
419
+ }],
420
+ "directives": [],
421
+ "selectionSet": {
422
+ "kind": "SelectionSet",
423
+ "selections": [
424
+ {
425
+ "kind": "Field",
426
+ "name": {
427
+ "kind": "Name",
428
+ "value": "id"
429
+ },
430
+ "arguments": [],
431
+ "directives": []
432
+ },
433
+ {
434
+ "kind": "Field",
435
+ "name": {
436
+ "kind": "Name",
437
+ "value": "removed"
438
+ },
439
+ "arguments": [],
440
+ "directives": []
441
+ },
442
+ {
443
+ "kind": "Field",
444
+ "name": {
445
+ "kind": "Name",
446
+ "value": "status"
447
+ },
448
+ "arguments": [],
449
+ "directives": []
450
+ }
451
+ ]
452
+ }
453
+ }]
454
+ }
455
+ }]
456
+ };
457
+
458
+ // src/generated/documents/global/MyWorkflowTemplateSubmissionsDocument.ts
459
+ const MyWorkflowTemplateSubmissionsDocument = {
460
+ "kind": "Document",
461
+ "definitions": [{
462
+ "kind": "OperationDefinition",
463
+ "operation": "query",
464
+ "name": {
465
+ "kind": "Name",
466
+ "value": "MyWorkflowTemplateSubmissions"
467
+ },
468
+ "variableDefinitions": [
469
+ {
470
+ "kind": "VariableDefinition",
471
+ "variable": {
472
+ "kind": "Variable",
473
+ "name": {
474
+ "kind": "Name",
475
+ "value": "status"
476
+ }
477
+ },
478
+ "type": {
479
+ "kind": "NamedType",
480
+ "name": {
481
+ "kind": "Name",
482
+ "value": "ProductStatus"
483
+ }
484
+ },
485
+ "directives": []
486
+ },
487
+ {
488
+ "kind": "VariableDefinition",
489
+ "variable": {
490
+ "kind": "Variable",
491
+ "name": {
492
+ "kind": "Name",
493
+ "value": "limit"
494
+ }
495
+ },
496
+ "type": {
497
+ "kind": "NamedType",
498
+ "name": {
499
+ "kind": "Name",
500
+ "value": "Int"
501
+ }
502
+ },
503
+ "directives": []
504
+ },
505
+ {
506
+ "kind": "VariableDefinition",
507
+ "variable": {
508
+ "kind": "Variable",
509
+ "name": {
510
+ "kind": "Name",
511
+ "value": "offset"
512
+ }
513
+ },
514
+ "type": {
515
+ "kind": "NamedType",
516
+ "name": {
517
+ "kind": "Name",
518
+ "value": "Int"
519
+ }
520
+ },
521
+ "directives": []
522
+ }
523
+ ],
524
+ "directives": [],
525
+ "selectionSet": {
526
+ "kind": "SelectionSet",
527
+ "selections": [{
528
+ "kind": "Field",
529
+ "name": {
530
+ "kind": "Name",
531
+ "value": "myWorkflowTemplateSubmissions"
532
+ },
533
+ "arguments": [
534
+ {
535
+ "kind": "Argument",
536
+ "name": {
537
+ "kind": "Name",
538
+ "value": "status"
539
+ },
540
+ "value": {
541
+ "kind": "Variable",
542
+ "name": {
543
+ "kind": "Name",
544
+ "value": "status"
545
+ }
546
+ }
547
+ },
548
+ {
549
+ "kind": "Argument",
550
+ "name": {
551
+ "kind": "Name",
552
+ "value": "limit"
553
+ },
554
+ "value": {
555
+ "kind": "Variable",
556
+ "name": {
557
+ "kind": "Name",
558
+ "value": "limit"
559
+ }
560
+ }
561
+ },
562
+ {
563
+ "kind": "Argument",
564
+ "name": {
565
+ "kind": "Name",
566
+ "value": "offset"
567
+ },
568
+ "value": {
569
+ "kind": "Variable",
570
+ "name": {
571
+ "kind": "Name",
572
+ "value": "offset"
573
+ }
574
+ }
575
+ }
576
+ ],
577
+ "directives": [],
578
+ "selectionSet": {
579
+ "kind": "SelectionSet",
580
+ "selections": [{
581
+ "kind": "Field",
582
+ "name": {
583
+ "kind": "Name",
584
+ "value": "totalCount"
585
+ },
586
+ "arguments": [],
587
+ "directives": []
588
+ }, {
589
+ "kind": "Field",
590
+ "name": {
591
+ "kind": "Name",
592
+ "value": "items"
593
+ },
594
+ "arguments": [],
595
+ "directives": [],
596
+ "selectionSet": {
597
+ "kind": "SelectionSet",
598
+ "selections": [
599
+ {
600
+ "kind": "Field",
601
+ "name": {
602
+ "kind": "Name",
603
+ "value": "id"
604
+ },
605
+ "arguments": [],
606
+ "directives": []
607
+ },
608
+ {
609
+ "kind": "Field",
610
+ "name": {
611
+ "kind": "Name",
612
+ "value": "slug"
613
+ },
614
+ "arguments": [],
615
+ "directives": []
616
+ },
617
+ {
618
+ "kind": "Field",
619
+ "name": {
620
+ "kind": "Name",
621
+ "value": "name"
622
+ },
623
+ "arguments": [],
624
+ "directives": []
625
+ },
626
+ {
627
+ "kind": "Field",
628
+ "name": {
629
+ "kind": "Name",
630
+ "value": "description"
631
+ },
632
+ "arguments": [],
633
+ "directives": []
634
+ },
635
+ {
636
+ "kind": "Field",
637
+ "name": {
638
+ "kind": "Name",
639
+ "value": "category"
640
+ },
641
+ "arguments": [],
642
+ "directives": []
643
+ },
644
+ {
645
+ "kind": "Field",
646
+ "name": {
647
+ "kind": "Name",
648
+ "value": "tags"
649
+ },
650
+ "arguments": [],
651
+ "directives": []
652
+ },
653
+ {
654
+ "kind": "Field",
655
+ "name": {
656
+ "kind": "Name",
657
+ "value": "icon"
658
+ },
659
+ "arguments": [],
660
+ "directives": []
661
+ },
662
+ {
663
+ "kind": "Field",
664
+ "name": {
665
+ "kind": "Name",
666
+ "value": "status"
667
+ },
668
+ "arguments": [],
669
+ "directives": []
670
+ },
671
+ {
672
+ "kind": "Field",
673
+ "name": {
674
+ "kind": "Name",
675
+ "value": "version"
676
+ },
677
+ "arguments": [],
678
+ "directives": []
679
+ },
680
+ {
681
+ "kind": "Field",
682
+ "name": {
683
+ "kind": "Name",
684
+ "value": "revision"
685
+ },
686
+ "arguments": [],
687
+ "directives": []
688
+ },
689
+ {
690
+ "kind": "Field",
691
+ "name": {
692
+ "kind": "Name",
693
+ "value": "authorName"
694
+ },
695
+ "arguments": [],
696
+ "directives": []
697
+ },
698
+ {
699
+ "kind": "Field",
700
+ "name": {
701
+ "kind": "Name",
702
+ "value": "sourceWorkflowKey"
703
+ },
704
+ "arguments": [],
705
+ "directives": []
706
+ },
707
+ {
708
+ "kind": "Field",
709
+ "name": {
710
+ "kind": "Name",
711
+ "value": "sourceWorkflowVersion"
712
+ },
713
+ "arguments": [],
714
+ "directives": []
715
+ },
716
+ {
717
+ "kind": "Field",
718
+ "name": {
719
+ "kind": "Name",
720
+ "value": "nodeCount"
721
+ },
722
+ "arguments": [],
723
+ "directives": []
724
+ },
725
+ {
726
+ "kind": "Field",
727
+ "name": {
728
+ "kind": "Name",
729
+ "value": "submittedAt"
730
+ },
731
+ "arguments": [],
732
+ "directives": []
733
+ },
734
+ {
735
+ "kind": "Field",
736
+ "name": {
737
+ "kind": "Name",
738
+ "value": "reviewedAt"
739
+ },
740
+ "arguments": [],
741
+ "directives": []
742
+ },
743
+ {
744
+ "kind": "Field",
745
+ "name": {
746
+ "kind": "Name",
747
+ "value": "reviewNotes"
748
+ },
749
+ "arguments": [],
750
+ "directives": []
751
+ },
752
+ {
753
+ "kind": "Field",
754
+ "name": {
755
+ "kind": "Name",
756
+ "value": "rejectedReason"
757
+ },
758
+ "arguments": [],
759
+ "directives": []
760
+ },
761
+ {
762
+ "kind": "Field",
763
+ "name": {
764
+ "kind": "Name",
765
+ "value": "publishedAt"
766
+ },
767
+ "arguments": [],
768
+ "directives": []
769
+ },
770
+ {
771
+ "kind": "Field",
772
+ "name": {
773
+ "kind": "Name",
774
+ "value": "downloads"
775
+ },
776
+ "arguments": [],
777
+ "directives": []
778
+ },
779
+ {
780
+ "kind": "Field",
781
+ "name": {
782
+ "kind": "Name",
783
+ "value": "code"
784
+ },
785
+ "arguments": [],
786
+ "directives": [],
787
+ "selectionSet": {
788
+ "kind": "SelectionSet",
789
+ "selections": [
790
+ {
791
+ "kind": "Field",
792
+ "name": {
793
+ "kind": "Name",
794
+ "value": "tier"
795
+ },
796
+ "arguments": [],
797
+ "directives": []
798
+ },
799
+ {
800
+ "kind": "Field",
801
+ "name": {
802
+ "kind": "Name",
803
+ "value": "format"
804
+ },
805
+ "arguments": [],
806
+ "directives": []
807
+ },
808
+ {
809
+ "kind": "Field",
810
+ "name": {
811
+ "kind": "Name",
812
+ "value": "fileCount"
813
+ },
814
+ "arguments": [],
815
+ "directives": []
816
+ },
817
+ {
818
+ "kind": "Field",
819
+ "name": {
820
+ "kind": "Name",
821
+ "value": "bytes"
822
+ },
823
+ "arguments": [],
824
+ "directives": []
825
+ }
826
+ ]
827
+ }
828
+ },
829
+ {
830
+ "kind": "Field",
831
+ "name": {
832
+ "kind": "Name",
833
+ "value": "createdAt"
834
+ },
835
+ "arguments": [],
836
+ "directives": []
837
+ },
838
+ {
839
+ "kind": "Field",
840
+ "name": {
841
+ "kind": "Name",
842
+ "value": "updatedAt"
843
+ },
844
+ "arguments": [],
845
+ "directives": []
846
+ }
847
+ ]
848
+ }
849
+ }]
850
+ }
851
+ }]
852
+ }
853
+ }]
854
+ };
855
+
856
+ // src/hooks/store/useWorkflowTemplatesPage.ts
857
+ /**
858
+ * One numbered page of the Store's workflow templates (BOFF-14754).
859
+ *
860
+ * The Templates gallery pages by number (`offset = (page - 1) * pageSize`)
861
+ * instead of appending "Load more" results, so each page is its own query.
862
+ * While the next page loads the previous page stays in `templates` (Apollo's
863
+ * `previousData`) and `pageLoading` is true, so the grid dims instead of
864
+ * emptying. `useWorkflowTemplates` keeps its append-style behaviour for the
865
+ * builder's template picker.
866
+ */
867
+ function useWorkflowTemplatesPage({ search, category, sortBy, page, pageSize, enabled }) {
868
+ const client = useGlobalStoreClient();
869
+ const context = useContext(FluidGridsContext);
870
+ const workspaceId = context?.workspaceId ?? getFluidGridsConfig().workspaceId;
871
+ const organizationId = context?.organizationId;
872
+ const headers = useMemo(() => {
873
+ const value = {};
874
+ if (organizationId) value["x-organization-id"] = organizationId;
875
+ if (workspaceId) value["x-workspace-id"] = workspaceId;
876
+ return value;
877
+ }, [organizationId, workspaceId]);
878
+ const searchTerm = search?.trim() || void 0;
879
+ const { data, previousData, loading, error, refetch } = useQuery(BrowseWorkflowTemplatesDocument, {
880
+ client,
881
+ variables: { input: {
882
+ filter: {
883
+ type: "WORKFLOW",
884
+ status: "PUBLISHED",
885
+ search: searchTerm,
886
+ ...category ? { category } : {}
887
+ },
888
+ pagination: {
889
+ limit: pageSize,
890
+ offset: (Math.max(1, page) - 1) * pageSize
891
+ },
892
+ sortBy
893
+ } },
894
+ fetchPolicy: "cache-and-network",
895
+ skip: !enabled,
896
+ context: Object.keys(headers).length > 0 ? { headers } : void 0
897
+ });
898
+ const shown = data ?? previousData;
899
+ return {
900
+ templates: shown?.browseStore?.products ?? [],
901
+ totalCount: shown?.browseStore?.totalCount ?? 0,
902
+ /** A page has arrived at least once (this one or the one before it). */
903
+ hasData: shown !== void 0,
904
+ /** This page is still loading; `templates` holds the previous page. */
905
+ pageLoading: loading && data === void 0,
906
+ loading,
907
+ error,
908
+ refetch
909
+ };
910
+ }
911
+
912
+ // src/hooks/store/usePublishToStore.ts
913
+ /** Categories a community template can be filed under (matches the store). */
914
+ const TEMPLATE_STORE_CATEGORIES = [
915
+ "automation",
916
+ "integration",
917
+ "data-processing",
918
+ "ai-ml",
919
+ "communication",
920
+ "devops",
921
+ "marketing",
922
+ "sales",
923
+ "support",
924
+ "productivity",
925
+ "finance"
926
+ ];
927
+ /**
928
+ * Publish a workspace workflow to the public store as a community template
929
+ * (BOFF-4316).
930
+ *
931
+ * The workflow's definitionJson is sent as read from the workflow service,
932
+ * which already masks literal secrets. The store removes connection bindings,
933
+ * pinned run data and any remaining secrets, builds the manifest and puts the
934
+ * template into review; a store admin approves or rejects it.
935
+ *
936
+ * With `code` the template also carries the workflow as code (G22). The
937
+ * workspace context goes with the request, because the store checks the
938
+ * workspace's code-first flags before it accepts code.
939
+ */
940
+ function usePublishToStore() {
941
+ const [publishing, setPublishing] = useState(false);
942
+ const [error, setError] = useState(null);
943
+ const globalClient = useGlobalStoreClient();
944
+ const context = useContext(FluidGridsContext);
945
+ const workspaceId = context?.workspaceId ?? getFluidGridsConfig().workspaceId;
946
+ const organizationId = context?.organizationId;
947
+ return {
948
+ publishToStore: useCallback(async (input) => {
949
+ setPublishing(true);
950
+ setError(null);
951
+ try {
952
+ const { workflow } = input;
953
+ const submission = throwIfResultError(await globalClient.mutate({
954
+ mutation: SubmitWorkflowTemplateDocument,
955
+ variables: { input: {
956
+ productId: input.productId,
957
+ name: (input.name || workflow.name).trim(),
958
+ description: (input.description || workflow.description || "").trim(),
959
+ longDescription: input.longDescription?.trim() || void 0,
960
+ category: input.category,
961
+ tags: input.tags ?? workflow.tags ?? [],
962
+ icon: workflow.icon || void 0,
963
+ definitionJson: workflow.definitionJson,
964
+ sourceWorkflowKey: workflow.workflowKey,
965
+ sourceWorkflowVersion: workflow.version,
966
+ authorName: input.authorName?.trim() || void 0,
967
+ difficultyLevel: input.difficultyLevel,
968
+ estimatedTimeMinutes: input.estimatedTimeMinutes,
969
+ notes: input.notes?.trim() || void 0,
970
+ code: input.code
971
+ } },
972
+ context: { headers: storeContextHeaders({
973
+ organizationId,
974
+ workspaceId,
975
+ workspaceToken: getFluidGridsConfig().workspaceToken
976
+ }) }
977
+ })).data?.submitWorkflowTemplate;
978
+ if (!submission) throw new Error("The store did not return the submitted template");
979
+ return {
980
+ success: true,
981
+ submission,
982
+ message: submission.status === "PUBLISHED" ? `Template "${submission.name}" is published` : `Template "${submission.name}" submitted for review`
983
+ };
984
+ } catch (err) {
985
+ const publishError = new Error(describeOperationError(err, "Failed to publish to store"), { cause: err });
986
+ setError(publishError);
987
+ return {
988
+ success: false,
989
+ submission: null,
990
+ message: publishError.message
991
+ };
992
+ } finally {
993
+ setPublishing(false);
994
+ }
995
+ }, [
996
+ globalClient,
997
+ organizationId,
998
+ workspaceId
999
+ ]),
1000
+ publishing,
1001
+ error
1002
+ };
1003
+ }
1004
+
1005
+ // src/hooks/store/useTemplateSubmissions.ts
1006
+ /**
1007
+ * The caller's own community workflow templates (BOFF-4316), newest first,
1008
+ * with a withdraw action. The list is self-scoped by the store: it only ever
1009
+ * returns templates whose publisher profile belongs to the signed-in user.
1010
+ */
1011
+ function useTemplateSubmissions(enabled = true, limit = 50) {
1012
+ const client = useGlobalStoreClient();
1013
+ const [withdrawingId, setWithdrawingId] = useState(null);
1014
+ const { data, loading, error, refetch } = useQuery(MyWorkflowTemplateSubmissionsDocument, {
1015
+ client,
1016
+ variables: {
1017
+ limit,
1018
+ offset: 0
1019
+ },
1020
+ fetchPolicy: "cache-and-network",
1021
+ skip: !enabled
1022
+ });
1023
+ const withdraw = useCallback(async (id) => {
1024
+ setWithdrawingId(id);
1025
+ try {
1026
+ const removed = throwIfResultError(await client.mutate({
1027
+ mutation: WithdrawWorkflowTemplateSubmissionDocument,
1028
+ variables: { id }
1029
+ })).data?.withdrawWorkflowTemplateSubmission.removed ?? false;
1030
+ await refetch();
1031
+ return {
1032
+ success: true,
1033
+ removed,
1034
+ message: removed ? "Template withdrawn and deleted" : "Template taken off the store"
1035
+ };
1036
+ } catch (err) {
1037
+ return {
1038
+ success: false,
1039
+ removed: false,
1040
+ message: describeOperationError(err, "Failed to withdraw template")
1041
+ };
1042
+ } finally {
1043
+ setWithdrawingId(null);
1044
+ }
1045
+ }, [client, refetch]);
1046
+ return {
1047
+ submissions: data?.myWorkflowTemplateSubmissions.items ?? [],
1048
+ totalCount: data?.myWorkflowTemplateSubmissions.totalCount ?? 0,
1049
+ loading,
1050
+ error,
1051
+ refetch,
1052
+ withdraw,
1053
+ withdrawingId
1054
+ };
1055
+ }
1056
+
1057
+ // src/builder/components/flow-builder/components/templates/TemplateCard.tsx
1058
+ function formatNumber(count) {
1059
+ if (count >= 1e6) return `${(count / 1e6).toFixed(1)}M`;
1060
+ if (count >= 1e3) return `${(count / 1e3).toFixed(1)}k`;
1061
+ return count.toString();
1062
+ }
1063
+ function PriceBadge({ template }) {
1064
+ const tr = useTr();
1065
+ return template.pricingModel === "FREE" ? /* @__PURE__ */ jsx(Badge$1, {
1066
+ variant: "secondary",
1067
+ className: "bg-status-success-bg text-action-primary-text border-0",
1068
+ children: tr("fluidgrids.builder.templateCard.freeBadge", "Free")
1069
+ }) : /* @__PURE__ */ jsx(Badge$1, {
1070
+ variant: "default",
1071
+ className: "bg-status-info-bg text-action-primary-text border-0",
1072
+ children: formatTemplatePrice(template.price, template.currency)
1073
+ });
1074
+ }
1075
+ /** Downloads and views (today's card; Navigation v2 shows them on the preview). */
1076
+ function UsageCounts({ template }) {
1077
+ const tr = useTr();
1078
+ return /* @__PURE__ */ jsxs("div", {
1079
+ className: "flex items-center gap-3",
1080
+ children: [/* @__PURE__ */ jsxs("div", {
1081
+ className: "flex items-center gap-1",
1082
+ title: tr("fluidgrids.builder.templateCard.downloadsTooltip", "Downloads"),
1083
+ children: [/* @__PURE__ */ jsx(Download, { className: "size-3" }), /* @__PURE__ */ jsx("span", { children: formatNumber(template.downloads || 0) })]
1084
+ }), /* @__PURE__ */ jsxs("div", {
1085
+ className: "flex items-center gap-1",
1086
+ title: tr("fluidgrids.builder.templateCard.viewsTooltip", "Views"),
1087
+ children: [/* @__PURE__ */ jsx(Eye, { className: "size-3" }), /* @__PURE__ */ jsx("span", { children: formatNumber(template.viewCount || 0) })]
1088
+ })]
1089
+ });
1090
+ }
1091
+ /**
1092
+ * Template card component inspired by ComfyUI's template showcase
1093
+ * Features:
1094
+ * - Large preview image/screenshot
1095
+ * - Template name and description
1096
+ * - Author info
1097
+ * - Stats (downloads, views, rating)
1098
+ * - Featured badge
1099
+ * - Category/tags
1100
+ *
1101
+ * Navigation v2 (BOFF-11848, the Templates gallery only): the download and
1102
+ * view counts move to the template preview. The builder's template picker
1103
+ * does not use this card: it shows the gallery's `StoreTemplateCardCompact`
1104
+ * (see TemplatesGrid).
1105
+ */
1106
+ function TemplateCard({ template, onClick, onUseTemplate }) {
1107
+ const tr = useTr();
1108
+ const v2 = useNavigationV2();
1109
+ const previewCandidates = templatePreviewCandidates(template);
1110
+ const handleUseTemplate = (e) => {
1111
+ e.stopPropagation();
1112
+ onUseTemplate?.(template);
1113
+ };
1114
+ return /* @__PURE__ */ jsxs(Card$1, {
1115
+ className: cn("group overflow-hidden transition-all duration-300 cursor-pointer", "hover:shadow-xl hover:scale-[1.02] border-2 hover:border-primary/50"),
1116
+ onClick,
1117
+ children: [/* @__PURE__ */ jsxs("div", {
1118
+ className: "relative aspect-video w-full overflow-hidden bg-gradient-to-br from-primary/5 to-primary/10",
1119
+ children: [
1120
+ /* @__PURE__ */ jsx("div", {
1121
+ className: "w-full h-full flex items-center justify-center",
1122
+ children: /* @__PURE__ */ jsx(StoreIcon, {
1123
+ candidates: previewCandidates,
1124
+ alt: template.name,
1125
+ imageClassName: "w-full h-full group-hover:scale-110 transition-transform duration-300",
1126
+ iconClassName: "text-primary/60",
1127
+ iconSize: 64,
1128
+ fallback: /* @__PURE__ */ jsx(Sparkles, { className: "size-16 text-primary/30" }),
1129
+ offline: true
1130
+ })
1131
+ }),
1132
+ template.featured && /* @__PURE__ */ jsx("div", {
1133
+ className: "absolute top-2 right-2",
1134
+ children: /* @__PURE__ */ jsxs(Badge$1, {
1135
+ variant: "default",
1136
+ className: "bg-status-warning-bg-subtle text-status-warning-text border border-status-warning-border shadow-lg",
1137
+ children: [/* @__PURE__ */ jsx(Star, { className: "size-3 mr-1 fill-current" }), tr("fluidgrids.builder.templateCard.featuredBadge", "Featured")]
1138
+ })
1139
+ }),
1140
+ /* @__PURE__ */ jsx("div", {
1141
+ className: "absolute top-2 left-2",
1142
+ children: /* @__PURE__ */ jsx(PriceBadge, { template })
1143
+ }),
1144
+ /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-gradient-to-t from-bg-overlay via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300" })
1145
+ ]
1146
+ }), /* @__PURE__ */ jsxs("div", {
1147
+ className: "p-4 space-y-3",
1148
+ children: [
1149
+ /* @__PURE__ */ jsx("h3", {
1150
+ className: "font-semibold text-base line-clamp-1 group-hover:text-primary transition-colors",
1151
+ children: template.name
1152
+ }),
1153
+ /* @__PURE__ */ jsx("p", {
1154
+ className: "text-sm text-muted-foreground line-clamp-2 min-h-[2.5rem]",
1155
+ children: template.description || tr("fluidgrids.builder.templateCard.noDescription", "No description available")
1156
+ }),
1157
+ /* @__PURE__ */ jsxs("div", {
1158
+ className: "flex items-center gap-2 text-xs text-muted-foreground",
1159
+ children: [/* @__PURE__ */ jsx("span", {
1160
+ className: "font-medium",
1161
+ children: template.authorName || template.publisher?.name || tr("fluidgrids.builder.templateCard.unknownAuthor", "Unknown")
1162
+ }), template.publisher?.isVerified && /* @__PURE__ */ jsx(Badge$1, {
1163
+ variant: "secondary",
1164
+ className: "text-xs px-1.5 py-0",
1165
+ role: "img",
1166
+ "aria-label": tr("fluidgrids.builder.templateCard.verifiedLabel", "Verified publisher"),
1167
+ title: tr("fluidgrids.builder.templateCard.verifiedLabel", "Verified publisher"),
1168
+ children: "✓"
1169
+ })]
1170
+ }),
1171
+ /* @__PURE__ */ jsxs("div", {
1172
+ className: "flex items-center justify-between text-xs text-muted-foreground pt-2 border-t",
1173
+ children: [/* @__PURE__ */ jsx("div", {
1174
+ className: "flex items-center gap-3",
1175
+ children: template.rating && /* @__PURE__ */ jsxs("div", {
1176
+ className: "flex items-center gap-1",
1177
+ children: [
1178
+ /* @__PURE__ */ jsx(Star, { className: "size-3 fill-status-warning-bg text-status-warning-text" }),
1179
+ /* @__PURE__ */ jsx("span", {
1180
+ className: "font-medium",
1181
+ children: template.rating.toFixed(1)
1182
+ }),
1183
+ /* @__PURE__ */ jsxs("span", {
1184
+ className: "text-muted-foreground/60",
1185
+ children: [
1186
+ "(",
1187
+ template.reviewCount || 0,
1188
+ ")"
1189
+ ]
1190
+ })
1191
+ ]
1192
+ })
1193
+ }), !v2 && /* @__PURE__ */ jsx(UsageCounts, { template })]
1194
+ }),
1195
+ (template.category || template.tags?.length > 0) && /* @__PURE__ */ jsxs("div", {
1196
+ className: "flex flex-wrap gap-1",
1197
+ children: [
1198
+ template.category && /* @__PURE__ */ jsx(Badge$1, {
1199
+ variant: "outline",
1200
+ className: "text-xs",
1201
+ children: template.category
1202
+ }),
1203
+ template.tags?.slice(0, 2).map((tag) => /* @__PURE__ */ jsx(Badge$1, {
1204
+ variant: "outline",
1205
+ className: "text-xs",
1206
+ children: tag
1207
+ }, tag)),
1208
+ template.tags?.length > 2 && /* @__PURE__ */ jsxs(Badge$1, {
1209
+ variant: "outline",
1210
+ className: "text-xs",
1211
+ children: ["+", template.tags.length - 2]
1212
+ })
1213
+ ]
1214
+ }),
1215
+ /* @__PURE__ */ jsx(SdkPermissionButton, {
1216
+ permission: FLUIDGRIDS_PERMISSIONS.WORKFLOW_CREATE,
1217
+ deniedTooltip: tr("fluidgrids.templates.useDeniedTooltip", "You don't have permission to create workflows from templates"),
1218
+ children: /* @__PURE__ */ jsxs(Button$2, {
1219
+ size: "sm",
1220
+ className: "w-full mt-2",
1221
+ onClick: handleUseTemplate,
1222
+ children: [/* @__PURE__ */ jsx(Sparkles, { className: "size-3 mr-1" }), tr("fluidgrids.builder.templateCard.useTemplateButton", "Use Template")]
1223
+ })
1224
+ })
1225
+ ]
1226
+ })]
1227
+ });
1228
+ }
1229
+
1230
+ // src/hooks/store/templateCode.ts
1231
+ /**
1232
+ * *Include code* when a workflow is published as a community template
1233
+ * (code-first gap G22, BOFF-14107, spec code-first/07 section 9).
1234
+ *
1235
+ * Collects the code `submitWorkflowTemplate` takes in `input.code`:
1236
+ *
1237
+ * - A canvas workflow (tier 1) is lifted to TypeScript by the service
1238
+ * (`exportWorkflow`). Connections are written by name (the names of the
1239
+ * author's saved connections), never by id, and pinned data is left out, so
1240
+ * the code carries nothing the store removes from the definition. Only a
1241
+ * lossless lift is published, so installing the code gives back the same
1242
+ * workflow.
1243
+ * - A durable function (tier 2) attaches its project files
1244
+ * (`workflowCodeSource`, vendored files excluded), TypeScript or Python.
1245
+ * TypeScript files may import only project files and
1246
+ * `@fluidgrids/workflows`.
1247
+ *
1248
+ * The store's rules (64 files, 1 MiB, safe and unique paths) are checked here
1249
+ * first, so a refusal is explained before anything is sent. The store checks
1250
+ * them again, and also refuses code that carries a secret.
1251
+ */
1252
+ /** Thrown when a flag *Include code* needs is off (fails closed). */
1253
+ var CodeTemplatesDisabledError = class extends Error {
1254
+ constructor() {
1255
+ super("Publishing a template with its code is not enabled here");
1256
+ this.name = "CodeTemplatesDisabledError";
1257
+ }
1258
+ };
1259
+ function isRecord(value) {
1260
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1261
+ }
1262
+ /** Keys that bind a node to a saved connection (as global-store-svc reads them). */
1263
+ const CONNECTION_KEYS = /* @__PURE__ */ new Set([
1264
+ "connectionId",
1265
+ "credentialId",
1266
+ "credentialsId"
1267
+ ]);
1268
+ const CONNECTION_ID_FIELDS = [
1269
+ "id",
1270
+ "connectionId",
1271
+ "credentialId",
1272
+ "credentialsId"
1273
+ ];
1274
+ /** Deepest nesting walked; a definition the store accepts is never deeper. */
1275
+ const MAX_DEPTH = 64;
1276
+ /**
1277
+ * The saved-connection ids a definition refers to: values of `connectionId`,
1278
+ * `credentialId` and `credentialsId`, and the entries of `connections`
1279
+ * lists (an id, or an object's id field).
1280
+ */
1281
+ function definitionConnectionIds(definition) {
1282
+ const found = /* @__PURE__ */ new Set();
1283
+ const visit = (value, depth) => {
1284
+ if (depth > MAX_DEPTH) return;
1285
+ if (Array.isArray(value)) {
1286
+ for (const item of value) visit(item, depth + 1);
1287
+ return;
1288
+ }
1289
+ if (!isRecord(value)) return;
1290
+ for (const [key, child] of Object.entries(value)) {
1291
+ if (CONNECTION_KEYS.has(key) && typeof child === "string" && child) found.add(child);
1292
+ else if (key === "connections" && Array.isArray(child)) {
1293
+ for (const entry of child) if (typeof entry === "string" && entry) found.add(entry);
1294
+ else if (isRecord(entry)) for (const field of CONNECTION_ID_FIELDS) {
1295
+ const id = entry[field];
1296
+ if (typeof id === "string" && id) found.add(id);
1297
+ }
1298
+ }
1299
+ visit(child, depth + 1);
1300
+ }
1301
+ };
1302
+ visit(definition, 0);
1303
+ return [...found];
1304
+ }
1305
+ /** The language of a tier-2 definition's code block. */
1306
+ function tier2Format(definitionJson) {
1307
+ const code = isRecord(definitionJson) ? definitionJson.code : void 0;
1308
+ return (isRecord(code) ? code.language : void 0) === "python" ? "PYTHON" : "TYPESCRIPT";
1309
+ }
1310
+ async function collectTier2(workflow) {
1311
+ const source = await fetchWorkflowCodeSource(workflow.workflowKey, workflow.version);
1312
+ if (!source || source.files.length === 0) throw new TemplateCodeError({ code: "no-files" });
1313
+ const files = source.files.map((file) => ({
1314
+ path: file.path,
1315
+ contentType: contentTypeOf(file.path),
1316
+ content: file.content
1317
+ }));
1318
+ assertTemplateSources(files, "tier2");
1319
+ return {
1320
+ tier: "TIER2",
1321
+ format: tier2Format(workflow.definitionJson),
1322
+ files
1323
+ };
1324
+ }
1325
+ async function collectTier1(workflow) {
1326
+ const connectionIds = definitionConnectionIds(workflow.definitionJson);
1327
+ const connectionNameMap = await fetchConnectionNames(connectionIds);
1328
+ const exported = await fetchWorkflowCodeExport({
1329
+ workflowKey: workflow.workflowKey,
1330
+ version: workflow.version,
1331
+ format: "TYPESCRIPT",
1332
+ options: {
1333
+ connectionNameMap,
1334
+ connectionNames: true,
1335
+ includeLayout: true,
1336
+ includePinnedData: false
1337
+ }
1338
+ });
1339
+ if (!isLosslessReport(exported.fidelity)) throw new TemplateCodeError({ code: "lossy" });
1340
+ const files = exported.files.map((file) => ({
1341
+ path: file.path,
1342
+ contentType: file.contentType || contentTypeOf(file.path),
1343
+ content: file.content ?? ""
1344
+ }));
1345
+ if (connectionIds.find((id) => !connectionNameMap[id] && files.some((file) => file.content.includes(id))) !== void 0) throw new TemplateCodeError({ code: "unnamed-connection" });
1346
+ assertTemplateSources(files, "tier1");
1347
+ return {
1348
+ tier: "TIER1",
1349
+ format: "TYPESCRIPT",
1350
+ files,
1351
+ sourceIrHash: exported.irHash
1352
+ };
1353
+ }
1354
+ /** Whether *Include code* can be offered for a workflow with these flags. */
1355
+ function canIncludeTemplateCode(definitionJson, flags) {
1356
+ return isTier2Definition(definitionJson) ? flags.codeTemplatesDurable : flags.codeTemplates;
1357
+ }
1358
+ /**
1359
+ * The code to publish with a workflow version. Throws
1360
+ * {@link CodeTemplatesDisabledError} when a needed flag is off and
1361
+ * {@link TemplateCodeError} when the code cannot be published (a lossy lift,
1362
+ * a connection without a name, no files, or a store rule broken).
1363
+ */
1364
+ async function collectTemplateCode(workflow, flags) {
1365
+ if (!canIncludeTemplateCode(workflow.definitionJson, flags)) throw new CodeTemplatesDisabledError();
1366
+ return isTier2Definition(workflow.definitionJson) ? collectTier2(workflow) : collectTier1(workflow);
1367
+ }
1368
+
1369
+ // src/modules/templates/utils/template-code-messages.ts
1370
+ /**
1371
+ * Messages for *Include code* refusals in the publish dialog (G22,
1372
+ * BOFF-14107). Each one tells the author what to change, or that they can
1373
+ * untick *Include code* and publish the definition only.
1374
+ */
1375
+ /**
1376
+ * The message for an error raised while collecting a template's code, or
1377
+ * null when the error is not a code refusal (the caller then shows the
1378
+ * error's own message).
1379
+ */
1380
+ function templateCodeErrorMessage(error, tr) {
1381
+ if (error instanceof CodeTemplatesDisabledError) return tr("fluidgrids.templates.publish.code.disabled", "Publishing a template with its code is not turned on for this workspace. Untick Include code to publish the workflow without it.");
1382
+ if (!(error instanceof TemplateCodeError)) return null;
1383
+ const { problem } = error;
1384
+ switch (problem.code) {
1385
+ case "lossy": return tr("fluidgrids.templates.publish.code.lossy", "This workflow cannot be turned into code without losing something (see the Code view for what). Untick Include code to publish it without code.");
1386
+ case "unnamed-connection": return tr("fluidgrids.templates.publish.code.unnamedConnection", "A node uses a connection that no longer exists, so its code would carry the connection's id. Pick a saved connection for it, save, and try again.");
1387
+ case "no-files": return tr("fluidgrids.templates.publish.code.noFiles", "This version has no code files to include. Save the workflow's code and try again.");
1388
+ case "too-large": return tr("fluidgrids.templates.publish.code.tooLarge", "The code is larger than the store allows ({{limit}} KB).", { limit: Math.round(TEMPLATE_SOURCES_MAX_BYTES / 1024) });
1389
+ case "too-many-files": return tr("fluidgrids.templates.publish.code.tooManyFiles", "The code has more files than the store allows ({{limit}}).", { limit: 64 });
1390
+ case "unsafe-path": return tr("fluidgrids.templates.publish.code.unsafePath", "The file {{path}} has a path the store does not accept.", { path: problem.path });
1391
+ case "duplicate-path": return tr("fluidgrids.templates.publish.code.duplicatePath", "Two files share the path {{path}}.", { path: problem.path });
1392
+ case "foreign-import": return tr("fluidgrids.templates.publish.code.foreignImport", "{{path}} imports {{specifier}}. Template code may import only its own files and @fluidgrids/workflows.", {
1393
+ path: problem.path,
1394
+ specifier: problem.specifier
1395
+ });
1396
+ case "python-tier2": return tr("fluidgrids.templates.publish.code.pythonTier2", "Python code cannot be installed from a template.");
1397
+ }
1398
+ }
1399
+
1400
+ // src/modules/templates/utils/template-categories.ts
1401
+ /** English labels for the store's template categories (BOFF-4316). */
1402
+ const TEMPLATE_CATEGORY_LABELS = {
1403
+ automation: "Automation",
1404
+ integration: "Integration",
1405
+ "data-processing": "Data Processing",
1406
+ "ai-ml": "AI/ML",
1407
+ communication: "Communication",
1408
+ devops: "DevOps",
1409
+ marketing: "Marketing",
1410
+ sales: "Sales",
1411
+ support: "Support",
1412
+ productivity: "Productivity",
1413
+ finance: "Finance"
1414
+ };
1415
+ /** Icons for the store category filter. */
1416
+ const TEMPLATE_CATEGORY_ICONS = {
1417
+ automation: "mdi:robot",
1418
+ integration: "mdi:connection",
1419
+ "data-processing": "mdi:database-cog",
1420
+ "ai-ml": "mdi:brain",
1421
+ communication: "mdi:message-text",
1422
+ devops: "mdi:server",
1423
+ marketing: "mdi:bullhorn",
1424
+ sales: "mdi:handshake",
1425
+ support: "mdi:lifebuoy",
1426
+ productivity: "mdi:checkbox-marked-circle-outline",
1427
+ finance: "mdi:currency-usd"
1428
+ };
1429
+ /**
1430
+ * Split a comma-separated tag field into the tag list the store expects:
1431
+ * trimmed, lower-cased, de-duplicated, empty entries dropped, at most 10.
1432
+ */
1433
+ function parseTemplateTags(value) {
1434
+ const out = [];
1435
+ for (const raw of value.split(",")) {
1436
+ const tag = raw.trim().toLowerCase();
1437
+ if (tag && !out.includes(tag)) out.push(tag);
1438
+ }
1439
+ return out.slice(0, 10);
1440
+ }
1441
+
1442
+ // src/modules/templates/components/PublishTemplateDialog.tsx
1443
+ /**
1444
+ * Publish a workspace workflow to the public FluidGrids store as a community
1445
+ * template (BOFF-4316).
1446
+ *
1447
+ * The dialog collects what the store shows on the template (name, summary,
1448
+ * category, tags, author, difficulty) and sends the workflow's current
1449
+ * definition. The store removes the author's connection bindings, pinned run
1450
+ * data and literal secrets before keeping a copy, and a store admin reviews the
1451
+ * template before it is listed. Passing `resubmit` updates one of the author's
1452
+ * rejected or withdrawn templates instead of creating one.
1453
+ *
1454
+ * *Include code* (G22, shown when the workspace has code templates on) also
1455
+ * publishes the workflow as code, so people who install the template can
1456
+ * open it as a code project. The store refuses code that carries a secret.
1457
+ */
1458
+ const DIFFICULTIES = [
1459
+ "easy",
1460
+ "medium",
1461
+ "hard"
1462
+ ];
1463
+ function initialCategory(workflow, resubmit) {
1464
+ const candidate = (resubmit?.category ?? workflow?.category ?? "").toLowerCase().replace(/\s+/g, "-");
1465
+ return TEMPLATE_STORE_CATEGORIES.includes(candidate) ? candidate : "automation";
1466
+ }
1467
+ function PublishTemplateDialog({ open, onOpenChange, workflow, resubmit, onSubmitted }) {
1468
+ const tr = useTr();
1469
+ const { publishToStore, publishing } = usePublishToStore();
1470
+ const { getWorkflow } = useLazyWorkflowDefinition();
1471
+ const phaseD = usePhaseDFlags();
1472
+ const [includeCode, setIncludeCode] = useState(false);
1473
+ const [collectingCode, setCollectingCode] = useState(false);
1474
+ const busy = publishing || collectingCode;
1475
+ const [name, setName] = useState("");
1476
+ const [description, setDescription] = useState("");
1477
+ const [longDescription, setLongDescription] = useState("");
1478
+ const [category, setCategory] = useState("automation");
1479
+ const [tags, setTags] = useState("");
1480
+ const [authorName, setAuthorName] = useState("");
1481
+ const [difficulty, setDifficulty] = useState("medium");
1482
+ const [notes, setNotes] = useState("");
1483
+ const [error, setError] = useState(null);
1484
+ useEffect(() => {
1485
+ if (!open) return;
1486
+ setName(resubmit?.name ?? workflow?.name ?? "");
1487
+ setDescription(resubmit?.description ?? workflow?.description ?? "");
1488
+ setLongDescription("");
1489
+ setCategory(initialCategory(workflow, resubmit));
1490
+ setTags((resubmit?.tags ?? workflow?.tags ?? []).join(", "));
1491
+ setAuthorName(resubmit?.authorName ?? "");
1492
+ setDifficulty("medium");
1493
+ setNotes("");
1494
+ setIncludeCode(false);
1495
+ setError(null);
1496
+ }, [
1497
+ open,
1498
+ workflow,
1499
+ resubmit
1500
+ ]);
1501
+ const submit = async () => {
1502
+ setError(null);
1503
+ if (!workflow) return;
1504
+ if (!name.trim()) {
1505
+ setError(tr("fluidgrids.templates.publish.nameRequired", "Enter a template name."));
1506
+ return;
1507
+ }
1508
+ if (!description.trim()) {
1509
+ setError(tr("fluidgrids.templates.publish.descriptionRequired", "Enter a one-line summary."));
1510
+ return;
1511
+ }
1512
+ const current = (workflow.version ? await getWorkflow(workflow.workflowKey, void 0, workflow.version) : null) ?? await getWorkflow(workflow.workflowKey);
1513
+ if (!current?.definitionJson) {
1514
+ setError(tr("fluidgrids.templates.publish.definitionMissing", "Could not read this workflow's definition. Save it and try again."));
1515
+ return;
1516
+ }
1517
+ let code;
1518
+ if (includeCode && phaseD.codeTemplates) {
1519
+ setCollectingCode(true);
1520
+ try {
1521
+ code = await collectTemplateCode(current, phaseD);
1522
+ } catch (err) {
1523
+ setError(templateCodeErrorMessage(err, tr) ?? (err instanceof Error ? err.message : tr("fluidgrids.templates.publish.code.failed", "Could not read this workflow's code.")));
1524
+ return;
1525
+ } finally {
1526
+ setCollectingCode(false);
1527
+ }
1528
+ }
1529
+ const result = await publishToStore({
1530
+ workflow: current,
1531
+ code,
1532
+ productId: resubmit?.id,
1533
+ name,
1534
+ description,
1535
+ longDescription: longDescription || void 0,
1536
+ category,
1537
+ tags: parseTemplateTags(tags),
1538
+ authorName: authorName || void 0,
1539
+ difficultyLevel: difficulty,
1540
+ notes: notes || void 0
1541
+ });
1542
+ if (result.success && result.submission) {
1543
+ onSubmitted?.(result.submission);
1544
+ onOpenChange(false);
1545
+ } else setError(result.message);
1546
+ };
1547
+ return /* @__PURE__ */ jsx(Dialog, {
1548
+ open,
1549
+ onOpenChange,
1550
+ children: /* @__PURE__ */ jsxs(DialogContent, {
1551
+ className: "sm:max-w-lg max-h-[90vh] overflow-y-auto",
1552
+ "data-testid": "publish-template-dialog",
1553
+ children: [
1554
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: resubmit ? tr("fluidgrids.templates.publish.resubmitTitle", "Resubmit template") : tr("fluidgrids.templates.publish.title", "Publish to FluidGrids Store") }), /* @__PURE__ */ jsx(DialogDescription, { children: tr("fluidgrids.templates.publish.description", "Share this workflow as a free community template. Saved connections, pinned test data and secrets are removed, and a store reviewer checks it before it is listed.") })] }),
1555
+ /* @__PURE__ */ jsxs("div", {
1556
+ className: "space-y-4 py-2",
1557
+ children: [
1558
+ /* @__PURE__ */ jsxs("div", {
1559
+ className: "space-y-1.5",
1560
+ children: [/* @__PURE__ */ jsx(Label, {
1561
+ htmlFor: "publish-template-name",
1562
+ children: tr("fluidgrids.templates.publish.nameLabel", "Template name")
1563
+ }), /* @__PURE__ */ jsx(Input, {
1564
+ id: "publish-template-name",
1565
+ value: name,
1566
+ maxLength: 120,
1567
+ onChange: (e) => setName(e.target.value)
1568
+ })]
1569
+ }),
1570
+ /* @__PURE__ */ jsxs("div", {
1571
+ className: "space-y-1.5",
1572
+ children: [/* @__PURE__ */ jsx(Label, {
1573
+ htmlFor: "publish-template-summary",
1574
+ children: tr("fluidgrids.templates.publish.summaryLabel", "Summary")
1575
+ }), /* @__PURE__ */ jsx(Input, {
1576
+ id: "publish-template-summary",
1577
+ value: description,
1578
+ maxLength: 500,
1579
+ placeholder: tr("fluidgrids.templates.publish.summaryPlaceholder", "What does this workflow do?"),
1580
+ onChange: (e) => setDescription(e.target.value)
1581
+ })]
1582
+ }),
1583
+ /* @__PURE__ */ jsxs("div", {
1584
+ className: "space-y-1.5",
1585
+ children: [/* @__PURE__ */ jsx(Label, {
1586
+ htmlFor: "publish-template-details",
1587
+ children: tr("fluidgrids.templates.publish.detailsLabel", "Details (optional, markdown)")
1588
+ }), /* @__PURE__ */ jsx(Textarea, {
1589
+ id: "publish-template-details",
1590
+ rows: 3,
1591
+ value: longDescription,
1592
+ maxLength: 1e4,
1593
+ onChange: (e) => setLongDescription(e.target.value)
1594
+ })]
1595
+ }),
1596
+ /* @__PURE__ */ jsxs("div", {
1597
+ className: "grid grid-cols-1 sm:grid-cols-2 gap-4",
1598
+ children: [/* @__PURE__ */ jsxs("div", {
1599
+ className: "space-y-1.5",
1600
+ children: [/* @__PURE__ */ jsx(Label, {
1601
+ htmlFor: "publish-template-category",
1602
+ children: tr("fluidgrids.templates.publish.categoryLabel", "Category")
1603
+ }), /* @__PURE__ */ jsxs(Select, {
1604
+ value: category,
1605
+ onValueChange: (value) => setCategory(value),
1606
+ children: [/* @__PURE__ */ jsx(SelectTrigger, {
1607
+ id: "publish-template-category",
1608
+ children: /* @__PURE__ */ jsx(SelectValue, {})
1609
+ }), /* @__PURE__ */ jsx(SelectContent, { children: TEMPLATE_STORE_CATEGORIES.map((value) => /* @__PURE__ */ jsx(SelectItem, {
1610
+ value,
1611
+ children: tr(`fluidgrids.templates.categories.${value}`, TEMPLATE_CATEGORY_LABELS[value])
1612
+ }, value)) })]
1613
+ })]
1614
+ }), /* @__PURE__ */ jsxs("div", {
1615
+ className: "space-y-1.5",
1616
+ children: [/* @__PURE__ */ jsx(Label, {
1617
+ htmlFor: "publish-template-difficulty",
1618
+ children: tr("fluidgrids.templates.publish.difficultyLabel", "Difficulty")
1619
+ }), /* @__PURE__ */ jsxs(Select, {
1620
+ value: difficulty,
1621
+ onValueChange: (value) => setDifficulty(value),
1622
+ children: [/* @__PURE__ */ jsx(SelectTrigger, {
1623
+ id: "publish-template-difficulty",
1624
+ children: /* @__PURE__ */ jsx(SelectValue, {})
1625
+ }), /* @__PURE__ */ jsx(SelectContent, { children: DIFFICULTIES.map((value) => /* @__PURE__ */ jsx(SelectItem, {
1626
+ value,
1627
+ children: tr(`fluidgrids.templates.difficulty.${value}`, value.charAt(0).toUpperCase() + value.slice(1))
1628
+ }, value)) })]
1629
+ })]
1630
+ })]
1631
+ }),
1632
+ /* @__PURE__ */ jsxs("div", {
1633
+ className: "space-y-1.5",
1634
+ children: [/* @__PURE__ */ jsx(Label, {
1635
+ htmlFor: "publish-template-tags",
1636
+ children: tr("fluidgrids.templates.publish.tagsLabel", "Tags (comma separated, up to 10)")
1637
+ }), /* @__PURE__ */ jsx(Input, {
1638
+ id: "publish-template-tags",
1639
+ value: tags,
1640
+ placeholder: "slack, alerts, crm",
1641
+ onChange: (e) => setTags(e.target.value)
1642
+ })]
1643
+ }),
1644
+ /* @__PURE__ */ jsxs("div", {
1645
+ className: "space-y-1.5",
1646
+ children: [/* @__PURE__ */ jsx(Label, {
1647
+ htmlFor: "publish-template-author",
1648
+ children: tr("fluidgrids.templates.publish.authorLabel", "Author name")
1649
+ }), /* @__PURE__ */ jsx(Input, {
1650
+ id: "publish-template-author",
1651
+ value: authorName,
1652
+ maxLength: 120,
1653
+ placeholder: tr("fluidgrids.templates.publish.authorPlaceholder", "Shown on the template. Required for your first one."),
1654
+ onChange: (e) => setAuthorName(e.target.value)
1655
+ })]
1656
+ }),
1657
+ /* @__PURE__ */ jsxs("div", {
1658
+ className: "space-y-1.5",
1659
+ children: [/* @__PURE__ */ jsx(Label, {
1660
+ htmlFor: "publish-template-notes",
1661
+ children: tr("fluidgrids.templates.publish.notesLabel", "Note for the reviewer (optional)")
1662
+ }), /* @__PURE__ */ jsx(Textarea, {
1663
+ id: "publish-template-notes",
1664
+ rows: 2,
1665
+ value: notes,
1666
+ maxLength: 2e3,
1667
+ onChange: (e) => setNotes(e.target.value)
1668
+ })]
1669
+ }),
1670
+ phaseD.codeTemplates && /* @__PURE__ */ jsxs("div", {
1671
+ className: "space-y-1",
1672
+ children: [/* @__PURE__ */ jsxs("div", {
1673
+ className: "flex items-center gap-2",
1674
+ children: [/* @__PURE__ */ jsx(Checkbox, {
1675
+ id: "publish-template-include-code",
1676
+ "data-testid": "publish-template-include-code",
1677
+ checked: includeCode,
1678
+ disabled: busy,
1679
+ onCheckedChange: (on) => setIncludeCode(on === true)
1680
+ }), /* @__PURE__ */ jsx(Label, {
1681
+ htmlFor: "publish-template-include-code",
1682
+ className: "text-sm",
1683
+ children: tr("fluidgrids.templates.publish.includeCodeLabel", "Include code")
1684
+ })]
1685
+ }), /* @__PURE__ */ jsx("p", {
1686
+ className: "text-xs text-text-secondary",
1687
+ children: tr("fluidgrids.templates.publish.includeCodeHint", "People who install the template can open it as a code project. Code that contains a secret is refused.")
1688
+ })]
1689
+ }),
1690
+ error && /* @__PURE__ */ jsx("p", {
1691
+ role: "alert",
1692
+ className: "text-sm text-[var(--color-status-error-text)]",
1693
+ "data-testid": "publish-template-error",
1694
+ children: error
1695
+ })
1696
+ ]
1697
+ }),
1698
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(Button$1, {
1699
+ variant: "outline",
1700
+ onClick: () => onOpenChange(false),
1701
+ disabled: busy,
1702
+ children: tr("fluidgrids.templates.publish.cancel", "Cancel")
1703
+ }), /* @__PURE__ */ jsxs(Button$1, {
1704
+ onClick: () => void submit(),
1705
+ disabled: busy || !workflow,
1706
+ "data-testid": "publish-template-submit",
1707
+ children: [busy ? /* @__PURE__ */ jsx(CompactMarkOr, {
1708
+ today: /* @__PURE__ */ jsx(OfflineIcon, {
1709
+ icon: "mdi:loading",
1710
+ width: 14,
1711
+ className: "mr-1.5 animate-spin"
1712
+ }),
1713
+ className: "mr-1.5 size-3.5"
1714
+ }) : /* @__PURE__ */ jsx(OfflineIcon, {
1715
+ icon: "mdi:store-plus",
1716
+ width: 14,
1717
+ className: "mr-1.5"
1718
+ }), tr("fluidgrids.templates.publish.submit", "Submit for review")]
1719
+ })] })
1720
+ ]
1721
+ })
1722
+ });
1723
+ }
1724
+
1725
+ // src/modules/templates/components/MySubmissionsPanel.tsx
1726
+ /**
1727
+ * The signed-in user's community workflow templates and where each one is in
1728
+ * store review (BOFF-4316): in review, published, rejected with the reviewer's
1729
+ * reason, or taken off the store. Rejected and withdrawn templates can be
1730
+ * resubmitted; any template can be withdrawn.
1731
+ */
1732
+ const STATUS_STYLES = {
1733
+ ["PENDING_REVIEW"]: {
1734
+ key: "pendingReview",
1735
+ label: "In review",
1736
+ icon: "mdi:clock-outline",
1737
+ className: "bg-[var(--color-status-info-bg-subtle)] text-[var(--color-status-info-text)] border-[var(--color-status-info-border)]"
1738
+ },
1739
+ ["PUBLISHED"]: {
1740
+ key: "published",
1741
+ label: "Published",
1742
+ icon: "mdi:check-circle",
1743
+ className: "bg-[var(--color-status-success-bg-subtle)] text-[var(--color-status-success-text)] border-[var(--color-status-success-border)]"
1744
+ },
1745
+ ["REJECTED"]: {
1746
+ key: "rejected",
1747
+ label: "Changes requested",
1748
+ icon: "mdi:alert-circle",
1749
+ className: "bg-[var(--color-status-error-bg-subtle)] text-[var(--color-status-error-text)] border-[var(--color-status-error-border)]"
1750
+ },
1751
+ ["UNLISTED"]: {
1752
+ key: "unlisted",
1753
+ label: "Withdrawn",
1754
+ icon: "mdi:eye-off",
1755
+ className: "bg-[var(--color-status-warning-bg-subtle)] text-[var(--color-status-warning-text)] border-[var(--color-status-warning-border)]"
1756
+ },
1757
+ ["DRAFT"]: {
1758
+ key: "draft",
1759
+ label: "Draft",
1760
+ icon: "mdi:pencil",
1761
+ className: "bg-surface-sunken text-text-secondary border-border-default"
1762
+ }
1763
+ };
1764
+ const RESUBMITTABLE = /* @__PURE__ */ new Set([
1765
+ "DRAFT",
1766
+ "REJECTED",
1767
+ "UNLISTED"
1768
+ ]);
1769
+ function categoryLabel$1(category) {
1770
+ if (!category) return null;
1771
+ return TEMPLATE_CATEGORY_LABELS[category] ?? category;
1772
+ }
1773
+ function MySubmissionsPanel({ onResubmit }) {
1774
+ const tr = useTr();
1775
+ const { submissions, loading, error, refetch, withdraw, withdrawingId } = useTemplateSubmissions(true);
1776
+ const [confirmingId, setConfirmingId] = useState(null);
1777
+ const handleWithdraw = async (submission) => {
1778
+ if (confirmingId !== submission.id) {
1779
+ setConfirmingId(submission.id);
1780
+ return;
1781
+ }
1782
+ setConfirmingId(null);
1783
+ const result = await withdraw(submission.id);
1784
+ if (result.success) toast.success(result.removed ? tr("fluidgrids.templates.submissions.withdrawDeletedToast", "Template withdrawn") : tr("fluidgrids.templates.submissions.withdrawUnlistedToast", "Template taken off the store"));
1785
+ else toast.error(result.message);
1786
+ };
1787
+ if (loading && submissions.length === 0) return /* @__PURE__ */ jsx("div", {
1788
+ className: "space-y-3",
1789
+ children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx(Skeleton, { className: "h-24 rounded-lg bg-card-foreground/10" }, i))
1790
+ });
1791
+ if (error) return /* @__PURE__ */ jsxs("div", {
1792
+ className: "p-4 bg-[var(--color-status-error-bg-subtle)] border border-[var(--color-status-error-border)] rounded-lg",
1793
+ children: [/* @__PURE__ */ jsx("p", {
1794
+ className: "text-sm text-[var(--color-status-error-text)]",
1795
+ children: error.message
1796
+ }), /* @__PURE__ */ jsx(Button$1, {
1797
+ variant: "outline",
1798
+ size: "sm",
1799
+ className: "mt-3",
1800
+ onClick: () => void refetch(),
1801
+ children: tr("fluidgrids.templates.templatesPage.errorStateRetry", "Retry")
1802
+ })]
1803
+ });
1804
+ if (submissions.length === 0) return /* @__PURE__ */ jsxs("div", {
1805
+ className: "flex flex-col items-center justify-center py-20 text-center",
1806
+ "data-testid": "my-submissions-empty",
1807
+ children: [
1808
+ /* @__PURE__ */ jsx("div", {
1809
+ className: "rounded-full bg-surface p-4 mb-4",
1810
+ children: /* @__PURE__ */ jsx(OfflineIcon, {
1811
+ icon: "mdi:store-plus",
1812
+ width: 40,
1813
+ className: "text-text-secondary"
1814
+ })
1815
+ }),
1816
+ /* @__PURE__ */ jsx("h3", {
1817
+ className: "text-lg font-semibold text-text-primary mb-2",
1818
+ children: tr("fluidgrids.templates.submissions.emptyTitle", "You have not published any templates yet")
1819
+ }),
1820
+ /* @__PURE__ */ jsx("p", {
1821
+ className: "text-sm text-text-secondary max-w-md",
1822
+ children: tr("fluidgrids.templates.submissions.emptyHint", "Open My Templates and choose Publish on a workflow to share it in the FluidGrids Store.")
1823
+ })
1824
+ ]
1825
+ });
1826
+ return /* @__PURE__ */ jsx("div", {
1827
+ className: "space-y-3",
1828
+ "data-testid": "my-submissions-list",
1829
+ children: submissions.map((submission) => {
1830
+ const style = STATUS_STYLES[submission.status];
1831
+ const category = categoryLabel$1(submission.category);
1832
+ const busy = withdrawingId === submission.id;
1833
+ return /* @__PURE__ */ jsx(Card, {
1834
+ className: "border border-border-default bg-surface",
1835
+ "data-testid": "my-submission-row",
1836
+ children: /* @__PURE__ */ jsxs(CardHeader, {
1837
+ className: "gap-3",
1838
+ children: [
1839
+ /* @__PURE__ */ jsxs("div", {
1840
+ className: "flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3",
1841
+ children: [/* @__PURE__ */ jsxs("div", {
1842
+ className: "flex items-start gap-3 min-w-0",
1843
+ children: [/* @__PURE__ */ jsx("div", {
1844
+ className: "rounded-lg bg-surface-sunken p-2.5 shrink-0",
1845
+ children: /* @__PURE__ */ jsx(NodeTypeIcon, {
1846
+ icon: submission.icon,
1847
+ alt: submission.name,
1848
+ fallbackIcon: "mdi:workflow",
1849
+ offline: true,
1850
+ className: "size-[22px] text-text-primary"
1851
+ })
1852
+ }), /* @__PURE__ */ jsxs("div", {
1853
+ className: "min-w-0",
1854
+ children: [
1855
+ /* @__PURE__ */ jsx("h3", {
1856
+ className: "font-semibold text-text-primary leading-tight break-words",
1857
+ children: submission.name
1858
+ }),
1859
+ /* @__PURE__ */ jsx("p", {
1860
+ className: "text-sm text-text-secondary mt-0.5 break-words",
1861
+ children: submission.description
1862
+ }),
1863
+ /* @__PURE__ */ jsxs("div", {
1864
+ className: "flex flex-wrap items-center gap-2 mt-2 text-xs text-text-secondary",
1865
+ children: [
1866
+ /* @__PURE__ */ jsx("span", { children: formatRunVersion(submission.version) }),
1867
+ category && /* @__PURE__ */ jsxs("span", { children: ["· ", category] }),
1868
+ /* @__PURE__ */ jsxs("span", { children: [
1869
+ "·",
1870
+ " ",
1871
+ tr("fluidgrids.templates.submissions.nodeCount", "{{count}} node types", { count: submission.nodeCount })
1872
+ ] }),
1873
+ submission.status === "PUBLISHED" && /* @__PURE__ */ jsxs("span", { children: [
1874
+ "·",
1875
+ " ",
1876
+ tr("fluidgrids.templates.submissions.downloads", "{{count}} imports", { count: submission.downloads })
1877
+ ] }),
1878
+ submission.code && /* @__PURE__ */ jsxs("span", {
1879
+ "data-testid": "my-submission-code",
1880
+ children: [
1881
+ "·",
1882
+ " ",
1883
+ tr("fluidgrids.templates.submissions.includesCode", "includes code ({{count}} files)", { count: submission.code.fileCount })
1884
+ ]
1885
+ }),
1886
+ submission.sourceWorkflowKey && /* @__PURE__ */ jsxs("span", {
1887
+ className: "truncate",
1888
+ children: [
1889
+ "·",
1890
+ " ",
1891
+ tr("fluidgrids.templates.submissions.source", "from {{key}}", { key: submission.sourceWorkflowKey })
1892
+ ]
1893
+ })
1894
+ ]
1895
+ })
1896
+ ]
1897
+ })]
1898
+ }), style && /* @__PURE__ */ jsxs(Badge, {
1899
+ variant: "outline",
1900
+ className: `shrink-0 w-fit ${style.className}`,
1901
+ "data-testid": "my-submission-status",
1902
+ children: [/* @__PURE__ */ jsx(OfflineIcon, {
1903
+ icon: style.icon,
1904
+ width: 14,
1905
+ className: "mr-1"
1906
+ }), tr(`fluidgrids.templates.submissions.status.${style.key}`, style.label)]
1907
+ })]
1908
+ }),
1909
+ submission.status === "REJECTED" && submission.rejectedReason && /* @__PURE__ */ jsxs("div", {
1910
+ className: "rounded-md border border-[var(--color-status-error-border)] bg-[var(--color-status-error-bg-subtle)] p-3 text-sm text-[var(--color-status-error-text)]",
1911
+ children: [
1912
+ /* @__PURE__ */ jsx("span", {
1913
+ className: "font-medium",
1914
+ children: tr("fluidgrids.templates.submissions.reviewerFeedback", "Reviewer feedback:")
1915
+ }),
1916
+ " ",
1917
+ submission.rejectedReason
1918
+ ]
1919
+ }),
1920
+ /* @__PURE__ */ jsxs("div", {
1921
+ className: "flex flex-wrap gap-2",
1922
+ children: [RESUBMITTABLE.has(submission.status) && submission.sourceWorkflowKey && /* @__PURE__ */ jsxs(Button$1, {
1923
+ size: "sm",
1924
+ onClick: () => onResubmit(submission),
1925
+ disabled: busy,
1926
+ children: [/* @__PURE__ */ jsx(OfflineIcon, {
1927
+ icon: "mdi:upload",
1928
+ width: 14,
1929
+ className: "mr-1.5"
1930
+ }), tr("fluidgrids.templates.submissions.resubmit", "Resubmit")]
1931
+ }), /* @__PURE__ */ jsxs(Button$1, {
1932
+ size: "sm",
1933
+ variant: "outline",
1934
+ onClick: () => void handleWithdraw(submission),
1935
+ disabled: busy,
1936
+ "data-testid": "my-submission-withdraw",
1937
+ children: [busy ? /* @__PURE__ */ jsx(CompactMarkOr, {
1938
+ today: /* @__PURE__ */ jsx(OfflineIcon, {
1939
+ icon: "mdi:loading",
1940
+ width: 14,
1941
+ className: "mr-1.5 animate-spin"
1942
+ }),
1943
+ className: "mr-1.5 size-3.5"
1944
+ }) : /* @__PURE__ */ jsx(OfflineIcon, {
1945
+ icon: "mdi:close-circle-outline",
1946
+ width: 14,
1947
+ className: "mr-1.5"
1948
+ }), confirmingId === submission.id ? tr("fluidgrids.templates.submissions.withdrawConfirm", "Click again to confirm") : submission.status === "PUBLISHED" ? tr("fluidgrids.templates.submissions.unlist", "Take off store") : tr("fluidgrids.templates.submissions.withdraw", "Withdraw")]
1949
+ })]
1950
+ })
1951
+ ]
1952
+ })
1953
+ }, submission.id);
1954
+ })
1955
+ });
1956
+ }
1957
+
1958
+ // src/modules/templates/utils/gallery-category.ts
1959
+ const STORE_CATEGORIES = new Set(Object.keys(TEMPLATE_CATEGORY_LABELS));
1960
+ function isTemplateStoreCategory(value) {
1961
+ return STORE_CATEGORIES.has(value);
1962
+ }
1963
+ /**
1964
+ * Category values that are not store categories but name one unambiguously.
1965
+ *
1966
+ * The store's first templates (seeded before BOFF-10462) set their content's
1967
+ * `defaultCategory` to `notification`, `ai-automation`, `ai-data` or
1968
+ * `developer-tools`, and the importer prefers that field over the store
1969
+ * product's category, so workflows imported from them still carry these
1970
+ * values. `ai` and `ai/ml` are the short forms people type by hand. A Map
1971
+ * rather than an object literal, so a value such as `constructor` cannot
1972
+ * resolve through the object prototype.
1973
+ */
1974
+ const CATEGORY_ALIASES = /* @__PURE__ */ new Map([
1975
+ ["notification", "communication"],
1976
+ ["notifications", "communication"],
1977
+ ["ai-automation", "ai-ml"],
1978
+ ["ai-data", "ai-ml"],
1979
+ ["developer-tools", "devops"],
1980
+ ["ai", "ai-ml"],
1981
+ ["ai/ml", "ai-ml"]
1982
+ ]);
1983
+ /**
1984
+ * The store category a workflow's stored `category` names, or `undefined`
1985
+ * when it names none. Matching ignores case and treats spaces and
1986
+ * underscores as hyphens, so "Data Processing" and "data_processing" both
1987
+ * resolve to `data-processing`.
1988
+ */
1989
+ function storedGalleryCategory(category) {
1990
+ const value = category?.trim().toLowerCase().replace(/[\s_]+/g, "-");
1991
+ if (!value) return void 0;
1992
+ if (isTemplateStoreCategory(value)) return value;
1993
+ return CATEGORY_ALIASES.get(value);
1994
+ }
1995
+ const KEYWORD_RULES = [
1996
+ {
1997
+ category: "ai-ml",
1998
+ word: /(?<![a-z0-9])(?:ai|ml)(?![a-z0-9])/,
1999
+ stems: [
2000
+ "model",
2001
+ "llm",
2002
+ "openai",
2003
+ "gpt"
2004
+ ]
2005
+ },
2006
+ {
2007
+ category: "integration",
2008
+ word: /(?<![a-z0-9])apis?(?![a-z0-9])/,
2009
+ stems: ["integrat", "connect"]
2010
+ },
2011
+ {
2012
+ category: "data-processing",
2013
+ word: /(?<![a-z0-9])etl(?![a-z0-9])/,
2014
+ stems: [
2015
+ "data",
2016
+ "transform",
2017
+ "process"
2018
+ ]
2019
+ },
2020
+ {
2021
+ category: "communication",
2022
+ stems: [
2023
+ "email",
2024
+ "slack",
2025
+ "notify",
2026
+ "message"
2027
+ ]
2028
+ },
2029
+ {
2030
+ category: "automation",
2031
+ stems: [
2032
+ "automat",
2033
+ "schedule",
2034
+ "trigger"
2035
+ ]
2036
+ }
2037
+ ];
2038
+ /** The category a workflow falls back to when no keyword matches. */
2039
+ const DEFAULT_GALLERY_CATEGORY = "automation";
2040
+ /**
2041
+ * Guess a category from the workflow's name, description, tags and category
2042
+ * text. Only used when the stored category names no store category.
2043
+ */
2044
+ function inferGalleryCategory(workflow) {
2045
+ const text = [
2046
+ workflow.name,
2047
+ workflow.description ?? "",
2048
+ ...workflow.tags ?? [],
2049
+ workflow.category ?? ""
2050
+ ].join(" ").toLowerCase();
2051
+ for (const rule of KEYWORD_RULES) if (rule.word?.test(text) || rule.stems.some((s) => text.includes(s))) return rule.category;
2052
+ return DEFAULT_GALLERY_CATEGORY;
2053
+ }
2054
+ /**
2055
+ * The gallery category for a workflow: its stored category when that names a
2056
+ * store category, otherwise the keyword guess.
2057
+ */
2058
+ function galleryCategory(workflow) {
2059
+ return storedGalleryCategory(workflow.category) ?? inferGalleryCategory(workflow);
2060
+ }
2061
+
2062
+ // src/modules/templates/components/PageTabsWithMore.tsx
2063
+ /**
2064
+ * Page tabs with a "More ▾" menu (Navigation v2, BOFF-11848): the everyday
2065
+ * tabs show as tabs, the rest sit one click away in "More". A tab picked from
2066
+ * the menu shows as the selected tab next to the everyday ones, so the page
2067
+ * always says where you are.
2068
+ *
2069
+ * A local stand-in for BOFF-11841's shared "page tabs with More ▾"; the props
2070
+ * are plain data so that component can replace it without touching callers.
2071
+ */
2072
+ /**
2073
+ * Under the loading system a count sits in a box at least three digits wide, with even digits,
2074
+ * so a count on its way (an empty badge) and the count that lands (1 to 999) take the same room
2075
+ * and the tabs after it do not slide (BOFF-16481). Without it, today's badge.
2076
+ */
2077
+ const COUNT_BOX = (loadingSystem) => loadingSystem ? " inline-block min-w-[3ch] text-center tabular-nums" : "";
2078
+ /** One page tab (also today's Templates source tabs, switch off). */
2079
+ function TabButton({ tab, selected, onSelect }) {
2080
+ const loadingSystem = useLoadingSystem();
2081
+ return /* @__PURE__ */ jsxs("button", {
2082
+ type: "button",
2083
+ role: "tab",
2084
+ "aria-selected": selected,
2085
+ onClick: onSelect,
2086
+ "data-testid": `templates-tab-${tab.id}`,
2087
+ className: `px-4 py-2 rounded-md text-sm font-medium transition-colors ${selected ? "bg-surface-canvas text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
2088
+ children: [
2089
+ tab.icon && /* @__PURE__ */ jsx(OfflineIcon, {
2090
+ icon: tab.icon,
2091
+ className: "inline mr-1.5",
2092
+ width: 16
2093
+ }),
2094
+ tab.label,
2095
+ tab.count !== void 0 && tab.count > 0 ? /* @__PURE__ */ jsx("span", {
2096
+ className: `ml-1.5 text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded-full${COUNT_BOX(loadingSystem)}`,
2097
+ children: tab.count
2098
+ }) : tab.countPending && loadingSystem ? /* @__PURE__ */ jsx("span", {
2099
+ className: `ml-1.5 text-xs bg-primary/10 px-1.5 py-0.5 rounded-full${COUNT_BOX(true)}`,
2100
+ "aria-hidden": "true",
2101
+ "data-count-pending": "",
2102
+ children: /* @__PURE__ */ jsx("span", {
2103
+ className: "invisible",
2104
+ children: "0"
2105
+ })
2106
+ }) : null
2107
+ ]
2108
+ });
2109
+ }
2110
+ function PageTabsWithMore({ tabs, moreTabs, value, onChange, label, "data-tour": dataTour }) {
2111
+ const tr = useTr();
2112
+ const pickedFromMore = moreTabs.find((tab) => tab.id === value);
2113
+ return /* @__PURE__ */ jsxs("div", {
2114
+ className: "flex flex-wrap items-center gap-2 mb-6",
2115
+ children: [/* @__PURE__ */ jsx("div", {
2116
+ className: "flex gap-1 p-1 bg-surface rounded-lg w-fit",
2117
+ role: "tablist",
2118
+ "aria-label": label,
2119
+ "data-tour": dataTour,
2120
+ children: [...tabs, ...pickedFromMore ? [pickedFromMore] : []].map((tab) => /* @__PURE__ */ jsx(TabButton, {
2121
+ tab,
2122
+ selected: tab.id === value,
2123
+ onSelect: () => onChange(tab.id)
2124
+ }, tab.id))
2125
+ }), moreTabs.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
2126
+ asChild: true,
2127
+ children: /* @__PURE__ */ jsxs(Button$1, {
2128
+ variant: "ghost",
2129
+ size: "sm",
2130
+ "data-testid": "templates-tabs-more",
2131
+ className: "text-text-secondary",
2132
+ children: [tr("fluidgrids.templates.templatesPage.moreTabs", "More"), /* @__PURE__ */ jsx(OfflineIcon, {
2133
+ icon: "mdi:chevron-down",
2134
+ className: "ml-1",
2135
+ width: 16
2136
+ })]
2137
+ })
2138
+ }), /* @__PURE__ */ jsx(DropdownMenuContent, {
2139
+ align: "start",
2140
+ children: moreTabs.map((tab) => /* @__PURE__ */ jsxs(DropdownMenuItem, {
2141
+ onSelect: () => onChange(tab.id),
2142
+ "data-testid": `templates-tabs-more-${tab.id}`,
2143
+ children: [tab.icon && /* @__PURE__ */ jsx(OfflineIcon, {
2144
+ icon: tab.icon,
2145
+ className: "mr-2",
2146
+ width: 16
2147
+ }), tab.label]
2148
+ }, tab.id))
2149
+ })] })]
2150
+ });
2151
+ }
2152
+
2153
+ // src/hooks/store/useWorkflowTemplateCategories.ts
2154
+ /**
2155
+ * The Store's own template categories (Navigation v2, BOFF-11848): the
2156
+ * categories the published workflow templates actually use, with counts,
2157
+ * from `browseStore`'s facets. The Templates page builds its category chips
2158
+ * from them instead of a fixed list, so a chip never leads to an empty page
2159
+ * and a new store category shows up without a code change.
2160
+ *
2161
+ * The facets are read without a category filter (only the search), so every
2162
+ * category stays offered while one is selected.
2163
+ */
2164
+ const BROWSE_WORKFLOW_TEMPLATE_CATEGORIES = gql`
2165
+ query BrowseWorkflowTemplateCategories($input: BrowseStoreInput!) {
2166
+ browseStore(input: $input) {
2167
+ totalCount
2168
+ facets {
2169
+ categories {
2170
+ value
2171
+ count
2172
+ }
2173
+ }
2174
+ }
2175
+ }
2176
+ `;
2177
+ /**
2178
+ * The categories in use, most templates first (ties by name), without empty
2179
+ * or blank ones.
2180
+ */
2181
+ function templateCategoriesFrom(data) {
2182
+ return (data?.browseStore?.facets?.categories ?? []).filter((facet) => facet.value.trim() && facet.count > 0).map((facet) => ({
2183
+ value: facet.value.trim(),
2184
+ count: facet.count
2185
+ })).sort((a, b) => b.count - a.count || a.value.localeCompare(b.value));
2186
+ }
2187
+ function useWorkflowTemplateCategories(searchTerm, enabled) {
2188
+ const client = useGlobalStoreClient();
2189
+ const context = useContext(FluidGridsContext);
2190
+ const workspaceId = context?.workspaceId ?? getFluidGridsConfig().workspaceId;
2191
+ const organizationId = context?.organizationId;
2192
+ const headers = useMemo(() => {
2193
+ const value = {};
2194
+ if (organizationId) value["x-organization-id"] = organizationId;
2195
+ if (workspaceId) value["x-workspace-id"] = workspaceId;
2196
+ return value;
2197
+ }, [organizationId, workspaceId]);
2198
+ const { data, loading } = useQuery(BROWSE_WORKFLOW_TEMPLATE_CATEGORIES, {
2199
+ client,
2200
+ skip: !enabled,
2201
+ fetchPolicy: "cache-first",
2202
+ variables: { input: {
2203
+ filter: {
2204
+ type: "WORKFLOW",
2205
+ status: "PUBLISHED",
2206
+ search: searchTerm?.trim() || void 0
2207
+ },
2208
+ pagination: {
2209
+ limit: 1,
2210
+ offset: 0
2211
+ }
2212
+ } },
2213
+ context: Object.keys(headers).length > 0 ? { headers } : void 0
2214
+ });
2215
+ return {
2216
+ categories: useMemo(() => templateCategoriesFrom(data), [data]),
2217
+ totalCount: data?.browseStore?.totalCount ?? 0,
2218
+ loading
2219
+ };
2220
+ }
2221
+
2222
+ // src/modules/templates/components/StoreGalleryV2.tsx
2223
+ /**
2224
+ * The Template gallery (Navigation v2, BOFF-14754): search and sort, one row
2225
+ * of category chips, compact cards and a numbered pager. It shows what the
2226
+ * page gives it; the page owns the query, the URL state and the import flow.
2227
+ */
2228
+ function categoryIconName(value) {
2229
+ return value in TEMPLATE_CATEGORY_ICONS ? TEMPLATE_CATEGORY_ICONS[value] : "mdi:tag-outline";
2230
+ }
2231
+ function SortMenu({ tr, searching, sort, onChange }) {
2232
+ const current = sortLabel(tr, sort);
2233
+ const aria = tr("fluidgrids.templates.sort.ariaCurrent", "Sort: {{sort}}", { sort: current });
2234
+ const content = /* @__PURE__ */ jsx(DropdownMenuContent, {
2235
+ align: "end",
2236
+ className: "min-w-[200px]",
2237
+ children: /* @__PURE__ */ jsx(DropdownMenuRadioGroup, {
2238
+ value: sort,
2239
+ onValueChange: (value) => {
2240
+ const next = sortOptions(searching).find((item) => item === value);
2241
+ if (next) onChange(next);
2242
+ },
2243
+ children: sortOptions(searching).map((option) => /* @__PURE__ */ jsx(DropdownMenuRadioItem, {
2244
+ value: option,
2245
+ children: sortLabel(tr, option)
2246
+ }, option))
2247
+ })
2248
+ });
2249
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
2250
+ className: "ms-auto hidden items-center gap-2 sm:flex",
2251
+ children: [/* @__PURE__ */ jsx("span", {
2252
+ className: "text-[13px] text-text-muted",
2253
+ "aria-hidden": "true",
2254
+ children: tr("fluidgrids.templates.sort.label", "Sort")
2255
+ }), /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
2256
+ asChild: true,
2257
+ children: /* @__PURE__ */ jsxs("button", {
2258
+ type: "button",
2259
+ "aria-label": aria,
2260
+ "data-testid": "store-sort",
2261
+ className: "inline-flex h-10 items-center gap-2 rounded-lg border border-border-default bg-bg-elevated px-3 text-sm text-text-primary outline-none focus-visible:ring-2 focus-visible:ring-accent-glow",
2262
+ children: [current, /* @__PURE__ */ jsx(ChevronDown, {
2263
+ className: "size-4 text-text-muted",
2264
+ "aria-hidden": "true"
2265
+ })]
2266
+ })
2267
+ }), content] })]
2268
+ }), /* @__PURE__ */ jsx("div", {
2269
+ className: "sm:hidden",
2270
+ children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
2271
+ asChild: true,
2272
+ children: /* @__PURE__ */ jsx("button", {
2273
+ type: "button",
2274
+ "aria-label": aria,
2275
+ "data-testid": "store-sort-icon",
2276
+ className: "inline-flex size-[42px] items-center justify-center rounded-[10px] border border-border-default bg-bg-elevated text-text-secondary outline-none focus-visible:ring-2 focus-visible:ring-accent-glow",
2277
+ children: /* @__PURE__ */ jsx(ArrowUpDown, {
2278
+ className: "size-4",
2279
+ "aria-hidden": "true"
2280
+ })
2281
+ })
2282
+ }), content] })
2283
+ })] });
2284
+ }
2285
+ /**
2286
+ * The pager is shared (`@burdenoff/fe-libs/ui`); the words stay Templates' own.
2287
+ * Each label is a literal `tr()` call so the app's word extractor finds it.
2288
+ */
2289
+ function Pager({ tr, page, totalPages, total, onPage }) {
2290
+ const labels = {
2291
+ pagesNav: tr("fluidgrids.templates.gallery.pagesNav", "Pages"),
2292
+ previous: tr("fluidgrids.templates.gallery.previous", "Previous"),
2293
+ next: tr("fluidgrids.templates.gallery.next", "Next"),
2294
+ previousPage: tr("fluidgrids.templates.gallery.previousPage", "Previous page"),
2295
+ nextPage: tr("fluidgrids.templates.gallery.nextPage", "Next page"),
2296
+ showing: (start, end, count) => tr("fluidgrids.templates.gallery.showing", "Showing {{start}}–{{end}} of {{total}}", {
2297
+ start,
2298
+ end,
2299
+ total: count
2300
+ }),
2301
+ pageAria: (item) => tr("fluidgrids.templates.gallery.pageAria", "Page {{page}}", { page: item }),
2302
+ pageOf: (current, pages) => tr("fluidgrids.templates.gallery.pageOf", "Page {{page}} of {{pages}}", {
2303
+ page: current,
2304
+ pages
2305
+ })
2306
+ };
2307
+ return /* @__PURE__ */ jsx(GalleryPager, {
2308
+ page,
2309
+ totalPages,
2310
+ total,
2311
+ pageSize: GALLERY_PAGE_SIZE,
2312
+ onPage,
2313
+ labels
2314
+ });
2315
+ }
2316
+ /** The search box and Sort. */
2317
+ function GalleryToolbar({ tr, search, onSearchChange, allCount, sort, onSortChange }) {
2318
+ return /* @__PURE__ */ jsxs("div", {
2319
+ className: "mb-3.5 flex items-center gap-2.5 sm:flex-wrap",
2320
+ children: [/* @__PURE__ */ jsxs("div", {
2321
+ className: "relative min-w-0 flex-1 sm:max-w-md sm:flex-[1_1_320px]",
2322
+ "data-tour": "fluidgrids-templates-search",
2323
+ children: [/* @__PURE__ */ jsx(Search, {
2324
+ className: "absolute left-3 top-1/2 size-[18px] -translate-y-1/2 text-text-secondary",
2325
+ "aria-hidden": "true"
2326
+ }), /* @__PURE__ */ jsx(Input, {
2327
+ type: "search",
2328
+ "aria-label": tr("fluidgrids.templates.gallery.searchLabel", "Search templates"),
2329
+ placeholder: allCount > 0 ? tr("fluidgrids.templates.gallery.searchPlaceholder", "Search {{count}} templates…", { count: allCount }) : tr("fluidgrids.templates.gallery.searchPlaceholderNoCount", "Search templates…"),
2330
+ value: search,
2331
+ onChange: (event) => onSearchChange(event.target.value),
2332
+ className: "h-10 border-border-default bg-surface pl-10"
2333
+ })]
2334
+ }), /* @__PURE__ */ jsx(SortMenu, {
2335
+ tr,
2336
+ searching: search.trim().length > 0,
2337
+ sort,
2338
+ onChange: onSortChange
2339
+ })]
2340
+ });
2341
+ }
2342
+ /** One row of category chips: All, the six largest, the selected one, and "N more". */
2343
+ function CategoryChips({ tr, facets, facetsTotal, category, onCategoryChange, loading = false }) {
2344
+ const loadingSystem = useLoadingSystem();
2345
+ const rail = /* @__PURE__ */ jsx(GalleryCategoryRail, {
2346
+ facets,
2347
+ facetsTotal,
2348
+ category,
2349
+ onCategoryChange,
2350
+ labelFor: (value) => storeCategoryLabel(tr, value),
2351
+ iconFor: (value) => /* @__PURE__ */ jsx(OfflineIcon, {
2352
+ icon: categoryIconName(value),
2353
+ width: 16
2354
+ }),
2355
+ allIcon: /* @__PURE__ */ jsx(OfflineIcon, {
2356
+ icon: "mdi:view-grid",
2357
+ width: 16
2358
+ }),
2359
+ allLabel: tr("fluidgrids.templates.categories.all", "All"),
2360
+ moreLabel: (count) => tr("fluidgrids.templates.gallery.moreCategories", "{{count}} more", { count }),
2361
+ moreTitle: tr("fluidgrids.templates.gallery.moreCategoriesTitle", "More categories"),
2362
+ topCount: TOP_CATEGORY_COUNT,
2363
+ testId: "store-template-categories",
2364
+ moreTestId: "store-categories-more"
2365
+ });
2366
+ return loadingSystem ? /* @__PURE__ */ jsx(HeldLoadRegion, {
2367
+ hold: loading,
2368
+ loading,
2369
+ skeleton: /* @__PURE__ */ jsx(GalleryChipsSkeleton, {}),
2370
+ children: rail
2371
+ }) : rail;
2372
+ }
2373
+ /** The results area could not load: scoped here, with Try again. */
2374
+ function GalleryError({ tr, error, onRetry }) {
2375
+ return /* @__PURE__ */ jsx(StatePanel, {
2376
+ kind: "error",
2377
+ role: "alert",
2378
+ icon: /* @__PURE__ */ jsx(AlertCircle, {
2379
+ className: "size-5 text-status-error-text",
2380
+ "aria-hidden": "true"
2381
+ }),
2382
+ title: tr("fluidgrids.templates.gallery.errorTitle", "Templates couldn’t load"),
2383
+ text: tr("fluidgrids.templates.gallery.errorText", "Check your connection and try again. Your search and category stay as they are."),
2384
+ children: /* @__PURE__ */ jsxs("div", {
2385
+ className: "flex flex-col items-center gap-2",
2386
+ children: [/* @__PURE__ */ jsx(Button$1, {
2387
+ variant: "outline",
2388
+ onClick: onRetry,
2389
+ children: tr("fluidgrids.templates.gallery.tryAgain", "Try again")
2390
+ }), /* @__PURE__ */ jsx(TechnicalDetails, { children: /* @__PURE__ */ jsx("p", {
2391
+ className: "break-words text-sm text-status-error-text",
2392
+ children: error.message
2393
+ }) })]
2394
+ })
2395
+ });
2396
+ }
2397
+ /**
2398
+ * Nothing matched. With a search: say what was searched, offer Clear search, All
2399
+ * categories and the assistant (whose suggestion only fills its message box).
2400
+ * A category alone (an old link, or a category the store no longer has): say the
2401
+ * category is empty and offer All categories.
2402
+ */
2403
+ function GalleryNoMatch({ tr, query, category, categoryName, onSearchChange, onCategoryChange }) {
2404
+ const askAssistant = useFgAskAssistant();
2405
+ const searching = query.length > 0;
2406
+ const allCategories = category !== "all" ? /* @__PURE__ */ jsx(Button$1, {
2407
+ variant: "outline",
2408
+ onClick: () => onCategoryChange("all"),
2409
+ children: tr("fluidgrids.templates.gallery.allCategories", "All categories")
2410
+ }) : null;
2411
+ if (!searching) return /* @__PURE__ */ jsx(StatePanel, {
2412
+ kind: "filtered",
2413
+ icon: /* @__PURE__ */ jsx(Search, {
2414
+ className: "size-5 text-text-secondary",
2415
+ "aria-hidden": "true"
2416
+ }),
2417
+ title: tr("fluidgrids.templates.gallery.noneInCategory", "No templates in {{category}} yet", { category: categoryName }),
2418
+ text: tr("fluidgrids.templates.gallery.noneInCategoryHint", "Look in every category, or describe what you need to the assistant and it will build the workflow."),
2419
+ children: allCategories
2420
+ });
2421
+ const askAbout = () => askAssistant?.({
2422
+ kind: "template-search",
2423
+ label: tr("fluidgrids.templates.gallery.askLabel", "Template search “{{query}}”", { query }),
2424
+ suggestions: [tr("fluidgrids.templates.gallery.askSuggestion", "Build a workflow that {{query}}", { query })]
2425
+ });
2426
+ return /* @__PURE__ */ jsxs(StatePanel, {
2427
+ kind: "no-results",
2428
+ icon: /* @__PURE__ */ jsx(Search, {
2429
+ className: "size-5 text-text-secondary",
2430
+ "aria-hidden": "true"
2431
+ }),
2432
+ title: category === "all" ? tr("fluidgrids.templates.gallery.noMatchAll", "No templates match “{{query}}”", { query }) : tr("fluidgrids.templates.gallery.noMatchIn", "No templates match “{{query}}” in {{category}}", {
2433
+ query,
2434
+ category: categoryName
2435
+ }),
2436
+ text: tr("fluidgrids.templates.gallery.noMatchHint", "Try other words, or look in every category. You can also describe it to the assistant and it will build the workflow."),
2437
+ children: [
2438
+ /* @__PURE__ */ jsx(Button$1, {
2439
+ variant: "outline",
2440
+ onClick: () => onSearchChange(""),
2441
+ children: tr("fluidgrids.templates.gallery.clearSearch", "Clear search")
2442
+ }),
2443
+ allCategories,
2444
+ askAssistant && /* @__PURE__ */ jsxs(Button$1, {
2445
+ onClick: askAbout,
2446
+ children: [/* @__PURE__ */ jsx(Sparkles, {
2447
+ className: "mr-1.5 size-4",
2448
+ "aria-hidden": "true"
2449
+ }), tr("fluidgrids.templates.gallery.askAssistant", "Ask the assistant")]
2450
+ })
2451
+ ]
2452
+ });
2453
+ }
2454
+ /** The cards: skeletons on the first load; the previous page dimmed under a bar while the next loads. */
2455
+ function GalleryGrid({ tr, templates, showSkeleton, loading, pageLoading, page, onUseTemplate, footer }) {
2456
+ const loadingSystem = useLoadingSystem();
2457
+ const grid = (skeleton) => /* @__PURE__ */ jsx("div", {
2458
+ className: cn("grid gap-3.5", CATALOG_GRID_COLUMNS, pageLoading && "opacity-55"),
2459
+ "aria-busy": loading,
2460
+ "data-testid": "store-template-grid",
2461
+ children: skeleton ? Array.from({ length: 8 }, (_, index) => /* @__PURE__ */ jsx(StoreTemplateCardSkeleton, {}, index)) : templates.map((template) => /* @__PURE__ */ jsx(StoreTemplateCardCompact, {
2462
+ template,
2463
+ previewTo: `../templates/${template.id}/preview`,
2464
+ onUseTemplate
2465
+ }, template.id))
2466
+ });
2467
+ return /* @__PURE__ */ jsxs("div", {
2468
+ className: "relative",
2469
+ children: [pageLoading && /* @__PURE__ */ jsx("div", {
2470
+ role: "progressbar",
2471
+ "aria-label": tr("fluidgrids.templates.gallery.loadingPage", "Loading page {{page}}", { page }),
2472
+ className: "absolute inset-x-0 -top-2 h-[3px] overflow-hidden rounded bg-border-subtle",
2473
+ "data-testid": "store-page-progress",
2474
+ children: /* @__PURE__ */ jsx("span", { className: "absolute left-0 top-0 h-[3px] w-1/3 rounded bg-accent-glow motion-safe:animate-pulse" })
2475
+ }), loadingSystem ? /* @__PURE__ */ jsxs(LoadRegion, {
2476
+ loading: showSkeleton,
2477
+ skeleton: /* @__PURE__ */ jsx(TemplateCardsSkeleton, {}),
2478
+ label: tr("fluidgrids.templates.gallery.loadingRegion", "Loading templates"),
2479
+ doneLabel: tr("fluidgrids.templates.gallery.loadedRegion", "Templates loaded"),
2480
+ children: [grid(false), footer]
2481
+ }) : grid(showSkeleton)]
2482
+ });
2483
+ }
2484
+ /** The results heading, the results (or why there are none) and the pager. */
2485
+ function GalleryResults(props) {
2486
+ const { tr, search, category, page, totalCount, hasData, loading } = props;
2487
+ const { pageLoading, error } = props;
2488
+ const query = search.trim();
2489
+ const totalPages = totalPagesFor(totalCount, GALLERY_PAGE_SIZE);
2490
+ const headingRef = useRef(null);
2491
+ const focusAfterLoad = useRef(false);
2492
+ useEffect(() => {
2493
+ if (!focusAfterLoad.current || pageLoading || !hasData) return;
2494
+ focusAfterLoad.current = false;
2495
+ const heading = headingRef.current;
2496
+ if (!heading) return;
2497
+ heading.focus({ preventScroll: true });
2498
+ heading.scrollIntoView?.({ block: "start" });
2499
+ }, [
2500
+ pageLoading,
2501
+ hasData,
2502
+ page
2503
+ ]);
2504
+ const goToPage = (next) => {
2505
+ focusAfterLoad.current = true;
2506
+ props.onPageChange(clampPage(next, totalPages));
2507
+ };
2508
+ const categoryName = category === "all" ? tr("fluidgrids.templates.gallery.allTemplates", "All templates") : storeCategoryLabel(tr, category);
2509
+ const { start, end } = pageRange(page, GALLERY_PAGE_SIZE, totalCount);
2510
+ const noMatch = hasData && !error && props.templates.length === 0;
2511
+ const showing = hasData && !error && !noMatch;
2512
+ const pager = showing && totalPages > 1 ? /* @__PURE__ */ jsx(Pager, {
2513
+ tr,
2514
+ page,
2515
+ totalPages,
2516
+ total: totalCount,
2517
+ onPage: goToPage
2518
+ }) : null;
2519
+ const loadingSystem = useLoadingSystem();
2520
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
2521
+ /* @__PURE__ */ jsxs("div", {
2522
+ className: "mb-3 flex items-baseline justify-between gap-3",
2523
+ children: [/* @__PURE__ */ jsx("h2", {
2524
+ ref: headingRef,
2525
+ tabIndex: -1,
2526
+ className: "text-[15px] font-semibold text-text-primary outline-none",
2527
+ "data-testid": "store-results-heading",
2528
+ children: categoryName
2529
+ }), showing && /* @__PURE__ */ jsx("span", {
2530
+ className: "text-[13px] text-text-muted max-sm:text-xs",
2531
+ children: tr("fluidgrids.templates.gallery.showing", "Showing {{start}}–{{end}} of {{total}}", {
2532
+ start,
2533
+ end,
2534
+ total: totalCount
2535
+ })
2536
+ })]
2537
+ }),
2538
+ error ? /* @__PURE__ */ jsx(GalleryError, {
2539
+ tr,
2540
+ error,
2541
+ onRetry: props.onRetry
2542
+ }) : noMatch ? /* @__PURE__ */ jsx(GalleryNoMatch, {
2543
+ tr,
2544
+ query,
2545
+ category,
2546
+ categoryName,
2547
+ onSearchChange: props.onSearchChange,
2548
+ onCategoryChange: props.onCategoryChange
2549
+ }) : /* @__PURE__ */ jsx(GalleryGrid, {
2550
+ tr,
2551
+ templates: props.templates,
2552
+ showSkeleton: !hasData && loading,
2553
+ loading,
2554
+ pageLoading,
2555
+ page,
2556
+ onUseTemplate: props.onUseTemplate,
2557
+ footer: loadingSystem ? pager : void 0
2558
+ }),
2559
+ loadingSystem ? null : pager,
2560
+ /* @__PURE__ */ jsx("span", {
2561
+ className: "sr-only",
2562
+ "aria-live": "polite",
2563
+ children: showing && !pageLoading ? tr("fluidgrids.templates.gallery.showing", "Showing {{start}}–{{end}} of {{total}}", {
2564
+ start,
2565
+ end,
2566
+ total: totalCount
2567
+ }) : ""
2568
+ })
2569
+ ] });
2570
+ }
2571
+ function StoreGalleryV2(props) {
2572
+ const tr = useTr();
2573
+ const searching = props.search.trim().length > 0;
2574
+ const firstRun = props.hasData && !props.error && props.templates.length === 0 && !searching && props.category === "all";
2575
+ return /* @__PURE__ */ jsxs("div", {
2576
+ "data-testid": "store-gallery",
2577
+ children: [
2578
+ /* @__PURE__ */ jsx(GalleryToolbar, {
2579
+ tr,
2580
+ search: props.search,
2581
+ onSearchChange: props.onSearchChange,
2582
+ allCount: props.allCount,
2583
+ sort: props.sort,
2584
+ onSortChange: props.onSortChange
2585
+ }),
2586
+ /* @__PURE__ */ jsx(CategoryChips, {
2587
+ tr,
2588
+ facets: props.facets,
2589
+ facetsTotal: props.facetsTotal,
2590
+ category: props.category,
2591
+ onCategoryChange: props.onCategoryChange,
2592
+ loading: props.categoriesLoading
2593
+ }),
2594
+ firstRun ? props.firstRun : /* @__PURE__ */ jsx(GalleryResults, {
2595
+ ...props,
2596
+ tr
2597
+ })
2598
+ ]
2599
+ });
2600
+ }
2601
+
2602
+ // src/modules/templates/pages/TemplatesPage.tsx
2603
+ var TemplatesPage_exports = /* @__PURE__ */ __exportAll({ TemplatesPage: () => TemplatesPage });
2604
+ /**
2605
+ * Category chips, shared by My Templates and From Store. My Templates groups
2606
+ * by the same store categories, read from each workflow's stored category
2607
+ * (see utils/gallery-category.ts, BOFF-9976).
2608
+ */
2609
+ const CATEGORY_FILTERS = ["all", ...TEMPLATE_STORE_CATEGORIES];
2610
+ /** The same chips for the assistant's page controls. */
2611
+ const CATEGORY_FILTER_OPTIONS = CATEGORY_FILTERS.map((value) => ({
2612
+ value,
2613
+ label: value === "all" ? "All" : TEMPLATE_CATEGORY_LABELS[value]
2614
+ }));
2615
+ const CATEGORY_COLORS = {
2616
+ "data-processing": "bg-status-info-bg-subtle text-status-info-text border-status-info-border",
2617
+ integration: "bg-chart-3/10 text-chart-3 border-chart-3/30",
2618
+ automation: "bg-status-success-bg-subtle text-status-success-text border-status-success-border",
2619
+ "ai-ml": "bg-status-warning-bg-subtle text-status-warning-text border-status-warning-border",
2620
+ communication: "bg-status-error-bg-subtle text-status-error-text border-status-error-border",
2621
+ devops: "bg-chart-1/10 text-chart-1 border-chart-1/30",
2622
+ marketing: "bg-chart-5/10 text-chart-5 border-chart-5/30",
2623
+ sales: "bg-chart-4/10 text-chart-4 border-chart-4/30",
2624
+ support: "bg-chart-6/10 text-chart-6 border-chart-6/30",
2625
+ productivity: "bg-chart-7/10 text-chart-7 border-chart-7/30",
2626
+ finance: "bg-chart-12/10 text-chart-12 border-chart-12/30"
2627
+ };
2628
+ function categoryIcon(value) {
2629
+ return value === "all" ? "mdi:view-grid" : TEMPLATE_CATEGORY_ICONS[value];
2630
+ }
2631
+ /**
2632
+ * Navigation v2 (BOFF-11845/11848): task words instead of developer
2633
+ * categories. The other categories keep their names.
2634
+ */
2635
+ const PLAIN_CATEGORY_LABELS = {
2636
+ "ai-ml": "AI",
2637
+ "data-processing": "Data & spreadsheets",
2638
+ integration: "Connect apps"
2639
+ };
2640
+ /** Translated chip and badge label for a category filter value. */
2641
+ function categoryLabel(tr, value, plain = false) {
2642
+ return value === "all" ? tr("fluidgrids.templates.categories.all", "All") : tr(`fluidgrids.templates.categories.${value}`, (plain ? PLAIN_CATEGORY_LABELS[value] : void 0) ?? TEMPLATE_CATEGORY_LABELS[value]);
2643
+ }
2644
+ function CategoryChip({ label, icon, active, onSelect, count }) {
2645
+ return /* @__PURE__ */ jsxs("button", {
2646
+ onClick: onSelect,
2647
+ "aria-pressed": active,
2648
+ className: `inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors ${active ? "bg-surface-sunken text-text-primary border border-border-strong" : "bg-surface text-text-secondary border border-border-default hover:text-text-primary hover:border-border-strong"}`,
2649
+ children: [
2650
+ /* @__PURE__ */ jsx(OfflineIcon, {
2651
+ icon,
2652
+ width: 16
2653
+ }),
2654
+ label,
2655
+ count !== void 0 && /* @__PURE__ */ jsxs("span", {
2656
+ className: `ml-0.5 text-xs ${active ? "text-text-primary" : "text-text-secondary"}`,
2657
+ children: [
2658
+ "(",
2659
+ count,
2660
+ ")"
2661
+ ]
2662
+ })
2663
+ ]
2664
+ });
2665
+ }
2666
+ /**
2667
+ * The "Copy a workspace workflow" (My Templates) grid: today's 3 columns,
2668
+ * which every app keeps. Navigation v2 (FluidGrids) adds columns on screens
2669
+ * of 1800 px and wider instead of stretching the cards (W2); below that it
2670
+ * changes nothing.
2671
+ */
2672
+ function workspaceGridClass(v2) {
2673
+ return cn("grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4", v2 && "min-[112.5rem]:grid-cols-[repeat(auto-fill,minmax(min(20rem,100%),1fr))]");
2674
+ }
2675
+ function TemplateSkeleton() {
2676
+ const v2 = useNavigationV2();
2677
+ return /* @__PURE__ */ jsx("div", {
2678
+ className: workspaceGridClass(v2),
2679
+ "data-testid": "template-grid-skeleton",
2680
+ children: Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsx(Skeleton, { className: "h-52 rounded-lg bg-card-foreground/10" }, i))
2681
+ });
2682
+ }
2683
+ function TemplatesEmptyState({ hasSearch, searching = false, hint }) {
2684
+ const tr = useTr();
2685
+ return /* @__PURE__ */ jsx(EmptyState, {
2686
+ kind: !hasSearch ? "first-use" : searching ? "no-results" : "filtered",
2687
+ illustration: "documents",
2688
+ size: "page",
2689
+ icon: /* @__PURE__ */ jsx(OfflineIcon, {
2690
+ icon: "mdi:file-document-multiple-outline",
2691
+ width: 40,
2692
+ className: "text-text-secondary"
2693
+ }),
2694
+ title: hasSearch ? tr("fluidgrids.templates.templatesPage.emptyStateSearchTitle", "No matching templates") : tr("fluidgrids.templates.templatesPage.emptyStateTitle", "No templates available yet"),
2695
+ description: hasSearch ? tr("fluidgrids.templates.templatesPage.emptyStateSearchHint", "Try adjusting your search or category filter.") : hint ?? tr("fluidgrids.templates.templatesPage.emptyStateHint", "Published workflows will appear here as reusable templates.")
2696
+ });
2697
+ }
2698
+ function ErrorState({ message, onRetry }) {
2699
+ const tr = useTr();
2700
+ const plain = useNavigationV2();
2701
+ return /* @__PURE__ */ jsxs("div", {
2702
+ className: "p-4 bg-[var(--color-status-error-bg-subtle)] border border-[var(--color-status-error-border)] rounded-lg",
2703
+ children: [
2704
+ /* @__PURE__ */ jsxs("div", {
2705
+ className: "flex items-center gap-2 text-[var(--color-status-error-text)]",
2706
+ children: [/* @__PURE__ */ jsx(OfflineIcon, {
2707
+ icon: "mdi:alert-circle",
2708
+ width: 20
2709
+ }), /* @__PURE__ */ jsx("span", {
2710
+ className: "font-medium",
2711
+ children: plain ? tr("fluidgrids.templates.templatesPage.errorStatePlainTitle", "We couldn't load templates. Try again in a moment.") : tr("fluidgrids.templates.templatesPage.errorStateTitle", "Error loading templates")
2712
+ })]
2713
+ }),
2714
+ plain ? /* @__PURE__ */ jsx(TechnicalDetails, {
2715
+ className: "mt-1",
2716
+ children: /* @__PURE__ */ jsx("p", {
2717
+ className: "break-words text-sm text-[var(--color-status-error-text)]",
2718
+ children: message
2719
+ })
2720
+ }) : /* @__PURE__ */ jsx("p", {
2721
+ className: "mt-1 text-sm text-[var(--color-status-error-text)]",
2722
+ children: message
2723
+ }),
2724
+ /* @__PURE__ */ jsx(Button$1, {
2725
+ variant: "outline",
2726
+ size: "sm",
2727
+ onClick: onRetry,
2728
+ className: "mt-3 border-[var(--color-status-error-border)] text-[var(--color-status-error-text)] hover:bg-[var(--color-status-error-bg-subtle)]",
2729
+ children: tr("fluidgrids.templates.templatesPage.errorStateRetry", "Retry")
2730
+ })
2731
+ ]
2732
+ });
2733
+ }
2734
+ function WorkspaceTemplateCard({ workflow, category, onUseTemplate, onPublish, isLoading }) {
2735
+ const tr = useTr();
2736
+ const v2 = useNavigationV2();
2737
+ return /* @__PURE__ */ jsxs(Card, {
2738
+ className: "group border border-border-default bg-surface hover:border-border-strong transition-colors duration-200 flex flex-col",
2739
+ children: [/* @__PURE__ */ jsxs(CardHeader, {
2740
+ className: "flex-1 pb-3",
2741
+ children: [
2742
+ /* @__PURE__ */ jsxs("div", {
2743
+ className: "flex items-start justify-between gap-2 mb-3",
2744
+ children: [/* @__PURE__ */ jsx("div", {
2745
+ className: "rounded-lg bg-surface-sunken p-2.5",
2746
+ children: /* @__PURE__ */ jsx(OfflineIcon, {
2747
+ icon: workflow.icon ?? "mdi:workflow",
2748
+ width: 24,
2749
+ className: "text-text-primary",
2750
+ fallback: /* @__PURE__ */ jsx(OfflineIcon, {
2751
+ icon: "mdi:workflow",
2752
+ width: 24,
2753
+ className: "text-text-primary"
2754
+ })
2755
+ })
2756
+ }), /* @__PURE__ */ jsx(Badge, {
2757
+ variant: "outline",
2758
+ className: CATEGORY_COLORS[category],
2759
+ children: categoryLabel(tr, category, v2)
2760
+ })]
2761
+ }),
2762
+ /* @__PURE__ */ jsx("h3", {
2763
+ className: "font-semibold text-text-primary text-base leading-tight mb-1.5 line-clamp-2",
2764
+ children: workflow.name
2765
+ }),
2766
+ /* @__PURE__ */ jsx("p", {
2767
+ className: "text-sm text-text-secondary line-clamp-2 min-h-[2.5rem]",
2768
+ children: workflow.description || tr("fluidgrids.templates.templatesPage.cardNoDescription", "No description provided.")
2769
+ })
2770
+ ]
2771
+ }), /* @__PURE__ */ jsx("div", {
2772
+ className: "px-6 pb-5 pt-0",
2773
+ children: /* @__PURE__ */ jsxs("div", {
2774
+ className: cn("flex items-center gap-2", v2 ? "justify-end" : "justify-between"),
2775
+ children: [!v2 && /* @__PURE__ */ jsx("span", {
2776
+ className: "text-xs text-text-secondary",
2777
+ children: formatRunVersion(workflow.version)
2778
+ }), /* @__PURE__ */ jsxs("div", {
2779
+ className: "flex items-center gap-2",
2780
+ children: [/* @__PURE__ */ jsxs(Button$1, {
2781
+ variant: "outline",
2782
+ size: "sm",
2783
+ onClick: () => onPublish(workflow),
2784
+ disabled: isLoading,
2785
+ title: tr("fluidgrids.templates.templatesPage.cardPublishHint", "Publish this workflow to the FluidGrids Store"),
2786
+ "data-testid": "workspace-template-publish",
2787
+ children: [/* @__PURE__ */ jsx(OfflineIcon, {
2788
+ icon: "mdi:store-plus",
2789
+ width: 14,
2790
+ className: "mr-1.5"
2791
+ }), tr("fluidgrids.templates.templatesPage.cardPublish", "Publish")]
2792
+ }), /* @__PURE__ */ jsx(SdkPermissionButton, {
2793
+ permission: FLUIDGRIDS_PERMISSIONS.WORKFLOW_CREATE,
2794
+ deniedTooltip: tr("fluidgrids.templates.useDeniedTooltip", "You don't have permission to create workflows from templates"),
2795
+ children: /* @__PURE__ */ jsx(Button$1, {
2796
+ variant: "default",
2797
+ size: "sm",
2798
+ onClick: () => onUseTemplate(workflow),
2799
+ disabled: isLoading,
2800
+ className: "text-primary-foreground",
2801
+ children: isLoading ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(OfflineIcon, {
2802
+ icon: "mdi:loading",
2803
+ width: 14,
2804
+ className: "mr-1.5 animate-spin"
2805
+ }), tr("fluidgrids.templates.templatesPage.cardCreating", "Creating...")] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(OfflineIcon, {
2806
+ icon: "mdi:plus",
2807
+ width: 14,
2808
+ className: "mr-1.5"
2809
+ }), tr("fluidgrids.templates.templatesPage.cardUseTemplate", "Use Template")] })
2810
+ })
2811
+ })]
2812
+ })]
2813
+ })
2814
+ })]
2815
+ });
2816
+ }
2817
+ /** A tab's error, then its skeleton, empty state or content. */
2818
+ function TabContent({ error, onRetry, loading, empty, hasSearch, searching, emptyHint, children }) {
2819
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [error && /* @__PURE__ */ jsx("div", {
2820
+ className: "mb-6",
2821
+ children: /* @__PURE__ */ jsx(ErrorState, {
2822
+ message: error.message,
2823
+ onRetry
2824
+ })
2825
+ }), loading ? /* @__PURE__ */ jsx(TemplateSkeleton, {}) : empty ? /* @__PURE__ */ jsx(TemplatesEmptyState, {
2826
+ hasSearch,
2827
+ searching,
2828
+ hint: emptyHint
2829
+ }) : children] });
2830
+ }
2831
+ function LoadMoreButton({ loading, onClick }) {
2832
+ const tr = useTr();
2833
+ return /* @__PURE__ */ jsx("div", {
2834
+ className: "flex justify-center pt-4",
2835
+ children: /* @__PURE__ */ jsx(Button$1, {
2836
+ variant: "outline",
2837
+ onClick,
2838
+ disabled: loading,
2839
+ className: "min-w-[200px]",
2840
+ children: loading ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(OfflineIcon, {
2841
+ icon: "mdi:loading",
2842
+ width: 16,
2843
+ className: "mr-2 animate-spin"
2844
+ }), tr("fluidgrids.templates.templatesPage.loadingMore", "Loading...")] }) : tr("fluidgrids.templates.templatesPage.loadMoreTemplates", "Load More Templates")
2845
+ })
2846
+ });
2847
+ }
2848
+ function TemplatesPage() {
2849
+ const navigate = useNavigate();
2850
+ const tr = useTr();
2851
+ const v2 = useNavigationV2();
2852
+ const [search, setSearch] = useState("");
2853
+ const [activeCategory, setActiveCategory] = useState("all");
2854
+ const [duplicatingId, setDuplicatingId] = useState(null);
2855
+ const [activeSource, setActiveSource] = useState("store");
2856
+ const [quotaRefusal, setQuotaRefusal] = useState(null);
2857
+ const [searchParams, setSearchParams] = useSearchParams();
2858
+ const galleryUrl = useMemo(() => readGalleryUrl(searchParams), [searchParams]);
2859
+ const [legacyStoreCategory, setLegacyStoreCategory] = useState("all");
2860
+ const storeCategory = v2 ? galleryUrl.category : legacyStoreCategory;
2861
+ const updateGallery = useCallback((patch, options) => setSearchParams((previous) => withGalleryState(previous, patch), { replace: options?.replace }), [setSearchParams]);
2862
+ const setStoreCategory = useCallback((value) => v2 ? updateGallery({ category: value }) : setLegacyStoreCategory(value), [v2, updateGallery]);
2863
+ const [publishSource, setPublishSource] = useState(null);
2864
+ const [resubmitTarget, setResubmitTarget] = useState(null);
2865
+ const { workflows, loading, error, refetch } = useWorkflowDefinitions({
2866
+ status: "ACTIVE",
2867
+ limit: 100
2868
+ });
2869
+ const { duplicateWorkflow } = useDuplicateWorkflow();
2870
+ const { bus, workspaceId } = useFluidGridsAnalytics();
2871
+ const handleSearchChange = useCallback((value) => {
2872
+ setSearch(value);
2873
+ if (v2) updateGallery({}, { replace: true });
2874
+ }, [v2, updateGallery]);
2875
+ const { templates: storeTemplates, totalCount: legacyStoreTotalCount, hasMore: storeHasMore, loading: storeLoading, error: storeError, loadMore: storeLoadMore, refetch: storeRefetch } = useWorkflowTemplates(activeSource === "store" && !v2 ? search : void 0, 20, activeSource === "store" && !v2, storeCategory === "all" ? void 0 : storeCategory);
2876
+ const searching = search.trim().length > 0;
2877
+ const gallerySort = effectiveSort(galleryUrl.sort, searching);
2878
+ const galleryPage = useWorkflowTemplatesPage({
2879
+ search,
2880
+ category: storeCategory === "all" ? void 0 : storeCategory,
2881
+ sortBy: storeSortBy(gallerySort),
2882
+ page: galleryUrl.page,
2883
+ pageSize: GALLERY_PAGE_SIZE,
2884
+ enabled: activeSource === "store" && v2
2885
+ });
2886
+ const galleryLastPage = totalPagesFor(galleryPage.totalCount, GALLERY_PAGE_SIZE);
2887
+ useEffect(() => {
2888
+ if (!v2 || activeSource !== "store") return;
2889
+ if (galleryPage.loading || galleryPage.error || !galleryPage.hasData) return;
2890
+ if (galleryUrl.page > galleryLastPage) updateGallery({ page: galleryLastPage }, { replace: true });
2891
+ }, [
2892
+ v2,
2893
+ activeSource,
2894
+ galleryPage.loading,
2895
+ galleryPage.error,
2896
+ galleryPage.hasData,
2897
+ galleryUrl.page,
2898
+ galleryLastPage,
2899
+ updateGallery
2900
+ ]);
2901
+ const storeTotalCount = !v2 ? legacyStoreTotalCount : activeSource === "store" ? galleryPage.totalCount : 0;
2902
+ const handlePublish = useCallback((workflow) => {
2903
+ setResubmitTarget(null);
2904
+ setPublishSource(workflow);
2905
+ }, []);
2906
+ const handleResubmit = useCallback((submission) => {
2907
+ if (!submission.sourceWorkflowKey) return;
2908
+ setResubmitTarget(submission);
2909
+ setPublishSource({
2910
+ workflowKey: submission.sourceWorkflowKey,
2911
+ version: submission.sourceWorkflowVersion ?? void 0,
2912
+ name: submission.name,
2913
+ description: submission.description,
2914
+ tags: submission.tags,
2915
+ category: submission.category
2916
+ });
2917
+ }, []);
2918
+ const handleSubmitted = useCallback((submission) => {
2919
+ toast.success(tr("fluidgrids.templates.templatesPage.publishSuccessToast", "Template submitted for review"), { description: tr("fluidgrids.templates.templatesPage.publishSuccessDescription", "{{name}} (v{{version}}) is listed in the store once a reviewer approves it.", {
2920
+ name: submission.name,
2921
+ version: submission.version
2922
+ }) });
2923
+ setResubmitTarget(null);
2924
+ setActiveSource("submissions");
2925
+ }, [tr]);
2926
+ const categorizedWorkflows = useMemo(() => {
2927
+ return workflows.map((w) => ({
2928
+ workflow: w,
2929
+ category: galleryCategory(w)
2930
+ }));
2931
+ }, [workflows]);
2932
+ const filtered = useMemo(() => {
2933
+ let items = categorizedWorkflows;
2934
+ if (activeCategory !== "all") items = items.filter((item) => item.category === activeCategory);
2935
+ if (search.trim()) {
2936
+ const q = search.toLowerCase();
2937
+ items = items.filter((item) => item.workflow.name.toLowerCase().includes(q) || (item.workflow.description ?? "").toLowerCase().includes(q) || item.workflow.tags?.some((t) => t.toLowerCase().includes(q)));
2938
+ }
2939
+ return items;
2940
+ }, [
2941
+ categorizedWorkflows,
2942
+ activeCategory,
2943
+ search
2944
+ ]);
2945
+ const categoryCounts = useMemo(() => {
2946
+ const counts = { all: categorizedWorkflows.length };
2947
+ for (const item of categorizedWorkflows) counts[item.category] = (counts[item.category] ?? 0) + 1;
2948
+ return counts;
2949
+ }, [categorizedWorkflows]);
2950
+ const handleUseWorkspaceTemplate = useCallback(async (workflow) => {
2951
+ setDuplicatingId(workflow.id);
2952
+ try {
2953
+ const newKey = `${workflow.workflowKey}-copy-${v4().substring(0, 6)}`;
2954
+ const result = await duplicateWorkflow(workflow.workflowKey, workflow.version, { newWorkflowKey: newKey }, { source: "template" });
2955
+ if (result?.success && result.workflow) {
2956
+ emitTemplateUsed(bus, {
2957
+ workspaceId,
2958
+ templateId: workflow.id,
2959
+ category: galleryCategory(workflow)
2960
+ });
2961
+ toast.success(tr("fluidgrids.templates.templatesPage.duplicateSuccessToast", "Workflow created from template"));
2962
+ navigate(`../workflow/${result.workflow.workflowKey}/${result.workflow.version}`);
2963
+ } else toast.error(result?.message ?? tr("fluidgrids.templates.templatesPage.duplicateErrorToast", "Failed to create workflow from template"));
2964
+ } catch (err) {
2965
+ const cause = err instanceof Error ? err.cause : void 0;
2966
+ const refusal = findQuotaRefusal(cause) ?? findQuotaRefusal(err);
2967
+ if (refusal) setQuotaRefusal(refusal);
2968
+ else {
2969
+ toast.error(tr("fluidgrids.templates.templatesPage.duplicateErrorToast", "Failed to create workflow from template"));
2970
+ console.error("[TemplatesPage] Error duplicating workflow:", err);
2971
+ }
2972
+ } finally {
2973
+ setDuplicatingId(null);
2974
+ }
2975
+ }, [
2976
+ duplicateWorkflow,
2977
+ navigate,
2978
+ tr,
2979
+ bus,
2980
+ workspaceId
2981
+ ]);
2982
+ const templateImport = useTemplateImportFlow({
2983
+ onImported: (created) => navigate(`../workflow/${created.workflowKey}/${created.version}`),
2984
+ onQuotaRefusal: setQuotaRefusal
2985
+ });
2986
+ const [paidPending, setPaidPending] = useState(null);
2987
+ const handleUseStoreTemplate = (template) => {
2988
+ if (v2 && isPaidTemplate(template)) {
2989
+ setPaidPending(template);
2990
+ return;
2991
+ }
2992
+ templateImport.start(template);
2993
+ };
2994
+ const galleryShown = v2 && activeSource === "store";
2995
+ const { categories: storeFacetCategories, totalCount: facetsTotal, loading: facetsLoading } = useWorkflowTemplateCategories(search, galleryShown);
2996
+ const [facetsAnswered, setFacetsAnswered] = useState(false);
2997
+ if (galleryShown && !facetsLoading && !facetsAnswered) setFacetsAnswered(true);
2998
+ const { totalCount: allTemplatesCount } = useWorkflowTemplateCategories(void 0, v2 && activeSource === "store");
2999
+ const galleryFacets = useMemo(() => {
3000
+ if (!v2) return [];
3001
+ const facets = storeFacetCategories.length > 0 ? storeFacetCategories.map((facet) => ({ ...facet })) : TEMPLATE_STORE_CATEGORIES.map((value) => ({ value }));
3002
+ if (storeCategory !== "all" && !facets.some((f) => f.value === storeCategory)) facets.push({ value: storeCategory });
3003
+ return facets;
3004
+ }, [
3005
+ v2,
3006
+ storeFacetCategories,
3007
+ storeCategory
3008
+ ]);
3009
+ const fixedStoreCategoryOptions = useMemo(() => CATEGORY_FILTERS.map((value) => ({
3010
+ value,
3011
+ label: categoryLabel(tr, value),
3012
+ icon: categoryIcon(value)
3013
+ })), [tr]);
3014
+ const assistantControls = useMemo(() => templatesControls({
3015
+ page: tr("fluidgrids.templates.templatesPage.heading", "Templates"),
3016
+ search: handleSearchChange,
3017
+ source: {
3018
+ storeLabel: tr("fluidgrids.templates.templatesPage.tabFromStore", v2 ? "Template gallery" : "From Store"),
3019
+ workspaceLabel: tr("fluidgrids.templates.templatesPage.tabMyTemplates", v2 ? "Copy a workspace workflow" : "My Templates"),
3020
+ submissionsLabel: tr("fluidgrids.templates.templatesPage.tabMySubmissions", "My Submissions"),
3021
+ value: activeSource,
3022
+ set: setActiveSource
3023
+ },
3024
+ category: {
3025
+ label: "Category",
3026
+ options: CATEGORY_FILTER_OPTIONS,
3027
+ neutral: "all",
3028
+ value: activeCategory,
3029
+ set: setActiveCategory
3030
+ },
3031
+ storeCategory: {
3032
+ label: "Category",
3033
+ options: v2 ? [{
3034
+ value: "all",
3035
+ label: categoryLabel(tr, "all")
3036
+ }, ...galleryFacets.map(({ value }) => ({
3037
+ value,
3038
+ label: storeCategoryLabel(tr, value)
3039
+ }))] : CATEGORY_FILTER_OPTIONS,
3040
+ neutral: "all",
3041
+ value: storeCategory,
3042
+ set: setStoreCategory
3043
+ }
3044
+ }), [
3045
+ tr,
3046
+ v2,
3047
+ activeSource,
3048
+ activeCategory,
3049
+ storeCategory,
3050
+ galleryFacets,
3051
+ handleSearchChange,
3052
+ setStoreCategory
3053
+ ]);
3054
+ useFluidGridsPageControls(assistantControls);
3055
+ const sourceTabs = [
3056
+ {
3057
+ id: "store",
3058
+ label: tr("fluidgrids.templates.templatesPage.tabFromStore", v2 ? "Template gallery" : "From Store"),
3059
+ icon: "mdi:store",
3060
+ count: storeTotalCount,
3061
+ countPending: v2 && activeSource === "store" && !galleryPage.hasData && !galleryPage.error
3062
+ },
3063
+ {
3064
+ id: "workspace",
3065
+ label: tr("fluidgrids.templates.templatesPage.tabMyTemplates", v2 ? "Copy a workspace workflow" : "My Templates"),
3066
+ icon: "mdi:folder-outline"
3067
+ },
3068
+ {
3069
+ id: "submissions",
3070
+ label: tr("fluidgrids.templates.templatesPage.tabMySubmissions", "My Submissions"),
3071
+ icon: "mdi:upload"
3072
+ }
3073
+ ];
3074
+ return /* @__PURE__ */ jsxs("div", {
3075
+ className: "p-4 sm:p-6 bg-surface-canvas min-h-screen",
3076
+ children: [
3077
+ /* @__PURE__ */ jsx(PageIntro, {
3078
+ "data-tour": "fluidgrids-templates-header",
3079
+ title: tr("fluidgrids.templates.templatesPage.heading", "Templates"),
3080
+ subtitle: tr("fluidgrids.templates.templatesPage.subheading", "Start quickly with pre-built workflow templates"),
3081
+ docsLink: /* @__PURE__ */ jsx(FluidGridsDocsLink, {
3082
+ topic: "templates",
3083
+ className: "mt-1"
3084
+ }),
3085
+ actions: /* @__PURE__ */ jsxs(Button$1, {
3086
+ variant: "outline",
3087
+ onClick: () => navigate("../list"),
3088
+ className: cn(v2 && "max-sm:h-9 max-sm:w-auto max-sm:self-start max-sm:px-3 max-sm:text-[13px]"),
3089
+ children: [/* @__PURE__ */ jsx(OfflineIcon, {
3090
+ icon: "mdi:arrow-left",
3091
+ className: "mr-2",
3092
+ width: 16
3093
+ }), tr("fluidgrids.templates.templatesPage.backToWorkflows", "Back to Workflows")]
3094
+ })
3095
+ }),
3096
+ v2 ? /* @__PURE__ */ jsx(PageTabsWithMore, {
3097
+ tabs: sourceTabs.filter((tab) => tab.id === "store"),
3098
+ moreTabs: sourceTabs.filter((tab) => tab.id !== "store"),
3099
+ value: activeSource,
3100
+ onChange: setActiveSource,
3101
+ label: tr("fluidgrids.templates.templatesPage.heading", "Templates"),
3102
+ "data-tour": "fluidgrids-templates-source-tabs"
3103
+ }) : /* @__PURE__ */ jsx("div", {
3104
+ className: "flex gap-1 p-1 bg-surface rounded-lg w-fit mb-6",
3105
+ "data-tour": "fluidgrids-templates-source-tabs",
3106
+ role: "tablist",
3107
+ children: sourceTabs.map((tab) => /* @__PURE__ */ jsx(TabButton, {
3108
+ tab,
3109
+ selected: activeSource === tab.id,
3110
+ onSelect: () => setActiveSource(tab.id)
3111
+ }, tab.id))
3112
+ }),
3113
+ (activeSource === "workspace" || activeSource === "store" && !v2) && /* @__PURE__ */ jsxs("div", {
3114
+ className: "relative max-w-md mb-6",
3115
+ "data-tour": "fluidgrids-templates-search",
3116
+ children: [/* @__PURE__ */ jsx(OfflineIcon, {
3117
+ icon: "mdi:magnify",
3118
+ width: 18,
3119
+ className: "absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary"
3120
+ }), /* @__PURE__ */ jsx(Input, {
3121
+ placeholder: activeSource === "workspace" ? tr("fluidgrids.templates.templatesPage.searchWorkspacePlaceholder", "Search workspace templates...") : tr("fluidgrids.templates.templatesPage.searchStorePlaceholder", "Search store templates..."),
3122
+ value: search,
3123
+ onChange: (e) => handleSearchChange(e.target.value),
3124
+ className: "pl-10 bg-surface border-border-default"
3125
+ })]
3126
+ }),
3127
+ activeSource === "workspace" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
3128
+ className: "flex flex-wrap gap-2 mb-6",
3129
+ "data-tour": "fluidgrids-templates-category-tabs",
3130
+ children: CATEGORY_FILTERS.map((value) => /* @__PURE__ */ jsx(CategoryChip, {
3131
+ label: categoryLabel(tr, value, v2),
3132
+ icon: categoryIcon(value),
3133
+ active: activeCategory === value,
3134
+ onSelect: () => setActiveCategory(value),
3135
+ count: categoryCounts[value] ?? 0
3136
+ }, value))
3137
+ }), /* @__PURE__ */ jsx(TabContent, {
3138
+ error,
3139
+ onRetry: refetch,
3140
+ loading,
3141
+ empty: filtered.length === 0,
3142
+ hasSearch: search.trim().length > 0 || activeCategory !== "all",
3143
+ searching: search.trim().length > 0,
3144
+ emptyHint: v2 ? tr("fluidgrids.templates.templatesPage.emptyStateWorkspaceHint", "Workflows that are on show up here, ready to copy.") : void 0,
3145
+ children: /* @__PURE__ */ jsx("div", {
3146
+ className: workspaceGridClass(v2),
3147
+ "data-testid": "workspace-template-grid",
3148
+ children: filtered.map(({ workflow, category }) => /* @__PURE__ */ jsx(WorkspaceTemplateCard, {
3149
+ workflow,
3150
+ category,
3151
+ onUseTemplate: handleUseWorkspaceTemplate,
3152
+ onPublish: handlePublish,
3153
+ isLoading: duplicatingId === workflow.id
3154
+ }, workflow.id))
3155
+ })
3156
+ })] }),
3157
+ activeSource === "store" && v2 && /* @__PURE__ */ jsx(StoreGalleryV2, {
3158
+ search,
3159
+ onSearchChange: handleSearchChange,
3160
+ allCount: allTemplatesCount,
3161
+ facets: galleryFacets,
3162
+ facetsTotal,
3163
+ categoriesLoading: !facetsAnswered,
3164
+ category: storeCategory,
3165
+ onCategoryChange: setStoreCategory,
3166
+ sort: gallerySort,
3167
+ onSortChange: (sort) => updateGallery({ sort: sort === "relevance" ? null : sort }),
3168
+ page: galleryUrl.page,
3169
+ onPageChange: (page, options) => updateGallery({ page }, options),
3170
+ templates: galleryPage.templates,
3171
+ totalCount: galleryPage.totalCount,
3172
+ hasData: galleryPage.hasData,
3173
+ loading: galleryPage.loading,
3174
+ pageLoading: galleryPage.pageLoading,
3175
+ error: galleryPage.error,
3176
+ onRetry: () => void galleryPage.refetch(),
3177
+ onUseTemplate: handleUseStoreTemplate,
3178
+ firstRun: /* @__PURE__ */ jsx(TemplatesEmptyState, {
3179
+ hasSearch: false,
3180
+ hint: tr("fluidgrids.templates.templatesPage.emptyStateStoreHint", "Ready-made templates show up here as they are added to the gallery.")
3181
+ })
3182
+ }),
3183
+ activeSource === "store" && !v2 && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
3184
+ className: "flex flex-wrap gap-2 mb-6",
3185
+ "data-testid": "store-template-categories",
3186
+ children: fixedStoreCategoryOptions.map((option) => /* @__PURE__ */ jsx(CategoryChip, {
3187
+ label: option.label,
3188
+ icon: option.icon,
3189
+ active: storeCategory === option.value,
3190
+ onSelect: () => setStoreCategory(option.value)
3191
+ }, option.value))
3192
+ }), /* @__PURE__ */ jsx(TabContent, {
3193
+ error: storeError,
3194
+ onRetry: storeRefetch,
3195
+ loading: storeLoading && storeTemplates.length === 0,
3196
+ empty: storeTemplates.length === 0,
3197
+ hasSearch: search.trim().length > 0 || storeCategory !== "all",
3198
+ searching: search.trim().length > 0,
3199
+ emptyHint: v2 ? tr("fluidgrids.templates.templatesPage.emptyStateStoreHint", "Ready-made templates show up here as they are added to the gallery.") : void 0,
3200
+ children: /* @__PURE__ */ jsxs("div", {
3201
+ className: "space-y-6",
3202
+ children: [/* @__PURE__ */ jsx("div", {
3203
+ className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",
3204
+ children: storeTemplates.map((template) => /* @__PURE__ */ jsx(TemplateCard, {
3205
+ template,
3206
+ onClick: () => navigate(`../templates/${template.id}/preview`),
3207
+ onUseTemplate: handleUseStoreTemplate
3208
+ }, template.id))
3209
+ }), storeHasMore && /* @__PURE__ */ jsx(LoadMoreButton, {
3210
+ loading: storeLoading,
3211
+ onClick: storeLoadMore
3212
+ })]
3213
+ })
3214
+ })] }),
3215
+ activeSource === "submissions" && /* @__PURE__ */ jsx(MySubmissionsPanel, { onResubmit: handleResubmit }),
3216
+ /* @__PURE__ */ jsx(PublishTemplateDialog, {
3217
+ open: publishSource !== null,
3218
+ onOpenChange: (open) => {
3219
+ if (!open) {
3220
+ setPublishSource(null);
3221
+ setResubmitTarget(null);
3222
+ }
3223
+ },
3224
+ workflow: publishSource,
3225
+ resubmit: resubmitTarget,
3226
+ onSubmitted: handleSubmitted
3227
+ }),
3228
+ templateImport.dialog,
3229
+ /* @__PURE__ */ jsx(PaidTemplateConfirm, {
3230
+ template: paidPending,
3231
+ onConfirm: () => {
3232
+ const template = paidPending;
3233
+ setPaidPending(null);
3234
+ if (template) templateImport.start(template);
3235
+ },
3236
+ onCancel: () => setPaidPending(null)
3237
+ }),
3238
+ /* @__PURE__ */ jsx(CreateWorkflowRefusalDialog, {
3239
+ surface: "template-import",
3240
+ refusal: quotaRefusal ? refusalOfQuota(quotaRefusal) : null,
3241
+ onClose: () => setQuotaRefusal(null),
3242
+ onUpgrade: () => {
3243
+ setQuotaRefusal(null);
3244
+ navigate(BILLING_PLANS_PATH);
3245
+ }
3246
+ })
3247
+ ]
3248
+ });
3249
+ }
3250
+
3251
+ export { TemplatesPage_exports as n, TemplatesPage as t };