@peektravel/app-utilities 0.9.4 → 1.0.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 +38 -3
- package/dist/index.cjs +149 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +86 -12
- package/dist/index.d.ts +86 -12
- package/dist/index.js +149 -66
- package/dist/index.js.map +1 -1
- package/docs/webhooks.md +6 -0
- package/llms.txt +20 -2
- package/package.json +1 -1
package/docs/webhooks.md
CHANGED
|
@@ -369,6 +369,12 @@ It throws if `install.platform` is `null` or unrecognised — an install with an
|
|
|
369
369
|
unknown platform has no service to route to, and silently defaulting would point
|
|
370
370
|
it at the wrong gateway.
|
|
371
371
|
|
|
372
|
+
`createAccessServiceForInstall` sets Peek's **required** `mode: "v2"` for you (a
|
|
373
|
+
registry install is always the v2 connection). If you construct `PeekAccessService`
|
|
374
|
+
by hand instead, `mode` is mandatory — pass `mode: "v2"` together with the
|
|
375
|
+
`apiUrl`. (`mode: "v1"` is the deprecated legacy gateway and needs `gatewayKey`;
|
|
376
|
+
see the README's *Connection mode* section.)
|
|
377
|
+
|
|
372
378
|
Prefer this (or the config's `apiUrl` field) over `baseUrl`/`appId`, which are
|
|
373
379
|
deprecated: they reconstruct the URL with a hardcoded gateway default that cannot
|
|
374
380
|
be correct for every install. **The hardcoded base-URL fallbacks will be removed
|
package/llms.txt
CHANGED
|
@@ -22,13 +22,25 @@ 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
|
+
mode: "v2", // REQUIRED connection generation: "v2" (registry, use going forward) | "v1" (legacy, deprecated)
|
|
25
26
|
apiUrl, // the install webhook's apiUrl — the base API URL; each service appends its own backoffice slug
|
|
26
|
-
// optional: gatewayKey, tokenTtlSeconds, tokenRefreshLeewaySeconds,
|
|
27
|
+
// optional: gatewayKey (v1 only), tokenTtlSeconds, tokenRefreshLeewaySeconds,
|
|
27
28
|
// retryDelaysMs, logger, fetch, itemOptionsPageSize,
|
|
28
29
|
// accessOptions: { fullCustomerAccess: false } // default — see "Access options / PII"
|
|
29
30
|
});
|
|
30
31
|
```
|
|
31
32
|
|
|
33
|
+
`mode` is **required** — choose the connection explicitly. `"v2"` is the
|
|
34
|
+
app-registry connection and **requires** the install webhook's `apiUrl` (persisted
|
|
35
|
+
per install); the constructor throws without it. If you don't have a webhook
|
|
36
|
+
`apiUrl` yet, build one by appending your **app slug** to the registry prefix and
|
|
37
|
+
pass that: `https://apps.peek.com/installations-api/<app-slug>` (same shape as the
|
|
38
|
+
webhook's `api.url`; the trailing app-slug segment is required — the prefix alone
|
|
39
|
+
is not a valid URL). Transitional bridge — prefer the webhook URL. `"v1"` is the legacy gateway
|
|
40
|
+
(needs `appId` + `gatewayKey`) and is **`@deprecated`** — passing `mode: "v1"` is
|
|
41
|
+
the fastest update for an install that relied on the old implicit default, but
|
|
42
|
+
migrate to `"v2"`. Omitting `mode` throws from the constructor.
|
|
43
|
+
|
|
32
44
|
Targeting an install by URL: pass the install webhook's `apiUrl` as the config
|
|
33
45
|
`apiUrl`. It is the install's **base API URL**; each service class appends its own
|
|
34
46
|
backoffice slug (e.g. `peek_backoffice_api-v1`, from a small per-platform endpoint
|
|
@@ -56,7 +68,7 @@ per call, and applies to every service that access service hands out.
|
|
|
56
68
|
|
|
57
69
|
```ts
|
|
58
70
|
const peek = new PeekAccessService({
|
|
59
|
-
installId, jwtSecret, issuer,
|
|
71
|
+
installId, jwtSecret, issuer, mode: "v2", apiUrl,
|
|
60
72
|
accessOptions: { fullCustomerAccess: true }, // opt in to PII + payment ops
|
|
61
73
|
});
|
|
62
74
|
```
|
|
@@ -166,6 +178,12 @@ final authority and may still reject the request.
|
|
|
166
178
|
`getAllReviewSummaries()` → `ProductReviewSummary[]` (one per activity:
|
|
167
179
|
`avgRating` — decimal, `null` when no ratings — plus `countTotal` and per-star
|
|
168
180
|
`countOneStar`…`countFiveStar`). No PII; unaffected by `fullCustomerAccess`.
|
|
181
|
+
- `getCustomQuestionService()` — `getAll()` returns every custom question defined
|
|
182
|
+
on the account (across all activities) as the same `CustomQuestion[]` shape as
|
|
183
|
+
`getProductService().getCustomQuestions(productId)`. The account-wide catalog
|
|
184
|
+
carries no per-activity config, so `order` is `0` and `isRequired` is `false` on
|
|
185
|
+
every entry. Question definitions, not answers — no PII; unaffected by
|
|
186
|
+
`fullCustomerAccess`.
|
|
169
187
|
|
|
170
188
|
## Sibling accessors (CNG, ACME — REST, not GraphQL)
|
|
171
189
|
|