@planningcenter/topbar 8.1.1 → 8.2.0-rc.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +10 -4
  2. package/README.md +18 -4
  3. package/dist/modules/api_request.d.ts +5 -0
  4. package/dist/modules/apps_provider.d.ts +1 -1
  5. package/dist/modules/client_storage.d.ts +1 -1
  6. package/dist/modules/color_app_squircles.d.ts +0 -1
  7. package/dist/modules/components/apps_menu.d.ts +6 -2
  8. package/dist/modules/components/notification_item.d.ts +1 -5
  9. package/dist/modules/components/notifications_menu.d.ts +3 -9
  10. package/dist/modules/connected_people_provider.d.ts +1 -1
  11. package/dist/modules/display_switch.d.ts +1 -1
  12. package/dist/modules/dummy_data.d.ts +3 -3
  13. package/dist/modules/formatters.d.ts +13 -1
  14. package/dist/modules/mono_app_symbols.d.ts +0 -4
  15. package/dist/modules/mono_app_text.d.ts +0 -5
  16. package/dist/modules/not_small_topbar.d.ts +15 -35
  17. package/dist/modules/symbols.d.ts +15 -8
  18. package/dist/topbar.js +1 -1
  19. package/dist/topbar.js.map +1 -1
  20. package/dist/topbar.modern.js +1 -1
  21. package/dist/topbar.modern.js.map +1 -1
  22. package/dist/topbar.module.js +1 -1
  23. package/dist/topbar.module.js.map +1 -1
  24. package/dist/topbar.umd.js +1 -1
  25. package/dist/topbar.umd.js.map +1 -1
  26. package/dist/types/modules/components/notifications_menu.d.ts.map +1 -1
  27. package/dist/types/modules/hooks/use_notifications.d.ts +2 -1
  28. package/dist/types/modules/hooks/use_notifications.d.ts.map +1 -1
  29. package/dist/types/modules/not_small_topbar.d.ts.map +1 -1
  30. package/dist/types/modules/small_topbar.d.ts.map +1 -1
  31. package/package.json +7 -2
  32. package/CHANGELOG-pre-4.9.0.md +0 -134
  33. package/dist/modules/colors.d.ts +0 -46
  34. package/dist/modules/components/NotificationsMenuBlankState.d.ts +0 -12
  35. package/dist/modules/components/conditional_wrap.d.ts +0 -7
  36. package/dist/modules/components/notifications_inbox.d.ts +0 -18
  37. package/dist/modules/components/notifications_menu_Wrapper.d.ts +0 -7
  38. package/dist/modules/components/notifications_menu_blank_state.d.ts +0 -8
  39. package/dist/modules/components/popover_root.d.ts +0 -6
  40. package/dist/modules/components/spinner.d.ts +0 -4
  41. package/dist/modules/hooks/use_hover.d.ts +0 -3
  42. package/dist/modules/hooks/use_local_storage.d.ts +0 -10
  43. package/dist/modules/hooks/use_notifications.d.ts +0 -16
  44. package/dist/modules/hooks/use_topbar_api.d.ts +0 -8
  45. package/dist/modules/topbar_context.d.ts +0 -5
  46. package/dist/topbar +0 -2
  47. package/dist/topbar.map +0 -1
  48. package/dist/topbar.modern.css +0 -2
  49. package/dist/topbar.modern.css.map +0 -1
  50. package/dist/topbar.module.css +0 -2
  51. package/dist/topbar.module.css.map +0 -1
  52. package/dist/types/modules/interfaces.d.ts +0 -55
  53. package/dist/types/modules/interfaces.d.ts.map +0 -1
  54. package/dist/types/modules/medium_topbar.d.ts +0 -39
  55. package/dist/types/modules/medium_topbar.d.ts.map +0 -1
  56. package/dist/types/modules/profile_container.d.ts +0 -10
  57. package/dist/types/modules/profile_container.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -5,13 +5,19 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [8.1.1] - 2021-04-11
8
+ ## [8.2.0-rc.2] - 2022-05-18
9
+
10
+ ### Fixed
11
+
12
+ - fix: hook into `pco-page-expired` to `disconnect` jolt instance when session is changed
13
+
14
+ ## [8.1.1] - 2022-04-11
9
15
 
10
16
  ### Changed
11
17
 
12
18
  - fix: don't send a `timeZone` key to `@churchcenter/datetime-fmt` if it doesn't have a value
13
19
 
14
- ## [8.1.0] - 2021-04-11
20
+ ## [8.1.0] - 2022-04-11
15
21
 
16
22
  ### Changed
17
23
 
@@ -22,14 +28,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
22
28
  - Fix dark mode text styles in notifications inbox
23
29
  - Fix notification date timezone not displaying in the org's time zone
24
30
 
25
- ## [8.0.1] - 2021-03-29
31
+ ## [8.0.1] - 2022-03-29
26
32
 
27
33
  ### Changed
28
34
 
29
35
  - Correct the capitalization of "Check-Ins" in order to set the correct color for notifications
30
36
  - Bring back the `notifications` prop for topbars so that if notifications are not enabled, it will render the `notifications` prop instead
31
37
 
32
- ## [8.0.0] - 2021-03-24
38
+ ## [8.0.0] - 2022-03-24
33
39
 
34
40
  ### Added
35
41
 
package/README.md CHANGED
@@ -34,6 +34,9 @@ If a Jolt connection is not shared with topbar, it will gladly initiate its own
34
34
  To reuse your app's Jolt connection, topbar requires a Promise that resolves into a [Jolt client](https://github.com/ministrycentered/jolt-client/) connection.
35
35
  If nothing is passed—or if a Promise is passed that resolves to `undefined` or `void`—topbar will initiate its own connection.
36
36
 
37
+ Topbar hooks into `pco-page-expired` and will `disconnect` either its internal, or passed in jolt instance when the session is invalidated (i.e. logged out in a different tab).
38
+ CSRF tokens are invalidated when the session is invalidated, and non-GET APIv2 requests (i.e. auth/subscribe) require a valid CSRF token and will never succeed in that state.
39
+
37
40
  #### Example
38
41
 
39
42
  As an example, we'll use what Services has done for the v7.3 alpha.
@@ -52,14 +55,12 @@ As a layout partial, they attach two Jolt-related things to `window`:
52
55
  In their Topbar implementation component, they then create the function that provides topbar the required Promise...
53
56
 
54
57
  ```jsx
55
- const waitForWindowJolt = async () => {
56
- const listener = Promise.resolve(window.joltListenerPromise)
57
- return listener.then((listener) => {
58
+ const waitForWindowJolt = async () =>
59
+ window.joltListenerPromise.then(listener => {
58
60
  if (listener && listener.jolt) {
59
61
  return listener.jolt
60
62
  }
61
63
  })
62
- }
63
64
  ```
64
65
 
65
66
  ...and passes that function in for the `JoltPromise` prop to topbar.
@@ -98,6 +99,19 @@ When you make `topbar` changes, run `yalc publish --push` to update your product
98
99
 
99
100
  When you're done, in your product directory run `yalc remove @planningcenter/topbar`.
100
101
 
102
+ If you are not seeing published updates after running `yalc publish --push` or things break in your app after running `yalc remove @planningcenter/topbar` then in your product you will want to be running `bin/webpack-dev-server`.
103
+ From experience, we have seen that the People app will automatically reload while running `bin/webpack-dev-server`.
104
+ Unfortunately, in the Services app we have had to restart `bin/webpack-dev-server` every time for a change to come in.
105
+ This may change depending on what app you're adding your yalc changes to.
106
+
107
+ ### Debugging Jolt
108
+
109
+ The `jolt-client` library has the ability to log debug information to the console.
110
+ This functionality is configured when creating a client and is disabled by default.
111
+ If you are passing your own Jolt client object into Topbar via props, you can configure it as required before providing it to Topbar.
112
+ If you are relying on Topbar to create its own Jolt connection and would like to enable logging, pass `enableJoltLogging={true}` as a prop to whichever topbar
113
+ you are using (`SmallTopbar`/`NotSmallTopbar`).
114
+
101
115
  ## Migrate
102
116
 
103
117
  These migration docs will guide you thru the process of updating to recent major releases.
@@ -1,5 +1,10 @@
1
+ import { Environment } from "@planningcenter/url";
1
2
  declare global {
2
3
  interface Window {
4
+ railsEnv?: Environment;
5
+ currentPerson?: {
6
+ id: number;
7
+ };
3
8
  Rails?: {
4
9
  csrfToken: () => string;
5
10
  };
@@ -17,7 +17,7 @@ export declare class AppsProvider extends React.Component<{
17
17
  fetch(): void;
18
18
  remove(): void;
19
19
  componentDidMount(): void;
20
- render(): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)>;
20
+ render(): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
21
21
  }
22
22
  interface App {
23
23
  attributes: {
@@ -8,5 +8,5 @@ export declare class ClientStorage extends React.Component<{
8
8
  method: string;
9
9
  };
10
10
  update(value: any): void;
11
- render(): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)>;
11
+ render(): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
12
12
  }
@@ -6,7 +6,6 @@ export declare function CheckIns(): JSX.Element[];
6
6
  export declare function ChurchCenter(): JSX.Element[];
7
7
  export declare function Giving(): JSX.Element[];
8
8
  export declare function Groups(): JSX.Element[];
9
- export declare function Home(): JSX.Element[];
10
9
  export declare function People(): JSX.Element[];
11
10
  export declare function Publishing(): JSX.Element[];
12
11
  export declare function Registrations(): JSX.Element[];
@@ -1,9 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import * as PCO_URL from "@planningcenter/url";
3
- import { App } from "../interfaces";
4
3
  declare const AppsMenu: ({ appName, apps, env, toggle, visible, }: {
5
4
  appName: string;
6
- apps: App[];
5
+ apps: {
6
+ attributes: {
7
+ name: string;
8
+ url: string;
9
+ };
10
+ }[];
7
11
  env: PCO_URL.Environment;
8
12
  toggle: any;
9
13
  visible: boolean;
@@ -1,11 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { Notification } from "../interfaces";
3
- declare const NotificationItem: ({ mobile, isLast, onMarkAsRead, onToggleRead, showBottomBorder, notification, }: {
4
- mobile?: boolean;
3
+ declare const NotificationItem: ({ isLast, notification: { appName, createdAt, isRead, link, title }, }: {
5
4
  isLast?: boolean;
6
- onMarkAsRead?: (notification: Notification) => any;
7
- onToggleRead: any;
8
- showBottomBorder?: boolean;
9
5
  notification: Notification;
10
6
  }) => JSX.Element;
11
7
  export default NotificationItem;
@@ -1,17 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import { Notification } from "../interfaces";
3
- declare const NotificationsMenu: ({ handleMarkAllAsRead, handleMarkAsRead, handleToggleRead, hasError, isLoading, mobile, notifications: { read, unread }, toggle, visible, }: {
4
- handleMarkAllAsRead: () => any;
5
- handleMarkAsRead: (notification: Notification) => any;
6
- handleToggleRead: (notification: Notification) => any;
7
- hasError?: boolean;
8
- isLoading?: boolean;
9
- mobile?: boolean;
3
+ declare const NotificationsMenu: ({ notifications: { read, unread }, toggle, visible, }: {
10
4
  notifications: {
11
5
  read: Notification[];
12
6
  unread: Notification[];
13
7
  };
14
- toggle?: any;
15
- visible?: boolean;
8
+ toggle: any;
9
+ visible: boolean;
16
10
  }) => JSX.Element;
17
11
  export default NotificationsMenu;
@@ -17,5 +17,5 @@ export declare class ConnectedPeopleProvider extends React.Component<{
17
17
  unlink(): void;
18
18
  switch(toId: string, returnPath: string): void;
19
19
  componentDidMount(): void;
20
- render(): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)>;
20
+ render(): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
21
21
  }
@@ -9,7 +9,7 @@ export declare class PointBreak extends React.Component<{
9
9
  componentDidMount(): void;
10
10
  componentWillUnmount(): void;
11
11
  breakpointString(width: any): "xs" | "sm" | "md" | "lg" | "xl";
12
- render(): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)>;
12
+ render(): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
13
13
  }
14
14
  export declare class DisplaySwitch extends React.Component<{
15
15
  smallBreakpoints: String[];
@@ -1,3 +1,3 @@
1
- import { Notification } from "./interfaces"
2
- export declare const DUMMY_DATA_UNREAD: Notification[]
3
- export declare const DUMMY_DATA_READ: Notification[]
1
+ import { Notification } from "./interfaces";
2
+ export declare const DUMMY_DATA_UNREAD: Notification[];
3
+ export declare const DUMMY_DATA_READ: Notification[];
@@ -1,3 +1,15 @@
1
- import { App, ConnectedPerson } from "./interfaces";
1
+ export interface App {
2
+ attributes: {
3
+ name: string;
4
+ url: string;
5
+ };
6
+ }
7
+ export interface ConnectedPerson {
8
+ id: number;
9
+ attributes: {
10
+ name: string;
11
+ organization_name: string;
12
+ };
13
+ }
2
14
  export declare const appsMenuFormatter: (apps: App[]) => App[];
3
15
  export declare const connectedPeopleMenuFormatter: (connectedPeople: ConnectedPerson[]) => ConnectedPerson[];
@@ -31,10 +31,6 @@ export declare function Groups({ color, ...platformProps }: {
31
31
  [x: string]: any;
32
32
  color: any;
33
33
  }): JSX.Element;
34
- export declare function Home({ color, ...platformProps }: {
35
- [x: string]: any;
36
- color: any;
37
- }): JSX.Element;
38
34
  export declare function People({ color, ...platformProps }: {
39
35
  [x: string]: any;
40
36
  color: any;
@@ -29,11 +29,6 @@ export declare function Giving({ color, size, ...platformProps }: {
29
29
  color: any;
30
30
  size?: number;
31
31
  }): JSX.Element;
32
- export declare function Home({ color, size, ...platformProps }: {
33
- [x: string]: any;
34
- color: any;
35
- size?: number;
36
- }): JSX.Element;
37
32
  export declare function Groups({ color, size, ...platformProps }: {
38
33
  [x: string]: any;
39
34
  color: any;
@@ -1,36 +1,6 @@
1
1
  import * as React from "react";
2
2
  import * as PCO_URL from "@planningcenter/url";
3
- export declare class AppsButton extends React.Component<{
4
- appName: string;
5
- colors: any;
6
- expanded: boolean;
7
- style?: object;
8
- onClick: any;
9
- displayIconOnly?: boolean;
10
- }, {
11
- entered: boolean;
12
- down: boolean;
13
- }> {
14
- constructor(props: any);
15
- static defaultProps: {
16
- displayIconOnly: boolean;
17
- };
18
- render(): JSX.Element;
19
- }
20
- export declare class Hoverable extends React.Component<{
21
- component?: any;
22
- style?: object;
23
- hover?: any;
24
- active?: any;
25
- type?: string;
26
- onClick?: any;
27
- }, {
28
- entered: boolean;
29
- down: boolean;
30
- }> {
31
- constructor(props: any);
32
- render(): JSX.Element;
33
- }
3
+ import { Notification } from "./interfaces";
34
4
  export declare class Topbar extends React.Component<{
35
5
  apps: {
36
6
  attributes: {
@@ -51,30 +21,40 @@ export declare class Topbar extends React.Component<{
51
21
  search?: any;
52
22
  style?: any;
53
23
  showOrgName?: boolean;
54
- notifications?: any;
55
24
  requestAppsFetch: any;
56
25
  requestConnectedPeopleFetch: any;
57
26
  requestUnlinkConnectedPeople: any;
58
27
  requestSwitchConnectedPerson: any;
59
28
  requestClearAppsCache: any;
60
29
  requestClearConnectedPeopleCache: any;
30
+ useDummyNotifications?: boolean;
61
31
  linkToProfile?: boolean;
62
- onLinkToProfileClick?: () => any;
63
32
  }, {
64
33
  appsMenuVisible: boolean;
65
- userMenuVisible: boolean;
34
+ notificationsMenuVisible: boolean;
66
35
  routesVisible: boolean;
36
+ userMenuVisible: boolean;
37
+ notifications: {
38
+ unread: Notification[];
39
+ read: Notification[];
40
+ };
67
41
  }> {
68
42
  static defaultProps: {
69
- notifications: () => any;
70
43
  search: () => any;
71
44
  linkToProfile: boolean;
72
45
  showOrgName: boolean;
46
+ useDummyNotifications: boolean;
73
47
  };
74
48
  constructor(props: any);
75
49
  hideRoutes(): void;
76
50
  showRoutes(): void;
77
51
  getTextColor(): any;
52
+ findInIncluded({ type, id }: {
53
+ type: any;
54
+ id: any;
55
+ }, included: any): any;
56
+ subscribeToJoltChannel(): void;
57
+ componentDidMount(): void;
78
58
  render(): JSX.Element;
79
59
  }
80
60
  export declare class Route extends React.Component<{
@@ -1,16 +1,23 @@
1
- import * as React from "react";
2
- export declare const Bell: React.StatelessComponent<{
1
+ /// <reference types="react" />
2
+ export declare const Bell: ({ dot, dotFill, fill, style, ...props }: {
3
3
  dot?: boolean;
4
4
  dotFill?: string;
5
5
  fill?: string;
6
- stroke?: string;
7
6
  style?: object;
8
- }>;
9
- export declare const Spyglass: React.StatelessComponent<{
7
+ }) => JSX.Element;
8
+ export declare const DisclosureChevronIcon: ({ colors, style, ...nativeProps }: {
9
+ colors: any;
10
+ style?: object;
11
+ }) => JSX.Element;
12
+ export declare const HelpIcon: ({ colors, style, ...nativeProps }: {
13
+ colors: any;
14
+ style?: object;
15
+ }) => JSX.Element;
16
+ export declare const Spyglass: ({ fill, style, ...nativeProps }: {
10
17
  fill?: string;
11
18
  style?: object;
12
- }>;
13
- export declare const X: React.StatelessComponent<{
19
+ }) => JSX.Element;
20
+ export declare const X: ({ fill, style, ...nativeProps }: {
14
21
  fill?: string;
15
22
  style?: object;
16
- }>;
23
+ }) => JSX.Element;