@planningcenter/topbar 12.8.1 → 12.8.2

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.
@@ -1931,6 +1931,44 @@
1931
1931
  }))))))));
1932
1932
  };
1933
1933
 
1934
+ // Every app that renders topbar runs its own Sentry, which reports what
1935
+ // reaches `window.reportError`, so topbar's errors land in that app's project.
1936
+ // Whether they should go to a topbar-owned project instead is still open
1937
+ // (CHAT-1808); only this function would change.
1938
+ function reportTopbarError(error) {
1939
+ window.reportError(error);
1940
+ }
1941
+
1942
+ class ErrorBoundary extends React.Component {
1943
+ constructor() {
1944
+ super(...arguments);
1945
+ this.state = {
1946
+ hasError: false
1947
+ };
1948
+ }
1949
+ static getDerivedStateFromError() {
1950
+ return {
1951
+ hasError: true
1952
+ };
1953
+ }
1954
+ componentDidCatch(error) {
1955
+ reportTopbarError(error);
1956
+ }
1957
+ render() {
1958
+ var _a;
1959
+ return this.state.hasError ? (_a = this.props.fallback) !== null && _a !== void 0 ? _a : null : this.props.children;
1960
+ }
1961
+ }
1962
+ function withErrorBoundary(Component, fallback) {
1963
+ return function Guarded(props) {
1964
+ return /*#__PURE__*/React.createElement(ErrorBoundary, {
1965
+ fallback: fallback
1966
+ }, /*#__PURE__*/React.createElement(Component, {
1967
+ ...props
1968
+ }));
1969
+ };
1970
+ }
1971
+
1934
1972
  const FEATURE_FLAGS = {
1935
1973
  CHURCH_CENTER_PRODUCT: "ROLLOUT_church_center_product",
1936
1974
  PRODUCT_SEARCH: "product_search"
@@ -6204,6 +6242,13 @@ true;
6204
6242
  }
6205
6243
  `), children);
6206
6244
  }
6245
+ function TopbarPlaceholder() {
6246
+ return /*#__PURE__*/React.createElement("div", {
6247
+ style: {
6248
+ height: "var(--topbar-height)"
6249
+ }
6250
+ });
6251
+ }
6207
6252
 
6208
6253
  var styles$b = {"route":"route--8BWe","is-active":"is-active-FsU9Y","apps-routes-separator":"apps-routes-separator-Nlm-N"};
6209
6254
 
@@ -6473,7 +6518,7 @@ true;
6473
6518
  }, orgName)), /*#__PURE__*/React.createElement(DisclosureChevronIcon, null)));
6474
6519
  };
6475
6520
 
6476
- const NotSmallTopbar = ({
6521
+ const UnguardedNotSmallTopbar = ({
6477
6522
  notifications = () => null,
6478
6523
  search = () => null,
6479
6524
  showOrgName = true,
@@ -6570,6 +6615,7 @@ true;
6570
6615
  ...nativeProps
6571
6616
  });
6572
6617
  };
6618
+ const NotSmallTopbar = withErrorBoundary(UnguardedNotSmallTopbar, /*#__PURE__*/React.createElement(TopbarPlaceholder, null));
6573
6619
 
6574
6620
  var styles$8 = {"avatar":"avatar-tW-wn"};
6575
6621
 
@@ -6763,7 +6809,7 @@ true;
6763
6809
 
6764
6810
  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"};
6765
6811
 
6766
- const SmallTopbar = ({
6812
+ const UnguardedSmallTopbar = ({
6767
6813
  currentRouteComponent = props => (/*#__PURE__*/React.createElement("span", {
6768
6814
  ...props
6769
6815
  })),
@@ -6852,6 +6898,7 @@ true;
6852
6898
  className: classnames(styles$6["route"], className, active && styles$6["is-active"]),
6853
6899
  ...props
6854
6900
  }));
6901
+ const SmallTopbar = withErrorBoundary(UnguardedSmallTopbar, /*#__PURE__*/React.createElement(TopbarPlaceholder, null));
6855
6902
 
6856
6903
  function getLoginProfilePath({
6857
6904
  env,
@@ -10118,7 +10165,7 @@ true;
10118
10165
  function toolIsRoutable(tool) {
10119
10166
  return tool.name.toLowerCase() in toolsRouteMap;
10120
10167
  }
10121
- function Toolbar({
10168
+ function UnguardedToolbar({
10122
10169
  appName,
10123
10170
  autoMountTool,
10124
10171
  env,
@@ -10562,6 +10609,9 @@ true;
10562
10609
  return `toolbar-${toolName.toLowerCase()}`;
10563
10610
  }
10564
10611
  }
10612
+ const Toolbar = withErrorBoundary(UnguardedToolbar, /*#__PURE__*/React.createElement("div", {
10613
+ className: styles$2["toolbar"]
10614
+ }));
10565
10615
 
10566
10616
  exports.AccessibilityToolbar = AccessibilityToolbar;
10567
10617
  exports.AppsProvider = AppsProvider;