@pitcher/canvas-ui 2026.1.15-101627-beta → 2026.1.15-103854-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/canvas-ui.css CHANGED
@@ -2667,7 +2667,7 @@ to {
2667
2667
  padding: 0;
2668
2668
  }
2669
2669
 
2670
- .data-accessor-input[data-v-dce6a881] .n-input__prefix {
2670
+ .data-accessor-input[data-v-a4296e5c] .n-input__prefix {
2671
2671
  margin-right: 0;
2672
2672
  }
2673
2673
  .cb-dynamic-data-table-settings {
package/canvas-ui.js CHANGED
@@ -84630,6 +84630,10 @@ const defaultWhenUsedInSection = {
84630
84630
  is_editable: false,
84631
84631
  is_removable: false
84632
84632
  };
84633
+ const defaultWhenUsedInTemplate = {
84634
+ is_editable: true,
84635
+ is_removable: true
84636
+ };
84633
84637
  const SERVER_ONLY_PROPS = [
84634
84638
  "content_url",
84635
84639
  "thumbnail_url",
@@ -88214,7 +88218,7 @@ async function crmQueryAdaptive(payload) {
88214
88218
  try {
88215
88219
  const env = await highLevelApi.API.request("get_env");
88216
88220
  const isIos = env?.mode === "IOS";
88217
- const isSfdcSyncEnabled = env?.launch_darkly?.sfdc_offline_enabled === true;
88221
+ const isSfdcSyncEnabled = env?.pitcher?.instance?.settings?.enable_sfdc_sync === true;
88218
88222
  useSmartStore = isIos && isSfdcSyncEnabled;
88219
88223
  } catch {
88220
88224
  useSmartStore = false;
@@ -137870,19 +137874,37 @@ function useComponentPermissions({
137870
137874
  isAnyTypeOfAdmin: false
137871
137875
  }))
137872
137876
  );
137873
- const { canvasContent } = useCanvas$1();
137877
+ const launchDarkly = inject(
137878
+ "launchDarkly",
137879
+ computed(() => ({}))
137880
+ );
137881
+ const { canvasContent, activeCanvas } = useCanvas$1();
137874
137882
  return computed(() => {
137875
- if (!usedInSectionId.value) return calculateCanvasPermissions(id.value, !!pitcherInfo.value?.isAnyTypeOfAdmin);
137876
- const parent = findParentByNodeId(canvasContent.value, id.value);
137877
- const canRemove = !!when_used_in_section.value?.is_removable;
137878
- const canEdit = !!when_used_in_section.value?.is_editable;
137879
- const canDuplicate = parent ? !!parent.when_used_in_section?.is_editable : false;
137880
- return {
137881
- hasSomethingEditable: canEdit || canRemove || canDuplicate,
137882
- canRemove,
137883
- canEdit,
137884
- canDuplicate
137885
- };
137883
+ if (usedInSectionId.value) {
137884
+ const parent = findParentByNodeId(canvasContent.value, id.value);
137885
+ const canRemove = !!when_used_in_section.value?.is_removable;
137886
+ const canEdit = !!when_used_in_section.value?.is_editable;
137887
+ const canDuplicate = parent ? !!parent.when_used_in_section?.is_editable : false;
137888
+ return {
137889
+ hasSomethingEditable: canEdit || canRemove || canDuplicate,
137890
+ canRemove,
137891
+ canEdit,
137892
+ canDuplicate
137893
+ };
137894
+ }
137895
+ const hasExplicitPermissions = when_used_in_section.value !== null && when_used_in_section.value !== void 0 && (when_used_in_section.value.is_editable !== void 0 || when_used_in_section.value.is_removable !== void 0);
137896
+ if (activeCanvas.value?.template?.id && launchDarkly.value.enable_template_component_permissions && hasExplicitPermissions) {
137897
+ const canRemove = !!when_used_in_section.value?.is_removable;
137898
+ const canEdit = !!when_used_in_section.value?.is_editable;
137899
+ const canDuplicate = canEdit;
137900
+ return {
137901
+ hasSomethingEditable: canEdit || canRemove || canDuplicate,
137902
+ canRemove,
137903
+ canEdit,
137904
+ canDuplicate
137905
+ };
137906
+ }
137907
+ return calculateCanvasPermissions(id.value, !!pitcherInfo.value?.isAnyTypeOfAdmin);
137886
137908
  });
137887
137909
  }
137888
137910
 
@@ -156859,7 +156881,9 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156859
156881
  visible: {},
156860
156882
  allow_admins_to_overwrite: { type: Boolean },
156861
156883
  style: {},
156862
- printModeIdx: {}
156884
+ printModeIdx: {},
156885
+ when_used_in_section: {},
156886
+ usedInSectionId: { default: "" }
156863
156887
  },
156864
156888
  emits: ["style"],
156865
156889
  setup(__props, { emit: __emit }) {
@@ -156874,12 +156898,42 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156874
156898
  computed(() => [])
156875
156899
  );
156876
156900
  const { isCompletionWizardEnabled, retriggerWizard } = useCanvasCompletionWizard();
156877
- const isEditable = computed(
156878
- () => isImpact.value ? !props.data.selection_strategy || props.data.selection_strategy === "free" || isCompletionWizardEnabled.value && wizardStepSectionListIds.value.includes(props.id) : true
156879
- );
156880
- const isRemovable = computed(
156881
- () => isImpact.value ? !props.data.selection_strategy || props.data.selection_strategy === "free" : true
156882
- );
156901
+ const {
156902
+ isImpact,
156903
+ mode,
156904
+ isEditMode,
156905
+ componentSelectedMode,
156906
+ isViewOnlyMode,
156907
+ componentEditMode,
156908
+ componentNodesById,
156909
+ activeCanvas,
156910
+ saveCanvasContentWithContext,
156911
+ removeComponentById,
156912
+ setComponentSelectedMode,
156913
+ setComponentSettingsMode,
156914
+ updateNodeDataById,
156915
+ canvasContent
156916
+ } = useCanvas$1();
156917
+ const { id, usedInSectionId, when_used_in_section } = toRefs(props);
156918
+ const componentPermissions = useComponentPermissions({
156919
+ id,
156920
+ usedInSectionId,
156921
+ when_used_in_section
156922
+ });
156923
+ const isEditable = computed(() => {
156924
+ if (!componentPermissions.value.canEdit) return false;
156925
+ if (isImpact.value) {
156926
+ return !props.data.selection_strategy || props.data.selection_strategy === "free" || isCompletionWizardEnabled.value && wizardStepSectionListIds.value.includes(props.id);
156927
+ }
156928
+ return true;
156929
+ });
156930
+ const isRemovable = computed(() => {
156931
+ if (!componentPermissions.value.canRemove) return false;
156932
+ if (isImpact.value) {
156933
+ return !props.data.selection_strategy || props.data.selection_strategy === "free";
156934
+ }
156935
+ return true;
156936
+ });
156883
156937
  const sectionSelectorAppSrc = computed(() => {
156884
156938
  if (!sectionSelectorApps.value?.length || !props.data.selection_app_name) return null;
156885
156939
  const relatedApp = sectionSelectorApps.value.find((app) => app.app_metadata?.name === props.data.selection_app_name);
@@ -156946,7 +157000,7 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156946
157000
  async (selectedData) => {
156947
157001
  console.info(`[SectionList]: Received done callback for ${props.id} with data`, selectedData);
156948
157002
  if (!selectedData) return;
156949
- const sections = (selectedData?.section_ids || []).map((id) => ({ id: typeof id === "string" ? id : id.id }));
157003
+ const sections = (selectedData?.section_ids || []).map((id2) => ({ id: typeof id2 === "string" ? id2 : id2.id }));
156950
157004
  const updatedData = { ...props.data, sections };
156951
157005
  updateNodeDataById(props.id, updatedData);
156952
157006
  const currentContext = cloneDeep(activeCanvas.value?.context || {});
@@ -156972,22 +157026,6 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156972
157026
  sectionListRef.value?.toggleSectionSelector();
156973
157027
  }
156974
157028
  }
156975
- const {
156976
- isImpact,
156977
- mode,
156978
- isEditMode,
156979
- componentSelectedMode,
156980
- isViewOnlyMode,
156981
- componentEditMode,
156982
- componentNodesById,
156983
- activeCanvas,
156984
- saveCanvasContentWithContext,
156985
- removeComponentById,
156986
- setComponentSelectedMode,
156987
- setComponentSettingsMode,
156988
- updateNodeDataById,
156989
- canvasContent
156990
- } = useCanvas$1();
156991
157029
  return (_ctx, _cache) => {
156992
157030
  return openBlock(), createElementBlock(Fragment, null, [
156993
157031
  unref(shouldDisplayPlaceholderComponent)(unref(isEditMode), unref(mode), _ctx.visible) ? (openBlock(), createBlock(PlaceholderComponent, {
@@ -156995,25 +157033,25 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156995
157033
  name: _ctx.tracking_id
156996
157034
  }, null, 8, ["name"])) : unref(isEditMode) && !unref(isViewOnlyMode) ? (openBlock(), createBlock(_sfc_main$34, {
156997
157035
  key: 1,
156998
- id: _ctx.id,
156999
- active: unref(componentEditMode) && unref(componentEditMode)?.id === _ctx.id,
157036
+ id: unref(id),
157037
+ active: unref(componentEditMode) && unref(componentEditMode)?.id === unref(id),
157000
157038
  class: normalizeClass({ "mt-12": sectionListName.value }),
157001
157039
  edit: isEditable.value,
157002
157040
  "exclude-stylables": [unref(ThemeComponentOptionEnum).COLOR_PICKER],
157003
157041
  remove: isRemovable.value,
157004
- selected: unref(componentSelectedMode) && unref(componentSelectedMode)?.id === _ctx.id,
157042
+ selected: unref(componentSelectedMode) && unref(componentSelectedMode)?.id === unref(id),
157005
157043
  settings: "",
157006
157044
  stylable: "",
157007
157045
  style: normalizeStyle(unref(omit$1)(_ctx.style, "paddingBottom", "paddingLeft", "paddingTop", "paddingRight")),
157008
157046
  onEdit: handleEdit,
157009
- onRemove: _cache[0] || (_cache[0] = ($event) => unref(removeComponentById)(_ctx.id)),
157010
- onSelect: _cache[1] || (_cache[1] = ($event) => unref(setComponentSelectedMode)(_ctx.id)),
157011
- onSettings: _cache[2] || (_cache[2] = ($event) => unref(setComponentSettingsMode)(_ctx.id)),
157047
+ onRemove: _cache[0] || (_cache[0] = ($event) => unref(removeComponentById)(unref(id))),
157048
+ onSelect: _cache[1] || (_cache[1] = ($event) => unref(setComponentSelectedMode)(unref(id))),
157049
+ onSettings: _cache[2] || (_cache[2] = ($event) => unref(setComponentSettingsMode)(unref(id))),
157012
157050
  onStyle: _cache[3] || (_cache[3] = ($event) => emit("style", $event))
157013
157051
  }, {
157014
157052
  default: withCtx(() => [
157015
157053
  createVNode(RawSectionList, mergeProps({
157016
- id: _ctx.id,
157054
+ id: unref(id),
157017
157055
  ref_key: "sectionListRef",
157018
157056
  ref: sectionListRef,
157019
157057
  class: "pa-2",
@@ -157031,7 +157069,7 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
157031
157069
  _: 1
157032
157070
  }, 8, ["id", "active", "class", "edit", "exclude-stylables", "remove", "selected", "style"])) : (openBlock(), createBlock(RawSectionList, mergeProps({
157033
157071
  key: 2,
157034
- id: _ctx.id,
157072
+ id: unref(id),
157035
157073
  data: _ctx.data
157036
157074
  }, unref(attrs), {
157037
157075
  "has-section-selector-app": !!sectionSelectorAppSrc.value,
@@ -159559,7 +159597,8 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159559
159597
  autofill: {},
159560
159598
  linkable: {},
159561
159599
  autofill_content_types: {},
159562
- when_used_in_section: {}
159600
+ when_used_in_section: {},
159601
+ usedInSectionId: { default: "" }
159563
159602
  },
159564
159603
  emits: ["style"],
159565
159604
  setup(__props, { emit: __emit }) {
@@ -159570,12 +159609,42 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159570
159609
  computed(() => [])
159571
159610
  );
159572
159611
  const { isCompletionWizardEnabled, retriggerWizard } = useCanvasCompletionWizard();
159573
- const isEditable = computed(
159574
- () => isImpact.value ? !props.data.selection_strategy || props.data.selection_strategy === "free" || isCompletionWizardEnabled.value && wizardStepSectionListIds.value.includes(props.id) : true
159575
- );
159576
- const isRemovable = computed(
159577
- () => isImpact.value ? !props.data.selection_strategy || props.data.selection_strategy === "free" : true
159578
- );
159612
+ const {
159613
+ isImpact,
159614
+ mode,
159615
+ isEditMode,
159616
+ componentSelectedMode,
159617
+ isViewOnlyMode,
159618
+ componentEditMode,
159619
+ componentNodesById,
159620
+ activeCanvas,
159621
+ saveCanvasContentWithContext,
159622
+ removeComponentById,
159623
+ setComponentSelectedMode,
159624
+ setComponentSettingsMode,
159625
+ updateNodeDataById,
159626
+ canvasContent
159627
+ } = useCanvas$1();
159628
+ const { id, usedInSectionId, when_used_in_section } = toRefs(props);
159629
+ const componentPermissions = useComponentPermissions({
159630
+ id,
159631
+ usedInSectionId,
159632
+ when_used_in_section
159633
+ });
159634
+ const isEditable = computed(() => {
159635
+ if (!componentPermissions.value.canEdit) return false;
159636
+ if (isImpact.value) {
159637
+ return !props.data.selection_strategy || props.data.selection_strategy === "free" || isCompletionWizardEnabled.value && wizardStepSectionListIds.value.includes(props.id);
159638
+ }
159639
+ return true;
159640
+ });
159641
+ const isRemovable = computed(() => {
159642
+ if (!componentPermissions.value.canRemove) return false;
159643
+ if (isImpact.value) {
159644
+ return !props.data.selection_strategy || props.data.selection_strategy === "free";
159645
+ }
159646
+ return true;
159647
+ });
159579
159648
  const sectionSelectorAppSrc = computed(() => {
159580
159649
  if (!sectionSelectorApps.value?.length || !props.data.selection_app_name) return null;
159581
159650
  const relatedApp = sectionSelectorApps.value.find((app) => app.app_metadata?.name === props.data.selection_app_name);
@@ -159641,7 +159710,7 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159641
159710
  async (selectedData) => {
159642
159711
  console.info(`[SectionList]: Received done callback for ${props.id} with data`, selectedData);
159643
159712
  if (!selectedData) return;
159644
- const sections = (selectedData?.section_ids || []).map((id) => ({ id: typeof id === "string" ? id : id.id }));
159713
+ const sections = (selectedData?.section_ids || []).map((id2) => ({ id: typeof id2 === "string" ? id2 : id2.id }));
159645
159714
  const updatedData = { ...props.data, sections };
159646
159715
  updateNodeDataById(props.id, updatedData);
159647
159716
  const currentContext = cloneDeep(activeCanvas.value?.context || {});
@@ -159667,22 +159736,6 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159667
159736
  contentListRef.value?.toggleSectionSelector();
159668
159737
  }
159669
159738
  }
159670
- const {
159671
- isImpact,
159672
- mode,
159673
- isEditMode,
159674
- componentSelectedMode,
159675
- isViewOnlyMode,
159676
- componentEditMode,
159677
- componentNodesById,
159678
- activeCanvas,
159679
- saveCanvasContentWithContext,
159680
- removeComponentById,
159681
- setComponentSelectedMode,
159682
- setComponentSettingsMode,
159683
- updateNodeDataById,
159684
- canvasContent
159685
- } = useCanvas$1();
159686
159739
  return (_ctx, _cache) => {
159687
159740
  return openBlock(), createElementBlock(Fragment, null, [
159688
159741
  unref(shouldDisplayPlaceholderComponent)(unref(isEditMode), unref(mode), _ctx.visible) ? (openBlock(), createBlock(PlaceholderComponent, {
@@ -159690,25 +159743,25 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159690
159743
  name: _ctx.tracking_id
159691
159744
  }, null, 8, ["name"])) : unref(isEditMode) && !unref(isViewOnlyMode) ? (openBlock(), createBlock(_sfc_main$34, {
159692
159745
  key: 1,
159693
- id: _ctx.id,
159694
- active: unref(componentEditMode) && unref(componentEditMode)?.id === _ctx.id,
159746
+ id: unref(id),
159747
+ active: unref(componentEditMode) && unref(componentEditMode)?.id === unref(id),
159695
159748
  class: normalizeClass({ "mt-12": componentName.value }),
159696
159749
  edit: isEditable.value,
159697
159750
  "exclude-stylables": [unref(ThemeComponentOptionEnum).COLOR_PICKER],
159698
159751
  remove: isRemovable.value,
159699
- selected: unref(componentSelectedMode) && unref(componentSelectedMode)?.id === _ctx.id,
159752
+ selected: unref(componentSelectedMode) && unref(componentSelectedMode)?.id === unref(id),
159700
159753
  settings: "",
159701
159754
  stylable: "",
159702
159755
  style: normalizeStyle(unref(omit$1)(_ctx.style, "paddingBottom", "paddingLeft", "paddingTop", "paddingRight")),
159703
159756
  onEdit: handleEdit,
159704
- onRemove: _cache[0] || (_cache[0] = ($event) => unref(removeComponentById)(_ctx.id)),
159705
- onSelect: _cache[1] || (_cache[1] = ($event) => unref(setComponentSelectedMode)(_ctx.id)),
159706
- onSettings: _cache[2] || (_cache[2] = ($event) => unref(setComponentSettingsMode)(_ctx.id)),
159757
+ onRemove: _cache[0] || (_cache[0] = ($event) => unref(removeComponentById)(unref(id))),
159758
+ onSelect: _cache[1] || (_cache[1] = ($event) => unref(setComponentSelectedMode)(unref(id))),
159759
+ onSettings: _cache[2] || (_cache[2] = ($event) => unref(setComponentSettingsMode)(unref(id))),
159707
159760
  onStyle: _cache[3] || (_cache[3] = ($event) => emit("style", $event))
159708
159761
  }, {
159709
159762
  default: withCtx(() => [
159710
159763
  createVNode(ContentListRaw, mergeProps({
159711
- id: _ctx.id,
159764
+ id: unref(id),
159712
159765
  ref_key: "contentListRef",
159713
159766
  ref: contentListRef,
159714
159767
  class: ["pa-2", props.class],
@@ -159726,7 +159779,7 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159726
159779
  _: 1
159727
159780
  }, 8, ["id", "active", "class", "edit", "exclude-stylables", "remove", "selected", "style"])) : (openBlock(), createBlock(ContentListRaw, mergeProps({
159728
159781
  key: 2,
159729
- id: _ctx.id,
159782
+ id: unref(id),
159730
159783
  data: _ctx.data
159731
159784
  }, unref(attrs), {
159732
159785
  "has-section-selector-app": !!sectionSelectorAppSrc.value,
@@ -162638,7 +162691,7 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
162638
162691
  );
162639
162692
  const areSectionsSystemControlled = computed(() => launchDarkly.value?.are_sections_system_controlled);
162640
162693
  const allowEditOrRemove = computed(
162641
- () => (selectedComponentType.value === ComponentTypes.Text || selectedComponentType.value === ComponentTypes.Carousel || selectedComponentType.value === ComponentTypes.Multimedia) && isAdmin.value && isSection.value
162694
+ () => isAdmin.value && ((selectedComponentType.value === ComponentTypes.Text || selectedComponentType.value === ComponentTypes.Carousel || selectedComponentType.value === ComponentTypes.Multimedia) && isSection.value || launchDarkly.value.enable_template_component_permissions && isCanvasTemplate.value)
162642
162695
  );
162643
162696
  const canSelectSectionListStrategy = computed(
162644
162697
  () => isAdmin.value && isCanvasTemplate.value && isSectionOrContentList.value
@@ -162700,7 +162753,8 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
162700
162753
  formValues.contentGridDataAccessor = value || "";
162701
162754
  }
162702
162755
  function getEditOrRemoveOption() {
162703
- const map = activeSettingsNode.value?.when_used_in_section ?? cloneDeep(defaultWhenUsedInSection);
162756
+ const defaultPermissions = isCanvasTemplate.value && launchDarkly.value.enable_template_component_permissions ? cloneDeep(defaultWhenUsedInTemplate) : cloneDeep(defaultWhenUsedInSection);
162757
+ const map = activeSettingsNode.value?.when_used_in_section ?? defaultPermissions;
162704
162758
  let value = "";
162705
162759
  value += map.is_editable ? "1" : "0";
162706
162760
  value += map.is_removable ? "1" : "0";
@@ -163201,7 +163255,7 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
163201
163255
  }
163202
163256
  });
163203
163257
 
163204
- const ComponentDrawerSettings = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__scopeId", "data-v-dce6a881"]]);
163258
+ const ComponentDrawerSettings = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__scopeId", "data-v-a4296e5c"]]);
163205
163259
 
163206
163260
  function useConnectUpload() {
163207
163261
  async function uploadToConnect(formData) {
@@ -181989,7 +182043,7 @@ function useSmartStore(env) {
181989
182043
  return false;
181990
182044
  }
181991
182045
  const isIos = envValue?.mode === "IOS";
181992
- const isSfdcSyncEnabled = envValue?.launch_darkly?.sfdc_offline_enabled === true;
182046
+ const isSfdcSyncEnabled = envValue?.pitcher?.instance?.settings?.enable_sfdc_sync === true;
181993
182047
  return isIos && isSfdcSyncEnabled;
181994
182048
  } catch (error) {
181995
182049
  console.error("[useSmartStore] Error checking SmartStore availability:", error);