@pitcher/canvas-ui 2026.1.14-143747-beta → 2026.1.15-103854-beta

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
@@ -84630,6 +84630,10 @@ const defaultWhenUsedInSection = {
84630
84630
  is_editable: false,
84631
84631
  is_removable: false
84632
84632
  };
84633
+ const defaultWhenUsedInTemplate = {
84634
+ is_editable: true,
84635
+ is_removable: true
84636
+ };
84633
84637
  const SERVER_ONLY_PROPS = [
84634
84638
  "content_url",
84635
84639
  "thumbnail_url",
@@ -95692,111 +95696,115 @@ const _hoisted_14$h = {
95692
95696
  key: 0,
95693
95697
  class: "flex items-center ml-2"
95694
95698
  };
95695
- const _hoisted_15$f = {
95696
- key: 2,
95699
+ const _hoisted_15$f = { class: "flex items-center" };
95700
+ const _hoisted_16$e = { key: 0 };
95701
+ const _hoisted_17$c = { class: "c-select-filter__popover w-[350px] rounded flex flex-col bg-base" };
95702
+ const _hoisted_18$a = { class: "pa-2 max-h-[300px] overflow-y-auto" };
95703
+ const _hoisted_19$a = {
95704
+ key: 0,
95697
95705
  class: "flex items-center ml-2"
95698
95706
  };
95699
- const _hoisted_16$e = { class: "flex flex-col w-full flex-1 min-h-0" };
95700
- const _hoisted_17$c = {
95707
+ const _hoisted_20$9 = { class: "flex flex-col w-full flex-1 min-h-0" };
95708
+ const _hoisted_21$7 = {
95701
95709
  key: 0,
95702
95710
  class: "flex-1 overflow-y-auto bg-white w-full pl-1 pr-6 py-0"
95703
95711
  };
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" };
95712
+ const _hoisted_22$5 = { class: "space-y-1 mt-4" };
95709
95713
  const _hoisted_23$5 = ["onClick"];
95710
- const _hoisted_24$5 = {
95714
+ const _hoisted_24$5 = { class: "text-sm text-gray-700" };
95715
+ const _hoisted_25$5 = { class: "flex items-center mb-0" };
95716
+ const _hoisted_26$5 = { class: "text-sm font-bold text-gray-700" };
95717
+ const _hoisted_27$5 = ["onClick"];
95718
+ const _hoisted_28$5 = {
95711
95719
  key: 0,
95712
95720
  class: "relative mr-4"
95713
95721
  };
95714
- const _hoisted_25$5 = {
95722
+ const _hoisted_29$5 = {
95715
95723
  key: 0,
95716
95724
  class: "absolute inset-0 flex items-center justify-center bg-gray-200 bg-opacity-75 border-rounded-1"
95717
95725
  };
95718
- const _hoisted_26$5 = {
95726
+ const _hoisted_30$4 = {
95719
95727
  key: 1,
95720
95728
  class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center"
95721
95729
  };
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 = {
95730
+ const _hoisted_31$4 = { class: "flex-1 min-w-0" };
95731
+ const _hoisted_32$4 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95732
+ const _hoisted_33$4 = { class: "text-xs text-gray-500" };
95733
+ const _hoisted_34$4 = {
95726
95734
  key: 1,
95727
95735
  class: "flex-1 overflow-y-auto bg-white w-full"
95728
95736
  };
95729
- const _hoisted_31$4 = { class: "w-full px-0" };
95730
- const _hoisted_32$4 = {
95737
+ const _hoisted_35$4 = { class: "w-full px-0" };
95738
+ const _hoisted_36$4 = {
95731
95739
  key: 0,
95732
95740
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95733
95741
  };
95734
- const _hoisted_33$4 = {
95742
+ const _hoisted_37$4 = {
95735
95743
  key: 0,
95736
95744
  class: "mb-0"
95737
95745
  };
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 = {
95746
+ const _hoisted_38$4 = { class: "flex items-center px-0 pt-2 pb-1" };
95747
+ const _hoisted_39$4 = { class: "text-m font-semibold text-gray-900" };
95748
+ const _hoisted_40$4 = { class: "ml-2 text-sm text-gray-500" };
95749
+ const _hoisted_41$4 = ["data-result-selected", "onClick"];
95750
+ const _hoisted_42$4 = {
95743
95751
  key: 1,
95744
95752
  class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center"
95745
95753
  };
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 = {
95754
+ const _hoisted_43$4 = { class: "flex-1 min-w-0" };
95755
+ const _hoisted_44$4 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95756
+ const _hoisted_45$4 = ["innerHTML"];
95757
+ const _hoisted_46$4 = { class: "text-xs text-gray-500" };
95758
+ const _hoisted_47$4 = { class: "text-xs text-gray-400" };
95759
+ const _hoisted_48$4 = {
95752
95760
  key: 0,
95753
95761
  class: "px-0 py-0"
95754
95762
  };
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 = {
95763
+ const _hoisted_49$4 = { key: 1 };
95764
+ const _hoisted_50$4 = { class: "flex items-center px-0 pt-2 pb-1" };
95765
+ const _hoisted_51$3 = { class: "text-m font-semibold text-gray-900" };
95766
+ const _hoisted_52$3 = { class: "ml-2 text-sm text-gray-500" };
95767
+ const _hoisted_53$3 = ["data-result-selected", "onClick"];
95768
+ 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" };
95769
+ const _hoisted_55$2 = { class: "flex-1 min-w-0" };
95770
+ const _hoisted_56$2 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95771
+ const _hoisted_57$2 = { class: "text-xs text-gray-500" };
95772
+ const _hoisted_58$2 = { class: "text-xs text-gray-400" };
95773
+ const _hoisted_59$2 = {
95766
95774
  key: 0,
95767
95775
  class: "px-0 py-0"
95768
95776
  };
95769
- const _hoisted_56$2 = {
95777
+ const _hoisted_60$2 = {
95770
95778
  key: 2,
95771
95779
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95772
95780
  };
95773
- const _hoisted_57$2 = {
95781
+ const _hoisted_61$2 = {
95774
95782
  key: 2,
95775
95783
  class: "flex-1 overflow-y-auto bg-white w-full"
95776
95784
  };
95777
- const _hoisted_58$2 = { class: "w-full px-0" };
95778
- const _hoisted_59$2 = {
95785
+ const _hoisted_62$2 = { class: "w-full px-0" };
95786
+ const _hoisted_63$2 = {
95779
95787
  key: 0,
95780
95788
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95781
95789
  };
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 = {
95790
+ const _hoisted_64$2 = { class: "flex items-center px-0 pt-2 pb-1" };
95791
+ const _hoisted_65$2 = { class: "text-m font-semibold text-gray-900" };
95792
+ const _hoisted_66$2 = { class: "ml-2 text-sm text-gray-500" };
95793
+ const _hoisted_67$2 = ["data-result-selected", "onClick"];
95794
+ const _hoisted_68$2 = {
95787
95795
  key: 1,
95788
95796
  class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center"
95789
95797
  };
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 = {
95798
+ const _hoisted_69$1 = { class: "flex-1 min-w-0" };
95799
+ const _hoisted_70$1 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95800
+ const _hoisted_71$1 = ["innerHTML"];
95801
+ const _hoisted_72$1 = { class: "text-xs text-gray-500" };
95802
+ const _hoisted_73$1 = { class: "text-xs text-gray-400" };
95803
+ const _hoisted_74$1 = {
95796
95804
  key: 0,
95797
95805
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95798
95806
  };
95799
- const _hoisted_71$1 = {
95807
+ const _hoisted_75$1 = {
95800
95808
  key: 0,
95801
95809
  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
95810
  };
@@ -95823,6 +95831,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95823
95831
  const selectedFileTypes = ref([]);
95824
95832
  const showFileTypeDropdown = ref(false);
95825
95833
  const selectedCanvasFilters = ref([]);
95834
+ const showCanvasTypeDropdown = ref(false);
95826
95835
  const fileTypeOptions = [
95827
95836
  { label: "Folder", value: "folder" },
95828
95837
  { label: "PDF", value: "pdf" },
@@ -95835,6 +95844,42 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95835
95844
  { label: "AR", value: "ar" },
95836
95845
  { label: "Web", value: "web" }
95837
95846
  ];
95847
+ const canvasTypeOptions = computed(() => {
95848
+ const options = [
95849
+ { label: t("canvasUI.CAlgoliaSearch.canvasFilters.templates"), value: "template" },
95850
+ { label: t("canvasUI.CAlgoliaSearch.canvasFilters.products"), value: "section" },
95851
+ { label: t("canvasUI.CAlgoliaSearch.canvasFilters.blocks"), value: "block" }
95852
+ ];
95853
+ if (!props.isAdmin) {
95854
+ options.unshift({ label: t("canvasUI.CAlgoliaSearch.canvasFilters.saved"), value: "saved_canvas" });
95855
+ }
95856
+ if (props.isAdmin) {
95857
+ options.splice(1, 0, {
95858
+ label: t("canvasUI.CAlgoliaSearch.canvasFilters.productTemplates"),
95859
+ value: "product_template"
95860
+ });
95861
+ }
95862
+ return options;
95863
+ });
95864
+ const ALLOWED_CANVAS_TYPES = ["saved_canvas", "template", "product_template", "section", "block"];
95865
+ const ALLOWED_FILE_TYPES = [
95866
+ "folder",
95867
+ "pdf",
95868
+ "image",
95869
+ "audio",
95870
+ "video",
95871
+ "document",
95872
+ "presentation",
95873
+ "spreadsheet",
95874
+ "ar",
95875
+ "web"
95876
+ ];
95877
+ const visibleCanvasTypeOptions = computed(() => {
95878
+ if (showRecentView.value || !searchQuery.value.trim()) {
95879
+ return canvasTypeOptions.value;
95880
+ }
95881
+ return canvasTypeOptions.value.filter((option) => availableCanvasTypes.value.has(option.value));
95882
+ });
95838
95883
  const hasActiveFilters = computed(() => selectedFileTypes.value.length > 0 || selectedCanvasFilters.value.length > 0);
95839
95884
  const clearAllFilters = () => {
95840
95885
  selectedFileTypes.value = [];
@@ -95845,7 +95890,9 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95845
95890
  selectedFileTypes.value = [];
95846
95891
  selectedCanvasFilters.value = [];
95847
95892
  searchType.value = null;
95848
- if (searchQuery.value.trim()) {
95893
+ if (searchQuery.value.trim() && (unfilteredContentResults.value.length > 0 || unfilteredCanvasResults.value.length > 0)) {
95894
+ applyFiltersToResults();
95895
+ } else if (searchQuery.value.trim()) {
95849
95896
  try {
95850
95897
  skipNextSuggestionFetch.value = true;
95851
95898
  await performSearch(searchQuery.value);
@@ -95981,8 +96028,11 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95981
96028
  };
95982
96029
  const contentResults = ref([]);
95983
96030
  const canvasResults = ref([]);
96031
+ const unfilteredContentResults = ref([]);
96032
+ const unfilteredCanvasResults = ref([]);
95984
96033
  const isSearching = ref(false);
95985
96034
  const hasSearchCompleted = ref(false);
96035
+ let currentSearchId = 0;
95986
96036
  const querySuggestions = ref([]);
95987
96037
  const selectedSuggestionIndex = ref(-1);
95988
96038
  const selectedResultIndex = ref(-1);
@@ -95999,6 +96049,44 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95999
96049
  }
96000
96050
  return canvasResults.value;
96001
96051
  });
96052
+ const availableFileTypes = computed(() => {
96053
+ if (showRecentView.value || !searchQuery.value.trim()) {
96054
+ return /* @__PURE__ */ new Set();
96055
+ }
96056
+ const types = /* @__PURE__ */ new Set();
96057
+ unfilteredContentResults.value.forEach((item) => {
96058
+ if (item.type === "folder") {
96059
+ types.add("folder");
96060
+ } else if (item.type === "file" && item.file_category) {
96061
+ types.add(item.file_category);
96062
+ }
96063
+ });
96064
+ return types;
96065
+ });
96066
+ const availableCanvasTypes = computed(() => {
96067
+ if (showRecentView.value || !searchQuery.value.trim()) {
96068
+ return /* @__PURE__ */ new Set();
96069
+ }
96070
+ const types = /* @__PURE__ */ new Set();
96071
+ unfilteredCanvasResults.value.forEach((item) => {
96072
+ if (item.content_type) {
96073
+ types.add(item.content_type);
96074
+ }
96075
+ });
96076
+ return types;
96077
+ });
96078
+ const visibleFileTypeOptions = computed(() => {
96079
+ if (showRecentView.value || !searchQuery.value.trim()) {
96080
+ return fileTypeOptions;
96081
+ }
96082
+ return fileTypeOptions.filter((option) => availableFileTypes.value.has(option.value));
96083
+ });
96084
+ const hasContentFilters = computed(() => {
96085
+ return visibleFileTypeOptions.value.length > 0 || selectedFileTypes.value.length > 0;
96086
+ });
96087
+ const hasCanvasFilters = computed(() => {
96088
+ return visibleCanvasTypeOptions.value.length > 0 || selectedCanvasFilters.value.length > 0;
96089
+ });
96002
96090
  const shouldShowNoResults = computed(() => {
96003
96091
  if (showRecentView.value || !searchQuery.value.trim() || isSearching.value || !hasSearchCompleted.value) return false;
96004
96092
  if (searchType.value === "content") {
@@ -96042,6 +96130,32 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96042
96130
  };
96043
96131
  watch(searchType, () => {
96044
96132
  selectedResultIndex.value = -1;
96133
+ showFileTypeDropdown.value = false;
96134
+ showCanvasTypeDropdown.value = false;
96135
+ });
96136
+ watch(visibleFileTypeOptions, (newOptions) => {
96137
+ if (selectedFileTypes.value.length > 0) {
96138
+ const availableValues = new Set(newOptions.map((option) => option.value));
96139
+ const stillAvailable = selectedFileTypes.value.filter((type) => availableValues.has(type));
96140
+ if (stillAvailable.length !== selectedFileTypes.value.length) {
96141
+ selectedFileTypes.value = stillAvailable;
96142
+ if (searchQuery.value.trim()) {
96143
+ performSearch(searchQuery.value.trim());
96144
+ }
96145
+ }
96146
+ }
96147
+ });
96148
+ watch(visibleCanvasTypeOptions, (newOptions) => {
96149
+ if (selectedCanvasFilters.value.length > 0) {
96150
+ const availableValues = new Set(newOptions.map((option) => option.value));
96151
+ const stillAvailable = selectedCanvasFilters.value.filter((type) => availableValues.has(type));
96152
+ if (stillAvailable.length !== selectedCanvasFilters.value.length) {
96153
+ selectedCanvasFilters.value = stillAvailable;
96154
+ if (searchQuery.value.trim()) {
96155
+ performSearch(searchQuery.value.trim());
96156
+ }
96157
+ }
96158
+ }
96045
96159
  });
96046
96160
  const scrollSelectedResultIntoView = () => {
96047
96161
  nextTick(() => {
@@ -96085,6 +96199,8 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96085
96199
  if (!query.trim()) {
96086
96200
  contentResults.value = [];
96087
96201
  canvasResults.value = [];
96202
+ unfilteredContentResults.value = [];
96203
+ unfilteredCanvasResults.value = [];
96088
96204
  hasSearchCompleted.value = false;
96089
96205
  isSearching.value = false;
96090
96206
  searchError.value = null;
@@ -96093,59 +96209,51 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96093
96209
  isSearching.value = true;
96094
96210
  hasSearchCompleted.value = false;
96095
96211
  searchError.value = null;
96212
+ const searchId = ++currentSearchId;
96096
96213
  const shouldSkipSuggestionFetch = skipNextSuggestionFetch.value;
96097
96214
  if (shouldSkipSuggestionFetch) {
96098
96215
  skipNextSuggestionFetch.value = false;
96099
96216
  }
96100
96217
  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);
96218
+ const validCanvasFilters = selectedCanvasFilters.value.filter((filter) => ALLOWED_CANVAS_TYPES.includes(filter));
96219
+ if (selectedCanvasFilters.value.length !== validCanvasFilters.length) {
96220
+ const invalid = selectedCanvasFilters.value.filter((filter) => !ALLOWED_CANVAS_TYPES.includes(filter));
96221
+ console.warn("[CAlgoliaSearch] Invalid canvas filters removed:", invalid);
96124
96222
  selectedCanvasFilters.value = validCanvasFilters;
96125
96223
  }
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);
96224
+ const validFileTypes = selectedFileTypes.value.filter((type) => ALLOWED_FILE_TYPES.includes(type));
96225
+ if (selectedFileTypes.value.length !== validFileTypes.length) {
96226
+ const invalid = selectedFileTypes.value.filter((type) => !ALLOWED_FILE_TYPES.includes(type));
96227
+ console.warn("[CAlgoliaSearch] Invalid file type filters removed:", invalid);
96137
96228
  selectedFileTypes.value = validFileTypes;
96138
96229
  }
96139
- const contentFilters = validFileTypes.length > 0 ? ` AND (${validFileTypes.map((type) => type === "folder" ? `type:"${type}"` : `file_category:"${type}"`).join(" OR ")})` : "";
96140
96230
  const results = await searchViaBackend(query.trim(), {
96141
- canvas: canvasFilters,
96142
- content: contentFilters
96231
+ canvas: "",
96232
+ content: ""
96143
96233
  });
96144
96234
  if (query.trim() !== searchQuery.value.trim()) {
96145
96235
  return;
96146
96236
  }
96147
- contentResults.value = results.content?.hits || [];
96148
- canvasResults.value = results.canvas?.hits || [];
96237
+ unfilteredContentResults.value = results.content?.hits || [];
96238
+ unfilteredCanvasResults.value = results.canvas?.hits || [];
96239
+ let filteredContent = unfilteredContentResults.value;
96240
+ let filteredCanvas = unfilteredCanvasResults.value;
96241
+ if (validFileTypes.length > 0) {
96242
+ filteredContent = filteredContent.filter((item) => {
96243
+ if (validFileTypes.includes("folder") && item.type === "folder") {
96244
+ return true;
96245
+ }
96246
+ if (item.type === "file") {
96247
+ return validFileTypes.includes(item.file_category);
96248
+ }
96249
+ return false;
96250
+ });
96251
+ }
96252
+ if (validCanvasFilters.length > 0) {
96253
+ filteredCanvas = filteredCanvas.filter((item) => validCanvasFilters.includes(item.content_type));
96254
+ }
96255
+ contentResults.value = filteredContent;
96256
+ canvasResults.value = filteredCanvas;
96149
96257
  selectedResultIndex.value = -1;
96150
96258
  searchError.value = null;
96151
96259
  if (query.trim().length >= 2 && !shouldSkipSuggestionFetch) {
@@ -96158,23 +96266,27 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96158
96266
  }
96159
96267
  await nextTick();
96160
96268
  setTimeout(() => {
96161
- isSearching.value = false;
96162
- hasSearchCompleted.value = true;
96269
+ if (searchId === currentSearchId) {
96270
+ isSearching.value = false;
96271
+ hasSearchCompleted.value = true;
96272
+ }
96163
96273
  }, 50);
96164
96274
  } catch (error) {
96165
96275
  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";
96276
+ if (searchId === currentSearchId) {
96277
+ contentResults.value = [];
96278
+ canvasResults.value = [];
96279
+ isSearching.value = false;
96280
+ hasSearchCompleted.value = true;
96281
+ if (error.message === "AUTH_REQUIRED") {
96282
+ searchError.value = "Please sign in to search";
96283
+ } else if (error.message === "AUTH_EXPIRED") {
96284
+ searchError.value = "Your session has expired. Please sign in again";
96285
+ } else if (error.message === "AUTH_FORBIDDEN") {
96286
+ searchError.value = "You do not have permission to search this instance";
96287
+ } else {
96288
+ searchError.value = "Search failed. Please try again";
96289
+ }
96178
96290
  }
96179
96291
  }
96180
96292
  };
@@ -96184,19 +96296,38 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96184
96296
  if (!query || typeof query !== "string") return "";
96185
96297
  return query;
96186
96298
  }
96299
+ function applyFiltersToResults() {
96300
+ if (unfilteredContentResults.value.length === 0 && unfilteredCanvasResults.value.length === 0) {
96301
+ return;
96302
+ }
96303
+ const validFileTypes = selectedFileTypes.value.filter((type) => ALLOWED_FILE_TYPES.includes(type));
96304
+ const validCanvasFilters = selectedCanvasFilters.value.filter((type) => ALLOWED_CANVAS_TYPES.includes(type));
96305
+ let filteredContent = unfilteredContentResults.value;
96306
+ let filteredCanvas = unfilteredCanvasResults.value;
96307
+ if (validFileTypes.length > 0) {
96308
+ filteredContent = filteredContent.filter((item) => {
96309
+ if (validFileTypes.includes("folder") && item.type === "folder") {
96310
+ return true;
96311
+ }
96312
+ if (item.type === "file") {
96313
+ return validFileTypes.includes(item.file_category);
96314
+ }
96315
+ return false;
96316
+ });
96317
+ }
96318
+ if (validCanvasFilters.length > 0) {
96319
+ filteredCanvas = filteredCanvas.filter((item) => validCanvasFilters.includes(item.content_type));
96320
+ }
96321
+ contentResults.value = filteredContent;
96322
+ canvasResults.value = filteredCanvas;
96323
+ selectedResultIndex.value = -1;
96324
+ }
96187
96325
  const debouncedFilterSearch = () => {
96188
96326
  if (filterChangeTimer) clearTimeout(filterChangeTimer);
96189
96327
  if (searchTimer) clearTimeout(searchTimer);
96190
96328
  filterChangeTimer = setTimeout(async () => {
96191
96329
  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
- }
96330
+ applyFiltersToResults();
96200
96331
  }
96201
96332
  }, 500);
96202
96333
  };
@@ -96222,6 +96353,8 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96222
96353
  showRecentView.value = true;
96223
96354
  contentResults.value = [];
96224
96355
  canvasResults.value = [];
96356
+ unfilteredContentResults.value = [];
96357
+ unfilteredCanvasResults.value = [];
96225
96358
  querySuggestions.value = [];
96226
96359
  selectedSuggestionIndex.value = -1;
96227
96360
  selectedResultIndex.value = -1;
@@ -96235,6 +96368,8 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96235
96368
  showRecentView.value = true;
96236
96369
  contentResults.value = [];
96237
96370
  canvasResults.value = [];
96371
+ unfilteredContentResults.value = [];
96372
+ unfilteredCanvasResults.value = [];
96238
96373
  querySuggestions.value = [];
96239
96374
  selectedSuggestionIndex.value = -1;
96240
96375
  selectedResultIndex.value = -1;
@@ -96359,31 +96494,31 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96359
96494
  if (endChar < highlightValue.length) truncated = truncated + "...";
96360
96495
  return sanitizeHtml(truncated);
96361
96496
  };
96362
- const toggleCanvasFilter = (filterType) => {
96363
- if (selectedCanvasFilters.value.includes(filterType)) {
96364
- selectedCanvasFilters.value.splice(selectedCanvasFilters.value.indexOf(filterType), 1);
96497
+ const handleFileTypeToggle = (value, checked) => {
96498
+ if (checked) {
96499
+ if (!selectedFileTypes.value.includes(value)) {
96500
+ selectedFileTypes.value.push(value);
96501
+ }
96365
96502
  } else {
96366
- selectedCanvasFilters.value.push(filterType);
96503
+ selectedFileTypes.value = selectedFileTypes.value.filter((v) => v !== value);
96367
96504
  }
96368
96505
  debouncedFilterSearch();
96369
96506
  };
96370
- const clearCanvasFilters = () => {
96371
- selectedCanvasFilters.value = [];
96372
- debouncedFilterSearch();
96373
- };
96374
- const toggleFileType = (fileType, checked) => {
96507
+ const handleCanvasTypeToggle = (value, checked) => {
96375
96508
  if (checked) {
96376
- if (!selectedFileTypes.value.includes(fileType)) {
96377
- selectedFileTypes.value.push(fileType);
96509
+ if (!selectedCanvasFilters.value.includes(value)) {
96510
+ selectedCanvasFilters.value.push(value);
96378
96511
  }
96379
96512
  } else {
96380
- const index = selectedFileTypes.value.indexOf(fileType);
96381
- if (index > -1) {
96382
- selectedFileTypes.value.splice(index, 1);
96383
- }
96513
+ selectedCanvasFilters.value = selectedCanvasFilters.value.filter((v) => v !== value);
96384
96514
  }
96385
96515
  debouncedFilterSearch();
96386
96516
  };
96517
+ const clearCanvasFilters = () => {
96518
+ selectedCanvasFilters.value = [];
96519
+ showCanvasTypeDropdown.value = false;
96520
+ debouncedFilterSearch();
96521
+ };
96387
96522
  const clearFileTypes = () => {
96388
96523
  selectedFileTypes.value = [];
96389
96524
  showFileTypeDropdown.value = false;
@@ -96554,7 +96689,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96554
96689
  show: "",
96555
96690
  verticalAlignment: "top",
96556
96691
  "z-index": _ctx.zIndex,
96557
- "onUpdate:show": _cache[15] || (_cache[15] = ($event) => emit("toggleSearch", $event))
96692
+ "onUpdate:show": _cache[12] || (_cache[12] = ($event) => emit("toggleSearch", $event))
96558
96693
  }, {
96559
96694
  default: withCtx(() => [
96560
96695
  createElementVNode("div", {
@@ -96563,7 +96698,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96563
96698
  }, [
96564
96699
  createElementVNode("div", _hoisted_1$4w, [
96565
96700
  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" }, [
96701
+ _cache[13] || (_cache[13] = createElementVNode("div", { class: "absolute left-2.5 top-1/2 transform -translate-y-1/2 z-10" }, [
96567
96702
  createElementVNode("i", { class: "c-icon far fa-search text-gray-400 text-l" })
96568
96703
  ], -1)),
96569
96704
  withDirectives(createElementVNode("input", {
@@ -96660,7 +96795,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96660
96795
  createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.tabs.pitchDecks")), 1)
96661
96796
  ], 2)) : createCommentVNode("", true)
96662
96797
  ]),
96663
- searchType.value ? (openBlock(), createElementBlock("div", _hoisted_9$O, [
96798
+ searchType.value && (searchType.value === "content" && hasContentFilters.value || searchType.value === "canvases" && hasCanvasFilters.value) ? (openBlock(), createElementBlock("div", _hoisted_9$O, [
96664
96799
  searchType.value === "content" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
96665
96800
  createVNode(unref(NPopover), {
96666
96801
  class: "c-select-filter",
@@ -96696,24 +96831,23 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96696
96831
  default: withCtx(() => [
96697
96832
  createElementVNode("div", _hoisted_12$p, [
96698
96833
  createElementVNode("div", _hoisted_13$k, [
96699
- (openBlock(), createElementBlock(Fragment, null, renderList(fileTypeOptions, (option) => {
96700
- return createElementVNode("div", {
96834
+ (openBlock(true), createElementBlock(Fragment, null, renderList(visibleFileTypeOptions.value, (option) => {
96835
+ return openBlock(), createElementBlock("div", {
96701
96836
  key: option.value,
96702
96837
  class: "w-full h-7 flex items-center"
96703
96838
  }, [
96704
96839
  createVNode(unref(NCheckbox), {
96705
96840
  checked: selectedFileTypes.value.includes(option.value),
96706
96841
  class: "px-2 truncate",
96707
- "onUpdate:checked": (v) => toggleFileType(option.value, v),
96708
- value: option.value
96842
+ "onUpdate:checked": (checked) => handleFileTypeToggle(option.value, checked)
96709
96843
  }, {
96710
96844
  default: withCtx(() => [
96711
96845
  createTextVNode(toDisplayString(option.label), 1)
96712
96846
  ]),
96713
96847
  _: 2
96714
- }, 1032, ["checked", "onUpdate:checked", "value"])
96848
+ }, 1032, ["checked", "onUpdate:checked"])
96715
96849
  ]);
96716
- }), 64))
96850
+ }), 128))
96717
96851
  ]),
96718
96852
  createElementVNode("div", {
96719
96853
  class: "pa-2",
@@ -96736,114 +96870,99 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96736
96870
  _: 1
96737
96871
  }, 8, ["show"]),
96738
96872
  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)),
96873
+ _cache[14] || (_cache[14] = createElementVNode("div", { class: "h-6 w-px bg-gray-300 mx-2" }, null, -1)),
96740
96874
  createElementVNode("span", {
96741
96875
  class: "text-sm text-gray-600 hover:text-gray-800 font-normal cursor-pointer",
96742
96876
  onClick: clearAllFilters
96743
96877
  }, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.clear")), 1)
96744
96878
  ])) : createCommentVNode("", true)
96745
96879
  ], 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"))
96880
+ createVNode(unref(NPopover), {
96881
+ class: "c-select-filter",
96882
+ placement: "bottom-start",
96883
+ raw: "",
96884
+ show: showCanvasTypeDropdown.value,
96885
+ "show-arrow": false,
96886
+ trigger: "manual",
96887
+ onClickoutside: _cache[9] || (_cache[9] = ($event) => showCanvasTypeDropdown.value = false)
96810
96888
  }, {
96811
- default: withCtx(() => [
96812
- createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.canvasFilters.products")), 1)
96889
+ trigger: withCtx(() => [
96890
+ createVNode(unref(NTag), {
96891
+ class: "select-none cursor-pointer",
96892
+ style: normalizeStyle({
96893
+ "--n-color": selectedCanvasFilters.value.length ? "var(--p-primary5)" : "var(--p-primary6)",
96894
+ "--n-border": "1px solid var(--p-primary5)",
96895
+ "--n-height": "28px"
96896
+ }),
96897
+ themeOverrides: {
96898
+ borderRadius: "4px"
96899
+ },
96900
+ onClick: _cache[8] || (_cache[8] = ($event) => showCanvasTypeDropdown.value = !showCanvasTypeDropdown.value)
96901
+ }, {
96902
+ default: withCtx(() => [
96903
+ createElementVNode("div", _hoisted_15$f, [
96904
+ createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.type")), 1),
96905
+ selectedCanvasFilters.value.length ? (openBlock(), createElementBlock("span", _hoisted_16$e, ": " + toDisplayString(selectedCanvasFilters.value.length), 1)) : createCommentVNode("", true)
96906
+ ])
96907
+ ]),
96908
+ _: 1
96909
+ }, 8, ["style"])
96813
96910
  ]),
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
96911
  default: withCtx(() => [
96829
- createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.canvasFilters.blocks")), 1)
96912
+ createElementVNode("div", _hoisted_17$c, [
96913
+ createElementVNode("div", _hoisted_18$a, [
96914
+ (openBlock(true), createElementBlock(Fragment, null, renderList(visibleCanvasTypeOptions.value, (option) => {
96915
+ return openBlock(), createElementBlock("div", {
96916
+ key: option.value,
96917
+ class: "w-full h-7 flex items-center"
96918
+ }, [
96919
+ createVNode(unref(NCheckbox), {
96920
+ checked: selectedCanvasFilters.value.includes(option.value),
96921
+ class: "px-2 truncate",
96922
+ "onUpdate:checked": (checked) => handleCanvasTypeToggle(option.value, checked)
96923
+ }, {
96924
+ default: withCtx(() => [
96925
+ createTextVNode(toDisplayString(option.label), 1)
96926
+ ]),
96927
+ _: 2
96928
+ }, 1032, ["checked", "onUpdate:checked"])
96929
+ ]);
96930
+ }), 128))
96931
+ ]),
96932
+ createElementVNode("div", {
96933
+ class: "pa-2",
96934
+ style: normalizeStyle({ borderTop: `1px solid ${unref(themeVars).primary5}` })
96935
+ }, [
96936
+ createVNode(CButton, {
96937
+ block: "",
96938
+ class: "pa-2",
96939
+ text: "",
96940
+ onClick: clearCanvasFilters
96941
+ }, {
96942
+ default: withCtx(() => [
96943
+ createTextVNode(toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.clear")), 1)
96944
+ ]),
96945
+ _: 1
96946
+ })
96947
+ ], 4)
96948
+ ])
96830
96949
  ]),
96831
96950
  _: 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)),
96951
+ }, 8, ["show"]),
96952
+ hasActiveFilters.value ? (openBlock(), createElementBlock("div", _hoisted_19$a, [
96953
+ _cache[15] || (_cache[15] = createElementVNode("div", { class: "h-6 w-px bg-gray-300 mx-2" }, null, -1)),
96835
96954
  createElementVNode("span", {
96836
96955
  class: "text-sm text-gray-600 hover:text-gray-800 font-normal cursor-pointer",
96837
- onClick: clearCanvasFilters
96956
+ onClick: clearAllFilters
96838
96957
  }, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.clear")), 1)
96839
96958
  ])) : createCommentVNode("", true)
96840
96959
  ], 64)) : createCommentVNode("", true)
96841
96960
  ])) : createCommentVNode("", true)
96842
96961
  ])) : createCommentVNode("", true)
96843
96962
  ]),
96844
- createElementVNode("div", _hoisted_16$e, [
96845
- showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_17$c, [
96846
- createElementVNode("div", _hoisted_18$a, [
96963
+ createElementVNode("div", _hoisted_20$9, [
96964
+ showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_21$7, [
96965
+ createElementVNode("div", _hoisted_22$5, [
96847
96966
  (openBlock(true), createElementBlock(Fragment, null, renderList(recentSearches.value, (search) => {
96848
96967
  return openBlock(), createElementBlock("div", {
96849
96968
  key: search,
@@ -96856,14 +96975,14 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96856
96975
  icon: "clock-rotate-left",
96857
96976
  size: "16"
96858
96977
  }),
96859
- createElementVNode("span", _hoisted_20$9, toDisplayString(search), 1)
96860
- ], 8, _hoisted_19$a);
96978
+ createElementVNode("span", _hoisted_24$5, toDisplayString(search), 1)
96979
+ ], 8, _hoisted_23$5);
96861
96980
  }), 128))
96862
96981
  ]),
96863
96982
  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)
96983
+ _cache[16] || (_cache[16] = createElementVNode("hr", { class: "border-0 h-px bg-gray-200 mt-2 mb-3 w-full" }, null, -1)),
96984
+ createElementVNode("div", _hoisted_25$5, [
96985
+ createElementVNode("span", _hoisted_26$5, toDisplayString(unref(t)("canvasUI.components.fileViewer.recentlyOpened")), 1)
96867
96986
  ]),
96868
96987
  createElementVNode("div", {
96869
96988
  class: normalizeClass(_ctx.isAdmin ? "space-y-2" : "space-y-0")
@@ -96877,7 +96996,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96877
96996
  ]),
96878
96997
  onClick: ($event) => handleRecentDocClick(doc, doc.type)
96879
96998
  }, [
96880
- doc.type === "file" ? (openBlock(), createElementBlock("div", _hoisted_24$5, [
96999
+ doc.type === "file" ? (openBlock(), createElementBlock("div", _hoisted_28$5, [
96881
97000
  createVNode(_sfc_main$6K, {
96882
97001
  class: "h-14 border-rounded-1 overflow-hidden flex-0",
96883
97002
  cover: "",
@@ -96886,7 +97005,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96886
97005
  src: recentThumbnails.value[doc.id] || "",
96887
97006
  width: "72"
96888
97007
  }, null, 8, ["file-data", "src"]),
96889
- isLoadingThumbnails.value && !recentThumbnails.value[doc.id] ? (openBlock(), createElementBlock("div", _hoisted_25$5, [
97008
+ isLoadingThumbnails.value && !recentThumbnails.value[doc.id] ? (openBlock(), createElementBlock("div", _hoisted_29$5, [
96890
97009
  createVNode(CIcon, {
96891
97010
  class: "animate-spin",
96892
97011
  color: "var(--p-primary)",
@@ -96894,7 +97013,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96894
97013
  size: "20"
96895
97014
  })
96896
97015
  ])) : createCommentVNode("", true)
96897
- ])) : (openBlock(), createElementBlock("div", _hoisted_26$5, [
97016
+ ])) : (openBlock(), createElementBlock("div", _hoisted_30$4, [
96898
97017
  doc.type === "canvas" ? (openBlock(), createBlock(CIcon, {
96899
97018
  key: 0,
96900
97019
  color: "var(--p-text2)",
@@ -96907,33 +97026,33 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96907
97026
  size: "32"
96908
97027
  }))
96909
97028
  ])),
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)
97029
+ createElementVNode("div", _hoisted_31$4, [
97030
+ createElementVNode("h3", _hoisted_32$4, toDisplayString(doc.name), 1),
97031
+ createElementVNode("p", _hoisted_33$4, toDisplayString(doc.type === "canvas" ? formatCanvasType(doc.content_type) : doc.type === "folder" ? "Folder" : doc.file_category || "File"), 1)
96913
97032
  ])
96914
- ], 10, _hoisted_23$5);
97033
+ ], 10, _hoisted_27$5);
96915
97034
  }), 128))
96916
97035
  ], 2)
96917
97036
  ], 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, [
97037
+ ])) : !searchType.value ? (openBlock(), createElementBlock("div", _hoisted_34$4, [
97038
+ createElementVNode("div", _hoisted_35$4, [
97039
+ isSearching.value ? (openBlock(), createElementBlock("div", _hoisted_36$4, [
96921
97040
  createVNode(CIcon, {
96922
97041
  class: "animate-spin text-6xl",
96923
97042
  color: "var(--p-primary)",
96924
97043
  icon: "spinner"
96925
97044
  })
96926
97045
  ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
96927
- filteredContentFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_33$4, [
96928
- createElementVNode("div", _hoisted_34$4, [
97046
+ filteredContentFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_37$4, [
97047
+ createElementVNode("div", _hoisted_38$4, [
96929
97048
  createVNode(CIcon, {
96930
97049
  class: "mr-2",
96931
97050
  color: "var(--p-text2)",
96932
97051
  icon: "folder",
96933
97052
  size: "16"
96934
97053
  }),
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)
97054
+ createElementVNode("span", _hoisted_39$4, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.sections.content")), 1),
97055
+ createElementVNode("span", _hoisted_40$4, "(" + toDisplayString(filteredContentFiles.value.length) + ")", 1)
96937
97056
  ]),
96938
97057
  createElementVNode("div", null, [
96939
97058
  (openBlock(true), createElementBlock(Fragment, null, renderList(filteredContentFiles.value.slice(0, 5), (item) => {
@@ -96955,30 +97074,30 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96955
97074
  "object-fit": "cover",
96956
97075
  src: item.picture_url || "",
96957
97076
  width: "72"
96958
- }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_38$4, [
97077
+ }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_42$4, [
96959
97078
  createVNode(CIcon, {
96960
97079
  color: "var(--p-text2)",
96961
97080
  icon: "folder",
96962
97081
  size: "32"
96963
97082
  })
96964
97083
  ])),
96965
- createElementVNode("div", _hoisted_39$4, [
96966
- createElementVNode("h3", _hoisted_40$4, toDisplayString(item.name), 1),
97084
+ createElementVNode("div", _hoisted_43$4, [
97085
+ createElementVNode("h3", _hoisted_44$4, toDisplayString(item.name), 1),
96967
97086
  item.type === "file" && getSnippet(item) ? (openBlock(), createElementBlock("p", {
96968
97087
  key: 0,
96969
97088
  class: "text-xs text-gray-600 mb-1",
96970
97089
  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)
97090
+ }, null, 8, _hoisted_45$4)) : createCommentVNode("", true),
97091
+ createElementVNode("p", _hoisted_46$4, toDisplayString(item.type === "folder" ? "Folder" : item.file_category || item.content_type || "File"), 1)
96973
97092
  ]),
96974
- createElementVNode("div", _hoisted_43$4, toDisplayString(item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
96975
- ], 10, _hoisted_37$4);
97093
+ createElementVNode("div", _hoisted_47$4, toDisplayString(item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
97094
+ ], 10, _hoisted_41$4);
96976
97095
  }), 128))
96977
97096
  ]),
96978
- filteredContentFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_44$4, [
97097
+ filteredContentFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_48$4, [
96979
97098
  createElementVNode("span", {
96980
97099
  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")
97100
+ onClick: _cache[10] || (_cache[10] = ($event) => searchType.value = "content")
96982
97101
  }, [
96983
97102
  createTextVNode(toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.actions.viewAll")) + " ", 1),
96984
97103
  createVNode(CIcon, {
@@ -96989,16 +97108,16 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96989
97108
  ])
96990
97109
  ])) : createCommentVNode("", true)
96991
97110
  ])) : createCommentVNode("", true),
96992
- filteredCanvasFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_45$4, [
96993
- createElementVNode("div", _hoisted_46$4, [
97111
+ filteredCanvasFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_49$4, [
97112
+ createElementVNode("div", _hoisted_50$4, [
96994
97113
  createVNode(CIcon, {
96995
97114
  class: "mr-2",
96996
97115
  color: "var(--p-text2)",
96997
97116
  icon: "presentation",
96998
97117
  size: "16"
96999
97118
  }),
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)
97119
+ createElementVNode("span", _hoisted_51$3, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.sections.pitchDecks")), 1),
97120
+ createElementVNode("span", _hoisted_52$3, "(" + toDisplayString(filteredCanvasFiles.value.length) + ")", 1)
97002
97121
  ]),
97003
97122
  createElementVNode("div", null, [
97004
97123
  (openBlock(true), createElementBlock(Fragment, null, renderList(filteredCanvasFiles.value.slice(0, 5), (item) => {
@@ -97012,25 +97131,25 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97012
97131
  "data-result-selected": isResultSelected(item),
97013
97132
  onClick: ($event) => handleResultClick(item, "canvas")
97014
97133
  }, [
97015
- createElementVNode("div", _hoisted_50$4, [
97134
+ createElementVNode("div", _hoisted_54$2, [
97016
97135
  createVNode(CIcon, {
97017
97136
  color: "var(--p-text2)",
97018
97137
  icon: "presentation",
97019
97138
  size: "32"
97020
97139
  })
97021
97140
  ]),
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)
97141
+ createElementVNode("div", _hoisted_55$2, [
97142
+ createElementVNode("h3", _hoisted_56$2, toDisplayString(item.name), 1),
97143
+ createElementVNode("p", _hoisted_57$2, toDisplayString(formatCanvasType(item.content_type)), 1)
97025
97144
  ]),
97026
- createElementVNode("div", _hoisted_54$2, toDisplayString(item.folder?.name || ""), 1)
97027
- ], 10, _hoisted_49$4);
97145
+ createElementVNode("div", _hoisted_58$2, toDisplayString(item.folder?.name || ""), 1)
97146
+ ], 10, _hoisted_53$3);
97028
97147
  }), 128))
97029
97148
  ]),
97030
- filteredCanvasFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_55$2, [
97149
+ filteredCanvasFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_59$2, [
97031
97150
  createElementVNode("span", {
97032
97151
  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")
97152
+ onClick: _cache[11] || (_cache[11] = ($event) => searchType.value = "canvases")
97034
97153
  }, [
97035
97154
  createTextVNode(toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.actions.viewAll")) + " ", 1),
97036
97155
  createVNode(CIcon, {
@@ -97041,7 +97160,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97041
97160
  ])
97042
97161
  ])) : createCommentVNode("", true)
97043
97162
  ])) : createCommentVNode("", true),
97044
- searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_56$2, [
97163
+ searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_60$2, [
97045
97164
  createVNode(CIcon, {
97046
97165
  class: "text-6xl",
97047
97166
  color: searchError.value ? "var(--p-error)" : "var(--p-text3)",
@@ -97054,16 +97173,16 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97054
97173
  ])) : createCommentVNode("", true)
97055
97174
  ], 64))
97056
97175
  ])
97057
- ])) : (openBlock(), createElementBlock("div", _hoisted_57$2, [
97058
- createElementVNode("div", _hoisted_58$2, [
97059
- isSearching.value ? (openBlock(), createElementBlock("div", _hoisted_59$2, [
97176
+ ])) : (openBlock(), createElementBlock("div", _hoisted_61$2, [
97177
+ createElementVNode("div", _hoisted_62$2, [
97178
+ isSearching.value ? (openBlock(), createElementBlock("div", _hoisted_63$2, [
97060
97179
  createVNode(CIcon, {
97061
97180
  class: "animate-spin text-6xl",
97062
97181
  color: "var(--p-primary)",
97063
97182
  icon: "spinner"
97064
97183
  })
97065
97184
  ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
97066
- createElementVNode("div", _hoisted_60$2, [
97185
+ createElementVNode("div", _hoisted_64$2, [
97067
97186
  searchType.value === "content" ? (openBlock(), createBlock(CIcon, {
97068
97187
  key: 0,
97069
97188
  class: "mr-2",
@@ -97077,8 +97196,8 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97077
97196
  icon: "presentation",
97078
97197
  size: "16"
97079
97198
  })),
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)
97199
+ createElementVNode("span", _hoisted_65$2, toDisplayString(searchType.value === "content" ? unref(t)("canvasUI.CAlgoliaSearch.sections.content") : unref(t)("canvasUI.CAlgoliaSearch.sections.pitchDecks")), 1),
97200
+ createElementVNode("span", _hoisted_66$2, " (" + toDisplayString(searchType.value === "content" ? filteredContentFiles.value.length : filteredCanvasFiles.value.length) + ") ", 1)
97082
97201
  ]),
97083
97202
  createElementVNode("div", null, [
97084
97203
  (openBlock(true), createElementBlock(Fragment, null, renderList(searchType.value === "content" ? filteredContentFiles.value : filteredCanvasFiles.value, (item) => {
@@ -97103,7 +97222,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97103
97222
  "object-fit": "cover",
97104
97223
  src: item.picture_url || "",
97105
97224
  width: "72"
97106
- }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_64$2, [
97225
+ }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_68$2, [
97107
97226
  searchType.value === "content" ? (openBlock(), createBlock(CIcon, {
97108
97227
  key: 0,
97109
97228
  color: "var(--p-text2)",
@@ -97116,20 +97235,20 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97116
97235
  size: "32"
97117
97236
  }))
97118
97237
  ])),
97119
- createElementVNode("div", _hoisted_65$2, [
97120
- createElementVNode("h3", _hoisted_66$2, toDisplayString(item.name), 1),
97238
+ createElementVNode("div", _hoisted_69$1, [
97239
+ createElementVNode("h3", _hoisted_70$1, toDisplayString(item.name), 1),
97121
97240
  searchType.value === "content" && item.type === "file" && getSnippet(item) ? (openBlock(), createElementBlock("p", {
97122
97241
  key: 0,
97123
97242
  class: "text-xs text-gray-600 mb-1",
97124
97243
  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)
97244
+ }, null, 8, _hoisted_71$1)) : createCommentVNode("", true),
97245
+ 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
97246
  ]),
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);
97247
+ createElementVNode("div", _hoisted_73$1, toDisplayString(searchType.value === "content" && item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
97248
+ ], 10, _hoisted_67$2);
97130
97249
  }), 128))
97131
97250
  ]),
97132
- searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_70$1, [
97251
+ searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_74$1, [
97133
97252
  createVNode(CIcon, {
97134
97253
  class: "text-6xl",
97135
97254
  color: searchError.value ? "var(--p-error)" : "var(--p-text3)",
@@ -97144,7 +97263,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97144
97263
  ])
97145
97264
  ]))
97146
97265
  ]),
97147
- !showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_71$1, [
97266
+ !showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_75$1, [
97148
97267
  createVNode(CShortcut, null, {
97149
97268
  default: withCtx(() => [
97150
97269
  createVNode(CShortcutIcon, { icon: "arrow-up" }),
@@ -97186,7 +97305,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97186
97305
  }
97187
97306
  });
97188
97307
 
97189
- const CAlgoliaSearch = /* @__PURE__ */ _export_sfc(_sfc_main$5K, [["__scopeId", "data-v-da2357d4"]]);
97308
+ const CAlgoliaSearch = /* @__PURE__ */ _export_sfc(_sfc_main$5K, [["__scopeId", "data-v-840d4fd4"]]);
97190
97309
 
97191
97310
  const BulletListExtended = BulletList.extend({
97192
97311
  addOptions() {
@@ -109616,9 +109735,11 @@ const _sfc_main$4U = /* @__PURE__ */ defineComponent({
109616
109735
  function filterByItemVisibility(items) {
109617
109736
  const isAdmin = state$3.appName.value === "admin";
109618
109737
  return items.reduce((acc, item) => {
109738
+ const hasCountData = "files_count" in item || "folders_count" in item || "available_files_count" in item || "available_folders_count" in item;
109619
109739
  const filesCount = item.available_files_count ?? item.files_count ?? 0;
109620
109740
  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;
109741
+ const isFolderEmpty = item.type == "folder" && hasCountData && filesCount === 0 && foldersCount === 0;
109742
+ const shouldHideItem = item.name?.startsWith(".") || isFolderEmpty || item.folder?.file_thumbnail_urls?.length === 0;
109622
109743
  if (!shouldHideItem && !isAdmin || isAdmin) {
109623
109744
  acc.push({
109624
109745
  ...item,
@@ -109995,7 +110116,8 @@ const getInitialState$1 = () => ({
109995
110116
  // instance metadata template fields dictionary
109996
110117
  searchQuery: "",
109997
110118
  searchMetadataFilters: {},
109998
- filteredItems: []
110119
+ filteredItems: [],
110120
+ folderCache: {}
109999
110121
  });
110000
110122
  const state$2 = reactive(getInitialState$1());
110001
110123
  const fileOrderedStatuses = [FileStatusEnum.PENDING, FileStatusEnum.VIEWABLE];
@@ -110080,6 +110202,15 @@ function updateFolderState(folder) {
110080
110202
  state$2.folders = folder.folders;
110081
110203
  state$2.files = folder.files;
110082
110204
  state$2.currentFolderPath = folder.path;
110205
+ folder.folders.forEach((subfolder) => {
110206
+ state$2.folderCache[subfolder.id] = {
110207
+ files_count: subfolder.files_count,
110208
+ folders_count: subfolder.folders_count,
110209
+ available_files_count: subfolder.available_files_count,
110210
+ available_folders_count: subfolder.available_folders_count,
110211
+ timestamp: Date.now()
110212
+ };
110213
+ });
110083
110214
  if (useAppStore$4().showFilteredResults.value) {
110084
110215
  const filesById = new Map(state$2.files.map((file) => [file.id, file]));
110085
110216
  state$2.filteredItems = state$2.filteredItems.map((filteredItem) => {
@@ -110344,7 +110475,24 @@ function init({
110344
110475
  }
110345
110476
  let filteredFolders = [];
110346
110477
  if (!hasMetadataFilters && foldersResponse.status === "fulfilled" && foldersResponse.value) {
110347
- filteredFolders = foldersResponse.value.results?.map((f) => ({ ...f, type: "folder" })) ?? [];
110478
+ const foldersFromSearch = foldersResponse.value.results ?? [];
110479
+ filteredFolders = foldersFromSearch.map((folder) => {
110480
+ const cached = state$2.folderCache[folder.id];
110481
+ if (cached) {
110482
+ const result = {
110483
+ ...folder,
110484
+ type: "folder"
110485
+ };
110486
+ if (cached.files_count !== void 0) result.files_count = cached.files_count;
110487
+ if (cached.folders_count !== void 0) result.folders_count = cached.folders_count;
110488
+ if (cached.available_files_count !== void 0) result.available_files_count = cached.available_files_count;
110489
+ if (cached.available_folders_count !== void 0) {
110490
+ result.available_folders_count = cached.available_folders_count;
110491
+ }
110492
+ return result;
110493
+ }
110494
+ return { ...folder, type: "folder" };
110495
+ });
110348
110496
  } else if (!hasMetadataFilters && !useAppStore$4().isLocalSearch.value) {
110349
110497
  console.error(
110350
110498
  "Failed to fetch folders:",
@@ -137726,19 +137874,37 @@ function useComponentPermissions({
137726
137874
  isAnyTypeOfAdmin: false
137727
137875
  }))
137728
137876
  );
137729
- const { canvasContent } = useCanvas$1();
137877
+ const launchDarkly = inject(
137878
+ "launchDarkly",
137879
+ computed(() => ({}))
137880
+ );
137881
+ const { canvasContent, activeCanvas } = useCanvas$1();
137730
137882
  return computed(() => {
137731
- if (!usedInSectionId.value) return calculateCanvasPermissions(id.value, !!pitcherInfo.value?.isAnyTypeOfAdmin);
137732
- const parent = findParentByNodeId(canvasContent.value, id.value);
137733
- const canRemove = !!when_used_in_section.value?.is_removable;
137734
- const canEdit = !!when_used_in_section.value?.is_editable;
137735
- const canDuplicate = parent ? !!parent.when_used_in_section?.is_editable : false;
137736
- return {
137737
- hasSomethingEditable: canEdit || canRemove || canDuplicate,
137738
- canRemove,
137739
- canEdit,
137740
- canDuplicate
137741
- };
137883
+ if (usedInSectionId.value) {
137884
+ const parent = findParentByNodeId(canvasContent.value, id.value);
137885
+ const canRemove = !!when_used_in_section.value?.is_removable;
137886
+ const canEdit = !!when_used_in_section.value?.is_editable;
137887
+ const canDuplicate = parent ? !!parent.when_used_in_section?.is_editable : false;
137888
+ return {
137889
+ hasSomethingEditable: canEdit || canRemove || canDuplicate,
137890
+ canRemove,
137891
+ canEdit,
137892
+ canDuplicate
137893
+ };
137894
+ }
137895
+ 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);
137896
+ if (activeCanvas.value?.template?.id && launchDarkly.value.enable_template_component_permissions && hasExplicitPermissions) {
137897
+ const canRemove = !!when_used_in_section.value?.is_removable;
137898
+ const canEdit = !!when_used_in_section.value?.is_editable;
137899
+ const canDuplicate = canEdit;
137900
+ return {
137901
+ hasSomethingEditable: canEdit || canRemove || canDuplicate,
137902
+ canRemove,
137903
+ canEdit,
137904
+ canDuplicate
137905
+ };
137906
+ }
137907
+ return calculateCanvasPermissions(id.value, !!pitcherInfo.value?.isAnyTypeOfAdmin);
137742
137908
  });
137743
137909
  }
137744
137910
 
@@ -156715,7 +156881,9 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156715
156881
  visible: {},
156716
156882
  allow_admins_to_overwrite: { type: Boolean },
156717
156883
  style: {},
156718
- printModeIdx: {}
156884
+ printModeIdx: {},
156885
+ when_used_in_section: {},
156886
+ usedInSectionId: { default: "" }
156719
156887
  },
156720
156888
  emits: ["style"],
156721
156889
  setup(__props, { emit: __emit }) {
@@ -156730,12 +156898,42 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156730
156898
  computed(() => [])
156731
156899
  );
156732
156900
  const { isCompletionWizardEnabled, retriggerWizard } = useCanvasCompletionWizard();
156733
- const isEditable = computed(
156734
- () => isImpact.value ? !props.data.selection_strategy || props.data.selection_strategy === "free" || isCompletionWizardEnabled.value && wizardStepSectionListIds.value.includes(props.id) : true
156735
- );
156736
- const isRemovable = computed(
156737
- () => isImpact.value ? !props.data.selection_strategy || props.data.selection_strategy === "free" : true
156738
- );
156901
+ const {
156902
+ isImpact,
156903
+ mode,
156904
+ isEditMode,
156905
+ componentSelectedMode,
156906
+ isViewOnlyMode,
156907
+ componentEditMode,
156908
+ componentNodesById,
156909
+ activeCanvas,
156910
+ saveCanvasContentWithContext,
156911
+ removeComponentById,
156912
+ setComponentSelectedMode,
156913
+ setComponentSettingsMode,
156914
+ updateNodeDataById,
156915
+ canvasContent
156916
+ } = useCanvas$1();
156917
+ const { id, usedInSectionId, when_used_in_section } = toRefs(props);
156918
+ const componentPermissions = useComponentPermissions({
156919
+ id,
156920
+ usedInSectionId,
156921
+ when_used_in_section
156922
+ });
156923
+ const isEditable = computed(() => {
156924
+ if (!componentPermissions.value.canEdit) return false;
156925
+ if (isImpact.value) {
156926
+ return !props.data.selection_strategy || props.data.selection_strategy === "free" || isCompletionWizardEnabled.value && wizardStepSectionListIds.value.includes(props.id);
156927
+ }
156928
+ return true;
156929
+ });
156930
+ const isRemovable = computed(() => {
156931
+ if (!componentPermissions.value.canRemove) return false;
156932
+ if (isImpact.value) {
156933
+ return !props.data.selection_strategy || props.data.selection_strategy === "free";
156934
+ }
156935
+ return true;
156936
+ });
156739
156937
  const sectionSelectorAppSrc = computed(() => {
156740
156938
  if (!sectionSelectorApps.value?.length || !props.data.selection_app_name) return null;
156741
156939
  const relatedApp = sectionSelectorApps.value.find((app) => app.app_metadata?.name === props.data.selection_app_name);
@@ -156802,7 +157000,7 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156802
157000
  async (selectedData) => {
156803
157001
  console.info(`[SectionList]: Received done callback for ${props.id} with data`, selectedData);
156804
157002
  if (!selectedData) return;
156805
- const sections = (selectedData?.section_ids || []).map((id) => ({ id: typeof id === "string" ? id : id.id }));
157003
+ const sections = (selectedData?.section_ids || []).map((id2) => ({ id: typeof id2 === "string" ? id2 : id2.id }));
156806
157004
  const updatedData = { ...props.data, sections };
156807
157005
  updateNodeDataById(props.id, updatedData);
156808
157006
  const currentContext = cloneDeep(activeCanvas.value?.context || {});
@@ -156828,22 +157026,6 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156828
157026
  sectionListRef.value?.toggleSectionSelector();
156829
157027
  }
156830
157028
  }
156831
- const {
156832
- isImpact,
156833
- mode,
156834
- isEditMode,
156835
- componentSelectedMode,
156836
- isViewOnlyMode,
156837
- componentEditMode,
156838
- componentNodesById,
156839
- activeCanvas,
156840
- saveCanvasContentWithContext,
156841
- removeComponentById,
156842
- setComponentSelectedMode,
156843
- setComponentSettingsMode,
156844
- updateNodeDataById,
156845
- canvasContent
156846
- } = useCanvas$1();
156847
157029
  return (_ctx, _cache) => {
156848
157030
  return openBlock(), createElementBlock(Fragment, null, [
156849
157031
  unref(shouldDisplayPlaceholderComponent)(unref(isEditMode), unref(mode), _ctx.visible) ? (openBlock(), createBlock(PlaceholderComponent, {
@@ -156851,25 +157033,25 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156851
157033
  name: _ctx.tracking_id
156852
157034
  }, null, 8, ["name"])) : unref(isEditMode) && !unref(isViewOnlyMode) ? (openBlock(), createBlock(_sfc_main$34, {
156853
157035
  key: 1,
156854
- id: _ctx.id,
156855
- active: unref(componentEditMode) && unref(componentEditMode)?.id === _ctx.id,
157036
+ id: unref(id),
157037
+ active: unref(componentEditMode) && unref(componentEditMode)?.id === unref(id),
156856
157038
  class: normalizeClass({ "mt-12": sectionListName.value }),
156857
157039
  edit: isEditable.value,
156858
157040
  "exclude-stylables": [unref(ThemeComponentOptionEnum).COLOR_PICKER],
156859
157041
  remove: isRemovable.value,
156860
- selected: unref(componentSelectedMode) && unref(componentSelectedMode)?.id === _ctx.id,
157042
+ selected: unref(componentSelectedMode) && unref(componentSelectedMode)?.id === unref(id),
156861
157043
  settings: "",
156862
157044
  stylable: "",
156863
157045
  style: normalizeStyle(unref(omit$1)(_ctx.style, "paddingBottom", "paddingLeft", "paddingTop", "paddingRight")),
156864
157046
  onEdit: handleEdit,
156865
- onRemove: _cache[0] || (_cache[0] = ($event) => unref(removeComponentById)(_ctx.id)),
156866
- onSelect: _cache[1] || (_cache[1] = ($event) => unref(setComponentSelectedMode)(_ctx.id)),
156867
- onSettings: _cache[2] || (_cache[2] = ($event) => unref(setComponentSettingsMode)(_ctx.id)),
157047
+ onRemove: _cache[0] || (_cache[0] = ($event) => unref(removeComponentById)(unref(id))),
157048
+ onSelect: _cache[1] || (_cache[1] = ($event) => unref(setComponentSelectedMode)(unref(id))),
157049
+ onSettings: _cache[2] || (_cache[2] = ($event) => unref(setComponentSettingsMode)(unref(id))),
156868
157050
  onStyle: _cache[3] || (_cache[3] = ($event) => emit("style", $event))
156869
157051
  }, {
156870
157052
  default: withCtx(() => [
156871
157053
  createVNode(RawSectionList, mergeProps({
156872
- id: _ctx.id,
157054
+ id: unref(id),
156873
157055
  ref_key: "sectionListRef",
156874
157056
  ref: sectionListRef,
156875
157057
  class: "pa-2",
@@ -156887,7 +157069,7 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156887
157069
  _: 1
156888
157070
  }, 8, ["id", "active", "class", "edit", "exclude-stylables", "remove", "selected", "style"])) : (openBlock(), createBlock(RawSectionList, mergeProps({
156889
157071
  key: 2,
156890
- id: _ctx.id,
157072
+ id: unref(id),
156891
157073
  data: _ctx.data
156892
157074
  }, unref(attrs), {
156893
157075
  "has-section-selector-app": !!sectionSelectorAppSrc.value,
@@ -159415,7 +159597,8 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159415
159597
  autofill: {},
159416
159598
  linkable: {},
159417
159599
  autofill_content_types: {},
159418
- when_used_in_section: {}
159600
+ when_used_in_section: {},
159601
+ usedInSectionId: { default: "" }
159419
159602
  },
159420
159603
  emits: ["style"],
159421
159604
  setup(__props, { emit: __emit }) {
@@ -159426,12 +159609,42 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159426
159609
  computed(() => [])
159427
159610
  );
159428
159611
  const { isCompletionWizardEnabled, retriggerWizard } = useCanvasCompletionWizard();
159429
- const isEditable = computed(
159430
- () => isImpact.value ? !props.data.selection_strategy || props.data.selection_strategy === "free" || isCompletionWizardEnabled.value && wizardStepSectionListIds.value.includes(props.id) : true
159431
- );
159432
- const isRemovable = computed(
159433
- () => isImpact.value ? !props.data.selection_strategy || props.data.selection_strategy === "free" : true
159434
- );
159612
+ const {
159613
+ isImpact,
159614
+ mode,
159615
+ isEditMode,
159616
+ componentSelectedMode,
159617
+ isViewOnlyMode,
159618
+ componentEditMode,
159619
+ componentNodesById,
159620
+ activeCanvas,
159621
+ saveCanvasContentWithContext,
159622
+ removeComponentById,
159623
+ setComponentSelectedMode,
159624
+ setComponentSettingsMode,
159625
+ updateNodeDataById,
159626
+ canvasContent
159627
+ } = useCanvas$1();
159628
+ const { id, usedInSectionId, when_used_in_section } = toRefs(props);
159629
+ const componentPermissions = useComponentPermissions({
159630
+ id,
159631
+ usedInSectionId,
159632
+ when_used_in_section
159633
+ });
159634
+ const isEditable = computed(() => {
159635
+ if (!componentPermissions.value.canEdit) return false;
159636
+ if (isImpact.value) {
159637
+ return !props.data.selection_strategy || props.data.selection_strategy === "free" || isCompletionWizardEnabled.value && wizardStepSectionListIds.value.includes(props.id);
159638
+ }
159639
+ return true;
159640
+ });
159641
+ const isRemovable = computed(() => {
159642
+ if (!componentPermissions.value.canRemove) return false;
159643
+ if (isImpact.value) {
159644
+ return !props.data.selection_strategy || props.data.selection_strategy === "free";
159645
+ }
159646
+ return true;
159647
+ });
159435
159648
  const sectionSelectorAppSrc = computed(() => {
159436
159649
  if (!sectionSelectorApps.value?.length || !props.data.selection_app_name) return null;
159437
159650
  const relatedApp = sectionSelectorApps.value.find((app) => app.app_metadata?.name === props.data.selection_app_name);
@@ -159497,7 +159710,7 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159497
159710
  async (selectedData) => {
159498
159711
  console.info(`[SectionList]: Received done callback for ${props.id} with data`, selectedData);
159499
159712
  if (!selectedData) return;
159500
- const sections = (selectedData?.section_ids || []).map((id) => ({ id: typeof id === "string" ? id : id.id }));
159713
+ const sections = (selectedData?.section_ids || []).map((id2) => ({ id: typeof id2 === "string" ? id2 : id2.id }));
159501
159714
  const updatedData = { ...props.data, sections };
159502
159715
  updateNodeDataById(props.id, updatedData);
159503
159716
  const currentContext = cloneDeep(activeCanvas.value?.context || {});
@@ -159523,22 +159736,6 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159523
159736
  contentListRef.value?.toggleSectionSelector();
159524
159737
  }
159525
159738
  }
159526
- const {
159527
- isImpact,
159528
- mode,
159529
- isEditMode,
159530
- componentSelectedMode,
159531
- isViewOnlyMode,
159532
- componentEditMode,
159533
- componentNodesById,
159534
- activeCanvas,
159535
- saveCanvasContentWithContext,
159536
- removeComponentById,
159537
- setComponentSelectedMode,
159538
- setComponentSettingsMode,
159539
- updateNodeDataById,
159540
- canvasContent
159541
- } = useCanvas$1();
159542
159739
  return (_ctx, _cache) => {
159543
159740
  return openBlock(), createElementBlock(Fragment, null, [
159544
159741
  unref(shouldDisplayPlaceholderComponent)(unref(isEditMode), unref(mode), _ctx.visible) ? (openBlock(), createBlock(PlaceholderComponent, {
@@ -159546,25 +159743,25 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159546
159743
  name: _ctx.tracking_id
159547
159744
  }, null, 8, ["name"])) : unref(isEditMode) && !unref(isViewOnlyMode) ? (openBlock(), createBlock(_sfc_main$34, {
159548
159745
  key: 1,
159549
- id: _ctx.id,
159550
- active: unref(componentEditMode) && unref(componentEditMode)?.id === _ctx.id,
159746
+ id: unref(id),
159747
+ active: unref(componentEditMode) && unref(componentEditMode)?.id === unref(id),
159551
159748
  class: normalizeClass({ "mt-12": componentName.value }),
159552
159749
  edit: isEditable.value,
159553
159750
  "exclude-stylables": [unref(ThemeComponentOptionEnum).COLOR_PICKER],
159554
159751
  remove: isRemovable.value,
159555
- selected: unref(componentSelectedMode) && unref(componentSelectedMode)?.id === _ctx.id,
159752
+ selected: unref(componentSelectedMode) && unref(componentSelectedMode)?.id === unref(id),
159556
159753
  settings: "",
159557
159754
  stylable: "",
159558
159755
  style: normalizeStyle(unref(omit$1)(_ctx.style, "paddingBottom", "paddingLeft", "paddingTop", "paddingRight")),
159559
159756
  onEdit: handleEdit,
159560
- onRemove: _cache[0] || (_cache[0] = ($event) => unref(removeComponentById)(_ctx.id)),
159561
- onSelect: _cache[1] || (_cache[1] = ($event) => unref(setComponentSelectedMode)(_ctx.id)),
159562
- onSettings: _cache[2] || (_cache[2] = ($event) => unref(setComponentSettingsMode)(_ctx.id)),
159757
+ onRemove: _cache[0] || (_cache[0] = ($event) => unref(removeComponentById)(unref(id))),
159758
+ onSelect: _cache[1] || (_cache[1] = ($event) => unref(setComponentSelectedMode)(unref(id))),
159759
+ onSettings: _cache[2] || (_cache[2] = ($event) => unref(setComponentSettingsMode)(unref(id))),
159563
159760
  onStyle: _cache[3] || (_cache[3] = ($event) => emit("style", $event))
159564
159761
  }, {
159565
159762
  default: withCtx(() => [
159566
159763
  createVNode(ContentListRaw, mergeProps({
159567
- id: _ctx.id,
159764
+ id: unref(id),
159568
159765
  ref_key: "contentListRef",
159569
159766
  ref: contentListRef,
159570
159767
  class: ["pa-2", props.class],
@@ -159582,7 +159779,7 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159582
159779
  _: 1
159583
159780
  }, 8, ["id", "active", "class", "edit", "exclude-stylables", "remove", "selected", "style"])) : (openBlock(), createBlock(ContentListRaw, mergeProps({
159584
159781
  key: 2,
159585
- id: _ctx.id,
159782
+ id: unref(id),
159586
159783
  data: _ctx.data
159587
159784
  }, unref(attrs), {
159588
159785
  "has-section-selector-app": !!sectionSelectorAppSrc.value,
@@ -162494,7 +162691,7 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
162494
162691
  );
162495
162692
  const areSectionsSystemControlled = computed(() => launchDarkly.value?.are_sections_system_controlled);
162496
162693
  const allowEditOrRemove = computed(
162497
- () => (selectedComponentType.value === ComponentTypes.Text || selectedComponentType.value === ComponentTypes.Carousel || selectedComponentType.value === ComponentTypes.Multimedia) && isAdmin.value && isSection.value
162694
+ () => isAdmin.value && ((selectedComponentType.value === ComponentTypes.Text || selectedComponentType.value === ComponentTypes.Carousel || selectedComponentType.value === ComponentTypes.Multimedia) && isSection.value || launchDarkly.value.enable_template_component_permissions && isCanvasTemplate.value)
162498
162695
  );
162499
162696
  const canSelectSectionListStrategy = computed(
162500
162697
  () => isAdmin.value && isCanvasTemplate.value && isSectionOrContentList.value
@@ -162556,7 +162753,8 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
162556
162753
  formValues.contentGridDataAccessor = value || "";
162557
162754
  }
162558
162755
  function getEditOrRemoveOption() {
162559
- const map = activeSettingsNode.value?.when_used_in_section ?? cloneDeep(defaultWhenUsedInSection);
162756
+ const defaultPermissions = isCanvasTemplate.value && launchDarkly.value.enable_template_component_permissions ? cloneDeep(defaultWhenUsedInTemplate) : cloneDeep(defaultWhenUsedInSection);
162757
+ const map = activeSettingsNode.value?.when_used_in_section ?? defaultPermissions;
162560
162758
  let value = "";
162561
162759
  value += map.is_editable ? "1" : "0";
162562
162760
  value += map.is_removable ? "1" : "0";
@@ -163057,7 +163255,7 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
163057
163255
  }
163058
163256
  });
163059
163257
 
163060
- const ComponentDrawerSettings = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__scopeId", "data-v-dce6a881"]]);
163258
+ const ComponentDrawerSettings = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__scopeId", "data-v-a4296e5c"]]);
163061
163259
 
163062
163260
  function useConnectUpload() {
163063
163261
  async function uploadToConnect(formData) {
@@ -176290,10 +176488,10 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
176290
176488
  __name: "ActionsToolbar",
176291
176489
  setup(__props) {
176292
176490
  useCssVars((_ctx) => ({
176293
- "c6ccac5c": unref(themeVars).primary4,
176294
- "3edbaaa2": unref(themeVars).primary,
176295
- "c6ccac58": unref(themeVars).primary6,
176296
- "0f45ae31": unref(themeVars).base
176491
+ "6b5e9219": unref(themeVars).primary4,
176492
+ "3d451d7b": unref(themeVars).primary,
176493
+ "6b5e921b": unref(themeVars).primary6,
176494
+ "42dfd1f8": unref(themeVars).base
176297
176495
  }));
176298
176496
  const {
176299
176497
  toggleContentPanel,
@@ -176521,7 +176719,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
176521
176719
  return (nameMatch || createdByMatch || tagMatch) && metadataMatch;
176522
176720
  });
176523
176721
  const folderResults = folders.map((folder) => {
176524
- return {
176722
+ const result = {
176525
176723
  id: folder.id,
176526
176724
  name: folder.name,
176527
176725
  folder_id: apiState.currentFolderId,
@@ -176533,6 +176731,11 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
176533
176731
  file_thumbnail_urls: folder.file_thumbnail_urls,
176534
176732
  thumbnail_url: folder.thumbnail_url
176535
176733
  };
176734
+ if (folder.files_count !== void 0) result.files_count = folder.files_count;
176735
+ if (folder.folders_count !== void 0) result.folders_count = folder.folders_count;
176736
+ if (folder.available_files_count !== void 0) result.available_files_count = folder.available_files_count;
176737
+ if (folder.available_folders_count !== void 0) result.available_folders_count = folder.available_folders_count;
176738
+ return result;
176536
176739
  });
176537
176740
  const fileResults = files.map((file) => {
176538
176741
  return {
@@ -176761,7 +176964,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
176761
176964
  }
176762
176965
  });
176763
176966
 
176764
- const ActionsToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-fecebf5a"]]);
176967
+ const ActionsToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-41ca4793"]]);
176765
176968
 
176766
176969
  const _sfc_main$t = /* @__PURE__ */ defineComponent({
176767
176970
  __name: "FavoritesTable",