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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/canvas-ui.js CHANGED
@@ -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
@@ -95691,111 +95692,115 @@ const _hoisted_14$h = {
95691
95692
  key: 0,
95692
95693
  class: "flex items-center ml-2"
95693
95694
  };
95694
- const _hoisted_15$f = {
95695
- key: 2,
95695
+ const _hoisted_15$f = { class: "flex items-center" };
95696
+ const _hoisted_16$e = { key: 0 };
95697
+ const _hoisted_17$c = { class: "c-select-filter__popover w-[350px] rounded flex flex-col bg-base" };
95698
+ const _hoisted_18$a = { class: "pa-2 max-h-[300px] overflow-y-auto" };
95699
+ const _hoisted_19$a = {
95700
+ key: 0,
95696
95701
  class: "flex items-center ml-2"
95697
95702
  };
95698
- const _hoisted_16$e = { class: "flex flex-col w-full flex-1 min-h-0" };
95699
- const _hoisted_17$c = {
95703
+ const _hoisted_20$9 = { class: "flex flex-col w-full flex-1 min-h-0" };
95704
+ const _hoisted_21$7 = {
95700
95705
  key: 0,
95701
95706
  class: "flex-1 overflow-y-auto bg-white w-full pl-1 pr-6 py-0"
95702
95707
  };
95703
- const _hoisted_18$a = { class: "space-y-1 mt-4" };
95704
- const _hoisted_19$a = ["onClick"];
95705
- const _hoisted_20$9 = { class: "text-sm text-gray-700" };
95706
- const _hoisted_21$7 = { class: "flex items-center mb-0" };
95707
- const _hoisted_22$5 = { class: "text-sm font-bold text-gray-700" };
95708
+ const _hoisted_22$5 = { class: "space-y-1 mt-4" };
95708
95709
  const _hoisted_23$5 = ["onClick"];
95709
- const _hoisted_24$5 = {
95710
+ const _hoisted_24$5 = { class: "text-sm text-gray-700" };
95711
+ const _hoisted_25$5 = { class: "flex items-center mb-0" };
95712
+ const _hoisted_26$5 = { class: "text-sm font-bold text-gray-700" };
95713
+ const _hoisted_27$5 = ["onClick"];
95714
+ const _hoisted_28$5 = {
95710
95715
  key: 0,
95711
95716
  class: "relative mr-4"
95712
95717
  };
95713
- const _hoisted_25$5 = {
95718
+ const _hoisted_29$5 = {
95714
95719
  key: 0,
95715
95720
  class: "absolute inset-0 flex items-center justify-center bg-gray-200 bg-opacity-75 border-rounded-1"
95716
95721
  };
95717
- const _hoisted_26$5 = {
95722
+ const _hoisted_30$4 = {
95718
95723
  key: 1,
95719
95724
  class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center"
95720
95725
  };
95721
- const _hoisted_27$5 = { class: "flex-1 min-w-0" };
95722
- const _hoisted_28$5 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95723
- const _hoisted_29$5 = { class: "text-xs text-gray-500" };
95724
- const _hoisted_30$4 = {
95726
+ const _hoisted_31$4 = { class: "flex-1 min-w-0" };
95727
+ const _hoisted_32$4 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95728
+ const _hoisted_33$4 = { class: "text-xs text-gray-500" };
95729
+ const _hoisted_34$4 = {
95725
95730
  key: 1,
95726
95731
  class: "flex-1 overflow-y-auto bg-white w-full"
95727
95732
  };
95728
- const _hoisted_31$4 = { class: "w-full px-0" };
95729
- const _hoisted_32$4 = {
95733
+ const _hoisted_35$4 = { class: "w-full px-0" };
95734
+ const _hoisted_36$4 = {
95730
95735
  key: 0,
95731
95736
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95732
95737
  };
95733
- const _hoisted_33$4 = {
95738
+ const _hoisted_37$4 = {
95734
95739
  key: 0,
95735
95740
  class: "mb-0"
95736
95741
  };
95737
- const _hoisted_34$4 = { class: "flex items-center px-0 pt-2 pb-1" };
95738
- const _hoisted_35$4 = { class: "text-m font-semibold text-gray-900" };
95739
- const _hoisted_36$4 = { class: "ml-2 text-sm text-gray-500" };
95740
- const _hoisted_37$4 = ["data-result-selected", "onClick"];
95741
- const _hoisted_38$4 = {
95742
+ const _hoisted_38$4 = { class: "flex items-center px-0 pt-2 pb-1" };
95743
+ const _hoisted_39$4 = { class: "text-m font-semibold text-gray-900" };
95744
+ const _hoisted_40$4 = { class: "ml-2 text-sm text-gray-500" };
95745
+ const _hoisted_41$4 = ["data-result-selected", "onClick"];
95746
+ const _hoisted_42$4 = {
95742
95747
  key: 1,
95743
95748
  class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center"
95744
95749
  };
95745
- const _hoisted_39$4 = { class: "flex-1 min-w-0" };
95746
- const _hoisted_40$4 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95747
- const _hoisted_41$4 = ["innerHTML"];
95748
- const _hoisted_42$4 = { class: "text-xs text-gray-500" };
95749
- const _hoisted_43$4 = { class: "text-xs text-gray-400" };
95750
- const _hoisted_44$4 = {
95750
+ const _hoisted_43$4 = { class: "flex-1 min-w-0" };
95751
+ const _hoisted_44$4 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95752
+ const _hoisted_45$4 = ["innerHTML"];
95753
+ const _hoisted_46$4 = { class: "text-xs text-gray-500" };
95754
+ const _hoisted_47$4 = { class: "text-xs text-gray-400" };
95755
+ const _hoisted_48$4 = {
95751
95756
  key: 0,
95752
95757
  class: "px-0 py-0"
95753
95758
  };
95754
- const _hoisted_45$4 = { key: 1 };
95755
- const _hoisted_46$4 = { class: "flex items-center px-0 pt-2 pb-1" };
95756
- const _hoisted_47$4 = { class: "text-m font-semibold text-gray-900" };
95757
- const _hoisted_48$4 = { class: "ml-2 text-sm text-gray-500" };
95758
- const _hoisted_49$4 = ["data-result-selected", "onClick"];
95759
- 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" };
95760
- const _hoisted_51$3 = { class: "flex-1 min-w-0" };
95761
- const _hoisted_52$3 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95762
- const _hoisted_53$3 = { class: "text-xs text-gray-500" };
95763
- const _hoisted_54$2 = { class: "text-xs text-gray-400" };
95764
- const _hoisted_55$2 = {
95759
+ const _hoisted_49$4 = { key: 1 };
95760
+ const _hoisted_50$4 = { class: "flex items-center px-0 pt-2 pb-1" };
95761
+ const _hoisted_51$3 = { class: "text-m font-semibold text-gray-900" };
95762
+ const _hoisted_52$3 = { class: "ml-2 text-sm text-gray-500" };
95763
+ const _hoisted_53$3 = ["data-result-selected", "onClick"];
95764
+ const _hoisted_54$2 = { class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center" };
95765
+ const _hoisted_55$2 = { class: "flex-1 min-w-0" };
95766
+ const _hoisted_56$2 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95767
+ const _hoisted_57$2 = { class: "text-xs text-gray-500" };
95768
+ const _hoisted_58$2 = { class: "text-xs text-gray-400" };
95769
+ const _hoisted_59$2 = {
95765
95770
  key: 0,
95766
95771
  class: "px-0 py-0"
95767
95772
  };
95768
- const _hoisted_56$2 = {
95773
+ const _hoisted_60$2 = {
95769
95774
  key: 2,
95770
95775
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95771
95776
  };
95772
- const _hoisted_57$2 = {
95777
+ const _hoisted_61$2 = {
95773
95778
  key: 2,
95774
95779
  class: "flex-1 overflow-y-auto bg-white w-full"
95775
95780
  };
95776
- const _hoisted_58$2 = { class: "w-full px-0" };
95777
- const _hoisted_59$2 = {
95781
+ const _hoisted_62$2 = { class: "w-full px-0" };
95782
+ const _hoisted_63$2 = {
95778
95783
  key: 0,
95779
95784
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95780
95785
  };
95781
- const _hoisted_60$2 = { class: "flex items-center px-0 pt-2 pb-1" };
95782
- const _hoisted_61$2 = { class: "text-m font-semibold text-gray-900" };
95783
- const _hoisted_62$2 = { class: "ml-2 text-sm text-gray-500" };
95784
- const _hoisted_63$2 = ["data-result-selected", "onClick"];
95785
- const _hoisted_64$2 = {
95786
+ const _hoisted_64$2 = { class: "flex items-center px-0 pt-2 pb-1" };
95787
+ const _hoisted_65$2 = { class: "text-m font-semibold text-gray-900" };
95788
+ const _hoisted_66$2 = { class: "ml-2 text-sm text-gray-500" };
95789
+ const _hoisted_67$2 = ["data-result-selected", "onClick"];
95790
+ const _hoisted_68$2 = {
95786
95791
  key: 1,
95787
95792
  class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center"
95788
95793
  };
95789
- const _hoisted_65$2 = { class: "flex-1 min-w-0" };
95790
- const _hoisted_66$2 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95791
- const _hoisted_67$2 = ["innerHTML"];
95792
- const _hoisted_68$2 = { class: "text-xs text-gray-500" };
95793
- const _hoisted_69$1 = { class: "text-xs text-gray-400" };
95794
- const _hoisted_70$1 = {
95794
+ const _hoisted_69$1 = { class: "flex-1 min-w-0" };
95795
+ const _hoisted_70$1 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95796
+ const _hoisted_71$1 = ["innerHTML"];
95797
+ const _hoisted_72$1 = { class: "text-xs text-gray-500" };
95798
+ const _hoisted_73$1 = { class: "text-xs text-gray-400" };
95799
+ const _hoisted_74$1 = {
95795
95800
  key: 0,
95796
95801
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95797
95802
  };
95798
- const _hoisted_71$1 = {
95803
+ const _hoisted_75$1 = {
95799
95804
  key: 0,
95800
95805
  class: "flex flex-wrap line-height-6 pt-4 pb-2 px-6 border-t border-gray-200 gap-y-4 gap-x-4"
95801
95806
  };
@@ -95822,6 +95827,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95822
95827
  const selectedFileTypes = ref([]);
95823
95828
  const showFileTypeDropdown = ref(false);
95824
95829
  const selectedCanvasFilters = ref([]);
95830
+ const showCanvasTypeDropdown = ref(false);
95825
95831
  const fileTypeOptions = [
95826
95832
  { label: "Folder", value: "folder" },
95827
95833
  { label: "PDF", value: "pdf" },
@@ -95834,6 +95840,42 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95834
95840
  { label: "AR", value: "ar" },
95835
95841
  { label: "Web", value: "web" }
95836
95842
  ];
95843
+ const canvasTypeOptions = computed(() => {
95844
+ const options = [
95845
+ { label: t("canvasUI.CAlgoliaSearch.canvasFilters.templates"), value: "template" },
95846
+ { label: t("canvasUI.CAlgoliaSearch.canvasFilters.products"), value: "section" },
95847
+ { label: t("canvasUI.CAlgoliaSearch.canvasFilters.blocks"), value: "block" }
95848
+ ];
95849
+ if (!props.isAdmin) {
95850
+ options.unshift({ label: t("canvasUI.CAlgoliaSearch.canvasFilters.saved"), value: "saved_canvas" });
95851
+ }
95852
+ if (props.isAdmin) {
95853
+ options.splice(1, 0, {
95854
+ label: t("canvasUI.CAlgoliaSearch.canvasFilters.productTemplates"),
95855
+ value: "product_template"
95856
+ });
95857
+ }
95858
+ return options;
95859
+ });
95860
+ const ALLOWED_CANVAS_TYPES = ["saved_canvas", "template", "product_template", "section", "block"];
95861
+ const ALLOWED_FILE_TYPES = [
95862
+ "folder",
95863
+ "pdf",
95864
+ "image",
95865
+ "audio",
95866
+ "video",
95867
+ "document",
95868
+ "presentation",
95869
+ "spreadsheet",
95870
+ "ar",
95871
+ "web"
95872
+ ];
95873
+ const visibleCanvasTypeOptions = computed(() => {
95874
+ if (showRecentView.value || !searchQuery.value.trim()) {
95875
+ return canvasTypeOptions.value;
95876
+ }
95877
+ return canvasTypeOptions.value.filter((option) => availableCanvasTypes.value.has(option.value));
95878
+ });
95837
95879
  const hasActiveFilters = computed(() => selectedFileTypes.value.length > 0 || selectedCanvasFilters.value.length > 0);
95838
95880
  const clearAllFilters = () => {
95839
95881
  selectedFileTypes.value = [];
@@ -95844,7 +95886,9 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95844
95886
  selectedFileTypes.value = [];
95845
95887
  selectedCanvasFilters.value = [];
95846
95888
  searchType.value = null;
95847
- if (searchQuery.value.trim()) {
95889
+ if (searchQuery.value.trim() && (unfilteredContentResults.value.length > 0 || unfilteredCanvasResults.value.length > 0)) {
95890
+ applyFiltersToResults();
95891
+ } else if (searchQuery.value.trim()) {
95848
95892
  try {
95849
95893
  skipNextSuggestionFetch.value = true;
95850
95894
  await performSearch(searchQuery.value);
@@ -95980,8 +96024,11 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95980
96024
  };
95981
96025
  const contentResults = ref([]);
95982
96026
  const canvasResults = ref([]);
96027
+ const unfilteredContentResults = ref([]);
96028
+ const unfilteredCanvasResults = ref([]);
95983
96029
  const isSearching = ref(false);
95984
96030
  const hasSearchCompleted = ref(false);
96031
+ let currentSearchId = 0;
95985
96032
  const querySuggestions = ref([]);
95986
96033
  const selectedSuggestionIndex = ref(-1);
95987
96034
  const selectedResultIndex = ref(-1);
@@ -95998,6 +96045,44 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95998
96045
  }
95999
96046
  return canvasResults.value;
96000
96047
  });
96048
+ const availableFileTypes = computed(() => {
96049
+ if (showRecentView.value || !searchQuery.value.trim()) {
96050
+ return /* @__PURE__ */ new Set();
96051
+ }
96052
+ const types = /* @__PURE__ */ new Set();
96053
+ unfilteredContentResults.value.forEach((item) => {
96054
+ if (item.type === "folder") {
96055
+ types.add("folder");
96056
+ } else if (item.type === "file" && item.file_category) {
96057
+ types.add(item.file_category);
96058
+ }
96059
+ });
96060
+ return types;
96061
+ });
96062
+ const availableCanvasTypes = computed(() => {
96063
+ if (showRecentView.value || !searchQuery.value.trim()) {
96064
+ return /* @__PURE__ */ new Set();
96065
+ }
96066
+ const types = /* @__PURE__ */ new Set();
96067
+ unfilteredCanvasResults.value.forEach((item) => {
96068
+ if (item.content_type) {
96069
+ types.add(item.content_type);
96070
+ }
96071
+ });
96072
+ return types;
96073
+ });
96074
+ const visibleFileTypeOptions = computed(() => {
96075
+ if (showRecentView.value || !searchQuery.value.trim()) {
96076
+ return fileTypeOptions;
96077
+ }
96078
+ return fileTypeOptions.filter((option) => availableFileTypes.value.has(option.value));
96079
+ });
96080
+ const hasContentFilters = computed(() => {
96081
+ return visibleFileTypeOptions.value.length > 0 || selectedFileTypes.value.length > 0;
96082
+ });
96083
+ const hasCanvasFilters = computed(() => {
96084
+ return visibleCanvasTypeOptions.value.length > 0 || selectedCanvasFilters.value.length > 0;
96085
+ });
96001
96086
  const shouldShowNoResults = computed(() => {
96002
96087
  if (showRecentView.value || !searchQuery.value.trim() || isSearching.value || !hasSearchCompleted.value) return false;
96003
96088
  if (searchType.value === "content") {
@@ -96041,6 +96126,32 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96041
96126
  };
96042
96127
  watch(searchType, () => {
96043
96128
  selectedResultIndex.value = -1;
96129
+ showFileTypeDropdown.value = false;
96130
+ showCanvasTypeDropdown.value = false;
96131
+ });
96132
+ watch(visibleFileTypeOptions, (newOptions) => {
96133
+ if (selectedFileTypes.value.length > 0) {
96134
+ const availableValues = new Set(newOptions.map((option) => option.value));
96135
+ const stillAvailable = selectedFileTypes.value.filter((type) => availableValues.has(type));
96136
+ if (stillAvailable.length !== selectedFileTypes.value.length) {
96137
+ selectedFileTypes.value = stillAvailable;
96138
+ if (searchQuery.value.trim()) {
96139
+ performSearch(searchQuery.value.trim());
96140
+ }
96141
+ }
96142
+ }
96143
+ });
96144
+ watch(visibleCanvasTypeOptions, (newOptions) => {
96145
+ if (selectedCanvasFilters.value.length > 0) {
96146
+ const availableValues = new Set(newOptions.map((option) => option.value));
96147
+ const stillAvailable = selectedCanvasFilters.value.filter((type) => availableValues.has(type));
96148
+ if (stillAvailable.length !== selectedCanvasFilters.value.length) {
96149
+ selectedCanvasFilters.value = stillAvailable;
96150
+ if (searchQuery.value.trim()) {
96151
+ performSearch(searchQuery.value.trim());
96152
+ }
96153
+ }
96154
+ }
96044
96155
  });
96045
96156
  const scrollSelectedResultIntoView = () => {
96046
96157
  nextTick(() => {
@@ -96084,6 +96195,8 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96084
96195
  if (!query.trim()) {
96085
96196
  contentResults.value = [];
96086
96197
  canvasResults.value = [];
96198
+ unfilteredContentResults.value = [];
96199
+ unfilteredCanvasResults.value = [];
96087
96200
  hasSearchCompleted.value = false;
96088
96201
  isSearching.value = false;
96089
96202
  searchError.value = null;
@@ -96092,59 +96205,51 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96092
96205
  isSearching.value = true;
96093
96206
  hasSearchCompleted.value = false;
96094
96207
  searchError.value = null;
96208
+ const searchId = ++currentSearchId;
96095
96209
  const shouldSkipSuggestionFetch = skipNextSuggestionFetch.value;
96096
96210
  if (shouldSkipSuggestionFetch) {
96097
96211
  skipNextSuggestionFetch.value = false;
96098
96212
  }
96099
96213
  try {
96100
- const ALLOWED_CANVAS_TYPES = ["saved_canvas", "template", "product_template", "section", "block"];
96101
- const ALLOWED_FILE_TYPES = [
96102
- "folder",
96103
- "pdf",
96104
- "image",
96105
- "audio",
96106
- "video",
96107
- "document",
96108
- "presentation",
96109
- "spreadsheet",
96110
- "ar",
96111
- "web"
96112
- ];
96113
- const validCanvasFilters = selectedCanvasFilters.value.filter((f) => ALLOWED_CANVAS_TYPES.includes(f));
96114
- if (selectedCanvasFilters.value.length > 0 && validCanvasFilters.length === 0) {
96115
- console.warn(
96116
- "[CAlgoliaSearch] All selected canvas filters are invalid and were removed:",
96117
- selectedCanvasFilters.value
96118
- );
96119
- selectedCanvasFilters.value = [];
96120
- } else if (validCanvasFilters.length < selectedCanvasFilters.value.length) {
96121
- const removedFilters = selectedCanvasFilters.value.filter((f) => !validCanvasFilters.includes(f));
96122
- console.warn("[CAlgoliaSearch] Some canvas filters were invalid and removed:", removedFilters);
96214
+ const validCanvasFilters = selectedCanvasFilters.value.filter((filter) => ALLOWED_CANVAS_TYPES.includes(filter));
96215
+ if (selectedCanvasFilters.value.length !== validCanvasFilters.length) {
96216
+ const invalid = selectedCanvasFilters.value.filter((filter) => !ALLOWED_CANVAS_TYPES.includes(filter));
96217
+ console.warn("[CAlgoliaSearch] Invalid canvas filters removed:", invalid);
96123
96218
  selectedCanvasFilters.value = validCanvasFilters;
96124
96219
  }
96125
- const canvasFilters = validCanvasFilters.length > 0 ? ` AND (${validCanvasFilters.map((filter) => `content_type:"${filter}"`).join(" OR ")})` : "";
96126
- const validFileTypes = selectedFileTypes.value.filter((t2) => ALLOWED_FILE_TYPES.includes(t2));
96127
- if (selectedFileTypes.value.length > 0 && validFileTypes.length === 0) {
96128
- console.warn(
96129
- "[CAlgoliaSearch] All selected file type filters are invalid and were removed:",
96130
- selectedFileTypes.value
96131
- );
96132
- selectedFileTypes.value = [];
96133
- } else if (validFileTypes.length < selectedFileTypes.value.length) {
96134
- const removedFilters = selectedFileTypes.value.filter((t2) => !validFileTypes.includes(t2));
96135
- console.warn("[CAlgoliaSearch] Some file type filters were invalid and removed:", removedFilters);
96220
+ const validFileTypes = selectedFileTypes.value.filter((type) => ALLOWED_FILE_TYPES.includes(type));
96221
+ if (selectedFileTypes.value.length !== validFileTypes.length) {
96222
+ const invalid = selectedFileTypes.value.filter((type) => !ALLOWED_FILE_TYPES.includes(type));
96223
+ console.warn("[CAlgoliaSearch] Invalid file type filters removed:", invalid);
96136
96224
  selectedFileTypes.value = validFileTypes;
96137
96225
  }
96138
- const contentFilters = validFileTypes.length > 0 ? ` AND (${validFileTypes.map((type) => type === "folder" ? `type:"${type}"` : `file_category:"${type}"`).join(" OR ")})` : "";
96139
96226
  const results = await searchViaBackend(query.trim(), {
96140
- canvas: canvasFilters,
96141
- content: contentFilters
96227
+ canvas: "",
96228
+ content: ""
96142
96229
  });
96143
96230
  if (query.trim() !== searchQuery.value.trim()) {
96144
96231
  return;
96145
96232
  }
96146
- contentResults.value = results.content?.hits || [];
96147
- canvasResults.value = results.canvas?.hits || [];
96233
+ unfilteredContentResults.value = results.content?.hits || [];
96234
+ unfilteredCanvasResults.value = results.canvas?.hits || [];
96235
+ let filteredContent = unfilteredContentResults.value;
96236
+ let filteredCanvas = unfilteredCanvasResults.value;
96237
+ if (validFileTypes.length > 0) {
96238
+ filteredContent = filteredContent.filter((item) => {
96239
+ if (validFileTypes.includes("folder") && item.type === "folder") {
96240
+ return true;
96241
+ }
96242
+ if (item.type === "file") {
96243
+ return validFileTypes.includes(item.file_category);
96244
+ }
96245
+ return false;
96246
+ });
96247
+ }
96248
+ if (validCanvasFilters.length > 0) {
96249
+ filteredCanvas = filteredCanvas.filter((item) => validCanvasFilters.includes(item.content_type));
96250
+ }
96251
+ contentResults.value = filteredContent;
96252
+ canvasResults.value = filteredCanvas;
96148
96253
  selectedResultIndex.value = -1;
96149
96254
  searchError.value = null;
96150
96255
  if (query.trim().length >= 2 && !shouldSkipSuggestionFetch) {
@@ -96157,23 +96262,27 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96157
96262
  }
96158
96263
  await nextTick();
96159
96264
  setTimeout(() => {
96160
- isSearching.value = false;
96161
- hasSearchCompleted.value = true;
96265
+ if (searchId === currentSearchId) {
96266
+ isSearching.value = false;
96267
+ hasSearchCompleted.value = true;
96268
+ }
96162
96269
  }, 50);
96163
96270
  } catch (error) {
96164
96271
  console.error("Search error:", error);
96165
- contentResults.value = [];
96166
- canvasResults.value = [];
96167
- isSearching.value = false;
96168
- hasSearchCompleted.value = true;
96169
- if (error.message === "AUTH_REQUIRED") {
96170
- searchError.value = "Please sign in to search";
96171
- } else if (error.message === "AUTH_EXPIRED") {
96172
- searchError.value = "Your session has expired. Please sign in again";
96173
- } else if (error.message === "AUTH_FORBIDDEN") {
96174
- searchError.value = "You do not have permission to search this instance";
96175
- } else {
96176
- searchError.value = "Search failed. Please try again";
96272
+ if (searchId === currentSearchId) {
96273
+ contentResults.value = [];
96274
+ canvasResults.value = [];
96275
+ isSearching.value = false;
96276
+ hasSearchCompleted.value = true;
96277
+ if (error.message === "AUTH_REQUIRED") {
96278
+ searchError.value = "Please sign in to search";
96279
+ } else if (error.message === "AUTH_EXPIRED") {
96280
+ searchError.value = "Your session has expired. Please sign in again";
96281
+ } else if (error.message === "AUTH_FORBIDDEN") {
96282
+ searchError.value = "You do not have permission to search this instance";
96283
+ } else {
96284
+ searchError.value = "Search failed. Please try again";
96285
+ }
96177
96286
  }
96178
96287
  }
96179
96288
  };
@@ -96183,19 +96292,38 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96183
96292
  if (!query || typeof query !== "string") return "";
96184
96293
  return query;
96185
96294
  }
96295
+ function applyFiltersToResults() {
96296
+ if (unfilteredContentResults.value.length === 0 && unfilteredCanvasResults.value.length === 0) {
96297
+ return;
96298
+ }
96299
+ const validFileTypes = selectedFileTypes.value.filter((type) => ALLOWED_FILE_TYPES.includes(type));
96300
+ const validCanvasFilters = selectedCanvasFilters.value.filter((type) => ALLOWED_CANVAS_TYPES.includes(type));
96301
+ let filteredContent = unfilteredContentResults.value;
96302
+ let filteredCanvas = unfilteredCanvasResults.value;
96303
+ if (validFileTypes.length > 0) {
96304
+ filteredContent = filteredContent.filter((item) => {
96305
+ if (validFileTypes.includes("folder") && item.type === "folder") {
96306
+ return true;
96307
+ }
96308
+ if (item.type === "file") {
96309
+ return validFileTypes.includes(item.file_category);
96310
+ }
96311
+ return false;
96312
+ });
96313
+ }
96314
+ if (validCanvasFilters.length > 0) {
96315
+ filteredCanvas = filteredCanvas.filter((item) => validCanvasFilters.includes(item.content_type));
96316
+ }
96317
+ contentResults.value = filteredContent;
96318
+ canvasResults.value = filteredCanvas;
96319
+ selectedResultIndex.value = -1;
96320
+ }
96186
96321
  const debouncedFilterSearch = () => {
96187
96322
  if (filterChangeTimer) clearTimeout(filterChangeTimer);
96188
96323
  if (searchTimer) clearTimeout(searchTimer);
96189
96324
  filterChangeTimer = setTimeout(async () => {
96190
96325
  if (searchQuery.value.trim() && !showRecentView.value) {
96191
- try {
96192
- skipNextSuggestionFetch.value = true;
96193
- await performSearch(searchQuery.value);
96194
- } catch (error) {
96195
- console.error("[debouncedFilterSearch] Search failed:", error);
96196
- } finally {
96197
- skipNextSuggestionFetch.value = false;
96198
- }
96326
+ applyFiltersToResults();
96199
96327
  }
96200
96328
  }, 500);
96201
96329
  };
@@ -96221,6 +96349,8 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96221
96349
  showRecentView.value = true;
96222
96350
  contentResults.value = [];
96223
96351
  canvasResults.value = [];
96352
+ unfilteredContentResults.value = [];
96353
+ unfilteredCanvasResults.value = [];
96224
96354
  querySuggestions.value = [];
96225
96355
  selectedSuggestionIndex.value = -1;
96226
96356
  selectedResultIndex.value = -1;
@@ -96234,6 +96364,8 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96234
96364
  showRecentView.value = true;
96235
96365
  contentResults.value = [];
96236
96366
  canvasResults.value = [];
96367
+ unfilteredContentResults.value = [];
96368
+ unfilteredCanvasResults.value = [];
96237
96369
  querySuggestions.value = [];
96238
96370
  selectedSuggestionIndex.value = -1;
96239
96371
  selectedResultIndex.value = -1;
@@ -96358,31 +96490,31 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96358
96490
  if (endChar < highlightValue.length) truncated = truncated + "...";
96359
96491
  return sanitizeHtml(truncated);
96360
96492
  };
96361
- const toggleCanvasFilter = (filterType) => {
96362
- if (selectedCanvasFilters.value.includes(filterType)) {
96363
- selectedCanvasFilters.value.splice(selectedCanvasFilters.value.indexOf(filterType), 1);
96493
+ const handleFileTypeToggle = (value, checked) => {
96494
+ if (checked) {
96495
+ if (!selectedFileTypes.value.includes(value)) {
96496
+ selectedFileTypes.value.push(value);
96497
+ }
96364
96498
  } else {
96365
- selectedCanvasFilters.value.push(filterType);
96499
+ selectedFileTypes.value = selectedFileTypes.value.filter((v) => v !== value);
96366
96500
  }
96367
96501
  debouncedFilterSearch();
96368
96502
  };
96369
- const clearCanvasFilters = () => {
96370
- selectedCanvasFilters.value = [];
96371
- debouncedFilterSearch();
96372
- };
96373
- const toggleFileType = (fileType, checked) => {
96503
+ const handleCanvasTypeToggle = (value, checked) => {
96374
96504
  if (checked) {
96375
- if (!selectedFileTypes.value.includes(fileType)) {
96376
- selectedFileTypes.value.push(fileType);
96505
+ if (!selectedCanvasFilters.value.includes(value)) {
96506
+ selectedCanvasFilters.value.push(value);
96377
96507
  }
96378
96508
  } else {
96379
- const index = selectedFileTypes.value.indexOf(fileType);
96380
- if (index > -1) {
96381
- selectedFileTypes.value.splice(index, 1);
96382
- }
96509
+ selectedCanvasFilters.value = selectedCanvasFilters.value.filter((v) => v !== value);
96383
96510
  }
96384
96511
  debouncedFilterSearch();
96385
96512
  };
96513
+ const clearCanvasFilters = () => {
96514
+ selectedCanvasFilters.value = [];
96515
+ showCanvasTypeDropdown.value = false;
96516
+ debouncedFilterSearch();
96517
+ };
96386
96518
  const clearFileTypes = () => {
96387
96519
  selectedFileTypes.value = [];
96388
96520
  showFileTypeDropdown.value = false;
@@ -96553,7 +96685,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96553
96685
  show: "",
96554
96686
  verticalAlignment: "top",
96555
96687
  "z-index": _ctx.zIndex,
96556
- "onUpdate:show": _cache[15] || (_cache[15] = ($event) => emit("toggleSearch", $event))
96688
+ "onUpdate:show": _cache[12] || (_cache[12] = ($event) => emit("toggleSearch", $event))
96557
96689
  }, {
96558
96690
  default: withCtx(() => [
96559
96691
  createElementVNode("div", {
@@ -96562,7 +96694,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96562
96694
  }, [
96563
96695
  createElementVNode("div", _hoisted_1$4w, [
96564
96696
  createElementVNode("div", _hoisted_2$3j, [
96565
- _cache[16] || (_cache[16] = createElementVNode("div", { class: "absolute left-2.5 top-1/2 transform -translate-y-1/2 z-10" }, [
96697
+ _cache[13] || (_cache[13] = createElementVNode("div", { class: "absolute left-2.5 top-1/2 transform -translate-y-1/2 z-10" }, [
96566
96698
  createElementVNode("i", { class: "c-icon far fa-search text-gray-400 text-l" })
96567
96699
  ], -1)),
96568
96700
  withDirectives(createElementVNode("input", {
@@ -96659,7 +96791,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96659
96791
  createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.tabs.pitchDecks")), 1)
96660
96792
  ], 2)) : createCommentVNode("", true)
96661
96793
  ]),
96662
- searchType.value ? (openBlock(), createElementBlock("div", _hoisted_9$O, [
96794
+ searchType.value && (searchType.value === "content" && hasContentFilters.value || searchType.value === "canvases" && hasCanvasFilters.value) ? (openBlock(), createElementBlock("div", _hoisted_9$O, [
96663
96795
  searchType.value === "content" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
96664
96796
  createVNode(unref(NPopover), {
96665
96797
  class: "c-select-filter",
@@ -96695,24 +96827,23 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96695
96827
  default: withCtx(() => [
96696
96828
  createElementVNode("div", _hoisted_12$p, [
96697
96829
  createElementVNode("div", _hoisted_13$k, [
96698
- (openBlock(), createElementBlock(Fragment, null, renderList(fileTypeOptions, (option) => {
96699
- return createElementVNode("div", {
96830
+ (openBlock(true), createElementBlock(Fragment, null, renderList(visibleFileTypeOptions.value, (option) => {
96831
+ return openBlock(), createElementBlock("div", {
96700
96832
  key: option.value,
96701
96833
  class: "w-full h-7 flex items-center"
96702
96834
  }, [
96703
96835
  createVNode(unref(NCheckbox), {
96704
96836
  checked: selectedFileTypes.value.includes(option.value),
96705
96837
  class: "px-2 truncate",
96706
- "onUpdate:checked": (v) => toggleFileType(option.value, v),
96707
- value: option.value
96838
+ "onUpdate:checked": (checked) => handleFileTypeToggle(option.value, checked)
96708
96839
  }, {
96709
96840
  default: withCtx(() => [
96710
96841
  createTextVNode(toDisplayString(option.label), 1)
96711
96842
  ]),
96712
96843
  _: 2
96713
- }, 1032, ["checked", "onUpdate:checked", "value"])
96844
+ }, 1032, ["checked", "onUpdate:checked"])
96714
96845
  ]);
96715
- }), 64))
96846
+ }), 128))
96716
96847
  ]),
96717
96848
  createElementVNode("div", {
96718
96849
  class: "pa-2",
@@ -96735,114 +96866,99 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96735
96866
  _: 1
96736
96867
  }, 8, ["show"]),
96737
96868
  hasActiveFilters.value ? (openBlock(), createElementBlock("div", _hoisted_14$h, [
96738
- _cache[17] || (_cache[17] = createElementVNode("div", { class: "h-6 w-px bg-gray-300 mx-2" }, null, -1)),
96869
+ _cache[14] || (_cache[14] = createElementVNode("div", { class: "h-6 w-px bg-gray-300 mx-2" }, null, -1)),
96739
96870
  createElementVNode("span", {
96740
96871
  class: "text-sm text-gray-600 hover:text-gray-800 font-normal cursor-pointer",
96741
96872
  onClick: clearAllFilters
96742
96873
  }, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.clear")), 1)
96743
96874
  ])) : createCommentVNode("", true)
96744
96875
  ], 64)) : searchType.value === "canvases" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
96745
- !_ctx.isAdmin ? (openBlock(), createBlock(unref(NTag), {
96746
- key: 0,
96747
- class: "select-none cursor-pointer",
96748
- style: normalizeStyle({
96749
- "--n-color": selectedCanvasFilters.value.includes("saved_canvas") ? "var(--p-primary5)" : "var(--p-primary6)",
96750
- "--n-border": "1px solid var(--p-primary5)",
96751
- "--n-height": "28px"
96752
- }),
96753
- themeOverrides: {
96754
- borderRadius: "4px"
96755
- },
96756
- onClick: _cache[8] || (_cache[8] = ($event) => toggleCanvasFilter("saved_canvas"))
96757
- }, {
96758
- default: withCtx(() => [
96759
- createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.canvasFilters.saved")), 1)
96760
- ]),
96761
- _: 1
96762
- }, 8, ["style"])) : createCommentVNode("", true),
96763
- createVNode(unref(NTag), {
96764
- class: "select-none cursor-pointer",
96765
- style: normalizeStyle({
96766
- "--n-color": selectedCanvasFilters.value.includes("template") ? "var(--p-primary5)" : "var(--p-primary6)",
96767
- "--n-border": "1px solid var(--p-primary5)",
96768
- "--n-height": "28px"
96769
- }),
96770
- themeOverrides: {
96771
- borderRadius: "4px"
96772
- },
96773
- onClick: _cache[9] || (_cache[9] = ($event) => toggleCanvasFilter("template"))
96774
- }, {
96775
- default: withCtx(() => [
96776
- createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.canvasFilters.templates")), 1)
96777
- ]),
96778
- _: 1
96779
- }, 8, ["style"]),
96780
- _ctx.isAdmin ? (openBlock(), createBlock(unref(NTag), {
96781
- key: 1,
96782
- class: "select-none cursor-pointer",
96783
- style: normalizeStyle({
96784
- "--n-color": selectedCanvasFilters.value.includes("product_template") ? "var(--p-primary5)" : "var(--p-primary6)",
96785
- "--n-border": "1px solid var(--p-primary5)",
96786
- "--n-height": "28px"
96787
- }),
96788
- themeOverrides: {
96789
- borderRadius: "4px"
96790
- },
96791
- onClick: _cache[10] || (_cache[10] = ($event) => toggleCanvasFilter("product_template"))
96792
- }, {
96793
- default: withCtx(() => [
96794
- createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.canvasFilters.productTemplates")), 1)
96795
- ]),
96796
- _: 1
96797
- }, 8, ["style"])) : createCommentVNode("", true),
96798
- createVNode(unref(NTag), {
96799
- class: "select-none cursor-pointer",
96800
- style: normalizeStyle({
96801
- "--n-color": selectedCanvasFilters.value.includes("section") ? "var(--p-primary5)" : "var(--p-primary6)",
96802
- "--n-border": "1px solid var(--p-primary5)",
96803
- "--n-height": "28px"
96804
- }),
96805
- themeOverrides: {
96806
- borderRadius: "4px"
96807
- },
96808
- onClick: _cache[11] || (_cache[11] = ($event) => toggleCanvasFilter("section"))
96876
+ createVNode(unref(NPopover), {
96877
+ class: "c-select-filter",
96878
+ placement: "bottom-start",
96879
+ raw: "",
96880
+ show: showCanvasTypeDropdown.value,
96881
+ "show-arrow": false,
96882
+ trigger: "manual",
96883
+ onClickoutside: _cache[9] || (_cache[9] = ($event) => showCanvasTypeDropdown.value = false)
96809
96884
  }, {
96810
- default: withCtx(() => [
96811
- createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.canvasFilters.products")), 1)
96885
+ trigger: withCtx(() => [
96886
+ createVNode(unref(NTag), {
96887
+ class: "select-none cursor-pointer",
96888
+ style: normalizeStyle({
96889
+ "--n-color": selectedCanvasFilters.value.length ? "var(--p-primary5)" : "var(--p-primary6)",
96890
+ "--n-border": "1px solid var(--p-primary5)",
96891
+ "--n-height": "28px"
96892
+ }),
96893
+ themeOverrides: {
96894
+ borderRadius: "4px"
96895
+ },
96896
+ onClick: _cache[8] || (_cache[8] = ($event) => showCanvasTypeDropdown.value = !showCanvasTypeDropdown.value)
96897
+ }, {
96898
+ default: withCtx(() => [
96899
+ createElementVNode("div", _hoisted_15$f, [
96900
+ createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.type")), 1),
96901
+ selectedCanvasFilters.value.length ? (openBlock(), createElementBlock("span", _hoisted_16$e, ": " + toDisplayString(selectedCanvasFilters.value.length), 1)) : createCommentVNode("", true)
96902
+ ])
96903
+ ]),
96904
+ _: 1
96905
+ }, 8, ["style"])
96812
96906
  ]),
96813
- _: 1
96814
- }, 8, ["style"]),
96815
- createVNode(unref(NTag), {
96816
- class: "select-none cursor-pointer",
96817
- style: normalizeStyle({
96818
- "--n-color": selectedCanvasFilters.value.includes("block") ? "var(--p-primary5)" : "var(--p-primary6)",
96819
- "--n-border": "1px solid var(--p-primary5)",
96820
- "--n-height": "28px"
96821
- }),
96822
- themeOverrides: {
96823
- borderRadius: "4px"
96824
- },
96825
- onClick: _cache[12] || (_cache[12] = ($event) => toggleCanvasFilter("block"))
96826
- }, {
96827
96907
  default: withCtx(() => [
96828
- createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.canvasFilters.blocks")), 1)
96908
+ createElementVNode("div", _hoisted_17$c, [
96909
+ createElementVNode("div", _hoisted_18$a, [
96910
+ (openBlock(true), createElementBlock(Fragment, null, renderList(visibleCanvasTypeOptions.value, (option) => {
96911
+ return openBlock(), createElementBlock("div", {
96912
+ key: option.value,
96913
+ class: "w-full h-7 flex items-center"
96914
+ }, [
96915
+ createVNode(unref(NCheckbox), {
96916
+ checked: selectedCanvasFilters.value.includes(option.value),
96917
+ class: "px-2 truncate",
96918
+ "onUpdate:checked": (checked) => handleCanvasTypeToggle(option.value, checked)
96919
+ }, {
96920
+ default: withCtx(() => [
96921
+ createTextVNode(toDisplayString(option.label), 1)
96922
+ ]),
96923
+ _: 2
96924
+ }, 1032, ["checked", "onUpdate:checked"])
96925
+ ]);
96926
+ }), 128))
96927
+ ]),
96928
+ createElementVNode("div", {
96929
+ class: "pa-2",
96930
+ style: normalizeStyle({ borderTop: `1px solid ${unref(themeVars).primary5}` })
96931
+ }, [
96932
+ createVNode(CButton, {
96933
+ block: "",
96934
+ class: "pa-2",
96935
+ text: "",
96936
+ onClick: clearCanvasFilters
96937
+ }, {
96938
+ default: withCtx(() => [
96939
+ createTextVNode(toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.clear")), 1)
96940
+ ]),
96941
+ _: 1
96942
+ })
96943
+ ], 4)
96944
+ ])
96829
96945
  ]),
96830
96946
  _: 1
96831
- }, 8, ["style"]),
96832
- selectedCanvasFilters.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_15$f, [
96833
- _cache[18] || (_cache[18] = createElementVNode("div", { class: "h-6 w-px bg-gray-300 mx-2" }, null, -1)),
96947
+ }, 8, ["show"]),
96948
+ hasActiveFilters.value ? (openBlock(), createElementBlock("div", _hoisted_19$a, [
96949
+ _cache[15] || (_cache[15] = createElementVNode("div", { class: "h-6 w-px bg-gray-300 mx-2" }, null, -1)),
96834
96950
  createElementVNode("span", {
96835
96951
  class: "text-sm text-gray-600 hover:text-gray-800 font-normal cursor-pointer",
96836
- onClick: clearCanvasFilters
96952
+ onClick: clearAllFilters
96837
96953
  }, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.clear")), 1)
96838
96954
  ])) : createCommentVNode("", true)
96839
96955
  ], 64)) : createCommentVNode("", true)
96840
96956
  ])) : createCommentVNode("", true)
96841
96957
  ])) : createCommentVNode("", true)
96842
96958
  ]),
96843
- createElementVNode("div", _hoisted_16$e, [
96844
- showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_17$c, [
96845
- createElementVNode("div", _hoisted_18$a, [
96959
+ createElementVNode("div", _hoisted_20$9, [
96960
+ showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_21$7, [
96961
+ createElementVNode("div", _hoisted_22$5, [
96846
96962
  (openBlock(true), createElementBlock(Fragment, null, renderList(recentSearches.value, (search) => {
96847
96963
  return openBlock(), createElementBlock("div", {
96848
96964
  key: search,
@@ -96855,14 +96971,14 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96855
96971
  icon: "clock-rotate-left",
96856
96972
  size: "16"
96857
96973
  }),
96858
- createElementVNode("span", _hoisted_20$9, toDisplayString(search), 1)
96859
- ], 8, _hoisted_19$a);
96974
+ createElementVNode("span", _hoisted_24$5, toDisplayString(search), 1)
96975
+ ], 8, _hoisted_23$5);
96860
96976
  }), 128))
96861
96977
  ]),
96862
96978
  recentlyOpenedDocs.value.length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
96863
- _cache[19] || (_cache[19] = createElementVNode("hr", { class: "border-0 h-px bg-gray-200 mt-2 mb-3 w-full" }, null, -1)),
96864
- createElementVNode("div", _hoisted_21$7, [
96865
- createElementVNode("span", _hoisted_22$5, toDisplayString(unref(t)("canvasUI.components.fileViewer.recentlyOpened")), 1)
96979
+ _cache[16] || (_cache[16] = createElementVNode("hr", { class: "border-0 h-px bg-gray-200 mt-2 mb-3 w-full" }, null, -1)),
96980
+ createElementVNode("div", _hoisted_25$5, [
96981
+ createElementVNode("span", _hoisted_26$5, toDisplayString(unref(t)("canvasUI.components.fileViewer.recentlyOpened")), 1)
96866
96982
  ]),
96867
96983
  createElementVNode("div", {
96868
96984
  class: normalizeClass(_ctx.isAdmin ? "space-y-2" : "space-y-0")
@@ -96876,7 +96992,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96876
96992
  ]),
96877
96993
  onClick: ($event) => handleRecentDocClick(doc, doc.type)
96878
96994
  }, [
96879
- doc.type === "file" ? (openBlock(), createElementBlock("div", _hoisted_24$5, [
96995
+ doc.type === "file" ? (openBlock(), createElementBlock("div", _hoisted_28$5, [
96880
96996
  createVNode(_sfc_main$6K, {
96881
96997
  class: "h-14 border-rounded-1 overflow-hidden flex-0",
96882
96998
  cover: "",
@@ -96885,7 +97001,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96885
97001
  src: recentThumbnails.value[doc.id] || "",
96886
97002
  width: "72"
96887
97003
  }, null, 8, ["file-data", "src"]),
96888
- isLoadingThumbnails.value && !recentThumbnails.value[doc.id] ? (openBlock(), createElementBlock("div", _hoisted_25$5, [
97004
+ isLoadingThumbnails.value && !recentThumbnails.value[doc.id] ? (openBlock(), createElementBlock("div", _hoisted_29$5, [
96889
97005
  createVNode(CIcon, {
96890
97006
  class: "animate-spin",
96891
97007
  color: "var(--p-primary)",
@@ -96893,7 +97009,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96893
97009
  size: "20"
96894
97010
  })
96895
97011
  ])) : createCommentVNode("", true)
96896
- ])) : (openBlock(), createElementBlock("div", _hoisted_26$5, [
97012
+ ])) : (openBlock(), createElementBlock("div", _hoisted_30$4, [
96897
97013
  doc.type === "canvas" ? (openBlock(), createBlock(CIcon, {
96898
97014
  key: 0,
96899
97015
  color: "var(--p-text2)",
@@ -96906,33 +97022,33 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96906
97022
  size: "32"
96907
97023
  }))
96908
97024
  ])),
96909
- createElementVNode("div", _hoisted_27$5, [
96910
- createElementVNode("h3", _hoisted_28$5, toDisplayString(doc.name), 1),
96911
- createElementVNode("p", _hoisted_29$5, toDisplayString(doc.type === "canvas" ? formatCanvasType(doc.content_type) : doc.type === "folder" ? "Folder" : doc.file_category || "File"), 1)
97025
+ createElementVNode("div", _hoisted_31$4, [
97026
+ createElementVNode("h3", _hoisted_32$4, toDisplayString(doc.name), 1),
97027
+ createElementVNode("p", _hoisted_33$4, toDisplayString(doc.type === "canvas" ? formatCanvasType(doc.content_type) : doc.type === "folder" ? "Folder" : doc.file_category || "File"), 1)
96912
97028
  ])
96913
- ], 10, _hoisted_23$5);
97029
+ ], 10, _hoisted_27$5);
96914
97030
  }), 128))
96915
97031
  ], 2)
96916
97032
  ], 64)) : createCommentVNode("", true)
96917
- ])) : !searchType.value ? (openBlock(), createElementBlock("div", _hoisted_30$4, [
96918
- createElementVNode("div", _hoisted_31$4, [
96919
- isSearching.value ? (openBlock(), createElementBlock("div", _hoisted_32$4, [
97033
+ ])) : !searchType.value ? (openBlock(), createElementBlock("div", _hoisted_34$4, [
97034
+ createElementVNode("div", _hoisted_35$4, [
97035
+ isSearching.value ? (openBlock(), createElementBlock("div", _hoisted_36$4, [
96920
97036
  createVNode(CIcon, {
96921
97037
  class: "animate-spin text-6xl",
96922
97038
  color: "var(--p-primary)",
96923
97039
  icon: "spinner"
96924
97040
  })
96925
97041
  ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
96926
- filteredContentFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_33$4, [
96927
- createElementVNode("div", _hoisted_34$4, [
97042
+ filteredContentFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_37$4, [
97043
+ createElementVNode("div", _hoisted_38$4, [
96928
97044
  createVNode(CIcon, {
96929
97045
  class: "mr-2",
96930
97046
  color: "var(--p-text2)",
96931
97047
  icon: "folder",
96932
97048
  size: "16"
96933
97049
  }),
96934
- createElementVNode("span", _hoisted_35$4, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.sections.content")), 1),
96935
- createElementVNode("span", _hoisted_36$4, "(" + toDisplayString(filteredContentFiles.value.length) + ")", 1)
97050
+ createElementVNode("span", _hoisted_39$4, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.sections.content")), 1),
97051
+ createElementVNode("span", _hoisted_40$4, "(" + toDisplayString(filteredContentFiles.value.length) + ")", 1)
96936
97052
  ]),
96937
97053
  createElementVNode("div", null, [
96938
97054
  (openBlock(true), createElementBlock(Fragment, null, renderList(filteredContentFiles.value.slice(0, 5), (item) => {
@@ -96954,30 +97070,30 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96954
97070
  "object-fit": "cover",
96955
97071
  src: item.picture_url || "",
96956
97072
  width: "72"
96957
- }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_38$4, [
97073
+ }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_42$4, [
96958
97074
  createVNode(CIcon, {
96959
97075
  color: "var(--p-text2)",
96960
97076
  icon: "folder",
96961
97077
  size: "32"
96962
97078
  })
96963
97079
  ])),
96964
- createElementVNode("div", _hoisted_39$4, [
96965
- createElementVNode("h3", _hoisted_40$4, toDisplayString(item.name), 1),
97080
+ createElementVNode("div", _hoisted_43$4, [
97081
+ createElementVNode("h3", _hoisted_44$4, toDisplayString(item.name), 1),
96966
97082
  item.type === "file" && getSnippet(item) ? (openBlock(), createElementBlock("p", {
96967
97083
  key: 0,
96968
97084
  class: "text-xs text-gray-600 mb-1",
96969
97085
  innerHTML: getSnippet(item)
96970
- }, null, 8, _hoisted_41$4)) : createCommentVNode("", true),
96971
- createElementVNode("p", _hoisted_42$4, toDisplayString(item.type === "folder" ? "Folder" : item.file_category || item.content_type || "File"), 1)
97086
+ }, null, 8, _hoisted_45$4)) : createCommentVNode("", true),
97087
+ createElementVNode("p", _hoisted_46$4, toDisplayString(item.type === "folder" ? "Folder" : item.file_category || item.content_type || "File"), 1)
96972
97088
  ]),
96973
- createElementVNode("div", _hoisted_43$4, toDisplayString(item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
96974
- ], 10, _hoisted_37$4);
97089
+ createElementVNode("div", _hoisted_47$4, toDisplayString(item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
97090
+ ], 10, _hoisted_41$4);
96975
97091
  }), 128))
96976
97092
  ]),
96977
- filteredContentFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_44$4, [
97093
+ filteredContentFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_48$4, [
96978
97094
  createElementVNode("span", {
96979
97095
  class: "text-sm text-gray-600 hover:text-gray-800 font-bold flex items-center cursor-pointer",
96980
- onClick: _cache[13] || (_cache[13] = ($event) => searchType.value = "content")
97096
+ onClick: _cache[10] || (_cache[10] = ($event) => searchType.value = "content")
96981
97097
  }, [
96982
97098
  createTextVNode(toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.actions.viewAll")) + " ", 1),
96983
97099
  createVNode(CIcon, {
@@ -96988,16 +97104,16 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96988
97104
  ])
96989
97105
  ])) : createCommentVNode("", true)
96990
97106
  ])) : createCommentVNode("", true),
96991
- filteredCanvasFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_45$4, [
96992
- createElementVNode("div", _hoisted_46$4, [
97107
+ filteredCanvasFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_49$4, [
97108
+ createElementVNode("div", _hoisted_50$4, [
96993
97109
  createVNode(CIcon, {
96994
97110
  class: "mr-2",
96995
97111
  color: "var(--p-text2)",
96996
97112
  icon: "presentation",
96997
97113
  size: "16"
96998
97114
  }),
96999
- createElementVNode("span", _hoisted_47$4, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.sections.pitchDecks")), 1),
97000
- createElementVNode("span", _hoisted_48$4, "(" + toDisplayString(filteredCanvasFiles.value.length) + ")", 1)
97115
+ createElementVNode("span", _hoisted_51$3, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.sections.pitchDecks")), 1),
97116
+ createElementVNode("span", _hoisted_52$3, "(" + toDisplayString(filteredCanvasFiles.value.length) + ")", 1)
97001
97117
  ]),
97002
97118
  createElementVNode("div", null, [
97003
97119
  (openBlock(true), createElementBlock(Fragment, null, renderList(filteredCanvasFiles.value.slice(0, 5), (item) => {
@@ -97011,25 +97127,25 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97011
97127
  "data-result-selected": isResultSelected(item),
97012
97128
  onClick: ($event) => handleResultClick(item, "canvas")
97013
97129
  }, [
97014
- createElementVNode("div", _hoisted_50$4, [
97130
+ createElementVNode("div", _hoisted_54$2, [
97015
97131
  createVNode(CIcon, {
97016
97132
  color: "var(--p-text2)",
97017
97133
  icon: "presentation",
97018
97134
  size: "32"
97019
97135
  })
97020
97136
  ]),
97021
- createElementVNode("div", _hoisted_51$3, [
97022
- createElementVNode("h3", _hoisted_52$3, toDisplayString(item.name), 1),
97023
- createElementVNode("p", _hoisted_53$3, toDisplayString(formatCanvasType(item.content_type)), 1)
97137
+ createElementVNode("div", _hoisted_55$2, [
97138
+ createElementVNode("h3", _hoisted_56$2, toDisplayString(item.name), 1),
97139
+ createElementVNode("p", _hoisted_57$2, toDisplayString(formatCanvasType(item.content_type)), 1)
97024
97140
  ]),
97025
- createElementVNode("div", _hoisted_54$2, toDisplayString(item.folder?.name || ""), 1)
97026
- ], 10, _hoisted_49$4);
97141
+ createElementVNode("div", _hoisted_58$2, toDisplayString(item.folder?.name || ""), 1)
97142
+ ], 10, _hoisted_53$3);
97027
97143
  }), 128))
97028
97144
  ]),
97029
- filteredCanvasFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_55$2, [
97145
+ filteredCanvasFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_59$2, [
97030
97146
  createElementVNode("span", {
97031
97147
  class: "text-sm text-gray-600 hover:text-gray-800 font-bold flex items-center cursor-pointer",
97032
- onClick: _cache[14] || (_cache[14] = ($event) => searchType.value = "canvases")
97148
+ onClick: _cache[11] || (_cache[11] = ($event) => searchType.value = "canvases")
97033
97149
  }, [
97034
97150
  createTextVNode(toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.actions.viewAll")) + " ", 1),
97035
97151
  createVNode(CIcon, {
@@ -97040,7 +97156,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97040
97156
  ])
97041
97157
  ])) : createCommentVNode("", true)
97042
97158
  ])) : createCommentVNode("", true),
97043
- searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_56$2, [
97159
+ searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_60$2, [
97044
97160
  createVNode(CIcon, {
97045
97161
  class: "text-6xl",
97046
97162
  color: searchError.value ? "var(--p-error)" : "var(--p-text3)",
@@ -97053,16 +97169,16 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97053
97169
  ])) : createCommentVNode("", true)
97054
97170
  ], 64))
97055
97171
  ])
97056
- ])) : (openBlock(), createElementBlock("div", _hoisted_57$2, [
97057
- createElementVNode("div", _hoisted_58$2, [
97058
- isSearching.value ? (openBlock(), createElementBlock("div", _hoisted_59$2, [
97172
+ ])) : (openBlock(), createElementBlock("div", _hoisted_61$2, [
97173
+ createElementVNode("div", _hoisted_62$2, [
97174
+ isSearching.value ? (openBlock(), createElementBlock("div", _hoisted_63$2, [
97059
97175
  createVNode(CIcon, {
97060
97176
  class: "animate-spin text-6xl",
97061
97177
  color: "var(--p-primary)",
97062
97178
  icon: "spinner"
97063
97179
  })
97064
97180
  ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
97065
- createElementVNode("div", _hoisted_60$2, [
97181
+ createElementVNode("div", _hoisted_64$2, [
97066
97182
  searchType.value === "content" ? (openBlock(), createBlock(CIcon, {
97067
97183
  key: 0,
97068
97184
  class: "mr-2",
@@ -97076,8 +97192,8 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97076
97192
  icon: "presentation",
97077
97193
  size: "16"
97078
97194
  })),
97079
- createElementVNode("span", _hoisted_61$2, toDisplayString(searchType.value === "content" ? unref(t)("canvasUI.CAlgoliaSearch.sections.content") : unref(t)("canvasUI.CAlgoliaSearch.sections.pitchDecks")), 1),
97080
- createElementVNode("span", _hoisted_62$2, " (" + toDisplayString(searchType.value === "content" ? filteredContentFiles.value.length : filteredCanvasFiles.value.length) + ") ", 1)
97195
+ createElementVNode("span", _hoisted_65$2, toDisplayString(searchType.value === "content" ? unref(t)("canvasUI.CAlgoliaSearch.sections.content") : unref(t)("canvasUI.CAlgoliaSearch.sections.pitchDecks")), 1),
97196
+ createElementVNode("span", _hoisted_66$2, " (" + toDisplayString(searchType.value === "content" ? filteredContentFiles.value.length : filteredCanvasFiles.value.length) + ") ", 1)
97081
97197
  ]),
97082
97198
  createElementVNode("div", null, [
97083
97199
  (openBlock(true), createElementBlock(Fragment, null, renderList(searchType.value === "content" ? filteredContentFiles.value : filteredCanvasFiles.value, (item) => {
@@ -97102,7 +97218,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97102
97218
  "object-fit": "cover",
97103
97219
  src: item.picture_url || "",
97104
97220
  width: "72"
97105
- }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_64$2, [
97221
+ }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_68$2, [
97106
97222
  searchType.value === "content" ? (openBlock(), createBlock(CIcon, {
97107
97223
  key: 0,
97108
97224
  color: "var(--p-text2)",
@@ -97115,20 +97231,20 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97115
97231
  size: "32"
97116
97232
  }))
97117
97233
  ])),
97118
- createElementVNode("div", _hoisted_65$2, [
97119
- createElementVNode("h3", _hoisted_66$2, toDisplayString(item.name), 1),
97234
+ createElementVNode("div", _hoisted_69$1, [
97235
+ createElementVNode("h3", _hoisted_70$1, toDisplayString(item.name), 1),
97120
97236
  searchType.value === "content" && item.type === "file" && getSnippet(item) ? (openBlock(), createElementBlock("p", {
97121
97237
  key: 0,
97122
97238
  class: "text-xs text-gray-600 mb-1",
97123
97239
  innerHTML: getSnippet(item)
97124
- }, null, 8, _hoisted_67$2)) : createCommentVNode("", true),
97125
- createElementVNode("p", _hoisted_68$2, toDisplayString(searchType.value === "content" ? item.type === "folder" ? "Folder" : item.file_category || item.content_type || "File" : formatCanvasType(item.content_type)), 1)
97240
+ }, null, 8, _hoisted_71$1)) : createCommentVNode("", true),
97241
+ createElementVNode("p", _hoisted_72$1, toDisplayString(searchType.value === "content" ? item.type === "folder" ? "Folder" : item.file_category || item.content_type || "File" : formatCanvasType(item.content_type)), 1)
97126
97242
  ]),
97127
- createElementVNode("div", _hoisted_69$1, toDisplayString(searchType.value === "content" && item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
97128
- ], 10, _hoisted_63$2);
97243
+ createElementVNode("div", _hoisted_73$1, toDisplayString(searchType.value === "content" && item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
97244
+ ], 10, _hoisted_67$2);
97129
97245
  }), 128))
97130
97246
  ]),
97131
- searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_70$1, [
97247
+ searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_74$1, [
97132
97248
  createVNode(CIcon, {
97133
97249
  class: "text-6xl",
97134
97250
  color: searchError.value ? "var(--p-error)" : "var(--p-text3)",
@@ -97143,7 +97259,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97143
97259
  ])
97144
97260
  ]))
97145
97261
  ]),
97146
- !showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_71$1, [
97262
+ !showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_75$1, [
97147
97263
  createVNode(CShortcut, null, {
97148
97264
  default: withCtx(() => [
97149
97265
  createVNode(CShortcutIcon, { icon: "arrow-up" }),
@@ -97185,7 +97301,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97185
97301
  }
97186
97302
  });
97187
97303
 
97188
- const CAlgoliaSearch = /* @__PURE__ */ _export_sfc(_sfc_main$5K, [["__scopeId", "data-v-da2357d4"]]);
97304
+ const CAlgoliaSearch = /* @__PURE__ */ _export_sfc(_sfc_main$5K, [["__scopeId", "data-v-840d4fd4"]]);
97189
97305
 
97190
97306
  const BulletListExtended = BulletList.extend({
97191
97307
  addOptions() {
@@ -99252,6 +99368,25 @@ const INITIAL_CALL_STATE = {
99252
99368
  };
99253
99369
 
99254
99370
  const realTimeExtraCrmShape = ref({});
99371
+ function buildSchemaFromData(data) {
99372
+ if (data === null || data === void 0) {
99373
+ return null;
99374
+ }
99375
+ if (Array.isArray(data)) {
99376
+ if (data.length === 0) {
99377
+ return [];
99378
+ }
99379
+ return [buildSchemaFromData(data[0])];
99380
+ }
99381
+ if (typeof data === "object") {
99382
+ const schema = {};
99383
+ for (const [key, value] of Object.entries(data)) {
99384
+ schema[key] = buildSchemaFromData(value);
99385
+ }
99386
+ return schema;
99387
+ }
99388
+ return null;
99389
+ }
99255
99390
  function isEmptyValue(value) {
99256
99391
  return !value || typeof value === "string" && value.trim() === "";
99257
99392
  }
@@ -99271,6 +99406,7 @@ function removeEmptyValues(obj) {
99271
99406
  return result;
99272
99407
  }
99273
99408
  function useCrmShape() {
99409
+ const { activeCanvas } = useCanvas$1();
99274
99410
  const call = useLocalStorage(CALL_STORAGE_KEY, INITIAL_CALL_STATE, {
99275
99411
  deep: true,
99276
99412
  listenToStorageChanges: true
@@ -99287,6 +99423,13 @@ function useCrmShape() {
99287
99423
  "myUser",
99288
99424
  computed(() => null)
99289
99425
  );
99426
+ const pitcherDataSchema = computed(() => {
99427
+ const pitcherData = activeCanvas.value?.context?.pitcher_data;
99428
+ if (!pitcherData || typeof pitcherData !== "object") {
99429
+ return {};
99430
+ }
99431
+ return { pitcher_data: buildSchemaFromData(pitcherData) };
99432
+ });
99290
99433
  function getDefaultCrmShape({
99291
99434
  accountName = "",
99292
99435
  myUser: myUser2 = null,
@@ -99325,7 +99468,9 @@ function useCrmShape() {
99325
99468
  showDefault: !!launchDarkly.value.enable_default_crm_shape
99326
99469
  }),
99327
99470
  isEmpty(realTimeExtraCrmShape.value) ? {} : realTimeExtraCrmShape.value,
99328
- isEmpty(extraCrmShape.value) ? {} : extraCrmShape.value
99471
+ isEmpty(extraCrmShape.value) ? {} : extraCrmShape.value,
99472
+ // Derive schema from actual pitcher_data in canvas context
99473
+ isEmpty(pitcherDataSchema.value) ? {} : pitcherDataSchema.value
99329
99474
  );
99330
99475
  });
99331
99476
  return {
@@ -120824,7 +120969,7 @@ const _sfc_main$4k = /* @__PURE__ */ defineComponent({
120824
120969
 
120825
120970
  function useCanvasContext() {
120826
120971
  const { activeCanvas, isPrintDisplayMode, builderCache } = useCanvas$1();
120827
- const { getDefaultCrmShape } = useCrmShape();
120972
+ const { crmShape, getDefaultCrmShape } = useCrmShape();
120828
120973
  const myUser = inject(
120829
120974
  "myUser",
120830
120975
  computed(() => null)
@@ -120856,14 +121001,21 @@ function useCanvasContext() {
120856
121001
  builderCache.value[sectionOverrideKey] = mergedCtx;
120857
121002
  return mergedCtx;
120858
121003
  };
120859
- const crmShape = computed(() => getDefaultCrmShape({ myUser: myUser.value }));
120860
- const crmShapeWithSectionCtx = computed(() => {
121004
+ const fullContext = computed(() => {
120861
121005
  const mergedCtx = getSectionCtx();
120862
- return !isEmpty(crmShape.value) ? { ...mergedCtx, ...crmShape.value } : mergedCtx;
121006
+ const defaultShape = getDefaultCrmShape({
121007
+ myUser: myUser.value,
121008
+ showDefault: true
121009
+ });
121010
+ return mergeWith({}, defaultShape, crmShape.value ?? {}, mergedCtx, (_objValue, srcValue) => {
121011
+ if (Array.isArray(srcValue)) {
121012
+ return srcValue;
121013
+ }
121014
+ return void 0;
121015
+ });
120863
121016
  });
120864
121017
  return {
120865
- getSectionCtx,
120866
- crmShapeWithSectionCtx
121018
+ fullContext
120867
121019
  };
120868
121020
  }
120869
121021
 
@@ -120909,10 +121061,10 @@ const _sfc_main$4j = /* @__PURE__ */ defineComponent({
120909
121061
  __name: "SelectionPanel",
120910
121062
  setup(__props) {
120911
121063
  useCssVars((_ctx) => ({
120912
- "6fe3245a": unref(themeVars).text,
120913
- "6fdae5fe": unref(themeVars).base,
120914
- "85f799be": unref(themeVars).primary6,
120915
- "85f799c4": unref(themeVars).primary3
121064
+ "7e857d3a": unref(themeVars).text,
121065
+ "7e7d3ede": unref(themeVars).base,
121066
+ "e1e1c7fe": unref(themeVars).primary6,
121067
+ "e1e1c804": unref(themeVars).primary3
120916
121068
  }));
120917
121069
  const { t } = useI18n();
120918
121070
  const { renderContentType, isFileExpired, isFileExpiring } = useFileDisplayHelpers();
@@ -120934,7 +121086,7 @@ const _sfc_main$4j = /* @__PURE__ */ defineComponent({
120934
121086
  "launchDarkly",
120935
121087
  computed(() => ({}))
120936
121088
  );
120937
- const { crmShapeWithSectionCtx } = useCanvasContext();
121089
+ const { fullContext } = useCanvasContext();
120938
121090
  const isCrmShapeEnabled = computed(() => launchDarkly.value?.enable_crm_shape_for_external_links ?? false);
120939
121091
  const draggableItems = computed({
120940
121092
  get: () => isDragNDropEnabled.value ? addedItems.value : selectedItems.value,
@@ -120949,7 +121101,7 @@ const _sfc_main$4j = /* @__PURE__ */ defineComponent({
120949
121101
  function getParsedUrl(url) {
120950
121102
  if (!url || !isCrmShapeEnabled.value) return url;
120951
121103
  try {
120952
- return renderTemplate(url, crmShapeWithSectionCtx.value);
121104
+ return renderTemplate(url, fullContext.value);
120953
121105
  } catch (error) {
120954
121106
  console.warn("Failed to parse template in external URL, using original URL:", error);
120955
121107
  return url;
@@ -121253,7 +121405,7 @@ const _sfc_main$4j = /* @__PURE__ */ defineComponent({
121253
121405
  }
121254
121406
  });
121255
121407
 
121256
- const SelectionPanel = /* @__PURE__ */ _export_sfc(_sfc_main$4j, [["__scopeId", "data-v-aa03fa77"]]);
121408
+ const SelectionPanel = /* @__PURE__ */ _export_sfc(_sfc_main$4j, [["__scopeId", "data-v-05db071e"]]);
121257
121409
 
121258
121410
  const _hoisted_1$3q = { class: "flex justify-between gap-2 items-center truncate py-1" };
121259
121411
  const _hoisted_2$2z = {
@@ -123785,13 +123937,13 @@ const _sfc_main$45 = /* @__PURE__ */ defineComponent({
123785
123937
  computed(() => ({}))
123786
123938
  );
123787
123939
  const { crmShape } = useCrmShape();
123788
- const { crmShapeWithSectionCtx } = useCanvasContext();
123940
+ const { fullContext } = useCanvasContext();
123789
123941
  const isCrmShapeEnabled = computed(() => launchDarkly.value?.enable_crm_shape_for_external_links ?? false);
123790
123942
  const parsedUrl = computed(() => {
123791
123943
  if (!url.value.trim()) return url.value;
123792
123944
  if (!isCrmShapeEnabled.value) return url.value;
123793
123945
  try {
123794
- return renderTemplate(url.value, crmShapeWithSectionCtx.value);
123946
+ return renderTemplate(url.value, fullContext.value);
123795
123947
  } catch (error) {
123796
123948
  console.error("Error parsing URL template:", error);
123797
123949
  return url.value;
@@ -123897,7 +124049,7 @@ const _sfc_main$45 = /* @__PURE__ */ defineComponent({
123897
124049
  }
123898
124050
  });
123899
124051
 
123900
- const ExternalLinks = /* @__PURE__ */ _export_sfc(_sfc_main$45, [["__scopeId", "data-v-1287b675"]]);
124052
+ const ExternalLinks = /* @__PURE__ */ _export_sfc(_sfc_main$45, [["__scopeId", "data-v-ba7b39ff"]]);
123901
124053
 
123902
124054
  const _hoisted_1$3d = { class: "mr-3 h-full" };
123903
124055
  const _hoisted_2$2m = { class: "flex flex-col gap-3 mb-3" };
@@ -147983,7 +148135,7 @@ const _sfc_main$2i = /* @__PURE__ */ defineComponent({
147983
148135
  } = useCanvas$1();
147984
148136
  const { discardOverridesConfirmationOptions, getComponentOverrides } = useCanvasSectionOverrides();
147985
148137
  const { getDerivedStyleFromFeatureFlags } = useComponentStyle(componentNode);
147986
- const { crmShapeWithSectionCtx } = useCanvasContext();
148138
+ const { fullContext } = useCanvasContext();
147987
148139
  const { setContentSelectorMode } = useContentSelector();
147988
148140
  const confirmation = useConfirmation();
147989
148141
  const themeVars = useThemeVars();
@@ -148136,7 +148288,7 @@ const _sfc_main$2i = /* @__PURE__ */ defineComponent({
148136
148288
  try {
148137
148289
  return {
148138
148290
  ...value,
148139
- external_url: renderTemplate(value.external_url, crmShapeWithSectionCtx.value)
148291
+ external_url: renderTemplate(value.external_url, fullContext.value)
148140
148292
  };
148141
148293
  } catch (error) {
148142
148294
  console.warn("Failed to parse template in external URL, using original URL:", error);
@@ -148654,7 +148806,7 @@ const _sfc_main$2h = /* @__PURE__ */ defineComponent({
148654
148806
  setCanvasMetadata,
148655
148807
  isImpact
148656
148808
  } = useCanvas$1();
148657
- const { crmShapeWithSectionCtx } = useCanvasContext();
148809
+ const { fullContext } = useCanvasContext();
148658
148810
  const { coreRestApiAxios } = useCoreApi();
148659
148811
  const { applyPrintModeToElement } = usePrintMode();
148660
148812
  const { discardOverridesConfirmationOptions, getComponentOverrides } = useCanvasSectionOverrides();
@@ -148711,7 +148863,7 @@ const _sfc_main$2h = /* @__PURE__ */ defineComponent({
148711
148863
  const memoizedModelValue = computed(() => getModelValue(computedTextProps.value.data?.content));
148712
148864
  function getModelValue(value = "") {
148713
148865
  if (!shouldInterpolate.value || !value.trim()) return value;
148714
- return renderTemplate(value, crmShapeWithSectionCtx.value);
148866
+ return renderTemplate(value, fullContext.value);
148715
148867
  }
148716
148868
  const debouncedUpdateNodeData = debounce((data2, nodeId, sectionId) => {
148717
148869
  return updateNodeData(data2, nodeId, sectionId);
@@ -148819,7 +148971,7 @@ const _sfc_main$2h = /* @__PURE__ */ defineComponent({
148819
148971
  );
148820
148972
  applyPrintModeToElement(contentElement.value, () => {
148821
148973
  const content = computedTextProps.value.data?.content || "";
148822
- return shouldInterpolate.value ? renderTemplate(content, crmShapeWithSectionCtx.value) : content;
148974
+ return shouldInterpolate.value ? renderTemplate(content, fullContext.value) : content;
148823
148975
  });
148824
148976
  if (enableScaleContent && spanStyles) {
148825
148977
  setTimeout(() => {
@@ -148931,7 +149083,7 @@ const _sfc_main$2h = /* @__PURE__ */ defineComponent({
148931
149083
  }
148932
149084
  });
148933
149085
 
148934
- const Text = /* @__PURE__ */ _export_sfc(_sfc_main$2h, [["__scopeId", "data-v-b2424519"]]);
149086
+ const Text = /* @__PURE__ */ _export_sfc(_sfc_main$2h, [["__scopeId", "data-v-73a884c3"]]);
148935
149087
 
148936
149088
  const _hoisted_1$1Q = { class: "absolute top-2 right-2 flex items-center gap-1 z-10" };
148937
149089
  const _hoisted_2$1m = { class: "text-xs" };
@@ -183680,8 +183832,14 @@ function getEventColor(sfEvent) {
183680
183832
  } else {
183681
183833
  isSubmitted = false;
183682
183834
  }
183835
+ const now = /* @__PURE__ */ new Date();
183683
183836
  if (isSubmitted) return SfEventColors.SUBMITTED;
183684
- else if (isAfter$1(/* @__PURE__ */ new Date(), new Date(sfEvent.EndDateTime))) return SfEventColors.PAST;
183837
+ else if (sfEvent.IsAllDayEvent) {
183838
+ const endDate = new Date(sfEvent.EndDateTime);
183839
+ const todayStart = startOfDay(now);
183840
+ const endDayStart = startOfDay(endDate);
183841
+ return isAfter$1(todayStart, endDayStart) ? SfEventColors.PAST : SfEventColors.PLANNED;
183842
+ } else if (isAfter$1(now, new Date(sfEvent.EndDateTime))) return SfEventColors.PAST;
183685
183843
  else return SfEventColors.PLANNED;
183686
183844
  }
183687
183845
  const minFutureDate = (date = /* @__PURE__ */ new Date()) => add(date, { minutes: MIN_DIFFERENCE_IN_MINUTES });