@peektravel/app-utilities 0.9.0 → 0.9.2
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 +6 -3
- package/dist/index.cjs +152 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +113 -57
- package/dist/index.d.ts +113 -57
- package/dist/index.js +152 -41
- package/dist/index.js.map +1 -1
- package/docs/webhooks.md +11 -8
- package/llms.txt +25 -8
- package/package.json +1 -1
package/docs/webhooks.md
CHANGED
|
@@ -301,14 +301,17 @@ event**, so persist them alongside `installId`/`accountId`:
|
|
|
301
301
|
- **`timezone`** — the account's IANA zone (e.g. `America/New_York`). Downstream
|
|
302
302
|
date/time handling for the install (scheduling, day boundaries, display) needs
|
|
303
303
|
the account's own zone, not the server's.
|
|
304
|
-
- **`apiUrl`** — the **
|
|
305
|
-
|
|
306
|
-
decompose it or append your own app id.
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
304
|
+
- **`apiUrl`** — the **base API URL** the registry serves this install from.
|
|
305
|
+
Store it and pass it straight through as the access service's **`apiUrl`**: do
|
|
306
|
+
not decompose it or append your own app id. Each service class appends its own
|
|
307
|
+
backoffice slug (e.g. `peek_backoffice_api-v1`) when it makes a call, so a Peek
|
|
308
|
+
GraphQL call POSTs to `<base>/peek_backoffice_api-v1` and a CNG/ACME REST call
|
|
309
|
+
hits `<base>/<slug>/<path>`. If the URL you pass already carries this platform's
|
|
310
|
+
slug (dashes or underscores) it is stripped back to the base; a URL carrying a
|
|
311
|
+
*different* platform's slug makes the constructor throw. If the registry tags
|
|
312
|
+
traffic with an app id in the path, that is the registry's concern and opaque to
|
|
313
|
+
you. Or hand the whole install to `createAccessServiceForInstall` (below), which
|
|
314
|
+
wires it for you.
|
|
312
315
|
|
|
313
316
|
Both default to `""` when a delivery omits them, so treat empty as "not
|
|
314
317
|
reported" and keep any value you previously stored.
|
package/llms.txt
CHANGED
|
@@ -22,7 +22,7 @@ const peek = new PeekAccessService({
|
|
|
22
22
|
installId, // JWT subject
|
|
23
23
|
jwtSecret, // HMAC secret signing the JWT
|
|
24
24
|
issuer, // app name (JWT issuer)
|
|
25
|
-
apiUrl, // the install webhook's apiUrl — the
|
|
25
|
+
apiUrl, // the install webhook's apiUrl — the base API URL; each service appends its own backoffice slug
|
|
26
26
|
// optional: gatewayKey, tokenTtlSeconds, tokenRefreshLeewaySeconds,
|
|
27
27
|
// retryDelaysMs, logger, fetch, itemOptionsPageSize,
|
|
28
28
|
// accessOptions: { fullCustomerAccess: false } // default — see "Access options / PII"
|
|
@@ -30,10 +30,15 @@ const peek = new PeekAccessService({
|
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
Targeting an install by URL: pass the install webhook's `apiUrl` as the config
|
|
33
|
-
`apiUrl
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
`apiUrl`. It is the install's **base API URL**; each service class appends its own
|
|
34
|
+
backoffice slug (e.g. `peek_backoffice_api-v1`, from a small per-platform endpoint
|
|
35
|
+
lookup) when it calls — so a Peek GraphQL call POSTs to `<base>/peek_backoffice_api-v1`
|
|
36
|
+
and a CNG/ACME REST call hits `<base>/<slug>/<path>`. If the URL you pass already
|
|
37
|
+
carries this platform's slug (dashes or underscores interchangeable) it is
|
|
38
|
+
**stripped** back to the base; a URL carrying a *different* platform's slug is
|
|
39
|
+
**rejected** (constructor throws). No app-id/gateway segment is inserted (`appId`
|
|
40
|
+
is unused). Any app id in the path is the registry's own traffic tag, opaque to
|
|
41
|
+
callers. `createAccessServiceForInstall(install, config)`
|
|
37
42
|
builds the right service for `install.platform` (`peek`/`cng`/`acme`) wired to
|
|
38
43
|
`install.apiUrl` in one call (throws on unknown/`null` platform). `appId` +
|
|
39
44
|
`baseUrl` (and the hardcoded gateway default) are **`@deprecated`** — they
|
|
@@ -134,15 +139,22 @@ final authority and may still reject the request.
|
|
|
134
139
|
`makePayment(input)`, `refund(input)`, `createInvoiceLink(id)`,
|
|
135
140
|
`listAddons(id)`, `addAddon(id, {addonOptionId, quantity})`,
|
|
136
141
|
`removeAddon(id, {addonOptionId, quantity})`, `create(input)`
|
|
142
|
+
- `getReviewService()` — `getReviews(productId, reviewCount?, reviewOffset?)`
|
|
143
|
+
(single newest-first page of `Review`s, count 1–50, offset ≥ 0);
|
|
144
|
+
`getAllReviewSummaries()` → `ProductReviewSummary[]` (one per activity:
|
|
145
|
+
`avgRating` — decimal, `null` when no ratings — plus `countTotal` and per-star
|
|
146
|
+
`countOneStar`…`countFiveStar`). No PII; unaffected by `fullCustomerAccess`.
|
|
137
147
|
|
|
138
148
|
## Sibling accessors (CNG, ACME — REST, not GraphQL)
|
|
139
149
|
|
|
140
150
|
Two brand-parallel accessors sit alongside `PeekAccessService` and share the same
|
|
141
151
|
auth/transport/UI plumbing. Both are **REST** and deliberately minimal today
|
|
142
152
|
(products only). Construct one per install, same config shape **minus `gatewayKey`**
|
|
143
|
-
(`installId`, `jwtSecret`, `issuer`, `apiUrl`). With `apiUrl` set, it is the
|
|
144
|
-
|
|
145
|
-
|
|
153
|
+
(`installId`, `jwtSecret`, `issuer`, `apiUrl`). With `apiUrl` set, it is the base
|
|
154
|
+
API URL and the product service appends its backoffice slug (`cng_backoffice_api-v1` /
|
|
155
|
+
`acme_backoffice_api-v1`) and the REST path (`<base>/<slug>/<path>`); the
|
|
156
|
+
deprecated `baseUrl`/`appId` fall back to the app-registry installations API
|
|
157
|
+
default (`<baseUrl>/<appId>` as the base). `createAccessServiceForInstall` routes
|
|
146
158
|
`platform` `"cng"`/`"acme"` to these.
|
|
147
159
|
|
|
148
160
|
- `CngAccessService` — `getProductService().getAllActivities()` (short-form
|
|
@@ -183,6 +195,11 @@ stay internal.
|
|
|
183
195
|
additionally enforces that every required (non-per-guest) custom question is
|
|
184
196
|
answered — validation runs even when `customQuestionAnswers` is empty/omitted,
|
|
185
197
|
and an unanswered required question fails creation before the quote.
|
|
198
|
+
`CreateBookingInput.acceptAllCustomQuestionIds?: boolean` (default `false`)
|
|
199
|
+
relaxes the id check: a `cq_…` id not in the activity's question list is
|
|
200
|
+
accepted as a plain text answer instead of failing creation (by-name answers
|
|
201
|
+
still must match). When every answer is by id (and no required check runs) the
|
|
202
|
+
questions fetch is skipped entirely.
|
|
186
203
|
|
|
187
204
|
## Errors
|
|
188
205
|
|