@peektravel/app-utilities 0.7.3 → 0.8.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 +17 -0
- package/dist/index.cjs +199 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +118 -1
- package/dist/index.d.ts +118 -1
- package/dist/index.js +199 -0
- 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/llms.txt +22 -2
- 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/llms.txt
CHANGED
|
@@ -108,6 +108,12 @@ final authority and may still reject the request.
|
|
|
108
108
|
carries `minPrice`/`maxPrice` (`PricingMoney | null`, `null` for add-ons and
|
|
109
109
|
when Peek reports no range); every `PricingMoney` includes a `displayPrice`
|
|
110
110
|
string (e.g. `"$50.00"`) on values read back from the gateway.
|
|
111
|
+
`getCustomQuestions(productId)` returns an activity's operator-configured
|
|
112
|
+
custom questions as `CustomQuestion[]` — each with `id`, `order`, `isRequired`,
|
|
113
|
+
`questionText`, `hintText`, `questionType` (`CHECK_BOX`/`TEXT`/`LOCATION`/
|
|
114
|
+
`SELECT_ONE`/…), `internalLabel`, `perGuest`, `defaultValue`, and
|
|
115
|
+
`options: CustomQuestionOption[]` (`{ id, order, value }`, empty for
|
|
116
|
+
free-text/checkbox questions). Question definitions, not answers — no PII.
|
|
111
117
|
- `getAccountUserService()` — `getAll()`, `getById(userId)`
|
|
112
118
|
- `getResourcePoolService()` — `getAll(mode?)`
|
|
113
119
|
- `getTimeslotService()` — `getForDay(productId, date, filter?)`, `getById(id)`,
|
|
@@ -158,8 +164,15 @@ stay internal.
|
|
|
158
164
|
- Payment source ids: `ps_…` or `cash/cash` | `custom/other` | `custom/voucher`.
|
|
159
165
|
Payment ids (refunds): `pmt_…`.
|
|
160
166
|
- Idempotency key required on `makePayment`, `refund`, `create({markAsPaid:true})`.
|
|
161
|
-
- `create()` uses pre-resolved ids
|
|
162
|
-
services); no free-text matching.
|
|
167
|
+
- `create()` uses pre-resolved ids for product/ticket/time (resolve via product
|
|
168
|
+
+ availability services); no free-text matching there. The one exception is
|
|
169
|
+
`CreateBookingInput.customQuestionAnswers?: CustomQuestionAnswerInput[]`
|
|
170
|
+
(`{questionIdOrText, value}`): when supplied, the activity's custom questions
|
|
171
|
+
are fetched and each answer is matched (id or lenient text) and validated by
|
|
172
|
+
type (checkbox `yes/no/true/false`; text verbatim; select-one/location by
|
|
173
|
+
option id or lenient label) before the quote is made — an unmatched/ambiguous
|
|
174
|
+
question or option, or an invalid checkbox value, fails creation up front.
|
|
175
|
+
Per-guest questions are not yet supported (answering one fails creation).
|
|
163
176
|
|
|
164
177
|
## Errors
|
|
165
178
|
|
|
@@ -250,6 +263,13 @@ effect; read-only state props (`isOpen`/`isVisible`) ignore the write (drive the
|
|
|
250
263
|
via a `ref`'s imperative methods). No `only a getter` crash. TS still types them
|
|
251
264
|
read-only — the setters are a runtime safety net.
|
|
252
265
|
|
|
266
|
+
Registration is idempotent (importing twice never throws). Lazy registration:
|
|
267
|
+
`odyssey.css` ships a `:not(:defined){visibility:hidden}` guard so un-upgraded
|
|
268
|
+
`<ody-*>` never flash as raw text (load the CSS eagerly), and `whenOdysseyReady()`
|
|
269
|
+
(`Promise<void>`) resolves once every imported element has upgraded — gate first
|
|
270
|
+
render on it. `registeredTags()` returns the registered tag list. A failed
|
|
271
|
+
dynamic import rejects at the `import()` call site.
|
|
272
|
+
|
|
253
273
|
Tags by tier (see `docs/ui.md` for attributes/events/examples per component):
|
|
254
274
|
- display: `ody-button`, `ody-tag`, `ody-alert`, `ody-card`, `ody-horizontal-divider`
|
|
255
275
|
(1px rule with a default `margin-block: var(--gap16)`; `spacing="tight"|"none"`),
|