@the-portland-company/shell 0.44.0 → 0.46.0

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.
@@ -358,6 +358,15 @@ function BellGlyph({ size = 20, className }) {
358
358
  /* @__PURE__ */ jsx("path", { d: "M13.73 21a2 2 0 0 1-3.46 0" })
359
359
  ] });
360
360
  }
361
+ function BellOffGlyph({ size = 14, className }) {
362
+ return /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", className, "aria-hidden": true, children: [
363
+ /* @__PURE__ */ jsx("path", { d: "M13.73 21a2 2 0 0 1-3.46 0" }),
364
+ /* @__PURE__ */ jsx("path", { d: "M18.63 13A17.9 17.9 0 0 1 18 8" }),
365
+ /* @__PURE__ */ jsx("path", { d: "M6.26 6.26A5.86 5.86 0 0 0 6 8c0 7-3 9-3 9h14" }),
366
+ /* @__PURE__ */ jsx("path", { d: "M18 8a6 6 0 0 0-9.33-5" }),
367
+ /* @__PURE__ */ jsx("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
368
+ ] });
369
+ }
361
370
  function LifeBuoyGlyph({ size = 20, className }) {
362
371
  return /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", className, "aria-hidden": true, children: [
363
372
  /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
@@ -603,6 +612,23 @@ function writeNotifState(orgId, state) {
603
612
  }
604
613
  }
605
614
  var TEN_DLC_REDIRECTED_KEY = "politogy_10dlc_redirected";
615
+ var TOASTS_MUTED_KEY = "politogy_chrome_toasts_muted";
616
+ function readToastsMuted() {
617
+ if (typeof window === "undefined") return false;
618
+ try {
619
+ return window.sessionStorage.getItem(TOASTS_MUTED_KEY) === "1";
620
+ } catch {
621
+ return false;
622
+ }
623
+ }
624
+ function writeToastsMuted(muted) {
625
+ if (typeof window === "undefined") return;
626
+ try {
627
+ if (muted) window.sessionStorage.setItem(TOASTS_MUTED_KEY, "1");
628
+ else window.sessionStorage.removeItem(TOASTS_MUTED_KEY);
629
+ } catch {
630
+ }
631
+ }
606
632
  function formatPhone(raw) {
607
633
  const digits = raw.replace(/\D/g, "");
608
634
  const ten = digits.length === 11 && digits.startsWith("1") ? digits.slice(1) : digits;
@@ -632,6 +658,7 @@ function NewReplyToast({
632
658
  reply,
633
659
  onActivate,
634
660
  onClose,
661
+ onSilence,
635
662
  ttlMs = 12e3
636
663
  }) {
637
664
  const [visible, setVisible] = useState(false);
@@ -678,8 +705,38 @@ function NewReplyToast({
678
705
  className: "absolute right-[18px] top-[-7px] h-0 w-0 border-x-[8px] border-x-transparent border-b-[8px] border-b-[#161616]"
679
706
  }
680
707
  ),
681
- /* @__PURE__ */ jsx("p", { className: "truncate text-sm font-semibold", children: reply.name }),
682
- /* @__PURE__ */ jsx("p", { className: "mt-1 truncate text-xs opacity-85", children: reply.preview })
708
+ /* @__PURE__ */ jsx(
709
+ "button",
710
+ {
711
+ type: "button",
712
+ "aria-label": "Dismiss notification",
713
+ onClick: (e) => {
714
+ e.stopPropagation();
715
+ setVisible(false);
716
+ onClose();
717
+ },
718
+ className: "absolute right-2 top-2 flex h-5 w-5 items-center justify-center rounded-full text-white opacity-60 transition hover:bg-white/10 hover:opacity-100",
719
+ children: /* @__PURE__ */ jsx(XGlyph, { size: 12 })
720
+ }
721
+ ),
722
+ /* @__PURE__ */ jsx("p", { className: "truncate pr-6 text-sm font-semibold", children: reply.name }),
723
+ /* @__PURE__ */ jsx("p", { className: "mt-1 truncate text-xs opacity-85", children: reply.preview }),
724
+ /* @__PURE__ */ jsxs(
725
+ "button",
726
+ {
727
+ type: "button",
728
+ onClick: (e) => {
729
+ e.stopPropagation();
730
+ setVisible(false);
731
+ onSilence();
732
+ },
733
+ className: "mt-2 inline-flex items-center gap-1 text-[11px] font-semibold text-white opacity-60 transition hover:opacity-100",
734
+ children: [
735
+ /* @__PURE__ */ jsx(BellOffGlyph, { size: 12 }),
736
+ "Silence notifications"
737
+ ]
738
+ }
739
+ )
683
740
  ]
684
741
  }
685
742
  );
@@ -691,6 +748,7 @@ function NotificationsAction({ orgId }) {
691
748
  const [error, setError] = useState(false);
692
749
  const [notif, setNotif] = useState(() => readNotifState(orgId));
693
750
  const [toastReply, setToastReply] = useState(null);
751
+ const [toastsMuted, setToastsMuted] = useState(() => readToastsMuted());
694
752
  const [openToken, setOpenToken] = useState(0);
695
753
  const [panelOpen, setPanelOpen] = useState(false);
696
754
  const anyPanelOpen = useAnyTopBarPanelOpen();
@@ -773,6 +831,7 @@ function NotificationsAction({ orgId }) {
773
831
  const imports = payload?.imports ?? [];
774
832
  const quarantined = payload?.quarantined ?? [];
775
833
  useEffect(() => {
834
+ if (toastsMuted) return;
776
835
  if (!payload || toastReply || panelOpen) return;
777
836
  const candidate = replies.filter((r) => {
778
837
  if (!r.createdAt) return false;
@@ -789,7 +848,24 @@ function NotificationsAction({ orgId }) {
789
848
  writeNotifState(orgId, next);
790
849
  return next;
791
850
  });
792
- }, [payload, replies, toastReply, panelOpen, notif.lastSeenAt, notif.toastedReplyIds, orgId]);
851
+ }, [
852
+ payload,
853
+ replies,
854
+ toastReply,
855
+ panelOpen,
856
+ toastsMuted,
857
+ notif.lastSeenAt,
858
+ notif.toastedReplyIds,
859
+ orgId
860
+ ]);
861
+ const setMuted = useCallback((muted) => {
862
+ writeToastsMuted(muted);
863
+ setToastsMuted(muted);
864
+ }, []);
865
+ const onToastSilence = useCallback(() => {
866
+ setMuted(true);
867
+ setToastReply(null);
868
+ }, [setMuted]);
793
869
  const onToastActivate = useCallback(() => {
794
870
  const href = toastReply?.href;
795
871
  setToastReply(null);
@@ -823,7 +899,18 @@ function NotificationsAction({ orgId }) {
823
899
  openToken,
824
900
  onOpenChange: setPanelOpen,
825
901
  children: /* @__PURE__ */ jsxs("div", { className: "px-4 py-3", children: [
826
- /* @__PURE__ */ jsx("p", { className: "mb-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-[color:var(--muted)]", children: "Notifications" }),
902
+ /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
903
+ /* @__PURE__ */ jsx("p", { className: "text-[11px] font-semibold uppercase tracking-[0.08em] text-[color:var(--muted)]", children: "Notifications" }),
904
+ toastsMuted ? /* @__PURE__ */ jsx(
905
+ "button",
906
+ {
907
+ type: "button",
908
+ onClick: () => setMuted(false),
909
+ className: "text-[11px] font-semibold text-[color:var(--color-race-red)] hover:underline",
910
+ children: "Unsilence"
911
+ }
912
+ ) : null
913
+ ] }),
827
914
  loading ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 py-1", children: [
828
915
  /* @__PURE__ */ jsx(ValueSkeleton, { className: "h-4 w-full" }),
829
916
  /* @__PURE__ */ jsx(ValueSkeleton, { className: "h-4 w-3/4" })
@@ -856,10 +943,21 @@ function NotificationsAction({ orgId }) {
856
943
  )
857
944
  ] }) }, a.id);
858
945
  }),
859
- replies.map((r) => /* @__PURE__ */ jsxs("li", { className: "rounded-lg px-2 py-2 hover:bg-[color:var(--panel)]", children: [
860
- /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-[color:var(--foreground)]", children: r.name }),
861
- /* @__PURE__ */ jsx("p", { className: "truncate text-xs text-[color:var(--muted)]", children: r.preview })
862
- ] }, r.id))
946
+ replies.map((r) => {
947
+ const body = /* @__PURE__ */ jsxs(Fragment, { children: [
948
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-[color:var(--foreground)]", children: r.name }),
949
+ /* @__PURE__ */ jsx("p", { className: "truncate text-xs text-[color:var(--muted)]", children: r.preview })
950
+ ] });
951
+ return /* @__PURE__ */ jsx("li", { children: r.href ? /* @__PURE__ */ jsx(
952
+ "a",
953
+ {
954
+ href: r.href,
955
+ "aria-label": `Open the conversation with ${r.name}`,
956
+ className: "block rounded-lg px-2 py-2 transition hover:bg-[color:var(--panel)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--color-race-red)]",
957
+ children: body
958
+ }
959
+ ) : /* @__PURE__ */ jsx("div", { className: "rounded-lg px-2 py-2", children: body }) }, r.id);
960
+ })
863
961
  ] }) : null,
864
962
  imports.length > 0 ? /* @__PURE__ */ jsxs("div", { children: [
865
963
  /* @__PURE__ */ jsx("p", { className: "mb-1 px-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-[color:var(--muted)]", children: "Imports" }),
@@ -902,7 +1000,8 @@ function NotificationsAction({ orgId }) {
902
1000
  {
903
1001
  reply: toastReply,
904
1002
  onActivate: onToastActivate,
905
- onClose: () => setToastReply(null)
1003
+ onClose: () => setToastReply(null),
1004
+ onSilence: onToastSilence
906
1005
  }
907
1006
  ) : null
908
1007
  ] })
@@ -2595,5 +2694,5 @@ function NavAppShell({
2595
2694
  }
2596
2695
 
2597
2696
  export { BETA_BANNER_DISMISS_KEY, CAMPAIGN_FEATURE_AVAILABILITY, CORE_APP_ORIGIN, CORE_BILLING_PATH, FuelAction, NavAppShell, NavBetaBanner, NavChromeProvider, NavDisplayAction, NavSidebar, NavTabStrip, NavThemeControl, NavTopBar, NotificationsAction, SupportAction, TopBarCountBadge, TopBarPanelArrow, TopBarPopover, TopBarTooltip, TopBarWidgetSlot, clearBetaBannerDismissal, envChipClasses, isNavItemActive, resolveOrgLogoUrl, standardPolitogyNav, topBarIconButtonClass, useChromeMe, useChromeOrgs, useNavChromeFetcher, useThemePreference };
2598
- //# sourceMappingURL=chunk-HCQXBR2R.js.map
2599
- //# sourceMappingURL=chunk-HCQXBR2R.js.map
2697
+ //# sourceMappingURL=chunk-I7DXEAWO.js.map
2698
+ //# sourceMappingURL=chunk-I7DXEAWO.js.map