@planningcenter/topbar 7.3.0-alpha.1 → 7.3.0-alpha.4

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 (39) hide show
  1. package/CHANGELOG.md +25 -7
  2. package/README.md +75 -14
  3. package/dist/topbar.css +1 -1
  4. package/dist/topbar.css.map +1 -1
  5. package/dist/topbar.js +1 -1
  6. package/dist/topbar.js.map +1 -1
  7. package/dist/topbar.modern.css +1 -1
  8. package/dist/topbar.modern.css.map +1 -1
  9. package/dist/topbar.modern.js +1 -1
  10. package/dist/topbar.modern.js.map +1 -1
  11. package/dist/topbar.module.css +1 -1
  12. package/dist/topbar.module.css.map +1 -1
  13. package/dist/topbar.module.js +1 -1
  14. package/dist/topbar.module.js.map +1 -1
  15. package/dist/topbar.umd.js +1 -1
  16. package/dist/topbar.umd.js.map +1 -1
  17. package/dist/types/modules/api_request.d.ts +0 -12
  18. package/dist/types/modules/api_request.d.ts.map +1 -1
  19. package/dist/types/modules/apps_provider.d.ts +4 -1
  20. package/dist/types/modules/apps_provider.d.ts.map +1 -1
  21. package/dist/types/modules/components/hoverable.d.ts +3 -1
  22. package/dist/types/modules/components/hoverable.d.ts.map +1 -1
  23. package/dist/types/modules/components/notification_bell.d.ts +4 -1
  24. package/dist/types/modules/components/notification_bell.d.ts.map +1 -1
  25. package/dist/types/modules/components/notifications_menu.d.ts +4 -2
  26. package/dist/types/modules/components/notifications_menu.d.ts.map +1 -1
  27. package/dist/types/modules/hooks/use_notifications.d.ts +2 -2
  28. package/dist/types/modules/hooks/use_notifications.d.ts.map +1 -1
  29. package/dist/types/modules/hooks/use_topbar_api.d.ts.map +1 -1
  30. package/dist/types/modules/mfa_status.d.ts +7 -0
  31. package/dist/types/modules/mfa_status.d.ts.map +1 -0
  32. package/dist/types/modules/not_small_topbar.d.ts +0 -1
  33. package/dist/types/modules/not_small_topbar.d.ts.map +1 -1
  34. package/dist/types/modules/small_topbar.d.ts.map +1 -1
  35. package/dist/types/modules/symbols.d.ts +10 -0
  36. package/dist/types/modules/symbols.d.ts.map +1 -1
  37. package/dist/types/modules/topbar_context.d.ts +3 -1
  38. package/dist/types/modules/topbar_context.d.ts.map +1 -1
  39. package/package.json +2 -1
package/CHANGELOG.md CHANGED
@@ -8,40 +8,60 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
  ## [Unreleased notifications]
9
9
 
10
10
  ### Added
11
- - Notification bell, indicator, and dropdown that displayes the current user's read and unread notifications. On initial load, a GET request is sent to the notifications API and its response is used to populate the unread indicator. To use dummy data instead, you can pass `useDummyNotifications={true}` when calling any `Topbar` component.
12
- - Subscribe to push notifications via Jolt after initial load. This is a naive implementation in that whenever a push event is received, a fresh GET request is sent to the notifications API endpoint to retrieve the current state of ALL of the user's notifications.
13
- - Set a baseline prettier config
11
+
12
+ - Notification bell, indicator, and dropdown that displays the current user's read and unread notifications.
13
+ - Subscribe to push notifications via Jolt after initial load. Whenever a push event is received, a GET request is sent to the notifications API endpoint to retrieve the details of the new notification.
14
+ - Set up prettier and eslint and allow them to have their way on the code
15
+ - Control the admin notifications inbox with the flipper flag of `TOPBAR_notifications_enabled` in People. Disable for a specific app by setting `window.notificationsDisabled = true`.
16
+ - Control the Login info section with the flipper flag of `TOPBAR_mfa_enabled` in People.
17
+ - Show an indicator for whether MFA is configured for the current profile
18
+ - Add `props.linkToProfile` to `SharedTopbarProps` (so it's available to small and not small)
19
+
20
+ ### Changed
21
+
22
+ - No-op `AppsProvider`'s `fetch` and `remove` functions that are passed along with `apps` to the `render` function prop. Since we will always have fresh data now, there is no need to have these functions run.
23
+ - The information required to render the topbar is now contained in a single API request from people (`/me/topbar`). This includes the list of apps to render in the app switcher and enabled features inside the topbar. This is a change specifically to the app switcher, so changes had to be made in terms of the expected shape of the response from the server in order to render the app switcher. The `AppsProvider` `mapApps` function has been updated accordingly.
24
+
25
+ ### Removed
26
+
27
+ - `mapResourcesToCalendar` is removed as an export of `AppsProvider`. The apps array we receive from the API no longer returns Resources. Use `mapApps` instead (or, better still, don't pass anything to `formatter` and let us use the default).
14
28
 
15
29
  ## [7.2.1] - 2021-12-09
16
30
 
17
31
  ### Fixed
32
+
18
33
  - Bug z-stacking Safari bug that caused expanded `smalltopbar` items to show up behind elements [#46](https://github.com/ministrycentered/topbar/pull/46)
19
34
  - Bug causing user settings to be hidden on mobile when Home wasn't enabled for the user [#47](https://github.com/ministrycentered/topbar/pull/47)
20
35
 
21
36
  ## [7.2.0] - 2021-12-02
22
37
 
23
38
  ### Changed
39
+
24
40
  - New look and feel for the app switcher ([#40](https://github.com/ministrycentered/topbar/pull/40), [#42](https://github.com/ministrycentered/topbar/pull/42)).
25
41
  The switcher now displays Home at the top with some visual separation and Accounts (as "account") at the bottom—also with visual separation.
26
42
 
27
43
  ## [7.1.3] - 2021-11-16
28
44
 
29
45
  ### Fixed
46
+
30
47
  - Corrected the sorting of app names in mobile topbar as well [#36](https://github.com/ministrycentered/topbar/pull/36)
31
48
 
32
49
  ## [7.1.2] - 2021-11-11
33
50
 
34
51
  ### Fixed
52
+
35
53
  - Corrected the corrected sorting of app names in app switcher [#33](https://github.com/ministrycentered/topbar/pull/33)
36
54
 
37
55
  ## [7.1.1] - 2021-11-10
38
56
 
39
57
  ### Fixed
58
+
40
59
  - Corrected sorting of app names in app switcher [#32](https://github.com/ministrycentered/topbar/pull/32)
41
60
 
42
61
  ## [7.1.0] - 2021-11-08
43
62
 
44
63
  ### Added
64
+
45
65
  - Add Home to the app switcher dropdown
46
66
 
47
67
  ## [7.0.0] - 2021-10-01
@@ -92,9 +112,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
92
112
 
93
113
  Versions entries to this changelog weren't tracked very well and were presented in a less organized style (more like a README or upgrade guide). If you are interested in that, you can read about the changes in [README-pre-4.9.0].
94
114
 
95
-
96
-
97
- [Unreleased notifications]: https://github.com/ministrycentered/topbar/compare/@planningcenter/topbar@7.2.1..notifications
115
+ [unreleased notifications]: https://github.com/ministrycentered/topbar/compare/@planningcenter/topbar@7.2.1..notifications
98
116
  [7.2.1]: https://github.com/ministrycentered/topbar/compare/v7.2.0..v7.2.1
99
117
  [7.2.0]: https://github.com/ministrycentered/topbar/compare/v7.1.3..v7.2.0
100
118
  [7.1.3]: https://github.com/ministrycentered/topbar/compare/v7.1.2..v7.1.3
@@ -102,4 +120,4 @@ Versions entries to this changelog weren't tracked very well and were presented
102
120
  [7.1.1]: https://github.com/ministrycentered/topbar/compare/v7.1.0..v7.1.1
103
121
  [7.1.0]: https://github.com/ministrycentered/topbar/compare/v7.0.0..v7.1.0
104
122
  [7.0.0]: https://github.com/ministrycentered/topbar/compare/@planningcenter/topbar@6.0.6..v7.0.0
105
- [Previous entries]: CHANGELOG-pre-4.9.0.md
123
+ [previous entries]: CHANGELOG-pre-4.9.0.md
package/README.md CHANGED
@@ -2,22 +2,70 @@
2
2
 
3
3
  The shared Planning Center product Topbar
4
4
 
5
- ## Install
5
+ In general, it is responsible for a number of things that are shared across our apps.
6
6
 
7
- Every planning center product manages its own composition of Topbar components.
8
- They all have slightly different features.
9
- When starting a new project (rare), check out these existing Topbar compositions:
7
+ - App switcher (via [`AppsProvider`](./modules/apps_provider.tsx))
8
+ - Profile switcher (via [`ConnectedPeopleProvider`](./modules/connected_people_provider.tsx))
9
+ - Admin notifications inbox dropdown (via [`NotificationsMenu`](./modules/components/notifications_menu.tsx))
10
+ - Platform and/or product announcements (via [`PlatformAnnouncements`](./modules/platform_announcements.jsx) and [`ProductAnnouncements`](./moduels/product_announcements))
10
11
 
11
- - [API](https://github.com/ministrycentered/api/blob/master/app/javascript/components/api_topbar.jsx)
12
- - [Accounts](https://github.com/ministrycentered/accounts/blob/master/app/javascript/components/accounts_topbar.jsx)
13
- - [Check-Ins](https://github.com/ministrycentered/check-ins/blob/master/app/javascript/components/checkins_topbar.js)
14
- - [Giving](https://github.com/ministrycentered/giving/blob/master/app/javascript/application/components/giving_topbar.jsx)
15
- - [Groups](https://github.com/ministrycentered/groups/blob/master/app/javascript/application/components/groups_topbar.js)
16
- - [People](https://github.com/ministrycentered/people/blob/master/app/javascript/components/people_topbar.jsx)
17
- - [Publishing](https://github.com/ministrycentered/publishing/blob/master/app/javascript/src/PublishingTopbar.jsx)
18
- - [Resources](https://github.com/ministrycentered/resources/blob/master/app/javascript/components/ResourcesTopbar.jsx)
19
- - [Registrations](https://github.com/ministrycentered/registrations/blob/master/app/javascript/components/registrations_topbar.jsx)
20
- - [Services](https://github.com/ministrycentered/services/blob/master/app/javascript/components/ServicesTopbar.js)
12
+ ## Usage
13
+
14
+ To a limited extent, each product can customize the display of these items as they see fit.
15
+ For the majority of the products, implementation is very similar.
16
+ You can view [product-specific examples](#example-product-implementations) below.
17
+
18
+ ### Disabling the notifications inbox
19
+
20
+ The global determination of whether the notifications inbox is enabled or disabled is controlled via a [People flipper flag](https://people.planningcenteronline.com/flipper/features/TOPBAR_notifications_enabled).
21
+ However, if your app needs to disable the notifications inbox for whatever reason, set `window.notificationsDisabled = true` when your app renders and we'll honor that setting.
22
+ Because settings and flags are cached for one load cycle, it will take a fresh reload from the user to have the disable override to take effect.
23
+
24
+ ### Shared Jolt connections
25
+
26
+ New in v7.3 is the admin notifications inbox feature.
27
+ Visually, this is a bell in the topbar that, when clicked, will display a dropdown containing notifications from every app in their account.
28
+ Because a notification can be sent to a user as they are working on a page, topbar subscribes to a special notifications channel for the current user that provides push updates to the dropdown.
29
+
30
+ For a handful of reasons (not least of which is because we pay per Jolt connection), if the current page of an app is already using a Jolt connection, topbar would like to piggy-back on that connection for its own subscription.
31
+ **Note that this connection sharing is entirely optional for the parent app, but strongly encouraged.**
32
+ If a Jolt connection is not shared with topbar, it will gladly initiate its own connection specifically for its purposes.
33
+
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
+ If nothing is passed—or if a Promise is passed that resolves to `undefined` or `void`—topbar will initiate its own connection.
36
+
37
+ #### Example
38
+
39
+ As an example, we'll use what Services has done for the v7.3 alpha.
40
+ As a layout partial, they attach two Jolt-related things to `window`:
41
+
42
+ 1. `joltListener` (an instance of their own wrapper around the `jolt-client` library)
43
+ 1. `joltListenerPromise` (a `jolt-client` instance that has gone through (or will go through asynchronously) the connection and authorization process)
44
+
45
+ ```html
46
+ <script>
47
+ window.joltListener = new window.JoltListener()
48
+ window.joltListenerPromise = window.joltListener.connect()
49
+ </script>
50
+ ```
51
+
52
+ In their Topbar implementation component, they then create the function that provides topbar the required Promise...
53
+
54
+ ```jsx
55
+ const waitForWindowJolt = async () => {
56
+ const listener = Promise.resolve(window.joltListenerPromise)
57
+ return listener.then((listener) => {
58
+ if (listener && listener.jolt) {
59
+ return listener.jolt
60
+ }
61
+ })
62
+ }
63
+ ```
64
+
65
+ ...and passes that function in for the `JoltPromise` prop to topbar.
66
+ Topbar can then use this Promise to determine whether or not it needs to create its own connection or piggyback on one provided.
67
+
68
+ The implementation details for your app can be decided by you and dependent on your apps current usage of Jolt.
21
69
 
22
70
  ## Upgrade
23
71
 
@@ -57,3 +105,16 @@ So, this CHANGELOG is a little lazy.
57
105
  If you like history, here are the initial release notes with technical considerations and trade-offs.
58
106
 
59
107
  [STORY](./docs/STORY.md)
108
+
109
+ ## Example product implementations
110
+
111
+ - [API](https://github.com/ministrycentered/api/blob/master/app/javascript/components/api_topbar.jsx)
112
+ - [Accounts](https://github.com/ministrycentered/accounts/blob/master/app/javascript/components/accounts_topbar.jsx)
113
+ - [Calendar](https://github.com/ministrycentered/resources/blob/master/app/javascript/components/CalendarTopbar.jsx)
114
+ - [Check-Ins](https://github.com/ministrycentered/check-ins/blob/master/app/javascript/components/checkins_topbar.js)
115
+ - [Giving](https://github.com/ministrycentered/giving/blob/master/app/javascript/application/components/giving_topbar.jsx)
116
+ - [Groups](https://github.com/ministrycentered/groups/blob/master/app/javascript/application/components/groups_topbar.js)
117
+ - [People](https://github.com/ministrycentered/people/blob/master/app/javascript/components/people_topbar.jsx)
118
+ - [Publishing](https://github.com/ministrycentered/publishing/blob/master/app/javascript/src/PublishingTopbar.js)
119
+ - [Registrations](https://github.com/ministrycentered/registrations/blob/master/app/javascript/components/registrations_topbar.jsx)
120
+ - [Services](https://github.com/ministrycentered/services/blob/master/app/javascript/components/ServicesTopbar.js)
package/dist/topbar.css CHANGED
@@ -1,2 +1,2 @@
1
- @-webkit-keyframes spinning{to{transform:rotate(1turn)}}@keyframes spinning{to{transform:rotate(1turn)}}.spinner{align-self:center;-webkit-animation:spinning .5s linear infinite;animation:spinning .5s linear infinite;border:2px solid #f7f7f7;border-radius:50%;border-top-color:#9e9e9e;display:inline;height:16px;transform:rotate(0deg);vertical-align:middle;width:16px}
1
+ .hide-scrollbar{-ms-overflow-style:none;scrollbar-width:none}.hide-scrollbar::-webkit-scrollbar{display:none}@-webkit-keyframes spinning{to{transform:rotate(1turn)}}@keyframes spinning{to{transform:rotate(1turn)}}.spinner{align-self:center;-webkit-animation:spinning .5s linear infinite;animation:spinning .5s linear infinite;border:2px solid #f7f7f7;border-radius:50%;border-top-color:#9e9e9e;display:inline;height:16px;transform:rotate(0deg);vertical-align:middle;width:16px}
2
2
  /*# sourceMappingURL=topbar.css.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["spinner.css"],"names":[],"mappings":"AAAA,4BACE,GAEE,uBACF,CACF,CACA,oBACE,GAEE,uBACF,CACF,CAEA,SACE,iBAAkB,CAClB,8CAAyC,CAAzC,sCAAyC,CAKzC,wBAAiB,CAHjB,iBAAkB,CAGlB,wBAAiB,CACjB,cAAe,CACf,WAAY,CACZ,sBAAuB,CACvB,qBAAsB,CACtB,UACF","file":"topbar.css","sourcesContent":["@-webkit-keyframes spinning {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n@keyframes spinning {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n.spinner {\n align-self: center;\n animation: spinning 500ms infinite linear;\n border-color: hsl(0 0% 97%);\n border-radius: 50%;\n border-style: solid;\n border-top-color: hsl(0 0% 62%);\n border-width: 2px;\n display: inline;\n height: 16px;\n transform: rotate(0deg);\n vertical-align: middle;\n width: 16px;\n}\n"]}
1
+ {"version":3,"sources":["utils.css","spinner.css"],"names":[],"mappings":"AAAA,gBACE,uBAAwB,CACxB,oBACF,CACA,mCACE,YACF,CCNA,4BACE,GAEE,uBACF,CACF,CACA,oBACE,GAEE,uBACF,CACF,CAEA,SACE,iBAAkB,CAClB,8CAAyC,CAAzC,sCAAyC,CAKzC,wBAAiB,CAHjB,iBAAkB,CAGlB,wBAAiB,CACjB,cAAe,CACf,WAAY,CACZ,sBAAuB,CACvB,qBAAsB,CACtB,UACF","file":"topbar.css","sourcesContent":[".hide-scrollbar {\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n}\n.hide-scrollbar::-webkit-scrollbar {\n display: none; /* Chrome, Safari, and Opera */\n}\n","@-webkit-keyframes spinning {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n@keyframes spinning {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n.spinner {\n align-self: center;\n animation: spinning 500ms infinite linear;\n border-color: hsl(0 0% 97%);\n border-radius: 50%;\n border-style: solid;\n border-top-color: hsl(0 0% 62%);\n border-width: 2px;\n display: inline;\n height: 16px;\n transform: rotate(0deg);\n vertical-align: middle;\n width: 16px;\n}\n"]}