@crvouga/mockingbird-notifications 0.13.0 → 0.14.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.
Files changed (35) hide show
  1. package/README.md +22 -17
  2. package/dist/admin-gateway.js +2 -2
  3. package/dist/browser.bundle-MOA3BSWW.js +6 -0
  4. package/dist/browser.bundle-MOA3BSWW.js.map +7 -0
  5. package/dist/chunk-5MRZJQ6J.js +1254 -0
  6. package/dist/chunk-5MRZJQ6J.js.map +7 -0
  7. package/dist/{chunk-6GZPCBEM.js → chunk-NMW2EZL2.js} +11 -5
  8. package/dist/chunk-NMW2EZL2.js.map +7 -0
  9. package/dist/{chunk-IWRSXOBL.js → chunk-T6QHUV5K.js} +3 -3
  10. package/dist/chunk-ZIE3JCV6.js +26 -0
  11. package/dist/chunk-ZIE3JCV6.js.map +7 -0
  12. package/dist/cli.js +4 -5
  13. package/dist/cli.js.map +1 -1
  14. package/dist/client.bundle-YOZJSCGX.js +6 -0
  15. package/dist/client.bundle-YOZJSCGX.js.map +7 -0
  16. package/dist/{document-OSYEGZSQ.js → document-JPNN2BT5.js} +2 -2
  17. package/dist/index.js +4 -6
  18. package/dist/index.js.map +1 -1
  19. package/dist/{chunk-QQK27AFM.js → page-J3NUKUUA.js} +34 -306
  20. package/dist/page-J3NUKUUA.js.map +7 -0
  21. package/dist/server-Q5XLVMT2.js +17378 -0
  22. package/dist/server-Q5XLVMT2.js.map +7 -0
  23. package/dist/server.js +4 -5
  24. package/dist/ui.d.ts +36 -46
  25. package/dist/ui.js +21530 -2526
  26. package/dist/ui.js.map +4 -4
  27. package/package.json +34 -14
  28. package/dist/chunk-5DUELOZW.js +0 -1202
  29. package/dist/chunk-5DUELOZW.js.map +0 -7
  30. package/dist/chunk-5KZ24SHQ.js +0 -26
  31. package/dist/chunk-5KZ24SHQ.js.map +0 -7
  32. package/dist/chunk-6GZPCBEM.js.map +0 -7
  33. package/dist/chunk-QQK27AFM.js.map +0 -7
  34. /package/dist/{chunk-IWRSXOBL.js.map → chunk-T6QHUV5K.js.map} +0 -0
  35. /package/dist/{document-OSYEGZSQ.js.map → document-JPNN2BT5.js.map} +0 -0
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @crvouga/mockingbird-notifications
2
2
 
3
- > Local emulators. Real API contracts. Part of [Mockingbird](https://github.com/crvouga-organization/mockingbird).
3
+ > Local emulators. Real API contracts. Part of [Mockingbird](https://github.com/crvouga/mockingbird).
4
4
 
5
5
  A notification test harness for a Mockingbird fleet. It reads the same emulators your application
6
6
  sends through and shows every SMS, WhatsApp message, email, push and chat message the way the
@@ -91,12 +91,15 @@ the tab); a harness you serve yourself takes `admin: adminGateway()` from `./ser
91
91
 
92
92
  ## The UI
93
93
 
94
- `/` shows four devices side by side. Each has a recipient picker (phone number, push token,
94
+ `/` shows four devices side by side, in the same Mockingbird UI as the admin and Fleet Cloud
95
+ (React and HeroUI, light or dark): a header with the **Live** status and the **Devices** and
96
+ **Timeline** switch, then the filter, the **Namespace** select, **Follow new**, **Sound** and a
97
+ status chip per emulator. Each device has a recipient picker (phone number, push token,
95
98
  mailbox, chat channel) that follows the newest arrival unless **Follow new** is off. The **Timeline** tab lists
96
99
  everything in one table; double-click any message, or click a timeline row, to inspect the
97
100
  normalized record and the emulator's raw one. Read state is kept per browser.
98
101
 
99
- The **channel tabs** under the top bar (`All | Text | Push | Email | Chat`) pick one device or all of them. A tab whose device is not on screen counts what arrived there. When the harness has less than 800px to itself (a phone, a side panel, a narrow embed) there is no room for two devices, so it shows one at a time and the tabs switch between them; this follows the width of the element the UI is mounted on, not the window. Every device has the same header above it, so the frames always line up along the top.
102
+ The **channel tabs** under the header (`All | Text | Push | Email | Chat`) pick one device or all of them. A tab whose device is not on screen counts what arrived there. When the harness has less than 800px to itself (a phone, a side panel, a narrow embed) there is no room for two devices, so it shows one at a time and the tabs switch between them; this follows the width of the element the UI is mounted on, not the window. Every device has the same header above it, so the frames always line up along the top.
100
103
 
101
104
  Links open one device for a screenshot, for example in a Playwright test:
102
105
 
@@ -127,7 +130,7 @@ The devices behave like the real apps, in a generic style with no vendor marks:
127
130
  Every gesture also works with a click or the keyboard. Dismissing, archiving or deleting only hides
128
131
  the message in this browser; the harness keeps every record, and a reload brings it back.
129
132
 
130
- **Sound** (off by default; the top bar's speaker toggles it, and `?sound=1` turns it on): new
133
+ **Sound** (off by default; the **Sound** toggle turns it on, and so does `?sound=1`): new
131
134
  arrivals play a synthesized chime in each platform's style, and phones vibrate where the browser
132
135
  allows. **Motion:** arrivals, swipes, stacks and screen changes are animated. A viewer's
133
136
  reduced-motion setting turns animation off, and so does the `motion: "reduce"` option.
@@ -185,7 +188,7 @@ test("the sign-in code is offered above the keyboard", async ({ page }) => {
185
188
 
186
189
  | Device | Main test ids | State attributes |
187
190
  | --- | --- | --- |
188
- | Top bar | `namespace`, `search`, `view-devices`, `view-timeline`, `follow`, `sound-toggle`, `connection`, `source`, `notice`, `toast`, `toast-undo` | `source`: `data-name`, `data-service`, `data-ok`, `data-count`. `connection`: `data-state`. |
191
+ | Header and filters | `namespace`, `search`, `view-devices`, `view-timeline`, `follow`, `sound-toggle`, `connection`, `source`, `notice`, `toast`, `toast-undo` | `source`: `data-name`, `data-service`, `data-ok`, `data-count`. `connection`: `data-state`. |
189
192
  | Channel tabs | `channel-tabs`, `channel-tab`, `channel-tab-unread` | Root: `data-layout` (`grid` or `tabs`), `data-tab` (`all`, `sms`, `push`, `email`, `chat`). `channel-tab`: `data-value`, `aria-selected`, `data-unread`. |
190
193
  | Messages | `sms-device`, `sms-recipient`, `sms-thread` (`-name`, `-preview`, `-time`, `-unread`), `sms-conversation`, `sms-back`, `sms-bubble`, `sms-code`, `sms-menu`, `sms-menu-tapback`, `sms-tapback`, `sms-empty` | `sms-device`: `data-screen` (`threads` or `conversation`), `data-recipient`, `data-thread`. `sms-thread`: `data-pinned`, `data-muted`. |
191
194
  | Push | `push-device`, `push-recipient`, `push-skin`, `push-group`, `push-group-more`, `push-notification` (`-title`, `-body`, `-app`, `-time`, `-image`, `-data`, `-meta`), `push-clear`, `push-options`, `push-preview`, `push-settings`, `push-clear-all`, `push-empty` | `push-device`: `data-skin` (`ios` or `android`), `data-platform`. `push-notification`: `data-expanded`, `data-app`, `data-stacked`. |
@@ -201,7 +204,7 @@ share a harness, give each one its own namespace (`?namespace=`) or open a deep
201
204
  recipient: a link with `to=` stays on that recipient instead of following new arrivals. Set
202
205
  `?follow=0` on any other link that should stay put.
203
206
 
204
- [`e2e/ui.e2e.ts`](https://github.com/crvouga-organization/mockingbird/blob/main/packages/notifications/e2e/ui.e2e.ts)
207
+ [`e2e/ui.e2e.ts`](https://github.com/crvouga/mockingbird/blob/main/packages/notifications/e2e/ui.e2e.ts)
205
208
  in this repository is a complete, passing example with real Twilio, Resend, FCM and Slack emulators.
206
209
 
207
210
  ## Embed the UI
@@ -224,15 +227,17 @@ await ui.ready
224
227
  ui.destroy()
225
228
  ```
226
229
 
227
- Its styles are scoped to the UI's root (`.mb-notifications`) and added once to the document, or to
228
- the shadow root that holds `panel`. Options: `harness`, or `fetch` and `baseUrl` for a harness on
230
+ The UI is React and HeroUI inside, prebuilt into this package, so your app needs neither. It adds
231
+ Mockingbird's stylesheet (`@crvouga/mockingbird-ui/styles`) and the device skins (`STYLES`, scoped to
232
+ `.mb-notifications`) once to the document, or to the shadow root that holds `panel`; pass
233
+ `injectStyles: false` to serve them yourself. Options: `harness`, or `fetch` and `baseUrl` for a harness on
229
234
  another origin; `channels` (which devices to show); `layout` (`auto`, `tabs` or `grid`) and `tabs` (show the
230
- channel tabs); `chrome` (show the top bar); `scale` (draw the devices smaller, `0.5` to `1`); `sound`; `motion`
235
+ channel tabs); `chrome` (show the header and filters); `scale` (draw the devices smaller, `0.5` to `1`); `sound`; `motion`
231
236
  (`auto`, `full` or `reduce`); `onArrive`; and `syncUrl`, which reads and writes `?view=`-style
232
- links on the page. The [lab ordering example](https://github.com/crvouga-organization/mockingbird/tree/main/packages/examples/medical-testing)
237
+ links on the page. The [lab ordering example](https://github.com/crvouga/mockingbird/tree/main/packages/examples/medical-testing)
233
238
  mounts it as its Notifications tab.
234
239
 
235
- `mountDashboard` puts a tab bar over that UI and an emulators panel you draw:
240
+ `mountDashboard` puts the Mockingbird shell and tabs over that UI and an emulators panel you draw:
236
241
 
237
242
  ```ts
238
243
  import { createNotificationHarness } from "@crvouga/mockingbird-notifications"
@@ -256,10 +261,10 @@ dashboard.show("notifications")
256
261
 
257
262
  Tabs are your own `tabs` (`{ id, label, mount }`), then Emulators, then Notifications. A tab is
258
263
  drawn the first time it is shown and stays mounted; the Notifications tab counts what arrives while
259
- another is open. Other options: `initialTab`, `onTabChange`, `theme` (`dark`, `light`, `auto`) and
260
- `injectStyles`. The handle has `show(id)`, `active()`, `tabs()`, `aside`, `notifications` and
261
- `destroy()`. Give the element a height. The shell is plain DOM with no inline script, so it runs
262
- under a strict Content-Security-Policy.
264
+ another is open. Other options: `initialTab`, `onTabChange`, `theme` (`auto`, the default, follows
265
+ the viewer; `light` or `dark` pins one) and `injectStyles`. The handle has `show(id)`, `active()`,
266
+ `tabs()`, `aside`, `notifications` and `destroy()`. Give the element a height. It adds no inline
267
+ script, so it runs under a strict Content-Security-Policy.
263
268
 
264
269
  ## Usage
265
270
 
@@ -355,8 +360,8 @@ forwards to Mailosaur (`--forward-to-inbox`), the Mailosaur copy is hidden so th
355
360
  | `CHANNELS` | value | Every channel, in device order: `sms`, `push`, `email`, `chat`. |
356
361
  | `TEST_IDS`, `selectors` | values | Every `data-testid` the UI renders, and CSS selector builders for browser tests. Also exported from `./ui`. |
357
362
  | `mountNotifications` (`./ui`) | function | `(element, {harness, …})` → `{ready, show, setNamespace, setSound, render, destroy}`. Mounts the UI on an element. |
358
- | `mountDashboard` (`./ui`) | function | `(element, {emulators, notifications, tabs, …})` → `{show, active, tabs, aside, notifications, destroy}`. A tab bar over an emulators panel and the notifications UI. Also `DASHBOARD_STYLES` and `DASHBOARD_ROOT_CLASS`. |
359
- | `createApp`, `STYLES`, `ROOT_CLASS` (`./ui`) | browser | The UI without the style injection and embedded defaults, its scoped stylesheet, and its root class. |
363
+ | `mountDashboard` (`./ui`) | function | `(element, {emulators, notifications, tabs, …})` → `{show, active, tabs, aside, notifications, destroy}`. The Mockingbird shell and tabs over an emulators panel and the notifications UI. Also `DASHBOARD_STYLES` and `DASHBOARD_ROOT_CLASS`. |
364
+ | `createApp`, `STYLES`, `ROOT_CLASS` (`./ui`) | browser | The UI without the style injection and embedded defaults, the device skins' scoped stylesheet (pair it with `MOCKINGBIRD_CSS`), and its root class. |
360
365
  | `createServer`, `manifestFile`, `DEFAULT_PORT` (`./server`) | Node | Serve the harness over `node:http`; `manifestFile(path)` re-reads a fleet ready file. Port 8790. |
361
366
  | `adminGateway` (`./server`) | Node | The harness's `admin` option: fronts every emulator's admin API and admin UI under `/admin/`. `createServer` passes it by default. |
362
367
 
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  ADMIN_BRANDS_URL,
3
3
  adminGateway
4
- } from "./chunk-6GZPCBEM.js";
5
- import "./chunk-5KZ24SHQ.js";
4
+ } from "./chunk-NMW2EZL2.js";
5
+ import "./chunk-ZIE3JCV6.js";
6
6
  export {
7
7
  ADMIN_BRANDS_URL,
8
8
  adminGateway