@pitcher/canvas-ui 2026.1.14-133826-beta → 2026.1.14-135114

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.
package/canvas-ui.js CHANGED
@@ -95692,111 +95692,115 @@ const _hoisted_14$h = {
95692
95692
  key: 0,
95693
95693
  class: "flex items-center ml-2"
95694
95694
  };
95695
- const _hoisted_15$f = {
95696
- key: 2,
95695
+ const _hoisted_15$f = { class: "flex items-center" };
95696
+ const _hoisted_16$e = { key: 0 };
95697
+ const _hoisted_17$c = { class: "c-select-filter__popover w-[350px] rounded flex flex-col bg-base" };
95698
+ const _hoisted_18$a = { class: "pa-2 max-h-[300px] overflow-y-auto" };
95699
+ const _hoisted_19$a = {
95700
+ key: 0,
95697
95701
  class: "flex items-center ml-2"
95698
95702
  };
95699
- const _hoisted_16$e = { class: "flex flex-col w-full flex-1 min-h-0" };
95700
- const _hoisted_17$c = {
95703
+ const _hoisted_20$9 = { class: "flex flex-col w-full flex-1 min-h-0" };
95704
+ const _hoisted_21$7 = {
95701
95705
  key: 0,
95702
95706
  class: "flex-1 overflow-y-auto bg-white w-full pl-1 pr-6 py-0"
95703
95707
  };
95704
- const _hoisted_18$a = { class: "space-y-1 mt-4" };
95705
- const _hoisted_19$a = ["onClick"];
95706
- const _hoisted_20$9 = { class: "text-sm text-gray-700" };
95707
- const _hoisted_21$7 = { class: "flex items-center mb-0" };
95708
- const _hoisted_22$5 = { class: "text-sm font-bold text-gray-700" };
95708
+ const _hoisted_22$5 = { class: "space-y-1 mt-4" };
95709
95709
  const _hoisted_23$5 = ["onClick"];
95710
- const _hoisted_24$5 = {
95710
+ const _hoisted_24$5 = { class: "text-sm text-gray-700" };
95711
+ const _hoisted_25$5 = { class: "flex items-center mb-0" };
95712
+ const _hoisted_26$5 = { class: "text-sm font-bold text-gray-700" };
95713
+ const _hoisted_27$5 = ["onClick"];
95714
+ const _hoisted_28$5 = {
95711
95715
  key: 0,
95712
95716
  class: "relative mr-4"
95713
95717
  };
95714
- const _hoisted_25$5 = {
95718
+ const _hoisted_29$5 = {
95715
95719
  key: 0,
95716
95720
  class: "absolute inset-0 flex items-center justify-center bg-gray-200 bg-opacity-75 border-rounded-1"
95717
95721
  };
95718
- const _hoisted_26$5 = {
95722
+ const _hoisted_30$4 = {
95719
95723
  key: 1,
95720
95724
  class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center"
95721
95725
  };
95722
- const _hoisted_27$5 = { class: "flex-1 min-w-0" };
95723
- const _hoisted_28$5 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95724
- const _hoisted_29$5 = { class: "text-xs text-gray-500" };
95725
- const _hoisted_30$4 = {
95726
+ const _hoisted_31$4 = { class: "flex-1 min-w-0" };
95727
+ const _hoisted_32$4 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95728
+ const _hoisted_33$4 = { class: "text-xs text-gray-500" };
95729
+ const _hoisted_34$4 = {
95726
95730
  key: 1,
95727
95731
  class: "flex-1 overflow-y-auto bg-white w-full"
95728
95732
  };
95729
- const _hoisted_31$4 = { class: "w-full px-0" };
95730
- const _hoisted_32$4 = {
95733
+ const _hoisted_35$4 = { class: "w-full px-0" };
95734
+ const _hoisted_36$4 = {
95731
95735
  key: 0,
95732
95736
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95733
95737
  };
95734
- const _hoisted_33$4 = {
95738
+ const _hoisted_37$4 = {
95735
95739
  key: 0,
95736
95740
  class: "mb-0"
95737
95741
  };
95738
- const _hoisted_34$4 = { class: "flex items-center px-0 pt-2 pb-1" };
95739
- const _hoisted_35$4 = { class: "text-m font-semibold text-gray-900" };
95740
- const _hoisted_36$4 = { class: "ml-2 text-sm text-gray-500" };
95741
- const _hoisted_37$4 = ["data-result-selected", "onClick"];
95742
- const _hoisted_38$4 = {
95742
+ const _hoisted_38$4 = { class: "flex items-center px-0 pt-2 pb-1" };
95743
+ const _hoisted_39$4 = { class: "text-m font-semibold text-gray-900" };
95744
+ const _hoisted_40$4 = { class: "ml-2 text-sm text-gray-500" };
95745
+ const _hoisted_41$4 = ["data-result-selected", "onClick"];
95746
+ const _hoisted_42$4 = {
95743
95747
  key: 1,
95744
95748
  class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center"
95745
95749
  };
95746
- const _hoisted_39$4 = { class: "flex-1 min-w-0" };
95747
- const _hoisted_40$4 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95748
- const _hoisted_41$4 = ["innerHTML"];
95749
- const _hoisted_42$4 = { class: "text-xs text-gray-500" };
95750
- const _hoisted_43$4 = { class: "text-xs text-gray-400" };
95751
- const _hoisted_44$4 = {
95750
+ const _hoisted_43$4 = { class: "flex-1 min-w-0" };
95751
+ const _hoisted_44$4 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95752
+ const _hoisted_45$4 = ["innerHTML"];
95753
+ const _hoisted_46$4 = { class: "text-xs text-gray-500" };
95754
+ const _hoisted_47$4 = { class: "text-xs text-gray-400" };
95755
+ const _hoisted_48$4 = {
95752
95756
  key: 0,
95753
95757
  class: "px-0 py-0"
95754
95758
  };
95755
- const _hoisted_45$4 = { key: 1 };
95756
- const _hoisted_46$4 = { class: "flex items-center px-0 pt-2 pb-1" };
95757
- const _hoisted_47$4 = { class: "text-m font-semibold text-gray-900" };
95758
- const _hoisted_48$4 = { class: "ml-2 text-sm text-gray-500" };
95759
- const _hoisted_49$4 = ["data-result-selected", "onClick"];
95760
- const _hoisted_50$4 = { class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center" };
95761
- const _hoisted_51$3 = { class: "flex-1 min-w-0" };
95762
- const _hoisted_52$3 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95763
- const _hoisted_53$3 = { class: "text-xs text-gray-500" };
95764
- const _hoisted_54$2 = { class: "text-xs text-gray-400" };
95765
- const _hoisted_55$2 = {
95759
+ const _hoisted_49$4 = { key: 1 };
95760
+ const _hoisted_50$4 = { class: "flex items-center px-0 pt-2 pb-1" };
95761
+ const _hoisted_51$3 = { class: "text-m font-semibold text-gray-900" };
95762
+ const _hoisted_52$3 = { class: "ml-2 text-sm text-gray-500" };
95763
+ const _hoisted_53$3 = ["data-result-selected", "onClick"];
95764
+ const _hoisted_54$2 = { class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center" };
95765
+ const _hoisted_55$2 = { class: "flex-1 min-w-0" };
95766
+ const _hoisted_56$2 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95767
+ const _hoisted_57$2 = { class: "text-xs text-gray-500" };
95768
+ const _hoisted_58$2 = { class: "text-xs text-gray-400" };
95769
+ const _hoisted_59$2 = {
95766
95770
  key: 0,
95767
95771
  class: "px-0 py-0"
95768
95772
  };
95769
- const _hoisted_56$2 = {
95773
+ const _hoisted_60$2 = {
95770
95774
  key: 2,
95771
95775
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95772
95776
  };
95773
- const _hoisted_57$2 = {
95777
+ const _hoisted_61$2 = {
95774
95778
  key: 2,
95775
95779
  class: "flex-1 overflow-y-auto bg-white w-full"
95776
95780
  };
95777
- const _hoisted_58$2 = { class: "w-full px-0" };
95778
- const _hoisted_59$2 = {
95781
+ const _hoisted_62$2 = { class: "w-full px-0" };
95782
+ const _hoisted_63$2 = {
95779
95783
  key: 0,
95780
95784
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95781
95785
  };
95782
- const _hoisted_60$2 = { class: "flex items-center px-0 pt-2 pb-1" };
95783
- const _hoisted_61$2 = { class: "text-m font-semibold text-gray-900" };
95784
- const _hoisted_62$2 = { class: "ml-2 text-sm text-gray-500" };
95785
- const _hoisted_63$2 = ["data-result-selected", "onClick"];
95786
- const _hoisted_64$2 = {
95786
+ const _hoisted_64$2 = { class: "flex items-center px-0 pt-2 pb-1" };
95787
+ const _hoisted_65$2 = { class: "text-m font-semibold text-gray-900" };
95788
+ const _hoisted_66$2 = { class: "ml-2 text-sm text-gray-500" };
95789
+ const _hoisted_67$2 = ["data-result-selected", "onClick"];
95790
+ const _hoisted_68$2 = {
95787
95791
  key: 1,
95788
95792
  class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center"
95789
95793
  };
95790
- const _hoisted_65$2 = { class: "flex-1 min-w-0" };
95791
- const _hoisted_66$2 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95792
- const _hoisted_67$2 = ["innerHTML"];
95793
- const _hoisted_68$2 = { class: "text-xs text-gray-500" };
95794
- const _hoisted_69$1 = { class: "text-xs text-gray-400" };
95795
- const _hoisted_70$1 = {
95794
+ const _hoisted_69$1 = { class: "flex-1 min-w-0" };
95795
+ const _hoisted_70$1 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95796
+ const _hoisted_71$1 = ["innerHTML"];
95797
+ const _hoisted_72$1 = { class: "text-xs text-gray-500" };
95798
+ const _hoisted_73$1 = { class: "text-xs text-gray-400" };
95799
+ const _hoisted_74$1 = {
95796
95800
  key: 0,
95797
95801
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95798
95802
  };
95799
- const _hoisted_71$1 = {
95803
+ const _hoisted_75$1 = {
95800
95804
  key: 0,
95801
95805
  class: "flex flex-wrap line-height-6 pt-4 pb-2 px-6 border-t border-gray-200 gap-y-4 gap-x-4"
95802
95806
  };
@@ -95823,6 +95827,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95823
95827
  const selectedFileTypes = ref([]);
95824
95828
  const showFileTypeDropdown = ref(false);
95825
95829
  const selectedCanvasFilters = ref([]);
95830
+ const showCanvasTypeDropdown = ref(false);
95826
95831
  const fileTypeOptions = [
95827
95832
  { label: "Folder", value: "folder" },
95828
95833
  { label: "PDF", value: "pdf" },
@@ -95835,6 +95840,42 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95835
95840
  { label: "AR", value: "ar" },
95836
95841
  { label: "Web", value: "web" }
95837
95842
  ];
95843
+ const canvasTypeOptions = computed(() => {
95844
+ const options = [
95845
+ { label: t("canvasUI.CAlgoliaSearch.canvasFilters.templates"), value: "template" },
95846
+ { label: t("canvasUI.CAlgoliaSearch.canvasFilters.products"), value: "section" },
95847
+ { label: t("canvasUI.CAlgoliaSearch.canvasFilters.blocks"), value: "block" }
95848
+ ];
95849
+ if (!props.isAdmin) {
95850
+ options.unshift({ label: t("canvasUI.CAlgoliaSearch.canvasFilters.saved"), value: "saved_canvas" });
95851
+ }
95852
+ if (props.isAdmin) {
95853
+ options.splice(1, 0, {
95854
+ label: t("canvasUI.CAlgoliaSearch.canvasFilters.productTemplates"),
95855
+ value: "product_template"
95856
+ });
95857
+ }
95858
+ return options;
95859
+ });
95860
+ const ALLOWED_CANVAS_TYPES = ["saved_canvas", "template", "product_template", "section", "block"];
95861
+ const ALLOWED_FILE_TYPES = [
95862
+ "folder",
95863
+ "pdf",
95864
+ "image",
95865
+ "audio",
95866
+ "video",
95867
+ "document",
95868
+ "presentation",
95869
+ "spreadsheet",
95870
+ "ar",
95871
+ "web"
95872
+ ];
95873
+ const visibleCanvasTypeOptions = computed(() => {
95874
+ if (showRecentView.value || !searchQuery.value.trim()) {
95875
+ return canvasTypeOptions.value;
95876
+ }
95877
+ return canvasTypeOptions.value.filter((option) => availableCanvasTypes.value.has(option.value));
95878
+ });
95838
95879
  const hasActiveFilters = computed(() => selectedFileTypes.value.length > 0 || selectedCanvasFilters.value.length > 0);
95839
95880
  const clearAllFilters = () => {
95840
95881
  selectedFileTypes.value = [];
@@ -95845,7 +95886,9 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95845
95886
  selectedFileTypes.value = [];
95846
95887
  selectedCanvasFilters.value = [];
95847
95888
  searchType.value = null;
95848
- if (searchQuery.value.trim()) {
95889
+ if (searchQuery.value.trim() && (unfilteredContentResults.value.length > 0 || unfilteredCanvasResults.value.length > 0)) {
95890
+ applyFiltersToResults();
95891
+ } else if (searchQuery.value.trim()) {
95849
95892
  try {
95850
95893
  skipNextSuggestionFetch.value = true;
95851
95894
  await performSearch(searchQuery.value);
@@ -95981,8 +96024,11 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95981
96024
  };
95982
96025
  const contentResults = ref([]);
95983
96026
  const canvasResults = ref([]);
96027
+ const unfilteredContentResults = ref([]);
96028
+ const unfilteredCanvasResults = ref([]);
95984
96029
  const isSearching = ref(false);
95985
96030
  const hasSearchCompleted = ref(false);
96031
+ let currentSearchId = 0;
95986
96032
  const querySuggestions = ref([]);
95987
96033
  const selectedSuggestionIndex = ref(-1);
95988
96034
  const selectedResultIndex = ref(-1);
@@ -95999,6 +96045,44 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95999
96045
  }
96000
96046
  return canvasResults.value;
96001
96047
  });
96048
+ const availableFileTypes = computed(() => {
96049
+ if (showRecentView.value || !searchQuery.value.trim()) {
96050
+ return /* @__PURE__ */ new Set();
96051
+ }
96052
+ const types = /* @__PURE__ */ new Set();
96053
+ unfilteredContentResults.value.forEach((item) => {
96054
+ if (item.type === "folder") {
96055
+ types.add("folder");
96056
+ } else if (item.type === "file" && item.file_category) {
96057
+ types.add(item.file_category);
96058
+ }
96059
+ });
96060
+ return types;
96061
+ });
96062
+ const availableCanvasTypes = computed(() => {
96063
+ if (showRecentView.value || !searchQuery.value.trim()) {
96064
+ return /* @__PURE__ */ new Set();
96065
+ }
96066
+ const types = /* @__PURE__ */ new Set();
96067
+ unfilteredCanvasResults.value.forEach((item) => {
96068
+ if (item.content_type) {
96069
+ types.add(item.content_type);
96070
+ }
96071
+ });
96072
+ return types;
96073
+ });
96074
+ const visibleFileTypeOptions = computed(() => {
96075
+ if (showRecentView.value || !searchQuery.value.trim()) {
96076
+ return fileTypeOptions;
96077
+ }
96078
+ return fileTypeOptions.filter((option) => availableFileTypes.value.has(option.value));
96079
+ });
96080
+ const hasContentFilters = computed(() => {
96081
+ return visibleFileTypeOptions.value.length > 0 || selectedFileTypes.value.length > 0;
96082
+ });
96083
+ const hasCanvasFilters = computed(() => {
96084
+ return visibleCanvasTypeOptions.value.length > 0 || selectedCanvasFilters.value.length > 0;
96085
+ });
96002
96086
  const shouldShowNoResults = computed(() => {
96003
96087
  if (showRecentView.value || !searchQuery.value.trim() || isSearching.value || !hasSearchCompleted.value) return false;
96004
96088
  if (searchType.value === "content") {
@@ -96042,6 +96126,32 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96042
96126
  };
96043
96127
  watch(searchType, () => {
96044
96128
  selectedResultIndex.value = -1;
96129
+ showFileTypeDropdown.value = false;
96130
+ showCanvasTypeDropdown.value = false;
96131
+ });
96132
+ watch(visibleFileTypeOptions, (newOptions) => {
96133
+ if (selectedFileTypes.value.length > 0) {
96134
+ const availableValues = new Set(newOptions.map((option) => option.value));
96135
+ const stillAvailable = selectedFileTypes.value.filter((type) => availableValues.has(type));
96136
+ if (stillAvailable.length !== selectedFileTypes.value.length) {
96137
+ selectedFileTypes.value = stillAvailable;
96138
+ if (searchQuery.value.trim()) {
96139
+ performSearch(searchQuery.value.trim());
96140
+ }
96141
+ }
96142
+ }
96143
+ });
96144
+ watch(visibleCanvasTypeOptions, (newOptions) => {
96145
+ if (selectedCanvasFilters.value.length > 0) {
96146
+ const availableValues = new Set(newOptions.map((option) => option.value));
96147
+ const stillAvailable = selectedCanvasFilters.value.filter((type) => availableValues.has(type));
96148
+ if (stillAvailable.length !== selectedCanvasFilters.value.length) {
96149
+ selectedCanvasFilters.value = stillAvailable;
96150
+ if (searchQuery.value.trim()) {
96151
+ performSearch(searchQuery.value.trim());
96152
+ }
96153
+ }
96154
+ }
96045
96155
  });
96046
96156
  const scrollSelectedResultIntoView = () => {
96047
96157
  nextTick(() => {
@@ -96085,6 +96195,8 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96085
96195
  if (!query.trim()) {
96086
96196
  contentResults.value = [];
96087
96197
  canvasResults.value = [];
96198
+ unfilteredContentResults.value = [];
96199
+ unfilteredCanvasResults.value = [];
96088
96200
  hasSearchCompleted.value = false;
96089
96201
  isSearching.value = false;
96090
96202
  searchError.value = null;
@@ -96093,59 +96205,51 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96093
96205
  isSearching.value = true;
96094
96206
  hasSearchCompleted.value = false;
96095
96207
  searchError.value = null;
96208
+ const searchId = ++currentSearchId;
96096
96209
  const shouldSkipSuggestionFetch = skipNextSuggestionFetch.value;
96097
96210
  if (shouldSkipSuggestionFetch) {
96098
96211
  skipNextSuggestionFetch.value = false;
96099
96212
  }
96100
96213
  try {
96101
- const ALLOWED_CANVAS_TYPES = ["saved_canvas", "template", "product_template", "section", "block"];
96102
- const ALLOWED_FILE_TYPES = [
96103
- "folder",
96104
- "pdf",
96105
- "image",
96106
- "audio",
96107
- "video",
96108
- "document",
96109
- "presentation",
96110
- "spreadsheet",
96111
- "ar",
96112
- "web"
96113
- ];
96114
- const validCanvasFilters = selectedCanvasFilters.value.filter((f) => ALLOWED_CANVAS_TYPES.includes(f));
96115
- if (selectedCanvasFilters.value.length > 0 && validCanvasFilters.length === 0) {
96116
- console.warn(
96117
- "[CAlgoliaSearch] All selected canvas filters are invalid and were removed:",
96118
- selectedCanvasFilters.value
96119
- );
96120
- selectedCanvasFilters.value = [];
96121
- } else if (validCanvasFilters.length < selectedCanvasFilters.value.length) {
96122
- const removedFilters = selectedCanvasFilters.value.filter((f) => !validCanvasFilters.includes(f));
96123
- console.warn("[CAlgoliaSearch] Some canvas filters were invalid and removed:", removedFilters);
96214
+ const validCanvasFilters = selectedCanvasFilters.value.filter((filter) => ALLOWED_CANVAS_TYPES.includes(filter));
96215
+ if (selectedCanvasFilters.value.length !== validCanvasFilters.length) {
96216
+ const invalid = selectedCanvasFilters.value.filter((filter) => !ALLOWED_CANVAS_TYPES.includes(filter));
96217
+ console.warn("[CAlgoliaSearch] Invalid canvas filters removed:", invalid);
96124
96218
  selectedCanvasFilters.value = validCanvasFilters;
96125
96219
  }
96126
- const canvasFilters = validCanvasFilters.length > 0 ? ` AND (${validCanvasFilters.map((filter) => `content_type:"${filter}"`).join(" OR ")})` : "";
96127
- const validFileTypes = selectedFileTypes.value.filter((t2) => ALLOWED_FILE_TYPES.includes(t2));
96128
- if (selectedFileTypes.value.length > 0 && validFileTypes.length === 0) {
96129
- console.warn(
96130
- "[CAlgoliaSearch] All selected file type filters are invalid and were removed:",
96131
- selectedFileTypes.value
96132
- );
96133
- selectedFileTypes.value = [];
96134
- } else if (validFileTypes.length < selectedFileTypes.value.length) {
96135
- const removedFilters = selectedFileTypes.value.filter((t2) => !validFileTypes.includes(t2));
96136
- console.warn("[CAlgoliaSearch] Some file type filters were invalid and removed:", removedFilters);
96220
+ const validFileTypes = selectedFileTypes.value.filter((type) => ALLOWED_FILE_TYPES.includes(type));
96221
+ if (selectedFileTypes.value.length !== validFileTypes.length) {
96222
+ const invalid = selectedFileTypes.value.filter((type) => !ALLOWED_FILE_TYPES.includes(type));
96223
+ console.warn("[CAlgoliaSearch] Invalid file type filters removed:", invalid);
96137
96224
  selectedFileTypes.value = validFileTypes;
96138
96225
  }
96139
- const contentFilters = validFileTypes.length > 0 ? ` AND (${validFileTypes.map((type) => type === "folder" ? `type:"${type}"` : `file_category:"${type}"`).join(" OR ")})` : "";
96140
96226
  const results = await searchViaBackend(query.trim(), {
96141
- canvas: canvasFilters,
96142
- content: contentFilters
96227
+ canvas: "",
96228
+ content: ""
96143
96229
  });
96144
96230
  if (query.trim() !== searchQuery.value.trim()) {
96145
96231
  return;
96146
96232
  }
96147
- contentResults.value = results.content?.hits || [];
96148
- canvasResults.value = results.canvas?.hits || [];
96233
+ unfilteredContentResults.value = results.content?.hits || [];
96234
+ unfilteredCanvasResults.value = results.canvas?.hits || [];
96235
+ let filteredContent = unfilteredContentResults.value;
96236
+ let filteredCanvas = unfilteredCanvasResults.value;
96237
+ if (validFileTypes.length > 0) {
96238
+ filteredContent = filteredContent.filter((item) => {
96239
+ if (validFileTypes.includes("folder") && item.type === "folder") {
96240
+ return true;
96241
+ }
96242
+ if (item.type === "file") {
96243
+ return validFileTypes.includes(item.file_category);
96244
+ }
96245
+ return false;
96246
+ });
96247
+ }
96248
+ if (validCanvasFilters.length > 0) {
96249
+ filteredCanvas = filteredCanvas.filter((item) => validCanvasFilters.includes(item.content_type));
96250
+ }
96251
+ contentResults.value = filteredContent;
96252
+ canvasResults.value = filteredCanvas;
96149
96253
  selectedResultIndex.value = -1;
96150
96254
  searchError.value = null;
96151
96255
  if (query.trim().length >= 2 && !shouldSkipSuggestionFetch) {
@@ -96158,23 +96262,27 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96158
96262
  }
96159
96263
  await nextTick();
96160
96264
  setTimeout(() => {
96161
- isSearching.value = false;
96162
- hasSearchCompleted.value = true;
96265
+ if (searchId === currentSearchId) {
96266
+ isSearching.value = false;
96267
+ hasSearchCompleted.value = true;
96268
+ }
96163
96269
  }, 50);
96164
96270
  } catch (error) {
96165
96271
  console.error("Search error:", error);
96166
- contentResults.value = [];
96167
- canvasResults.value = [];
96168
- isSearching.value = false;
96169
- hasSearchCompleted.value = true;
96170
- if (error.message === "AUTH_REQUIRED") {
96171
- searchError.value = "Please sign in to search";
96172
- } else if (error.message === "AUTH_EXPIRED") {
96173
- searchError.value = "Your session has expired. Please sign in again";
96174
- } else if (error.message === "AUTH_FORBIDDEN") {
96175
- searchError.value = "You do not have permission to search this instance";
96176
- } else {
96177
- searchError.value = "Search failed. Please try again";
96272
+ if (searchId === currentSearchId) {
96273
+ contentResults.value = [];
96274
+ canvasResults.value = [];
96275
+ isSearching.value = false;
96276
+ hasSearchCompleted.value = true;
96277
+ if (error.message === "AUTH_REQUIRED") {
96278
+ searchError.value = "Please sign in to search";
96279
+ } else if (error.message === "AUTH_EXPIRED") {
96280
+ searchError.value = "Your session has expired. Please sign in again";
96281
+ } else if (error.message === "AUTH_FORBIDDEN") {
96282
+ searchError.value = "You do not have permission to search this instance";
96283
+ } else {
96284
+ searchError.value = "Search failed. Please try again";
96285
+ }
96178
96286
  }
96179
96287
  }
96180
96288
  };
@@ -96184,19 +96292,38 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96184
96292
  if (!query || typeof query !== "string") return "";
96185
96293
  return query;
96186
96294
  }
96295
+ function applyFiltersToResults() {
96296
+ if (unfilteredContentResults.value.length === 0 && unfilteredCanvasResults.value.length === 0) {
96297
+ return;
96298
+ }
96299
+ const validFileTypes = selectedFileTypes.value.filter((type) => ALLOWED_FILE_TYPES.includes(type));
96300
+ const validCanvasFilters = selectedCanvasFilters.value.filter((type) => ALLOWED_CANVAS_TYPES.includes(type));
96301
+ let filteredContent = unfilteredContentResults.value;
96302
+ let filteredCanvas = unfilteredCanvasResults.value;
96303
+ if (validFileTypes.length > 0) {
96304
+ filteredContent = filteredContent.filter((item) => {
96305
+ if (validFileTypes.includes("folder") && item.type === "folder") {
96306
+ return true;
96307
+ }
96308
+ if (item.type === "file") {
96309
+ return validFileTypes.includes(item.file_category);
96310
+ }
96311
+ return false;
96312
+ });
96313
+ }
96314
+ if (validCanvasFilters.length > 0) {
96315
+ filteredCanvas = filteredCanvas.filter((item) => validCanvasFilters.includes(item.content_type));
96316
+ }
96317
+ contentResults.value = filteredContent;
96318
+ canvasResults.value = filteredCanvas;
96319
+ selectedResultIndex.value = -1;
96320
+ }
96187
96321
  const debouncedFilterSearch = () => {
96188
96322
  if (filterChangeTimer) clearTimeout(filterChangeTimer);
96189
96323
  if (searchTimer) clearTimeout(searchTimer);
96190
96324
  filterChangeTimer = setTimeout(async () => {
96191
96325
  if (searchQuery.value.trim() && !showRecentView.value) {
96192
- try {
96193
- skipNextSuggestionFetch.value = true;
96194
- await performSearch(searchQuery.value);
96195
- } catch (error) {
96196
- console.error("[debouncedFilterSearch] Search failed:", error);
96197
- } finally {
96198
- skipNextSuggestionFetch.value = false;
96199
- }
96326
+ applyFiltersToResults();
96200
96327
  }
96201
96328
  }, 500);
96202
96329
  };
@@ -96222,6 +96349,8 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96222
96349
  showRecentView.value = true;
96223
96350
  contentResults.value = [];
96224
96351
  canvasResults.value = [];
96352
+ unfilteredContentResults.value = [];
96353
+ unfilteredCanvasResults.value = [];
96225
96354
  querySuggestions.value = [];
96226
96355
  selectedSuggestionIndex.value = -1;
96227
96356
  selectedResultIndex.value = -1;
@@ -96235,6 +96364,8 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96235
96364
  showRecentView.value = true;
96236
96365
  contentResults.value = [];
96237
96366
  canvasResults.value = [];
96367
+ unfilteredContentResults.value = [];
96368
+ unfilteredCanvasResults.value = [];
96238
96369
  querySuggestions.value = [];
96239
96370
  selectedSuggestionIndex.value = -1;
96240
96371
  selectedResultIndex.value = -1;
@@ -96359,31 +96490,31 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96359
96490
  if (endChar < highlightValue.length) truncated = truncated + "...";
96360
96491
  return sanitizeHtml(truncated);
96361
96492
  };
96362
- const toggleCanvasFilter = (filterType) => {
96363
- if (selectedCanvasFilters.value.includes(filterType)) {
96364
- selectedCanvasFilters.value.splice(selectedCanvasFilters.value.indexOf(filterType), 1);
96493
+ const handleFileTypeToggle = (value, checked) => {
96494
+ if (checked) {
96495
+ if (!selectedFileTypes.value.includes(value)) {
96496
+ selectedFileTypes.value.push(value);
96497
+ }
96365
96498
  } else {
96366
- selectedCanvasFilters.value.push(filterType);
96499
+ selectedFileTypes.value = selectedFileTypes.value.filter((v) => v !== value);
96367
96500
  }
96368
96501
  debouncedFilterSearch();
96369
96502
  };
96370
- const clearCanvasFilters = () => {
96371
- selectedCanvasFilters.value = [];
96372
- debouncedFilterSearch();
96373
- };
96374
- const toggleFileType = (fileType, checked) => {
96503
+ const handleCanvasTypeToggle = (value, checked) => {
96375
96504
  if (checked) {
96376
- if (!selectedFileTypes.value.includes(fileType)) {
96377
- selectedFileTypes.value.push(fileType);
96505
+ if (!selectedCanvasFilters.value.includes(value)) {
96506
+ selectedCanvasFilters.value.push(value);
96378
96507
  }
96379
96508
  } else {
96380
- const index = selectedFileTypes.value.indexOf(fileType);
96381
- if (index > -1) {
96382
- selectedFileTypes.value.splice(index, 1);
96383
- }
96509
+ selectedCanvasFilters.value = selectedCanvasFilters.value.filter((v) => v !== value);
96384
96510
  }
96385
96511
  debouncedFilterSearch();
96386
96512
  };
96513
+ const clearCanvasFilters = () => {
96514
+ selectedCanvasFilters.value = [];
96515
+ showCanvasTypeDropdown.value = false;
96516
+ debouncedFilterSearch();
96517
+ };
96387
96518
  const clearFileTypes = () => {
96388
96519
  selectedFileTypes.value = [];
96389
96520
  showFileTypeDropdown.value = false;
@@ -96554,7 +96685,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96554
96685
  show: "",
96555
96686
  verticalAlignment: "top",
96556
96687
  "z-index": _ctx.zIndex,
96557
- "onUpdate:show": _cache[15] || (_cache[15] = ($event) => emit("toggleSearch", $event))
96688
+ "onUpdate:show": _cache[12] || (_cache[12] = ($event) => emit("toggleSearch", $event))
96558
96689
  }, {
96559
96690
  default: withCtx(() => [
96560
96691
  createElementVNode("div", {
@@ -96563,7 +96694,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96563
96694
  }, [
96564
96695
  createElementVNode("div", _hoisted_1$4w, [
96565
96696
  createElementVNode("div", _hoisted_2$3j, [
96566
- _cache[16] || (_cache[16] = createElementVNode("div", { class: "absolute left-2.5 top-1/2 transform -translate-y-1/2 z-10" }, [
96697
+ _cache[13] || (_cache[13] = createElementVNode("div", { class: "absolute left-2.5 top-1/2 transform -translate-y-1/2 z-10" }, [
96567
96698
  createElementVNode("i", { class: "c-icon far fa-search text-gray-400 text-l" })
96568
96699
  ], -1)),
96569
96700
  withDirectives(createElementVNode("input", {
@@ -96660,7 +96791,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96660
96791
  createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.tabs.pitchDecks")), 1)
96661
96792
  ], 2)) : createCommentVNode("", true)
96662
96793
  ]),
96663
- searchType.value ? (openBlock(), createElementBlock("div", _hoisted_9$O, [
96794
+ searchType.value && (searchType.value === "content" && hasContentFilters.value || searchType.value === "canvases" && hasCanvasFilters.value) ? (openBlock(), createElementBlock("div", _hoisted_9$O, [
96664
96795
  searchType.value === "content" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
96665
96796
  createVNode(unref(NPopover), {
96666
96797
  class: "c-select-filter",
@@ -96696,24 +96827,23 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96696
96827
  default: withCtx(() => [
96697
96828
  createElementVNode("div", _hoisted_12$p, [
96698
96829
  createElementVNode("div", _hoisted_13$k, [
96699
- (openBlock(), createElementBlock(Fragment, null, renderList(fileTypeOptions, (option) => {
96700
- return createElementVNode("div", {
96830
+ (openBlock(true), createElementBlock(Fragment, null, renderList(visibleFileTypeOptions.value, (option) => {
96831
+ return openBlock(), createElementBlock("div", {
96701
96832
  key: option.value,
96702
96833
  class: "w-full h-7 flex items-center"
96703
96834
  }, [
96704
96835
  createVNode(unref(NCheckbox), {
96705
96836
  checked: selectedFileTypes.value.includes(option.value),
96706
96837
  class: "px-2 truncate",
96707
- "onUpdate:checked": (v) => toggleFileType(option.value, v),
96708
- value: option.value
96838
+ "onUpdate:checked": (checked) => handleFileTypeToggle(option.value, checked)
96709
96839
  }, {
96710
96840
  default: withCtx(() => [
96711
96841
  createTextVNode(toDisplayString(option.label), 1)
96712
96842
  ]),
96713
96843
  _: 2
96714
- }, 1032, ["checked", "onUpdate:checked", "value"])
96844
+ }, 1032, ["checked", "onUpdate:checked"])
96715
96845
  ]);
96716
- }), 64))
96846
+ }), 128))
96717
96847
  ]),
96718
96848
  createElementVNode("div", {
96719
96849
  class: "pa-2",
@@ -96736,114 +96866,99 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96736
96866
  _: 1
96737
96867
  }, 8, ["show"]),
96738
96868
  hasActiveFilters.value ? (openBlock(), createElementBlock("div", _hoisted_14$h, [
96739
- _cache[17] || (_cache[17] = createElementVNode("div", { class: "h-6 w-px bg-gray-300 mx-2" }, null, -1)),
96869
+ _cache[14] || (_cache[14] = createElementVNode("div", { class: "h-6 w-px bg-gray-300 mx-2" }, null, -1)),
96740
96870
  createElementVNode("span", {
96741
96871
  class: "text-sm text-gray-600 hover:text-gray-800 font-normal cursor-pointer",
96742
96872
  onClick: clearAllFilters
96743
96873
  }, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.clear")), 1)
96744
96874
  ])) : createCommentVNode("", true)
96745
96875
  ], 64)) : searchType.value === "canvases" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
96746
- !_ctx.isAdmin ? (openBlock(), createBlock(unref(NTag), {
96747
- key: 0,
96748
- class: "select-none cursor-pointer",
96749
- style: normalizeStyle({
96750
- "--n-color": selectedCanvasFilters.value.includes("saved_canvas") ? "var(--p-primary5)" : "var(--p-primary6)",
96751
- "--n-border": "1px solid var(--p-primary5)",
96752
- "--n-height": "28px"
96753
- }),
96754
- themeOverrides: {
96755
- borderRadius: "4px"
96756
- },
96757
- onClick: _cache[8] || (_cache[8] = ($event) => toggleCanvasFilter("saved_canvas"))
96758
- }, {
96759
- default: withCtx(() => [
96760
- createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.canvasFilters.saved")), 1)
96761
- ]),
96762
- _: 1
96763
- }, 8, ["style"])) : createCommentVNode("", true),
96764
- createVNode(unref(NTag), {
96765
- class: "select-none cursor-pointer",
96766
- style: normalizeStyle({
96767
- "--n-color": selectedCanvasFilters.value.includes("template") ? "var(--p-primary5)" : "var(--p-primary6)",
96768
- "--n-border": "1px solid var(--p-primary5)",
96769
- "--n-height": "28px"
96770
- }),
96771
- themeOverrides: {
96772
- borderRadius: "4px"
96773
- },
96774
- onClick: _cache[9] || (_cache[9] = ($event) => toggleCanvasFilter("template"))
96775
- }, {
96776
- default: withCtx(() => [
96777
- createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.canvasFilters.templates")), 1)
96778
- ]),
96779
- _: 1
96780
- }, 8, ["style"]),
96781
- _ctx.isAdmin ? (openBlock(), createBlock(unref(NTag), {
96782
- key: 1,
96783
- class: "select-none cursor-pointer",
96784
- style: normalizeStyle({
96785
- "--n-color": selectedCanvasFilters.value.includes("product_template") ? "var(--p-primary5)" : "var(--p-primary6)",
96786
- "--n-border": "1px solid var(--p-primary5)",
96787
- "--n-height": "28px"
96788
- }),
96789
- themeOverrides: {
96790
- borderRadius: "4px"
96791
- },
96792
- onClick: _cache[10] || (_cache[10] = ($event) => toggleCanvasFilter("product_template"))
96793
- }, {
96794
- default: withCtx(() => [
96795
- createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.canvasFilters.productTemplates")), 1)
96796
- ]),
96797
- _: 1
96798
- }, 8, ["style"])) : createCommentVNode("", true),
96799
- createVNode(unref(NTag), {
96800
- class: "select-none cursor-pointer",
96801
- style: normalizeStyle({
96802
- "--n-color": selectedCanvasFilters.value.includes("section") ? "var(--p-primary5)" : "var(--p-primary6)",
96803
- "--n-border": "1px solid var(--p-primary5)",
96804
- "--n-height": "28px"
96805
- }),
96806
- themeOverrides: {
96807
- borderRadius: "4px"
96808
- },
96809
- onClick: _cache[11] || (_cache[11] = ($event) => toggleCanvasFilter("section"))
96876
+ createVNode(unref(NPopover), {
96877
+ class: "c-select-filter",
96878
+ placement: "bottom-start",
96879
+ raw: "",
96880
+ show: showCanvasTypeDropdown.value,
96881
+ "show-arrow": false,
96882
+ trigger: "manual",
96883
+ onClickoutside: _cache[9] || (_cache[9] = ($event) => showCanvasTypeDropdown.value = false)
96810
96884
  }, {
96811
- default: withCtx(() => [
96812
- createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.canvasFilters.products")), 1)
96885
+ trigger: withCtx(() => [
96886
+ createVNode(unref(NTag), {
96887
+ class: "select-none cursor-pointer",
96888
+ style: normalizeStyle({
96889
+ "--n-color": selectedCanvasFilters.value.length ? "var(--p-primary5)" : "var(--p-primary6)",
96890
+ "--n-border": "1px solid var(--p-primary5)",
96891
+ "--n-height": "28px"
96892
+ }),
96893
+ themeOverrides: {
96894
+ borderRadius: "4px"
96895
+ },
96896
+ onClick: _cache[8] || (_cache[8] = ($event) => showCanvasTypeDropdown.value = !showCanvasTypeDropdown.value)
96897
+ }, {
96898
+ default: withCtx(() => [
96899
+ createElementVNode("div", _hoisted_15$f, [
96900
+ createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.type")), 1),
96901
+ selectedCanvasFilters.value.length ? (openBlock(), createElementBlock("span", _hoisted_16$e, ": " + toDisplayString(selectedCanvasFilters.value.length), 1)) : createCommentVNode("", true)
96902
+ ])
96903
+ ]),
96904
+ _: 1
96905
+ }, 8, ["style"])
96813
96906
  ]),
96814
- _: 1
96815
- }, 8, ["style"]),
96816
- createVNode(unref(NTag), {
96817
- class: "select-none cursor-pointer",
96818
- style: normalizeStyle({
96819
- "--n-color": selectedCanvasFilters.value.includes("block") ? "var(--p-primary5)" : "var(--p-primary6)",
96820
- "--n-border": "1px solid var(--p-primary5)",
96821
- "--n-height": "28px"
96822
- }),
96823
- themeOverrides: {
96824
- borderRadius: "4px"
96825
- },
96826
- onClick: _cache[12] || (_cache[12] = ($event) => toggleCanvasFilter("block"))
96827
- }, {
96828
96907
  default: withCtx(() => [
96829
- createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.canvasFilters.blocks")), 1)
96908
+ createElementVNode("div", _hoisted_17$c, [
96909
+ createElementVNode("div", _hoisted_18$a, [
96910
+ (openBlock(true), createElementBlock(Fragment, null, renderList(visibleCanvasTypeOptions.value, (option) => {
96911
+ return openBlock(), createElementBlock("div", {
96912
+ key: option.value,
96913
+ class: "w-full h-7 flex items-center"
96914
+ }, [
96915
+ createVNode(unref(NCheckbox), {
96916
+ checked: selectedCanvasFilters.value.includes(option.value),
96917
+ class: "px-2 truncate",
96918
+ "onUpdate:checked": (checked) => handleCanvasTypeToggle(option.value, checked)
96919
+ }, {
96920
+ default: withCtx(() => [
96921
+ createTextVNode(toDisplayString(option.label), 1)
96922
+ ]),
96923
+ _: 2
96924
+ }, 1032, ["checked", "onUpdate:checked"])
96925
+ ]);
96926
+ }), 128))
96927
+ ]),
96928
+ createElementVNode("div", {
96929
+ class: "pa-2",
96930
+ style: normalizeStyle({ borderTop: `1px solid ${unref(themeVars).primary5}` })
96931
+ }, [
96932
+ createVNode(CButton, {
96933
+ block: "",
96934
+ class: "pa-2",
96935
+ text: "",
96936
+ onClick: clearCanvasFilters
96937
+ }, {
96938
+ default: withCtx(() => [
96939
+ createTextVNode(toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.clear")), 1)
96940
+ ]),
96941
+ _: 1
96942
+ })
96943
+ ], 4)
96944
+ ])
96830
96945
  ]),
96831
96946
  _: 1
96832
- }, 8, ["style"]),
96833
- selectedCanvasFilters.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_15$f, [
96834
- _cache[18] || (_cache[18] = createElementVNode("div", { class: "h-6 w-px bg-gray-300 mx-2" }, null, -1)),
96947
+ }, 8, ["show"]),
96948
+ hasActiveFilters.value ? (openBlock(), createElementBlock("div", _hoisted_19$a, [
96949
+ _cache[15] || (_cache[15] = createElementVNode("div", { class: "h-6 w-px bg-gray-300 mx-2" }, null, -1)),
96835
96950
  createElementVNode("span", {
96836
96951
  class: "text-sm text-gray-600 hover:text-gray-800 font-normal cursor-pointer",
96837
- onClick: clearCanvasFilters
96952
+ onClick: clearAllFilters
96838
96953
  }, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.clear")), 1)
96839
96954
  ])) : createCommentVNode("", true)
96840
96955
  ], 64)) : createCommentVNode("", true)
96841
96956
  ])) : createCommentVNode("", true)
96842
96957
  ])) : createCommentVNode("", true)
96843
96958
  ]),
96844
- createElementVNode("div", _hoisted_16$e, [
96845
- showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_17$c, [
96846
- createElementVNode("div", _hoisted_18$a, [
96959
+ createElementVNode("div", _hoisted_20$9, [
96960
+ showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_21$7, [
96961
+ createElementVNode("div", _hoisted_22$5, [
96847
96962
  (openBlock(true), createElementBlock(Fragment, null, renderList(recentSearches.value, (search) => {
96848
96963
  return openBlock(), createElementBlock("div", {
96849
96964
  key: search,
@@ -96856,14 +96971,14 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96856
96971
  icon: "clock-rotate-left",
96857
96972
  size: "16"
96858
96973
  }),
96859
- createElementVNode("span", _hoisted_20$9, toDisplayString(search), 1)
96860
- ], 8, _hoisted_19$a);
96974
+ createElementVNode("span", _hoisted_24$5, toDisplayString(search), 1)
96975
+ ], 8, _hoisted_23$5);
96861
96976
  }), 128))
96862
96977
  ]),
96863
96978
  recentlyOpenedDocs.value.length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
96864
- _cache[19] || (_cache[19] = createElementVNode("hr", { class: "border-0 h-px bg-gray-200 mt-2 mb-3 w-full" }, null, -1)),
96865
- createElementVNode("div", _hoisted_21$7, [
96866
- createElementVNode("span", _hoisted_22$5, toDisplayString(unref(t)("canvasUI.components.fileViewer.recentlyOpened")), 1)
96979
+ _cache[16] || (_cache[16] = createElementVNode("hr", { class: "border-0 h-px bg-gray-200 mt-2 mb-3 w-full" }, null, -1)),
96980
+ createElementVNode("div", _hoisted_25$5, [
96981
+ createElementVNode("span", _hoisted_26$5, toDisplayString(unref(t)("canvasUI.components.fileViewer.recentlyOpened")), 1)
96867
96982
  ]),
96868
96983
  createElementVNode("div", {
96869
96984
  class: normalizeClass(_ctx.isAdmin ? "space-y-2" : "space-y-0")
@@ -96877,7 +96992,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96877
96992
  ]),
96878
96993
  onClick: ($event) => handleRecentDocClick(doc, doc.type)
96879
96994
  }, [
96880
- doc.type === "file" ? (openBlock(), createElementBlock("div", _hoisted_24$5, [
96995
+ doc.type === "file" ? (openBlock(), createElementBlock("div", _hoisted_28$5, [
96881
96996
  createVNode(_sfc_main$6K, {
96882
96997
  class: "h-14 border-rounded-1 overflow-hidden flex-0",
96883
96998
  cover: "",
@@ -96886,7 +97001,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96886
97001
  src: recentThumbnails.value[doc.id] || "",
96887
97002
  width: "72"
96888
97003
  }, null, 8, ["file-data", "src"]),
96889
- isLoadingThumbnails.value && !recentThumbnails.value[doc.id] ? (openBlock(), createElementBlock("div", _hoisted_25$5, [
97004
+ isLoadingThumbnails.value && !recentThumbnails.value[doc.id] ? (openBlock(), createElementBlock("div", _hoisted_29$5, [
96890
97005
  createVNode(CIcon, {
96891
97006
  class: "animate-spin",
96892
97007
  color: "var(--p-primary)",
@@ -96894,7 +97009,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96894
97009
  size: "20"
96895
97010
  })
96896
97011
  ])) : createCommentVNode("", true)
96897
- ])) : (openBlock(), createElementBlock("div", _hoisted_26$5, [
97012
+ ])) : (openBlock(), createElementBlock("div", _hoisted_30$4, [
96898
97013
  doc.type === "canvas" ? (openBlock(), createBlock(CIcon, {
96899
97014
  key: 0,
96900
97015
  color: "var(--p-text2)",
@@ -96907,33 +97022,33 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96907
97022
  size: "32"
96908
97023
  }))
96909
97024
  ])),
96910
- createElementVNode("div", _hoisted_27$5, [
96911
- createElementVNode("h3", _hoisted_28$5, toDisplayString(doc.name), 1),
96912
- createElementVNode("p", _hoisted_29$5, toDisplayString(doc.type === "canvas" ? formatCanvasType(doc.content_type) : doc.type === "folder" ? "Folder" : doc.file_category || "File"), 1)
97025
+ createElementVNode("div", _hoisted_31$4, [
97026
+ createElementVNode("h3", _hoisted_32$4, toDisplayString(doc.name), 1),
97027
+ createElementVNode("p", _hoisted_33$4, toDisplayString(doc.type === "canvas" ? formatCanvasType(doc.content_type) : doc.type === "folder" ? "Folder" : doc.file_category || "File"), 1)
96913
97028
  ])
96914
- ], 10, _hoisted_23$5);
97029
+ ], 10, _hoisted_27$5);
96915
97030
  }), 128))
96916
97031
  ], 2)
96917
97032
  ], 64)) : createCommentVNode("", true)
96918
- ])) : !searchType.value ? (openBlock(), createElementBlock("div", _hoisted_30$4, [
96919
- createElementVNode("div", _hoisted_31$4, [
96920
- isSearching.value ? (openBlock(), createElementBlock("div", _hoisted_32$4, [
97033
+ ])) : !searchType.value ? (openBlock(), createElementBlock("div", _hoisted_34$4, [
97034
+ createElementVNode("div", _hoisted_35$4, [
97035
+ isSearching.value ? (openBlock(), createElementBlock("div", _hoisted_36$4, [
96921
97036
  createVNode(CIcon, {
96922
97037
  class: "animate-spin text-6xl",
96923
97038
  color: "var(--p-primary)",
96924
97039
  icon: "spinner"
96925
97040
  })
96926
97041
  ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
96927
- filteredContentFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_33$4, [
96928
- createElementVNode("div", _hoisted_34$4, [
97042
+ filteredContentFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_37$4, [
97043
+ createElementVNode("div", _hoisted_38$4, [
96929
97044
  createVNode(CIcon, {
96930
97045
  class: "mr-2",
96931
97046
  color: "var(--p-text2)",
96932
97047
  icon: "folder",
96933
97048
  size: "16"
96934
97049
  }),
96935
- createElementVNode("span", _hoisted_35$4, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.sections.content")), 1),
96936
- createElementVNode("span", _hoisted_36$4, "(" + toDisplayString(filteredContentFiles.value.length) + ")", 1)
97050
+ createElementVNode("span", _hoisted_39$4, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.sections.content")), 1),
97051
+ createElementVNode("span", _hoisted_40$4, "(" + toDisplayString(filteredContentFiles.value.length) + ")", 1)
96937
97052
  ]),
96938
97053
  createElementVNode("div", null, [
96939
97054
  (openBlock(true), createElementBlock(Fragment, null, renderList(filteredContentFiles.value.slice(0, 5), (item) => {
@@ -96955,30 +97070,30 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96955
97070
  "object-fit": "cover",
96956
97071
  src: item.picture_url || "",
96957
97072
  width: "72"
96958
- }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_38$4, [
97073
+ }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_42$4, [
96959
97074
  createVNode(CIcon, {
96960
97075
  color: "var(--p-text2)",
96961
97076
  icon: "folder",
96962
97077
  size: "32"
96963
97078
  })
96964
97079
  ])),
96965
- createElementVNode("div", _hoisted_39$4, [
96966
- createElementVNode("h3", _hoisted_40$4, toDisplayString(item.name), 1),
97080
+ createElementVNode("div", _hoisted_43$4, [
97081
+ createElementVNode("h3", _hoisted_44$4, toDisplayString(item.name), 1),
96967
97082
  item.type === "file" && getSnippet(item) ? (openBlock(), createElementBlock("p", {
96968
97083
  key: 0,
96969
97084
  class: "text-xs text-gray-600 mb-1",
96970
97085
  innerHTML: getSnippet(item)
96971
- }, null, 8, _hoisted_41$4)) : createCommentVNode("", true),
96972
- createElementVNode("p", _hoisted_42$4, toDisplayString(item.type === "folder" ? "Folder" : item.file_category || item.content_type || "File"), 1)
97086
+ }, null, 8, _hoisted_45$4)) : createCommentVNode("", true),
97087
+ createElementVNode("p", _hoisted_46$4, toDisplayString(item.type === "folder" ? "Folder" : item.file_category || item.content_type || "File"), 1)
96973
97088
  ]),
96974
- createElementVNode("div", _hoisted_43$4, toDisplayString(item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
96975
- ], 10, _hoisted_37$4);
97089
+ createElementVNode("div", _hoisted_47$4, toDisplayString(item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
97090
+ ], 10, _hoisted_41$4);
96976
97091
  }), 128))
96977
97092
  ]),
96978
- filteredContentFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_44$4, [
97093
+ filteredContentFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_48$4, [
96979
97094
  createElementVNode("span", {
96980
97095
  class: "text-sm text-gray-600 hover:text-gray-800 font-bold flex items-center cursor-pointer",
96981
- onClick: _cache[13] || (_cache[13] = ($event) => searchType.value = "content")
97096
+ onClick: _cache[10] || (_cache[10] = ($event) => searchType.value = "content")
96982
97097
  }, [
96983
97098
  createTextVNode(toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.actions.viewAll")) + " ", 1),
96984
97099
  createVNode(CIcon, {
@@ -96989,16 +97104,16 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96989
97104
  ])
96990
97105
  ])) : createCommentVNode("", true)
96991
97106
  ])) : createCommentVNode("", true),
96992
- filteredCanvasFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_45$4, [
96993
- createElementVNode("div", _hoisted_46$4, [
97107
+ filteredCanvasFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_49$4, [
97108
+ createElementVNode("div", _hoisted_50$4, [
96994
97109
  createVNode(CIcon, {
96995
97110
  class: "mr-2",
96996
97111
  color: "var(--p-text2)",
96997
97112
  icon: "presentation",
96998
97113
  size: "16"
96999
97114
  }),
97000
- createElementVNode("span", _hoisted_47$4, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.sections.pitchDecks")), 1),
97001
- createElementVNode("span", _hoisted_48$4, "(" + toDisplayString(filteredCanvasFiles.value.length) + ")", 1)
97115
+ createElementVNode("span", _hoisted_51$3, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.sections.pitchDecks")), 1),
97116
+ createElementVNode("span", _hoisted_52$3, "(" + toDisplayString(filteredCanvasFiles.value.length) + ")", 1)
97002
97117
  ]),
97003
97118
  createElementVNode("div", null, [
97004
97119
  (openBlock(true), createElementBlock(Fragment, null, renderList(filteredCanvasFiles.value.slice(0, 5), (item) => {
@@ -97012,25 +97127,25 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97012
97127
  "data-result-selected": isResultSelected(item),
97013
97128
  onClick: ($event) => handleResultClick(item, "canvas")
97014
97129
  }, [
97015
- createElementVNode("div", _hoisted_50$4, [
97130
+ createElementVNode("div", _hoisted_54$2, [
97016
97131
  createVNode(CIcon, {
97017
97132
  color: "var(--p-text2)",
97018
97133
  icon: "presentation",
97019
97134
  size: "32"
97020
97135
  })
97021
97136
  ]),
97022
- createElementVNode("div", _hoisted_51$3, [
97023
- createElementVNode("h3", _hoisted_52$3, toDisplayString(item.name), 1),
97024
- createElementVNode("p", _hoisted_53$3, toDisplayString(formatCanvasType(item.content_type)), 1)
97137
+ createElementVNode("div", _hoisted_55$2, [
97138
+ createElementVNode("h3", _hoisted_56$2, toDisplayString(item.name), 1),
97139
+ createElementVNode("p", _hoisted_57$2, toDisplayString(formatCanvasType(item.content_type)), 1)
97025
97140
  ]),
97026
- createElementVNode("div", _hoisted_54$2, toDisplayString(item.folder?.name || ""), 1)
97027
- ], 10, _hoisted_49$4);
97141
+ createElementVNode("div", _hoisted_58$2, toDisplayString(item.folder?.name || ""), 1)
97142
+ ], 10, _hoisted_53$3);
97028
97143
  }), 128))
97029
97144
  ]),
97030
- filteredCanvasFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_55$2, [
97145
+ filteredCanvasFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_59$2, [
97031
97146
  createElementVNode("span", {
97032
97147
  class: "text-sm text-gray-600 hover:text-gray-800 font-bold flex items-center cursor-pointer",
97033
- onClick: _cache[14] || (_cache[14] = ($event) => searchType.value = "canvases")
97148
+ onClick: _cache[11] || (_cache[11] = ($event) => searchType.value = "canvases")
97034
97149
  }, [
97035
97150
  createTextVNode(toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.actions.viewAll")) + " ", 1),
97036
97151
  createVNode(CIcon, {
@@ -97041,7 +97156,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97041
97156
  ])
97042
97157
  ])) : createCommentVNode("", true)
97043
97158
  ])) : createCommentVNode("", true),
97044
- searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_56$2, [
97159
+ searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_60$2, [
97045
97160
  createVNode(CIcon, {
97046
97161
  class: "text-6xl",
97047
97162
  color: searchError.value ? "var(--p-error)" : "var(--p-text3)",
@@ -97054,16 +97169,16 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97054
97169
  ])) : createCommentVNode("", true)
97055
97170
  ], 64))
97056
97171
  ])
97057
- ])) : (openBlock(), createElementBlock("div", _hoisted_57$2, [
97058
- createElementVNode("div", _hoisted_58$2, [
97059
- isSearching.value ? (openBlock(), createElementBlock("div", _hoisted_59$2, [
97172
+ ])) : (openBlock(), createElementBlock("div", _hoisted_61$2, [
97173
+ createElementVNode("div", _hoisted_62$2, [
97174
+ isSearching.value ? (openBlock(), createElementBlock("div", _hoisted_63$2, [
97060
97175
  createVNode(CIcon, {
97061
97176
  class: "animate-spin text-6xl",
97062
97177
  color: "var(--p-primary)",
97063
97178
  icon: "spinner"
97064
97179
  })
97065
97180
  ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
97066
- createElementVNode("div", _hoisted_60$2, [
97181
+ createElementVNode("div", _hoisted_64$2, [
97067
97182
  searchType.value === "content" ? (openBlock(), createBlock(CIcon, {
97068
97183
  key: 0,
97069
97184
  class: "mr-2",
@@ -97077,8 +97192,8 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97077
97192
  icon: "presentation",
97078
97193
  size: "16"
97079
97194
  })),
97080
- createElementVNode("span", _hoisted_61$2, toDisplayString(searchType.value === "content" ? unref(t)("canvasUI.CAlgoliaSearch.sections.content") : unref(t)("canvasUI.CAlgoliaSearch.sections.pitchDecks")), 1),
97081
- createElementVNode("span", _hoisted_62$2, " (" + toDisplayString(searchType.value === "content" ? filteredContentFiles.value.length : filteredCanvasFiles.value.length) + ") ", 1)
97195
+ createElementVNode("span", _hoisted_65$2, toDisplayString(searchType.value === "content" ? unref(t)("canvasUI.CAlgoliaSearch.sections.content") : unref(t)("canvasUI.CAlgoliaSearch.sections.pitchDecks")), 1),
97196
+ createElementVNode("span", _hoisted_66$2, " (" + toDisplayString(searchType.value === "content" ? filteredContentFiles.value.length : filteredCanvasFiles.value.length) + ") ", 1)
97082
97197
  ]),
97083
97198
  createElementVNode("div", null, [
97084
97199
  (openBlock(true), createElementBlock(Fragment, null, renderList(searchType.value === "content" ? filteredContentFiles.value : filteredCanvasFiles.value, (item) => {
@@ -97103,7 +97218,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97103
97218
  "object-fit": "cover",
97104
97219
  src: item.picture_url || "",
97105
97220
  width: "72"
97106
- }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_64$2, [
97221
+ }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_68$2, [
97107
97222
  searchType.value === "content" ? (openBlock(), createBlock(CIcon, {
97108
97223
  key: 0,
97109
97224
  color: "var(--p-text2)",
@@ -97116,20 +97231,20 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97116
97231
  size: "32"
97117
97232
  }))
97118
97233
  ])),
97119
- createElementVNode("div", _hoisted_65$2, [
97120
- createElementVNode("h3", _hoisted_66$2, toDisplayString(item.name), 1),
97234
+ createElementVNode("div", _hoisted_69$1, [
97235
+ createElementVNode("h3", _hoisted_70$1, toDisplayString(item.name), 1),
97121
97236
  searchType.value === "content" && item.type === "file" && getSnippet(item) ? (openBlock(), createElementBlock("p", {
97122
97237
  key: 0,
97123
97238
  class: "text-xs text-gray-600 mb-1",
97124
97239
  innerHTML: getSnippet(item)
97125
- }, null, 8, _hoisted_67$2)) : createCommentVNode("", true),
97126
- createElementVNode("p", _hoisted_68$2, toDisplayString(searchType.value === "content" ? item.type === "folder" ? "Folder" : item.file_category || item.content_type || "File" : formatCanvasType(item.content_type)), 1)
97240
+ }, null, 8, _hoisted_71$1)) : createCommentVNode("", true),
97241
+ createElementVNode("p", _hoisted_72$1, toDisplayString(searchType.value === "content" ? item.type === "folder" ? "Folder" : item.file_category || item.content_type || "File" : formatCanvasType(item.content_type)), 1)
97127
97242
  ]),
97128
- createElementVNode("div", _hoisted_69$1, toDisplayString(searchType.value === "content" && item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
97129
- ], 10, _hoisted_63$2);
97243
+ createElementVNode("div", _hoisted_73$1, toDisplayString(searchType.value === "content" && item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
97244
+ ], 10, _hoisted_67$2);
97130
97245
  }), 128))
97131
97246
  ]),
97132
- searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_70$1, [
97247
+ searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_74$1, [
97133
97248
  createVNode(CIcon, {
97134
97249
  class: "text-6xl",
97135
97250
  color: searchError.value ? "var(--p-error)" : "var(--p-text3)",
@@ -97144,7 +97259,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97144
97259
  ])
97145
97260
  ]))
97146
97261
  ]),
97147
- !showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_71$1, [
97262
+ !showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_75$1, [
97148
97263
  createVNode(CShortcut, null, {
97149
97264
  default: withCtx(() => [
97150
97265
  createVNode(CShortcutIcon, { icon: "arrow-up" }),
@@ -97186,7 +97301,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97186
97301
  }
97187
97302
  });
97188
97303
 
97189
- const CAlgoliaSearch = /* @__PURE__ */ _export_sfc(_sfc_main$5K, [["__scopeId", "data-v-da2357d4"]]);
97304
+ const CAlgoliaSearch = /* @__PURE__ */ _export_sfc(_sfc_main$5K, [["__scopeId", "data-v-840d4fd4"]]);
97190
97305
 
97191
97306
  const BulletListExtended = BulletList.extend({
97192
97307
  addOptions() {
@@ -109616,9 +109731,11 @@ const _sfc_main$4U = /* @__PURE__ */ defineComponent({
109616
109731
  function filterByItemVisibility(items) {
109617
109732
  const isAdmin = state$3.appName.value === "admin";
109618
109733
  return items.reduce((acc, item) => {
109734
+ const hasCountData = "files_count" in item || "folders_count" in item || "available_files_count" in item || "available_folders_count" in item;
109619
109735
  const filesCount = item.available_files_count ?? item.files_count ?? 0;
109620
109736
  const foldersCount = item.available_folders_count ?? item.folders_count ?? 0;
109621
- const shouldHideItem = item.name?.startsWith(".") || item.type == "folder" && filesCount === 0 && foldersCount === 0 || item.folder?.file_thumbnail_urls?.length === 0;
109737
+ const isFolderEmpty = item.type == "folder" && hasCountData && filesCount === 0 && foldersCount === 0;
109738
+ const shouldHideItem = item.name?.startsWith(".") || isFolderEmpty || item.folder?.file_thumbnail_urls?.length === 0;
109622
109739
  if (!shouldHideItem && !isAdmin || isAdmin) {
109623
109740
  acc.push({
109624
109741
  ...item,
@@ -109995,7 +110112,8 @@ const getInitialState$1 = () => ({
109995
110112
  // instance metadata template fields dictionary
109996
110113
  searchQuery: "",
109997
110114
  searchMetadataFilters: {},
109998
- filteredItems: []
110115
+ filteredItems: [],
110116
+ folderCache: {}
109999
110117
  });
110000
110118
  const state$2 = reactive(getInitialState$1());
110001
110119
  const fileOrderedStatuses = [FileStatusEnum.PENDING, FileStatusEnum.VIEWABLE];
@@ -110080,6 +110198,15 @@ function updateFolderState(folder) {
110080
110198
  state$2.folders = folder.folders;
110081
110199
  state$2.files = folder.files;
110082
110200
  state$2.currentFolderPath = folder.path;
110201
+ folder.folders.forEach((subfolder) => {
110202
+ state$2.folderCache[subfolder.id] = {
110203
+ files_count: subfolder.files_count,
110204
+ folders_count: subfolder.folders_count,
110205
+ available_files_count: subfolder.available_files_count,
110206
+ available_folders_count: subfolder.available_folders_count,
110207
+ timestamp: Date.now()
110208
+ };
110209
+ });
110083
110210
  if (useAppStore$4().showFilteredResults.value) {
110084
110211
  const filesById = new Map(state$2.files.map((file) => [file.id, file]));
110085
110212
  state$2.filteredItems = state$2.filteredItems.map((filteredItem) => {
@@ -110344,7 +110471,24 @@ function init({
110344
110471
  }
110345
110472
  let filteredFolders = [];
110346
110473
  if (!hasMetadataFilters && foldersResponse.status === "fulfilled" && foldersResponse.value) {
110347
- filteredFolders = foldersResponse.value.results?.map((f) => ({ ...f, type: "folder" })) ?? [];
110474
+ const foldersFromSearch = foldersResponse.value.results ?? [];
110475
+ filteredFolders = foldersFromSearch.map((folder) => {
110476
+ const cached = state$2.folderCache[folder.id];
110477
+ if (cached) {
110478
+ const result = {
110479
+ ...folder,
110480
+ type: "folder"
110481
+ };
110482
+ if (cached.files_count !== void 0) result.files_count = cached.files_count;
110483
+ if (cached.folders_count !== void 0) result.folders_count = cached.folders_count;
110484
+ if (cached.available_files_count !== void 0) result.available_files_count = cached.available_files_count;
110485
+ if (cached.available_folders_count !== void 0) {
110486
+ result.available_folders_count = cached.available_folders_count;
110487
+ }
110488
+ return result;
110489
+ }
110490
+ return { ...folder, type: "folder" };
110491
+ });
110348
110492
  } else if (!hasMetadataFilters && !useAppStore$4().isLocalSearch.value) {
110349
110493
  console.error(
110350
110494
  "Failed to fetch folders:",
@@ -137726,37 +137870,19 @@ function useComponentPermissions({
137726
137870
  isAnyTypeOfAdmin: false
137727
137871
  }))
137728
137872
  );
137729
- const launchDarkly = inject(
137730
- "launchDarkly",
137731
- computed(() => ({}))
137732
- );
137733
- const { canvasContent, activeCanvas } = useCanvas$1();
137873
+ const { canvasContent } = useCanvas$1();
137734
137874
  return computed(() => {
137735
- if (usedInSectionId.value) {
137736
- const parent = findParentByNodeId(canvasContent.value, id.value);
137737
- const canRemove = !!when_used_in_section.value?.is_removable;
137738
- const canEdit = !!when_used_in_section.value?.is_editable;
137739
- const canDuplicate = parent ? !!parent.when_used_in_section?.is_editable : false;
137740
- return {
137741
- hasSomethingEditable: canEdit || canRemove || canDuplicate,
137742
- canRemove,
137743
- canEdit,
137744
- canDuplicate
137745
- };
137746
- }
137747
- const hasExplicitPermissions = when_used_in_section.value !== null && when_used_in_section.value !== void 0 && (when_used_in_section.value.is_editable !== void 0 || when_used_in_section.value.is_removable !== void 0);
137748
- if (activeCanvas.value?.template?.id && launchDarkly.value.enable_template_component_permissions && hasExplicitPermissions) {
137749
- const canRemove = !!when_used_in_section.value?.is_removable;
137750
- const canEdit = !!when_used_in_section.value?.is_editable;
137751
- const canDuplicate = canEdit;
137752
- return {
137753
- hasSomethingEditable: canEdit || canRemove || canDuplicate,
137754
- canRemove,
137755
- canEdit,
137756
- canDuplicate
137757
- };
137758
- }
137759
- return calculateCanvasPermissions(id.value, !!pitcherInfo.value?.isAnyTypeOfAdmin);
137875
+ if (!usedInSectionId.value) return calculateCanvasPermissions(id.value, !!pitcherInfo.value?.isAnyTypeOfAdmin);
137876
+ const parent = findParentByNodeId(canvasContent.value, id.value);
137877
+ const canRemove = !!when_used_in_section.value?.is_removable;
137878
+ const canEdit = !!when_used_in_section.value?.is_editable;
137879
+ const canDuplicate = parent ? !!parent.when_used_in_section?.is_editable : false;
137880
+ return {
137881
+ hasSomethingEditable: canEdit || canRemove || canDuplicate,
137882
+ canRemove,
137883
+ canEdit,
137884
+ canDuplicate
137885
+ };
137760
137886
  });
137761
137887
  }
137762
137888
 
@@ -156733,9 +156859,7 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156733
156859
  visible: {},
156734
156860
  allow_admins_to_overwrite: { type: Boolean },
156735
156861
  style: {},
156736
- printModeIdx: {},
156737
- when_used_in_section: { default: () => defaultWhenUsedInSection },
156738
- usedInSectionId: { default: "" }
156862
+ printModeIdx: {}
156739
156863
  },
156740
156864
  emits: ["style"],
156741
156865
  setup(__props, { emit: __emit }) {
@@ -156750,42 +156874,12 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156750
156874
  computed(() => [])
156751
156875
  );
156752
156876
  const { isCompletionWizardEnabled, retriggerWizard } = useCanvasCompletionWizard();
156753
- const {
156754
- isImpact,
156755
- mode,
156756
- isEditMode,
156757
- componentSelectedMode,
156758
- isViewOnlyMode,
156759
- componentEditMode,
156760
- componentNodesById,
156761
- activeCanvas,
156762
- saveCanvasContentWithContext,
156763
- removeComponentById,
156764
- setComponentSelectedMode,
156765
- setComponentSettingsMode,
156766
- updateNodeDataById,
156767
- canvasContent
156768
- } = useCanvas$1();
156769
- const { id, usedInSectionId, when_used_in_section } = toRefs(props);
156770
- const componentPermissions = useComponentPermissions({
156771
- id,
156772
- usedInSectionId,
156773
- when_used_in_section
156774
- });
156775
- const isEditable = computed(() => {
156776
- if (!componentPermissions.value.canEdit) return false;
156777
- if (isImpact.value) {
156778
- return !props.data.selection_strategy || props.data.selection_strategy === "free" || isCompletionWizardEnabled.value && wizardStepSectionListIds.value.includes(props.id);
156779
- }
156780
- return true;
156781
- });
156782
- const isRemovable = computed(() => {
156783
- if (!componentPermissions.value.canRemove) return false;
156784
- if (isImpact.value) {
156785
- return !props.data.selection_strategy || props.data.selection_strategy === "free";
156786
- }
156787
- return true;
156788
- });
156877
+ const isEditable = computed(
156878
+ () => isImpact.value ? !props.data.selection_strategy || props.data.selection_strategy === "free" || isCompletionWizardEnabled.value && wizardStepSectionListIds.value.includes(props.id) : true
156879
+ );
156880
+ const isRemovable = computed(
156881
+ () => isImpact.value ? !props.data.selection_strategy || props.data.selection_strategy === "free" : true
156882
+ );
156789
156883
  const sectionSelectorAppSrc = computed(() => {
156790
156884
  if (!sectionSelectorApps.value?.length || !props.data.selection_app_name) return null;
156791
156885
  const relatedApp = sectionSelectorApps.value.find((app) => app.app_metadata?.name === props.data.selection_app_name);
@@ -156852,7 +156946,7 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156852
156946
  async (selectedData) => {
156853
156947
  console.info(`[SectionList]: Received done callback for ${props.id} with data`, selectedData);
156854
156948
  if (!selectedData) return;
156855
- const sections = (selectedData?.section_ids || []).map((id2) => ({ id: typeof id2 === "string" ? id2 : id2.id }));
156949
+ const sections = (selectedData?.section_ids || []).map((id) => ({ id: typeof id === "string" ? id : id.id }));
156856
156950
  const updatedData = { ...props.data, sections };
156857
156951
  updateNodeDataById(props.id, updatedData);
156858
156952
  const currentContext = cloneDeep(activeCanvas.value?.context || {});
@@ -156878,6 +156972,22 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156878
156972
  sectionListRef.value?.toggleSectionSelector();
156879
156973
  }
156880
156974
  }
156975
+ const {
156976
+ isImpact,
156977
+ mode,
156978
+ isEditMode,
156979
+ componentSelectedMode,
156980
+ isViewOnlyMode,
156981
+ componentEditMode,
156982
+ componentNodesById,
156983
+ activeCanvas,
156984
+ saveCanvasContentWithContext,
156985
+ removeComponentById,
156986
+ setComponentSelectedMode,
156987
+ setComponentSettingsMode,
156988
+ updateNodeDataById,
156989
+ canvasContent
156990
+ } = useCanvas$1();
156881
156991
  return (_ctx, _cache) => {
156882
156992
  return openBlock(), createElementBlock(Fragment, null, [
156883
156993
  unref(shouldDisplayPlaceholderComponent)(unref(isEditMode), unref(mode), _ctx.visible) ? (openBlock(), createBlock(PlaceholderComponent, {
@@ -156885,25 +156995,25 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156885
156995
  name: _ctx.tracking_id
156886
156996
  }, null, 8, ["name"])) : unref(isEditMode) && !unref(isViewOnlyMode) ? (openBlock(), createBlock(_sfc_main$34, {
156887
156997
  key: 1,
156888
- id: unref(id),
156889
- active: unref(componentEditMode) && unref(componentEditMode)?.id === unref(id),
156998
+ id: _ctx.id,
156999
+ active: unref(componentEditMode) && unref(componentEditMode)?.id === _ctx.id,
156890
157000
  class: normalizeClass({ "mt-12": sectionListName.value }),
156891
157001
  edit: isEditable.value,
156892
157002
  "exclude-stylables": [unref(ThemeComponentOptionEnum).COLOR_PICKER],
156893
157003
  remove: isRemovable.value,
156894
- selected: unref(componentSelectedMode) && unref(componentSelectedMode)?.id === unref(id),
157004
+ selected: unref(componentSelectedMode) && unref(componentSelectedMode)?.id === _ctx.id,
156895
157005
  settings: "",
156896
157006
  stylable: "",
156897
157007
  style: normalizeStyle(unref(omit$1)(_ctx.style, "paddingBottom", "paddingLeft", "paddingTop", "paddingRight")),
156898
157008
  onEdit: handleEdit,
156899
- onRemove: _cache[0] || (_cache[0] = ($event) => unref(removeComponentById)(unref(id))),
156900
- onSelect: _cache[1] || (_cache[1] = ($event) => unref(setComponentSelectedMode)(unref(id))),
156901
- onSettings: _cache[2] || (_cache[2] = ($event) => unref(setComponentSettingsMode)(unref(id))),
157009
+ onRemove: _cache[0] || (_cache[0] = ($event) => unref(removeComponentById)(_ctx.id)),
157010
+ onSelect: _cache[1] || (_cache[1] = ($event) => unref(setComponentSelectedMode)(_ctx.id)),
157011
+ onSettings: _cache[2] || (_cache[2] = ($event) => unref(setComponentSettingsMode)(_ctx.id)),
156902
157012
  onStyle: _cache[3] || (_cache[3] = ($event) => emit("style", $event))
156903
157013
  }, {
156904
157014
  default: withCtx(() => [
156905
157015
  createVNode(RawSectionList, mergeProps({
156906
- id: unref(id),
157016
+ id: _ctx.id,
156907
157017
  ref_key: "sectionListRef",
156908
157018
  ref: sectionListRef,
156909
157019
  class: "pa-2",
@@ -156921,7 +157031,7 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156921
157031
  _: 1
156922
157032
  }, 8, ["id", "active", "class", "edit", "exclude-stylables", "remove", "selected", "style"])) : (openBlock(), createBlock(RawSectionList, mergeProps({
156923
157033
  key: 2,
156924
- id: unref(id),
157034
+ id: _ctx.id,
156925
157035
  data: _ctx.data
156926
157036
  }, unref(attrs), {
156927
157037
  "has-section-selector-app": !!sectionSelectorAppSrc.value,
@@ -159449,8 +159559,7 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159449
159559
  autofill: {},
159450
159560
  linkable: {},
159451
159561
  autofill_content_types: {},
159452
- when_used_in_section: { default: () => defaultWhenUsedInSection },
159453
- usedInSectionId: { default: "" }
159562
+ when_used_in_section: {}
159454
159563
  },
159455
159564
  emits: ["style"],
159456
159565
  setup(__props, { emit: __emit }) {
@@ -159461,42 +159570,12 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159461
159570
  computed(() => [])
159462
159571
  );
159463
159572
  const { isCompletionWizardEnabled, retriggerWizard } = useCanvasCompletionWizard();
159464
- const {
159465
- isImpact,
159466
- mode,
159467
- isEditMode,
159468
- componentSelectedMode,
159469
- isViewOnlyMode,
159470
- componentEditMode,
159471
- componentNodesById,
159472
- activeCanvas,
159473
- saveCanvasContentWithContext,
159474
- removeComponentById,
159475
- setComponentSelectedMode,
159476
- setComponentSettingsMode,
159477
- updateNodeDataById,
159478
- canvasContent
159479
- } = useCanvas$1();
159480
- const { id, usedInSectionId, when_used_in_section } = toRefs(props);
159481
- const componentPermissions = useComponentPermissions({
159482
- id,
159483
- usedInSectionId,
159484
- when_used_in_section
159485
- });
159486
- const isEditable = computed(() => {
159487
- if (!componentPermissions.value.canEdit) return false;
159488
- if (isImpact.value) {
159489
- return !props.data.selection_strategy || props.data.selection_strategy === "free" || isCompletionWizardEnabled.value && wizardStepSectionListIds.value.includes(props.id);
159490
- }
159491
- return true;
159492
- });
159493
- const isRemovable = computed(() => {
159494
- if (!componentPermissions.value.canRemove) return false;
159495
- if (isImpact.value) {
159496
- return !props.data.selection_strategy || props.data.selection_strategy === "free";
159497
- }
159498
- return true;
159499
- });
159573
+ const isEditable = computed(
159574
+ () => isImpact.value ? !props.data.selection_strategy || props.data.selection_strategy === "free" || isCompletionWizardEnabled.value && wizardStepSectionListIds.value.includes(props.id) : true
159575
+ );
159576
+ const isRemovable = computed(
159577
+ () => isImpact.value ? !props.data.selection_strategy || props.data.selection_strategy === "free" : true
159578
+ );
159500
159579
  const sectionSelectorAppSrc = computed(() => {
159501
159580
  if (!sectionSelectorApps.value?.length || !props.data.selection_app_name) return null;
159502
159581
  const relatedApp = sectionSelectorApps.value.find((app) => app.app_metadata?.name === props.data.selection_app_name);
@@ -159562,7 +159641,7 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159562
159641
  async (selectedData) => {
159563
159642
  console.info(`[SectionList]: Received done callback for ${props.id} with data`, selectedData);
159564
159643
  if (!selectedData) return;
159565
- const sections = (selectedData?.section_ids || []).map((id2) => ({ id: typeof id2 === "string" ? id2 : id2.id }));
159644
+ const sections = (selectedData?.section_ids || []).map((id) => ({ id: typeof id === "string" ? id : id.id }));
159566
159645
  const updatedData = { ...props.data, sections };
159567
159646
  updateNodeDataById(props.id, updatedData);
159568
159647
  const currentContext = cloneDeep(activeCanvas.value?.context || {});
@@ -159588,6 +159667,22 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159588
159667
  contentListRef.value?.toggleSectionSelector();
159589
159668
  }
159590
159669
  }
159670
+ const {
159671
+ isImpact,
159672
+ mode,
159673
+ isEditMode,
159674
+ componentSelectedMode,
159675
+ isViewOnlyMode,
159676
+ componentEditMode,
159677
+ componentNodesById,
159678
+ activeCanvas,
159679
+ saveCanvasContentWithContext,
159680
+ removeComponentById,
159681
+ setComponentSelectedMode,
159682
+ setComponentSettingsMode,
159683
+ updateNodeDataById,
159684
+ canvasContent
159685
+ } = useCanvas$1();
159591
159686
  return (_ctx, _cache) => {
159592
159687
  return openBlock(), createElementBlock(Fragment, null, [
159593
159688
  unref(shouldDisplayPlaceholderComponent)(unref(isEditMode), unref(mode), _ctx.visible) ? (openBlock(), createBlock(PlaceholderComponent, {
@@ -159595,25 +159690,25 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159595
159690
  name: _ctx.tracking_id
159596
159691
  }, null, 8, ["name"])) : unref(isEditMode) && !unref(isViewOnlyMode) ? (openBlock(), createBlock(_sfc_main$34, {
159597
159692
  key: 1,
159598
- id: unref(id),
159599
- active: unref(componentEditMode) && unref(componentEditMode)?.id === unref(id),
159693
+ id: _ctx.id,
159694
+ active: unref(componentEditMode) && unref(componentEditMode)?.id === _ctx.id,
159600
159695
  class: normalizeClass({ "mt-12": componentName.value }),
159601
159696
  edit: isEditable.value,
159602
159697
  "exclude-stylables": [unref(ThemeComponentOptionEnum).COLOR_PICKER],
159603
159698
  remove: isRemovable.value,
159604
- selected: unref(componentSelectedMode) && unref(componentSelectedMode)?.id === unref(id),
159699
+ selected: unref(componentSelectedMode) && unref(componentSelectedMode)?.id === _ctx.id,
159605
159700
  settings: "",
159606
159701
  stylable: "",
159607
159702
  style: normalizeStyle(unref(omit$1)(_ctx.style, "paddingBottom", "paddingLeft", "paddingTop", "paddingRight")),
159608
159703
  onEdit: handleEdit,
159609
- onRemove: _cache[0] || (_cache[0] = ($event) => unref(removeComponentById)(unref(id))),
159610
- onSelect: _cache[1] || (_cache[1] = ($event) => unref(setComponentSelectedMode)(unref(id))),
159611
- onSettings: _cache[2] || (_cache[2] = ($event) => unref(setComponentSettingsMode)(unref(id))),
159704
+ onRemove: _cache[0] || (_cache[0] = ($event) => unref(removeComponentById)(_ctx.id)),
159705
+ onSelect: _cache[1] || (_cache[1] = ($event) => unref(setComponentSelectedMode)(_ctx.id)),
159706
+ onSettings: _cache[2] || (_cache[2] = ($event) => unref(setComponentSettingsMode)(_ctx.id)),
159612
159707
  onStyle: _cache[3] || (_cache[3] = ($event) => emit("style", $event))
159613
159708
  }, {
159614
159709
  default: withCtx(() => [
159615
159710
  createVNode(ContentListRaw, mergeProps({
159616
- id: unref(id),
159711
+ id: _ctx.id,
159617
159712
  ref_key: "contentListRef",
159618
159713
  ref: contentListRef,
159619
159714
  class: ["pa-2", props.class],
@@ -159631,7 +159726,7 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159631
159726
  _: 1
159632
159727
  }, 8, ["id", "active", "class", "edit", "exclude-stylables", "remove", "selected", "style"])) : (openBlock(), createBlock(ContentListRaw, mergeProps({
159633
159728
  key: 2,
159634
- id: unref(id),
159729
+ id: _ctx.id,
159635
159730
  data: _ctx.data
159636
159731
  }, unref(attrs), {
159637
159732
  "has-section-selector-app": !!sectionSelectorAppSrc.value,
@@ -162517,9 +162612,7 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
162517
162612
  isCanvasTemplate,
162518
162613
  isCanvas,
162519
162614
  isTemplate,
162520
- isSection,
162521
- parentIdByNodeId,
162522
- componentNodesById
162615
+ isSection
162523
162616
  } = useCanvas$1();
162524
162617
  const { getComponentDefaultVisibility } = useCanvasVisibility();
162525
162618
  const { crmShape } = useCrmShape();
@@ -162545,7 +162638,7 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
162545
162638
  );
162546
162639
  const areSectionsSystemControlled = computed(() => launchDarkly.value?.are_sections_system_controlled);
162547
162640
  const allowEditOrRemove = computed(
162548
- () => isAdmin.value && ((selectedComponentType.value === ComponentTypes.Text || selectedComponentType.value === ComponentTypes.Carousel || selectedComponentType.value === ComponentTypes.Multimedia) && isSection.value || launchDarkly.value.enable_template_component_permissions && isCanvasTemplate.value)
162641
+ () => (selectedComponentType.value === ComponentTypes.Text || selectedComponentType.value === ComponentTypes.Carousel || selectedComponentType.value === ComponentTypes.Multimedia) && isAdmin.value && isSection.value
162549
162642
  );
162550
162643
  const canSelectSectionListStrategy = computed(
162551
162644
  () => isAdmin.value && isCanvasTemplate.value && isSectionOrContentList.value
@@ -162606,27 +162699,7 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
162606
162699
  selectedContentGridDataPath.value = value || "";
162607
162700
  formValues.contentGridDataAccessor = value || "";
162608
162701
  }
162609
- function isComponentInsideSectionList() {
162610
- if (!activeSettingsNode.value?.id) return false;
162611
- let currentParentId = parentIdByNodeId.value[activeSettingsNode.value.id];
162612
- while (currentParentId) {
162613
- const parentNode = componentNodesById.value[currentParentId];
162614
- if (parentNode?.type === ComponentTypes.SectionList || parentNode?.type === ComponentTypes.ContentList) {
162615
- return true;
162616
- }
162617
- currentParentId = parentIdByNodeId.value[currentParentId];
162618
- }
162619
- return false;
162620
- }
162621
162702
  function getEditOrRemoveOption() {
162622
- if (!activeSettingsNode.value?.when_used_in_section) {
162623
- if (launchDarkly.value.enable_template_component_permissions && isCanvasTemplate.value && !isSection.value) {
162624
- if (isComponentInsideSectionList()) {
162625
- return "00";
162626
- }
162627
- return "11";
162628
- }
162629
- }
162630
162703
  const map = activeSettingsNode.value?.when_used_in_section ?? cloneDeep(defaultWhenUsedInSection);
162631
162704
  let value = "";
162632
162705
  value += map.is_editable ? "1" : "0";
@@ -163128,7 +163201,7 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
163128
163201
  }
163129
163202
  });
163130
163203
 
163131
- const ComponentDrawerSettings = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__scopeId", "data-v-7724d85a"]]);
163204
+ const ComponentDrawerSettings = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__scopeId", "data-v-dce6a881"]]);
163132
163205
 
163133
163206
  function useConnectUpload() {
163134
163207
  async function uploadToConnect(formData) {
@@ -176361,10 +176434,10 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
176361
176434
  __name: "ActionsToolbar",
176362
176435
  setup(__props) {
176363
176436
  useCssVars((_ctx) => ({
176364
- "c6ccac5c": unref(themeVars).primary4,
176365
- "3edbaaa2": unref(themeVars).primary,
176366
- "c6ccac58": unref(themeVars).primary6,
176367
- "0f45ae31": unref(themeVars).base
176437
+ "6b5e9219": unref(themeVars).primary4,
176438
+ "3d451d7b": unref(themeVars).primary,
176439
+ "6b5e921b": unref(themeVars).primary6,
176440
+ "42dfd1f8": unref(themeVars).base
176368
176441
  }));
176369
176442
  const {
176370
176443
  toggleContentPanel,
@@ -176592,7 +176665,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
176592
176665
  return (nameMatch || createdByMatch || tagMatch) && metadataMatch;
176593
176666
  });
176594
176667
  const folderResults = folders.map((folder) => {
176595
- return {
176668
+ const result = {
176596
176669
  id: folder.id,
176597
176670
  name: folder.name,
176598
176671
  folder_id: apiState.currentFolderId,
@@ -176604,6 +176677,11 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
176604
176677
  file_thumbnail_urls: folder.file_thumbnail_urls,
176605
176678
  thumbnail_url: folder.thumbnail_url
176606
176679
  };
176680
+ if (folder.files_count !== void 0) result.files_count = folder.files_count;
176681
+ if (folder.folders_count !== void 0) result.folders_count = folder.folders_count;
176682
+ if (folder.available_files_count !== void 0) result.available_files_count = folder.available_files_count;
176683
+ if (folder.available_folders_count !== void 0) result.available_folders_count = folder.available_folders_count;
176684
+ return result;
176607
176685
  });
176608
176686
  const fileResults = files.map((file) => {
176609
176687
  return {
@@ -176832,7 +176910,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
176832
176910
  }
176833
176911
  });
176834
176912
 
176835
- const ActionsToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-fecebf5a"]]);
176913
+ const ActionsToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-41ca4793"]]);
176836
176914
 
176837
176915
  const _sfc_main$t = /* @__PURE__ */ defineComponent({
176838
176916
  __name: "FavoritesTable",