@the-portland-company/shell 0.36.2 → 0.37.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.
package/dist/native.cjs CHANGED
@@ -150,6 +150,12 @@ var CORE_APP_ORIGIN = "https://app.politogyvrm.com";
150
150
  var CORE_BILLING_PATH = "/organization-settings/subscription-billing/text-email";
151
151
  var CORE_BILLING_URL = `${CORE_APP_ORIGIN}${CORE_BILLING_PATH}`;
152
152
  var QUARANTINED_CONTACTS_URL = `${CORE_APP_ORIGIN}/relationship/contacts/quarantined`;
153
+ function resolveOrgLogoUrl(url) {
154
+ const raw = url?.trim();
155
+ if (!raw) return void 0;
156
+ if (/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(raw)) return raw;
157
+ return `${CORE_APP_ORIGIN}${raw.startsWith("/") ? "" : "/"}${raw}`;
158
+ }
153
159
  function topBarIconButtonClass(tone = "default") {
154
160
  const toneClass = tone === "danger" || tone === "warning" ? "text-[color:var(--color-race-red)] hover:text-[color:var(--color-race-red)]" : "text-[color:var(--topbar-icon-color,var(--muted))] hover:text-[color:var(--topbar-icon-hover-color,var(--foreground))] hover:bg-[color:var(--topbar-icon-hover-bg,transparent)]";
155
161
  return [
@@ -1588,6 +1594,7 @@ function NavSidebar({
1588
1594
  const activeFn = nav.isActive ?? isNavItemActive;
1589
1595
  const ModeIcon = mode?.icon;
1590
1596
  const orgBg = org?.brandColor || ORG_PILL_DEFAULT;
1597
+ const orgLogoSrc = resolveOrgLogoUrl(org?.logoUrl);
1591
1598
  const activeGroupKey = react.useMemo(() => {
1592
1599
  for (let i = 0; i < nav.items.length; i++) {
1593
1600
  const item = nav.items[i];
@@ -1655,7 +1662,7 @@ function NavSidebar({
1655
1662
  {
1656
1663
  style: { backgroundColor: orgBg },
1657
1664
  className: "flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-full text-[11px] font-bold text-white",
1658
- children: org.logoUrl ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: org.logoUrl, alt: "", className: "h-full w-full object-cover" }) : (org.name ?? "Org").slice(0, 2).toUpperCase()
1665
+ children: orgLogoSrc ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: orgLogoSrc, alt: "", className: "h-full w-full object-cover" }) : (org.name ?? "Org").slice(0, 2).toUpperCase()
1659
1666
  }
1660
1667
  ),
1661
1668
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1690,7 +1697,14 @@ function NavSidebar({
1690
1697
  {
1691
1698
  style: { backgroundColor: o.brandColor || ORG_PILL_DEFAULT },
1692
1699
  className: "flex h-6 w-6 shrink-0 items-center justify-center overflow-hidden rounded-full text-[10px] font-bold text-white",
1693
- children: o.logoUrl ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: o.logoUrl, alt: "", className: "h-full w-full object-cover" }) : (o.name ?? "Org").slice(0, 2).toUpperCase()
1700
+ children: resolveOrgLogoUrl(o.logoUrl) ? /* @__PURE__ */ jsxRuntime.jsx(
1701
+ "img",
1702
+ {
1703
+ src: resolveOrgLogoUrl(o.logoUrl),
1704
+ alt: "",
1705
+ className: "h-full w-full object-cover"
1706
+ }
1707
+ ) : (o.name ?? "Org").slice(0, 2).toUpperCase()
1694
1708
  }
1695
1709
  ),
1696
1710
  /* @__PURE__ */ jsxRuntime.jsx("span", { title: o.name ?? o.id, className: "truncate", children: o.name ?? o.id.slice(0, 8) })
@@ -1712,7 +1726,7 @@ function NavSidebar({
1712
1726
  {
1713
1727
  style: { backgroundColor: orgBg },
1714
1728
  className: "flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-full text-[11px] font-bold text-white",
1715
- children: org.logoUrl ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: org.logoUrl, alt: "", className: "h-full w-full object-cover" }) : (org.name ?? "Org").slice(0, 2).toUpperCase()
1729
+ children: orgLogoSrc ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: orgLogoSrc, alt: "", className: "h-full w-full object-cover" }) : (org.name ?? "Org").slice(0, 2).toUpperCase()
1716
1730
  }
1717
1731
  ),
1718
1732
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm font-semibold", children: org.name ?? "No organizations" })
@@ -2607,6 +2621,7 @@ exports.TopBarTooltip = TopBarTooltip;
2607
2621
  exports.TopBarWidgetSlot = TopBarWidgetSlot;
2608
2622
  exports.envChipClasses = envChipClasses;
2609
2623
  exports.isNavItemActive = isNavItemActive;
2624
+ exports.resolveOrgLogoUrl = resolveOrgLogoUrl;
2610
2625
  exports.standardPolitogyNav = standardPolitogyNav;
2611
2626
  exports.topBarIconButtonClass = topBarIconButtonClass;
2612
2627
  exports.useChromeMe = useChromeMe;