@burdenoff/fluidgrids-fe-sdk 2026.1112.8 → 2026.1112.9

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 (43) hide show
  1. package/dist/{AiStudioPage-CtgPSPyc.js → AiStudioPage-DfoV1Olc.js} +1 -1
  2. package/dist/ApprovalInboxPage-Bb8H9ruw.js +1317 -0
  3. package/dist/{DataTablesPage-2xTLe_jk.js → DataTablesPage-Zz23QZQp.js} +3 -1
  4. package/dist/Disclosure-DQiUKrqd.js +41 -0
  5. package/dist/{ExecutionDetailPage-CL-w9c3L.js → ExecutionDetailPage-CcUxFexZ.js} +3 -2
  6. package/dist/{ExecutionsListPage-Bf6Cvsnz.js → ExecutionsListPage-JpByw6nA.js} +3 -1
  7. package/dist/{MissingNodesInstallModal-BCbhddk4.js → MissingNodesInstallModal-olEc52p2.js} +1 -1
  8. package/dist/{OpenTemplateAsCodeButton-BgvgDaVe.js → OpenTemplateAsCodeButton-Dh3ee2OR.js} +1 -1
  9. package/dist/PaidTemplateConfirm-DjmVi_m-.js +28 -0
  10. package/dist/{RunActionsMenu-DmO14hEE.js → RunActionsMenu-BE_1r3bF.js} +1 -50
  11. package/dist/{RunnersPage-CvAPHdfU.js → RunnersPage-CAt4YDhB.js} +2 -1
  12. package/dist/TechnicalDetails-D4xGy201.js +19 -0
  13. package/dist/{TemplateCard-XBc0qEA4.js → TemplateCard--WYJZlA_.js} +81 -25
  14. package/dist/{TemplateConfigurationModal-Dl_7RaCt.js → TemplateConfigurationModal-cd0-QVMZ.js} +2 -2
  15. package/dist/{TemplateDetailPanel-0Cc6jguU.js → TemplateDetailPanel-C-2JuXg6.js} +1 -1
  16. package/dist/TemplatePreview-BCnGjMuN.js +646 -0
  17. package/dist/{TemplatesPage-wClKZLO4.js → TemplatesPage-u7bXJYfv.js} +375 -136
  18. package/dist/{VariablesPage-BtoLjmUA.js → VariablesPage-CPL34WBc.js} +2 -358
  19. package/dist/{WorkflowBuilder-qRGFtXJG.js → WorkflowBuilder-BWxBmBoP.js} +2 -2
  20. package/dist/{WorkflowBuilder-CK6c0eRp.js → WorkflowBuilder-DxAAPHsn.js} +3 -3
  21. package/dist/{agentTools-BkQsycAp.js → agentTools-JHtYGgd7.js} +2 -2
  22. package/dist/{canvasNoteTools-U7j1z7GR.js → canvasNoteTools-B2ouyIbj.js} +1 -1
  23. package/dist/{HumanRequestCard-lbWDpWd7.js → channel-CZ70oI81.js} +5 -228
  24. package/dist/executions.js +2 -2
  25. package/dist/{flow-builder-9jDNwkID.js → flow-builder-DzKPrW2r.js} +33 -24
  26. package/dist/{index-rj-TznII.d.ts → index-CGCAcRKo.d.ts} +3 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.js +19 -19
  29. package/dist/{node-detail-view-C1yupyvL.js → node-detail-view-DNilUGcx.js} +2 -2
  30. package/dist/{node-editor-tab-body-BtxSQPtX.js → node-editor-tab-body-XBedxkpN.js} +1 -1
  31. package/dist/observability.d.ts +1 -1
  32. package/dist/{popover-BaYffpTw.js → popover-BC4r84K0.js} +1 -1
  33. package/dist/{quick-config-panel-BvlhLiQp.js → quick-config-panel-BPmrhIOb.js} +2 -2
  34. package/dist/{schedule-panel-D5VdzW2c.js → schedule-panel-DJN1TDQH.js} +2 -2
  35. package/dist/{sidebar-node-editor-BU4rJwvm.js → sidebar-node-editor-DKdfcd2r.js} +2 -2
  36. package/dist/templates.js +2 -2
  37. package/dist/useVariables-cI8uLwye.js +361 -0
  38. package/dist/workflow-builder.js +2 -2
  39. package/dist/workflow-pages.d.ts +1 -1
  40. package/dist/workflow-pages.js +10 -10
  41. package/package.json +1 -1
  42. package/dist/ApprovalInboxPage-QAJim81n.js +0 -559
  43. package/dist/TemplatePreview-CRLUX5yI.js +0 -240
@@ -1,25 +1,31 @@
1
1
  "use client";
2
2
  import { t as __exportAll } from "./rolldown-runtime-hDbaFkMy.js";
3
3
  import { h as useWorkflowDefinitions, l as useLazyWorkflowDefinition, s as useDuplicateWorkflow } from "./useWorkflows-CRUlQBd3.js";
4
- import { a as useTemplateImportFlow, f as useWorkflowTemplates, t as TemplateCard, x as useGlobalStoreClient } from "./TemplateCard-XBc0qEA4.js";
4
+ import { C as useGlobalStoreClient, m as useWorkflowTemplates, r as isPaidTemplate, s as useTemplateImportFlow, t as TemplateCard } from "./TemplateCard--WYJZlA_.js";
5
5
  import { kI as WorkflowStatus } from "./graphql-types-v6CTGwA0.js";
6
6
  import { i as SdkPermissionButton, t as FLUIDGRIDS_PERMISSIONS } from "./constants-dcxg6zG6.js";
7
7
  import { S as QuotaExhaustedDialog } from "./workflow-code-transfer-Cshsgf2H.js";
8
8
  import { r as useTr } from "./TranslationBridge-Da-TPgQm.js";
9
- import { O as MyWorkflowTemplateSubmissionsDocument, P as WithdrawWorkflowTemplateSubmissionDocument, j as SubmitWorkflowTemplateDocument, vn as useFluidGridsAnalytics } from "./FluidGridsProvider-TQ-aDPtn.js";
9
+ import { O as MyWorkflowTemplateSubmissionsDocument, P as WithdrawWorkflowTemplateSubmissionDocument, j as SubmitWorkflowTemplateDocument, t as FluidGridsContext, vn as useFluidGridsAnalytics } from "./FluidGridsProvider-TQ-aDPtn.js";
10
10
  import { a as emitTemplateUsed } from "./fluidgridsEvents-Dm5CaHtr.js";
11
11
  import { n as useFluidGridsPageControls } from "./pageControlsBridge-0pX9s-3k.js";
12
12
  import { r as templatesControls } from "./pageControlSpecs-DZJ9K37m.js";
13
13
  import { c as isQuotaExhaustedFailure, t as BILLING_PLANS_PATH } from "./quota-Cdt8yz7N.js";
14
14
  import { t as FluidGridsDocsLink } from "./FluidGridsDocsLink-JxkBpOeb.js";
15
- import { _ as throwIfResultError, m as describeOperationError } from "./client-C9XSzSXr.js";
16
- import { useCallback, useEffect, useMemo, useState } from "react";
15
+ import { _ as throwIfResultError, m as describeOperationError, x as getFluidGridsConfig } from "./client-C9XSzSXr.js";
16
+ import { n as formatRunVersion } from "./run-display-BycKYSU0.js";
17
+ import { n as useNavigationV2 } from "./useNavigationV2-C2WeqN7d.js";
18
+ import { t as TechnicalDetails } from "./TechnicalDetails-D4xGy201.js";
19
+ import { t as PaidTemplateConfirm } from "./PaidTemplateConfirm-DjmVi_m-.js";
20
+ import { t as cn } from "./cn-QqidFIgr.js";
21
+ import { useCallback, useContext, useEffect, useMemo, useState } from "react";
17
22
  import { useNavigate } from "react-router";
18
23
  import { useQuery } from "@apollo/client/react";
19
24
  import { Icon } from "@iconify/react";
20
25
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
21
26
  import { toast } from "sonner";
22
- import { Badge, Card, CardHeader, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, Input, Label, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Skeleton, Textarea } from "@burdenoff/fe-libs/ui";
27
+ import { gql } from "@apollo/client";
28
+ import { Badge, Card, CardHeader, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, Input, Label, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Skeleton, Textarea } from "@burdenoff/fe-libs/ui";
23
29
  import { Button as Button$1 } from "@burdenoff/fe-libs/button";
24
30
  import { v4 } from "uuid";
25
31
 
@@ -755,6 +761,150 @@ function galleryCategory(workflow) {
755
761
  return storedGalleryCategory(workflow.category) ?? inferGalleryCategory(workflow);
756
762
  }
757
763
 
764
+ // src/modules/templates/components/PageTabsWithMore.tsx
765
+ /**
766
+ * Page tabs with a "More ▾" menu (Navigation v2, BOFF-11848): the everyday
767
+ * tabs show as tabs, the rest sit one click away in "More". A tab picked from
768
+ * the menu shows as the selected tab next to the everyday ones, so the page
769
+ * always says where you are.
770
+ *
771
+ * A local stand-in for BOFF-11841's shared "page tabs with More ▾"; the props
772
+ * are plain data so that component can replace it without touching callers.
773
+ */
774
+ /** One page tab (also today's Templates source tabs, switch off). */
775
+ function TabButton({ tab, selected, onSelect }) {
776
+ return /* @__PURE__ */ jsxs("button", {
777
+ type: "button",
778
+ role: "tab",
779
+ "aria-selected": selected,
780
+ onClick: onSelect,
781
+ "data-testid": `templates-tab-${tab.id}`,
782
+ className: `px-4 py-2 rounded-md text-sm font-medium transition-colors ${selected ? "bg-background-primary text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
783
+ children: [
784
+ tab.icon && /* @__PURE__ */ jsx(Icon, {
785
+ icon: tab.icon,
786
+ className: "inline mr-1.5",
787
+ width: 16
788
+ }),
789
+ tab.label,
790
+ tab.count !== void 0 && tab.count > 0 && /* @__PURE__ */ jsx("span", {
791
+ className: "ml-1.5 text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",
792
+ children: tab.count
793
+ })
794
+ ]
795
+ });
796
+ }
797
+ function PageTabsWithMore({ tabs, moreTabs, value, onChange, label, "data-tour": dataTour }) {
798
+ const tr = useTr();
799
+ const pickedFromMore = moreTabs.find((tab) => tab.id === value);
800
+ return /* @__PURE__ */ jsxs("div", {
801
+ className: "flex flex-wrap items-center gap-2 mb-6",
802
+ children: [/* @__PURE__ */ jsx("div", {
803
+ className: "flex gap-1 p-1 bg-background-secondary rounded-lg w-fit",
804
+ role: "tablist",
805
+ "aria-label": label,
806
+ "data-tour": dataTour,
807
+ children: [...tabs, ...pickedFromMore ? [pickedFromMore] : []].map((tab) => /* @__PURE__ */ jsx(TabButton, {
808
+ tab,
809
+ selected: tab.id === value,
810
+ onSelect: () => onChange(tab.id)
811
+ }, tab.id))
812
+ }), moreTabs.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
813
+ asChild: true,
814
+ children: /* @__PURE__ */ jsxs(Button$1, {
815
+ variant: "ghost",
816
+ size: "sm",
817
+ "data-testid": "templates-tabs-more",
818
+ className: "text-text-secondary",
819
+ children: [tr("fluidgrids.templates.templatesPage.moreTabs", "More"), /* @__PURE__ */ jsx(Icon, {
820
+ icon: "mdi:chevron-down",
821
+ className: "ml-1",
822
+ width: 16
823
+ })]
824
+ })
825
+ }), /* @__PURE__ */ jsx(DropdownMenuContent, {
826
+ align: "start",
827
+ children: moreTabs.map((tab) => /* @__PURE__ */ jsxs(DropdownMenuItem, {
828
+ onSelect: () => onChange(tab.id),
829
+ "data-testid": `templates-tabs-more-${tab.id}`,
830
+ children: [tab.icon && /* @__PURE__ */ jsx(Icon, {
831
+ icon: tab.icon,
832
+ className: "mr-2",
833
+ width: 16
834
+ }), tab.label]
835
+ }, tab.id))
836
+ })] })]
837
+ });
838
+ }
839
+
840
+ // src/hooks/store/useWorkflowTemplateCategories.ts
841
+ /**
842
+ * The Store's own template categories (Navigation v2, BOFF-11848): the
843
+ * categories the published workflow templates actually use, with counts,
844
+ * from `browseStore`'s facets. The Templates page builds its category chips
845
+ * from them instead of a fixed list, so a chip never leads to an empty page
846
+ * and a new store category shows up without a code change.
847
+ *
848
+ * The facets are read without a category filter (only the search), so every
849
+ * category stays offered while one is selected.
850
+ */
851
+ const BROWSE_WORKFLOW_TEMPLATE_CATEGORIES = gql`
852
+ query BrowseWorkflowTemplateCategories($input: BrowseStoreInput!) {
853
+ browseStore(input: $input) {
854
+ totalCount
855
+ facets {
856
+ categories {
857
+ value
858
+ count
859
+ }
860
+ }
861
+ }
862
+ }
863
+ `;
864
+ /**
865
+ * The categories in use, most templates first (ties by name), without empty
866
+ * or blank ones.
867
+ */
868
+ function templateCategoriesFrom(data) {
869
+ return (data?.browseStore?.facets?.categories ?? []).filter((facet) => facet.value.trim() && facet.count > 0).map((facet) => ({
870
+ value: facet.value.trim(),
871
+ count: facet.count
872
+ })).sort((a, b) => b.count - a.count || a.value.localeCompare(b.value));
873
+ }
874
+ function useWorkflowTemplateCategories(searchTerm, enabled) {
875
+ const client = useGlobalStoreClient();
876
+ const context = useContext(FluidGridsContext);
877
+ const workspaceId = context?.workspaceId ?? getFluidGridsConfig().workspaceId;
878
+ const organizationId = context?.organizationId;
879
+ const headers = useMemo(() => {
880
+ const value = {};
881
+ if (organizationId) value["x-organization-id"] = organizationId;
882
+ if (workspaceId) value["x-workspace-id"] = workspaceId;
883
+ return value;
884
+ }, [organizationId, workspaceId]);
885
+ const { data, loading } = useQuery(BROWSE_WORKFLOW_TEMPLATE_CATEGORIES, {
886
+ client,
887
+ skip: !enabled,
888
+ fetchPolicy: "cache-first",
889
+ variables: { input: {
890
+ filter: {
891
+ type: "WORKFLOW",
892
+ status: "PUBLISHED",
893
+ search: searchTerm?.trim() || void 0
894
+ },
895
+ pagination: {
896
+ limit: 1,
897
+ offset: 0
898
+ }
899
+ } },
900
+ context: Object.keys(headers).length > 0 ? { headers } : void 0
901
+ });
902
+ return {
903
+ categories: useMemo(() => templateCategoriesFrom(data), [data]),
904
+ loading
905
+ };
906
+ }
907
+
758
908
  // src/modules/templates/pages/TemplatesPage.tsx
759
909
  var TemplatesPage_exports = /* @__PURE__ */ __exportAll({ TemplatesPage: () => TemplatesPage });
760
910
  /**
@@ -784,9 +934,60 @@ const CATEGORY_COLORS = {
784
934
  function categoryIcon(value) {
785
935
  return value === "all" ? "mdi:view-grid" : TEMPLATE_CATEGORY_ICONS[value];
786
936
  }
937
+ /**
938
+ * Navigation v2 (BOFF-11845/11848): task words instead of developer
939
+ * categories. The other categories keep their names.
940
+ */
941
+ const PLAIN_CATEGORY_LABELS = {
942
+ "ai-ml": "AI",
943
+ "data-processing": "Data & spreadsheets",
944
+ integration: "Connect apps"
945
+ };
787
946
  /** Translated chip and badge label for a category filter value. */
788
- function categoryLabel(tr, value) {
789
- return value === "all" ? tr("fluidgrids.templates.categories.all", "All") : tr(`fluidgrids.templates.categories.${value}`, TEMPLATE_CATEGORY_LABELS[value]);
947
+ function categoryLabel(tr, value, plain = false) {
948
+ 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]);
949
+ }
950
+ const KNOWN_CATEGORIES = new Set(CATEGORY_FILTERS);
951
+ function isCategoryFilter(value) {
952
+ return KNOWN_CATEGORIES.has(value);
953
+ }
954
+ /** "customer-success" → "Customer success", for a store category the SDK does not know. */
955
+ function humanizeCategory(value) {
956
+ const text = value.replace(/[-_]+/g, " ").trim();
957
+ return text.charAt(0).toUpperCase() + text.slice(1);
958
+ }
959
+ function storeCategoryOption(tr, value) {
960
+ return isCategoryFilter(value) ? {
961
+ value,
962
+ label: categoryLabel(tr, value, true),
963
+ icon: categoryIcon(value)
964
+ } : {
965
+ value,
966
+ label: humanizeCategory(value),
967
+ icon: "mdi:tag-outline"
968
+ };
969
+ }
970
+ function CategoryChip({ label, icon, active, onSelect, count }) {
971
+ return /* @__PURE__ */ jsxs("button", {
972
+ onClick: onSelect,
973
+ "aria-pressed": active,
974
+ className: `inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors ${active ? "bg-background-tertiary text-text-primary border border-border-primary" : "bg-background-secondary text-text-secondary border border-border-secondary hover:text-text-primary hover:border-border-primary"}`,
975
+ children: [
976
+ /* @__PURE__ */ jsx(Icon, {
977
+ icon,
978
+ width: 16
979
+ }),
980
+ label,
981
+ count !== void 0 && /* @__PURE__ */ jsxs("span", {
982
+ className: `ml-0.5 text-xs ${active ? "text-text-primary" : "text-text-secondary"}`,
983
+ children: [
984
+ "(",
985
+ count,
986
+ ")"
987
+ ]
988
+ })
989
+ ]
990
+ });
790
991
  }
791
992
  function TemplateSkeleton() {
792
993
  return /* @__PURE__ */ jsx("div", {
@@ -794,7 +995,7 @@ function TemplateSkeleton() {
794
995
  children: Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsx(Skeleton, { className: "h-52 rounded-lg bg-card-foreground/10" }, i))
795
996
  });
796
997
  }
797
- function EmptyState$1({ hasSearch }) {
998
+ function EmptyState$1({ hasSearch, hint }) {
798
999
  const tr = useTr();
799
1000
  return /* @__PURE__ */ jsxs("div", {
800
1001
  className: "flex flex-col items-center justify-center py-20 text-center",
@@ -813,13 +1014,14 @@ function EmptyState$1({ hasSearch }) {
813
1014
  }),
814
1015
  /* @__PURE__ */ jsx("p", {
815
1016
  className: "text-sm text-text-secondary max-w-md",
816
- children: hasSearch ? tr("fluidgrids.templates.templatesPage.emptyStateSearchHint", "Try adjusting your search or category filter.") : tr("fluidgrids.templates.templatesPage.emptyStateHint", "Published workflows will appear here as reusable templates.")
1017
+ children: 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.")
817
1018
  })
818
1019
  ]
819
1020
  });
820
1021
  }
821
1022
  function ErrorState({ message, onRetry }) {
822
1023
  const tr = useTr();
1024
+ const plain = useNavigationV2();
823
1025
  return /* @__PURE__ */ jsxs("div", {
824
1026
  className: "p-4 bg-[var(--color-status-error-bg-subtle)] border border-[var(--color-status-error-border)] rounded-lg",
825
1027
  children: [
@@ -830,10 +1032,16 @@ function ErrorState({ message, onRetry }) {
830
1032
  width: 20
831
1033
  }), /* @__PURE__ */ jsx("span", {
832
1034
  className: "font-medium",
833
- children: tr("fluidgrids.templates.templatesPage.errorStateTitle", "Error loading templates")
1035
+ 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")
834
1036
  })]
835
1037
  }),
836
- /* @__PURE__ */ jsx("p", {
1038
+ plain ? /* @__PURE__ */ jsx(TechnicalDetails, {
1039
+ className: "mt-1",
1040
+ children: /* @__PURE__ */ jsx("p", {
1041
+ className: "break-words text-sm text-[var(--color-status-error-text)]",
1042
+ children: message
1043
+ })
1044
+ }) : /* @__PURE__ */ jsx("p", {
837
1045
  className: "mt-1 text-sm text-[var(--color-status-error-text)]",
838
1046
  children: message
839
1047
  }),
@@ -849,8 +1057,9 @@ function ErrorState({ message, onRetry }) {
849
1057
  }
850
1058
  function WorkspaceTemplateCard({ workflow, category, onUseTemplate, onPublish, isLoading }) {
851
1059
  const tr = useTr();
1060
+ const v2 = useNavigationV2();
852
1061
  return /* @__PURE__ */ jsxs(Card, {
853
- className: "group border border-border-secondary bg-background-secondary hover:border-border-primary transition-all duration-200 flex flex-col",
1062
+ className: "group border border-border-secondary bg-background-secondary hover:border-border-primary transition-colors duration-200 flex flex-col",
854
1063
  children: [/* @__PURE__ */ jsxs(CardHeader, {
855
1064
  className: "flex-1 pb-3",
856
1065
  children: [
@@ -866,7 +1075,7 @@ function WorkspaceTemplateCard({ workflow, category, onUseTemplate, onPublish, i
866
1075
  }), /* @__PURE__ */ jsx(Badge, {
867
1076
  variant: "outline",
868
1077
  className: CATEGORY_COLORS[category],
869
- children: categoryLabel(tr, category)
1078
+ children: categoryLabel(tr, category, v2)
870
1079
  })]
871
1080
  }),
872
1081
  /* @__PURE__ */ jsx("h3", {
@@ -881,10 +1090,10 @@ function WorkspaceTemplateCard({ workflow, category, onUseTemplate, onPublish, i
881
1090
  }), /* @__PURE__ */ jsx("div", {
882
1091
  className: "px-6 pb-5 pt-0",
883
1092
  children: /* @__PURE__ */ jsxs("div", {
884
- className: "flex items-center justify-between gap-2",
885
- children: [/* @__PURE__ */ jsxs("span", {
1093
+ className: cn("flex items-center gap-2", v2 ? "justify-end" : "justify-between"),
1094
+ children: [!v2 && /* @__PURE__ */ jsx("span", {
886
1095
  className: "text-xs text-text-secondary",
887
- children: ["v", workflow.version]
1096
+ children: formatRunVersion(workflow.version)
888
1097
  }), /* @__PURE__ */ jsxs("div", {
889
1098
  className: "flex items-center gap-2",
890
1099
  children: [/* @__PURE__ */ jsxs(Button$1, {
@@ -924,9 +1133,40 @@ function WorkspaceTemplateCard({ workflow, category, onUseTemplate, onPublish, i
924
1133
  })]
925
1134
  });
926
1135
  }
1136
+ /** A tab's error, then its skeleton, empty state or content. */
1137
+ function TabContent({ error, onRetry, loading, empty, hasSearch, emptyHint, children }) {
1138
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [error && /* @__PURE__ */ jsx("div", {
1139
+ className: "mb-6",
1140
+ children: /* @__PURE__ */ jsx(ErrorState, {
1141
+ message: error.message,
1142
+ onRetry
1143
+ })
1144
+ }), loading ? /* @__PURE__ */ jsx(TemplateSkeleton, {}) : empty ? /* @__PURE__ */ jsx(EmptyState$1, {
1145
+ hasSearch,
1146
+ hint: emptyHint
1147
+ }) : children] });
1148
+ }
1149
+ function LoadMoreButton({ loading, onClick }) {
1150
+ const tr = useTr();
1151
+ return /* @__PURE__ */ jsx("div", {
1152
+ className: "flex justify-center pt-4",
1153
+ children: /* @__PURE__ */ jsx(Button$1, {
1154
+ variant: "outline",
1155
+ onClick,
1156
+ disabled: loading,
1157
+ className: "min-w-[200px]",
1158
+ children: loading ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Icon, {
1159
+ icon: "mdi:loading",
1160
+ width: 16,
1161
+ className: "mr-2 animate-spin"
1162
+ }), tr("fluidgrids.templates.templatesPage.loadingMore", "Loading...")] }) : tr("fluidgrids.templates.templatesPage.loadMoreTemplates", "Load More Templates")
1163
+ })
1164
+ });
1165
+ }
927
1166
  function TemplatesPage() {
928
1167
  const navigate = useNavigate();
929
1168
  const tr = useTr();
1169
+ const v2 = useNavigationV2();
930
1170
  const [search, setSearch] = useState("");
931
1171
  const [activeCategory, setActiveCategory] = useState("all");
932
1172
  const [duplicatingId, setDuplicatingId] = useState(null);
@@ -1025,13 +1265,41 @@ function TemplatesPage() {
1025
1265
  onImported: (created) => navigate(`../workflow/${created.workflowKey}/${created.version}`),
1026
1266
  onQuotaExhausted: () => setShowQuotaExhausted(true)
1027
1267
  });
1028
- const handleUseStoreTemplate = templateImport.start;
1268
+ const [paidPending, setPaidPending] = useState(null);
1269
+ const handleUseStoreTemplate = (template) => {
1270
+ if (v2 && isPaidTemplate(template)) {
1271
+ setPaidPending(template);
1272
+ return;
1273
+ }
1274
+ templateImport.start(template);
1275
+ };
1276
+ const { categories: storeFacetCategories } = useWorkflowTemplateCategories(search, v2 && activeSource === "store");
1277
+ const storeCategoryOptions = useMemo(() => {
1278
+ if (!v2) return [];
1279
+ const values = storeFacetCategories.length > 0 ? storeFacetCategories.map((facet) => facet.value) : [...TEMPLATE_STORE_CATEGORIES];
1280
+ if (storeCategory !== "all" && !values.includes(storeCategory)) values.push(storeCategory);
1281
+ return [{
1282
+ value: "all",
1283
+ label: categoryLabel(tr, "all"),
1284
+ icon: categoryIcon("all")
1285
+ }, ...values.map((value) => storeCategoryOption(tr, value))];
1286
+ }, [
1287
+ v2,
1288
+ storeFacetCategories,
1289
+ storeCategory,
1290
+ tr
1291
+ ]);
1292
+ const fixedStoreCategoryOptions = useMemo(() => CATEGORY_FILTERS.map((value) => ({
1293
+ value,
1294
+ label: categoryLabel(tr, value),
1295
+ icon: categoryIcon(value)
1296
+ })), [tr]);
1029
1297
  const assistantControls = useMemo(() => templatesControls({
1030
1298
  page: tr("fluidgrids.templates.templatesPage.heading", "Templates"),
1031
1299
  search: setSearch,
1032
1300
  source: {
1033
- storeLabel: tr("fluidgrids.templates.templatesPage.tabFromStore", "From Store"),
1034
- workspaceLabel: tr("fluidgrids.templates.templatesPage.tabMyTemplates", "My Templates"),
1301
+ storeLabel: tr("fluidgrids.templates.templatesPage.tabFromStore", v2 ? "Template gallery" : "From Store"),
1302
+ workspaceLabel: tr("fluidgrids.templates.templatesPage.tabMyTemplates", v2 ? "Copy a workspace workflow" : "My Templates"),
1035
1303
  submissionsLabel: tr("fluidgrids.templates.templatesPage.tabMySubmissions", "My Submissions"),
1036
1304
  value: activeSource,
1037
1305
  set: setActiveSource
@@ -1045,18 +1313,41 @@ function TemplatesPage() {
1045
1313
  },
1046
1314
  storeCategory: {
1047
1315
  label: "Category",
1048
- options: CATEGORY_FILTER_OPTIONS,
1316
+ options: v2 ? storeCategoryOptions.map(({ value, label }) => ({
1317
+ value,
1318
+ label
1319
+ })) : CATEGORY_FILTER_OPTIONS,
1049
1320
  neutral: "all",
1050
1321
  value: storeCategory,
1051
1322
  set: setStoreCategory
1052
1323
  }
1053
1324
  }), [
1054
1325
  tr,
1326
+ v2,
1055
1327
  activeSource,
1056
1328
  activeCategory,
1057
- storeCategory
1329
+ storeCategory,
1330
+ storeCategoryOptions
1058
1331
  ]);
1059
1332
  useFluidGridsPageControls(assistantControls);
1333
+ const sourceTabs = [
1334
+ {
1335
+ id: "store",
1336
+ label: tr("fluidgrids.templates.templatesPage.tabFromStore", v2 ? "Template gallery" : "From Store"),
1337
+ icon: "mdi:store",
1338
+ count: storeTotalCount
1339
+ },
1340
+ {
1341
+ id: "workspace",
1342
+ label: tr("fluidgrids.templates.templatesPage.tabMyTemplates", v2 ? "Copy a workspace workflow" : "My Templates"),
1343
+ icon: "mdi:folder-outline"
1344
+ },
1345
+ {
1346
+ id: "submissions",
1347
+ label: tr("fluidgrids.templates.templatesPage.tabMySubmissions", "My Submissions"),
1348
+ icon: "mdi:upload"
1349
+ }
1350
+ ];
1060
1351
  return /* @__PURE__ */ jsxs("div", {
1061
1352
  className: "p-4 sm:p-6 bg-background-primary min-h-screen",
1062
1353
  children: [
@@ -1086,46 +1377,22 @@ function TemplatesPage() {
1086
1377
  }), tr("fluidgrids.templates.templatesPage.backToWorkflows", "Back to Workflows")]
1087
1378
  })]
1088
1379
  }),
1089
- /* @__PURE__ */ jsxs("div", {
1380
+ v2 ? /* @__PURE__ */ jsx(PageTabsWithMore, {
1381
+ tabs: sourceTabs.filter((tab) => tab.id === "store"),
1382
+ moreTabs: sourceTabs.filter((tab) => tab.id !== "store"),
1383
+ value: activeSource,
1384
+ onChange: setActiveSource,
1385
+ label: tr("fluidgrids.templates.templatesPage.heading", "Templates"),
1386
+ "data-tour": "fluidgrids-templates-source-tabs"
1387
+ }) : /* @__PURE__ */ jsx("div", {
1090
1388
  className: "flex gap-1 p-1 bg-background-secondary rounded-lg w-fit mb-6",
1091
1389
  "data-tour": "fluidgrids-templates-source-tabs",
1092
- children: [
1093
- /* @__PURE__ */ jsxs("button", {
1094
- onClick: () => setActiveSource("store"),
1095
- className: `px-4 py-2 rounded-md text-sm font-medium transition-colors ${activeSource === "store" ? "bg-background-primary text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
1096
- children: [
1097
- /* @__PURE__ */ jsx(Icon, {
1098
- icon: "mdi:store",
1099
- className: "inline mr-1.5",
1100
- width: 16
1101
- }),
1102
- tr("fluidgrids.templates.templatesPage.tabFromStore", "From Store"),
1103
- storeTotalCount > 0 && /* @__PURE__ */ jsx("span", {
1104
- className: "ml-1.5 text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",
1105
- children: storeTotalCount
1106
- })
1107
- ]
1108
- }),
1109
- /* @__PURE__ */ jsxs("button", {
1110
- onClick: () => setActiveSource("workspace"),
1111
- className: `px-4 py-2 rounded-md text-sm font-medium transition-colors ${activeSource === "workspace" ? "bg-background-primary text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
1112
- children: [/* @__PURE__ */ jsx(Icon, {
1113
- icon: "mdi:folder-outline",
1114
- className: "inline mr-1.5",
1115
- width: 16
1116
- }), tr("fluidgrids.templates.templatesPage.tabMyTemplates", "My Templates")]
1117
- }),
1118
- /* @__PURE__ */ jsxs("button", {
1119
- onClick: () => setActiveSource("submissions"),
1120
- className: `px-4 py-2 rounded-md text-sm font-medium transition-colors ${activeSource === "submissions" ? "bg-background-primary text-text-primary shadow-sm" : "text-text-secondary hover:text-text-primary"}`,
1121
- "data-testid": "templates-tab-submissions",
1122
- children: [/* @__PURE__ */ jsx(Icon, {
1123
- icon: "mdi:upload",
1124
- className: "inline mr-1.5",
1125
- width: 16
1126
- }), tr("fluidgrids.templates.templatesPage.tabMySubmissions", "My Submissions")]
1127
- })
1128
- ]
1390
+ role: "tablist",
1391
+ children: sourceTabs.map((tab) => /* @__PURE__ */ jsx(TabButton, {
1392
+ tab,
1393
+ selected: activeSource === tab.id,
1394
+ onSelect: () => setActiveSource(tab.id)
1395
+ }, tab.id))
1129
1396
  }),
1130
1397
  activeSource !== "submissions" && /* @__PURE__ */ jsxs("div", {
1131
1398
  className: "relative max-w-md mb-6",
@@ -1141,43 +1408,24 @@ function TemplatesPage() {
1141
1408
  className: "pl-10 bg-background-secondary border-border-secondary"
1142
1409
  })]
1143
1410
  }),
1144
- activeSource === "workspace" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
1145
- /* @__PURE__ */ jsx("div", {
1146
- className: "flex flex-wrap gap-2 mb-6",
1147
- "data-tour": "fluidgrids-templates-category-tabs",
1148
- children: CATEGORY_FILTERS.map((value) => {
1149
- const count = categoryCounts[value] ?? 0;
1150
- const isActive = activeCategory === value;
1151
- return /* @__PURE__ */ jsxs("button", {
1152
- onClick: () => setActiveCategory(value),
1153
- "aria-pressed": isActive,
1154
- className: `inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors ${isActive ? "bg-background-tertiary text-text-primary border border-border-primary" : "bg-background-secondary text-text-secondary border border-border-secondary hover:text-text-primary hover:border-border-primary"}`,
1155
- children: [
1156
- /* @__PURE__ */ jsx(Icon, {
1157
- icon: categoryIcon(value),
1158
- width: 16
1159
- }),
1160
- categoryLabel(tr, value),
1161
- /* @__PURE__ */ jsxs("span", {
1162
- className: `ml-0.5 text-xs ${isActive ? "text-text-primary" : "text-text-secondary"}`,
1163
- children: [
1164
- "(",
1165
- count,
1166
- ")"
1167
- ]
1168
- })
1169
- ]
1170
- }, value);
1171
- })
1172
- }),
1173
- error && /* @__PURE__ */ jsx("div", {
1174
- className: "mb-6",
1175
- children: /* @__PURE__ */ jsx(ErrorState, {
1176
- message: error.message,
1177
- onRetry: refetch
1178
- })
1179
- }),
1180
- loading ? /* @__PURE__ */ jsx(TemplateSkeleton, {}) : filtered.length === 0 ? /* @__PURE__ */ jsx(EmptyState$1, { hasSearch: search.trim().length > 0 || activeCategory !== "all" }) : /* @__PURE__ */ jsx("div", {
1411
+ activeSource === "workspace" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
1412
+ className: "flex flex-wrap gap-2 mb-6",
1413
+ "data-tour": "fluidgrids-templates-category-tabs",
1414
+ children: CATEGORY_FILTERS.map((value) => /* @__PURE__ */ jsx(CategoryChip, {
1415
+ label: categoryLabel(tr, value, v2),
1416
+ icon: categoryIcon(value),
1417
+ active: activeCategory === value,
1418
+ onSelect: () => setActiveCategory(value),
1419
+ count: categoryCounts[value] ?? 0
1420
+ }, value))
1421
+ }), /* @__PURE__ */ jsx(TabContent, {
1422
+ error,
1423
+ onRetry: refetch,
1424
+ loading,
1425
+ empty: filtered.length === 0,
1426
+ hasSearch: search.trim().length > 0 || activeCategory !== "all",
1427
+ emptyHint: v2 ? tr("fluidgrids.templates.templatesPage.emptyStateWorkspaceHint", "Workflows that are on show up here, ready to copy.") : void 0,
1428
+ children: /* @__PURE__ */ jsx("div", {
1181
1429
  className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",
1182
1430
  children: filtered.map(({ workflow, category }) => /* @__PURE__ */ jsx(WorkspaceTemplateCard, {
1183
1431
  workflow,
@@ -1187,32 +1435,24 @@ function TemplatesPage() {
1187
1435
  isLoading: duplicatingId === workflow.id
1188
1436
  }, workflow.id))
1189
1437
  })
1190
- ] }),
1191
- activeSource === "store" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
1192
- /* @__PURE__ */ jsx("div", {
1193
- className: "flex flex-wrap gap-2 mb-6",
1194
- "data-testid": "store-template-categories",
1195
- children: CATEGORY_FILTERS.map((value) => {
1196
- const isActive = storeCategory === value;
1197
- return /* @__PURE__ */ jsxs("button", {
1198
- onClick: () => setStoreCategory(value),
1199
- "aria-pressed": isActive,
1200
- className: `inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors ${isActive ? "bg-background-tertiary text-text-primary border border-border-primary" : "bg-background-secondary text-text-secondary border border-border-secondary hover:text-text-primary hover:border-border-primary"}`,
1201
- children: [/* @__PURE__ */ jsx(Icon, {
1202
- icon: categoryIcon(value),
1203
- width: 16
1204
- }), categoryLabel(tr, value)]
1205
- }, value);
1206
- })
1207
- }),
1208
- storeError && /* @__PURE__ */ jsx("div", {
1209
- className: "mb-6",
1210
- children: /* @__PURE__ */ jsx(ErrorState, {
1211
- message: storeError.message,
1212
- onRetry: storeRefetch
1213
- })
1214
- }),
1215
- storeLoading && storeTemplates.length === 0 ? /* @__PURE__ */ jsx(TemplateSkeleton, {}) : storeTemplates.length === 0 ? /* @__PURE__ */ jsx(EmptyState$1, { hasSearch: search.trim().length > 0 || storeCategory !== "all" }) : /* @__PURE__ */ jsxs("div", {
1438
+ })] }),
1439
+ activeSource === "store" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
1440
+ className: "flex flex-wrap gap-2 mb-6",
1441
+ "data-testid": "store-template-categories",
1442
+ children: (v2 ? storeCategoryOptions : fixedStoreCategoryOptions).map((option) => /* @__PURE__ */ jsx(CategoryChip, {
1443
+ label: option.label,
1444
+ icon: option.icon,
1445
+ active: storeCategory === option.value,
1446
+ onSelect: () => setStoreCategory(option.value)
1447
+ }, option.value))
1448
+ }), /* @__PURE__ */ jsx(TabContent, {
1449
+ error: storeError,
1450
+ onRetry: storeRefetch,
1451
+ loading: storeLoading && storeTemplates.length === 0,
1452
+ empty: storeTemplates.length === 0,
1453
+ hasSearch: search.trim().length > 0 || storeCategory !== "all",
1454
+ emptyHint: v2 ? tr("fluidgrids.templates.templatesPage.emptyStateStoreHint", "Ready-made templates show up here as they are added to the gallery.") : void 0,
1455
+ children: /* @__PURE__ */ jsxs("div", {
1216
1456
  className: "space-y-6",
1217
1457
  children: [/* @__PURE__ */ jsx("div", {
1218
1458
  className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",
@@ -1221,22 +1461,12 @@ function TemplatesPage() {
1221
1461
  onClick: () => navigate(`../templates/${template.id}/preview`),
1222
1462
  onUseTemplate: handleUseStoreTemplate
1223
1463
  }, template.id))
1224
- }), storeHasMore && /* @__PURE__ */ jsx("div", {
1225
- className: "flex justify-center pt-4",
1226
- children: /* @__PURE__ */ jsx(Button$1, {
1227
- variant: "outline",
1228
- onClick: storeLoadMore,
1229
- disabled: storeLoading,
1230
- className: "min-w-[200px]",
1231
- children: storeLoading ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Icon, {
1232
- icon: "mdi:loading",
1233
- width: 16,
1234
- className: "mr-2 animate-spin"
1235
- }), tr("fluidgrids.templates.templatesPage.loadingMore", "Loading...")] }) : tr("fluidgrids.templates.templatesPage.loadMoreTemplates", "Load More Templates")
1236
- })
1464
+ }), storeHasMore && /* @__PURE__ */ jsx(LoadMoreButton, {
1465
+ loading: storeLoading,
1466
+ onClick: storeLoadMore
1237
1467
  })]
1238
1468
  })
1239
- ] }),
1469
+ })] }),
1240
1470
  activeSource === "submissions" && /* @__PURE__ */ jsx(MySubmissionsPanel, { onResubmit: handleResubmit }),
1241
1471
  /* @__PURE__ */ jsx(PublishTemplateDialog, {
1242
1472
  open: publishSource !== null,
@@ -1251,6 +1481,15 @@ function TemplatesPage() {
1251
1481
  onSubmitted: handleSubmitted
1252
1482
  }),
1253
1483
  templateImport.dialog,
1484
+ /* @__PURE__ */ jsx(PaidTemplateConfirm, {
1485
+ template: paidPending,
1486
+ onConfirm: () => {
1487
+ const template = paidPending;
1488
+ setPaidPending(null);
1489
+ if (template) templateImport.start(template);
1490
+ },
1491
+ onCancel: () => setPaidPending(null)
1492
+ }),
1254
1493
  /* @__PURE__ */ jsx(QuotaExhaustedDialog, {
1255
1494
  surface: "template-import",
1256
1495
  open: showQuotaExhausted,