@pitcher/canvas-ui 2026.1.14-120429-beta → 2026.1.14-133826-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
@@ -95691,115 +95692,111 @@ const _hoisted_14$h = {
95691
95692
  key: 0,
95692
95693
  class: "flex items-center ml-2"
95693
95694
  };
95694
- const _hoisted_15$f = { class: "flex items-center" };
95695
- const _hoisted_16$e = { key: 0 };
95696
- const _hoisted_17$c = { class: "c-select-filter__popover w-[350px] rounded flex flex-col bg-base" };
95697
- const _hoisted_18$a = { class: "pa-2 max-h-[300px] overflow-y-auto" };
95698
- const _hoisted_19$a = {
95699
- key: 0,
95695
+ const _hoisted_15$f = {
95696
+ key: 2,
95700
95697
  class: "flex items-center ml-2"
95701
95698
  };
95702
- const _hoisted_20$9 = { class: "flex flex-col w-full flex-1 min-h-0" };
95703
- const _hoisted_21$7 = {
95699
+ const _hoisted_16$e = { class: "flex flex-col w-full flex-1 min-h-0" };
95700
+ const _hoisted_17$c = {
95704
95701
  key: 0,
95705
95702
  class: "flex-1 overflow-y-auto bg-white w-full pl-1 pr-6 py-0"
95706
95703
  };
95707
- const _hoisted_22$5 = { class: "space-y-1 mt-4" };
95704
+ const _hoisted_18$a = { class: "space-y-1 mt-4" };
95705
+ const _hoisted_19$a = ["onClick"];
95706
+ const _hoisted_20$9 = { class: "text-sm text-gray-700" };
95707
+ const _hoisted_21$7 = { class: "flex items-center mb-0" };
95708
+ const _hoisted_22$5 = { class: "text-sm font-bold text-gray-700" };
95708
95709
  const _hoisted_23$5 = ["onClick"];
95709
- const _hoisted_24$5 = { class: "text-sm text-gray-700" };
95710
- const _hoisted_25$5 = { class: "flex items-center mb-0" };
95711
- const _hoisted_26$5 = { class: "text-sm font-bold text-gray-700" };
95712
- const _hoisted_27$5 = ["onClick"];
95713
- const _hoisted_28$5 = {
95710
+ const _hoisted_24$5 = {
95714
95711
  key: 0,
95715
95712
  class: "relative mr-4"
95716
95713
  };
95717
- const _hoisted_29$5 = {
95714
+ const _hoisted_25$5 = {
95718
95715
  key: 0,
95719
95716
  class: "absolute inset-0 flex items-center justify-center bg-gray-200 bg-opacity-75 border-rounded-1"
95720
95717
  };
95721
- const _hoisted_30$4 = {
95718
+ const _hoisted_26$5 = {
95722
95719
  key: 1,
95723
95720
  class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center"
95724
95721
  };
95725
- const _hoisted_31$4 = { class: "flex-1 min-w-0" };
95726
- const _hoisted_32$4 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95727
- const _hoisted_33$4 = { class: "text-xs text-gray-500" };
95728
- const _hoisted_34$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 = {
95729
95726
  key: 1,
95730
95727
  class: "flex-1 overflow-y-auto bg-white w-full"
95731
95728
  };
95732
- const _hoisted_35$4 = { class: "w-full px-0" };
95733
- const _hoisted_36$4 = {
95729
+ const _hoisted_31$4 = { class: "w-full px-0" };
95730
+ const _hoisted_32$4 = {
95734
95731
  key: 0,
95735
95732
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95736
95733
  };
95737
- const _hoisted_37$4 = {
95734
+ const _hoisted_33$4 = {
95738
95735
  key: 0,
95739
95736
  class: "mb-0"
95740
95737
  };
95741
- const _hoisted_38$4 = { class: "flex items-center px-0 pt-2 pb-1" };
95742
- const _hoisted_39$4 = { class: "text-m font-semibold text-gray-900" };
95743
- const _hoisted_40$4 = { class: "ml-2 text-sm text-gray-500" };
95744
- const _hoisted_41$4 = ["data-result-selected", "onClick"];
95745
- const _hoisted_42$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 = {
95746
95743
  key: 1,
95747
95744
  class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center"
95748
95745
  };
95749
- const _hoisted_43$4 = { class: "flex-1 min-w-0" };
95750
- const _hoisted_44$4 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95751
- const _hoisted_45$4 = ["innerHTML"];
95752
- const _hoisted_46$4 = { class: "text-xs text-gray-500" };
95753
- const _hoisted_47$4 = { class: "text-xs text-gray-400" };
95754
- const _hoisted_48$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 = {
95755
95752
  key: 0,
95756
95753
  class: "px-0 py-0"
95757
95754
  };
95758
- const _hoisted_49$4 = { key: 1 };
95759
- const _hoisted_50$4 = { class: "flex items-center px-0 pt-2 pb-1" };
95760
- const _hoisted_51$3 = { class: "text-m font-semibold text-gray-900" };
95761
- const _hoisted_52$3 = { class: "ml-2 text-sm text-gray-500" };
95762
- const _hoisted_53$3 = ["data-result-selected", "onClick"];
95763
- 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" };
95764
- const _hoisted_55$2 = { class: "flex-1 min-w-0" };
95765
- const _hoisted_56$2 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95766
- const _hoisted_57$2 = { class: "text-xs text-gray-500" };
95767
- const _hoisted_58$2 = { class: "text-xs text-gray-400" };
95768
- const _hoisted_59$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 = {
95769
95766
  key: 0,
95770
95767
  class: "px-0 py-0"
95771
95768
  };
95772
- const _hoisted_60$2 = {
95769
+ const _hoisted_56$2 = {
95773
95770
  key: 2,
95774
95771
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95775
95772
  };
95776
- const _hoisted_61$2 = {
95773
+ const _hoisted_57$2 = {
95777
95774
  key: 2,
95778
95775
  class: "flex-1 overflow-y-auto bg-white w-full"
95779
95776
  };
95780
- const _hoisted_62$2 = { class: "w-full px-0" };
95781
- const _hoisted_63$2 = {
95777
+ const _hoisted_58$2 = { class: "w-full px-0" };
95778
+ const _hoisted_59$2 = {
95782
95779
  key: 0,
95783
95780
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95784
95781
  };
95785
- const _hoisted_64$2 = { class: "flex items-center px-0 pt-2 pb-1" };
95786
- const _hoisted_65$2 = { class: "text-m font-semibold text-gray-900" };
95787
- const _hoisted_66$2 = { class: "ml-2 text-sm text-gray-500" };
95788
- const _hoisted_67$2 = ["data-result-selected", "onClick"];
95789
- const _hoisted_68$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 = {
95790
95787
  key: 1,
95791
95788
  class: "w-18 h-14 border-rounded-1 mr-4 flex-shrink-0 bg-gray-200 flex items-center justify-center"
95792
95789
  };
95793
- const _hoisted_69$1 = { class: "flex-1 min-w-0" };
95794
- const _hoisted_70$1 = { class: "text-sm font-bold text-gray-900 truncate mb-1" };
95795
- const _hoisted_71$1 = ["innerHTML"];
95796
- const _hoisted_72$1 = { class: "text-xs text-gray-500" };
95797
- const _hoisted_73$1 = { class: "text-xs text-gray-400" };
95798
- const _hoisted_74$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 = {
95799
95796
  key: 0,
95800
95797
  class: "flex flex-col items-center justify-center text-center p-8 gap-4"
95801
95798
  };
95802
- const _hoisted_75$1 = {
95799
+ const _hoisted_71$1 = {
95803
95800
  key: 0,
95804
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"
95805
95802
  };
@@ -95826,7 +95823,6 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95826
95823
  const selectedFileTypes = ref([]);
95827
95824
  const showFileTypeDropdown = ref(false);
95828
95825
  const selectedCanvasFilters = ref([]);
95829
- const showCanvasTypeDropdown = ref(false);
95830
95826
  const fileTypeOptions = [
95831
95827
  { label: "Folder", value: "folder" },
95832
95828
  { label: "PDF", value: "pdf" },
@@ -95839,42 +95835,6 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95839
95835
  { label: "AR", value: "ar" },
95840
95836
  { label: "Web", value: "web" }
95841
95837
  ];
95842
- const canvasTypeOptions = computed(() => {
95843
- const options = [
95844
- { label: t("canvasUI.CAlgoliaSearch.canvasFilters.templates"), value: "template" },
95845
- { label: t("canvasUI.CAlgoliaSearch.canvasFilters.products"), value: "section" },
95846
- { label: t("canvasUI.CAlgoliaSearch.canvasFilters.blocks"), value: "block" }
95847
- ];
95848
- if (!props.isAdmin) {
95849
- options.unshift({ label: t("canvasUI.CAlgoliaSearch.canvasFilters.saved"), value: "saved_canvas" });
95850
- }
95851
- if (props.isAdmin) {
95852
- options.splice(1, 0, {
95853
- label: t("canvasUI.CAlgoliaSearch.canvasFilters.productTemplates"),
95854
- value: "product_template"
95855
- });
95856
- }
95857
- return options;
95858
- });
95859
- const ALLOWED_CANVAS_TYPES = ["saved_canvas", "template", "product_template", "section", "block"];
95860
- const ALLOWED_FILE_TYPES = [
95861
- "folder",
95862
- "pdf",
95863
- "image",
95864
- "audio",
95865
- "video",
95866
- "document",
95867
- "presentation",
95868
- "spreadsheet",
95869
- "ar",
95870
- "web"
95871
- ];
95872
- const visibleCanvasTypeOptions = computed(() => {
95873
- if (showRecentView.value || !searchQuery.value.trim()) {
95874
- return canvasTypeOptions.value;
95875
- }
95876
- return canvasTypeOptions.value.filter((option) => availableCanvasTypes.value.has(option.value));
95877
- });
95878
95838
  const hasActiveFilters = computed(() => selectedFileTypes.value.length > 0 || selectedCanvasFilters.value.length > 0);
95879
95839
  const clearAllFilters = () => {
95880
95840
  selectedFileTypes.value = [];
@@ -95885,9 +95845,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
95885
95845
  selectedFileTypes.value = [];
95886
95846
  selectedCanvasFilters.value = [];
95887
95847
  searchType.value = null;
95888
- if (searchQuery.value.trim() && (unfilteredContentResults.value.length > 0 || unfilteredCanvasResults.value.length > 0)) {
95889
- applyFiltersToResults();
95890
- } else if (searchQuery.value.trim()) {
95848
+ if (searchQuery.value.trim()) {
95891
95849
  try {
95892
95850
  skipNextSuggestionFetch.value = true;
95893
95851
  await performSearch(searchQuery.value);
@@ -96023,11 +95981,8 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96023
95981
  };
96024
95982
  const contentResults = ref([]);
96025
95983
  const canvasResults = ref([]);
96026
- const unfilteredContentResults = ref([]);
96027
- const unfilteredCanvasResults = ref([]);
96028
95984
  const isSearching = ref(false);
96029
95985
  const hasSearchCompleted = ref(false);
96030
- let currentSearchId = 0;
96031
95986
  const querySuggestions = ref([]);
96032
95987
  const selectedSuggestionIndex = ref(-1);
96033
95988
  const selectedResultIndex = ref(-1);
@@ -96044,44 +95999,6 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96044
95999
  }
96045
96000
  return canvasResults.value;
96046
96001
  });
96047
- const availableFileTypes = computed(() => {
96048
- if (showRecentView.value || !searchQuery.value.trim()) {
96049
- return /* @__PURE__ */ new Set();
96050
- }
96051
- const types = /* @__PURE__ */ new Set();
96052
- unfilteredContentResults.value.forEach((item) => {
96053
- if (item.type === "folder") {
96054
- types.add("folder");
96055
- } else if (item.type === "file" && item.file_category) {
96056
- types.add(item.file_category);
96057
- }
96058
- });
96059
- return types;
96060
- });
96061
- const availableCanvasTypes = computed(() => {
96062
- if (showRecentView.value || !searchQuery.value.trim()) {
96063
- return /* @__PURE__ */ new Set();
96064
- }
96065
- const types = /* @__PURE__ */ new Set();
96066
- unfilteredCanvasResults.value.forEach((item) => {
96067
- if (item.content_type) {
96068
- types.add(item.content_type);
96069
- }
96070
- });
96071
- return types;
96072
- });
96073
- const visibleFileTypeOptions = computed(() => {
96074
- if (showRecentView.value || !searchQuery.value.trim()) {
96075
- return fileTypeOptions;
96076
- }
96077
- return fileTypeOptions.filter((option) => availableFileTypes.value.has(option.value));
96078
- });
96079
- const hasContentFilters = computed(() => {
96080
- return visibleFileTypeOptions.value.length > 0 || selectedFileTypes.value.length > 0;
96081
- });
96082
- const hasCanvasFilters = computed(() => {
96083
- return visibleCanvasTypeOptions.value.length > 0 || selectedCanvasFilters.value.length > 0;
96084
- });
96085
96002
  const shouldShowNoResults = computed(() => {
96086
96003
  if (showRecentView.value || !searchQuery.value.trim() || isSearching.value || !hasSearchCompleted.value) return false;
96087
96004
  if (searchType.value === "content") {
@@ -96125,32 +96042,6 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96125
96042
  };
96126
96043
  watch(searchType, () => {
96127
96044
  selectedResultIndex.value = -1;
96128
- showFileTypeDropdown.value = false;
96129
- showCanvasTypeDropdown.value = false;
96130
- });
96131
- watch(visibleFileTypeOptions, (newOptions) => {
96132
- if (selectedFileTypes.value.length > 0) {
96133
- const availableValues = new Set(newOptions.map((option) => option.value));
96134
- const stillAvailable = selectedFileTypes.value.filter((type) => availableValues.has(type));
96135
- if (stillAvailable.length !== selectedFileTypes.value.length) {
96136
- selectedFileTypes.value = stillAvailable;
96137
- if (searchQuery.value.trim()) {
96138
- performSearch(searchQuery.value.trim());
96139
- }
96140
- }
96141
- }
96142
- });
96143
- watch(visibleCanvasTypeOptions, (newOptions) => {
96144
- if (selectedCanvasFilters.value.length > 0) {
96145
- const availableValues = new Set(newOptions.map((option) => option.value));
96146
- const stillAvailable = selectedCanvasFilters.value.filter((type) => availableValues.has(type));
96147
- if (stillAvailable.length !== selectedCanvasFilters.value.length) {
96148
- selectedCanvasFilters.value = stillAvailable;
96149
- if (searchQuery.value.trim()) {
96150
- performSearch(searchQuery.value.trim());
96151
- }
96152
- }
96153
- }
96154
96045
  });
96155
96046
  const scrollSelectedResultIntoView = () => {
96156
96047
  nextTick(() => {
@@ -96194,8 +96085,6 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96194
96085
  if (!query.trim()) {
96195
96086
  contentResults.value = [];
96196
96087
  canvasResults.value = [];
96197
- unfilteredContentResults.value = [];
96198
- unfilteredCanvasResults.value = [];
96199
96088
  hasSearchCompleted.value = false;
96200
96089
  isSearching.value = false;
96201
96090
  searchError.value = null;
@@ -96204,51 +96093,59 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96204
96093
  isSearching.value = true;
96205
96094
  hasSearchCompleted.value = false;
96206
96095
  searchError.value = null;
96207
- const searchId = ++currentSearchId;
96208
96096
  const shouldSkipSuggestionFetch = skipNextSuggestionFetch.value;
96209
96097
  if (shouldSkipSuggestionFetch) {
96210
96098
  skipNextSuggestionFetch.value = false;
96211
96099
  }
96212
96100
  try {
96213
- const validCanvasFilters = selectedCanvasFilters.value.filter((filter) => ALLOWED_CANVAS_TYPES.includes(filter));
96214
- if (selectedCanvasFilters.value.length !== validCanvasFilters.length) {
96215
- const invalid = selectedCanvasFilters.value.filter((filter) => !ALLOWED_CANVAS_TYPES.includes(filter));
96216
- console.warn("[CAlgoliaSearch] Invalid canvas filters removed:", invalid);
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);
96217
96124
  selectedCanvasFilters.value = validCanvasFilters;
96218
96125
  }
96219
- const validFileTypes = selectedFileTypes.value.filter((type) => ALLOWED_FILE_TYPES.includes(type));
96220
- if (selectedFileTypes.value.length !== validFileTypes.length) {
96221
- const invalid = selectedFileTypes.value.filter((type) => !ALLOWED_FILE_TYPES.includes(type));
96222
- console.warn("[CAlgoliaSearch] Invalid file type filters removed:", invalid);
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);
96223
96137
  selectedFileTypes.value = validFileTypes;
96224
96138
  }
96139
+ const contentFilters = validFileTypes.length > 0 ? ` AND (${validFileTypes.map((type) => type === "folder" ? `type:"${type}"` : `file_category:"${type}"`).join(" OR ")})` : "";
96225
96140
  const results = await searchViaBackend(query.trim(), {
96226
- canvas: "",
96227
- content: ""
96141
+ canvas: canvasFilters,
96142
+ content: contentFilters
96228
96143
  });
96229
96144
  if (query.trim() !== searchQuery.value.trim()) {
96230
96145
  return;
96231
96146
  }
96232
- unfilteredContentResults.value = results.content?.hits || [];
96233
- unfilteredCanvasResults.value = results.canvas?.hits || [];
96234
- let filteredContent = unfilteredContentResults.value;
96235
- let filteredCanvas = unfilteredCanvasResults.value;
96236
- if (validFileTypes.length > 0) {
96237
- filteredContent = filteredContent.filter((item) => {
96238
- if (validFileTypes.includes("folder") && item.type === "folder") {
96239
- return true;
96240
- }
96241
- if (item.type === "file") {
96242
- return validFileTypes.includes(item.file_category);
96243
- }
96244
- return false;
96245
- });
96246
- }
96247
- if (validCanvasFilters.length > 0) {
96248
- filteredCanvas = filteredCanvas.filter((item) => validCanvasFilters.includes(item.content_type));
96249
- }
96250
- contentResults.value = filteredContent;
96251
- canvasResults.value = filteredCanvas;
96147
+ contentResults.value = results.content?.hits || [];
96148
+ canvasResults.value = results.canvas?.hits || [];
96252
96149
  selectedResultIndex.value = -1;
96253
96150
  searchError.value = null;
96254
96151
  if (query.trim().length >= 2 && !shouldSkipSuggestionFetch) {
@@ -96261,27 +96158,23 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96261
96158
  }
96262
96159
  await nextTick();
96263
96160
  setTimeout(() => {
96264
- if (searchId === currentSearchId) {
96265
- isSearching.value = false;
96266
- hasSearchCompleted.value = true;
96267
- }
96161
+ isSearching.value = false;
96162
+ hasSearchCompleted.value = true;
96268
96163
  }, 50);
96269
96164
  } catch (error) {
96270
96165
  console.error("Search error:", error);
96271
- if (searchId === currentSearchId) {
96272
- contentResults.value = [];
96273
- canvasResults.value = [];
96274
- isSearching.value = false;
96275
- hasSearchCompleted.value = true;
96276
- if (error.message === "AUTH_REQUIRED") {
96277
- searchError.value = "Please sign in to search";
96278
- } else if (error.message === "AUTH_EXPIRED") {
96279
- searchError.value = "Your session has expired. Please sign in again";
96280
- } else if (error.message === "AUTH_FORBIDDEN") {
96281
- searchError.value = "You do not have permission to search this instance";
96282
- } else {
96283
- searchError.value = "Search failed. Please try again";
96284
- }
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";
96285
96178
  }
96286
96179
  }
96287
96180
  };
@@ -96291,38 +96184,19 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96291
96184
  if (!query || typeof query !== "string") return "";
96292
96185
  return query;
96293
96186
  }
96294
- function applyFiltersToResults() {
96295
- if (unfilteredContentResults.value.length === 0 && unfilteredCanvasResults.value.length === 0) {
96296
- return;
96297
- }
96298
- const validFileTypes = selectedFileTypes.value.filter((type) => ALLOWED_FILE_TYPES.includes(type));
96299
- const validCanvasFilters = selectedCanvasFilters.value.filter((type) => ALLOWED_CANVAS_TYPES.includes(type));
96300
- let filteredContent = unfilteredContentResults.value;
96301
- let filteredCanvas = unfilteredCanvasResults.value;
96302
- if (validFileTypes.length > 0) {
96303
- filteredContent = filteredContent.filter((item) => {
96304
- if (validFileTypes.includes("folder") && item.type === "folder") {
96305
- return true;
96306
- }
96307
- if (item.type === "file") {
96308
- return validFileTypes.includes(item.file_category);
96309
- }
96310
- return false;
96311
- });
96312
- }
96313
- if (validCanvasFilters.length > 0) {
96314
- filteredCanvas = filteredCanvas.filter((item) => validCanvasFilters.includes(item.content_type));
96315
- }
96316
- contentResults.value = filteredContent;
96317
- canvasResults.value = filteredCanvas;
96318
- selectedResultIndex.value = -1;
96319
- }
96320
96187
  const debouncedFilterSearch = () => {
96321
96188
  if (filterChangeTimer) clearTimeout(filterChangeTimer);
96322
96189
  if (searchTimer) clearTimeout(searchTimer);
96323
96190
  filterChangeTimer = setTimeout(async () => {
96324
96191
  if (searchQuery.value.trim() && !showRecentView.value) {
96325
- 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
+ }
96326
96200
  }
96327
96201
  }, 500);
96328
96202
  };
@@ -96348,8 +96222,6 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96348
96222
  showRecentView.value = true;
96349
96223
  contentResults.value = [];
96350
96224
  canvasResults.value = [];
96351
- unfilteredContentResults.value = [];
96352
- unfilteredCanvasResults.value = [];
96353
96225
  querySuggestions.value = [];
96354
96226
  selectedSuggestionIndex.value = -1;
96355
96227
  selectedResultIndex.value = -1;
@@ -96363,8 +96235,6 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96363
96235
  showRecentView.value = true;
96364
96236
  contentResults.value = [];
96365
96237
  canvasResults.value = [];
96366
- unfilteredContentResults.value = [];
96367
- unfilteredCanvasResults.value = [];
96368
96238
  querySuggestions.value = [];
96369
96239
  selectedSuggestionIndex.value = -1;
96370
96240
  selectedResultIndex.value = -1;
@@ -96489,31 +96359,31 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96489
96359
  if (endChar < highlightValue.length) truncated = truncated + "...";
96490
96360
  return sanitizeHtml(truncated);
96491
96361
  };
96492
- const handleFileTypeToggle = (value, checked) => {
96493
- if (checked) {
96494
- if (!selectedFileTypes.value.includes(value)) {
96495
- selectedFileTypes.value.push(value);
96496
- }
96362
+ const toggleCanvasFilter = (filterType) => {
96363
+ if (selectedCanvasFilters.value.includes(filterType)) {
96364
+ selectedCanvasFilters.value.splice(selectedCanvasFilters.value.indexOf(filterType), 1);
96497
96365
  } else {
96498
- selectedFileTypes.value = selectedFileTypes.value.filter((v) => v !== value);
96366
+ selectedCanvasFilters.value.push(filterType);
96499
96367
  }
96500
96368
  debouncedFilterSearch();
96501
96369
  };
96502
- const handleCanvasTypeToggle = (value, checked) => {
96370
+ const clearCanvasFilters = () => {
96371
+ selectedCanvasFilters.value = [];
96372
+ debouncedFilterSearch();
96373
+ };
96374
+ const toggleFileType = (fileType, checked) => {
96503
96375
  if (checked) {
96504
- if (!selectedCanvasFilters.value.includes(value)) {
96505
- selectedCanvasFilters.value.push(value);
96376
+ if (!selectedFileTypes.value.includes(fileType)) {
96377
+ selectedFileTypes.value.push(fileType);
96506
96378
  }
96507
96379
  } else {
96508
- selectedCanvasFilters.value = selectedCanvasFilters.value.filter((v) => v !== value);
96380
+ const index = selectedFileTypes.value.indexOf(fileType);
96381
+ if (index > -1) {
96382
+ selectedFileTypes.value.splice(index, 1);
96383
+ }
96509
96384
  }
96510
96385
  debouncedFilterSearch();
96511
96386
  };
96512
- const clearCanvasFilters = () => {
96513
- selectedCanvasFilters.value = [];
96514
- showCanvasTypeDropdown.value = false;
96515
- debouncedFilterSearch();
96516
- };
96517
96387
  const clearFileTypes = () => {
96518
96388
  selectedFileTypes.value = [];
96519
96389
  showFileTypeDropdown.value = false;
@@ -96684,7 +96554,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96684
96554
  show: "",
96685
96555
  verticalAlignment: "top",
96686
96556
  "z-index": _ctx.zIndex,
96687
- "onUpdate:show": _cache[12] || (_cache[12] = ($event) => emit("toggleSearch", $event))
96557
+ "onUpdate:show": _cache[15] || (_cache[15] = ($event) => emit("toggleSearch", $event))
96688
96558
  }, {
96689
96559
  default: withCtx(() => [
96690
96560
  createElementVNode("div", {
@@ -96693,7 +96563,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96693
96563
  }, [
96694
96564
  createElementVNode("div", _hoisted_1$4w, [
96695
96565
  createElementVNode("div", _hoisted_2$3j, [
96696
- _cache[13] || (_cache[13] = 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" }, [
96697
96567
  createElementVNode("i", { class: "c-icon far fa-search text-gray-400 text-l" })
96698
96568
  ], -1)),
96699
96569
  withDirectives(createElementVNode("input", {
@@ -96790,7 +96660,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96790
96660
  createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.tabs.pitchDecks")), 1)
96791
96661
  ], 2)) : createCommentVNode("", true)
96792
96662
  ]),
96793
- 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, [
96794
96664
  searchType.value === "content" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
96795
96665
  createVNode(unref(NPopover), {
96796
96666
  class: "c-select-filter",
@@ -96826,23 +96696,24 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96826
96696
  default: withCtx(() => [
96827
96697
  createElementVNode("div", _hoisted_12$p, [
96828
96698
  createElementVNode("div", _hoisted_13$k, [
96829
- (openBlock(true), createElementBlock(Fragment, null, renderList(visibleFileTypeOptions.value, (option) => {
96830
- return openBlock(), createElementBlock("div", {
96699
+ (openBlock(), createElementBlock(Fragment, null, renderList(fileTypeOptions, (option) => {
96700
+ return createElementVNode("div", {
96831
96701
  key: option.value,
96832
96702
  class: "w-full h-7 flex items-center"
96833
96703
  }, [
96834
96704
  createVNode(unref(NCheckbox), {
96835
96705
  checked: selectedFileTypes.value.includes(option.value),
96836
96706
  class: "px-2 truncate",
96837
- "onUpdate:checked": (checked) => handleFileTypeToggle(option.value, checked)
96707
+ "onUpdate:checked": (v) => toggleFileType(option.value, v),
96708
+ value: option.value
96838
96709
  }, {
96839
96710
  default: withCtx(() => [
96840
96711
  createTextVNode(toDisplayString(option.label), 1)
96841
96712
  ]),
96842
96713
  _: 2
96843
- }, 1032, ["checked", "onUpdate:checked"])
96714
+ }, 1032, ["checked", "onUpdate:checked", "value"])
96844
96715
  ]);
96845
- }), 128))
96716
+ }), 64))
96846
96717
  ]),
96847
96718
  createElementVNode("div", {
96848
96719
  class: "pa-2",
@@ -96865,99 +96736,114 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96865
96736
  _: 1
96866
96737
  }, 8, ["show"]),
96867
96738
  hasActiveFilters.value ? (openBlock(), createElementBlock("div", _hoisted_14$h, [
96868
- _cache[14] || (_cache[14] = createElementVNode("div", { class: "h-6 w-px bg-gray-300 mx-2" }, null, -1)),
96739
+ _cache[17] || (_cache[17] = createElementVNode("div", { class: "h-6 w-px bg-gray-300 mx-2" }, null, -1)),
96869
96740
  createElementVNode("span", {
96870
96741
  class: "text-sm text-gray-600 hover:text-gray-800 font-normal cursor-pointer",
96871
96742
  onClick: clearAllFilters
96872
96743
  }, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.clear")), 1)
96873
96744
  ])) : createCommentVNode("", true)
96874
96745
  ], 64)) : searchType.value === "canvases" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
96875
- createVNode(unref(NPopover), {
96876
- class: "c-select-filter",
96877
- placement: "bottom-start",
96878
- raw: "",
96879
- show: showCanvasTypeDropdown.value,
96880
- "show-arrow": false,
96881
- trigger: "manual",
96882
- onClickoutside: _cache[9] || (_cache[9] = ($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"))
96883
96758
  }, {
96884
- trigger: withCtx(() => [
96885
- createVNode(unref(NTag), {
96886
- class: "select-none cursor-pointer",
96887
- style: normalizeStyle({
96888
- "--n-color": selectedCanvasFilters.value.length ? "var(--p-primary5)" : "var(--p-primary6)",
96889
- "--n-border": "1px solid var(--p-primary5)",
96890
- "--n-height": "28px"
96891
- }),
96892
- themeOverrides: {
96893
- borderRadius: "4px"
96894
- },
96895
- onClick: _cache[8] || (_cache[8] = ($event) => showCanvasTypeDropdown.value = !showCanvasTypeDropdown.value)
96896
- }, {
96897
- default: withCtx(() => [
96898
- createElementVNode("div", _hoisted_15$f, [
96899
- createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.type")), 1),
96900
- selectedCanvasFilters.value.length ? (openBlock(), createElementBlock("span", _hoisted_16$e, ": " + toDisplayString(selectedCanvasFilters.value.length), 1)) : createCommentVNode("", true)
96901
- ])
96902
- ]),
96903
- _: 1
96904
- }, 8, ["style"])
96759
+ default: withCtx(() => [
96760
+ createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.canvasFilters.saved")), 1)
96905
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
+ }, {
96906
96776
  default: withCtx(() => [
96907
- createElementVNode("div", _hoisted_17$c, [
96908
- createElementVNode("div", _hoisted_18$a, [
96909
- (openBlock(true), createElementBlock(Fragment, null, renderList(visibleCanvasTypeOptions.value, (option) => {
96910
- return openBlock(), createElementBlock("div", {
96911
- key: option.value,
96912
- class: "w-full h-7 flex items-center"
96913
- }, [
96914
- createVNode(unref(NCheckbox), {
96915
- checked: selectedCanvasFilters.value.includes(option.value),
96916
- class: "px-2 truncate",
96917
- "onUpdate:checked": (checked) => handleCanvasTypeToggle(option.value, checked)
96918
- }, {
96919
- default: withCtx(() => [
96920
- createTextVNode(toDisplayString(option.label), 1)
96921
- ]),
96922
- _: 2
96923
- }, 1032, ["checked", "onUpdate:checked"])
96924
- ]);
96925
- }), 128))
96926
- ]),
96927
- createElementVNode("div", {
96928
- class: "pa-2",
96929
- style: normalizeStyle({ borderTop: `1px solid ${unref(themeVars).primary5}` })
96930
- }, [
96931
- createVNode(CButton, {
96932
- block: "",
96933
- class: "pa-2",
96934
- text: "",
96935
- onClick: clearCanvasFilters
96936
- }, {
96937
- default: withCtx(() => [
96938
- createTextVNode(toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.clear")), 1)
96939
- ]),
96940
- _: 1
96941
- })
96942
- ], 4)
96943
- ])
96777
+ createElementVNode("span", null, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.canvasFilters.templates")), 1)
96944
96778
  ]),
96945
96779
  _: 1
96946
- }, 8, ["show"]),
96947
- hasActiveFilters.value ? (openBlock(), createElementBlock("div", _hoisted_19$a, [
96948
- _cache[15] || (_cache[15] = 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)),
96949
96835
  createElementVNode("span", {
96950
96836
  class: "text-sm text-gray-600 hover:text-gray-800 font-normal cursor-pointer",
96951
- onClick: clearAllFilters
96837
+ onClick: clearCanvasFilters
96952
96838
  }, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.filters.clear")), 1)
96953
96839
  ])) : createCommentVNode("", true)
96954
96840
  ], 64)) : createCommentVNode("", true)
96955
96841
  ])) : createCommentVNode("", true)
96956
96842
  ])) : createCommentVNode("", true)
96957
96843
  ]),
96958
- createElementVNode("div", _hoisted_20$9, [
96959
- showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_21$7, [
96960
- createElementVNode("div", _hoisted_22$5, [
96844
+ createElementVNode("div", _hoisted_16$e, [
96845
+ showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_17$c, [
96846
+ createElementVNode("div", _hoisted_18$a, [
96961
96847
  (openBlock(true), createElementBlock(Fragment, null, renderList(recentSearches.value, (search) => {
96962
96848
  return openBlock(), createElementBlock("div", {
96963
96849
  key: search,
@@ -96970,14 +96856,14 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96970
96856
  icon: "clock-rotate-left",
96971
96857
  size: "16"
96972
96858
  }),
96973
- createElementVNode("span", _hoisted_24$5, toDisplayString(search), 1)
96974
- ], 8, _hoisted_23$5);
96859
+ createElementVNode("span", _hoisted_20$9, toDisplayString(search), 1)
96860
+ ], 8, _hoisted_19$a);
96975
96861
  }), 128))
96976
96862
  ]),
96977
96863
  recentlyOpenedDocs.value.length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
96978
- _cache[16] || (_cache[16] = createElementVNode("hr", { class: "border-0 h-px bg-gray-200 mt-2 mb-3 w-full" }, null, -1)),
96979
- createElementVNode("div", _hoisted_25$5, [
96980
- createElementVNode("span", _hoisted_26$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)
96981
96867
  ]),
96982
96868
  createElementVNode("div", {
96983
96869
  class: normalizeClass(_ctx.isAdmin ? "space-y-2" : "space-y-0")
@@ -96991,7 +96877,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
96991
96877
  ]),
96992
96878
  onClick: ($event) => handleRecentDocClick(doc, doc.type)
96993
96879
  }, [
96994
- doc.type === "file" ? (openBlock(), createElementBlock("div", _hoisted_28$5, [
96880
+ doc.type === "file" ? (openBlock(), createElementBlock("div", _hoisted_24$5, [
96995
96881
  createVNode(_sfc_main$6K, {
96996
96882
  class: "h-14 border-rounded-1 overflow-hidden flex-0",
96997
96883
  cover: "",
@@ -97000,7 +96886,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97000
96886
  src: recentThumbnails.value[doc.id] || "",
97001
96887
  width: "72"
97002
96888
  }, null, 8, ["file-data", "src"]),
97003
- isLoadingThumbnails.value && !recentThumbnails.value[doc.id] ? (openBlock(), createElementBlock("div", _hoisted_29$5, [
96889
+ isLoadingThumbnails.value && !recentThumbnails.value[doc.id] ? (openBlock(), createElementBlock("div", _hoisted_25$5, [
97004
96890
  createVNode(CIcon, {
97005
96891
  class: "animate-spin",
97006
96892
  color: "var(--p-primary)",
@@ -97008,7 +96894,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97008
96894
  size: "20"
97009
96895
  })
97010
96896
  ])) : createCommentVNode("", true)
97011
- ])) : (openBlock(), createElementBlock("div", _hoisted_30$4, [
96897
+ ])) : (openBlock(), createElementBlock("div", _hoisted_26$5, [
97012
96898
  doc.type === "canvas" ? (openBlock(), createBlock(CIcon, {
97013
96899
  key: 0,
97014
96900
  color: "var(--p-text2)",
@@ -97021,33 +96907,33 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97021
96907
  size: "32"
97022
96908
  }))
97023
96909
  ])),
97024
- createElementVNode("div", _hoisted_31$4, [
97025
- createElementVNode("h3", _hoisted_32$4, toDisplayString(doc.name), 1),
97026
- createElementVNode("p", _hoisted_33$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)
97027
96913
  ])
97028
- ], 10, _hoisted_27$5);
96914
+ ], 10, _hoisted_23$5);
97029
96915
  }), 128))
97030
96916
  ], 2)
97031
96917
  ], 64)) : createCommentVNode("", true)
97032
- ])) : !searchType.value ? (openBlock(), createElementBlock("div", _hoisted_34$4, [
97033
- createElementVNode("div", _hoisted_35$4, [
97034
- isSearching.value ? (openBlock(), createElementBlock("div", _hoisted_36$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, [
97035
96921
  createVNode(CIcon, {
97036
96922
  class: "animate-spin text-6xl",
97037
96923
  color: "var(--p-primary)",
97038
96924
  icon: "spinner"
97039
96925
  })
97040
96926
  ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
97041
- filteredContentFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_37$4, [
97042
- createElementVNode("div", _hoisted_38$4, [
96927
+ filteredContentFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_33$4, [
96928
+ createElementVNode("div", _hoisted_34$4, [
97043
96929
  createVNode(CIcon, {
97044
96930
  class: "mr-2",
97045
96931
  color: "var(--p-text2)",
97046
96932
  icon: "folder",
97047
96933
  size: "16"
97048
96934
  }),
97049
- createElementVNode("span", _hoisted_39$4, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.sections.content")), 1),
97050
- createElementVNode("span", _hoisted_40$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)
97051
96937
  ]),
97052
96938
  createElementVNode("div", null, [
97053
96939
  (openBlock(true), createElementBlock(Fragment, null, renderList(filteredContentFiles.value.slice(0, 5), (item) => {
@@ -97069,30 +96955,30 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97069
96955
  "object-fit": "cover",
97070
96956
  src: item.picture_url || "",
97071
96957
  width: "72"
97072
- }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_42$4, [
96958
+ }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_38$4, [
97073
96959
  createVNode(CIcon, {
97074
96960
  color: "var(--p-text2)",
97075
96961
  icon: "folder",
97076
96962
  size: "32"
97077
96963
  })
97078
96964
  ])),
97079
- createElementVNode("div", _hoisted_43$4, [
97080
- createElementVNode("h3", _hoisted_44$4, toDisplayString(item.name), 1),
96965
+ createElementVNode("div", _hoisted_39$4, [
96966
+ createElementVNode("h3", _hoisted_40$4, toDisplayString(item.name), 1),
97081
96967
  item.type === "file" && getSnippet(item) ? (openBlock(), createElementBlock("p", {
97082
96968
  key: 0,
97083
96969
  class: "text-xs text-gray-600 mb-1",
97084
96970
  innerHTML: getSnippet(item)
97085
- }, null, 8, _hoisted_45$4)) : createCommentVNode("", true),
97086
- createElementVNode("p", _hoisted_46$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)
97087
96973
  ]),
97088
- createElementVNode("div", _hoisted_47$4, toDisplayString(item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
97089
- ], 10, _hoisted_41$4);
96974
+ createElementVNode("div", _hoisted_43$4, toDisplayString(item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
96975
+ ], 10, _hoisted_37$4);
97090
96976
  }), 128))
97091
96977
  ]),
97092
- filteredContentFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_48$4, [
96978
+ filteredContentFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_44$4, [
97093
96979
  createElementVNode("span", {
97094
96980
  class: "text-sm text-gray-600 hover:text-gray-800 font-bold flex items-center cursor-pointer",
97095
- onClick: _cache[10] || (_cache[10] = ($event) => searchType.value = "content")
96981
+ onClick: _cache[13] || (_cache[13] = ($event) => searchType.value = "content")
97096
96982
  }, [
97097
96983
  createTextVNode(toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.actions.viewAll")) + " ", 1),
97098
96984
  createVNode(CIcon, {
@@ -97103,16 +96989,16 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97103
96989
  ])
97104
96990
  ])) : createCommentVNode("", true)
97105
96991
  ])) : createCommentVNode("", true),
97106
- filteredCanvasFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_49$4, [
97107
- createElementVNode("div", _hoisted_50$4, [
96992
+ filteredCanvasFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_45$4, [
96993
+ createElementVNode("div", _hoisted_46$4, [
97108
96994
  createVNode(CIcon, {
97109
96995
  class: "mr-2",
97110
96996
  color: "var(--p-text2)",
97111
96997
  icon: "presentation",
97112
96998
  size: "16"
97113
96999
  }),
97114
- createElementVNode("span", _hoisted_51$3, toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.sections.pitchDecks")), 1),
97115
- createElementVNode("span", _hoisted_52$3, "(" + 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)
97116
97002
  ]),
97117
97003
  createElementVNode("div", null, [
97118
97004
  (openBlock(true), createElementBlock(Fragment, null, renderList(filteredCanvasFiles.value.slice(0, 5), (item) => {
@@ -97126,25 +97012,25 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97126
97012
  "data-result-selected": isResultSelected(item),
97127
97013
  onClick: ($event) => handleResultClick(item, "canvas")
97128
97014
  }, [
97129
- createElementVNode("div", _hoisted_54$2, [
97015
+ createElementVNode("div", _hoisted_50$4, [
97130
97016
  createVNode(CIcon, {
97131
97017
  color: "var(--p-text2)",
97132
97018
  icon: "presentation",
97133
97019
  size: "32"
97134
97020
  })
97135
97021
  ]),
97136
- createElementVNode("div", _hoisted_55$2, [
97137
- createElementVNode("h3", _hoisted_56$2, toDisplayString(item.name), 1),
97138
- createElementVNode("p", _hoisted_57$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)
97139
97025
  ]),
97140
- createElementVNode("div", _hoisted_58$2, toDisplayString(item.folder?.name || ""), 1)
97141
- ], 10, _hoisted_53$3);
97026
+ createElementVNode("div", _hoisted_54$2, toDisplayString(item.folder?.name || ""), 1)
97027
+ ], 10, _hoisted_49$4);
97142
97028
  }), 128))
97143
97029
  ]),
97144
- filteredCanvasFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_59$2, [
97030
+ filteredCanvasFiles.value.length > 5 ? (openBlock(), createElementBlock("div", _hoisted_55$2, [
97145
97031
  createElementVNode("span", {
97146
97032
  class: "text-sm text-gray-600 hover:text-gray-800 font-bold flex items-center cursor-pointer",
97147
- onClick: _cache[11] || (_cache[11] = ($event) => searchType.value = "canvases")
97033
+ onClick: _cache[14] || (_cache[14] = ($event) => searchType.value = "canvases")
97148
97034
  }, [
97149
97035
  createTextVNode(toDisplayString(unref(t)("canvasUI.CAlgoliaSearch.actions.viewAll")) + " ", 1),
97150
97036
  createVNode(CIcon, {
@@ -97155,7 +97041,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97155
97041
  ])
97156
97042
  ])) : createCommentVNode("", true)
97157
97043
  ])) : createCommentVNode("", true),
97158
- searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_60$2, [
97044
+ searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_56$2, [
97159
97045
  createVNode(CIcon, {
97160
97046
  class: "text-6xl",
97161
97047
  color: searchError.value ? "var(--p-error)" : "var(--p-text3)",
@@ -97168,16 +97054,16 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97168
97054
  ])) : createCommentVNode("", true)
97169
97055
  ], 64))
97170
97056
  ])
97171
- ])) : (openBlock(), createElementBlock("div", _hoisted_61$2, [
97172
- createElementVNode("div", _hoisted_62$2, [
97173
- isSearching.value ? (openBlock(), createElementBlock("div", _hoisted_63$2, [
97057
+ ])) : (openBlock(), createElementBlock("div", _hoisted_57$2, [
97058
+ createElementVNode("div", _hoisted_58$2, [
97059
+ isSearching.value ? (openBlock(), createElementBlock("div", _hoisted_59$2, [
97174
97060
  createVNode(CIcon, {
97175
97061
  class: "animate-spin text-6xl",
97176
97062
  color: "var(--p-primary)",
97177
97063
  icon: "spinner"
97178
97064
  })
97179
97065
  ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
97180
- createElementVNode("div", _hoisted_64$2, [
97066
+ createElementVNode("div", _hoisted_60$2, [
97181
97067
  searchType.value === "content" ? (openBlock(), createBlock(CIcon, {
97182
97068
  key: 0,
97183
97069
  class: "mr-2",
@@ -97191,8 +97077,8 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97191
97077
  icon: "presentation",
97192
97078
  size: "16"
97193
97079
  })),
97194
- createElementVNode("span", _hoisted_65$2, toDisplayString(searchType.value === "content" ? unref(t)("canvasUI.CAlgoliaSearch.sections.content") : unref(t)("canvasUI.CAlgoliaSearch.sections.pitchDecks")), 1),
97195
- createElementVNode("span", _hoisted_66$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)
97196
97082
  ]),
97197
97083
  createElementVNode("div", null, [
97198
97084
  (openBlock(true), createElementBlock(Fragment, null, renderList(searchType.value === "content" ? filteredContentFiles.value : filteredCanvasFiles.value, (item) => {
@@ -97217,7 +97103,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97217
97103
  "object-fit": "cover",
97218
97104
  src: item.picture_url || "",
97219
97105
  width: "72"
97220
- }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_68$2, [
97106
+ }, null, 8, ["file-data", "src"])) : (openBlock(), createElementBlock("div", _hoisted_64$2, [
97221
97107
  searchType.value === "content" ? (openBlock(), createBlock(CIcon, {
97222
97108
  key: 0,
97223
97109
  color: "var(--p-text2)",
@@ -97230,20 +97116,20 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97230
97116
  size: "32"
97231
97117
  }))
97232
97118
  ])),
97233
- createElementVNode("div", _hoisted_69$1, [
97234
- createElementVNode("h3", _hoisted_70$1, toDisplayString(item.name), 1),
97119
+ createElementVNode("div", _hoisted_65$2, [
97120
+ createElementVNode("h3", _hoisted_66$2, toDisplayString(item.name), 1),
97235
97121
  searchType.value === "content" && item.type === "file" && getSnippet(item) ? (openBlock(), createElementBlock("p", {
97236
97122
  key: 0,
97237
97123
  class: "text-xs text-gray-600 mb-1",
97238
97124
  innerHTML: getSnippet(item)
97239
- }, null, 8, _hoisted_71$1)) : createCommentVNode("", true),
97240
- 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)
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)
97241
97127
  ]),
97242
- createElementVNode("div", _hoisted_73$1, toDisplayString(searchType.value === "content" && item.type === "folder" ? item.parent_folder?.name || "" : item.folder?.name || ""), 1)
97243
- ], 10, _hoisted_67$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);
97244
97130
  }), 128))
97245
97131
  ]),
97246
- searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_74$1, [
97132
+ searchError.value || shouldShowNoResults.value ? (openBlock(), createElementBlock("div", _hoisted_70$1, [
97247
97133
  createVNode(CIcon, {
97248
97134
  class: "text-6xl",
97249
97135
  color: searchError.value ? "var(--p-error)" : "var(--p-text3)",
@@ -97258,7 +97144,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97258
97144
  ])
97259
97145
  ]))
97260
97146
  ]),
97261
- !showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_75$1, [
97147
+ !showRecentView.value ? (openBlock(), createElementBlock("div", _hoisted_71$1, [
97262
97148
  createVNode(CShortcut, null, {
97263
97149
  default: withCtx(() => [
97264
97150
  createVNode(CShortcutIcon, { icon: "arrow-up" }),
@@ -97300,7 +97186,7 @@ const _sfc_main$5K = /* @__PURE__ */ defineComponent({
97300
97186
  }
97301
97187
  });
97302
97188
 
97303
- const CAlgoliaSearch = /* @__PURE__ */ _export_sfc(_sfc_main$5K, [["__scopeId", "data-v-840d4fd4"]]);
97189
+ const CAlgoliaSearch = /* @__PURE__ */ _export_sfc(_sfc_main$5K, [["__scopeId", "data-v-da2357d4"]]);
97304
97190
 
97305
97191
  const BulletListExtended = BulletList.extend({
97306
97192
  addOptions() {
@@ -99367,6 +99253,25 @@ const INITIAL_CALL_STATE = {
99367
99253
  };
99368
99254
 
99369
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
+ }
99370
99275
  function isEmptyValue(value) {
99371
99276
  return !value || typeof value === "string" && value.trim() === "";
99372
99277
  }
@@ -99386,6 +99291,7 @@ function removeEmptyValues(obj) {
99386
99291
  return result;
99387
99292
  }
99388
99293
  function useCrmShape() {
99294
+ const { activeCanvas } = useCanvas$1();
99389
99295
  const call = useLocalStorage(CALL_STORAGE_KEY, INITIAL_CALL_STATE, {
99390
99296
  deep: true,
99391
99297
  listenToStorageChanges: true
@@ -99402,6 +99308,13 @@ function useCrmShape() {
99402
99308
  "myUser",
99403
99309
  computed(() => null)
99404
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
+ });
99405
99318
  function getDefaultCrmShape({
99406
99319
  accountName = "",
99407
99320
  myUser: myUser2 = null,
@@ -99440,7 +99353,9 @@ function useCrmShape() {
99440
99353
  showDefault: !!launchDarkly.value.enable_default_crm_shape
99441
99354
  }),
99442
99355
  isEmpty(realTimeExtraCrmShape.value) ? {} : realTimeExtraCrmShape.value,
99443
- 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
99444
99359
  );
99445
99360
  });
99446
99361
  return {
@@ -120910,7 +120825,7 @@ const _sfc_main$4k = /* @__PURE__ */ defineComponent({
120910
120825
 
120911
120826
  function useCanvasContext() {
120912
120827
  const { activeCanvas, isPrintDisplayMode, builderCache } = useCanvas$1();
120913
- const { getDefaultCrmShape } = useCrmShape();
120828
+ const { crmShape, getDefaultCrmShape } = useCrmShape();
120914
120829
  const myUser = inject(
120915
120830
  "myUser",
120916
120831
  computed(() => null)
@@ -120942,14 +120857,21 @@ function useCanvasContext() {
120942
120857
  builderCache.value[sectionOverrideKey] = mergedCtx;
120943
120858
  return mergedCtx;
120944
120859
  };
120945
- const crmShape = computed(() => getDefaultCrmShape({ myUser: myUser.value }));
120946
- const crmShapeWithSectionCtx = computed(() => {
120860
+ const fullContext = computed(() => {
120947
120861
  const mergedCtx = getSectionCtx();
120948
- 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
+ });
120949
120872
  });
120950
120873
  return {
120951
- getSectionCtx,
120952
- crmShapeWithSectionCtx
120874
+ fullContext
120953
120875
  };
120954
120876
  }
120955
120877
 
@@ -120995,10 +120917,10 @@ const _sfc_main$4j = /* @__PURE__ */ defineComponent({
120995
120917
  __name: "SelectionPanel",
120996
120918
  setup(__props) {
120997
120919
  useCssVars((_ctx) => ({
120998
- "6fe3245a": unref(themeVars).text,
120999
- "6fdae5fe": unref(themeVars).base,
121000
- "85f799be": unref(themeVars).primary6,
121001
- "85f799c4": unref(themeVars).primary3
120920
+ "7e857d3a": unref(themeVars).text,
120921
+ "7e7d3ede": unref(themeVars).base,
120922
+ "e1e1c7fe": unref(themeVars).primary6,
120923
+ "e1e1c804": unref(themeVars).primary3
121002
120924
  }));
121003
120925
  const { t } = useI18n();
121004
120926
  const { renderContentType, isFileExpired, isFileExpiring } = useFileDisplayHelpers();
@@ -121020,7 +120942,7 @@ const _sfc_main$4j = /* @__PURE__ */ defineComponent({
121020
120942
  "launchDarkly",
121021
120943
  computed(() => ({}))
121022
120944
  );
121023
- const { crmShapeWithSectionCtx } = useCanvasContext();
120945
+ const { fullContext } = useCanvasContext();
121024
120946
  const isCrmShapeEnabled = computed(() => launchDarkly.value?.enable_crm_shape_for_external_links ?? false);
121025
120947
  const draggableItems = computed({
121026
120948
  get: () => isDragNDropEnabled.value ? addedItems.value : selectedItems.value,
@@ -121035,7 +120957,7 @@ const _sfc_main$4j = /* @__PURE__ */ defineComponent({
121035
120957
  function getParsedUrl(url) {
121036
120958
  if (!url || !isCrmShapeEnabled.value) return url;
121037
120959
  try {
121038
- return renderTemplate(url, crmShapeWithSectionCtx.value);
120960
+ return renderTemplate(url, fullContext.value);
121039
120961
  } catch (error) {
121040
120962
  console.warn("Failed to parse template in external URL, using original URL:", error);
121041
120963
  return url;
@@ -121339,7 +121261,7 @@ const _sfc_main$4j = /* @__PURE__ */ defineComponent({
121339
121261
  }
121340
121262
  });
121341
121263
 
121342
- 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"]]);
121343
121265
 
121344
121266
  const _hoisted_1$3q = { class: "flex justify-between gap-2 items-center truncate py-1" };
121345
121267
  const _hoisted_2$2z = {
@@ -123871,13 +123793,13 @@ const _sfc_main$45 = /* @__PURE__ */ defineComponent({
123871
123793
  computed(() => ({}))
123872
123794
  );
123873
123795
  const { crmShape } = useCrmShape();
123874
- const { crmShapeWithSectionCtx } = useCanvasContext();
123796
+ const { fullContext } = useCanvasContext();
123875
123797
  const isCrmShapeEnabled = computed(() => launchDarkly.value?.enable_crm_shape_for_external_links ?? false);
123876
123798
  const parsedUrl = computed(() => {
123877
123799
  if (!url.value.trim()) return url.value;
123878
123800
  if (!isCrmShapeEnabled.value) return url.value;
123879
123801
  try {
123880
- return renderTemplate(url.value, crmShapeWithSectionCtx.value);
123802
+ return renderTemplate(url.value, fullContext.value);
123881
123803
  } catch (error) {
123882
123804
  console.error("Error parsing URL template:", error);
123883
123805
  return url.value;
@@ -123983,7 +123905,7 @@ const _sfc_main$45 = /* @__PURE__ */ defineComponent({
123983
123905
  }
123984
123906
  });
123985
123907
 
123986
- 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"]]);
123987
123909
 
123988
123910
  const _hoisted_1$3d = { class: "mr-3 h-full" };
123989
123911
  const _hoisted_2$2m = { class: "flex flex-col gap-3 mb-3" };
@@ -137804,19 +137726,37 @@ function useComponentPermissions({
137804
137726
  isAnyTypeOfAdmin: false
137805
137727
  }))
137806
137728
  );
137807
- const { canvasContent } = useCanvas$1();
137729
+ const launchDarkly = inject(
137730
+ "launchDarkly",
137731
+ computed(() => ({}))
137732
+ );
137733
+ const { canvasContent, activeCanvas } = useCanvas$1();
137808
137734
  return computed(() => {
137809
- if (!usedInSectionId.value) return calculateCanvasPermissions(id.value, !!pitcherInfo.value?.isAnyTypeOfAdmin);
137810
- const parent = findParentByNodeId(canvasContent.value, id.value);
137811
- const canRemove = !!when_used_in_section.value?.is_removable;
137812
- const canEdit = !!when_used_in_section.value?.is_editable;
137813
- const canDuplicate = parent ? !!parent.when_used_in_section?.is_editable : false;
137814
- return {
137815
- hasSomethingEditable: canEdit || canRemove || canDuplicate,
137816
- canRemove,
137817
- canEdit,
137818
- canDuplicate
137819
- };
137735
+ if (usedInSectionId.value) {
137736
+ const parent = findParentByNodeId(canvasContent.value, id.value);
137737
+ const canRemove = !!when_used_in_section.value?.is_removable;
137738
+ const canEdit = !!when_used_in_section.value?.is_editable;
137739
+ const canDuplicate = parent ? !!parent.when_used_in_section?.is_editable : false;
137740
+ return {
137741
+ hasSomethingEditable: canEdit || canRemove || canDuplicate,
137742
+ canRemove,
137743
+ canEdit,
137744
+ canDuplicate
137745
+ };
137746
+ }
137747
+ const hasExplicitPermissions = when_used_in_section.value !== null && when_used_in_section.value !== void 0 && (when_used_in_section.value.is_editable !== void 0 || when_used_in_section.value.is_removable !== void 0);
137748
+ if (activeCanvas.value?.template?.id && launchDarkly.value.enable_template_component_permissions && hasExplicitPermissions) {
137749
+ const canRemove = !!when_used_in_section.value?.is_removable;
137750
+ const canEdit = !!when_used_in_section.value?.is_editable;
137751
+ const canDuplicate = canEdit;
137752
+ return {
137753
+ hasSomethingEditable: canEdit || canRemove || canDuplicate,
137754
+ canRemove,
137755
+ canEdit,
137756
+ canDuplicate
137757
+ };
137758
+ }
137759
+ return calculateCanvasPermissions(id.value, !!pitcherInfo.value?.isAnyTypeOfAdmin);
137820
137760
  });
137821
137761
  }
137822
137762
 
@@ -148069,7 +148009,7 @@ const _sfc_main$2i = /* @__PURE__ */ defineComponent({
148069
148009
  } = useCanvas$1();
148070
148010
  const { discardOverridesConfirmationOptions, getComponentOverrides } = useCanvasSectionOverrides();
148071
148011
  const { getDerivedStyleFromFeatureFlags } = useComponentStyle(componentNode);
148072
- const { crmShapeWithSectionCtx } = useCanvasContext();
148012
+ const { fullContext } = useCanvasContext();
148073
148013
  const { setContentSelectorMode } = useContentSelector();
148074
148014
  const confirmation = useConfirmation();
148075
148015
  const themeVars = useThemeVars();
@@ -148222,7 +148162,7 @@ const _sfc_main$2i = /* @__PURE__ */ defineComponent({
148222
148162
  try {
148223
148163
  return {
148224
148164
  ...value,
148225
- external_url: renderTemplate(value.external_url, crmShapeWithSectionCtx.value)
148165
+ external_url: renderTemplate(value.external_url, fullContext.value)
148226
148166
  };
148227
148167
  } catch (error) {
148228
148168
  console.warn("Failed to parse template in external URL, using original URL:", error);
@@ -148740,7 +148680,7 @@ const _sfc_main$2h = /* @__PURE__ */ defineComponent({
148740
148680
  setCanvasMetadata,
148741
148681
  isImpact
148742
148682
  } = useCanvas$1();
148743
- const { crmShapeWithSectionCtx } = useCanvasContext();
148683
+ const { fullContext } = useCanvasContext();
148744
148684
  const { coreRestApiAxios } = useCoreApi();
148745
148685
  const { applyPrintModeToElement } = usePrintMode();
148746
148686
  const { discardOverridesConfirmationOptions, getComponentOverrides } = useCanvasSectionOverrides();
@@ -148797,7 +148737,7 @@ const _sfc_main$2h = /* @__PURE__ */ defineComponent({
148797
148737
  const memoizedModelValue = computed(() => getModelValue(computedTextProps.value.data?.content));
148798
148738
  function getModelValue(value = "") {
148799
148739
  if (!shouldInterpolate.value || !value.trim()) return value;
148800
- return renderTemplate(value, crmShapeWithSectionCtx.value);
148740
+ return renderTemplate(value, fullContext.value);
148801
148741
  }
148802
148742
  const debouncedUpdateNodeData = debounce((data2, nodeId, sectionId) => {
148803
148743
  return updateNodeData(data2, nodeId, sectionId);
@@ -148905,7 +148845,7 @@ const _sfc_main$2h = /* @__PURE__ */ defineComponent({
148905
148845
  );
148906
148846
  applyPrintModeToElement(contentElement.value, () => {
148907
148847
  const content = computedTextProps.value.data?.content || "";
148908
- return shouldInterpolate.value ? renderTemplate(content, crmShapeWithSectionCtx.value) : content;
148848
+ return shouldInterpolate.value ? renderTemplate(content, fullContext.value) : content;
148909
148849
  });
148910
148850
  if (enableScaleContent && spanStyles) {
148911
148851
  setTimeout(() => {
@@ -149017,7 +148957,7 @@ const _sfc_main$2h = /* @__PURE__ */ defineComponent({
149017
148957
  }
149018
148958
  });
149019
148959
 
149020
- 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"]]);
149021
148961
 
149022
148962
  const _hoisted_1$1Q = { class: "absolute top-2 right-2 flex items-center gap-1 z-10" };
149023
148963
  const _hoisted_2$1m = { class: "text-xs" };
@@ -156793,7 +156733,9 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156793
156733
  visible: {},
156794
156734
  allow_admins_to_overwrite: { type: Boolean },
156795
156735
  style: {},
156796
- printModeIdx: {}
156736
+ printModeIdx: {},
156737
+ when_used_in_section: { default: () => defaultWhenUsedInSection },
156738
+ usedInSectionId: { default: "" }
156797
156739
  },
156798
156740
  emits: ["style"],
156799
156741
  setup(__props, { emit: __emit }) {
@@ -156808,12 +156750,42 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156808
156750
  computed(() => [])
156809
156751
  );
156810
156752
  const { isCompletionWizardEnabled, retriggerWizard } = useCanvasCompletionWizard();
156811
- const isEditable = computed(
156812
- () => isImpact.value ? !props.data.selection_strategy || props.data.selection_strategy === "free" || isCompletionWizardEnabled.value && wizardStepSectionListIds.value.includes(props.id) : true
156813
- );
156814
- const isRemovable = computed(
156815
- () => isImpact.value ? !props.data.selection_strategy || props.data.selection_strategy === "free" : true
156816
- );
156753
+ const {
156754
+ isImpact,
156755
+ mode,
156756
+ isEditMode,
156757
+ componentSelectedMode,
156758
+ isViewOnlyMode,
156759
+ componentEditMode,
156760
+ componentNodesById,
156761
+ activeCanvas,
156762
+ saveCanvasContentWithContext,
156763
+ removeComponentById,
156764
+ setComponentSelectedMode,
156765
+ setComponentSettingsMode,
156766
+ updateNodeDataById,
156767
+ canvasContent
156768
+ } = useCanvas$1();
156769
+ const { id, usedInSectionId, when_used_in_section } = toRefs(props);
156770
+ const componentPermissions = useComponentPermissions({
156771
+ id,
156772
+ usedInSectionId,
156773
+ when_used_in_section
156774
+ });
156775
+ const isEditable = computed(() => {
156776
+ if (!componentPermissions.value.canEdit) return false;
156777
+ if (isImpact.value) {
156778
+ return !props.data.selection_strategy || props.data.selection_strategy === "free" || isCompletionWizardEnabled.value && wizardStepSectionListIds.value.includes(props.id);
156779
+ }
156780
+ return true;
156781
+ });
156782
+ const isRemovable = computed(() => {
156783
+ if (!componentPermissions.value.canRemove) return false;
156784
+ if (isImpact.value) {
156785
+ return !props.data.selection_strategy || props.data.selection_strategy === "free";
156786
+ }
156787
+ return true;
156788
+ });
156817
156789
  const sectionSelectorAppSrc = computed(() => {
156818
156790
  if (!sectionSelectorApps.value?.length || !props.data.selection_app_name) return null;
156819
156791
  const relatedApp = sectionSelectorApps.value.find((app) => app.app_metadata?.name === props.data.selection_app_name);
@@ -156880,7 +156852,7 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156880
156852
  async (selectedData) => {
156881
156853
  console.info(`[SectionList]: Received done callback for ${props.id} with data`, selectedData);
156882
156854
  if (!selectedData) return;
156883
- const sections = (selectedData?.section_ids || []).map((id) => ({ id: typeof id === "string" ? id : id.id }));
156855
+ const sections = (selectedData?.section_ids || []).map((id2) => ({ id: typeof id2 === "string" ? id2 : id2.id }));
156884
156856
  const updatedData = { ...props.data, sections };
156885
156857
  updateNodeDataById(props.id, updatedData);
156886
156858
  const currentContext = cloneDeep(activeCanvas.value?.context || {});
@@ -156906,22 +156878,6 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156906
156878
  sectionListRef.value?.toggleSectionSelector();
156907
156879
  }
156908
156880
  }
156909
- const {
156910
- isImpact,
156911
- mode,
156912
- isEditMode,
156913
- componentSelectedMode,
156914
- isViewOnlyMode,
156915
- componentEditMode,
156916
- componentNodesById,
156917
- activeCanvas,
156918
- saveCanvasContentWithContext,
156919
- removeComponentById,
156920
- setComponentSelectedMode,
156921
- setComponentSettingsMode,
156922
- updateNodeDataById,
156923
- canvasContent
156924
- } = useCanvas$1();
156925
156881
  return (_ctx, _cache) => {
156926
156882
  return openBlock(), createElementBlock(Fragment, null, [
156927
156883
  unref(shouldDisplayPlaceholderComponent)(unref(isEditMode), unref(mode), _ctx.visible) ? (openBlock(), createBlock(PlaceholderComponent, {
@@ -156929,25 +156885,25 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156929
156885
  name: _ctx.tracking_id
156930
156886
  }, null, 8, ["name"])) : unref(isEditMode) && !unref(isViewOnlyMode) ? (openBlock(), createBlock(_sfc_main$34, {
156931
156887
  key: 1,
156932
- id: _ctx.id,
156933
- active: unref(componentEditMode) && unref(componentEditMode)?.id === _ctx.id,
156888
+ id: unref(id),
156889
+ active: unref(componentEditMode) && unref(componentEditMode)?.id === unref(id),
156934
156890
  class: normalizeClass({ "mt-12": sectionListName.value }),
156935
156891
  edit: isEditable.value,
156936
156892
  "exclude-stylables": [unref(ThemeComponentOptionEnum).COLOR_PICKER],
156937
156893
  remove: isRemovable.value,
156938
- selected: unref(componentSelectedMode) && unref(componentSelectedMode)?.id === _ctx.id,
156894
+ selected: unref(componentSelectedMode) && unref(componentSelectedMode)?.id === unref(id),
156939
156895
  settings: "",
156940
156896
  stylable: "",
156941
156897
  style: normalizeStyle(unref(omit$1)(_ctx.style, "paddingBottom", "paddingLeft", "paddingTop", "paddingRight")),
156942
156898
  onEdit: handleEdit,
156943
- onRemove: _cache[0] || (_cache[0] = ($event) => unref(removeComponentById)(_ctx.id)),
156944
- onSelect: _cache[1] || (_cache[1] = ($event) => unref(setComponentSelectedMode)(_ctx.id)),
156945
- onSettings: _cache[2] || (_cache[2] = ($event) => unref(setComponentSettingsMode)(_ctx.id)),
156899
+ onRemove: _cache[0] || (_cache[0] = ($event) => unref(removeComponentById)(unref(id))),
156900
+ onSelect: _cache[1] || (_cache[1] = ($event) => unref(setComponentSelectedMode)(unref(id))),
156901
+ onSettings: _cache[2] || (_cache[2] = ($event) => unref(setComponentSettingsMode)(unref(id))),
156946
156902
  onStyle: _cache[3] || (_cache[3] = ($event) => emit("style", $event))
156947
156903
  }, {
156948
156904
  default: withCtx(() => [
156949
156905
  createVNode(RawSectionList, mergeProps({
156950
- id: _ctx.id,
156906
+ id: unref(id),
156951
156907
  ref_key: "sectionListRef",
156952
156908
  ref: sectionListRef,
156953
156909
  class: "pa-2",
@@ -156965,7 +156921,7 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156965
156921
  _: 1
156966
156922
  }, 8, ["id", "active", "class", "edit", "exclude-stylables", "remove", "selected", "style"])) : (openBlock(), createBlock(RawSectionList, mergeProps({
156967
156923
  key: 2,
156968
- id: _ctx.id,
156924
+ id: unref(id),
156969
156925
  data: _ctx.data
156970
156926
  }, unref(attrs), {
156971
156927
  "has-section-selector-app": !!sectionSelectorAppSrc.value,
@@ -159493,7 +159449,8 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159493
159449
  autofill: {},
159494
159450
  linkable: {},
159495
159451
  autofill_content_types: {},
159496
- when_used_in_section: {}
159452
+ when_used_in_section: { default: () => defaultWhenUsedInSection },
159453
+ usedInSectionId: { default: "" }
159497
159454
  },
159498
159455
  emits: ["style"],
159499
159456
  setup(__props, { emit: __emit }) {
@@ -159504,12 +159461,42 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159504
159461
  computed(() => [])
159505
159462
  );
159506
159463
  const { isCompletionWizardEnabled, retriggerWizard } = useCanvasCompletionWizard();
159507
- const isEditable = computed(
159508
- () => isImpact.value ? !props.data.selection_strategy || props.data.selection_strategy === "free" || isCompletionWizardEnabled.value && wizardStepSectionListIds.value.includes(props.id) : true
159509
- );
159510
- const isRemovable = computed(
159511
- () => isImpact.value ? !props.data.selection_strategy || props.data.selection_strategy === "free" : true
159512
- );
159464
+ const {
159465
+ isImpact,
159466
+ mode,
159467
+ isEditMode,
159468
+ componentSelectedMode,
159469
+ isViewOnlyMode,
159470
+ componentEditMode,
159471
+ componentNodesById,
159472
+ activeCanvas,
159473
+ saveCanvasContentWithContext,
159474
+ removeComponentById,
159475
+ setComponentSelectedMode,
159476
+ setComponentSettingsMode,
159477
+ updateNodeDataById,
159478
+ canvasContent
159479
+ } = useCanvas$1();
159480
+ const { id, usedInSectionId, when_used_in_section } = toRefs(props);
159481
+ const componentPermissions = useComponentPermissions({
159482
+ id,
159483
+ usedInSectionId,
159484
+ when_used_in_section
159485
+ });
159486
+ const isEditable = computed(() => {
159487
+ if (!componentPermissions.value.canEdit) return false;
159488
+ if (isImpact.value) {
159489
+ return !props.data.selection_strategy || props.data.selection_strategy === "free" || isCompletionWizardEnabled.value && wizardStepSectionListIds.value.includes(props.id);
159490
+ }
159491
+ return true;
159492
+ });
159493
+ const isRemovable = computed(() => {
159494
+ if (!componentPermissions.value.canRemove) return false;
159495
+ if (isImpact.value) {
159496
+ return !props.data.selection_strategy || props.data.selection_strategy === "free";
159497
+ }
159498
+ return true;
159499
+ });
159513
159500
  const sectionSelectorAppSrc = computed(() => {
159514
159501
  if (!sectionSelectorApps.value?.length || !props.data.selection_app_name) return null;
159515
159502
  const relatedApp = sectionSelectorApps.value.find((app) => app.app_metadata?.name === props.data.selection_app_name);
@@ -159575,7 +159562,7 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159575
159562
  async (selectedData) => {
159576
159563
  console.info(`[SectionList]: Received done callback for ${props.id} with data`, selectedData);
159577
159564
  if (!selectedData) return;
159578
- const sections = (selectedData?.section_ids || []).map((id) => ({ id: typeof id === "string" ? id : id.id }));
159565
+ const sections = (selectedData?.section_ids || []).map((id2) => ({ id: typeof id2 === "string" ? id2 : id2.id }));
159579
159566
  const updatedData = { ...props.data, sections };
159580
159567
  updateNodeDataById(props.id, updatedData);
159581
159568
  const currentContext = cloneDeep(activeCanvas.value?.context || {});
@@ -159601,22 +159588,6 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159601
159588
  contentListRef.value?.toggleSectionSelector();
159602
159589
  }
159603
159590
  }
159604
- const {
159605
- isImpact,
159606
- mode,
159607
- isEditMode,
159608
- componentSelectedMode,
159609
- isViewOnlyMode,
159610
- componentEditMode,
159611
- componentNodesById,
159612
- activeCanvas,
159613
- saveCanvasContentWithContext,
159614
- removeComponentById,
159615
- setComponentSelectedMode,
159616
- setComponentSettingsMode,
159617
- updateNodeDataById,
159618
- canvasContent
159619
- } = useCanvas$1();
159620
159591
  return (_ctx, _cache) => {
159621
159592
  return openBlock(), createElementBlock(Fragment, null, [
159622
159593
  unref(shouldDisplayPlaceholderComponent)(unref(isEditMode), unref(mode), _ctx.visible) ? (openBlock(), createBlock(PlaceholderComponent, {
@@ -159624,25 +159595,25 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159624
159595
  name: _ctx.tracking_id
159625
159596
  }, null, 8, ["name"])) : unref(isEditMode) && !unref(isViewOnlyMode) ? (openBlock(), createBlock(_sfc_main$34, {
159626
159597
  key: 1,
159627
- id: _ctx.id,
159628
- active: unref(componentEditMode) && unref(componentEditMode)?.id === _ctx.id,
159598
+ id: unref(id),
159599
+ active: unref(componentEditMode) && unref(componentEditMode)?.id === unref(id),
159629
159600
  class: normalizeClass({ "mt-12": componentName.value }),
159630
159601
  edit: isEditable.value,
159631
159602
  "exclude-stylables": [unref(ThemeComponentOptionEnum).COLOR_PICKER],
159632
159603
  remove: isRemovable.value,
159633
- selected: unref(componentSelectedMode) && unref(componentSelectedMode)?.id === _ctx.id,
159604
+ selected: unref(componentSelectedMode) && unref(componentSelectedMode)?.id === unref(id),
159634
159605
  settings: "",
159635
159606
  stylable: "",
159636
159607
  style: normalizeStyle(unref(omit$1)(_ctx.style, "paddingBottom", "paddingLeft", "paddingTop", "paddingRight")),
159637
159608
  onEdit: handleEdit,
159638
- onRemove: _cache[0] || (_cache[0] = ($event) => unref(removeComponentById)(_ctx.id)),
159639
- onSelect: _cache[1] || (_cache[1] = ($event) => unref(setComponentSelectedMode)(_ctx.id)),
159640
- onSettings: _cache[2] || (_cache[2] = ($event) => unref(setComponentSettingsMode)(_ctx.id)),
159609
+ onRemove: _cache[0] || (_cache[0] = ($event) => unref(removeComponentById)(unref(id))),
159610
+ onSelect: _cache[1] || (_cache[1] = ($event) => unref(setComponentSelectedMode)(unref(id))),
159611
+ onSettings: _cache[2] || (_cache[2] = ($event) => unref(setComponentSettingsMode)(unref(id))),
159641
159612
  onStyle: _cache[3] || (_cache[3] = ($event) => emit("style", $event))
159642
159613
  }, {
159643
159614
  default: withCtx(() => [
159644
159615
  createVNode(ContentListRaw, mergeProps({
159645
- id: _ctx.id,
159616
+ id: unref(id),
159646
159617
  ref_key: "contentListRef",
159647
159618
  ref: contentListRef,
159648
159619
  class: ["pa-2", props.class],
@@ -159660,7 +159631,7 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159660
159631
  _: 1
159661
159632
  }, 8, ["id", "active", "class", "edit", "exclude-stylables", "remove", "selected", "style"])) : (openBlock(), createBlock(ContentListRaw, mergeProps({
159662
159633
  key: 2,
159663
- id: _ctx.id,
159634
+ id: unref(id),
159664
159635
  data: _ctx.data
159665
159636
  }, unref(attrs), {
159666
159637
  "has-section-selector-app": !!sectionSelectorAppSrc.value,
@@ -162546,7 +162517,9 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
162546
162517
  isCanvasTemplate,
162547
162518
  isCanvas,
162548
162519
  isTemplate,
162549
- isSection
162520
+ isSection,
162521
+ parentIdByNodeId,
162522
+ componentNodesById
162550
162523
  } = useCanvas$1();
162551
162524
  const { getComponentDefaultVisibility } = useCanvasVisibility();
162552
162525
  const { crmShape } = useCrmShape();
@@ -162572,7 +162545,7 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
162572
162545
  );
162573
162546
  const areSectionsSystemControlled = computed(() => launchDarkly.value?.are_sections_system_controlled);
162574
162547
  const allowEditOrRemove = computed(
162575
- () => (selectedComponentType.value === ComponentTypes.Text || selectedComponentType.value === ComponentTypes.Carousel || selectedComponentType.value === ComponentTypes.Multimedia) && isAdmin.value && isSection.value
162548
+ () => isAdmin.value && ((selectedComponentType.value === ComponentTypes.Text || selectedComponentType.value === ComponentTypes.Carousel || selectedComponentType.value === ComponentTypes.Multimedia) && isSection.value || launchDarkly.value.enable_template_component_permissions && isCanvasTemplate.value)
162576
162549
  );
162577
162550
  const canSelectSectionListStrategy = computed(
162578
162551
  () => isAdmin.value && isCanvasTemplate.value && isSectionOrContentList.value
@@ -162633,7 +162606,27 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
162633
162606
  selectedContentGridDataPath.value = value || "";
162634
162607
  formValues.contentGridDataAccessor = value || "";
162635
162608
  }
162609
+ function isComponentInsideSectionList() {
162610
+ if (!activeSettingsNode.value?.id) return false;
162611
+ let currentParentId = parentIdByNodeId.value[activeSettingsNode.value.id];
162612
+ while (currentParentId) {
162613
+ const parentNode = componentNodesById.value[currentParentId];
162614
+ if (parentNode?.type === ComponentTypes.SectionList || parentNode?.type === ComponentTypes.ContentList) {
162615
+ return true;
162616
+ }
162617
+ currentParentId = parentIdByNodeId.value[currentParentId];
162618
+ }
162619
+ return false;
162620
+ }
162636
162621
  function getEditOrRemoveOption() {
162622
+ if (!activeSettingsNode.value?.when_used_in_section) {
162623
+ if (launchDarkly.value.enable_template_component_permissions && isCanvasTemplate.value && !isSection.value) {
162624
+ if (isComponentInsideSectionList()) {
162625
+ return "00";
162626
+ }
162627
+ return "11";
162628
+ }
162629
+ }
162637
162630
  const map = activeSettingsNode.value?.when_used_in_section ?? cloneDeep(defaultWhenUsedInSection);
162638
162631
  let value = "";
162639
162632
  value += map.is_editable ? "1" : "0";
@@ -163135,7 +163128,7 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
163135
163128
  }
163136
163129
  });
163137
163130
 
163138
- const ComponentDrawerSettings = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__scopeId", "data-v-dce6a881"]]);
163131
+ const ComponentDrawerSettings = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__scopeId", "data-v-7724d85a"]]);
163139
163132
 
163140
163133
  function useConnectUpload() {
163141
163134
  async function uploadToConnect(formData) {
@@ -183761,8 +183754,14 @@ function getEventColor(sfEvent) {
183761
183754
  } else {
183762
183755
  isSubmitted = false;
183763
183756
  }
183757
+ const now = /* @__PURE__ */ new Date();
183764
183758
  if (isSubmitted) return SfEventColors.SUBMITTED;
183765
- else if (isAfter$1(/* @__PURE__ */ new Date(), new Date(sfEvent.EndDateTime))) return SfEventColors.PAST;
183759
+ else if (sfEvent.IsAllDayEvent) {
183760
+ const endDate = new Date(sfEvent.EndDateTime);
183761
+ const todayStart = startOfDay(now);
183762
+ const endDayStart = startOfDay(endDate);
183763
+ return isAfter$1(todayStart, endDayStart) ? SfEventColors.PAST : SfEventColors.PLANNED;
183764
+ } else if (isAfter$1(now, new Date(sfEvent.EndDateTime))) return SfEventColors.PAST;
183766
183765
  else return SfEventColors.PLANNED;
183767
183766
  }
183768
183767
  const minFutureDate = (date = /* @__PURE__ */ new Date()) => add(date, { minutes: MIN_DIFFERENCE_IN_MINUTES });