@peektravel/app-utilities 0.7.2 → 0.7.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.
- package/README.md +24 -6
- package/dist/index.cjs +30 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -32
- package/dist/index.d.ts +38 -32
- package/dist/index.js +31 -28
- package/dist/index.js.map +1 -1
- package/dist/ui/index.cjs +11 -0
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.cts +16 -1
- package/dist/ui/index.d.ts +16 -1
- package/dist/ui/index.js +10 -1
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/odyssey.css +30 -0
- package/docs/ui.md +27 -0
- package/docs/webhooks.md +4 -3
- package/llms.txt +12 -4
- package/package.json +1 -1
package/dist/ui/odyssey.css
CHANGED
|
@@ -9,6 +9,36 @@
|
|
|
9
9
|
* dependency-free.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
/* ---- unupgraded-element guard (FOUC) ------------------------------------- */
|
|
13
|
+
/*
|
|
14
|
+
* Hide each <ody-*> element until its definition upgrades it, so it never
|
|
15
|
+
* flashes as its raw text content (an un-upgraded `<ody-button>Save</ody-button>`
|
|
16
|
+
* would otherwise render the bare word "Save"). `visibility` (not `display`)
|
|
17
|
+
* preserves layout, so there is no reflow when the element upgrades; wrapping
|
|
18
|
+
* the tags in `:where` keeps specificity at zero so a consumer can override
|
|
19
|
+
* trivially. If the
|
|
20
|
+
* registration bundle never loads, elements stay hidden rather than showing raw
|
|
21
|
+
* text. This selector list is kept in sync with the component registry by the
|
|
22
|
+
* `defined-guard` drift test — add any new tag here when you register it.
|
|
23
|
+
*/
|
|
24
|
+
:where(
|
|
25
|
+
ody-accordion, ody-alert, ody-app-page-container, ody-brand-icon, ody-breadcrumb,
|
|
26
|
+
ody-breadcrumb-item, ody-button, ody-card, ody-check-in-status, ody-checkbox,
|
|
27
|
+
ody-checkbox-group, ody-collapsible, ody-collapsible-collapsed, ody-collapsible-content,
|
|
28
|
+
ody-collapsible-section, ody-copy-button, ody-datepicker, ody-divider, ody-dropdown-multi,
|
|
29
|
+
ody-dropdown-single, ody-empty-state, ody-horizontal-divider, ody-icon, ody-inline-input,
|
|
30
|
+
ody-inline-list, ody-inline-list-item, ody-input, ody-list-item, ody-loading-bar,
|
|
31
|
+
ody-loading-spinner, ody-message, ody-modal, ody-money-input, ody-option, ody-page-container,
|
|
32
|
+
ody-panel, ody-percentage-input, ody-popover, ody-product-indicator, ody-radio-button-group,
|
|
33
|
+
ody-search-input, ody-section-column-item, ody-section-columns, ody-section-row-item,
|
|
34
|
+
ody-section-rows, ody-split-button, ody-stat, ody-stat-detail, ody-stat-summary,
|
|
35
|
+
ody-stat-summary-detail, ody-status-dot, ody-table, ody-table-header, ody-tabs, ody-tag,
|
|
36
|
+
ody-toast-host, ody-toggle-button, ody-tooltip, ody-two-column, ody-two-column-main,
|
|
37
|
+
ody-two-column-secondary, ody-two-column-secondary-header
|
|
38
|
+
):not(:defined) {
|
|
39
|
+
visibility: hidden;
|
|
40
|
+
}
|
|
41
|
+
|
|
12
42
|
/* ---- base ---------------------------------------------------------------- */
|
|
13
43
|
ody-icon, ody-button, ody-tag, ody-alert, ody-card, ody-divider, ody-horizontal-divider,
|
|
14
44
|
ody-status-dot, ody-message, ody-loading-spinner, ody-loading-bar {
|
package/docs/ui.md
CHANGED
|
@@ -40,6 +40,33 @@ CSS can also be linked instead of imported:
|
|
|
40
40
|
<link rel="stylesheet" href="…/@peektravel/app-utilities/ui/odyssey.css" />
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
Registration is **idempotent** — importing the module more than once (or from
|
|
44
|
+
more than one bundle) re-registers nothing and never throws, so lazy or
|
|
45
|
+
duplicated imports are safe.
|
|
46
|
+
|
|
47
|
+
If you register the bundle **lazily** (e.g. a dynamic `import()` to dodge SSR /
|
|
48
|
+
hydration mismatches), two things stop un-upgraded elements from flashing as
|
|
49
|
+
their raw text content (`<ody-button>Save</ody-button>` briefly showing the bare
|
|
50
|
+
word "Save"):
|
|
51
|
+
|
|
52
|
+
- `odyssey.css` ships a `:not(:defined) { visibility: hidden }` guard, so every
|
|
53
|
+
`<ody-*>` stays invisible — layout preserved, no reflow — until it upgrades.
|
|
54
|
+
Load the CSS **eagerly** so this applies before first paint. It has zero
|
|
55
|
+
specificity, so you can override it for a deliberate fallback.
|
|
56
|
+
- `whenOdysseyReady()` resolves once every imported element has upgraded, so you
|
|
57
|
+
can gate your first render on it:
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import { whenOdysseyReady } from '@peektravel/app-utilities/ui';
|
|
61
|
+
await whenOdysseyReady();
|
|
62
|
+
// …now render your <ody-*> tree
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
A *failed* dynamic import rejects at the `import()` call site — handle load
|
|
66
|
+
failures there; `whenOdysseyReady()` reflects only the elements that did
|
|
67
|
+
register. `registeredTags()` returns the registered tag list if you need to
|
|
68
|
+
introspect it.
|
|
69
|
+
|
|
43
70
|
Named exports for advanced use:
|
|
44
71
|
|
|
45
72
|
```ts
|
package/docs/webhooks.md
CHANGED
|
@@ -265,9 +265,10 @@ The **JSON body is the source of the event data**; the fields it shares with the
|
|
|
265
265
|
token (`installId`, `accountId`, `status`, `displayVersion`, `user`) fall back to
|
|
266
266
|
the **verified token** when the body omits them. The token authenticates the
|
|
267
267
|
whole delivery — only Peek can mint a valid one — so the body is trusted within a
|
|
268
|
-
verified request.
|
|
269
|
-
lifecycle events are often system-initiated (no acting user), so
|
|
270
|
-
tolerates a missing `modified_by`/`user
|
|
268
|
+
verified request. `user` is nullable here — as it is on `verifyPeekAuthToken` —
|
|
269
|
+
because install lifecycle events are often system-initiated (no acting user), so
|
|
270
|
+
the parser tolerates a missing `modified_by`/`user`, and every field inside a
|
|
271
|
+
present `user` is itself nullable (a sentinel `""`/`"null"` id becomes `null`).
|
|
271
272
|
|
|
272
273
|
> **Migrating from `verifyInstallWebhook` / `parseInstallEvent`?**
|
|
273
274
|
> `verifyInstallWebhook(token, secret)` still works but is `@deprecated` — it
|
package/llms.txt
CHANGED
|
@@ -169,10 +169,11 @@ stay internal.
|
|
|
169
169
|
418/429 with no GraphQL `errors` — e.g. 401/404/5xx; carries `.statusCode`,
|
|
170
170
|
`.url`, and raw `.body`; surfaced before JSON parsing so non-JSON error pages
|
|
171
171
|
keep their status), `PiiAccessDisabledError` (a payment/booking-modification op
|
|
172
|
-
was called without `fullCustomerAccess`), `
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
172
|
+
was called without `fullCustomerAccess`), and the REST-sibling `CngApiError` /
|
|
173
|
+
`AcmeApiError` — all importable; branch with `instanceof`. Token claim
|
|
174
|
+
extraction never throws once the signature verifies: a missing `user` block
|
|
175
|
+
gives `user: null`, and each user field (including `id`, the person's own id —
|
|
176
|
+
not an account/partner id) is nullable, with `""`/`"null"` normalized to `null`.
|
|
176
177
|
- Plain `Error` for validation/precondition failures thrown before any request.
|
|
177
178
|
|
|
178
179
|
## Webhooks (booking + waiver + install)
|
|
@@ -249,6 +250,13 @@ effect; read-only state props (`isOpen`/`isVisible`) ignore the write (drive the
|
|
|
249
250
|
via a `ref`'s imperative methods). No `only a getter` crash. TS still types them
|
|
250
251
|
read-only — the setters are a runtime safety net.
|
|
251
252
|
|
|
253
|
+
Registration is idempotent (importing twice never throws). Lazy registration:
|
|
254
|
+
`odyssey.css` ships a `:not(:defined){visibility:hidden}` guard so un-upgraded
|
|
255
|
+
`<ody-*>` never flash as raw text (load the CSS eagerly), and `whenOdysseyReady()`
|
|
256
|
+
(`Promise<void>`) resolves once every imported element has upgraded — gate first
|
|
257
|
+
render on it. `registeredTags()` returns the registered tag list. A failed
|
|
258
|
+
dynamic import rejects at the `import()` call site.
|
|
259
|
+
|
|
252
260
|
Tags by tier (see `docs/ui.md` for attributes/events/examples per component):
|
|
253
261
|
- display: `ody-button`, `ody-tag`, `ody-alert`, `ody-card`, `ody-horizontal-divider`
|
|
254
262
|
(1px rule with a default `margin-block: var(--gap16)`; `spacing="tight"|"none"`),
|