@pitcher/canvas-ui 2026.1.12-71806 → 2026.1.13-070805-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
@@ -88219,15 +88219,14 @@ async function crmQueryAdaptive(payload) {
88219
88219
  } catch {
88220
88220
  useSmartStore = false;
88221
88221
  }
88222
- console.log(`[crmQueryAdaptive] Called query: `, query2);
88222
+ console.log(`crmQueryAdaptive called with the query: `, query2);
88223
88223
  if (useSmartStore) {
88224
88224
  const fields = extractFieldsFromSoql(query2);
88225
88225
  const objectName = extractObjectFromSoql(query2);
88226
88226
  const smartQuery = convertSoqlToSmartQuery(query2);
88227
- console.log(`[crmSmartQuery] Called query: `, smartQuery);
88227
+ console.log(`Smart Query: `, smartQuery);
88228
88228
  const smartStoreResults = await crmSmartQuery({ query: smartQuery });
88229
88229
  const records = transformSmartStoreResults(smartStoreResults, fields, objectName);
88230
- console.log(`[SmartStore] Results: `, records);
88231
88230
  return {
88232
88231
  records,
88233
88232
  totalSize: records.length
@@ -95685,118 +95684,120 @@ const _hoisted_9$O = {
95685
95684
  class: "flex items-center space-x-1 ml-2"
95686
95685
  };
95687
95686
  const _hoisted_10$C = { class: "flex items-center" };
95688
- const _hoisted_11$x = { key: 0 };
95689
- const _hoisted_12$p = { class: "c-select-filter__popover w-[350px] rounded flex flex-col bg-base" };
95690
- const _hoisted_13$k = { class: "pa-2 max-h-[300px] overflow-y-auto" };
95691
- const _hoisted_14$h = {
95687
+ const _hoisted_11$x = { class: "c-select-filter__popover w-[350px] rounded flex flex-col bg-base" };
95688
+ const _hoisted_12$p = { class: "pa-2 max-h-[300px] overflow-y-auto" };
95689
+ const _hoisted_13$k = {
95692
95690
  key: 0,
95693
95691
  class: "flex items-center ml-2"
95694
95692
  };
95695
- const _hoisted_15$f = {
95696
- key: 2,
95693
+ const _hoisted_14$h = { class: "flex items-center" };
95694
+ const _hoisted_15$f = { class: "c-select-filter__popover w-[350px] rounded flex flex-col bg-base" };
95695
+ const _hoisted_16$e = { class: "pa-2 max-h-[300px] overflow-y-auto" };
95696
+ const _hoisted_17$c = {
95697
+ key: 0,
95697
95698
  class: "flex items-center ml-2"
95698
95699
  };
95699
- const _hoisted_16$e = { class: "flex flex-col w-full flex-1 min-h-0" };
95700
- const _hoisted_17$c = {
95700
+ const _hoisted_18$a = { class: "flex flex-col w-full flex-1 min-h-0" };
95701
+ const _hoisted_19$a = {
95701
95702
  key: 0,
95702
95703
  class: "flex-1 overflow-y-auto bg-white w-full pl-1 pr-6 py-0"
95703
95704
  };
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" };
95709
- const _hoisted_23$5 = ["onClick"];
95710
- const _hoisted_24$5 = {
95705
+ const _hoisted_20$9 = { class: "space-y-1 mt-4" };
95706
+ const _hoisted_21$7 = ["onClick"];
95707
+ const _hoisted_22$5 = { class: "text-sm text-gray-700" };
95708
+ const _hoisted_23$5 = { class: "flex items-center mb-0" };
95709
+ const _hoisted_24$5 = { class: "text-sm font-bold text-gray-700" };
95710
+ const _hoisted_25$5 = ["onClick"];
95711
+ const _hoisted_26$5 = {
95711
95712
  key: 0,
95712
95713
  class: "relative mr-4"
95713
95714
  };
95714
- const _hoisted_25$5 = {
95715
+ const _hoisted_27$5 = {
95715
95716
  key: 0,
95716
95717
  class: "absolute inset-0 flex items-center justify-center bg-gray-200 bg-opacity-75 border-rounded-1"
95717
95718
  };
95718
- const _hoisted_26$5 = {
95719
+ const _hoisted_28$5 = {
95719
95720
  key: 1,
95720
95721
  class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center"
95721
95722
  };
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 = {
95723
+ const _hoisted_29$5 = { class: "flex-1 min-w-0" };
95724
+ const _hoisted_30$4 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95725
+ const _hoisted_31$4 = { class: "text-xs text-gray-500" };
95726
+ const _hoisted_32$4 = {
95726
95727
  key: 1,
95727
95728
  class: "flex-1 overflow-y-auto bg-white w-full"
95728
95729
  };
95729
- const _hoisted_31$4 = { class: "w-full px-0" };
95730
- const _hoisted_32$4 = {
95730
+ const _hoisted_33$4 = { class: "w-full px-0" };
95731
+ const _hoisted_34$4 = {
95731
95732
  key: 0,
95732
95733
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95733
95734
  };
95734
- const _hoisted_33$4 = {
95735
+ const _hoisted_35$4 = {
95735
95736
  key: 0,
95736
95737
  class: "mb-0"
95737
95738
  };
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 = {
95739
+ const _hoisted_36$4 = { class: "flex items-center px-0 pt-2 pb-1" };
95740
+ const _hoisted_37$4 = { class: "text-m font-semibold text-gray-900" };
95741
+ const _hoisted_38$4 = { class: "ml-2 text-sm text-gray-500" };
95742
+ const _hoisted_39$4 = ["data-result-selected", "onClick"];
95743
+ const _hoisted_40$4 = {
95743
95744
  key: 1,
95744
95745
  class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center"
95745
95746
  };
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 = {
95747
+ const _hoisted_41$4 = { class: "flex-1 min-w-0" };
95748
+ const _hoisted_42$4 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95749
+ const _hoisted_43$4 = ["innerHTML"];
95750
+ const _hoisted_44$4 = { class: "text-xs text-gray-500" };
95751
+ const _hoisted_45$4 = { class: "text-xs text-gray-400" };
95752
+ const _hoisted_46$4 = {
95752
95753
  key: 0,
95753
95754
  class: "px-0 py-0"
95754
95755
  };
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 = {
95756
+ const _hoisted_47$4 = { key: 1 };
95757
+ const _hoisted_48$4 = { class: "flex items-center px-0 pt-2 pb-1" };
95758
+ const _hoisted_49$4 = { class: "text-m font-semibold text-gray-900" };
95759
+ const _hoisted_50$4 = { class: "ml-2 text-sm text-gray-500" };
95760
+ const _hoisted_51$3 = ["data-result-selected", "onClick"];
95761
+ const _hoisted_52$3 = { class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center" };
95762
+ const _hoisted_53$3 = { class: "flex-1 min-w-0" };
95763
+ const _hoisted_54$2 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95764
+ const _hoisted_55$2 = { class: "text-xs text-gray-500" };
95765
+ const _hoisted_56$2 = { class: "text-xs text-gray-400" };
95766
+ const _hoisted_57$2 = {
95766
95767
  key: 0,
95767
95768
  class: "px-0 py-0"
95768
95769
  };
95769
- const _hoisted_56$2 = {
95770
+ const _hoisted_58$2 = {
95770
95771
  key: 2,
95771
95772
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95772
95773
  };
95773
- const _hoisted_57$2 = {
95774
+ const _hoisted_59$2 = {
95774
95775
  key: 2,
95775
95776
  class: "flex-1 overflow-y-auto bg-white w-full"
95776
95777
  };
95777
- const _hoisted_58$2 = { class: "w-full px-0" };
95778
- const _hoisted_59$2 = {
95778
+ const _hoisted_60$2 = { class: "w-full px-0" };
95779
+ const _hoisted_61$2 = {
95779
95780
  key: 0,
95780
95781
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95781
95782
  };
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 = {
95783
+ const _hoisted_62$2 = { class: "flex items-center px-0 pt-2 pb-1" };
95784
+ const _hoisted_63$2 = { class: "text-m font-semibold text-gray-900" };
95785
+ const _hoisted_64$2 = { class: "ml-2 text-sm text-gray-500" };
95786
+ const _hoisted_65$2 = ["data-result-selected", "onClick"];
95787
+ const _hoisted_66$2 = {
95787
95788
  key: 1,
95788
95789
  class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center"
95789
95790
  };
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 = {
95791
+ const _hoisted_67$2 = { class: "flex-1 min-w-0" };
95792
+ const _hoisted_68$2 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95793
+ const _hoisted_69$1 = ["innerHTML"];
95794
+ const _hoisted_70$1 = { class: "text-xs text-gray-500" };
95795
+ const _hoisted_71$1 = { class: "text-xs text-gray-400" };
95796
+ const _hoisted_72$1 = {
95796
95797
  key: 0,
95797
95798
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95798
95799
  };
95799
- const _hoisted_71$1 = {
95800
+ const _hoisted_73$1 = {
95800
95801
  key: 0,
95801
95802
  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
95803
  };
@@ -95820,9 +95821,10 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95820
95821
  const showRecentView = ref(true);
95821
95822
  const suggestionsDropdownRef = ref(null);
95822
95823
  const searchInputRef = ref(null);
95823
- const selectedFileTypes = ref([]);
95824
+ const selectedFileType = ref(null);
95824
95825
  const showFileTypeDropdown = ref(false);
95825
- const selectedCanvasFilters = ref([]);
95826
+ const selectedCanvasFilter = ref(null);
95827
+ const showCanvasTypeDropdown = ref(false);
95826
95828
  const fileTypeOptions = [
95827
95829
  { label: "Folder", value: "folder" },
95828
95830
  { label: "PDF", value: "pdf" },
@@ -95835,17 +95837,55 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95835
95837
  { label: "AR", value: "ar" },
95836
95838
  { label: "Web", value: "web" }
95837
95839
  ];
95838
- const hasActiveFilters = computed(() => selectedFileTypes.value.length > 0 || selectedCanvasFilters.value.length > 0);
95840
+ const canvasTypeOptions = computed(() => {
95841
+ const options = [
95842
+ { label: t("canvasUI.CAlgoliaSearch.canvasFilters.templates"), value: "template" },
95843
+ { label: t("canvasUI.CAlgoliaSearch.canvasFilters.products"), value: "section" },
95844
+ { label: t("canvasUI.CAlgoliaSearch.canvasFilters.blocks"), value: "block" }
95845
+ ];
95846
+ if (!props.isAdmin) {
95847
+ options.unshift({ label: t("canvasUI.CAlgoliaSearch.canvasFilters.saved"), value: "saved_canvas" });
95848
+ }
95849
+ if (props.isAdmin) {
95850
+ options.splice(1, 0, {
95851
+ label: t("canvasUI.CAlgoliaSearch.canvasFilters.productTemplates"),
95852
+ value: "product_template"
95853
+ });
95854
+ }
95855
+ return options;
95856
+ });
95857
+ const ALLOWED_CANVAS_TYPES = ["saved_canvas", "template", "product_template", "section", "block"];
95858
+ const ALLOWED_FILE_TYPES = [
95859
+ "folder",
95860
+ "pdf",
95861
+ "image",
95862
+ "audio",
95863
+ "video",
95864
+ "document",
95865
+ "presentation",
95866
+ "spreadsheet",
95867
+ "ar",
95868
+ "web"
95869
+ ];
95870
+ const visibleCanvasTypeOptions = computed(() => {
95871
+ if (showRecentView.value || !searchQuery.value.trim()) {
95872
+ return canvasTypeOptions.value;
95873
+ }
95874
+ return canvasTypeOptions.value.filter((option) => availableCanvasTypes.value.has(option.value));
95875
+ });
95876
+ const hasActiveFilters = computed(() => selectedFileType.value !== null || selectedCanvasFilter.value !== null);
95839
95877
  const clearAllFilters = () => {
95840
- selectedFileTypes.value = [];
95841
- selectedCanvasFilters.value = [];
95878
+ selectedFileType.value = null;
95879
+ selectedCanvasFilter.value = null;
95842
95880
  debouncedFilterSearch();
95843
95881
  };
95844
95882
  const handleEverywhereClick = async () => {
95845
- selectedFileTypes.value = [];
95846
- selectedCanvasFilters.value = [];
95883
+ selectedFileType.value = null;
95884
+ selectedCanvasFilter.value = null;
95847
95885
  searchType.value = null;
95848
- if (searchQuery.value.trim()) {
95886
+ if (searchQuery.value.trim() && (unfilteredContentResults.value.length > 0 || unfilteredCanvasResults.value.length > 0)) {
95887
+ applyFiltersToResults();
95888
+ } else if (searchQuery.value.trim()) {
95849
95889
  try {
95850
95890
  skipNextSuggestionFetch.value = true;
95851
95891
  await performSearch(searchQuery.value);
@@ -95981,8 +96021,11 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95981
96021
  };
95982
96022
  const contentResults = ref([]);
95983
96023
  const canvasResults = ref([]);
96024
+ const unfilteredContentResults = ref([]);
96025
+ const unfilteredCanvasResults = ref([]);
95984
96026
  const isSearching = ref(false);
95985
96027
  const hasSearchCompleted = ref(false);
96028
+ let currentSearchId = 0;
95986
96029
  const querySuggestions = ref([]);
95987
96030
  const selectedSuggestionIndex = ref(-1);
95988
96031
  const selectedResultIndex = ref(-1);
@@ -95999,6 +96042,44 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95999
96042
  }
96000
96043
  return canvasResults.value;
96001
96044
  });
96045
+ const availableFileTypes = computed(() => {
96046
+ if (showRecentView.value || !searchQuery.value.trim()) {
96047
+ return /* @__PURE__ */ new Set();
96048
+ }
96049
+ const types = /* @__PURE__ */ new Set();
96050
+ unfilteredContentResults.value.forEach((item) => {
96051
+ if (item.type === "folder") {
96052
+ types.add("folder");
96053
+ } else if (item.type === "file" && item.file_category) {
96054
+ types.add(item.file_category);
96055
+ }
96056
+ });
96057
+ return types;
96058
+ });
96059
+ const availableCanvasTypes = computed(() => {
96060
+ if (showRecentView.value || !searchQuery.value.trim()) {
96061
+ return /* @__PURE__ */ new Set();
96062
+ }
96063
+ const types = /* @__PURE__ */ new Set();
96064
+ unfilteredCanvasResults.value.forEach((item) => {
96065
+ if (item.content_type) {
96066
+ types.add(item.content_type);
96067
+ }
96068
+ });
96069
+ return types;
96070
+ });
96071
+ const visibleFileTypeOptions = computed(() => {
96072
+ if (showRecentView.value || !searchQuery.value.trim()) {
96073
+ return fileTypeOptions;
96074
+ }
96075
+ return fileTypeOptions.filter((option) => availableFileTypes.value.has(option.value));
96076
+ });
96077
+ const hasContentFilters = computed(() => {
96078
+ return visibleFileTypeOptions.value.length > 0 || selectedFileType.value !== null;
96079
+ });
96080
+ const hasCanvasFilters = computed(() => {
96081
+ return visibleCanvasTypeOptions.value.length > 0 || selectedCanvasFilter.value !== null;
96082
+ });
96002
96083
  const shouldShowNoResults = computed(() => {
96003
96084
  if (showRecentView.value || !searchQuery.value.trim() || isSearching.value || !hasSearchCompleted.value) return false;
96004
96085
  if (searchType.value === "content") {
@@ -96042,6 +96123,30 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96042
96123
  };
96043
96124
  watch(searchType, () => {
96044
96125
  selectedResultIndex.value = -1;
96126
+ showFileTypeDropdown.value = false;
96127
+ showCanvasTypeDropdown.value = false;
96128
+ });
96129
+ watch(visibleFileTypeOptions, (newOptions) => {
96130
+ if (selectedFileType.value) {
96131
+ const isStillAvailable = newOptions.some((option) => option.value === selectedFileType.value);
96132
+ if (!isStillAvailable) {
96133
+ selectedFileType.value = null;
96134
+ if (searchQuery.value.trim()) {
96135
+ performSearch(searchQuery.value.trim());
96136
+ }
96137
+ }
96138
+ }
96139
+ });
96140
+ watch(visibleCanvasTypeOptions, (newOptions) => {
96141
+ if (selectedCanvasFilter.value) {
96142
+ const isStillAvailable = newOptions.some((option) => option.value === selectedCanvasFilter.value);
96143
+ if (!isStillAvailable) {
96144
+ selectedCanvasFilter.value = null;
96145
+ if (searchQuery.value.trim()) {
96146
+ performSearch(searchQuery.value.trim());
96147
+ }
96148
+ }
96149
+ }
96045
96150
  });
96046
96151
  const scrollSelectedResultIntoView = () => {
96047
96152
  nextTick(() => {
@@ -96085,6 +96190,8 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96085
96190
  if (!query.trim()) {
96086
96191
  contentResults.value = [];
96087
96192
  canvasResults.value = [];
96193
+ unfilteredContentResults.value = [];
96194
+ unfilteredCanvasResults.value = [];
96088
96195
  hasSearchCompleted.value = false;
96089
96196
  isSearching.value = false;
96090
96197
  searchError.value = null;
@@ -96093,59 +96200,47 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96093
96200
  isSearching.value = true;
96094
96201
  hasSearchCompleted.value = false;
96095
96202
  searchError.value = null;
96203
+ const searchId = ++currentSearchId;
96096
96204
  const shouldSkipSuggestionFetch = skipNextSuggestionFetch.value;
96097
96205
  if (shouldSkipSuggestionFetch) {
96098
96206
  skipNextSuggestionFetch.value = false;
96099
96207
  }
96100
96208
  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);
96124
- selectedCanvasFilters.value = validCanvasFilters;
96125
- }
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);
96137
- selectedFileTypes.value = validFileTypes;
96209
+ const validCanvasFilter = selectedCanvasFilter.value && ALLOWED_CANVAS_TYPES.includes(selectedCanvasFilter.value) ? selectedCanvasFilter.value : null;
96210
+ if (selectedCanvasFilter.value && !validCanvasFilter) {
96211
+ console.warn("[CAlgoliaSearch] Selected canvas filter is invalid and was removed:", selectedCanvasFilter.value);
96212
+ selectedCanvasFilter.value = null;
96213
+ }
96214
+ const validFileType = selectedFileType.value && ALLOWED_FILE_TYPES.includes(selectedFileType.value) ? selectedFileType.value : null;
96215
+ if (selectedFileType.value && !validFileType) {
96216
+ console.warn("[CAlgoliaSearch] Selected file type filter is invalid and was removed:", selectedFileType.value);
96217
+ selectedFileType.value = null;
96138
96218
  }
96139
- const contentFilters = validFileTypes.length > 0 ? ` AND (${validFileTypes.map((type) => type === "folder" ? `type:"${type}"` : `file_category:"${type}"`).join(" OR ")})` : "";
96140
96219
  const results = await searchViaBackend(query.trim(), {
96141
- canvas: canvasFilters,
96142
- content: contentFilters
96220
+ canvas: "",
96221
+ content: ""
96143
96222
  });
96144
96223
  if (query.trim() !== searchQuery.value.trim()) {
96145
96224
  return;
96146
96225
  }
96147
- contentResults.value = results.content?.hits || [];
96148
- canvasResults.value = results.canvas?.hits || [];
96226
+ unfilteredContentResults.value = results.content?.hits || [];
96227
+ unfilteredCanvasResults.value = results.canvas?.hits || [];
96228
+ let filteredContent = unfilteredContentResults.value;
96229
+ let filteredCanvas = unfilteredCanvasResults.value;
96230
+ if (validFileType) {
96231
+ filteredContent = filteredContent.filter((item) => {
96232
+ if (validFileType === "folder") {
96233
+ return item.type === "folder";
96234
+ } else {
96235
+ return item.type === "file" && item.file_category === validFileType;
96236
+ }
96237
+ });
96238
+ }
96239
+ if (validCanvasFilter) {
96240
+ filteredCanvas = filteredCanvas.filter((item) => item.content_type === validCanvasFilter);
96241
+ }
96242
+ contentResults.value = filteredContent;
96243
+ canvasResults.value = filteredCanvas;
96149
96244
  selectedResultIndex.value = -1;
96150
96245
  searchError.value = null;
96151
96246
  if (query.trim().length >= 2 && !shouldSkipSuggestionFetch) {
@@ -96158,23 +96253,27 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96158
96253
  }
96159
96254
  await nextTick();
96160
96255
  setTimeout(() => {
96161
- isSearching.value = false;
96162
- hasSearchCompleted.value = true;
96256
+ if (searchId === currentSearchId) {
96257
+ isSearching.value = false;
96258
+ hasSearchCompleted.value = true;
96259
+ }
96163
96260
  }, 50);
96164
96261
  } catch (error) {
96165
96262
  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";
96263
+ if (searchId === currentSearchId) {
96264
+ contentResults.value = [];
96265
+ canvasResults.value = [];
96266
+ isSearching.value = false;
96267
+ hasSearchCompleted.value = true;
96268
+ if (error.message === "AUTH_REQUIRED") {
96269
+ searchError.value = "Please sign in to search";
96270
+ } else if (error.message === "AUTH_EXPIRED") {
96271
+ searchError.value = "Your session has expired. Please sign in again";
96272
+ } else if (error.message === "AUTH_FORBIDDEN") {
96273
+ searchError.value = "You do not have permission to search this instance";
96274
+ } else {
96275
+ searchError.value = "Search failed. Please try again";
96276
+ }
96178
96277
  }
96179
96278
  }
96180
96279
  };
@@ -96184,19 +96283,36 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96184
96283
  if (!query || typeof query !== "string") return "";
96185
96284
  return query;
96186
96285
  }
96286
+ function applyFiltersToResults() {
96287
+ if (unfilteredContentResults.value.length === 0 && unfilteredCanvasResults.value.length === 0) {
96288
+ return;
96289
+ }
96290
+ const validFileType = selectedFileType.value ? ALLOWED_FILE_TYPES.includes(selectedFileType.value) ? selectedFileType.value : null : null;
96291
+ const validCanvasFilter = selectedCanvasFilter.value ? ALLOWED_CANVAS_TYPES.includes(selectedCanvasFilter.value) ? selectedCanvasFilter.value : null : null;
96292
+ let filteredContent = unfilteredContentResults.value;
96293
+ let filteredCanvas = unfilteredCanvasResults.value;
96294
+ if (validFileType) {
96295
+ filteredContent = filteredContent.filter((item) => {
96296
+ if (validFileType === "folder") {
96297
+ return item.type === "folder";
96298
+ } else {
96299
+ return item.type === "file" && item.file_category === validFileType;
96300
+ }
96301
+ });
96302
+ }
96303
+ if (validCanvasFilter) {
96304
+ filteredCanvas = filteredCanvas.filter((item) => item.content_type === validCanvasFilter);
96305
+ }
96306
+ contentResults.value = filteredContent;
96307
+ canvasResults.value = filteredCanvas;
96308
+ selectedResultIndex.value = -1;
96309
+ }
96187
96310
  const debouncedFilterSearch = () => {
96188
96311
  if (filterChangeTimer) clearTimeout(filterChangeTimer);
96189
96312
  if (searchTimer) clearTimeout(searchTimer);
96190
96313
  filterChangeTimer = setTimeout(async () => {
96191
96314
  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
- }
96315
+ applyFiltersToResults();
96200
96316
  }
96201
96317
  }, 500);
96202
96318
  };
@@ -96222,6 +96338,8 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96222
96338
  showRecentView.value = true;
96223
96339
  contentResults.value = [];
96224
96340
  canvasResults.value = [];
96341
+ unfilteredContentResults.value = [];
96342
+ unfilteredCanvasResults.value = [];
96225
96343
  querySuggestions.value = [];
96226
96344
  selectedSuggestionIndex.value = -1;
96227
96345
  selectedResultIndex.value = -1;
@@ -96235,6 +96353,8 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96235
96353
  showRecentView.value = true;
96236
96354
  contentResults.value = [];
96237
96355
  canvasResults.value = [];
96356
+ unfilteredContentResults.value = [];
96357
+ unfilteredCanvasResults.value = [];
96238
96358
  querySuggestions.value = [];
96239
96359
  selectedSuggestionIndex.value = -1;
96240
96360
  selectedResultIndex.value = -1;
@@ -96359,33 +96479,23 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96359
96479
  if (endChar < highlightValue.length) truncated = truncated + "...";
96360
96480
  return sanitizeHtml(truncated);
96361
96481
  };
96362
- const toggleCanvasFilter = (filterType) => {
96363
- if (selectedCanvasFilters.value.includes(filterType)) {
96364
- selectedCanvasFilters.value.splice(selectedCanvasFilters.value.indexOf(filterType), 1);
96365
- } else {
96366
- selectedCanvasFilters.value.push(filterType);
96367
- }
96482
+ const handleCanvasTypeChange = (value) => {
96483
+ selectedCanvasFilter.value = value;
96484
+ showCanvasTypeDropdown.value = false;
96368
96485
  debouncedFilterSearch();
96369
96486
  };
96370
- const clearCanvasFilters = () => {
96371
- selectedCanvasFilters.value = [];
96487
+ const clearCanvasFilter = () => {
96488
+ selectedCanvasFilter.value = null;
96489
+ showCanvasTypeDropdown.value = false;
96372
96490
  debouncedFilterSearch();
96373
96491
  };
96374
- const toggleFileType = (fileType, checked) => {
96375
- if (checked) {
96376
- if (!selectedFileTypes.value.includes(fileType)) {
96377
- selectedFileTypes.value.push(fileType);
96378
- }
96379
- } else {
96380
- const index = selectedFileTypes.value.indexOf(fileType);
96381
- if (index > -1) {
96382
- selectedFileTypes.value.splice(index, 1);
96383
- }
96384
- }
96492
+ const handleFileTypeChange = (value) => {
96493
+ selectedFileType.value = value;
96494
+ showFileTypeDropdown.value = false;
96385
96495
  debouncedFilterSearch();
96386
96496
  };
96387
- const clearFileTypes = () => {
96388
- selectedFileTypes.value = [];
96497
+ const clearFileType = () => {
96498
+ selectedFileType.value = null;
96389
96499
  showFileTypeDropdown.value = false;
96390
96500
  debouncedFilterSearch();
96391
96501
  };
@@ -96554,7 +96664,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96554
96664
  show: "",
96555
96665
  verticalAlignment: "top",
96556
96666
  "z-index": _ctx.zIndex,
96557
- "onUpdate:show": _cache[15] || (_cache[15] = ($event) => emit("toggleSearch", $event))
96667
+ "onUpdate:show": _cache[14] || (_cache[14] = ($event) => emit("toggleSearch", $event))
96558
96668
  }, {
96559
96669
  default: withCtx(() => [
96560
96670
  createElementVNode("div", {
@@ -96563,7 +96673,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96563
96673
  }, [
96564
96674
  createElementVNode("div", _hoisted_1$4w, [
96565
96675
  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" }, [
96676
+ _cache[15] || (_cache[15] = createElementVNode("div", { class: "absolute left-2.5 top-1/2 transform -translate-y-1/2 z-10" }, [
96567
96677
  createElementVNode("i", { class: "c-icon far fa-search text-gray-400 text-l" })
96568
96678
  ], -1)),
96569
96679
  withDirectives(createElementVNode("input", {
@@ -96660,7 +96770,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96660
96770
  createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.tabs.pitchDecks")), 1)
96661
96771
  ], 2)) : createCommentVNode("", true)
96662
96772
  ]),
96663
- searchType.value ? (openBlock(), createElementBlock("div", _hoisted_9$O, [
96773
+ searchType.value && (searchType.value === "content" && hasContentFilters.value || searchType.value === "canvases" && hasCanvasFilters.value) ? (openBlock(), createElementBlock("div", _hoisted_9$O, [
96664
96774
  searchType.value === "content" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
96665
96775
  createVNode(unref(NPopover), {
96666
96776
  class: "c-select-filter",
@@ -96669,13 +96779,13 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96669
96779
  show: showFileTypeDropdown.value,
96670
96780
  "show-arrow": false,
96671
96781
  trigger: "manual",
96672
- onClickoutside: _cache[7] || (_cache[7] = ($event) => showFileTypeDropdown.value = false)
96782
+ onClickoutside: _cache[8] || (_cache[8] = ($event) => showFileTypeDropdown.value = false)
96673
96783
  }, {
96674
96784
  trigger: withCtx(() => [
96675
96785
  createVNode(unref(NTag), {
96676
96786
  class: "select-none cursor-pointer",
96677
96787
  style: normalizeStyle({
96678
- "--n-color": selectedFileTypes.value.length ? "var(--p-primary5)" : "var(--p-primary6)",
96788
+ "--n-color": selectedFileType.value ? "var(--p-primary5)" : "var(--p-primary6)",
96679
96789
  "--n-border": "1px solid var(--p-primary5)",
96680
96790
  "--n-height": "28px"
96681
96791
  }),
@@ -96686,34 +96796,42 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96686
96796
  }, {
96687
96797
  default: withCtx(() => [
96688
96798
  createElementVNode("div", _hoisted_10$C, [
96689
- createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.type")), 1),
96690
- selectedFileTypes.value.length ? (openBlock(), createElementBlock("span", _hoisted_11$x, ": " + toDisplayString(selectedFileTypes.value.length), 1)) : createCommentVNode("", true)
96799
+ createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.type")), 1)
96691
96800
  ])
96692
96801
  ]),
96693
96802
  _: 1
96694
96803
  }, 8, ["style"])
96695
96804
  ]),
96696
96805
  default: withCtx(() => [
96697
- createElementVNode("div", _hoisted_12$p, [
96698
- createElementVNode("div", _hoisted_13$k, [
96699
- (openBlock(), createElementBlock(Fragment, null, renderList(fileTypeOptions, (option) => {
96700
- return createElementVNode("div", {
96701
- key: option.value,
96702
- class: "w-full h-7 flex items-center"
96703
- }, [
96704
- createVNode(unref(NCheckbox), {
96705
- checked: selectedFileTypes.value.includes(option.value),
96706
- class: "px-2 truncate",
96707
- "onUpdate:checked": (v) => toggleFileType(option.value, v),
96708
- value: option.value
96709
- }, {
96710
- default: withCtx(() => [
96711
- createTextVNode(toDisplayString(option.label), 1)
96712
- ]),
96713
- _: 2
96714
- }, 1032, ["checked", "onUpdate:checked", "value"])
96715
- ]);
96716
- }), 64))
96806
+ createElementVNode("div", _hoisted_11$x, [
96807
+ createElementVNode("div", _hoisted_12$p, [
96808
+ createVNode(unref(NRadioGroup), {
96809
+ value: selectedFileType.value,
96810
+ "onUpdate:value": [
96811
+ _cache[7] || (_cache[7] = ($event) => selectedFileType.value = $event),
96812
+ handleFileTypeChange
96813
+ ]
96814
+ }, {
96815
+ default: withCtx(() => [
96816
+ (openBlock(true), createElementBlock(Fragment, null, renderList(visibleFileTypeOptions.value, (option) => {
96817
+ return openBlock(), createElementBlock("div", {
96818
+ key: option.value,
96819
+ class: "w-full h-7 flex items-center"
96820
+ }, [
96821
+ createVNode(unref(NRadio), {
96822
+ class: "px-2 truncate",
96823
+ value: option.value
96824
+ }, {
96825
+ default: withCtx(() => [
96826
+ createTextVNode(toDisplayString(option.label), 1)
96827
+ ]),
96828
+ _: 2
96829
+ }, 1032, ["value"])
96830
+ ]);
96831
+ }), 128))
96832
+ ]),
96833
+ _: 1
96834
+ }, 8, ["value"])
96717
96835
  ]),
96718
96836
  createElementVNode("div", {
96719
96837
  class: "pa-2",
@@ -96723,7 +96841,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96723
96841
  block: "",
96724
96842
  class: "pa-2",
96725
96843
  text: "",
96726
- onClick: clearFileTypes
96844
+ onClick: clearFileType
96727
96845
  }, {
96728
96846
  default: withCtx(() => [
96729
96847
  createTextVNode(toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.clear")), 1)
@@ -96735,115 +96853,109 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96735
96853
  ]),
96736
96854
  _: 1
96737
96855
  }, 8, ["show"]),
96738
- 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)),
96856
+ hasActiveFilters.value ? (openBlock(), createElementBlock("div", _hoisted_13$k, [
96857
+ _cache[16] || (_cache[16] = createElementVNode("div", { class: "h-6 w-px bg-gray-300 mx-2" }, null, -1)),
96740
96858
  createElementVNode("span", {
96741
96859
  class: "text-sm text-gray-600 hover:text-gray-800 font-normal cursor-pointer",
96742
96860
  onClick: clearAllFilters
96743
96861
  }, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.clear")), 1)
96744
96862
  ])) : createCommentVNode("", true)
96745
96863
  ], 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"))
96864
+ createVNode(unref(NPopover), {
96865
+ class: "c-select-filter",
96866
+ placement: "bottom-start",
96867
+ raw: "",
96868
+ show: showCanvasTypeDropdown.value,
96869
+ "show-arrow": false,
96870
+ trigger: "manual",
96871
+ onClickoutside: _cache[11] || (_cache[11] = ($event) => showCanvasTypeDropdown.value = false)
96810
96872
  }, {
96811
- default: withCtx(() => [
96812
- createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.canvasFilters.products")), 1)
96873
+ trigger: withCtx(() => [
96874
+ createVNode(unref(NTag), {
96875
+ class: "select-none cursor-pointer",
96876
+ style: normalizeStyle({
96877
+ "--n-color": selectedCanvasFilter.value ? "var(--p-primary5)" : "var(--p-primary6)",
96878
+ "--n-border": "1px solid var(--p-primary5)",
96879
+ "--n-height": "28px"
96880
+ }),
96881
+ themeOverrides: {
96882
+ borderRadius: "4px"
96883
+ },
96884
+ onClick: _cache[9] || (_cache[9] = ($event) => showCanvasTypeDropdown.value = !showCanvasTypeDropdown.value)
96885
+ }, {
96886
+ default: withCtx(() => [
96887
+ createElementVNode("div", _hoisted_14$h, [
96888
+ createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.type")), 1)
96889
+ ])
96890
+ ]),
96891
+ _: 1
96892
+ }, 8, ["style"])
96813
96893
  ]),
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
96894
  default: withCtx(() => [
96829
- createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.canvasFilters.blocks")), 1)
96895
+ createElementVNode("div", _hoisted_15$f, [
96896
+ createElementVNode("div", _hoisted_16$e, [
96897
+ createVNode(unref(NRadioGroup), {
96898
+ value: selectedCanvasFilter.value,
96899
+ "onUpdate:value": [
96900
+ _cache[10] || (_cache[10] = ($event) => selectedCanvasFilter.value = $event),
96901
+ handleCanvasTypeChange
96902
+ ]
96903
+ }, {
96904
+ default: withCtx(() => [
96905
+ (openBlock(true), createElementBlock(Fragment, null, renderList(visibleCanvasTypeOptions.value, (option) => {
96906
+ return openBlock(), createElementBlock("div", {
96907
+ key: option.value,
96908
+ class: "w-full h-7 flex items-center"
96909
+ }, [
96910
+ createVNode(unref(NRadio), {
96911
+ class: "px-2 truncate",
96912
+ value: option.value
96913
+ }, {
96914
+ default: withCtx(() => [
96915
+ createTextVNode(toDisplayString(option.label), 1)
96916
+ ]),
96917
+ _: 2
96918
+ }, 1032, ["value"])
96919
+ ]);
96920
+ }), 128))
96921
+ ]),
96922
+ _: 1
96923
+ }, 8, ["value"])
96924
+ ]),
96925
+ createElementVNode("div", {
96926
+ class: "pa-2",
96927
+ style: normalizeStyle({ borderTop: `1px solid ${unref(themeVars).primary5}` })
96928
+ }, [
96929
+ createVNode(CButton, {
96930
+ block: "",
96931
+ class: "pa-2",
96932
+ text: "",
96933
+ onClick: clearCanvasFilter
96934
+ }, {
96935
+ default: withCtx(() => [
96936
+ createTextVNode(toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.clear")), 1)
96937
+ ]),
96938
+ _: 1
96939
+ })
96940
+ ], 4)
96941
+ ])
96830
96942
  ]),
96831
96943
  _: 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)),
96944
+ }, 8, ["show"]),
96945
+ hasActiveFilters.value ? (openBlock(), createElementBlock("div", _hoisted_17$c, [
96946
+ _cache[17] || (_cache[17] = createElementVNode("div", { class: "h-6 w-px bg-gray-300 mx-2" }, null, -1)),
96835
96947
  createElementVNode("span", {
96836
96948
  class: "text-sm text-gray-600 hover:text-gray-800 font-normal cursor-pointer",
96837
- onClick: clearCanvasFilters
96949
+ onClick: clearAllFilters
96838
96950
  }, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.clear")), 1)
96839
96951
  ])) : createCommentVNode("", true)
96840
96952
  ], 64)) : createCommentVNode("", true)
96841
96953
  ])) : createCommentVNode("", true)
96842
96954
  ])) : createCommentVNode("", true)
96843
96955
  ]),
96844
- createElementVNode("div", _hoisted_16$e, [
96845
- showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_17$c, [
96846
- createElementVNode("div", _hoisted_18$a, [
96956
+ createElementVNode("div", _hoisted_18$a, [
96957
+ showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_19$a, [
96958
+ createElementVNode("div", _hoisted_20$9, [
96847
96959
  (openBlock(true), createElementBlock(Fragment, null, renderList(recentSearches.value, (search) => {
96848
96960
  return openBlock(), createElementBlock("div", {
96849
96961
  key: search,
@@ -96856,14 +96968,14 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96856
96968
  icon: "clock-rotate-left",
96857
96969
  size: "16"
96858
96970
  }),
96859
- createElementVNode("span", _hoisted_20$9, toDisplayString(search), 1)
96860
- ], 8, _hoisted_19$a);
96971
+ createElementVNode("span", _hoisted_22$5, toDisplayString(search), 1)
96972
+ ], 8, _hoisted_21$7);
96861
96973
  }), 128))
96862
96974
  ]),
96863
96975
  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)
96976
+ _cache[18] || (_cache[18] = createElementVNode("hr", { class: "border-0 h-px bg-gray-200 mt-2 mb-3 w-full" }, null, -1)),
96977
+ createElementVNode("div", _hoisted_23$5, [
96978
+ createElementVNode("span", _hoisted_24$5, toDisplayString(unref(t)("canvasUI.components.fileViewer.recentlyOpened")), 1)
96867
96979
  ]),
96868
96980
  createElementVNode("div", {
96869
96981
  class: normalizeClass(_ctx.isAdmin ? "space-y-2" : "space-y-0")
@@ -96877,7 +96989,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96877
96989
  ]),
96878
96990
  onClick: ($event) => handleRecentDocClick(doc, doc.type)
96879
96991
  }, [
96880
- doc.type === "file" ? (openBlock(), createElementBlock("div", _hoisted_24$5, [
96992
+ doc.type === "file" ? (openBlock(), createElementBlock("div", _hoisted_26$5, [
96881
96993
  createVNode(_sfc_main$6K, {
96882
96994
  class: "h-14 border-rounded-1 overflow-hidden flex-0",
96883
96995
  cover: "",
@@ -96886,7 +96998,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96886
96998
  src: recentThumbnails.value[doc.id] || "",
96887
96999
  width: "72"
96888
97000
  }, null, 8, ["file-data", "src"]),
96889
- isLoadingThumbnails.value && !recentThumbnails.value[doc.id] ? (openBlock(), createElementBlock("div", _hoisted_25$5, [
97001
+ isLoadingThumbnails.value && !recentThumbnails.value[doc.id] ? (openBlock(), createElementBlock("div", _hoisted_27$5, [
96890
97002
  createVNode(CIcon, {
96891
97003
  class: "animate-spin",
96892
97004
  color: "var(--p-primary)",
@@ -96894,7 +97006,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96894
97006
  size: "20"
96895
97007
  })
96896
97008
  ])) : createCommentVNode("", true)
96897
- ])) : (openBlock(), createElementBlock("div", _hoisted_26$5, [
97009
+ ])) : (openBlock(), createElementBlock("div", _hoisted_28$5, [
96898
97010
  doc.type === "canvas" ? (openBlock(), createBlock(CIcon, {
96899
97011
  key: 0,
96900
97012
  color: "var(--p-text2)",
@@ -96907,33 +97019,33 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96907
97019
  size: "32"
96908
97020
  }))
96909
97021
  ])),
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)
97022
+ createElementVNode("div", _hoisted_29$5, [
97023
+ createElementVNode("h3", _hoisted_30$4, toDisplayString(doc.name), 1),
97024
+ createElementVNode("p", _hoisted_31$4, toDisplayString(doc.type === "canvas" ? formatCanvasType(doc.content_type) : doc.type === "folder" ? "Folder" : doc.file_category || "File"), 1)
96913
97025
  ])
96914
- ], 10, _hoisted_23$5);
97026
+ ], 10, _hoisted_25$5);
96915
97027
  }), 128))
96916
97028
  ], 2)
96917
97029
  ], 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, [
97030
+ ])) : !searchType.value ? (openBlock(), createElementBlock("div", _hoisted_32$4, [
97031
+ createElementVNode("div", _hoisted_33$4, [
97032
+ isSearching.value ? (openBlock(), createElementBlock("div", _hoisted_34$4, [
96921
97033
  createVNode(CIcon, {
96922
97034
  class: "animate-spin text-6xl",
96923
97035
  color: "var(--p-primary)",
96924
97036
  icon: "spinner"
96925
97037
  })
96926
97038
  ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
96927
- filteredContentFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_33$4, [
96928
- createElementVNode("div", _hoisted_34$4, [
97039
+ filteredContentFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_35$4, [
97040
+ createElementVNode("div", _hoisted_36$4, [
96929
97041
  createVNode(CIcon, {
96930
97042
  class: "mr-2",
96931
97043
  color: "var(--p-text2)",
96932
97044
  icon: "folder",
96933
97045
  size: "16"
96934
97046
  }),
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)
97047
+ createElementVNode("span", _hoisted_37$4, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.sections.content")), 1),
97048
+ createElementVNode("span", _hoisted_38$4, "(" + toDisplayString(filteredContentFiles.value.length) + ")", 1)
96937
97049
  ]),
96938
97050
  createElementVNode("div", null, [
96939
97051
  (openBlock(true), createElementBlock(Fragment, null, renderList(filteredContentFiles.value.slice(0, 5), (item) => {
@@ -96955,30 +97067,30 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96955
97067
  "object-fit": "cover",
96956
97068
  src: item.picture_url || "",
96957
97069
  width: "72"
96958
- }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_38$4, [
97070
+ }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_40$4, [
96959
97071
  createVNode(CIcon, {
96960
97072
  color: "var(--p-text2)",
96961
97073
  icon: "folder",
96962
97074
  size: "32"
96963
97075
  })
96964
97076
  ])),
96965
- createElementVNode("div", _hoisted_39$4, [
96966
- createElementVNode("h3", _hoisted_40$4, toDisplayString(item.name), 1),
97077
+ createElementVNode("div", _hoisted_41$4, [
97078
+ createElementVNode("h3", _hoisted_42$4, toDisplayString(item.name), 1),
96967
97079
  item.type === "file" && getSnippet(item) ? (openBlock(), createElementBlock("p", {
96968
97080
  key: 0,
96969
97081
  class: "text-xs text-gray-600 mb-1",
96970
97082
  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)
97083
+ }, null, 8, _hoisted_43$4)) : createCommentVNode("", true),
97084
+ createElementVNode("p", _hoisted_44$4, toDisplayString(item.type === "folder" ? "Folder" : item.file_category || item.content_type || "File"), 1)
96973
97085
  ]),
96974
- createElementVNode("div", _hoisted_43$4, toDisplayString(item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
96975
- ], 10, _hoisted_37$4);
97086
+ createElementVNode("div", _hoisted_45$4, toDisplayString(item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
97087
+ ], 10, _hoisted_39$4);
96976
97088
  }), 128))
96977
97089
  ]),
96978
- filteredContentFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_44$4, [
97090
+ filteredContentFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_46$4, [
96979
97091
  createElementVNode("span", {
96980
97092
  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")
97093
+ onClick: _cache[12] || (_cache[12] = ($event) => searchType.value = "content")
96982
97094
  }, [
96983
97095
  createTextVNode(toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.actions.viewAll")) + " ", 1),
96984
97096
  createVNode(CIcon, {
@@ -96989,16 +97101,16 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96989
97101
  ])
96990
97102
  ])) : createCommentVNode("", true)
96991
97103
  ])) : createCommentVNode("", true),
96992
- filteredCanvasFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_45$4, [
96993
- createElementVNode("div", _hoisted_46$4, [
97104
+ filteredCanvasFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_47$4, [
97105
+ createElementVNode("div", _hoisted_48$4, [
96994
97106
  createVNode(CIcon, {
96995
97107
  class: "mr-2",
96996
97108
  color: "var(--p-text2)",
96997
97109
  icon: "presentation",
96998
97110
  size: "16"
96999
97111
  }),
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)
97112
+ createElementVNode("span", _hoisted_49$4, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.sections.pitchDecks")), 1),
97113
+ createElementVNode("span", _hoisted_50$4, "(" + toDisplayString(filteredCanvasFiles.value.length) + ")", 1)
97002
97114
  ]),
97003
97115
  createElementVNode("div", null, [
97004
97116
  (openBlock(true), createElementBlock(Fragment, null, renderList(filteredCanvasFiles.value.slice(0, 5), (item) => {
@@ -97012,25 +97124,25 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97012
97124
  "data-result-selected": isResultSelected(item),
97013
97125
  onClick: ($event) => handleResultClick(item, "canvas")
97014
97126
  }, [
97015
- createElementVNode("div", _hoisted_50$4, [
97127
+ createElementVNode("div", _hoisted_52$3, [
97016
97128
  createVNode(CIcon, {
97017
97129
  color: "var(--p-text2)",
97018
97130
  icon: "presentation",
97019
97131
  size: "32"
97020
97132
  })
97021
97133
  ]),
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)
97134
+ createElementVNode("div", _hoisted_53$3, [
97135
+ createElementVNode("h3", _hoisted_54$2, toDisplayString(item.name), 1),
97136
+ createElementVNode("p", _hoisted_55$2, toDisplayString(formatCanvasType(item.content_type)), 1)
97025
97137
  ]),
97026
- createElementVNode("div", _hoisted_54$2, toDisplayString(item.folder?.name || ""), 1)
97027
- ], 10, _hoisted_49$4);
97138
+ createElementVNode("div", _hoisted_56$2, toDisplayString(item.folder?.name || ""), 1)
97139
+ ], 10, _hoisted_51$3);
97028
97140
  }), 128))
97029
97141
  ]),
97030
- filteredCanvasFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_55$2, [
97142
+ filteredCanvasFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_57$2, [
97031
97143
  createElementVNode("span", {
97032
97144
  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")
97145
+ onClick: _cache[13] || (_cache[13] = ($event) => searchType.value = "canvases")
97034
97146
  }, [
97035
97147
  createTextVNode(toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.actions.viewAll")) + " ", 1),
97036
97148
  createVNode(CIcon, {
@@ -97041,7 +97153,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97041
97153
  ])
97042
97154
  ])) : createCommentVNode("", true)
97043
97155
  ])) : createCommentVNode("", true),
97044
- searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_56$2, [
97156
+ searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_58$2, [
97045
97157
  createVNode(CIcon, {
97046
97158
  class: "text-6xl",
97047
97159
  color: searchError.value ? "var(--p-error)" : "var(--p-text3)",
@@ -97054,16 +97166,16 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97054
97166
  ])) : createCommentVNode("", true)
97055
97167
  ], 64))
97056
97168
  ])
97057
- ])) : (openBlock(), createElementBlock("div", _hoisted_57$2, [
97058
- createElementVNode("div", _hoisted_58$2, [
97059
- isSearching.value ? (openBlock(), createElementBlock("div", _hoisted_59$2, [
97169
+ ])) : (openBlock(), createElementBlock("div", _hoisted_59$2, [
97170
+ createElementVNode("div", _hoisted_60$2, [
97171
+ isSearching.value ? (openBlock(), createElementBlock("div", _hoisted_61$2, [
97060
97172
  createVNode(CIcon, {
97061
97173
  class: "animate-spin text-6xl",
97062
97174
  color: "var(--p-primary)",
97063
97175
  icon: "spinner"
97064
97176
  })
97065
97177
  ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
97066
- createElementVNode("div", _hoisted_60$2, [
97178
+ createElementVNode("div", _hoisted_62$2, [
97067
97179
  searchType.value === "content" ? (openBlock(), createBlock(CIcon, {
97068
97180
  key: 0,
97069
97181
  class: "mr-2",
@@ -97077,8 +97189,8 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97077
97189
  icon: "presentation",
97078
97190
  size: "16"
97079
97191
  })),
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)
97192
+ createElementVNode("span", _hoisted_63$2, toDisplayString(searchType.value === "content" ? unref(t)("canvasUI.CAlgoliaSearch.sections.content") : unref(t)("canvasUI.CAlgoliaSearch.sections.pitchDecks")), 1),
97193
+ createElementVNode("span", _hoisted_64$2, " (" + toDisplayString(searchType.value === "content" ? filteredContentFiles.value.length : filteredCanvasFiles.value.length) + ") ", 1)
97082
97194
  ]),
97083
97195
  createElementVNode("div", null, [
97084
97196
  (openBlock(true), createElementBlock(Fragment, null, renderList(searchType.value === "content" ? filteredContentFiles.value : filteredCanvasFiles.value, (item) => {
@@ -97103,7 +97215,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97103
97215
  "object-fit": "cover",
97104
97216
  src: item.picture_url || "",
97105
97217
  width: "72"
97106
- }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_64$2, [
97218
+ }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_66$2, [
97107
97219
  searchType.value === "content" ? (openBlock(), createBlock(CIcon, {
97108
97220
  key: 0,
97109
97221
  color: "var(--p-text2)",
@@ -97116,20 +97228,20 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97116
97228
  size: "32"
97117
97229
  }))
97118
97230
  ])),
97119
- createElementVNode("div", _hoisted_65$2, [
97120
- createElementVNode("h3", _hoisted_66$2, toDisplayString(item.name), 1),
97231
+ createElementVNode("div", _hoisted_67$2, [
97232
+ createElementVNode("h3", _hoisted_68$2, toDisplayString(item.name), 1),
97121
97233
  searchType.value === "content" && item.type === "file" && getSnippet(item) ? (openBlock(), createElementBlock("p", {
97122
97234
  key: 0,
97123
97235
  class: "text-xs text-gray-600 mb-1",
97124
97236
  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)
97237
+ }, null, 8, _hoisted_69$1)) : createCommentVNode("", true),
97238
+ createElementVNode("p", _hoisted_70$1, toDisplayString(searchType.value === "content" ? item.type === "folder" ? "Folder" : item.file_category || item.content_type || "File" : formatCanvasType(item.content_type)), 1)
97127
97239
  ]),
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);
97240
+ createElementVNode("div", _hoisted_71$1, toDisplayString(searchType.value === "content" && item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
97241
+ ], 10, _hoisted_65$2);
97130
97242
  }), 128))
97131
97243
  ]),
97132
- searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_70$1, [
97244
+ searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_72$1, [
97133
97245
  createVNode(CIcon, {
97134
97246
  class: "text-6xl",
97135
97247
  color: searchError.value ? "var(--p-error)" : "var(--p-text3)",
@@ -97144,7 +97256,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97144
97256
  ])
97145
97257
  ]))
97146
97258
  ]),
97147
- !showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_71$1, [
97259
+ !showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_73$1, [
97148
97260
  createVNode(CShortcut, null, {
97149
97261
  default: withCtx(() => [
97150
97262
  createVNode(CShortcutIcon, { icon: "arrow-up" }),
@@ -97186,7 +97298,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97186
97298
  }
97187
97299
  });
97188
97300
 
97189
- const CAlgoliaSearch = /* @__PURE__ */ _export_sfc(_sfc_main$5K, [["__scopeId", "data-v-da2357d4"]]);
97301
+ const CAlgoliaSearch = /* @__PURE__ */ _export_sfc(_sfc_main$5K, [["__scopeId", "data-v-52d9ac98"]]);
97190
97302
 
97191
97303
  const BulletListExtended = BulletList.extend({
97192
97304
  addOptions() {
@@ -99253,25 +99365,6 @@ const INITIAL_CALL_STATE = {
99253
99365
  };
99254
99366
 
99255
99367
  const realTimeExtraCrmShape = ref({});
99256
- function buildSchemaFromData(data) {
99257
- if (data === null || data === void 0) {
99258
- return null;
99259
- }
99260
- if (Array.isArray(data)) {
99261
- if (data.length === 0) {
99262
- return [];
99263
- }
99264
- return [buildSchemaFromData(data[0])];
99265
- }
99266
- if (typeof data === "object") {
99267
- const schema = {};
99268
- for (const [key, value] of Object.entries(data)) {
99269
- schema[key] = buildSchemaFromData(value);
99270
- }
99271
- return schema;
99272
- }
99273
- return null;
99274
- }
99275
99368
  function isEmptyValue(value) {
99276
99369
  return !value || typeof value === "string" && value.trim() === "";
99277
99370
  }
@@ -99291,7 +99384,6 @@ function removeEmptyValues(obj) {
99291
99384
  return result;
99292
99385
  }
99293
99386
  function useCrmShape() {
99294
- const { activeCanvas } = useCanvas$1();
99295
99387
  const call = useLocalStorage(CALL_STORAGE_KEY, INITIAL_CALL_STATE, {
99296
99388
  deep: true,
99297
99389
  listenToStorageChanges: true
@@ -99308,13 +99400,6 @@ function useCrmShape() {
99308
99400
  "myUser",
99309
99401
  computed(() => null)
99310
99402
  );
99311
- const pitcherDataSchema = computed(() => {
99312
- const pitcherData = activeCanvas.value?.context?.pitcher_data;
99313
- if (!pitcherData || typeof pitcherData !== "object") {
99314
- return {};
99315
- }
99316
- return { pitcher_data: buildSchemaFromData(pitcherData) };
99317
- });
99318
99403
  function getDefaultCrmShape({
99319
99404
  accountName = "",
99320
99405
  myUser: myUser2 = null,
@@ -99353,9 +99438,7 @@ function useCrmShape() {
99353
99438
  showDefault: !!launchDarkly.value.enable_default_crm_shape
99354
99439
  }),
99355
99440
  isEmpty(realTimeExtraCrmShape.value) ? {} : realTimeExtraCrmShape.value,
99356
- isEmpty(extraCrmShape.value) ? {} : extraCrmShape.value,
99357
- // Derive schema from actual pitcher_data in canvas context
99358
- isEmpty(pitcherDataSchema.value) ? {} : pitcherDataSchema.value
99441
+ isEmpty(extraCrmShape.value) ? {} : extraCrmShape.value
99359
99442
  );
99360
99443
  });
99361
99444
  return {
@@ -120825,7 +120908,7 @@ const _sfc_main$4k = /* @__PURE__ */ defineComponent({
120825
120908
 
120826
120909
  function useCanvasContext() {
120827
120910
  const { activeCanvas, isPrintDisplayMode, builderCache } = useCanvas$1();
120828
- const { crmShape, getDefaultCrmShape } = useCrmShape();
120911
+ const { getDefaultCrmShape } = useCrmShape();
120829
120912
  const myUser = inject(
120830
120913
  "myUser",
120831
120914
  computed(() => null)
@@ -120857,21 +120940,14 @@ function useCanvasContext() {
120857
120940
  builderCache.value[sectionOverrideKey] = mergedCtx;
120858
120941
  return mergedCtx;
120859
120942
  };
120860
- const fullContext = computed(() => {
120943
+ const crmShape = computed(() => getDefaultCrmShape({ myUser: myUser.value }));
120944
+ const crmShapeWithSectionCtx = computed(() => {
120861
120945
  const mergedCtx = getSectionCtx();
120862
- const defaultShape = getDefaultCrmShape({
120863
- myUser: myUser.value,
120864
- showDefault: true
120865
- });
120866
- return mergeWith({}, defaultShape, crmShape.value ?? {}, mergedCtx, (_objValue, srcValue) => {
120867
- if (Array.isArray(srcValue)) {
120868
- return srcValue;
120869
- }
120870
- return void 0;
120871
- });
120946
+ return !isEmpty(crmShape.value) ? { ...mergedCtx, ...crmShape.value } : mergedCtx;
120872
120947
  });
120873
120948
  return {
120874
- fullContext
120949
+ getSectionCtx,
120950
+ crmShapeWithSectionCtx
120875
120951
  };
120876
120952
  }
120877
120953
 
@@ -120917,10 +120993,10 @@ const _sfc_main$4j = /* @__PURE__ */ defineComponent({
120917
120993
  __name: "SelectionPanel",
120918
120994
  setup(__props) {
120919
120995
  useCssVars((_ctx) => ({
120920
- "7e857d3a": unref(themeVars).text,
120921
- "7e7d3ede": unref(themeVars).base,
120922
- "e1e1c7fe": unref(themeVars).primary6,
120923
- "e1e1c804": unref(themeVars).primary3
120996
+ "6fe3245a": unref(themeVars).text,
120997
+ "6fdae5fe": unref(themeVars).base,
120998
+ "85f799be": unref(themeVars).primary6,
120999
+ "85f799c4": unref(themeVars).primary3
120924
121000
  }));
120925
121001
  const { t } = useI18n();
120926
121002
  const { renderContentType, isFileExpired, isFileExpiring } = useFileDisplayHelpers();
@@ -120942,7 +121018,7 @@ const _sfc_main$4j = /* @__PURE__ */ defineComponent({
120942
121018
  "launchDarkly",
120943
121019
  computed(() => ({}))
120944
121020
  );
120945
- const { fullContext } = useCanvasContext();
121021
+ const { crmShapeWithSectionCtx } = useCanvasContext();
120946
121022
  const isCrmShapeEnabled = computed(() => launchDarkly.value?.enable_crm_shape_for_external_links ?? false);
120947
121023
  const draggableItems = computed({
120948
121024
  get: () => isDragNDropEnabled.value ? addedItems.value : selectedItems.value,
@@ -120957,7 +121033,7 @@ const _sfc_main$4j = /* @__PURE__ */ defineComponent({
120957
121033
  function getParsedUrl(url) {
120958
121034
  if (!url || !isCrmShapeEnabled.value) return url;
120959
121035
  try {
120960
- return renderTemplate(url, fullContext.value);
121036
+ return renderTemplate(url, crmShapeWithSectionCtx.value);
120961
121037
  } catch (error) {
120962
121038
  console.warn("Failed to parse template in external URL, using original URL:", error);
120963
121039
  return url;
@@ -121261,7 +121337,7 @@ const _sfc_main$4j = /* @__PURE__ */ defineComponent({
121261
121337
  }
121262
121338
  });
121263
121339
 
121264
- const SelectionPanel = /* @__PURE__ */ _export_sfc(_sfc_main$4j, [["__scopeId", "data-v-05db071e"]]);
121340
+ const SelectionPanel = /* @__PURE__ */ _export_sfc(_sfc_main$4j, [["__scopeId", "data-v-aa03fa77"]]);
121265
121341
 
121266
121342
  const _hoisted_1$3q = { class: "flex justify-between gap-2 items-center truncate py-1" };
121267
121343
  const _hoisted_2$2z = {
@@ -123793,13 +123869,13 @@ const _sfc_main$45 = /* @__PURE__ */ defineComponent({
123793
123869
  computed(() => ({}))
123794
123870
  );
123795
123871
  const { crmShape } = useCrmShape();
123796
- const { fullContext } = useCanvasContext();
123872
+ const { crmShapeWithSectionCtx } = useCanvasContext();
123797
123873
  const isCrmShapeEnabled = computed(() => launchDarkly.value?.enable_crm_shape_for_external_links ?? false);
123798
123874
  const parsedUrl = computed(() => {
123799
123875
  if (!url.value.trim()) return url.value;
123800
123876
  if (!isCrmShapeEnabled.value) return url.value;
123801
123877
  try {
123802
- return renderTemplate(url.value, fullContext.value);
123878
+ return renderTemplate(url.value, crmShapeWithSectionCtx.value);
123803
123879
  } catch (error) {
123804
123880
  console.error("Error parsing URL template:", error);
123805
123881
  return url.value;
@@ -123905,7 +123981,7 @@ const _sfc_main$45 = /* @__PURE__ */ defineComponent({
123905
123981
  }
123906
123982
  });
123907
123983
 
123908
- const ExternalLinks = /* @__PURE__ */ _export_sfc(_sfc_main$45, [["__scopeId", "data-v-ba7b39ff"]]);
123984
+ const ExternalLinks = /* @__PURE__ */ _export_sfc(_sfc_main$45, [["__scopeId", "data-v-1287b675"]]);
123909
123985
 
123910
123986
  const _hoisted_1$3d = { class: "mr-3 h-full" };
123911
123987
  const _hoisted_2$2m = { class: "flex flex-col gap-3 mb-3" };
@@ -147991,7 +148067,7 @@ const _sfc_main$2i = /* @__PURE__ */ defineComponent({
147991
148067
  } = useCanvas$1();
147992
148068
  const { discardOverridesConfirmationOptions, getComponentOverrides } = useCanvasSectionOverrides();
147993
148069
  const { getDerivedStyleFromFeatureFlags } = useComponentStyle(componentNode);
147994
- const { fullContext } = useCanvasContext();
148070
+ const { crmShapeWithSectionCtx } = useCanvasContext();
147995
148071
  const { setContentSelectorMode } = useContentSelector();
147996
148072
  const confirmation = useConfirmation();
147997
148073
  const themeVars = useThemeVars();
@@ -148144,7 +148220,7 @@ const _sfc_main$2i = /* @__PURE__ */ defineComponent({
148144
148220
  try {
148145
148221
  return {
148146
148222
  ...value,
148147
- external_url: renderTemplate(value.external_url, fullContext.value)
148223
+ external_url: renderTemplate(value.external_url, crmShapeWithSectionCtx.value)
148148
148224
  };
148149
148225
  } catch (error) {
148150
148226
  console.warn("Failed to parse template in external URL, using original URL:", error);
@@ -148662,7 +148738,7 @@ const _sfc_main$2h = /* @__PURE__ */ defineComponent({
148662
148738
  setCanvasMetadata,
148663
148739
  isImpact
148664
148740
  } = useCanvas$1();
148665
- const { fullContext } = useCanvasContext();
148741
+ const { crmShapeWithSectionCtx } = useCanvasContext();
148666
148742
  const { coreRestApiAxios } = useCoreApi();
148667
148743
  const { applyPrintModeToElement } = usePrintMode();
148668
148744
  const { discardOverridesConfirmationOptions, getComponentOverrides } = useCanvasSectionOverrides();
@@ -148719,7 +148795,7 @@ const _sfc_main$2h = /* @__PURE__ */ defineComponent({
148719
148795
  const memoizedModelValue = computed(() => getModelValue(computedTextProps.value.data?.content));
148720
148796
  function getModelValue(value = "") {
148721
148797
  if (!shouldInterpolate.value || !value.trim()) return value;
148722
- return renderTemplate(value, fullContext.value);
148798
+ return renderTemplate(value, crmShapeWithSectionCtx.value);
148723
148799
  }
148724
148800
  const debouncedUpdateNodeData = debounce((data2, nodeId, sectionId) => {
148725
148801
  return updateNodeData(data2, nodeId, sectionId);
@@ -148827,7 +148903,7 @@ const _sfc_main$2h = /* @__PURE__ */ defineComponent({
148827
148903
  );
148828
148904
  applyPrintModeToElement(contentElement.value, () => {
148829
148905
  const content = computedTextProps.value.data?.content || "";
148830
- return shouldInterpolate.value ? renderTemplate(content, fullContext.value) : content;
148906
+ return shouldInterpolate.value ? renderTemplate(content, crmShapeWithSectionCtx.value) : content;
148831
148907
  });
148832
148908
  if (enableScaleContent && spanStyles) {
148833
148909
  setTimeout(() => {
@@ -148939,7 +149015,7 @@ const _sfc_main$2h = /* @__PURE__ */ defineComponent({
148939
149015
  }
148940
149016
  });
148941
149017
 
148942
- const Text = /* @__PURE__ */ _export_sfc(_sfc_main$2h, [["__scopeId", "data-v-73a884c3"]]);
149018
+ const Text = /* @__PURE__ */ _export_sfc(_sfc_main$2h, [["__scopeId", "data-v-b2424519"]]);
148943
149019
 
148944
149020
  const _hoisted_1$1Q = { class: "absolute top-2 right-2 flex items-center gap-1 z-10" };
148945
149021
  const _hoisted_2$1m = { class: "text-xs" };
@@ -183683,14 +183759,8 @@ function getEventColor(sfEvent) {
183683
183759
  } else {
183684
183760
  isSubmitted = false;
183685
183761
  }
183686
- const now = /* @__PURE__ */ new Date();
183687
183762
  if (isSubmitted) return SfEventColors.SUBMITTED;
183688
- else if (sfEvent.IsAllDayEvent) {
183689
- const endDate = new Date(sfEvent.EndDateTime);
183690
- const todayStart = startOfDay(now);
183691
- const endDayStart = startOfDay(endDate);
183692
- return isAfter$1(todayStart, endDayStart) ? SfEventColors.PAST : SfEventColors.PLANNED;
183693
- } else if (isAfter$1(now, new Date(sfEvent.EndDateTime))) return SfEventColors.PAST;
183763
+ else if (isAfter$1(/* @__PURE__ */ new Date(), new Date(sfEvent.EndDateTime))) return SfEventColors.PAST;
183694
183764
  else return SfEventColors.PLANNED;
183695
183765
  }
183696
183766
  const minFutureDate = (date = /* @__PURE__ */ new Date()) => add(date, { minutes: MIN_DIFFERENCE_IN_MINUTES });