@dataemergencia/emergency 0.1.0 → 0.2.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.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Client for the DataEmergencia emergency flow. It owns everything that happens
4
4
  after the SOS trigger: the panel, the emergency lifecycle, the public realtime
5
- updates and the fallback surfaces.
5
+ updates and the geolocation fallback feedback.
6
6
 
7
7
  The upstream DataEmergencia API is never called from the browser. The only
8
8
  backend contract is the emergency BFF (`/de-bff/emergency`), which validates the
@@ -22,13 +22,14 @@ identity code, sends the WhatsApp messages and proxies the upstream state.
22
22
  - [Vanilla, no-build guide](docs/client/vanilla.md)
23
23
  - [Theming](docs/client/theming.md)
24
24
  - [Troubleshooting](docs/client/troubleshooting.md)
25
+ - [Releasing](docs/release/releasing.md)
25
26
 
26
27
  The BFF is a separate package:
27
28
  [`dataemergencia/emergency-bff`](https://github.com/The-BoxHead-Guy/emergency-bff).
28
29
 
29
30
  ## Requirements
30
31
 
31
- - Node.js 24.22.1 or newer, LTS (the monorepo currently runs Node 26.13.0; the pinned LTS toolchain is 24.22.2).
32
+ - Node.js 22 or newer. CI and releases use the pinned LTS from `.nvmrc` (24.22.2).
32
33
  - pnpm 10+ (the monorepo currently runs pnpm 12.8.1).
33
34
  - Vite+ 1.4.0 for this package's build and test commands.
34
35
 
@@ -99,18 +100,18 @@ against the mock BFF: see
99
100
 
100
101
  ## Mount options
101
102
 
102
- | Option | Type | Notes |
103
- | ---------------------- | --------------------------------------------------------- | ------------------------------------------------------------- |
104
- | `root` | `HTMLElement \| string` | Host container. Validated at mount. |
105
- | `bffBaseUrl` | `string` | Full BFF route prefix, including `/de-bff/emergency`. |
106
- | `code` | `string` | 6-character identity code supplied by the host. |
107
- | `trigger` | `string \| HTMLElement \| (open) => void \| (() => void)` | Optional. Click opens the panel. |
108
- | `fallback` | `{ phone, label }` | Optional direct-call surface. No country number is hardcoded. |
109
- | `theme` | `EmergencyTheme` | CSS variable overrides (see Theming). |
110
- | `locale` | `string` | Defaults to `es`; used for time formatting. |
111
- | `geolocationTimeoutMs` | `number` | Defaults to `8000`. |
112
- | `requestTimeoutMs` | `number` | Defaults to `15000`. |
113
- | `onEvent` | `(name, payload) => void` | Typed lifecycle events. |
103
+ | Option | Type | Notes |
104
+ | ---------------------- | --------------------------------------------------------- | ------------------------------------------------------ |
105
+ | `root` | `HTMLElement \| string` | Host container. Validated at mount. |
106
+ | `bffBaseUrl` | `string` | Full BFF route prefix, including `/de-bff/emergency`. |
107
+ | `code` | `string` | 6-character identity code supplied by the host. |
108
+ | `trigger` | `string \| HTMLElement \| (open) => void \| (() => void)` | Optional. Click opens the panel. |
109
+ | `fallback` | `{ phone, label }` | Optional. Emitted in `emergency:fallback` for host UI. |
110
+ | `theme` | `EmergencyTheme` | CSS variable overrides (see Theming). |
111
+ | `locale` | `string` | Defaults to `es`; used for time formatting. |
112
+ | `geolocationTimeoutMs` | `number` | Defaults to `8000`. |
113
+ | `requestTimeoutMs` | `number` | Defaults to `15000`. |
114
+ | `onEvent` | `(name, payload) => void` | Typed lifecycle events. |
114
115
 
115
116
  Invalid roots or codes do not throw into the host page. `mount()` reports a
116
117
  `configuration` error through `onEvent('emergency:failed', …)`, logs it, and
@@ -135,8 +136,8 @@ client.destroy()
135
136
 
136
137
  Activation opens the panel immediately, requests geolocation and only reports
137
138
  success after the BFF confirms. If geolocation is denied, unavailable, times out
138
- or is unsupported, the client shows the typed error and the host-provided phone
139
- fallback; it never implies that an emergency was sent without a location.
139
+ or is unsupported, the client shows a dismissable error feedback card for five
140
+ seconds and never implies that an emergency was sent without a location.
140
141
 
141
142
  Abort requires confirmation: `requestAbortConfirmation()` sets the state that
142
143
  the UI uses for the "keep active / cancel emergency" step, and `abort()` acts on
@@ -213,6 +214,11 @@ and `radius` onto `--de-emergency-red`, `--de-emergency-on-red`,
213
214
  `--de-emergency-white`, `--de-emergency-text`, `--de-emergency-text-secondary`
214
215
  and `--de-emergency-radius`.
215
216
 
217
+ The client injects the Google Fonts stylesheet for Google Sans, Montserrat and
218
+ Poppins at mount time, in both the ESM/CJS and IIFE builds, so the host does not
219
+ add font `<link>` tags. Use the `fontLoading` mount option to disable loading or
220
+ select families; see [Configuration](docs/client/configuration.md#fonts).
221
+
216
222
  The IIFE bundle embeds this stylesheet in a single injected `<style>` tag and
217
223
  removes it when the last mount is destroyed. Hosts using the IIFE must not load
218
224
  a second copy of the CSS. ESM/CJS consumers import `styles.css` once.
@@ -262,30 +268,43 @@ Build outputs:
262
268
 
263
269
  The IIFE gzip budget is 150 KB (current build: ~115 KB).
264
270
 
265
- ## Repository split and release
271
+ ## Releasing
266
272
 
267
273
  This package lives at `libs/emergency` in the DataEmergencia monorepo and is
268
274
  published from the public split repository `The-BoxHead-Guy/emergency` as
269
275
  `@dataemergencia/emergency` (npm org `dataemergencia`).
270
276
 
271
- - Monorepo tags: `npm-v0.1.0`.
272
- - Split repository tags: `v0.1.0`.
273
- - The split workflow `.github/workflows/split-emergency-client.yml` copies this
274
- directory to the split root, regenerates a standalone `pnpm-lock.yaml`, and
275
- pushes the tag.
277
+ The full runbook is [Releasing the client](docs/release/releasing.md). The short
278
+ version:
279
+
280
+ ```bash
281
+ cd libs/emergency
282
+ pnpm bump 0.2.1 # package.json only; commit the bump
283
+ pnpm run check && pnpm run test && pnpm run build
284
+ git tag -a emergency-client-v0.2.1 -m "release: 0.2.1"
285
+ git push origin emergency-client-v0.2.1
286
+ ```
287
+
288
+ The tag push runs the split workflow, which mirrors this directory to the split
289
+ root, regenerates a standalone `pnpm-lock.yaml`, and pushes the split tag. Then
290
+ run **Publish to npm** from the split repository.
291
+
292
+ - Monorepo tags are project-scoped: `emergency-client-v0.2.1`.
293
+ - Split repository tags: `v0.2.1`.
276
294
  - `scripts/split.sh <version> [--push] [--publish]` performs the same mirror
277
- manually and is the fallback when Actions minutes are exhausted.
278
- - `scripts/release.sh <version> [--publish]` verifies the committed version, the
279
- changelog entry, the tarball contents and the IIFE budget before publishing.
280
- - The first publish is manual (`scripts/release.sh <version> --publish`).
281
- Trusted Publishing is prepared in `.github/workflows/publish-npm.yml` for
282
- later releases.
295
+ manually and is the fallback when Actions is unavailable.
296
+ - `scripts/release.sh <version> [--publish]` verifies the committed version and
297
+ the changelog entry, then runs check, tests and build through npm before
298
+ publishing.
299
+ - Publishing uses npm Trusted Publishing from the split repository; the original
300
+ `0.1.0` was published manually.
283
301
 
284
302
  The published tarball contains `dist/`, `README.md`, `LICENSE` and
285
303
  `package.json`; `dist/**/*.map` files are excluded. Source maps stay in the
286
304
  repository and in the CI artifacts.
287
305
 
288
- See `docs/release/release-checklist.md` and `CHANGELOG.md`.
306
+ See [Releasing the client](docs/release/releasing.md) and
307
+ [CHANGELOG.md](CHANGELOG.md).
289
308
 
290
309
  ## License
291
310