@planningcenter/topbar 12.8.1 → 12.8.2-rc.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.
@@ -1924,6 +1924,44 @@ const AppsMenu = ({
1924
1924
  }))))))));
1925
1925
  };
1926
1926
 
1927
+ // Every app that renders topbar runs its own Sentry, which reports what
1928
+ // reaches `window.reportError`, so topbar's errors land in that app's project.
1929
+ // Whether they should go to a topbar-owned project instead is still open
1930
+ // (CHAT-1808); only this function would change.
1931
+ function reportTopbarError(error) {
1932
+ window.reportError(error);
1933
+ }
1934
+
1935
+ class ErrorBoundary extends React__default.Component {
1936
+ constructor() {
1937
+ super(...arguments);
1938
+ this.state = {
1939
+ hasError: false
1940
+ };
1941
+ }
1942
+ static getDerivedStateFromError() {
1943
+ return {
1944
+ hasError: true
1945
+ };
1946
+ }
1947
+ componentDidCatch(error) {
1948
+ reportTopbarError(error);
1949
+ }
1950
+ render() {
1951
+ var _a;
1952
+ return this.state.hasError ? (_a = this.props.fallback) !== null && _a !== void 0 ? _a : null : this.props.children;
1953
+ }
1954
+ }
1955
+ function withErrorBoundary(Component, fallback) {
1956
+ return function Guarded(props) {
1957
+ return /*#__PURE__*/React__default.createElement(ErrorBoundary, {
1958
+ fallback: fallback
1959
+ }, /*#__PURE__*/React__default.createElement(Component, {
1960
+ ...props
1961
+ }));
1962
+ };
1963
+ }
1964
+
1927
1965
  const FEATURE_FLAGS = {
1928
1966
  CHURCH_CENTER_PRODUCT: "ROLLOUT_church_center_product",
1929
1967
  PRODUCT_SEARCH: "product_search"
@@ -6197,6 +6235,13 @@ function StyledRoot({
6197
6235
  }
6198
6236
  `), children);
6199
6237
  }
6238
+ function TopbarPlaceholder() {
6239
+ return /*#__PURE__*/React__default.createElement("div", {
6240
+ style: {
6241
+ height: "var(--topbar-height)"
6242
+ }
6243
+ });
6244
+ }
6200
6245
 
6201
6246
  var styles$b = {"route":"route--8BWe","is-active":"is-active-FsU9Y","apps-routes-separator":"apps-routes-separator-Nlm-N"};
6202
6247
 
@@ -6466,7 +6511,7 @@ const UserMenuTrigger = ({
6466
6511
  }, orgName)), /*#__PURE__*/React__default.createElement(DisclosureChevronIcon, null)));
6467
6512
  };
6468
6513
 
6469
- const NotSmallTopbar = ({
6514
+ const UnguardedNotSmallTopbar = ({
6470
6515
  notifications = () => null,
6471
6516
  search = () => null,
6472
6517
  showOrgName = true,
@@ -6563,6 +6608,7 @@ const NotSmallRoute = ({
6563
6608
  ...nativeProps
6564
6609
  });
6565
6610
  };
6611
+ const NotSmallTopbar = withErrorBoundary(UnguardedNotSmallTopbar, /*#__PURE__*/React__default.createElement(TopbarPlaceholder, null));
6566
6612
 
6567
6613
  var styles$8 = {"avatar":"avatar-tW-wn"};
6568
6614
 
@@ -6756,7 +6802,7 @@ const AppsSwitcher = ({
6756
6802
 
6757
6803
  var styles$6 = {"current-route":"current-route-wpJgz","actions":"actions-INQ7-","is-active":"is-active-wy8Bg","routes":"routes-Nmt1S","route":"route-kkknQ","profile-button":"profile-button-a2WO2"};
6758
6804
 
6759
- const SmallTopbar = ({
6805
+ const UnguardedSmallTopbar = ({
6760
6806
  currentRouteComponent = props => (/*#__PURE__*/React__default.createElement("span", {
6761
6807
  ...props
6762
6808
  })),
@@ -6845,6 +6891,7 @@ const SmallRoute = ({
6845
6891
  className: classnames(styles$6["route"], className, active && styles$6["is-active"]),
6846
6892
  ...props
6847
6893
  }));
6894
+ const SmallTopbar = withErrorBoundary(UnguardedSmallTopbar, /*#__PURE__*/React__default.createElement(TopbarPlaceholder, null));
6848
6895
 
6849
6896
  function getLoginProfilePath({
6850
6897
  env,
@@ -10111,7 +10158,7 @@ const toolsRouteMap = Object.fromEntries(Object.entries(TOOLS_MAP).map(([k, v])
10111
10158
  function toolIsRoutable(tool) {
10112
10159
  return tool.name.toLowerCase() in toolsRouteMap;
10113
10160
  }
10114
- function Toolbar({
10161
+ function UnguardedToolbar({
10115
10162
  appName,
10116
10163
  autoMountTool,
10117
10164
  env,
@@ -10555,6 +10602,9 @@ function getDataPendoAttribute(toolName) {
10555
10602
  return `toolbar-${toolName.toLowerCase()}`;
10556
10603
  }
10557
10604
  }
10605
+ const Toolbar = withErrorBoundary(UnguardedToolbar, /*#__PURE__*/React__default.createElement("div", {
10606
+ className: styles$2["toolbar"]
10607
+ }));
10558
10608
 
10559
10609
  export { AccessibilityToolbar, AppsProvider, Bell as BellIcon, ConnectedPeopleProvider, DisplaySwitch, NotSmallRoute, NotSmallTopbar, PlatformAnnouncements, StyleProvider$1 as PlatformAnnouncementsStyleProvider, ProductAnnouncement, StyleProvider as ProductAnnouncementStyleProvider, SmallRoute, SmallTopbar, Spyglass as SpyglassIcon, StyledAnnouncement$1 as StyledPlatformAnnouncement, StyledAnnouncement as StyledProductAnnouncement, StyledDismissButton as StyledProductAnnouncementDimissButton, SwitchView, Toolbar, X as XIcon, mapApps, railsCsrfFetch };
10560
10610
  //# sourceMappingURL=topbar.module.js.map