@pitcher/canvas-ui 2026.1.20-135322 → 2026.1.20-135703

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-1ab19780] .n-input__prefix {
2671
2671
  margin-right: 0;
2672
2672
  }
2673
2673
  .cb-dynamic-data-table-settings {
package/canvas-ui.js CHANGED
@@ -138007,19 +138007,37 @@ function useComponentPermissions({
138007
138007
  isAnyTypeOfAdmin: false
138008
138008
  }))
138009
138009
  );
138010
- const { canvasContent } = useCanvas$1();
138010
+ const launchDarkly = inject(
138011
+ "launchDarkly",
138012
+ computed(() => ({}))
138013
+ );
138014
+ const { canvasContent, activeCanvas } = useCanvas$1();
138011
138015
  return computed(() => {
138012
- if (!usedInSectionId.value) return calculateCanvasPermissions(id.value, !!pitcherInfo.value?.isAnyTypeOfAdmin);
138013
- const parent = findParentByNodeId(canvasContent.value, id.value);
138014
- const canRemove = !!when_used_in_section.value?.is_removable;
138015
- const canEdit = !!when_used_in_section.value?.is_editable;
138016
- const canDuplicate = parent ? !!parent.when_used_in_section?.is_editable : false;
138017
- return {
138018
- hasSomethingEditable: canEdit || canRemove || canDuplicate,
138019
- canRemove,
138020
- canEdit,
138021
- canDuplicate
138022
- };
138016
+ if (usedInSectionId.value) {
138017
+ const parent = findParentByNodeId(canvasContent.value, id.value);
138018
+ const canRemove = !!when_used_in_section.value?.is_removable;
138019
+ const canEdit = !!when_used_in_section.value?.is_editable;
138020
+ const canDuplicate = parent ? !!parent.when_used_in_section?.is_editable : false;
138021
+ return {
138022
+ hasSomethingEditable: canEdit || canRemove || canDuplicate,
138023
+ canRemove,
138024
+ canEdit,
138025
+ canDuplicate
138026
+ };
138027
+ }
138028
+ 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);
138029
+ if (activeCanvas.value?.template?.id && launchDarkly.value.enable_template_component_permissions && hasExplicitPermissions) {
138030
+ const canRemove = !!when_used_in_section.value?.is_removable;
138031
+ const canEdit = !!when_used_in_section.value?.is_editable;
138032
+ const canDuplicate = canEdit;
138033
+ return {
138034
+ hasSomethingEditable: canEdit || canRemove || canDuplicate,
138035
+ canRemove,
138036
+ canEdit,
138037
+ canDuplicate
138038
+ };
138039
+ }
138040
+ return calculateCanvasPermissions(id.value, !!pitcherInfo.value?.isAnyTypeOfAdmin);
138023
138041
  });
138024
138042
  }
138025
138043
 
@@ -156996,7 +157014,9 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
156996
157014
  visible: {},
156997
157015
  allow_admins_to_overwrite: { type: Boolean },
156998
157016
  style: {},
156999
- printModeIdx: {}
157017
+ printModeIdx: {},
157018
+ when_used_in_section: {},
157019
+ usedInSectionId: { default: "" }
157000
157020
  },
157001
157021
  emits: ["style"],
157002
157022
  setup(__props, { emit: __emit }) {
@@ -157011,12 +157031,42 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
157011
157031
  computed(() => [])
157012
157032
  );
157013
157033
  const { isCompletionWizardEnabled, retriggerWizard } = useCanvasCompletionWizard();
157014
- const isEditable = computed(
157015
- () => isImpact.value ? !props.data.selection_strategy || props.data.selection_strategy === "free" || isCompletionWizardEnabled.value && wizardStepSectionListIds.value.includes(props.id) : true
157016
- );
157017
- const isRemovable = computed(
157018
- () => isImpact.value ? !props.data.selection_strategy || props.data.selection_strategy === "free" : true
157019
- );
157034
+ const {
157035
+ isImpact,
157036
+ mode,
157037
+ isEditMode,
157038
+ componentSelectedMode,
157039
+ isViewOnlyMode,
157040
+ componentEditMode,
157041
+ componentNodesById,
157042
+ activeCanvas,
157043
+ saveCanvasContentWithContext,
157044
+ removeComponentById,
157045
+ setComponentSelectedMode,
157046
+ setComponentSettingsMode,
157047
+ updateNodeDataById,
157048
+ canvasContent
157049
+ } = useCanvas$1();
157050
+ const { id, usedInSectionId, when_used_in_section } = toRefs(props);
157051
+ const componentPermissions = useComponentPermissions({
157052
+ id,
157053
+ usedInSectionId,
157054
+ when_used_in_section
157055
+ });
157056
+ const isEditable = computed(() => {
157057
+ if (!componentPermissions.value.canEdit) return false;
157058
+ if (isImpact.value) {
157059
+ return !props.data.selection_strategy || props.data.selection_strategy === "free" || isCompletionWizardEnabled.value && wizardStepSectionListIds.value.includes(props.id);
157060
+ }
157061
+ return true;
157062
+ });
157063
+ const isRemovable = computed(() => {
157064
+ if (!componentPermissions.value.canRemove) return false;
157065
+ if (isImpact.value) {
157066
+ return !props.data.selection_strategy || props.data.selection_strategy === "free";
157067
+ }
157068
+ return true;
157069
+ });
157020
157070
  const sectionSelectorAppSrc = computed(() => {
157021
157071
  if (!sectionSelectorApps.value?.length || !props.data.selection_app_name) return null;
157022
157072
  const relatedApp = sectionSelectorApps.value.find((app) => app.app_metadata?.name === props.data.selection_app_name);
@@ -157083,7 +157133,7 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
157083
157133
  async (selectedData) => {
157084
157134
  console.info(`[SectionList]: Received done callback for ${props.id} with data`, selectedData);
157085
157135
  if (!selectedData) return;
157086
- const sections = (selectedData?.section_ids || []).map((id) => ({ id: typeof id === "string" ? id : id.id }));
157136
+ const sections = (selectedData?.section_ids || []).map((id2) => ({ id: typeof id2 === "string" ? id2 : id2.id }));
157087
157137
  const updatedData = { ...props.data, sections };
157088
157138
  updateNodeDataById(props.id, updatedData);
157089
157139
  const currentContext = cloneDeep(activeCanvas.value?.context || {});
@@ -157109,22 +157159,6 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
157109
157159
  sectionListRef.value?.toggleSectionSelector();
157110
157160
  }
157111
157161
  }
157112
- const {
157113
- isImpact,
157114
- mode,
157115
- isEditMode,
157116
- componentSelectedMode,
157117
- isViewOnlyMode,
157118
- componentEditMode,
157119
- componentNodesById,
157120
- activeCanvas,
157121
- saveCanvasContentWithContext,
157122
- removeComponentById,
157123
- setComponentSelectedMode,
157124
- setComponentSettingsMode,
157125
- updateNodeDataById,
157126
- canvasContent
157127
- } = useCanvas$1();
157128
157162
  return (_ctx, _cache) => {
157129
157163
  return openBlock(), createElementBlock(Fragment, null, [
157130
157164
  unref(shouldDisplayPlaceholderComponent)(unref(isEditMode), unref(mode), _ctx.visible) ? (openBlock(), createBlock(PlaceholderComponent, {
@@ -157132,25 +157166,25 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
157132
157166
  name: _ctx.tracking_id
157133
157167
  }, null, 8, ["name"])) : unref(isEditMode) && !unref(isViewOnlyMode) ? (openBlock(), createBlock(_sfc_main$34, {
157134
157168
  key: 1,
157135
- id: _ctx.id,
157136
- active: unref(componentEditMode) && unref(componentEditMode)?.id === _ctx.id,
157169
+ id: unref(id),
157170
+ active: unref(componentEditMode) && unref(componentEditMode)?.id === unref(id),
157137
157171
  class: normalizeClass({ "mt-12": sectionListName.value }),
157138
157172
  edit: isEditable.value,
157139
157173
  "exclude-stylables": [unref(ThemeComponentOptionEnum).COLOR_PICKER],
157140
157174
  remove: isRemovable.value,
157141
- selected: unref(componentSelectedMode) && unref(componentSelectedMode)?.id === _ctx.id,
157175
+ selected: unref(componentSelectedMode) && unref(componentSelectedMode)?.id === unref(id),
157142
157176
  settings: "",
157143
157177
  stylable: "",
157144
157178
  style: normalizeStyle(unref(omit$1)(_ctx.style, "paddingBottom", "paddingLeft", "paddingTop", "paddingRight")),
157145
157179
  onEdit: handleEdit,
157146
- onRemove: _cache[0] || (_cache[0] = ($event) => unref(removeComponentById)(_ctx.id)),
157147
- onSelect: _cache[1] || (_cache[1] = ($event) => unref(setComponentSelectedMode)(_ctx.id)),
157148
- onSettings: _cache[2] || (_cache[2] = ($event) => unref(setComponentSettingsMode)(_ctx.id)),
157180
+ onRemove: _cache[0] || (_cache[0] = ($event) => unref(removeComponentById)(unref(id))),
157181
+ onSelect: _cache[1] || (_cache[1] = ($event) => unref(setComponentSelectedMode)(unref(id))),
157182
+ onSettings: _cache[2] || (_cache[2] = ($event) => unref(setComponentSettingsMode)(unref(id))),
157149
157183
  onStyle: _cache[3] || (_cache[3] = ($event) => emit("style", $event))
157150
157184
  }, {
157151
157185
  default: withCtx(() => [
157152
157186
  createVNode(RawSectionList, mergeProps({
157153
- id: _ctx.id,
157187
+ id: unref(id),
157154
157188
  ref_key: "sectionListRef",
157155
157189
  ref: sectionListRef,
157156
157190
  class: "pa-2",
@@ -157168,7 +157202,7 @@ const _sfc_main$1P = /* @__PURE__ */ defineComponent({
157168
157202
  _: 1
157169
157203
  }, 8, ["id", "active", "class", "edit", "exclude-stylables", "remove", "selected", "style"])) : (openBlock(), createBlock(RawSectionList, mergeProps({
157170
157204
  key: 2,
157171
- id: _ctx.id,
157205
+ id: unref(id),
157172
157206
  data: _ctx.data
157173
157207
  }, unref(attrs), {
157174
157208
  "has-section-selector-app": !!sectionSelectorAppSrc.value,
@@ -159696,7 +159730,8 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159696
159730
  autofill: {},
159697
159731
  linkable: {},
159698
159732
  autofill_content_types: {},
159699
- when_used_in_section: {}
159733
+ when_used_in_section: {},
159734
+ usedInSectionId: { default: "" }
159700
159735
  },
159701
159736
  emits: ["style"],
159702
159737
  setup(__props, { emit: __emit }) {
@@ -159711,12 +159746,42 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159711
159746
  computed(() => ({}))
159712
159747
  );
159713
159748
  const { isCompletionWizardEnabled, retriggerWizard } = useCanvasCompletionWizard();
159714
- const isEditable = computed(
159715
- () => isImpact.value ? !props.data.selection_strategy || props.data.selection_strategy === "free" || isCompletionWizardEnabled.value && wizardStepSectionListIds.value.includes(props.id) : true
159716
- );
159717
- const isRemovable = computed(
159718
- () => isImpact.value ? !props.data.selection_strategy || props.data.selection_strategy === "free" : true
159719
- );
159749
+ const {
159750
+ isImpact,
159751
+ mode,
159752
+ isEditMode,
159753
+ componentSelectedMode,
159754
+ isViewOnlyMode,
159755
+ componentEditMode,
159756
+ componentNodesById,
159757
+ activeCanvas,
159758
+ saveCanvasContentWithContext,
159759
+ removeComponentById,
159760
+ setComponentSelectedMode,
159761
+ setComponentSettingsMode,
159762
+ updateNodeDataById,
159763
+ canvasContent
159764
+ } = useCanvas$1();
159765
+ const { id, usedInSectionId, when_used_in_section } = toRefs(props);
159766
+ const componentPermissions = useComponentPermissions({
159767
+ id,
159768
+ usedInSectionId,
159769
+ when_used_in_section
159770
+ });
159771
+ const isEditable = computed(() => {
159772
+ if (!componentPermissions.value.canEdit) return false;
159773
+ if (isImpact.value) {
159774
+ return !props.data.selection_strategy || props.data.selection_strategy === "free" || isCompletionWizardEnabled.value && wizardStepSectionListIds.value.includes(props.id);
159775
+ }
159776
+ return true;
159777
+ });
159778
+ const isRemovable = computed(() => {
159779
+ if (!componentPermissions.value.canRemove) return false;
159780
+ if (isImpact.value) {
159781
+ return !props.data.selection_strategy || props.data.selection_strategy === "free";
159782
+ }
159783
+ return true;
159784
+ });
159720
159785
  const sectionSelectorAppSrc = computed(() => {
159721
159786
  if (!sectionSelectorApps.value?.length || !props.data.selection_app_name) return null;
159722
159787
  const relatedApp = sectionSelectorApps.value.find((app) => app.app_metadata?.name === props.data.selection_app_name);
@@ -159783,7 +159848,7 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159783
159848
  async (selectedData) => {
159784
159849
  console.info(`[SectionList]: Received done callback for ${props.id} with data`, selectedData);
159785
159850
  if (!selectedData) return;
159786
- const sections = (selectedData?.section_ids || []).map((id) => ({ id: typeof id === "string" ? id : id.id }));
159851
+ const sections = (selectedData?.section_ids || []).map((id2) => ({ id: typeof id2 === "string" ? id2 : id2.id }));
159787
159852
  const updatedData = { ...props.data, sections };
159788
159853
  updateNodeDataById(props.id, updatedData);
159789
159854
  const currentContext = cloneDeep(activeCanvas.value?.context || {});
@@ -159809,22 +159874,6 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159809
159874
  contentListRef.value?.toggleSectionSelector();
159810
159875
  }
159811
159876
  }
159812
- const {
159813
- isImpact,
159814
- mode,
159815
- isEditMode,
159816
- componentSelectedMode,
159817
- isViewOnlyMode,
159818
- componentEditMode,
159819
- componentNodesById,
159820
- activeCanvas,
159821
- saveCanvasContentWithContext,
159822
- removeComponentById,
159823
- setComponentSelectedMode,
159824
- setComponentSettingsMode,
159825
- updateNodeDataById,
159826
- canvasContent
159827
- } = useCanvas$1();
159828
159877
  return (_ctx, _cache) => {
159829
159878
  return openBlock(), createElementBlock(Fragment, null, [
159830
159879
  unref(shouldDisplayPlaceholderComponent)(unref(isEditMode), unref(mode), _ctx.visible) ? (openBlock(), createBlock(PlaceholderComponent, {
@@ -159832,25 +159881,25 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159832
159881
  name: _ctx.tracking_id
159833
159882
  }, null, 8, ["name"])) : unref(isEditMode) && !unref(isViewOnlyMode) ? (openBlock(), createBlock(_sfc_main$34, {
159834
159883
  key: 1,
159835
- id: _ctx.id,
159836
- active: unref(componentEditMode) && unref(componentEditMode)?.id === _ctx.id,
159884
+ id: unref(id),
159885
+ active: unref(componentEditMode) && unref(componentEditMode)?.id === unref(id),
159837
159886
  class: normalizeClass({ "mt-12": componentName.value }),
159838
159887
  edit: isEditable.value,
159839
159888
  "exclude-stylables": [unref(ThemeComponentOptionEnum).COLOR_PICKER],
159840
159889
  remove: isRemovable.value,
159841
- selected: unref(componentSelectedMode) && unref(componentSelectedMode)?.id === _ctx.id,
159890
+ selected: unref(componentSelectedMode) && unref(componentSelectedMode)?.id === unref(id),
159842
159891
  settings: "",
159843
159892
  stylable: "",
159844
159893
  style: normalizeStyle(unref(omit$1)(_ctx.style, "paddingBottom", "paddingLeft", "paddingTop", "paddingRight")),
159845
159894
  onEdit: handleEdit,
159846
- onRemove: _cache[0] || (_cache[0] = ($event) => unref(removeComponentById)(_ctx.id)),
159847
- onSelect: _cache[1] || (_cache[1] = ($event) => unref(setComponentSelectedMode)(_ctx.id)),
159848
- onSettings: _cache[2] || (_cache[2] = ($event) => unref(setComponentSettingsMode)(_ctx.id)),
159895
+ onRemove: _cache[0] || (_cache[0] = ($event) => unref(removeComponentById)(unref(id))),
159896
+ onSelect: _cache[1] || (_cache[1] = ($event) => unref(setComponentSelectedMode)(unref(id))),
159897
+ onSettings: _cache[2] || (_cache[2] = ($event) => unref(setComponentSettingsMode)(unref(id))),
159849
159898
  onStyle: _cache[3] || (_cache[3] = ($event) => emit("style", $event))
159850
159899
  }, {
159851
159900
  default: withCtx(() => [
159852
159901
  createVNode(ContentListRaw, mergeProps({
159853
- id: _ctx.id,
159902
+ id: unref(id),
159854
159903
  ref_key: "contentListRef",
159855
159904
  ref: contentListRef,
159856
159905
  class: ["pa-2", props.class],
@@ -159868,7 +159917,7 @@ const _sfc_main$1H = /* @__PURE__ */ defineComponent({
159868
159917
  _: 1
159869
159918
  }, 8, ["id", "active", "class", "edit", "exclude-stylables", "remove", "selected", "style"])) : (openBlock(), createBlock(ContentListRaw, mergeProps({
159870
159919
  key: 2,
159871
- id: _ctx.id,
159920
+ id: unref(id),
159872
159921
  data: _ctx.data
159873
159922
  }, unref(attrs), {
159874
159923
  "has-section-selector-app": !!sectionSelectorAppSrc.value,
@@ -162780,7 +162829,7 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
162780
162829
  );
162781
162830
  const areSectionsSystemControlled = computed(() => launchDarkly.value?.are_sections_system_controlled);
162782
162831
  const allowEditOrRemove = computed(
162783
- () => (selectedComponentType.value === ComponentTypes.Text || selectedComponentType.value === ComponentTypes.Carousel || selectedComponentType.value === ComponentTypes.Multimedia) && isAdmin.value && isSection.value
162832
+ () => isAdmin.value && ((selectedComponentType.value === ComponentTypes.Text || selectedComponentType.value === ComponentTypes.Carousel || selectedComponentType.value === ComponentTypes.Multimedia) && isSection.value || launchDarkly.value.enable_template_component_permissions && isCanvasTemplate.value)
162784
162833
  );
162785
162834
  const canSelectSectionListStrategy = computed(
162786
162835
  () => isAdmin.value && isCanvasTemplate.value && isSectionOrContentList.value
@@ -162842,7 +162891,8 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
162842
162891
  formValues.contentGridDataAccessor = value || "";
162843
162892
  }
162844
162893
  function getEditOrRemoveOption() {
162845
- const map = activeSettingsNode.value?.when_used_in_section ?? cloneDeep(defaultWhenUsedInSection);
162894
+ const defaultPermissions = isCanvasTemplate.value && launchDarkly.value.enable_template_component_permissions ? { is_editable: true, is_removable: true } : cloneDeep(defaultWhenUsedInSection);
162895
+ const map = activeSettingsNode.value?.when_used_in_section ?? defaultPermissions;
162846
162896
  let value = "";
162847
162897
  value += map.is_editable ? "1" : "0";
162848
162898
  value += map.is_removable ? "1" : "0";
@@ -163343,7 +163393,7 @@ const _sfc_main$1w = /* @__PURE__ */ defineComponent({
163343
163393
  }
163344
163394
  });
163345
163395
 
163346
- const ComponentDrawerSettings = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__scopeId", "data-v-dce6a881"]]);
163396
+ const ComponentDrawerSettings = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__scopeId", "data-v-1ab19780"]]);
163347
163397
 
163348
163398
  function useConnectUpload() {
163349
163399
  async function uploadToConnect(formData) {