@embedreach/components 0.2.50 → 0.2.51

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.
@@ -10004,7 +10004,7 @@ const CalendarPlus2 = createLucideIcon("CalendarPlus2", [
10004
10004
  * This source code is licensed under the ISC license.
10005
10005
  * See the LICENSE file in the root directory of this source tree.
10006
10006
  */
10007
- const Calendar$1 = createLucideIcon("Calendar", [
10007
+ const Calendar = createLucideIcon("Calendar", [
10008
10008
  ["path", { d: "M8 2v4", key: "1cmpym" }],
10009
10009
  ["path", { d: "M16 2v4", key: "4m81vk" }],
10010
10010
  ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
@@ -46978,7 +46978,7 @@ const IconDefinitions = {
46978
46978
  UserIcon: User,
46979
46979
  UsersIcon: Users,
46980
46980
  UserEdit: UserPen,
46981
- ScheduleButton: Calendar$1,
46981
+ ScheduleButton: Calendar,
46982
46982
  SendButton: Send,
46983
46983
  BackButton: ChevronLeft,
46984
46984
  NextButton: ChevronRight,
@@ -46996,7 +46996,7 @@ const IconDefinitions = {
46996
46996
  */
46997
46997
  OneTimeBroadcast: Radio,
46998
46998
  PatronEntersList: List$1,
46999
- DateMilestone: Calendar$1,
46999
+ DateMilestone: Calendar,
47000
47000
  RealtimeActivity: CalendarPlus2,
47001
47001
  DuplicateIcon: Copy,
47002
47002
  /**
@@ -77620,7 +77620,7 @@ function RootProvider(props2) {
77620
77620
  function DayPicker(props2) {
77621
77621
  return jsx(RootProvider, __assign({}, props2, { children: jsx(Root$3, { initialProps: props2 }) }));
77622
77622
  }
77623
- function Calendar({
77623
+ function ReactCalendar({
77624
77624
  className: className2,
77625
77625
  classNames,
77626
77626
  showOutsideDays = true,
@@ -77657,7 +77657,6 @@ function Calendar({
77657
77657
  day_hidden: "invisible",
77658
77658
  ...classNames
77659
77659
  };
77660
- console.log(finalClassNames);
77661
77660
  return /* @__PURE__ */ jsx(
77662
77661
  DayPicker,
77663
77662
  {
@@ -77672,7 +77671,7 @@ function Calendar({
77672
77671
  }
77673
77672
  );
77674
77673
  }
77675
- Calendar.displayName = "Calendar";
77674
+ ReactCalendar.displayName = "Calendar";
77676
77675
  const ComboboxDemo = ({
77677
77676
  data,
77678
77677
  placeholder,
@@ -77798,13 +77797,13 @@ const SetScheduleTime = ({ setScheduleTime, setTimezone, timezone, scheduleTime,
77798
77797
  !scheduleTime && "text-muted-foreground"
77799
77798
  ),
77800
77799
  children: [
77801
- /* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
77800
+ /* @__PURE__ */ jsx(Calendar, { className: "mr-2 h-4 w-4" }),
77802
77801
  scheduleTime ? scheduleTime === "now" ? "Send immediately" : format$1(new Date(scheduleTime), "PPP") : /* @__PURE__ */ jsx("span", { children: "Pick a date" })
77803
77802
  ]
77804
77803
  }
77805
77804
  ) }),
77806
77805
  /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0 z-[60] pointer-events-auto", children: /* @__PURE__ */ jsx(
77807
- Calendar,
77806
+ ReactCalendar,
77808
77807
  {
77809
77808
  mode: "single",
77810
77809
  selected: scheduleTime ? new Date(scheduleTime) : void 0,
@@ -79452,7 +79451,8 @@ function MultiSelectDialog({
79452
79451
  searchPlaceholder = "Search items...",
79453
79452
  emptyMessage = "No items found",
79454
79453
  handleSearchInput,
79455
- extraCommandItems = []
79454
+ extraCommandItems = [],
79455
+ canOpen = true
79456
79456
  }) {
79457
79457
  const [open, setOpen] = React.useState(false);
79458
79458
  const [searchQuery, setSearchQuery] = React.useState("");
@@ -79525,7 +79525,7 @@ function MultiSelectDialog({
79525
79525
  ).length;
79526
79526
  const selectedDisplay = getSelectedOptionsDisplay();
79527
79527
  const canSelectMore = !maxCount || tempSelected.length < maxCount;
79528
- return /* @__PURE__ */ jsxs(Dialog, { open, onOpenChange: setOpen, children: [
79528
+ return /* @__PURE__ */ jsxs(Dialog, { open: open && canOpen, onOpenChange: setOpen, children: [
79529
79529
  /* @__PURE__ */ jsx(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
79530
79530
  Button$1,
79531
79531
  {
@@ -79865,13 +79865,13 @@ const DateSegmentSelector = ({
79865
79865
  !date2 && "text-muted-foreground"
79866
79866
  ),
79867
79867
  children: [
79868
- /* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
79868
+ /* @__PURE__ */ jsx(Calendar, { className: "mr-2 h-4 w-4" }),
79869
79869
  date2 ? format$1(date2, monthDayOnly ? "MMMM d" : "PPP") : /* @__PURE__ */ jsx("span", { children: placeholder })
79870
79870
  ]
79871
79871
  }
79872
79872
  ) }),
79873
79873
  /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx(
79874
- Calendar,
79874
+ ReactCalendar,
79875
79875
  {
79876
79876
  mode: "single",
79877
79877
  selected: date2,
@@ -81384,9 +81384,10 @@ const RecipientsTable = ({ recipients }) => {
81384
81384
  ] }, index2)) })
81385
81385
  ] }) }) });
81386
81386
  };
81387
- const AllOrSelectSegmentPicker = ({ onSelectionChange, defaultValue = "all" }) => {
81387
+ const AllOrSelectSegmentPicker = ({ onSelectionChange, defaultValue = "all", canEditAudience = true }) => {
81388
81388
  const [selected, setSelected] = useState(defaultValue);
81389
81389
  const handleSelect = (value) => {
81390
+ if (!canEditAudience) return;
81390
81391
  setSelected(value);
81391
81392
  onSelectionChange?.(value);
81392
81393
  };
@@ -81421,7 +81422,8 @@ const SegmentSection = ({
81421
81422
  allSegments,
81422
81423
  onAddSegment,
81423
81424
  onRemoveSegment,
81424
- setOpenCreateSegmentDialog
81425
+ setOpenCreateSegmentDialog,
81426
+ canEditAudience = true
81425
81427
  }) => {
81426
81428
  const handleValueChange = (newValues) => {
81427
81429
  const segmentsToAdd = newValues.filter((id2) => !segments.includes(id2));
@@ -81440,6 +81442,7 @@ const SegmentSection = ({
81440
81442
  return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
81441
81443
  MultiSelectDialog,
81442
81444
  {
81445
+ canAddValues: canEditAudience,
81443
81446
  selectedValues: segmentSelectedIds,
81444
81447
  setSelectedValues: setSegmentSelectedIds,
81445
81448
  options,
@@ -81473,7 +81476,8 @@ const SelectSegmentsContent = ({
81473
81476
  handleRemoveSegment,
81474
81477
  setOpenCreateSegmentDialog,
81475
81478
  segments,
81476
- defaultIsExcludeOpen = false
81479
+ defaultIsExcludeOpen = false,
81480
+ canEditAudience = true
81477
81481
  }) => {
81478
81482
  const [isExcludeOpen, setIsExcludeOpen] = useState(defaultIsExcludeOpen);
81479
81483
  return /* @__PURE__ */ jsxs("div", { children: [
@@ -81492,7 +81496,10 @@ const SelectSegmentsContent = ({
81492
81496
  /* @__PURE__ */ jsxs(
81493
81497
  Button$1,
81494
81498
  {
81495
- onClick: () => setIsExcludeOpen(!isExcludeOpen),
81499
+ onClick: () => {
81500
+ if (!canEditAudience) return;
81501
+ setIsExcludeOpen(!isExcludeOpen);
81502
+ },
81496
81503
  className: "flex items-center gap-1 transition-colors",
81497
81504
  size: "sm",
81498
81505
  children: [
@@ -81518,6 +81525,7 @@ const SelectSegmentsContent = ({
81518
81525
  children: /* @__PURE__ */ jsx(
81519
81526
  SegmentSection,
81520
81527
  {
81528
+ canEditAudience,
81521
81529
  segments: excludedSegments,
81522
81530
  allSegments: segments || [],
81523
81531
  onAddSegment: (id2) => handleAddSegment(id2, "exclude"),
@@ -81626,6 +81634,7 @@ const AutomationAudienceSelectorMain = ({ title: title2 = "Preview Audience" })
81626
81634
  setIncludedSegments((prev) => [...prev, id2]);
81627
81635
  }
81628
81636
  };
81637
+ const canEditAudience = automation2?.status !== AutomationStatus.DRAFT;
81629
81638
  return /* @__PURE__ */ jsxs(MainPageWrapper, { title: title2, children: [
81630
81639
  isLoading || !segments || !initialStateSet ? /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(BasicLoader, { text: ["Fetching segments", "Finishing up"] }) }) : /* @__PURE__ */ jsxs("div", { className: "flex gap-8 w-full pb-4 px-4", children: [
81631
81640
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col flex-1 relative overflow-y-auto pb-4 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]", children: [
@@ -81634,7 +81643,8 @@ const AutomationAudienceSelectorMain = ({ title: title2 = "Preview Audience" })
81634
81643
  AllOrSelectSegmentPicker,
81635
81644
  {
81636
81645
  onSelectionChange: handleAudienceSelectionChange,
81637
- defaultValue: selectedAudience
81646
+ defaultValue: selectedAudience,
81647
+ canEditAudience
81638
81648
  }
81639
81649
  ),
81640
81650
  /* @__PURE__ */ jsx(AnimatePresence, { children: selectedAudience === "segments" && /* @__PURE__ */ jsx(
@@ -81648,6 +81658,7 @@ const AutomationAudienceSelectorMain = ({ title: title2 = "Preview Audience" })
81648
81658
  children: /* @__PURE__ */ jsx(
81649
81659
  SelectSegmentsContent,
81650
81660
  {
81661
+ canEditAudience,
81651
81662
  includedSegments,
81652
81663
  excludedSegments,
81653
81664
  handleAddSegment,