@pitcher/canvas-ui 2026.1.13-070805-beta → 2026.1.13-125745-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,14 +88219,15 @@ async function crmQueryAdaptive(payload) {
88219
88219
  } catch {
88220
88220
  useSmartStore = false;
88221
88221
  }
88222
- console.log(`crmQueryAdaptive called with the query: `, query2);
88222
+ console.log(`[crmQueryAdaptive] Called 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(`Smart Query: `, smartQuery);
88227
+ console.log(`[crmSmartQuery] Called query: `, smartQuery);
88228
88228
  const smartStoreResults = await crmSmartQuery({ query: smartQuery });
88229
88229
  const records = transformSmartStoreResults(smartStoreResults, fields, objectName);
88230
+ console.log(`[SmartStore] Results: `, records);
88230
88231
  return {
88231
88232
  records,
88232
88233
  totalSize: records.length
@@ -95684,120 +95685,118 @@ const _hoisted_9$O = {
95684
95685
  class: "flex items-center space-x-1 ml-2"
95685
95686
  };
95686
95687
  const _hoisted_10$C = { class: "flex items-center" };
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 = {
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 = {
95690
95692
  key: 0,
95691
95693
  class: "flex items-center ml-2"
95692
95694
  };
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,
95695
+ const _hoisted_15$f = {
95696
+ key: 2,
95698
95697
  class: "flex items-center ml-2"
95699
95698
  };
95700
- const _hoisted_18$a = { class: "flex flex-col w-full flex-1 min-h-0" };
95701
- const _hoisted_19$a = {
95699
+ const _hoisted_16$e = { class: "flex flex-col w-full flex-1 min-h-0" };
95700
+ const _hoisted_17$c = {
95702
95701
  key: 0,
95703
95702
  class: "flex-1 overflow-y-auto bg-white w-full pl-1 pr-6 py-0"
95704
95703
  };
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 = {
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 = {
95712
95711
  key: 0,
95713
95712
  class: "relative mr-4"
95714
95713
  };
95715
- const _hoisted_27$5 = {
95714
+ const _hoisted_25$5 = {
95716
95715
  key: 0,
95717
95716
  class: "absolute inset-0 flex items-center justify-center bg-gray-200 bg-opacity-75 border-rounded-1"
95718
95717
  };
95719
- const _hoisted_28$5 = {
95718
+ const _hoisted_26$5 = {
95720
95719
  key: 1,
95721
95720
  class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center"
95722
95721
  };
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 = {
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 = {
95727
95726
  key: 1,
95728
95727
  class: "flex-1 overflow-y-auto bg-white w-full"
95729
95728
  };
95730
- const _hoisted_33$4 = { class: "w-full px-0" };
95731
- const _hoisted_34$4 = {
95729
+ const _hoisted_31$4 = { class: "w-full px-0" };
95730
+ const _hoisted_32$4 = {
95732
95731
  key: 0,
95733
95732
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95734
95733
  };
95735
- const _hoisted_35$4 = {
95734
+ const _hoisted_33$4 = {
95736
95735
  key: 0,
95737
95736
  class: "mb-0"
95738
95737
  };
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 = {
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 = {
95744
95743
  key: 1,
95745
95744
  class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center"
95746
95745
  };
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 = {
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 = {
95753
95752
  key: 0,
95754
95753
  class: "px-0 py-0"
95755
95754
  };
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 = {
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 = {
95767
95766
  key: 0,
95768
95767
  class: "px-0 py-0"
95769
95768
  };
95770
- const _hoisted_58$2 = {
95769
+ const _hoisted_56$2 = {
95771
95770
  key: 2,
95772
95771
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95773
95772
  };
95774
- const _hoisted_59$2 = {
95773
+ const _hoisted_57$2 = {
95775
95774
  key: 2,
95776
95775
  class: "flex-1 overflow-y-auto bg-white w-full"
95777
95776
  };
95778
- const _hoisted_60$2 = { class: "w-full px-0" };
95779
- const _hoisted_61$2 = {
95777
+ const _hoisted_58$2 = { class: "w-full px-0" };
95778
+ const _hoisted_59$2 = {
95780
95779
  key: 0,
95781
95780
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95782
95781
  };
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 = {
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 = {
95788
95787
  key: 1,
95789
95788
  class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center"
95790
95789
  };
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 = {
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 = {
95797
95796
  key: 0,
95798
95797
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95799
95798
  };
95800
- const _hoisted_73$1 = {
95799
+ const _hoisted_71$1 = {
95801
95800
  key: 0,
95802
95801
  class: "flex flex-wrap line-height-6 pt-4 pb-2 px-6 border-t border-gray-200 gap-y-4 gap-x-4"
95803
95802
  };
@@ -95821,10 +95820,9 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95821
95820
  const showRecentView = ref(true);
95822
95821
  const suggestionsDropdownRef = ref(null);
95823
95822
  const searchInputRef = ref(null);
95824
- const selectedFileType = ref(null);
95823
+ const selectedFileTypes = ref([]);
95825
95824
  const showFileTypeDropdown = ref(false);
95826
- const selectedCanvasFilter = ref(null);
95827
- const showCanvasTypeDropdown = ref(false);
95825
+ const selectedCanvasFilters = ref([]);
95828
95826
  const fileTypeOptions = [
95829
95827
  { label: "Folder", value: "folder" },
95830
95828
  { label: "PDF", value: "pdf" },
@@ -95837,55 +95835,17 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95837
95835
  { label: "AR", value: "ar" },
95838
95836
  { label: "Web", value: "web" }
95839
95837
  ];
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);
95838
+ const hasActiveFilters = computed(() => selectedFileTypes.value.length > 0 || selectedCanvasFilters.value.length > 0);
95877
95839
  const clearAllFilters = () => {
95878
- selectedFileType.value = null;
95879
- selectedCanvasFilter.value = null;
95840
+ selectedFileTypes.value = [];
95841
+ selectedCanvasFilters.value = [];
95880
95842
  debouncedFilterSearch();
95881
95843
  };
95882
95844
  const handleEverywhereClick = async () => {
95883
- selectedFileType.value = null;
95884
- selectedCanvasFilter.value = null;
95845
+ selectedFileTypes.value = [];
95846
+ selectedCanvasFilters.value = [];
95885
95847
  searchType.value = null;
95886
- if (searchQuery.value.trim() && (unfilteredContentResults.value.length > 0 || unfilteredCanvasResults.value.length > 0)) {
95887
- applyFiltersToResults();
95888
- } else if (searchQuery.value.trim()) {
95848
+ if (searchQuery.value.trim()) {
95889
95849
  try {
95890
95850
  skipNextSuggestionFetch.value = true;
95891
95851
  await performSearch(searchQuery.value);
@@ -96021,11 +95981,8 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96021
95981
  };
96022
95982
  const contentResults = ref([]);
96023
95983
  const canvasResults = ref([]);
96024
- const unfilteredContentResults = ref([]);
96025
- const unfilteredCanvasResults = ref([]);
96026
95984
  const isSearching = ref(false);
96027
95985
  const hasSearchCompleted = ref(false);
96028
- let currentSearchId = 0;
96029
95986
  const querySuggestions = ref([]);
96030
95987
  const selectedSuggestionIndex = ref(-1);
96031
95988
  const selectedResultIndex = ref(-1);
@@ -96042,44 +95999,6 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96042
95999
  }
96043
96000
  return canvasResults.value;
96044
96001
  });
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
- });
96083
96002
  const shouldShowNoResults = computed(() => {
96084
96003
  if (showRecentView.value || !searchQuery.value.trim() || isSearching.value || !hasSearchCompleted.value) return false;
96085
96004
  if (searchType.value === "content") {
@@ -96123,30 +96042,6 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96123
96042
  };
96124
96043
  watch(searchType, () => {
96125
96044
  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
- }
96150
96045
  });
96151
96046
  const scrollSelectedResultIntoView = () => {
96152
96047
  nextTick(() => {
@@ -96190,8 +96085,6 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96190
96085
  if (!query.trim()) {
96191
96086
  contentResults.value = [];
96192
96087
  canvasResults.value = [];
96193
- unfilteredContentResults.value = [];
96194
- unfilteredCanvasResults.value = [];
96195
96088
  hasSearchCompleted.value = false;
96196
96089
  isSearching.value = false;
96197
96090
  searchError.value = null;
@@ -96200,47 +96093,59 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96200
96093
  isSearching.value = true;
96201
96094
  hasSearchCompleted.value = false;
96202
96095
  searchError.value = null;
96203
- const searchId = ++currentSearchId;
96204
96096
  const shouldSkipSuggestionFetch = skipNextSuggestionFetch.value;
96205
96097
  if (shouldSkipSuggestionFetch) {
96206
96098
  skipNextSuggestionFetch.value = false;
96207
96099
  }
96208
96100
  try {
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;
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;
96218
96138
  }
96139
+ const contentFilters = validFileTypes.length > 0 ? ` AND (${validFileTypes.map((type) => type === "folder" ? `type:"${type}"` : `file_category:"${type}"`).join(" OR ")})` : "";
96219
96140
  const results = await searchViaBackend(query.trim(), {
96220
- canvas: "",
96221
- content: ""
96141
+ canvas: canvasFilters,
96142
+ content: contentFilters
96222
96143
  });
96223
96144
  if (query.trim() !== searchQuery.value.trim()) {
96224
96145
  return;
96225
96146
  }
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;
96147
+ contentResults.value = results.content?.hits || [];
96148
+ canvasResults.value = results.canvas?.hits || [];
96244
96149
  selectedResultIndex.value = -1;
96245
96150
  searchError.value = null;
96246
96151
  if (query.trim().length >= 2 && !shouldSkipSuggestionFetch) {
@@ -96253,27 +96158,23 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96253
96158
  }
96254
96159
  await nextTick();
96255
96160
  setTimeout(() => {
96256
- if (searchId === currentSearchId) {
96257
- isSearching.value = false;
96258
- hasSearchCompleted.value = true;
96259
- }
96161
+ isSearching.value = false;
96162
+ hasSearchCompleted.value = true;
96260
96163
  }, 50);
96261
96164
  } catch (error) {
96262
96165
  console.error("Search error:", error);
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
- }
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";
96277
96178
  }
96278
96179
  }
96279
96180
  };
@@ -96283,36 +96184,19 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96283
96184
  if (!query || typeof query !== "string") return "";
96284
96185
  return query;
96285
96186
  }
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
- }
96310
96187
  const debouncedFilterSearch = () => {
96311
96188
  if (filterChangeTimer) clearTimeout(filterChangeTimer);
96312
96189
  if (searchTimer) clearTimeout(searchTimer);
96313
96190
  filterChangeTimer = setTimeout(async () => {
96314
96191
  if (searchQuery.value.trim() && !showRecentView.value) {
96315
- applyFiltersToResults();
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
+ }
96316
96200
  }
96317
96201
  }, 500);
96318
96202
  };
@@ -96338,8 +96222,6 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96338
96222
  showRecentView.value = true;
96339
96223
  contentResults.value = [];
96340
96224
  canvasResults.value = [];
96341
- unfilteredContentResults.value = [];
96342
- unfilteredCanvasResults.value = [];
96343
96225
  querySuggestions.value = [];
96344
96226
  selectedSuggestionIndex.value = -1;
96345
96227
  selectedResultIndex.value = -1;
@@ -96353,8 +96235,6 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96353
96235
  showRecentView.value = true;
96354
96236
  contentResults.value = [];
96355
96237
  canvasResults.value = [];
96356
- unfilteredContentResults.value = [];
96357
- unfilteredCanvasResults.value = [];
96358
96238
  querySuggestions.value = [];
96359
96239
  selectedSuggestionIndex.value = -1;
96360
96240
  selectedResultIndex.value = -1;
@@ -96479,23 +96359,33 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96479
96359
  if (endChar < highlightValue.length) truncated = truncated + "...";
96480
96360
  return sanitizeHtml(truncated);
96481
96361
  };
96482
- const handleCanvasTypeChange = (value) => {
96483
- selectedCanvasFilter.value = value;
96484
- showCanvasTypeDropdown.value = false;
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
+ }
96485
96368
  debouncedFilterSearch();
96486
96369
  };
96487
- const clearCanvasFilter = () => {
96488
- selectedCanvasFilter.value = null;
96489
- showCanvasTypeDropdown.value = false;
96370
+ const clearCanvasFilters = () => {
96371
+ selectedCanvasFilters.value = [];
96490
96372
  debouncedFilterSearch();
96491
96373
  };
96492
- const handleFileTypeChange = (value) => {
96493
- selectedFileType.value = value;
96494
- showFileTypeDropdown.value = false;
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
+ }
96495
96385
  debouncedFilterSearch();
96496
96386
  };
96497
- const clearFileType = () => {
96498
- selectedFileType.value = null;
96387
+ const clearFileTypes = () => {
96388
+ selectedFileTypes.value = [];
96499
96389
  showFileTypeDropdown.value = false;
96500
96390
  debouncedFilterSearch();
96501
96391
  };
@@ -96664,7 +96554,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96664
96554
  show: "",
96665
96555
  verticalAlignment: "top",
96666
96556
  "z-index": _ctx.zIndex,
96667
- "onUpdate:show": _cache[14] || (_cache[14] = ($event) => emit("toggleSearch", $event))
96557
+ "onUpdate:show": _cache[15] || (_cache[15] = ($event) => emit("toggleSearch", $event))
96668
96558
  }, {
96669
96559
  default: withCtx(() => [
96670
96560
  createElementVNode("div", {
@@ -96673,7 +96563,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96673
96563
  }, [
96674
96564
  createElementVNode("div", _hoisted_1$4w, [
96675
96565
  createElementVNode("div", _hoisted_2$3j, [
96676
- _cache[15] || (_cache[15] = createElementVNode("div", { class: "absolute left-2.5 top-1/2 transform -translate-y-1/2 z-10" }, [
96566
+ _cache[16] || (_cache[16] = createElementVNode("div", { class: "absolute left-2.5 top-1/2 transform -translate-y-1/2 z-10" }, [
96677
96567
  createElementVNode("i", { class: "c-icon far fa-search text-gray-400 text-l" })
96678
96568
  ], -1)),
96679
96569
  withDirectives(createElementVNode("input", {
@@ -96770,7 +96660,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96770
96660
  createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.tabs.pitchDecks")), 1)
96771
96661
  ], 2)) : createCommentVNode("", true)
96772
96662
  ]),
96773
- searchType.value && (searchType.value === "content" && hasContentFilters.value || searchType.value === "canvases" && hasCanvasFilters.value) ? (openBlock(), createElementBlock("div", _hoisted_9$O, [
96663
+ searchType.value ? (openBlock(), createElementBlock("div", _hoisted_9$O, [
96774
96664
  searchType.value === "content" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
96775
96665
  createVNode(unref(NPopover), {
96776
96666
  class: "c-select-filter",
@@ -96779,13 +96669,13 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96779
96669
  show: showFileTypeDropdown.value,
96780
96670
  "show-arrow": false,
96781
96671
  trigger: "manual",
96782
- onClickoutside: _cache[8] || (_cache[8] = ($event) => showFileTypeDropdown.value = false)
96672
+ onClickoutside: _cache[7] || (_cache[7] = ($event) => showFileTypeDropdown.value = false)
96783
96673
  }, {
96784
96674
  trigger: withCtx(() => [
96785
96675
  createVNode(unref(NTag), {
96786
96676
  class: "select-none cursor-pointer",
96787
96677
  style: normalizeStyle({
96788
- "--n-color": selectedFileType.value ? "var(--p-primary5)" : "var(--p-primary6)",
96678
+ "--n-color": selectedFileTypes.value.length ? "var(--p-primary5)" : "var(--p-primary6)",
96789
96679
  "--n-border": "1px solid var(--p-primary5)",
96790
96680
  "--n-height": "28px"
96791
96681
  }),
@@ -96796,42 +96686,34 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96796
96686
  }, {
96797
96687
  default: withCtx(() => [
96798
96688
  createElementVNode("div", _hoisted_10$C, [
96799
- createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.type")), 1)
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)
96800
96691
  ])
96801
96692
  ]),
96802
96693
  _: 1
96803
96694
  }, 8, ["style"])
96804
96695
  ]),
96805
96696
  default: withCtx(() => [
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"])
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))
96835
96717
  ]),
96836
96718
  createElementVNode("div", {
96837
96719
  class: "pa-2",
@@ -96841,7 +96723,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96841
96723
  block: "",
96842
96724
  class: "pa-2",
96843
96725
  text: "",
96844
- onClick: clearFileType
96726
+ onClick: clearFileTypes
96845
96727
  }, {
96846
96728
  default: withCtx(() => [
96847
96729
  createTextVNode(toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.clear")), 1)
@@ -96853,109 +96735,115 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96853
96735
  ]),
96854
96736
  _: 1
96855
96737
  }, 8, ["show"]),
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)),
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)),
96858
96740
  createElementVNode("span", {
96859
96741
  class: "text-sm text-gray-600 hover:text-gray-800 font-normal cursor-pointer",
96860
96742
  onClick: clearAllFilters
96861
96743
  }, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.clear")), 1)
96862
96744
  ])) : createCommentVNode("", true)
96863
96745
  ], 64)) : searchType.value === "canvases" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
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)
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"))
96872
96758
  }, {
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"])
96759
+ default: withCtx(() => [
96760
+ createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.canvasFilters.saved")), 1)
96893
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
+ }, {
96894
96776
  default: withCtx(() => [
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
- ])
96777
+ createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.canvasFilters.templates")), 1)
96942
96778
  ]),
96943
96779
  _: 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)),
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"))
96810
+ }, {
96811
+ default: withCtx(() => [
96812
+ createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.canvasFilters.products")), 1)
96813
+ ]),
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
+ default: withCtx(() => [
96829
+ createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.canvasFilters.blocks")), 1)
96830
+ ]),
96831
+ _: 1
96832
+ }, 8, ["style"]),
96833
+ selectedCanvasFilters.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_15$f, [
96834
+ _cache[18] || (_cache[18] = createElementVNode("div", { class: "h-6 w-px bg-gray-300 mx-2" }, null, -1)),
96947
96835
  createElementVNode("span", {
96948
96836
  class: "text-sm text-gray-600 hover:text-gray-800 font-normal cursor-pointer",
96949
- onClick: clearAllFilters
96837
+ onClick: clearCanvasFilters
96950
96838
  }, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.clear")), 1)
96951
96839
  ])) : createCommentVNode("", true)
96952
96840
  ], 64)) : createCommentVNode("", true)
96953
96841
  ])) : createCommentVNode("", true)
96954
96842
  ])) : createCommentVNode("", true)
96955
96843
  ]),
96956
- createElementVNode("div", _hoisted_18$a, [
96957
- showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_19$a, [
96958
- createElementVNode("div", _hoisted_20$9, [
96844
+ createElementVNode("div", _hoisted_16$e, [
96845
+ showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_17$c, [
96846
+ createElementVNode("div", _hoisted_18$a, [
96959
96847
  (openBlock(true), createElementBlock(Fragment, null, renderList(recentSearches.value, (search) => {
96960
96848
  return openBlock(), createElementBlock("div", {
96961
96849
  key: search,
@@ -96968,14 +96856,14 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96968
96856
  icon: "clock-rotate-left",
96969
96857
  size: "16"
96970
96858
  }),
96971
- createElementVNode("span", _hoisted_22$5, toDisplayString(search), 1)
96972
- ], 8, _hoisted_21$7);
96859
+ createElementVNode("span", _hoisted_20$9, toDisplayString(search), 1)
96860
+ ], 8, _hoisted_19$a);
96973
96861
  }), 128))
96974
96862
  ]),
96975
96863
  recentlyOpenedDocs.value.length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
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)
96864
+ _cache[19] || (_cache[19] = createElementVNode("hr", { class: "border-0 h-px bg-gray-200 mt-2 mb-3 w-full" }, null, -1)),
96865
+ createElementVNode("div", _hoisted_21$7, [
96866
+ createElementVNode("span", _hoisted_22$5, toDisplayString(unref(t)("canvasUI.components.fileViewer.recentlyOpened")), 1)
96979
96867
  ]),
96980
96868
  createElementVNode("div", {
96981
96869
  class: normalizeClass(_ctx.isAdmin ? "space-y-2" : "space-y-0")
@@ -96989,7 +96877,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96989
96877
  ]),
96990
96878
  onClick: ($event) => handleRecentDocClick(doc, doc.type)
96991
96879
  }, [
96992
- doc.type === "file" ? (openBlock(), createElementBlock("div", _hoisted_26$5, [
96880
+ doc.type === "file" ? (openBlock(), createElementBlock("div", _hoisted_24$5, [
96993
96881
  createVNode(_sfc_main$6K, {
96994
96882
  class: "h-14 border-rounded-1 overflow-hidden flex-0",
96995
96883
  cover: "",
@@ -96998,7 +96886,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96998
96886
  src: recentThumbnails.value[doc.id] || "",
96999
96887
  width: "72"
97000
96888
  }, null, 8, ["file-data", "src"]),
97001
- isLoadingThumbnails.value && !recentThumbnails.value[doc.id] ? (openBlock(), createElementBlock("div", _hoisted_27$5, [
96889
+ isLoadingThumbnails.value && !recentThumbnails.value[doc.id] ? (openBlock(), createElementBlock("div", _hoisted_25$5, [
97002
96890
  createVNode(CIcon, {
97003
96891
  class: "animate-spin",
97004
96892
  color: "var(--p-primary)",
@@ -97006,7 +96894,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97006
96894
  size: "20"
97007
96895
  })
97008
96896
  ])) : createCommentVNode("", true)
97009
- ])) : (openBlock(), createElementBlock("div", _hoisted_28$5, [
96897
+ ])) : (openBlock(), createElementBlock("div", _hoisted_26$5, [
97010
96898
  doc.type === "canvas" ? (openBlock(), createBlock(CIcon, {
97011
96899
  key: 0,
97012
96900
  color: "var(--p-text2)",
@@ -97019,33 +96907,33 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97019
96907
  size: "32"
97020
96908
  }))
97021
96909
  ])),
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)
96910
+ createElementVNode("div", _hoisted_27$5, [
96911
+ createElementVNode("h3", _hoisted_28$5, toDisplayString(doc.name), 1),
96912
+ createElementVNode("p", _hoisted_29$5, toDisplayString(doc.type === "canvas" ? formatCanvasType(doc.content_type) : doc.type === "folder" ? "Folder" : doc.file_category || "File"), 1)
97025
96913
  ])
97026
- ], 10, _hoisted_25$5);
96914
+ ], 10, _hoisted_23$5);
97027
96915
  }), 128))
97028
96916
  ], 2)
97029
96917
  ], 64)) : createCommentVNode("", true)
97030
- ])) : !searchType.value ? (openBlock(), createElementBlock("div", _hoisted_32$4, [
97031
- createElementVNode("div", _hoisted_33$4, [
97032
- isSearching.value ? (openBlock(), createElementBlock("div", _hoisted_34$4, [
96918
+ ])) : !searchType.value ? (openBlock(), createElementBlock("div", _hoisted_30$4, [
96919
+ createElementVNode("div", _hoisted_31$4, [
96920
+ isSearching.value ? (openBlock(), createElementBlock("div", _hoisted_32$4, [
97033
96921
  createVNode(CIcon, {
97034
96922
  class: "animate-spin text-6xl",
97035
96923
  color: "var(--p-primary)",
97036
96924
  icon: "spinner"
97037
96925
  })
97038
96926
  ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
97039
- filteredContentFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_35$4, [
97040
- createElementVNode("div", _hoisted_36$4, [
96927
+ filteredContentFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_33$4, [
96928
+ createElementVNode("div", _hoisted_34$4, [
97041
96929
  createVNode(CIcon, {
97042
96930
  class: "mr-2",
97043
96931
  color: "var(--p-text2)",
97044
96932
  icon: "folder",
97045
96933
  size: "16"
97046
96934
  }),
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)
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)
97049
96937
  ]),
97050
96938
  createElementVNode("div", null, [
97051
96939
  (openBlock(true), createElementBlock(Fragment, null, renderList(filteredContentFiles.value.slice(0, 5), (item) => {
@@ -97067,30 +96955,30 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97067
96955
  "object-fit": "cover",
97068
96956
  src: item.picture_url || "",
97069
96957
  width: "72"
97070
- }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_40$4, [
96958
+ }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_38$4, [
97071
96959
  createVNode(CIcon, {
97072
96960
  color: "var(--p-text2)",
97073
96961
  icon: "folder",
97074
96962
  size: "32"
97075
96963
  })
97076
96964
  ])),
97077
- createElementVNode("div", _hoisted_41$4, [
97078
- createElementVNode("h3", _hoisted_42$4, toDisplayString(item.name), 1),
96965
+ createElementVNode("div", _hoisted_39$4, [
96966
+ createElementVNode("h3", _hoisted_40$4, toDisplayString(item.name), 1),
97079
96967
  item.type === "file" && getSnippet(item) ? (openBlock(), createElementBlock("p", {
97080
96968
  key: 0,
97081
96969
  class: "text-xs text-gray-600 mb-1",
97082
96970
  innerHTML: getSnippet(item)
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)
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)
97085
96973
  ]),
97086
- createElementVNode("div", _hoisted_45$4, toDisplayString(item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
97087
- ], 10, _hoisted_39$4);
96974
+ createElementVNode("div", _hoisted_43$4, toDisplayString(item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
96975
+ ], 10, _hoisted_37$4);
97088
96976
  }), 128))
97089
96977
  ]),
97090
- filteredContentFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_46$4, [
96978
+ filteredContentFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_44$4, [
97091
96979
  createElementVNode("span", {
97092
96980
  class: "text-sm text-gray-600 hover:text-gray-800 font-bold flex items-center cursor-pointer",
97093
- onClick: _cache[12] || (_cache[12] = ($event) => searchType.value = "content")
96981
+ onClick: _cache[13] || (_cache[13] = ($event) => searchType.value = "content")
97094
96982
  }, [
97095
96983
  createTextVNode(toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.actions.viewAll")) + " ", 1),
97096
96984
  createVNode(CIcon, {
@@ -97101,16 +96989,16 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97101
96989
  ])
97102
96990
  ])) : createCommentVNode("", true)
97103
96991
  ])) : createCommentVNode("", true),
97104
- filteredCanvasFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_47$4, [
97105
- createElementVNode("div", _hoisted_48$4, [
96992
+ filteredCanvasFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_45$4, [
96993
+ createElementVNode("div", _hoisted_46$4, [
97106
96994
  createVNode(CIcon, {
97107
96995
  class: "mr-2",
97108
96996
  color: "var(--p-text2)",
97109
96997
  icon: "presentation",
97110
96998
  size: "16"
97111
96999
  }),
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)
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)
97114
97002
  ]),
97115
97003
  createElementVNode("div", null, [
97116
97004
  (openBlock(true), createElementBlock(Fragment, null, renderList(filteredCanvasFiles.value.slice(0, 5), (item) => {
@@ -97124,25 +97012,25 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97124
97012
  "data-result-selected": isResultSelected(item),
97125
97013
  onClick: ($event) => handleResultClick(item, "canvas")
97126
97014
  }, [
97127
- createElementVNode("div", _hoisted_52$3, [
97015
+ createElementVNode("div", _hoisted_50$4, [
97128
97016
  createVNode(CIcon, {
97129
97017
  color: "var(--p-text2)",
97130
97018
  icon: "presentation",
97131
97019
  size: "32"
97132
97020
  })
97133
97021
  ]),
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)
97022
+ createElementVNode("div", _hoisted_51$3, [
97023
+ createElementVNode("h3", _hoisted_52$3, toDisplayString(item.name), 1),
97024
+ createElementVNode("p", _hoisted_53$3, toDisplayString(formatCanvasType(item.content_type)), 1)
97137
97025
  ]),
97138
- createElementVNode("div", _hoisted_56$2, toDisplayString(item.folder?.name || ""), 1)
97139
- ], 10, _hoisted_51$3);
97026
+ createElementVNode("div", _hoisted_54$2, toDisplayString(item.folder?.name || ""), 1)
97027
+ ], 10, _hoisted_49$4);
97140
97028
  }), 128))
97141
97029
  ]),
97142
- filteredCanvasFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_57$2, [
97030
+ filteredCanvasFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_55$2, [
97143
97031
  createElementVNode("span", {
97144
97032
  class: "text-sm text-gray-600 hover:text-gray-800 font-bold flex items-center cursor-pointer",
97145
- onClick: _cache[13] || (_cache[13] = ($event) => searchType.value = "canvases")
97033
+ onClick: _cache[14] || (_cache[14] = ($event) => searchType.value = "canvases")
97146
97034
  }, [
97147
97035
  createTextVNode(toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.actions.viewAll")) + " ", 1),
97148
97036
  createVNode(CIcon, {
@@ -97153,7 +97041,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97153
97041
  ])
97154
97042
  ])) : createCommentVNode("", true)
97155
97043
  ])) : createCommentVNode("", true),
97156
- searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_58$2, [
97044
+ searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_56$2, [
97157
97045
  createVNode(CIcon, {
97158
97046
  class: "text-6xl",
97159
97047
  color: searchError.value ? "var(--p-error)" : "var(--p-text3)",
@@ -97166,16 +97054,16 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97166
97054
  ])) : createCommentVNode("", true)
97167
97055
  ], 64))
97168
97056
  ])
97169
- ])) : (openBlock(), createElementBlock("div", _hoisted_59$2, [
97170
- createElementVNode("div", _hoisted_60$2, [
97171
- isSearching.value ? (openBlock(), createElementBlock("div", _hoisted_61$2, [
97057
+ ])) : (openBlock(), createElementBlock("div", _hoisted_57$2, [
97058
+ createElementVNode("div", _hoisted_58$2, [
97059
+ isSearching.value ? (openBlock(), createElementBlock("div", _hoisted_59$2, [
97172
97060
  createVNode(CIcon, {
97173
97061
  class: "animate-spin text-6xl",
97174
97062
  color: "var(--p-primary)",
97175
97063
  icon: "spinner"
97176
97064
  })
97177
97065
  ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
97178
- createElementVNode("div", _hoisted_62$2, [
97066
+ createElementVNode("div", _hoisted_60$2, [
97179
97067
  searchType.value === "content" ? (openBlock(), createBlock(CIcon, {
97180
97068
  key: 0,
97181
97069
  class: "mr-2",
@@ -97189,8 +97077,8 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97189
97077
  icon: "presentation",
97190
97078
  size: "16"
97191
97079
  })),
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)
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)
97194
97082
  ]),
97195
97083
  createElementVNode("div", null, [
97196
97084
  (openBlock(true), createElementBlock(Fragment, null, renderList(searchType.value === "content" ? filteredContentFiles.value : filteredCanvasFiles.value, (item) => {
@@ -97215,7 +97103,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97215
97103
  "object-fit": "cover",
97216
97104
  src: item.picture_url || "",
97217
97105
  width: "72"
97218
- }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_66$2, [
97106
+ }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_64$2, [
97219
97107
  searchType.value === "content" ? (openBlock(), createBlock(CIcon, {
97220
97108
  key: 0,
97221
97109
  color: "var(--p-text2)",
@@ -97228,20 +97116,20 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97228
97116
  size: "32"
97229
97117
  }))
97230
97118
  ])),
97231
- createElementVNode("div", _hoisted_67$2, [
97232
- createElementVNode("h3", _hoisted_68$2, toDisplayString(item.name), 1),
97119
+ createElementVNode("div", _hoisted_65$2, [
97120
+ createElementVNode("h3", _hoisted_66$2, toDisplayString(item.name), 1),
97233
97121
  searchType.value === "content" && item.type === "file" && getSnippet(item) ? (openBlock(), createElementBlock("p", {
97234
97122
  key: 0,
97235
97123
  class: "text-xs text-gray-600 mb-1",
97236
97124
  innerHTML: getSnippet(item)
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)
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)
97239
97127
  ]),
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);
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);
97242
97130
  }), 128))
97243
97131
  ]),
97244
- searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_72$1, [
97132
+ searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_70$1, [
97245
97133
  createVNode(CIcon, {
97246
97134
  class: "text-6xl",
97247
97135
  color: searchError.value ? "var(--p-error)" : "var(--p-text3)",
@@ -97256,7 +97144,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97256
97144
  ])
97257
97145
  ]))
97258
97146
  ]),
97259
- !showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_73$1, [
97147
+ !showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_71$1, [
97260
97148
  createVNode(CShortcut, null, {
97261
97149
  default: withCtx(() => [
97262
97150
  createVNode(CShortcutIcon, { icon: "arrow-up" }),
@@ -97298,7 +97186,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97298
97186
  }
97299
97187
  });
97300
97188
 
97301
- const CAlgoliaSearch = /* @__PURE__ */ _export_sfc(_sfc_main$5K, [["__scopeId", "data-v-52d9ac98"]]);
97189
+ const CAlgoliaSearch = /* @__PURE__ */ _export_sfc(_sfc_main$5K, [["__scopeId", "data-v-da2357d4"]]);
97302
97190
 
97303
97191
  const BulletListExtended = BulletList.extend({
97304
97192
  addOptions() {
@@ -99365,6 +99253,25 @@ const INITIAL_CALL_STATE = {
99365
99253
  };
99366
99254
 
99367
99255
  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
+ }
99368
99275
  function isEmptyValue(value) {
99369
99276
  return !value || typeof value === "string" && value.trim() === "";
99370
99277
  }
@@ -99384,6 +99291,7 @@ function removeEmptyValues(obj) {
99384
99291
  return result;
99385
99292
  }
99386
99293
  function useCrmShape() {
99294
+ const { activeCanvas } = useCanvas$1();
99387
99295
  const call = useLocalStorage(CALL_STORAGE_KEY, INITIAL_CALL_STATE, {
99388
99296
  deep: true,
99389
99297
  listenToStorageChanges: true
@@ -99400,6 +99308,13 @@ function useCrmShape() {
99400
99308
  "myUser",
99401
99309
  computed(() => null)
99402
99310
  );
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
+ });
99403
99318
  function getDefaultCrmShape({
99404
99319
  accountName = "",
99405
99320
  myUser: myUser2 = null,
@@ -99438,7 +99353,9 @@ function useCrmShape() {
99438
99353
  showDefault: !!launchDarkly.value.enable_default_crm_shape
99439
99354
  }),
99440
99355
  isEmpty(realTimeExtraCrmShape.value) ? {} : realTimeExtraCrmShape.value,
99441
- isEmpty(extraCrmShape.value) ? {} : extraCrmShape.value
99356
+ isEmpty(extraCrmShape.value) ? {} : extraCrmShape.value,
99357
+ // Derive schema from actual pitcher_data in canvas context
99358
+ isEmpty(pitcherDataSchema.value) ? {} : pitcherDataSchema.value
99442
99359
  );
99443
99360
  });
99444
99361
  return {
@@ -120908,7 +120825,7 @@ const _sfc_main$4k = /* @__PURE__ */ defineComponent({
120908
120825
 
120909
120826
  function useCanvasContext() {
120910
120827
  const { activeCanvas, isPrintDisplayMode, builderCache } = useCanvas$1();
120911
- const { getDefaultCrmShape } = useCrmShape();
120828
+ const { crmShape, getDefaultCrmShape } = useCrmShape();
120912
120829
  const myUser = inject(
120913
120830
  "myUser",
120914
120831
  computed(() => null)
@@ -120940,14 +120857,21 @@ function useCanvasContext() {
120940
120857
  builderCache.value[sectionOverrideKey] = mergedCtx;
120941
120858
  return mergedCtx;
120942
120859
  };
120943
- const crmShape = computed(() => getDefaultCrmShape({ myUser: myUser.value }));
120944
- const crmShapeWithSectionCtx = computed(() => {
120860
+ const fullContext = computed(() => {
120945
120861
  const mergedCtx = getSectionCtx();
120946
- return !isEmpty(crmShape.value) ? { ...mergedCtx, ...crmShape.value } : mergedCtx;
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
+ });
120947
120872
  });
120948
120873
  return {
120949
- getSectionCtx,
120950
- crmShapeWithSectionCtx
120874
+ fullContext
120951
120875
  };
120952
120876
  }
120953
120877
 
@@ -120993,10 +120917,10 @@ const _sfc_main$4j = /* @__PURE__ */ defineComponent({
120993
120917
  __name: "SelectionPanel",
120994
120918
  setup(__props) {
120995
120919
  useCssVars((_ctx) => ({
120996
- "6fe3245a": unref(themeVars).text,
120997
- "6fdae5fe": unref(themeVars).base,
120998
- "85f799be": unref(themeVars).primary6,
120999
- "85f799c4": unref(themeVars).primary3
120920
+ "7e857d3a": unref(themeVars).text,
120921
+ "7e7d3ede": unref(themeVars).base,
120922
+ "e1e1c7fe": unref(themeVars).primary6,
120923
+ "e1e1c804": unref(themeVars).primary3
121000
120924
  }));
121001
120925
  const { t } = useI18n();
121002
120926
  const { renderContentType, isFileExpired, isFileExpiring } = useFileDisplayHelpers();
@@ -121018,7 +120942,7 @@ const _sfc_main$4j = /* @__PURE__ */ defineComponent({
121018
120942
  "launchDarkly",
121019
120943
  computed(() => ({}))
121020
120944
  );
121021
- const { crmShapeWithSectionCtx } = useCanvasContext();
120945
+ const { fullContext } = useCanvasContext();
121022
120946
  const isCrmShapeEnabled = computed(() => launchDarkly.value?.enable_crm_shape_for_external_links ?? false);
121023
120947
  const draggableItems = computed({
121024
120948
  get: () => isDragNDropEnabled.value ? addedItems.value : selectedItems.value,
@@ -121033,7 +120957,7 @@ const _sfc_main$4j = /* @__PURE__ */ defineComponent({
121033
120957
  function getParsedUrl(url) {
121034
120958
  if (!url || !isCrmShapeEnabled.value) return url;
121035
120959
  try {
121036
- return renderTemplate(url, crmShapeWithSectionCtx.value);
120960
+ return renderTemplate(url, fullContext.value);
121037
120961
  } catch (error) {
121038
120962
  console.warn("Failed to parse template in external URL, using original URL:", error);
121039
120963
  return url;
@@ -121337,7 +121261,7 @@ const _sfc_main$4j = /* @__PURE__ */ defineComponent({
121337
121261
  }
121338
121262
  });
121339
121263
 
121340
- const SelectionPanel = /* @__PURE__ */ _export_sfc(_sfc_main$4j, [["__scopeId", "data-v-aa03fa77"]]);
121264
+ const SelectionPanel = /* @__PURE__ */ _export_sfc(_sfc_main$4j, [["__scopeId", "data-v-05db071e"]]);
121341
121265
 
121342
121266
  const _hoisted_1$3q = { class: "flex justify-between gap-2 items-center truncate py-1" };
121343
121267
  const _hoisted_2$2z = {
@@ -123869,13 +123793,13 @@ const _sfc_main$45 = /* @__PURE__ */ defineComponent({
123869
123793
  computed(() => ({}))
123870
123794
  );
123871
123795
  const { crmShape } = useCrmShape();
123872
- const { crmShapeWithSectionCtx } = useCanvasContext();
123796
+ const { fullContext } = useCanvasContext();
123873
123797
  const isCrmShapeEnabled = computed(() => launchDarkly.value?.enable_crm_shape_for_external_links ?? false);
123874
123798
  const parsedUrl = computed(() => {
123875
123799
  if (!url.value.trim()) return url.value;
123876
123800
  if (!isCrmShapeEnabled.value) return url.value;
123877
123801
  try {
123878
- return renderTemplate(url.value, crmShapeWithSectionCtx.value);
123802
+ return renderTemplate(url.value, fullContext.value);
123879
123803
  } catch (error) {
123880
123804
  console.error("Error parsing URL template:", error);
123881
123805
  return url.value;
@@ -123981,7 +123905,7 @@ const _sfc_main$45 = /* @__PURE__ */ defineComponent({
123981
123905
  }
123982
123906
  });
123983
123907
 
123984
- const ExternalLinks = /* @__PURE__ */ _export_sfc(_sfc_main$45, [["__scopeId", "data-v-1287b675"]]);
123908
+ const ExternalLinks = /* @__PURE__ */ _export_sfc(_sfc_main$45, [["__scopeId", "data-v-ba7b39ff"]]);
123985
123909
 
123986
123910
  const _hoisted_1$3d = { class: "mr-3 h-full" };
123987
123911
  const _hoisted_2$2m = { class: "flex flex-col gap-3 mb-3" };
@@ -137802,19 +137726,37 @@ function useComponentPermissions({
137802
137726
  isAnyTypeOfAdmin: false
137803
137727
  }))
137804
137728
  );
137805
- const { canvasContent } = useCanvas$1();
137729
+ const launchDarkly = inject(
137730
+ "launchDarkly",
137731
+ computed(() => ({}))
137732
+ );
137733
+ const { canvasContent, activeCanvas } = useCanvas$1();
137806
137734
  return computed(() => {
137807
- if (!usedInSectionId.value) return calculateCanvasPermissions(id.value, !!pitcherInfo.value?.isAnyTypeOfAdmin);
137808
- const parent = findParentByNodeId(canvasContent.value, id.value);
137809
- const canRemove = !!when_used_in_section.value?.is_removable;
137810
- const canEdit = !!when_used_in_section.value?.is_editable;
137811
- const canDuplicate = parent ? !!parent.when_used_in_section?.is_editable : false;
137812
- return {
137813
- hasSomethingEditable: canEdit || canRemove || canDuplicate,
137814
- canRemove,
137815
- canEdit,
137816
- canDuplicate
137817
- };
137735
+ if (usedInSectionId.value) {
137736
+ const parent = findParentByNodeId(canvasContent.value, id.value);
137737
+ const canRemove = !!when_used_in_section.value?.is_removable;
137738
+ const canEdit = !!when_used_in_section.value?.is_editable;
137739
+ const canDuplicate = parent ? !!parent.when_used_in_section?.is_editable : false;
137740
+ return {
137741
+ hasSomethingEditable: canEdit || canRemove || canDuplicate,
137742
+ canRemove,
137743
+ canEdit,
137744
+ canDuplicate
137745
+ };
137746
+ }
137747
+ if (activeCanvas.value?.template?.id && launchDarkly.value.enable_template_component_permissions && when_used_in_section.value) {
137748
+ const parent = findParentByNodeId(canvasContent.value, id.value);
137749
+ const canRemove = !!when_used_in_section.value?.is_removable;
137750
+ const canEdit = !!when_used_in_section.value?.is_editable;
137751
+ const canDuplicate = parent ? !!parent.when_used_in_section?.is_editable : false;
137752
+ return {
137753
+ hasSomethingEditable: canEdit || canRemove || canDuplicate,
137754
+ canRemove,
137755
+ canEdit,
137756
+ canDuplicate
137757
+ };
137758
+ }
137759
+ return calculateCanvasPermissions(id.value, !!pitcherInfo.value?.isAnyTypeOfAdmin);
137818
137760
  });
137819
137761
  }
137820
137762
 
@@ -148067,7 +148009,7 @@ const _sfc_main$2i = /* @__PURE__ */ defineComponent({
148067
148009
  } = useCanvas$1();
148068
148010
  const { discardOverridesConfirmationOptions, getComponentOverrides } = useCanvasSectionOverrides();
148069
148011
  const { getDerivedStyleFromFeatureFlags } = useComponentStyle(componentNode);
148070
- const { crmShapeWithSectionCtx } = useCanvasContext();
148012
+ const { fullContext } = useCanvasContext();
148071
148013
  const { setContentSelectorMode } = useContentSelector();
148072
148014
  const confirmation = useConfirmation();
148073
148015
  const themeVars = useThemeVars();
@@ -148220,7 +148162,7 @@ const _sfc_main$2i = /* @__PURE__ */ defineComponent({
148220
148162
  try {
148221
148163
  return {
148222
148164
  ...value,
148223
- external_url: renderTemplate(value.external_url, crmShapeWithSectionCtx.value)
148165
+ external_url: renderTemplate(value.external_url, fullContext.value)
148224
148166
  };
148225
148167
  } catch (error) {
148226
148168
  console.warn("Failed to parse template in external URL, using original URL:", error);
@@ -148738,7 +148680,7 @@ const _sfc_main$2h = /* @__PURE__ */ defineComponent({
148738
148680
  setCanvasMetadata,
148739
148681
  isImpact
148740
148682
  } = useCanvas$1();
148741
- const { crmShapeWithSectionCtx } = useCanvasContext();
148683
+ const { fullContext } = useCanvasContext();
148742
148684
  const { coreRestApiAxios } = useCoreApi();
148743
148685
  const { applyPrintModeToElement } = usePrintMode();
148744
148686
  const { discardOverridesConfirmationOptions, getComponentOverrides } = useCanvasSectionOverrides();
@@ -148795,7 +148737,7 @@ const _sfc_main$2h = /* @__PURE__ */ defineComponent({
148795
148737
  const memoizedModelValue = computed(() => getModelValue(computedTextProps.value.data?.content));
148796
148738
  function getModelValue(value = "") {
148797
148739
  if (!shouldInterpolate.value || !value.trim()) return value;
148798
- return renderTemplate(value, crmShapeWithSectionCtx.value);
148740
+ return renderTemplate(value, fullContext.value);
148799
148741
  }
148800
148742
  const debouncedUpdateNodeData = debounce((data2, nodeId, sectionId) => {
148801
148743
  return updateNodeData(data2, nodeId, sectionId);
@@ -148903,7 +148845,7 @@ const _sfc_main$2h = /* @__PURE__ */ defineComponent({
148903
148845
  );
148904
148846
  applyPrintModeToElement(contentElement.value, () => {
148905
148847
  const content = computedTextProps.value.data?.content || "";
148906
- return shouldInterpolate.value ? renderTemplate(content, crmShapeWithSectionCtx.value) : content;
148848
+ return shouldInterpolate.value ? renderTemplate(content, fullContext.value) : content;
148907
148849
  });
148908
148850
  if (enableScaleContent && spanStyles) {
148909
148851
  setTimeout(() => {
@@ -149015,7 +148957,7 @@ const _sfc_main$2h = /* @__PURE__ */ defineComponent({
149015
148957
  }
149016
148958
  });
149017
148959
 
149018
- const Text = /* @__PURE__ */ _export_sfc(_sfc_main$2h, [["__scopeId", "data-v-b2424519"]]);
148960
+ const Text = /* @__PURE__ */ _export_sfc(_sfc_main$2h, [["__scopeId", "data-v-73a884c3"]]);
149019
148961
 
149020
148962
  const _hoisted_1$1Q = { class: "absolute top-2 right-2 flex items-center gap-1 z-10" };
149021
148963
  const _hoisted_2$1m = { class: "text-xs" };
@@ -162570,7 +162512,7 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
162570
162512
  );
162571
162513
  const areSectionsSystemControlled = computed(() => launchDarkly.value?.are_sections_system_controlled);
162572
162514
  const allowEditOrRemove = computed(
162573
- () => (selectedComponentType.value === ComponentTypes.Text || selectedComponentType.value === ComponentTypes.Carousel || selectedComponentType.value === ComponentTypes.Multimedia) && isAdmin.value && isSection.value
162515
+ () => isAdmin.value && launchDarkly.value.enable_template_component_permissions && (isSection.value || isCanvasTemplate.value)
162574
162516
  );
162575
162517
  const canSelectSectionListStrategy = computed(
162576
162518
  () => isAdmin.value && isCanvasTemplate.value && isSectionOrContentList.value
@@ -163133,7 +163075,7 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
163133
163075
  }
163134
163076
  });
163135
163077
 
163136
- const ComponentDrawerSettings = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__scopeId", "data-v-dce6a881"]]);
163078
+ const ComponentDrawerSettings = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__scopeId", "data-v-1114be0f"]]);
163137
163079
 
163138
163080
  function useConnectUpload() {
163139
163081
  async function uploadToConnect(formData) {
@@ -183759,8 +183701,14 @@ function getEventColor(sfEvent) {
183759
183701
  } else {
183760
183702
  isSubmitted = false;
183761
183703
  }
183704
+ const now = /* @__PURE__ */ new Date();
183762
183705
  if (isSubmitted) return SfEventColors.SUBMITTED;
183763
- else if (isAfter$1(/* @__PURE__ */ new Date(), new Date(sfEvent.EndDateTime))) return SfEventColors.PAST;
183706
+ else if (sfEvent.IsAllDayEvent) {
183707
+ const endDate = new Date(sfEvent.EndDateTime);
183708
+ const todayStart = startOfDay(now);
183709
+ const endDayStart = startOfDay(endDate);
183710
+ return isAfter$1(todayStart, endDayStart) ? SfEventColors.PAST : SfEventColors.PLANNED;
183711
+ } else if (isAfter$1(now, new Date(sfEvent.EndDateTime))) return SfEventColors.PAST;
183764
183712
  else return SfEventColors.PLANNED;
183765
183713
  }
183766
183714
  const minFutureDate = (date = /* @__PURE__ */ new Date()) => add(date, { minutes: MIN_DIFFERENCE_IN_MINUTES });