n8n-editor-ui 1.66.0 → 1.67.0

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 (99) hide show
  1. package/dist/assets/{AnnotationTagsDropdown.ee.vue_vue_type_script_setup_true_lang-CYMqjryg.js → AnnotationTagsDropdown.ee.vue_vue_type_script_setup_true_lang-DbabN_I2.js} +2 -2
  2. package/dist/assets/{AuthView-31vu0x_3.js → AuthView-DmC24d7S.js} +17 -19
  3. package/dist/assets/{CanvasControls-DkT1iClJ.js → CanvasControls-BPXQqeeO.js} +1 -1
  4. package/dist/assets/{ChangePasswordView-DkhZAh4j.js → ChangePasswordView-SC3n2vJc.js} +2 -2
  5. package/dist/assets/CollectionParameter-Odk28FRT.js +4 -0
  6. package/dist/assets/{CredentialsView-Du-lMwPW.js → CredentialsView-B3m9CpEC.js} +11 -9
  7. package/dist/assets/{ErrorView-CROJIl1H.js → ErrorView-D6M8WlVP.js} +1 -1
  8. package/dist/assets/{ExecutionsFilter-BecTg03r.css → ExecutionsFilter-DVxRt-Pz.css} +6 -6
  9. package/dist/assets/{ExecutionsFilter-132FKb5o.js → ExecutionsFilter-DlZH8tDW.js} +5 -5
  10. package/dist/assets/{ExecutionsView-B41cgHPD.js → ExecutionsView-DaHtYmF4.js} +4 -4
  11. package/dist/assets/{FileSaver.min-B3lWZPMp.js → FileSaver.min-DNytcjKT.js} +1 -1
  12. package/dist/assets/FixedCollectionParameter-CypxYAFK.js +334 -0
  13. package/dist/assets/{FixedCollectionParameter-fI2wTyfY.css → FixedCollectionParameter-DzOGMEdq.css} +10 -10
  14. package/dist/assets/{ForgotMyPasswordView-DKrE7dUn.js → ForgotMyPasswordView-BJ6gd5CS.js} +4 -3
  15. package/dist/assets/{MainHeader-Bc5G9_Uq.css → MainHeader-D56WYRMG.css} +9 -9
  16. package/dist/assets/{MainHeader-CW31WCmm.js → MainHeader-DniXcGMK.js} +92 -98
  17. package/dist/assets/{MainSidebar-cNW0UJBC.css → MainSidebar-BRYJRpOA.css} +2 -2
  18. package/dist/assets/{MainSidebar-Dny90RtO.js → MainSidebar-NwOfijmV.js} +7 -6
  19. package/dist/assets/{NodeCreation-BqSkxffS.js → NodeCreation-Ce1ct2i3.js} +6 -6
  20. package/dist/assets/{NodeCreator-CoqcSKC-.js → NodeCreator-DMLTbzAt.js} +35 -22
  21. package/dist/assets/{NodeViewSwitcher-C1Gp-jKb.js → NodeViewSwitcher-B9JUn3eY.js} +399 -289
  22. package/dist/assets/{NodeViewSwitcher-B8VPj4Rs.css → NodeViewSwitcher-CnP5aYyg.css} +116 -116
  23. package/dist/assets/{ProjectCardBadge-kHyKG50e.js → ProjectCardBadge-C3QU-WmO.js} +1 -1
  24. package/dist/assets/{ProjectSettings-BohhQ-z6.js → ProjectSettings-BvcEg3hx.js} +5 -5
  25. package/dist/assets/{ProjectTabs-D-87NPFl.js → ProjectTabs-Dve3xFj9.js} +1 -1
  26. package/dist/assets/PushConnectionTracker.vue_vue_type_script_setup_true_lang-DlJOpf7N.js +39 -0
  27. package/dist/assets/{ResourceListHeader-Bs6GLg32.js → ResourceListHeader-B2sxe6HT.js} +1 -1
  28. package/dist/assets/ResourcesListLayout-Bc4__nvw.js +692 -0
  29. package/dist/assets/{ResourcesListLayout-Bw99IFlO.css → ResourcesListLayout-Ci-K1bH3.css} +8 -8
  30. package/dist/assets/{RunDataAi-CYTNyRq_.js → RunDataAi-BKu1beM6.js} +4 -4
  31. package/dist/assets/{RunDataJson-CUsbBWaI.js → RunDataJson-ea5u1EeD.js} +12 -12
  32. package/dist/assets/{RunDataJsonActions-Bnn0o9WH.js → RunDataJsonActions-Dflnt8gK.js} +127 -159
  33. package/dist/assets/{RunDataSearch-BiygytJ8.js → RunDataSearch-DKNVmEqa.js} +1 -1
  34. package/dist/assets/{RunDataTable--RIqj8DU.js → RunDataTable-DISLWxMc.js} +1 -1
  35. package/dist/assets/{SamlOnboarding-BXYS2fQg.js → SamlOnboarding-CPvGRYUg.js} +2 -2
  36. package/dist/assets/SettingsApiView-BFj9fDL9.js +227 -0
  37. package/dist/assets/{SettingsCommunityNodesView-BjakfOB1.js → SettingsCommunityNodesView-nJFDrtIR.js} +185 -195
  38. package/dist/assets/{SettingsExternalSecrets-BGIt9OQy.js → SettingsExternalSecrets-0-mj45K-.js} +3 -3
  39. package/dist/assets/{SettingsLdapView-DBY4YyYE.js → SettingsLdapView-BhBxX72w.js} +3 -3
  40. package/dist/assets/SettingsLogStreamingView-CmEJrEOv.js +500 -0
  41. package/dist/assets/{SettingsPersonalView-CgzznKXi.js → SettingsPersonalView-C__lC8Vv.js} +1 -1
  42. package/dist/assets/{SettingsSourceControl-DNWFyNrX.js → SettingsSourceControl-CMoS5B5P.js} +3 -3
  43. package/dist/assets/{SettingsSso-B8oke872.js → SettingsSso-DJfrl1Rl.js} +3 -3
  44. package/dist/assets/{SettingsUsageAndPlan-BUUYApK_.js → SettingsUsageAndPlan-CWQ5uVrG.js} +4 -3
  45. package/dist/assets/{SettingsUsageAndPlan-P6SS2mWq.css → SettingsUsageAndPlan-vijI-va0.css} +3 -3
  46. package/dist/assets/{SettingsUsersView-DyuP8V6k.js → SettingsUsersView-Cvr6Digb.js} +4 -3
  47. package/dist/assets/{SettingsView-CD83Adan.js → SettingsView-DtGga45F.js} +2 -30
  48. package/dist/assets/{SetupView-C8XYMj2N.js → SetupView-DkJH96By.js} +2 -2
  49. package/dist/assets/{SetupWorkflowCredentialsButton-u1qhjj5K.js → SetupWorkflowCredentialsButton-C1Jv_-V5.js} +1 -1
  50. package/dist/assets/{SetupWorkflowFromTemplateView-DdxqCGcl.js → SetupWorkflowFromTemplateView-WSzVMgC4.js} +3 -3
  51. package/dist/assets/{SigninView-CGQ20O_c.js → SigninView-xej8y-Vu.js} +4 -3
  52. package/dist/assets/{SignoutView-BZwBBglt.js → SignoutView-Dc8fBBIm.js} +1 -1
  53. package/dist/assets/{SignupView-BCT6dhhZ.js → SignupView-CKA28Xc8.js} +4 -3
  54. package/dist/assets/TemplateDetails-Pi49rFlS.js +179 -0
  55. package/dist/assets/TemplateList-BncQL783.js +371 -0
  56. package/dist/assets/{TemplatesCollectionView-BxBSljqH.js → TemplatesCollectionView-C9PKPo5y.js} +8 -8
  57. package/dist/assets/{TemplatesSearchView-kFcPH-ZH.js → TemplatesSearchView-65taIL-M.js} +530 -577
  58. package/dist/assets/{TemplatesView-TPTpSdeD.js → TemplatesView-DkP9JWHk.js} +32 -37
  59. package/dist/assets/{TemplatesWorkflowView-8NdGLWj7.js → TemplatesWorkflowView-B5uc0BtL.js} +5 -5
  60. package/dist/assets/{VariablesView-CHXdt5-z.css → VariablesView-BPKo50HJ.css} +18 -18
  61. package/dist/assets/{VariablesView-C1NxBxBQ.js → VariablesView-DV1-KgmN.js} +6 -5
  62. package/dist/assets/WorkerView-5P9lg6ew.js +148 -0
  63. package/dist/assets/WorkerView-Dm0b18Mh.css +22 -0
  64. package/dist/assets/{WorkflowActivator-CalsATsI.js → WorkflowActivator-Dc_Un-Af.js} +2 -2
  65. package/dist/assets/{WorkflowExecutionsInfoAccordion-rUnvuY-5.js → WorkflowExecutionsInfoAccordion-BLyC6lr5.js} +1 -1
  66. package/dist/assets/{WorkflowExecutionsLandingPage-C4K7kfqv.js → WorkflowExecutionsLandingPage-Dsa6Bgkn.js} +2 -2
  67. package/dist/assets/{WorkflowExecutionsPreview-BO31AO7v.js → WorkflowExecutionsPreview-B_X-enUV.js} +5 -5
  68. package/dist/assets/{WorkflowExecutionsView-B-5zbx_n.js → WorkflowExecutionsView-Bkz3Sig-.js} +5 -5
  69. package/dist/assets/{WorkflowHistory-uvlFDwTJ.js → WorkflowHistory-BiPMooAv.js} +5 -4
  70. package/dist/assets/{WorkflowOnboardingView-B869wGVb.js → WorkflowOnboardingView-XHuS6lCs.js} +1 -1
  71. package/dist/assets/{WorkflowPreview-BlzWpiO1.js → WorkflowPreview-DxZKd23H.js} +1 -1
  72. package/dist/assets/{WorkflowsView-IdgMnIZY.js → WorkflowsView-BBaLVqJs.js} +10 -9
  73. package/dist/assets/{dateFormatter-BCrxaIdG.js → dateFormatter-C53K7zEn.js} +1 -1
  74. package/dist/assets/{index-QAq8Sa9R.js → index-7YFQEQmt.js} +36144 -36617
  75. package/dist/assets/{index-DaeOVPzE.css → index-BFH_KxyA.css} +64 -45
  76. package/dist/assets/{pushConnection.store-Cdssd0uJ.js → pushConnection.store-DbprXL-x.js} +1 -1
  77. package/dist/assets/{templateActions-ClPy1BRa.js → templateActions-QFQD8amJ.js} +1 -1
  78. package/dist/assets/{useBugReporting-Bvr7bSQt.js → useBugReporting-IgwBNdXI.js} +1 -1
  79. package/dist/assets/{useExecutionDebugging-CwyVwJqO.js → useExecutionDebugging-CLORI_Ma.js} +3 -2
  80. package/dist/assets/{useNodeViewVersionSwitcher-BPNKvsXw.js → useNodeViewVersionSwitcher-CJLQ5lju.js} +1 -1
  81. package/dist/assets/{usePushConnection-DDXmzoG8.js → usePushConnection-DjPgTuLw.js} +9 -10
  82. package/dist/assets/{useWorkflowActivate-DKPQP7qy.js → useWorkflowActivate-D_gK841h.js} +1 -1
  83. package/dist/index.html +3 -2
  84. package/index.html +1 -0
  85. package/package.json +1 -1
  86. package/vite.config.mts +1 -17
  87. package/dist/assets/CollectionParameter-BDKfoIMJ.js +0 -4
  88. package/dist/assets/FixedCollectionParameter-DXh-j7zB.js +0 -355
  89. package/dist/assets/PushConnectionTracker-Bhnghrmf.js +0 -38
  90. package/dist/assets/ResourcesListLayout-ByBNP70B.js +0 -800
  91. package/dist/assets/SettingsApiView-DoibCiLo.js +0 -255
  92. package/dist/assets/SettingsFakeDoorView-DpKZ4qWG.css +0 -14
  93. package/dist/assets/SettingsFakeDoorView-DwXDXgon.js +0 -44
  94. package/dist/assets/SettingsLogStreamingView-DHQWns6I.js +0 -519
  95. package/dist/assets/TemplateDetails-BsLVCpdi.js +0 -199
  96. package/dist/assets/TemplateList-Bn7ePHhc.js +0 -433
  97. package/dist/assets/WorkerView-Bj1cvzLg.js +0 -825
  98. package/dist/assets/WorkerView-C_d54L0W.css +0 -181
  99. package/dist/assets/cloud-B6bxVT9F.js +0 -37
@@ -1,6 +1,6 @@
1
- import { a as __unplugin_components_0$1, _ as __unplugin_components_2 } from "./TemplateList-Bn7ePHhc.js";
2
- import { i7 as baseOrderBy, i8 as isArray, d as defineComponent, c as openBlock, e as createBlock, aE as createSlots, w as withCtx, j as createBaseVNode, n as normalizeClass, t as toDisplayString, q as renderSlot, i as createVNode, bP as mergeProps, l as resolveComponent, _ as _export_sfc, ar as withDirectives, as as vShow, k as createTextVNode, B as normalizeStyle, i9 as throttle, h as createElementBlock, f as createCommentVNode, F as Fragment, z as renderList, r as ref, H as watch, o as onMounted, C as nextTick, aq as onBeforeMount, A as unref, e0 as mapStores, aC as useTemplatesStore, J as useDebounce, a as useToast, a3 as useDocumentTitle, ia as CREATOR_HUB_URL, gZ as usePostHog, u as useUsersStore, K as useUIStore, m as useSettingsStore, V as VIEWS, c9 as resolveDirective } from "./index-QAq8Sa9R.js";
3
- import { T as TemplatesView } from "./TemplatesView-TPTpSdeD.js";
1
+ import { ia as baseOrderBy, ib as isArray, d as defineComponent, c as openBlock, e as createBlock, aF as createSlots, w as withCtx, j as createBaseVNode, n as normalizeClass, t as toDisplayString, q as renderSlot, i as createVNode, bQ as mergeProps, l as resolveComponent, _ as _export_sfc, as as withDirectives, at as vShow, k as createTextVNode, A as unref, B as normalizeStyle, g as useI18n, ic as throttle, h as createElementBlock, f as createCommentVNode, F as Fragment, z as renderList, r as ref, H as watch, o as onMounted, x as nextTick, ar as onBeforeMount, p as computed, J as useDebounce, a as useToast, a3 as useDocumentTitle, m as useSettingsStore, aD as useTemplatesStore, u as useUsersStore, U as useRoute, b as useRouter, hq as onBeforeRouteLeave, id as CREATOR_HUB_URL, V as VIEWS, ca as resolveDirective, ak as useTelemetry } from "./index-7YFQEQmt.js";
2
+ import { N as NodeList, T as TemplateList } from "./TemplateList-BncQL783.js";
3
+ import { T as TemplatesView } from "./TemplatesView-DkP9JWHk.js";
4
4
  function orderBy(collection, iteratees, orders, guard) {
5
5
  if (collection == null) {
6
6
  return [];
@@ -68,62 +68,47 @@ const cssModules$3 = {
68
68
  "$style": style0$3
69
69
  };
70
70
  const Card = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__cssModules", cssModules$3]]);
71
- const _sfc_main$4 = defineComponent({
72
- name: "TemplatesInfoCard",
73
- components: {
74
- Card,
75
- NodeList: __unplugin_components_0$1
76
- },
71
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
72
+ __name: "TemplatesInfoCard",
77
73
  props: {
78
- collection: {
79
- type: Object,
80
- required: true
81
- },
82
- loading: {
83
- type: Boolean
84
- },
85
- showItemCount: {
86
- type: Boolean,
87
- default: true
88
- },
89
- width: {
90
- type: String,
91
- required: true
92
- }
74
+ collection: {},
75
+ loading: { type: Boolean, default: false },
76
+ showItemCount: { type: Boolean, default: true },
77
+ width: {}
78
+ },
79
+ setup(__props) {
80
+ const i18n = useI18n();
81
+ return (_ctx, _cache) => {
82
+ const _component_n8n_text = resolveComponent("n8n-text");
83
+ return openBlock(), createBlock(Card, {
84
+ loading: _ctx.loading,
85
+ title: _ctx.collection.name,
86
+ style: normalizeStyle({ width: _ctx.width })
87
+ }, {
88
+ footer: withCtx(() => [
89
+ createBaseVNode("span", null, [
90
+ withDirectives(createVNode(_component_n8n_text, {
91
+ size: "small",
92
+ color: "text-light"
93
+ }, {
94
+ default: withCtx(() => [
95
+ createTextVNode(toDisplayString(_ctx.collection.workflows.length) + " " + toDisplayString(unref(i18n).baseText("templates.workflows")), 1)
96
+ ]),
97
+ _: 1
98
+ }, 512), [
99
+ [vShow, _ctx.showItemCount]
100
+ ])
101
+ ]),
102
+ createVNode(NodeList, {
103
+ nodes: _ctx.collection.nodes,
104
+ "show-more": false
105
+ }, null, 8, ["nodes"])
106
+ ]),
107
+ _: 1
108
+ }, 8, ["loading", "title", "style"]);
109
+ };
93
110
  }
94
111
  });
95
- function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
96
- const _component_n8n_text = resolveComponent("n8n-text");
97
- const _component_NodeList = __unplugin_components_0$1;
98
- const _component_Card = resolveComponent("Card");
99
- return openBlock(), createBlock(_component_Card, {
100
- loading: _ctx.loading,
101
- title: _ctx.collection.name,
102
- style: normalizeStyle({ width: _ctx.width })
103
- }, {
104
- footer: withCtx(() => [
105
- createBaseVNode("span", null, [
106
- withDirectives(createVNode(_component_n8n_text, {
107
- size: "small",
108
- color: "text-light"
109
- }, {
110
- default: withCtx(() => [
111
- createTextVNode(toDisplayString(_ctx.collection.workflows.length) + " " + toDisplayString(_ctx.$locale.baseText("templates.workflows")), 1)
112
- ]),
113
- _: 1
114
- }, 512), [
115
- [vShow, _ctx.showItemCount]
116
- ])
117
- ]),
118
- createVNode(_component_NodeList, {
119
- nodes: _ctx.collection.nodes,
120
- "show-more": false
121
- }, null, 8, ["nodes"])
122
- ]),
123
- _: 1
124
- }, 8, ["loading", "title", "style"]);
125
- }
126
- const TemplatesInfoCard = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$3]]);
127
112
  const mixin$6 = {
128
113
  methods: {
129
114
  handleMouseDown(e) {
@@ -761,7 +746,7 @@ const _hoisted_8 = {
761
746
  };
762
747
  const _hoisted_9 = ["onClick"];
763
748
  const _hoisted_10 = ["disabled"];
764
- function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
749
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
765
750
  return openBlock(), createElementBlock("div", {
766
751
  class: normalizeClass([{ "agile--ssr": $data.isSSR, "agile--auto-play": _ctx.settings.autoplay, "agile--disabled": _ctx.settings.unagile, "agile--fade": _ctx.settings.fade && !_ctx.settings.unagile, "agile--rtl": _ctx.settings.rtl, "agile--no-nav-buttons": !_ctx.settings.navButtons }, "agile"]),
767
752
  onTouchstart: () => {
@@ -838,7 +823,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
838
823
  ])) : createCommentVNode("", true)
839
824
  ], 34);
840
825
  }
841
- const VueAgile = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$2]]);
826
+ const VueAgile = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render]]);
842
827
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
843
828
  __name: "TemplatesInfoCarousel",
844
829
  props: {
@@ -933,7 +918,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
933
918
  }, null, 8, ["loading"]);
934
919
  }), 128)),
935
920
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.loading ? [] : _ctx.collections, (collection) => {
936
- return openBlock(), createBlock(TemplatesInfoCard, {
921
+ return openBlock(), createBlock(_sfc_main$4, {
937
922
  key: collection.id,
938
923
  "data-test-id": "templates-info-card",
939
924
  collection,
@@ -980,84 +965,151 @@ const style0$2 = {
980
965
  const cssModules$2 = {
981
966
  "$style": style0$2
982
967
  };
983
- const __unplugin_components_1 = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__cssModules", cssModules$2]]);
984
- const _sfc_main$1 = defineComponent({
985
- name: "TemplateFilters",
968
+ const TemplatesInfoCarousel = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__cssModules", cssModules$2]]);
969
+ const _hoisted_1$1 = ["textContent"];
970
+ const _hoisted_2 = ["data-test-id"];
971
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
972
+ __name: "TemplateFilters",
986
973
  props: {
987
- categories: {
988
- type: Array,
989
- default: () => []
990
- },
991
- sortOnPopulate: {
992
- type: Boolean,
993
- default: false
994
- },
995
- expandLimit: {
996
- type: Number,
997
- default: 12
998
- },
999
- loading: {
1000
- type: Boolean
1001
- },
1002
- selected: {
1003
- type: Array,
1004
- default: () => []
1005
- }
974
+ categories: { default: () => [] },
975
+ sortOnPopulate: { type: Boolean, default: false },
976
+ expandLimit: { default: 12 },
977
+ loading: { type: Boolean, default: false },
978
+ selected: { default: () => [] }
1006
979
  },
1007
980
  emits: ["clearAll", "select", "clear"],
1008
- data() {
1009
- return {
1010
- collapsed: true,
1011
- sortedCategories: []
1012
- };
1013
- },
1014
- computed: {
1015
- ...mapStores(useTemplatesStore),
1016
- allSelected() {
1017
- return this.selected.length === 0;
981
+ setup(__props, { emit: __emit }) {
982
+ const props = __props;
983
+ const emit = __emit;
984
+ const i18n = useI18n();
985
+ const collapsed = ref(true);
986
+ const sortedCategories = ref([]);
987
+ const allSelected = computed(() => {
988
+ return props.selected.length === 0;
989
+ });
990
+ function sortCategories() {
991
+ if (!props.sortOnPopulate) {
992
+ sortedCategories.value = props.categories;
993
+ } else {
994
+ const selected = props.selected || [];
995
+ const selectedCategories = props.categories.filter((cat) => selected.includes(cat));
996
+ const notSelectedCategories = props.categories.filter((cat) => !selected.includes(cat));
997
+ sortedCategories.value = selectedCategories.concat(notSelectedCategories);
998
+ }
1018
999
  }
1019
- },
1020
- watch: {
1021
- sortOnPopulate: {
1022
- handler(value) {
1000
+ function collapseAction() {
1001
+ collapsed.value = false;
1002
+ }
1003
+ function handleCheckboxChanged(value, selectedCategory) {
1004
+ if (value) {
1005
+ emit("select", selectedCategory);
1006
+ } else {
1007
+ emit("clear", selectedCategory);
1008
+ }
1009
+ }
1010
+ function isSelected(category) {
1011
+ return props.selected.includes(category);
1012
+ }
1013
+ function resetCategories() {
1014
+ emit("clearAll");
1015
+ }
1016
+ watch(
1017
+ () => props.sortOnPopulate,
1018
+ (value) => {
1023
1019
  if (value) {
1024
- this.sortCategories();
1020
+ sortCategories();
1025
1021
  }
1026
1022
  },
1027
- immediate: true
1028
- },
1029
- categories: {
1030
- handler(categories2) {
1023
+ {
1024
+ immediate: true
1025
+ }
1026
+ );
1027
+ watch(
1028
+ () => props.categories,
1029
+ (categories2) => {
1031
1030
  if (categories2.length > 0) {
1032
- this.sortCategories();
1031
+ sortCategories();
1033
1032
  }
1034
1033
  },
1035
- immediate: true
1036
- }
1037
- },
1038
- methods: {
1039
- sortCategories() {
1040
- if (!this.sortOnPopulate) {
1041
- this.sortedCategories = this.categories;
1042
- } else {
1043
- const selected = this.selected || [];
1044
- const selectedCategories = this.categories.filter((cat) => selected.includes(cat));
1045
- const notSelectedCategories = this.categories.filter((cat) => !selected.includes(cat));
1046
- this.sortedCategories = selectedCategories.concat(notSelectedCategories);
1034
+ {
1035
+ immediate: true
1047
1036
  }
1048
- },
1049
- collapseAction() {
1050
- this.collapsed = false;
1051
- },
1052
- handleCheckboxChanged(value, selectedCategory) {
1053
- this.$emit(value ? "select" : "clear", selectedCategory);
1054
- },
1055
- isSelected(category) {
1056
- return this.selected.includes(category);
1057
- },
1058
- resetCategories() {
1059
- this.$emit("clearAll");
1060
- }
1037
+ );
1038
+ return (_ctx, _cache) => {
1039
+ const _component_n8n_loading = resolveComponent("n8n-loading");
1040
+ const _component_el_checkbox = resolveComponent("el-checkbox");
1041
+ const _component_n8n_text = resolveComponent("n8n-text");
1042
+ return openBlock(), createElementBlock("div", {
1043
+ class: normalizeClass([_ctx.$style.filters, "template-filters"]),
1044
+ "data-test-id": "templates-filter-container"
1045
+ }, [
1046
+ createBaseVNode("div", {
1047
+ class: normalizeClass(_ctx.$style.title),
1048
+ textContent: toDisplayString(unref(i18n).baseText("templates.categoriesHeading"))
1049
+ }, null, 10, _hoisted_1$1),
1050
+ _ctx.loading ? (openBlock(), createElementBlock("div", {
1051
+ key: 0,
1052
+ class: normalizeClass(_ctx.$style.list)
1053
+ }, [
1054
+ createVNode(_component_n8n_loading, {
1055
+ loading: _ctx.loading,
1056
+ rows: _ctx.expandLimit
1057
+ }, null, 8, ["loading", "rows"])
1058
+ ], 2)) : createCommentVNode("", true),
1059
+ !_ctx.loading ? (openBlock(), createElementBlock("ul", {
1060
+ key: 1,
1061
+ class: normalizeClass(_ctx.$style.categories)
1062
+ }, [
1063
+ createBaseVNode("li", {
1064
+ class: normalizeClass(_ctx.$style.item),
1065
+ "data-test-id": "template-filter-all-categories"
1066
+ }, [
1067
+ createVNode(_component_el_checkbox, {
1068
+ "model-value": allSelected.value,
1069
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = () => resetCategories())
1070
+ }, {
1071
+ default: withCtx(() => [
1072
+ createTextVNode(toDisplayString(unref(i18n).baseText("templates.allCategories")), 1)
1073
+ ]),
1074
+ _: 1
1075
+ }, 8, ["model-value"])
1076
+ ], 2),
1077
+ (openBlock(true), createElementBlock(Fragment, null, renderList(collapsed.value ? sortedCategories.value.slice(0, _ctx.expandLimit) : sortedCategories.value, (category, index) => {
1078
+ return openBlock(), createElementBlock("li", {
1079
+ key: index,
1080
+ class: normalizeClass(_ctx.$style.item),
1081
+ "data-test-id": `template-filter-${category.name.toLowerCase().replaceAll(" ", "-")}`
1082
+ }, [
1083
+ createVNode(_component_el_checkbox, {
1084
+ "model-value": isSelected(category),
1085
+ "onUpdate:modelValue": (value) => handleCheckboxChanged(value, category)
1086
+ }, {
1087
+ default: withCtx(() => [
1088
+ createTextVNode(toDisplayString(category.name), 1)
1089
+ ]),
1090
+ _: 2
1091
+ }, 1032, ["model-value", "onUpdate:modelValue"])
1092
+ ], 10, _hoisted_2);
1093
+ }), 128))
1094
+ ], 2)) : createCommentVNode("", true),
1095
+ sortedCategories.value.length > _ctx.expandLimit && collapsed.value && !_ctx.loading ? (openBlock(), createElementBlock("div", {
1096
+ key: 2,
1097
+ class: normalizeClass(_ctx.$style.button),
1098
+ "data-test-id": "expand-categories-button",
1099
+ onClick: collapseAction
1100
+ }, [
1101
+ createVNode(_component_n8n_text, {
1102
+ size: "small",
1103
+ color: "primary"
1104
+ }, {
1105
+ default: withCtx(() => [
1106
+ createTextVNode(" + " + toDisplayString(`${sortedCategories.value.length - _ctx.expandLimit} more`), 1)
1107
+ ]),
1108
+ _: 1
1109
+ })
1110
+ ], 2)) : createCommentVNode("", true)
1111
+ ], 2);
1112
+ };
1061
1113
  }
1062
1114
  });
1063
1115
  const title = "_title_1sb10_1";
@@ -1070,359 +1122,218 @@ const style0$1 = {
1070
1122
  item,
1071
1123
  button
1072
1124
  };
1073
- const _hoisted_1$1 = ["textContent"];
1074
- const _hoisted_2 = ["data-test-id"];
1075
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
1076
- const _component_n8n_loading = resolveComponent("n8n-loading");
1077
- const _component_el_checkbox = resolveComponent("el-checkbox");
1078
- const _component_n8n_text = resolveComponent("n8n-text");
1079
- return openBlock(), createElementBlock("div", {
1080
- class: normalizeClass([_ctx.$style.filters, "template-filters"]),
1081
- "data-test-id": "templates-filter-container"
1082
- }, [
1083
- createBaseVNode("div", {
1084
- class: normalizeClass(_ctx.$style.title),
1085
- textContent: toDisplayString(_ctx.$locale.baseText("templates.categoriesHeading"))
1086
- }, null, 10, _hoisted_1$1),
1087
- _ctx.loading ? (openBlock(), createElementBlock("div", {
1088
- key: 0,
1089
- class: normalizeClass(_ctx.$style.list)
1090
- }, [
1091
- createVNode(_component_n8n_loading, {
1092
- loading: _ctx.loading,
1093
- rows: _ctx.expandLimit
1094
- }, null, 8, ["loading", "rows"])
1095
- ], 2)) : createCommentVNode("", true),
1096
- !_ctx.loading ? (openBlock(), createElementBlock("ul", {
1097
- key: 1,
1098
- class: normalizeClass(_ctx.$style.categories)
1099
- }, [
1100
- createBaseVNode("li", {
1101
- class: normalizeClass(_ctx.$style.item),
1102
- "data-test-id": "template-filter-all-categories"
1103
- }, [
1104
- createVNode(_component_el_checkbox, {
1105
- "model-value": _ctx.allSelected,
1106
- "onUpdate:modelValue": _cache[0] || (_cache[0] = () => _ctx.resetCategories())
1107
- }, {
1108
- default: withCtx(() => [
1109
- createTextVNode(toDisplayString(_ctx.$locale.baseText("templates.allCategories")), 1)
1110
- ]),
1111
- _: 1
1112
- }, 8, ["model-value"])
1113
- ], 2),
1114
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.collapsed ? _ctx.sortedCategories.slice(0, _ctx.expandLimit) : _ctx.sortedCategories, (category, index) => {
1115
- return openBlock(), createElementBlock("li", {
1116
- key: index,
1117
- class: normalizeClass(_ctx.$style.item),
1118
- "data-test-id": `template-filter-${category.name.toLowerCase().replaceAll(" ", "-")}`
1119
- }, [
1120
- createVNode(_component_el_checkbox, {
1121
- "model-value": _ctx.isSelected(category),
1122
- "onUpdate:modelValue": (value) => _ctx.handleCheckboxChanged(value, category)
1123
- }, {
1124
- default: withCtx(() => [
1125
- createTextVNode(toDisplayString(category.name), 1)
1126
- ]),
1127
- _: 2
1128
- }, 1032, ["model-value", "onUpdate:modelValue"])
1129
- ], 10, _hoisted_2);
1130
- }), 128))
1131
- ], 2)) : createCommentVNode("", true),
1132
- _ctx.sortedCategories.length > _ctx.expandLimit && _ctx.collapsed && !_ctx.loading ? (openBlock(), createElementBlock("div", {
1133
- key: 2,
1134
- class: normalizeClass(_ctx.$style.button),
1135
- "data-test-id": "expand-categories-button",
1136
- onClick: _cache[1] || (_cache[1] = (...args) => _ctx.collapseAction && _ctx.collapseAction(...args))
1137
- }, [
1138
- createVNode(_component_n8n_text, {
1139
- size: "small",
1140
- color: "primary"
1141
- }, {
1142
- default: withCtx(() => [
1143
- createTextVNode(" + " + toDisplayString(`${_ctx.sortedCategories.length - _ctx.expandLimit} more`), 1)
1144
- ]),
1145
- _: 1
1146
- })
1147
- ], 2)) : createCommentVNode("", true)
1148
- ], 2);
1149
- }
1150
1125
  const cssModules$1 = {
1151
1126
  "$style": style0$1
1152
1127
  };
1153
- const __unplugin_components_0 = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__cssModules", cssModules$1]]);
1154
- const _sfc_main = defineComponent({
1155
- name: "TemplatesSearchView",
1156
- components: {
1157
- TemplatesInfoCarousel: __unplugin_components_1,
1158
- TemplateFilters: __unplugin_components_0,
1159
- TemplateList: __unplugin_components_2,
1160
- TemplatesView
1161
- },
1162
- beforeRouteLeave(_to, _from, next) {
1163
- var _a, _b;
1164
- const contentArea = document.getElementById("content");
1165
- if (contentArea) {
1166
- (_b = (_a = this.$route.meta) == null ? void 0 : _a.setScrollPosition) == null ? void 0 : _b.call(_a, contentArea.scrollTop);
1167
- }
1168
- this.trackSearch();
1169
- next();
1170
- },
1171
- setup() {
1128
+ const TemplateFilters = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__cssModules", cssModules$1]]);
1129
+ const _hoisted_1 = ["textContent"];
1130
+ const _sfc_main = /* @__PURE__ */ defineComponent({
1131
+ __name: "TemplatesSearchView",
1132
+ setup(__props) {
1133
+ const areCategoriesPrepopulated = ref(false);
1134
+ const categories2 = ref([]);
1135
+ const loadingCategories = ref(true);
1136
+ const loadingCollections = ref(true);
1137
+ const loadingWorkflows = ref(true);
1138
+ const search2 = ref("");
1139
+ const searchEventToTrack = ref(null);
1140
+ const errorLoadingWorkflows = ref(false);
1172
1141
  const { callDebounced } = useDebounce();
1173
- return {
1174
- callDebounced,
1175
- ...useToast(),
1176
- documentTitle: useDocumentTitle()
1177
- };
1178
- },
1179
- data() {
1180
- return {
1181
- areCategoriesPrepopulated: false,
1182
- categories: [],
1183
- loading: true,
1184
- loadingCategories: true,
1185
- loadingCollections: true,
1186
- loadingWorkflows: true,
1187
- search: "",
1188
- searchEventToTrack: null,
1189
- errorLoadingWorkflows: false,
1190
- creatorHubUrl: CREATOR_HUB_URL
1142
+ const toast = useToast();
1143
+ const documentTitle = useDocumentTitle();
1144
+ const settingsStore = useSettingsStore();
1145
+ const templatesStore = useTemplatesStore();
1146
+ const usersStore = useUsersStore();
1147
+ const i18n = useI18n();
1148
+ const route = useRoute();
1149
+ const router = useRouter();
1150
+ const telemetry = useTelemetry();
1151
+ const createQueryObject = (categoryId) => {
1152
+ return {
1153
+ categories: categories2.value.map(
1154
+ (category) => categoryId === "name" ? category.name : String(category.id)
1155
+ ),
1156
+ search: search2.value
1157
+ };
1191
1158
  };
1192
- },
1193
- computed: {
1194
- ...mapStores(useSettingsStore, useTemplatesStore, useUIStore, useUsersStore, usePostHog),
1195
- totalWorkflows() {
1196
- return this.templatesStore.getSearchedWorkflowsTotal(this.createQueryObject("name"));
1197
- },
1198
- workflows() {
1199
- return this.templatesStore.getSearchedWorkflows(this.createQueryObject("name")) ?? [];
1200
- },
1201
- collections() {
1202
- return this.templatesStore.getSearchedCollections(this.createQueryObject("id")) ?? [];
1203
- },
1204
- endOfSearchMessage() {
1205
- if (this.loadingWorkflows) {
1159
+ const totalWorkflows = computed(
1160
+ () => templatesStore.getSearchedWorkflowsTotal(createQueryObject("name"))
1161
+ );
1162
+ const workflows = computed(
1163
+ () => templatesStore.getSearchedWorkflows(createQueryObject("name")) ?? []
1164
+ );
1165
+ const collections = computed(
1166
+ () => templatesStore.getSearchedCollections(createQueryObject("id")) ?? []
1167
+ );
1168
+ const endOfSearchMessage = computed(() => {
1169
+ if (loadingWorkflows.value) {
1206
1170
  return null;
1207
1171
  }
1208
- if (!this.loadingCollections && this.workflows.length === 0 && this.collections.length === 0) {
1209
- if (!this.settingsStore.isTemplatesEndpointReachable && this.errorLoadingWorkflows) {
1210
- return this.$locale.baseText("templates.connectionWarning");
1172
+ if (!loadingCollections.value && workflows.value.length === 0 && collections.value.length === 0) {
1173
+ if (!settingsStore.isTemplatesEndpointReachable && errorLoadingWorkflows.value) {
1174
+ return i18n.baseText("templates.connectionWarning");
1211
1175
  }
1212
- return this.$locale.baseText("templates.noSearchResults");
1176
+ return i18n.baseText("templates.noSearchResults");
1213
1177
  }
1214
1178
  return null;
1215
- },
1216
- nothingFound() {
1217
- return !this.loadingWorkflows && !this.loadingCollections && this.workflows.length === 0 && this.collections.length === 0;
1218
- }
1219
- },
1220
- watch: {
1221
- workflows(newWorkflows) {
1222
- if (newWorkflows.length === 0) {
1223
- this.scrollTo(0);
1179
+ });
1180
+ const updateQueryParam = (search22, category) => {
1181
+ const query = Object.assign({}, route.query);
1182
+ if (category.length) {
1183
+ query.categories = category;
1184
+ } else {
1185
+ delete query.categories;
1224
1186
  }
1225
- }
1226
- },
1227
- async mounted() {
1228
- this.documentTitle.set("Templates");
1229
- await this.loadCategories();
1230
- void this.loadWorkflowsAndCollections(true);
1231
- void this.usersStore.showPersonalizationSurvey();
1232
- this.restoreSearchFromRoute();
1233
- setTimeout(() => {
1234
- var _a;
1235
- const scrollOffset = (_a = this.$route.meta) == null ? void 0 : _a.scrollOffset;
1236
- if (typeof scrollOffset === "number" && scrollOffset > 0) {
1237
- this.scrollTo(scrollOffset, "auto");
1238
- }
1239
- }, 100);
1240
- },
1241
- methods: {
1242
- createQueryObject(categoryId) {
1243
- return {
1244
- categories: this.categories.map(
1245
- (category) => categoryId === "name" ? category.name : String(category.id)
1246
- ),
1247
- search: this.search
1248
- };
1249
- },
1250
- restoreSearchFromRoute() {
1251
- let updateSearch = false;
1252
- if (this.$route.query.search && typeof this.$route.query.search === "string") {
1253
- this.search = this.$route.query.search;
1254
- updateSearch = true;
1255
- }
1256
- if (typeof this.$route.query.categories === "string" && this.$route.query.categories.length) {
1257
- const categoriesFromURL = this.$route.query.categories.split(",");
1258
- this.categories = this.templatesStore.allCategories.filter(
1259
- (category) => categoriesFromURL.includes(category.id.toString())
1260
- );
1261
- updateSearch = true;
1187
+ if (search22.length) {
1188
+ query.search = search22;
1189
+ } else {
1190
+ delete query.search;
1262
1191
  }
1263
- if (updateSearch) {
1264
- this.updateSearch();
1265
- this.trackCategories();
1266
- this.areCategoriesPrepopulated = true;
1192
+ void router.replace({ query });
1193
+ };
1194
+ const updateSearch = () => {
1195
+ updateQueryParam(search2.value, categories2.value.map((category) => category.id).join(","));
1196
+ void loadWorkflowsAndCollections(false);
1197
+ };
1198
+ const loadWorkflows = async () => {
1199
+ try {
1200
+ loadingWorkflows.value = true;
1201
+ await templatesStore.getWorkflows({
1202
+ search: search2.value,
1203
+ categories: categories2.value.map((category) => category.name)
1204
+ });
1205
+ errorLoadingWorkflows.value = false;
1206
+ } catch (e) {
1207
+ errorLoadingWorkflows.value = true;
1267
1208
  }
1268
- },
1269
- onOpenCollection({ event, id }) {
1270
- this.navigateTo(event, VIEWS.COLLECTION, id);
1271
- },
1272
- onOpenTemplate({ event, id }) {
1273
- this.navigateTo(event, VIEWS.TEMPLATE, id);
1274
- },
1275
- navigateTo(e, page, id) {
1276
- if (e.metaKey || e.ctrlKey) {
1277
- const route = this.$router.resolve({ name: page, params: { id } });
1278
- window.open(route.href, "_blank");
1279
- return;
1280
- } else {
1281
- void this.$router.push({ name: page, params: { id } });
1209
+ loadingWorkflows.value = false;
1210
+ };
1211
+ const loadCollections = async () => {
1212
+ try {
1213
+ loadingCollections.value = true;
1214
+ await templatesStore.getCollections({
1215
+ categories: categories2.value.map((category) => String(category.id)),
1216
+ search: search2.value
1217
+ });
1218
+ } catch (e) {
1282
1219
  }
1283
- },
1284
- updateSearch() {
1285
- this.updateQueryParam(this.search, this.categories.map((category) => category.id).join(","));
1286
- void this.loadWorkflowsAndCollections(false);
1287
- },
1288
- updateSearchTracking(search2, categories2) {
1289
- if (!search2) {
1220
+ loadingCollections.value = false;
1221
+ };
1222
+ const updateSearchTracking = (search22, categories22) => {
1223
+ if (!search22) {
1290
1224
  return;
1291
1225
  }
1292
- if (this.searchEventToTrack && this.searchEventToTrack.search_string.length > search2.length) {
1226
+ if (searchEventToTrack.value && searchEventToTrack.value.search_string.length > search22.length) {
1293
1227
  return;
1294
1228
  }
1295
- this.searchEventToTrack = {
1296
- search_string: search2,
1297
- workflow_results_count: this.workflows.length,
1298
- collection_results_count: this.collections.length,
1299
- categories_applied: categories2.map(
1300
- (categoryId) => this.templatesStore.getCategoryById(categoryId.toString())
1229
+ searchEventToTrack.value = {
1230
+ search_string: search22,
1231
+ workflow_results_count: workflows.value.length,
1232
+ collection_results_count: collections.value.length,
1233
+ categories_applied: categories22.map(
1234
+ (categoryId) => templatesStore.getCategoryById(categoryId.toString())
1301
1235
  ),
1302
- wf_template_repo_session_id: this.templatesStore.currentSessionId
1236
+ wf_template_repo_session_id: templatesStore.currentSessionId
1303
1237
  };
1304
- },
1305
- trackSearch() {
1306
- if (this.searchEventToTrack) {
1307
- this.$telemetry.track(
1238
+ };
1239
+ const trackCategories = () => {
1240
+ if (categories2.value.length) {
1241
+ telemetry.track("User changed template filters", {
1242
+ search_string: search2.value,
1243
+ categories_applied: categories2.value,
1244
+ wf_template_repo_session_id: templatesStore.currentSessionId
1245
+ });
1246
+ }
1247
+ };
1248
+ const loadWorkflowsAndCollections = async (initialLoad) => {
1249
+ const _categories = [...categories2.value];
1250
+ const _search = search2.value;
1251
+ await Promise.all([loadWorkflows(), loadCollections()]);
1252
+ if (!initialLoad) {
1253
+ updateSearchTracking(
1254
+ _search,
1255
+ _categories.map((category) => category.id)
1256
+ );
1257
+ }
1258
+ };
1259
+ const navigateTo = (e, page, id) => {
1260
+ if (e.metaKey || e.ctrlKey) {
1261
+ const route2 = router.resolve({ name: page, params: { id } });
1262
+ window.open(route2.href, "_blank");
1263
+ return;
1264
+ } else {
1265
+ void router.push({ name: page, params: { id } });
1266
+ }
1267
+ };
1268
+ const onOpenCollection = ({ event, id }) => {
1269
+ navigateTo(event, VIEWS.COLLECTION, id);
1270
+ };
1271
+ const onOpenTemplate = ({ event, id }) => {
1272
+ navigateTo(event, VIEWS.TEMPLATE, id);
1273
+ };
1274
+ const trackSearch = () => {
1275
+ if (searchEventToTrack.value) {
1276
+ telemetry.track(
1308
1277
  "User searched workflow templates",
1309
- this.searchEventToTrack
1278
+ searchEventToTrack.value
1310
1279
  );
1311
- this.searchEventToTrack = null;
1280
+ searchEventToTrack.value = null;
1312
1281
  }
1313
- },
1314
- onSearchInput(search2) {
1315
- this.loadingWorkflows = true;
1316
- this.loadingCollections = true;
1317
- this.search = search2;
1318
- void this.callDebounced(this.updateSearch, {
1282
+ };
1283
+ const onSearchInput = (searchText) => {
1284
+ loadingWorkflows.value = true;
1285
+ loadingCollections.value = true;
1286
+ search2.value = searchText;
1287
+ void callDebounced(updateSearch, {
1319
1288
  debounceTime: 500,
1320
1289
  trailing: true
1321
1290
  });
1322
- if (search2.length === 0) {
1323
- this.trackSearch();
1291
+ if (searchText.length === 0) {
1292
+ trackSearch();
1324
1293
  }
1325
- },
1326
- onCategorySelected(selected) {
1327
- this.categories = this.categories.concat(selected);
1328
- this.updateSearch();
1329
- this.trackCategories();
1330
- },
1331
- onCategoryUnselected(selected) {
1332
- this.categories = this.categories.filter((category) => category.id !== selected.id);
1333
- this.updateSearch();
1334
- this.trackCategories();
1335
- },
1336
- onCategoriesCleared() {
1337
- this.categories = [];
1338
- this.updateSearch();
1339
- },
1340
- trackCategories() {
1341
- if (this.categories.length) {
1342
- this.$telemetry.track("User changed template filters", {
1343
- search_string: this.search,
1344
- categories_applied: this.categories,
1345
- wf_template_repo_session_id: this.templatesStore.currentSessionId
1346
- });
1347
- }
1348
- },
1349
- updateQueryParam(search2, category) {
1350
- const query = Object.assign({}, this.$route.query);
1351
- if (category.length) {
1352
- query.categories = category;
1353
- } else {
1354
- delete query.categories;
1355
- }
1356
- if (search2.length) {
1357
- query.search = search2;
1358
- } else {
1359
- delete query.search;
1360
- }
1361
- void this.$router.replace({ query });
1362
- },
1363
- async onLoadMore() {
1364
- if (this.workflows.length >= this.totalWorkflows) {
1294
+ };
1295
+ const onCategorySelected = (selected) => {
1296
+ categories2.value = categories2.value.concat(selected);
1297
+ updateSearch();
1298
+ trackCategories();
1299
+ };
1300
+ const onCategoryUnselected = (selected) => {
1301
+ categories2.value = categories2.value.filter((category) => category.id !== selected.id);
1302
+ updateSearch();
1303
+ trackCategories();
1304
+ };
1305
+ const onCategoriesCleared = () => {
1306
+ categories2.value = [];
1307
+ updateSearch();
1308
+ };
1309
+ const onLoadMore = async () => {
1310
+ if (workflows.value.length >= totalWorkflows.value) {
1365
1311
  return;
1366
1312
  }
1367
1313
  try {
1368
- this.loadingWorkflows = true;
1369
- await this.templatesStore.getMoreWorkflows({
1370
- categories: this.categories.map((category) => category.name),
1371
- search: this.search
1314
+ loadingWorkflows.value = true;
1315
+ await templatesStore.getMoreWorkflows({
1316
+ categories: categories2.value.map((category) => category.name),
1317
+ search: search2.value
1372
1318
  });
1373
1319
  } catch (e) {
1374
- this.showMessage({
1320
+ toast.showMessage({
1375
1321
  title: "Error",
1376
1322
  message: "Could not load more workflows",
1377
1323
  type: "error"
1378
1324
  });
1379
1325
  } finally {
1380
- this.loadingWorkflows = false;
1381
- }
1382
- },
1383
- async loadCategories() {
1384
- try {
1385
- await this.templatesStore.getCategories();
1386
- } catch (e) {
1387
- }
1388
- this.loadingCategories = false;
1389
- },
1390
- async loadCollections() {
1391
- try {
1392
- this.loadingCollections = true;
1393
- await this.templatesStore.getCollections({
1394
- categories: this.categories.map((category) => String(category.id)),
1395
- search: this.search
1396
- });
1397
- } catch (e) {
1326
+ loadingWorkflows.value = false;
1398
1327
  }
1399
- this.loadingCollections = false;
1400
- },
1401
- async loadWorkflows() {
1328
+ };
1329
+ const loadCategories = async () => {
1402
1330
  try {
1403
- this.loadingWorkflows = true;
1404
- await this.templatesStore.getWorkflows({
1405
- search: this.search,
1406
- categories: this.categories.map((category) => category.name)
1407
- });
1408
- this.errorLoadingWorkflows = false;
1331
+ await templatesStore.getCategories();
1409
1332
  } catch (e) {
1410
- this.errorLoadingWorkflows = true;
1411
- }
1412
- this.loadingWorkflows = false;
1413
- },
1414
- async loadWorkflowsAndCollections(initialLoad) {
1415
- const search2 = this.search;
1416
- const categories2 = [...this.categories];
1417
- await Promise.all([this.loadWorkflows(), this.loadCollections()]);
1418
- if (!initialLoad) {
1419
- this.updateSearchTracking(
1420
- search2,
1421
- categories2.map((category) => category.id)
1422
- );
1423
1333
  }
1424
- },
1425
- scrollTo(position, behavior = "smooth") {
1334
+ loadingCategories.value = false;
1335
+ };
1336
+ const scrollTo = (position, behavior = "smooth") => {
1426
1337
  setTimeout(() => {
1427
1338
  const contentArea = document.getElementById("content");
1428
1339
  if (contentArea) {
@@ -1432,7 +1343,186 @@ const _sfc_main = defineComponent({
1432
1343
  });
1433
1344
  }
1434
1345
  }, 0);
1435
- }
1346
+ };
1347
+ const restoreSearchFromRoute = () => {
1348
+ let shouldUpdateSearch = false;
1349
+ if (route.query.search && typeof route.query.search === "string") {
1350
+ search2.value = route.query.search;
1351
+ shouldUpdateSearch = true;
1352
+ }
1353
+ if (typeof route.query.categories === "string" && route.query.categories.length) {
1354
+ const categoriesFromURL = route.query.categories.split(",");
1355
+ categories2.value = templatesStore.allCategories.filter(
1356
+ (category) => categoriesFromURL.includes(category.id.toString())
1357
+ );
1358
+ shouldUpdateSearch = true;
1359
+ }
1360
+ if (shouldUpdateSearch) {
1361
+ updateSearch();
1362
+ trackCategories();
1363
+ areCategoriesPrepopulated.value = true;
1364
+ }
1365
+ };
1366
+ onMounted(async () => {
1367
+ documentTitle.set("Templates");
1368
+ await loadCategories();
1369
+ void loadWorkflowsAndCollections(true);
1370
+ void usersStore.showPersonalizationSurvey();
1371
+ restoreSearchFromRoute();
1372
+ setTimeout(() => {
1373
+ var _a;
1374
+ const scrollOffset = (_a = route.meta) == null ? void 0 : _a.scrollOffset;
1375
+ if (typeof scrollOffset === "number" && scrollOffset > 0) {
1376
+ scrollTo(scrollOffset, "auto");
1377
+ }
1378
+ }, 100);
1379
+ });
1380
+ onBeforeRouteLeave((_to, _from, next) => {
1381
+ var _a, _b;
1382
+ const contentArea = document.getElementById("content");
1383
+ if (contentArea) {
1384
+ (_b = (_a = route.meta) == null ? void 0 : _a.setScrollPosition) == null ? void 0 : _b.call(_a, contentArea.scrollTop);
1385
+ }
1386
+ trackSearch();
1387
+ next();
1388
+ });
1389
+ watch(workflows, (newWorkflows) => {
1390
+ if (newWorkflows.length === 0) {
1391
+ window.scrollTo(0, 0);
1392
+ }
1393
+ });
1394
+ return (_ctx, _cache) => {
1395
+ const _component_n8n_heading = resolveComponent("n8n-heading");
1396
+ const _component_n8n_button = resolveComponent("n8n-button");
1397
+ const _component_font_awesome_icon = resolveComponent("font-awesome-icon");
1398
+ const _component_n8n_input = resolveComponent("n8n-input");
1399
+ const _component_n8n_text = resolveComponent("n8n-text");
1400
+ const _directive_n8n_html = resolveDirective("n8n-html");
1401
+ return openBlock(), createBlock(TemplatesView, null, {
1402
+ header: withCtx(() => [
1403
+ createBaseVNode("div", {
1404
+ class: normalizeClass(_ctx.$style.wrapper)
1405
+ }, [
1406
+ createBaseVNode("div", {
1407
+ class: normalizeClass(_ctx.$style.title)
1408
+ }, [
1409
+ createVNode(_component_n8n_heading, {
1410
+ tag: "h1",
1411
+ size: "2xlarge"
1412
+ }, {
1413
+ default: withCtx(() => [
1414
+ createTextVNode(toDisplayString(unref(i18n).baseText("templates.heading")), 1)
1415
+ ]),
1416
+ _: 1
1417
+ })
1418
+ ], 2),
1419
+ createBaseVNode("div", {
1420
+ class: normalizeClass(_ctx.$style.button)
1421
+ }, [
1422
+ createVNode(_component_n8n_button, {
1423
+ size: "large",
1424
+ type: "secondary",
1425
+ element: "a",
1426
+ href: unref(CREATOR_HUB_URL),
1427
+ label: unref(i18n).baseText("templates.shareWorkflow"),
1428
+ target: "_blank"
1429
+ }, null, 8, ["href", "label"])
1430
+ ], 2)
1431
+ ], 2)
1432
+ ]),
1433
+ content: withCtx(() => [
1434
+ createBaseVNode("div", {
1435
+ class: normalizeClass(_ctx.$style.contentWrapper)
1436
+ }, [
1437
+ createBaseVNode("div", {
1438
+ class: normalizeClass(_ctx.$style.filters)
1439
+ }, [
1440
+ createVNode(TemplateFilters, {
1441
+ categories: unref(templatesStore).allCategories,
1442
+ "sort-on-populate": areCategoriesPrepopulated.value,
1443
+ selected: categories2.value,
1444
+ loading: loadingCategories.value,
1445
+ onClear: onCategoryUnselected,
1446
+ onClearAll: onCategoriesCleared,
1447
+ onSelect: onCategorySelected
1448
+ }, null, 8, ["categories", "sort-on-populate", "selected", "loading"])
1449
+ ], 2),
1450
+ createBaseVNode("div", {
1451
+ class: normalizeClass(_ctx.$style.search)
1452
+ }, [
1453
+ createVNode(_component_n8n_input, {
1454
+ "model-value": search2.value,
1455
+ placeholder: unref(i18n).baseText("templates.searchPlaceholder"),
1456
+ clearable: "",
1457
+ "data-test-id": "template-search-input",
1458
+ "onUpdate:modelValue": onSearchInput,
1459
+ onBlur: trackSearch
1460
+ }, {
1461
+ prefix: withCtx(() => [
1462
+ createVNode(_component_font_awesome_icon, { icon: "search" })
1463
+ ]),
1464
+ _: 1
1465
+ }, 8, ["model-value", "placeholder"]),
1466
+ withDirectives(createBaseVNode("div", {
1467
+ class: normalizeClass(_ctx.$style.carouselContainer)
1468
+ }, [
1469
+ createBaseVNode("div", {
1470
+ class: normalizeClass(_ctx.$style.header)
1471
+ }, [
1472
+ createVNode(_component_n8n_heading, {
1473
+ bold: true,
1474
+ size: "medium",
1475
+ color: "text-light"
1476
+ }, {
1477
+ default: withCtx(() => [
1478
+ createTextVNode(toDisplayString(unref(i18n).baseText("templates.collections")) + " ", 1),
1479
+ !loadingCollections.value ? (openBlock(), createElementBlock("span", {
1480
+ key: 0,
1481
+ "data-test-id": "collection-count-label",
1482
+ textContent: toDisplayString(`(${collections.value.length})`)
1483
+ }, null, 8, _hoisted_1)) : createCommentVNode("", true)
1484
+ ]),
1485
+ _: 1
1486
+ })
1487
+ ], 2),
1488
+ createVNode(TemplatesInfoCarousel, {
1489
+ collections: collections.value,
1490
+ loading: loadingCollections.value,
1491
+ onOpenCollection
1492
+ }, null, 8, ["collections", "loading"])
1493
+ ], 2), [
1494
+ [vShow, collections.value.length || loadingCollections.value]
1495
+ ]),
1496
+ createVNode(TemplateList, {
1497
+ "infinite-scroll-enabled": true,
1498
+ loading: loadingWorkflows.value,
1499
+ workflows: workflows.value,
1500
+ "total-count": totalWorkflows.value,
1501
+ onLoadMore,
1502
+ onOpenTemplate
1503
+ }, null, 8, ["loading", "workflows", "total-count"]),
1504
+ endOfSearchMessage.value ? (openBlock(), createElementBlock("div", {
1505
+ key: 0,
1506
+ class: normalizeClass(_ctx.$style.endText)
1507
+ }, [
1508
+ createVNode(_component_n8n_text, {
1509
+ size: "medium",
1510
+ color: "text-base"
1511
+ }, {
1512
+ default: withCtx(() => [
1513
+ withDirectives(createBaseVNode("span", null, null, 512), [
1514
+ [_directive_n8n_html, endOfSearchMessage.value]
1515
+ ])
1516
+ ]),
1517
+ _: 1
1518
+ })
1519
+ ], 2)) : createCommentVNode("", true)
1520
+ ], 2)
1521
+ ], 2)
1522
+ ]),
1523
+ _: 1
1524
+ });
1525
+ };
1436
1526
  }
1437
1527
  });
1438
1528
  const wrapper = "_wrapper_1el39_1";
@@ -1447,147 +1537,10 @@ const style0 = {
1447
1537
  search,
1448
1538
  header
1449
1539
  };
1450
- const _hoisted_1 = ["textContent"];
1451
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
1452
- const _component_n8n_heading = resolveComponent("n8n-heading");
1453
- const _component_n8n_button = resolveComponent("n8n-button");
1454
- const _component_TemplateFilters = __unplugin_components_0;
1455
- const _component_font_awesome_icon = resolveComponent("font-awesome-icon");
1456
- const _component_n8n_input = resolveComponent("n8n-input");
1457
- const _component_TemplatesInfoCarousel = __unplugin_components_1;
1458
- const _component_TemplateList = __unplugin_components_2;
1459
- const _component_n8n_text = resolveComponent("n8n-text");
1460
- const _component_TemplatesView = resolveComponent("TemplatesView");
1461
- const _directive_n8n_html = resolveDirective("n8n-html");
1462
- return openBlock(), createBlock(_component_TemplatesView, null, {
1463
- header: withCtx(() => [
1464
- createBaseVNode("div", {
1465
- class: normalizeClass(_ctx.$style.wrapper)
1466
- }, [
1467
- createBaseVNode("div", {
1468
- class: normalizeClass(_ctx.$style.title)
1469
- }, [
1470
- createVNode(_component_n8n_heading, {
1471
- tag: "h1",
1472
- size: "2xlarge"
1473
- }, {
1474
- default: withCtx(() => [
1475
- createTextVNode(toDisplayString(_ctx.$locale.baseText("templates.heading")), 1)
1476
- ]),
1477
- _: 1
1478
- })
1479
- ], 2),
1480
- createBaseVNode("div", {
1481
- class: normalizeClass(_ctx.$style.button)
1482
- }, [
1483
- createVNode(_component_n8n_button, {
1484
- size: "large",
1485
- type: "secondary",
1486
- element: "a",
1487
- href: _ctx.creatorHubUrl,
1488
- label: _ctx.$locale.baseText("templates.shareWorkflow"),
1489
- target: "_blank"
1490
- }, null, 8, ["href", "label"])
1491
- ], 2)
1492
- ], 2)
1493
- ]),
1494
- content: withCtx(() => [
1495
- createBaseVNode("div", {
1496
- class: normalizeClass(_ctx.$style.contentWrapper)
1497
- }, [
1498
- createBaseVNode("div", {
1499
- class: normalizeClass(_ctx.$style.filters)
1500
- }, [
1501
- createVNode(_component_TemplateFilters, {
1502
- categories: _ctx.templatesStore.allCategories,
1503
- "sort-on-populate": _ctx.areCategoriesPrepopulated,
1504
- selected: _ctx.categories,
1505
- loading: _ctx.loadingCategories,
1506
- onClear: _ctx.onCategoryUnselected,
1507
- onClearAll: _ctx.onCategoriesCleared,
1508
- onSelect: _ctx.onCategorySelected
1509
- }, null, 8, ["categories", "sort-on-populate", "selected", "loading", "onClear", "onClearAll", "onSelect"])
1510
- ], 2),
1511
- createBaseVNode("div", {
1512
- class: normalizeClass(_ctx.$style.search)
1513
- }, [
1514
- createVNode(_component_n8n_input, {
1515
- "model-value": _ctx.search,
1516
- placeholder: _ctx.$locale.baseText("templates.searchPlaceholder"),
1517
- clearable: "",
1518
- "data-test-id": "template-search-input",
1519
- "onUpdate:modelValue": _ctx.onSearchInput,
1520
- onBlur: _ctx.trackSearch
1521
- }, {
1522
- prefix: withCtx(() => [
1523
- createVNode(_component_font_awesome_icon, { icon: "search" })
1524
- ]),
1525
- _: 1
1526
- }, 8, ["model-value", "placeholder", "onUpdate:modelValue", "onBlur"]),
1527
- withDirectives(createBaseVNode("div", {
1528
- class: normalizeClass(_ctx.$style.carouselContainer)
1529
- }, [
1530
- createBaseVNode("div", {
1531
- class: normalizeClass(_ctx.$style.header)
1532
- }, [
1533
- createVNode(_component_n8n_heading, {
1534
- bold: true,
1535
- size: "medium",
1536
- color: "text-light"
1537
- }, {
1538
- default: withCtx(() => [
1539
- createTextVNode(toDisplayString(_ctx.$locale.baseText("templates.collections")) + " ", 1),
1540
- !_ctx.loadingCollections ? (openBlock(), createElementBlock("span", {
1541
- key: 0,
1542
- "data-test-id": "collection-count-label",
1543
- textContent: toDisplayString(`(${_ctx.collections.length})`)
1544
- }, null, 8, _hoisted_1)) : createCommentVNode("", true)
1545
- ]),
1546
- _: 1
1547
- })
1548
- ], 2),
1549
- createVNode(_component_TemplatesInfoCarousel, {
1550
- collections: _ctx.collections,
1551
- loading: _ctx.loadingCollections,
1552
- onOpenCollection: _ctx.onOpenCollection
1553
- }, null, 8, ["collections", "loading", "onOpenCollection"])
1554
- ], 2), [
1555
- [vShow, _ctx.collections.length || _ctx.loadingCollections]
1556
- ]),
1557
- createVNode(_component_TemplateList, {
1558
- "infinite-scroll-enabled": true,
1559
- loading: _ctx.loadingWorkflows,
1560
- workflows: _ctx.workflows,
1561
- "total-count": _ctx.totalWorkflows,
1562
- onLoadMore: _ctx.onLoadMore,
1563
- onOpenTemplate: _ctx.onOpenTemplate
1564
- }, null, 8, ["loading", "workflows", "total-count", "onLoadMore", "onOpenTemplate"]),
1565
- _ctx.endOfSearchMessage ? (openBlock(), createElementBlock("div", {
1566
- key: 0,
1567
- class: normalizeClass(_ctx.$style.endText)
1568
- }, [
1569
- createVNode(_component_n8n_text, {
1570
- size: "medium",
1571
- color: "text-base"
1572
- }, {
1573
- default: withCtx(() => [
1574
- withDirectives(createBaseVNode("span", null, null, 512), [
1575
- [_directive_n8n_html, _ctx.endOfSearchMessage]
1576
- ])
1577
- ]),
1578
- _: 1
1579
- })
1580
- ], 2)) : createCommentVNode("", true)
1581
- ], 2)
1582
- ], 2)
1583
- ]),
1584
- _: 1
1585
- });
1586
- }
1587
1540
  const cssModules = {
1588
1541
  "$style": style0
1589
1542
  };
1590
- const TemplatesSearchView = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__cssModules", cssModules]]);
1543
+ const TemplatesSearchView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__cssModules", cssModules]]);
1591
1544
  export {
1592
1545
  TemplatesSearchView as default
1593
1546
  };