@c1m-public/channel-client 0.27.0 → 0.29.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 +29 -0
- package/dist/{chunk-HOR5MOYI.js → chunk-EDG3ZGPF.js} +3 -2
- package/dist/{chunk-LRHQXWLD.js → chunk-KCYSLD37.js} +2 -1
- package/dist/{chunk-E5J5UOPS.js → chunk-LBOYLZ4J.js} +20 -0
- package/dist/dash-next.d.ts +1 -0
- package/dist/dash-next.js +3 -3
- package/dist/dash.d.ts +4 -2
- package/dist/dash.js +2 -2
- package/dist/index.d.ts +10 -1308
- package/dist/index.js +1 -1
- package/dist/next.d.ts +8 -3
- package/dist/next.js +2 -2
- package/dist/site.d.ts +107 -0
- package/dist/site.js +109 -0
- package/dist/types-DrmlZASd.d.ts +1360 -0
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -17,6 +17,10 @@ transport core.
|
|
|
17
17
|
- `@c1m-public/channel-client/dash` and `/dash/next` — the dash-scoped surface
|
|
18
18
|
(profile, directory, plans, leads, lead portal) with the same neutral/Next
|
|
19
19
|
split; see [The `/next` kits](#the-next-kits).
|
|
20
|
+
- `@c1m-public/channel-client/site` — what a public site serves, decided from
|
|
21
|
+
the `signals` block every bootstrap carries, plus the site-mode settings
|
|
22
|
+
helpers owner and operator screens share; see [`./site`](#site). Pure, no
|
|
23
|
+
transport, safe in a proxy or a client component.
|
|
20
24
|
- `@c1m-public/channel-client/moving-lead-model` — the moving-quote domain
|
|
21
25
|
model shared by dash sites and SaaSDash; no transport, optional `zod` peer.
|
|
22
26
|
|
|
@@ -273,6 +277,31 @@ methods and subscriptions. `pnpm contract:check` compares both client
|
|
|
273
277
|
inventories with the canonical server OpenAPI document when the repositories
|
|
274
278
|
are checked out together.
|
|
275
279
|
|
|
280
|
+
## `./site`
|
|
281
|
+
|
|
282
|
+
Every bootstrap (`dash.init`, `init.get`, `init.light`) carries the same
|
|
283
|
+
`signals` block: the public `site`, the server-decided `gate` (waitlist,
|
|
284
|
+
maintenance or private), the owner's `lifecycle`, `visibility` and
|
|
285
|
+
`site_enabled`. Decide a request from it and never recompute availability:
|
|
286
|
+
|
|
287
|
+
```ts
|
|
288
|
+
import { normalizeSignals, siteDecision } from "@c1m-public/channel-client/site";
|
|
289
|
+
|
|
290
|
+
const decision = siteDecision(normalizeSignals(init), pathname, { exempt: ["/account"] });
|
|
291
|
+
// serve | no-site | inactive | private | gate-page | redirect | rewrite
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
The order is the server's: no public site, then an inactive owner, then the
|
|
295
|
+
gate. `GATE_EXEMPT_PATHS` (legal, framework and crawler paths) are always
|
|
296
|
+
served. `private` means the public may not see the site; a site with member
|
|
297
|
+
sessions checks membership before showing its private page. A backend that
|
|
298
|
+
predates `signals` is read from its top-level `gate` as an active, public
|
|
299
|
+
site.
|
|
300
|
+
|
|
301
|
+
`SITE_MODE_CHOICES`, `siteModeChoice`, `withSiteModeChoice`,
|
|
302
|
+
`describeLiveGate`, `toDateTimeLocal` and `fromDateTimeLocal` are the shared
|
|
303
|
+
pieces of a site-mode settings form.
|
|
304
|
+
|
|
276
305
|
## `./moving-lead-model`
|
|
277
306
|
|
|
278
307
|
A subpath carrying the moving-quote domain model: lead payload schemas, the
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isChannelAPIError, createChannelClient } from './chunk-
|
|
1
|
+
import { isChannelAPIError, createChannelClient } from './chunk-LBOYLZ4J.js';
|
|
2
2
|
import { parseChannelWebhookEvent, isChannelWebhookVerificationError, isChannelWebhookEventType, ChannelConfigurationError } from './chunk-XPO7C3DW.js';
|
|
3
3
|
import 'server-only';
|
|
4
4
|
|
|
@@ -331,7 +331,8 @@ function createNextChannelClient(options) {
|
|
|
331
331
|
const method = (request.method ?? "GET").toUpperCase();
|
|
332
332
|
const pathname = pathnameOf(input);
|
|
333
333
|
const scoped = isRequestScoped(new Headers(request.headers), pathname);
|
|
334
|
-
|
|
334
|
+
const explicitNoStore = request.cache === "no-store";
|
|
335
|
+
if (method === "GET" && !scoped && !explicitNoStore && cache !== "no-store") {
|
|
335
336
|
delete request.cache;
|
|
336
337
|
const classify = cache.tagsFor ?? defaultChannelCacheTags;
|
|
337
338
|
const tags = Array.from(/* @__PURE__ */ new Set([...cache.tags ?? [], ...classify(pathname)]));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createChannelClient } from './chunk-
|
|
1
|
+
import { createChannelClient } from './chunk-LBOYLZ4J.js';
|
|
2
2
|
import 'server-only';
|
|
3
3
|
|
|
4
4
|
function narrow(client) {
|
|
@@ -6,6 +6,7 @@ function narrow(client) {
|
|
|
6
6
|
ping: client.ping,
|
|
7
7
|
geo: client.geo,
|
|
8
8
|
dash: client.dash,
|
|
9
|
+
audience: client.audience,
|
|
9
10
|
assetUrl: client.assetUrl,
|
|
10
11
|
withVisitor: (visitor) => narrow(client.withVisitor(visitor))
|
|
11
12
|
};
|
|
@@ -243,6 +243,21 @@ function createChannelClient(options) {
|
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
+
async function linkRequest(path, body) {
|
|
247
|
+
try {
|
|
248
|
+
const result = await performRequest(transport, `${baseUrl}/api/v1/public/audience${path}`, {
|
|
249
|
+
method: "POST",
|
|
250
|
+
headers: { "Content-Type": "application/json" },
|
|
251
|
+
body: JSON.stringify(body),
|
|
252
|
+
cache: "no-store"
|
|
253
|
+
});
|
|
254
|
+
return result.payload;
|
|
255
|
+
} catch (error) {
|
|
256
|
+
if (!isTransportError(error)) throw error;
|
|
257
|
+
const { status, code, message, requestId } = error.failure;
|
|
258
|
+
throw new ChannelAPIError(message || "Audience link request failed", status, code || "audience_link_failed", requestId);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
246
261
|
function mutationHeaders(mutation) {
|
|
247
262
|
return mutation?.idempotencyKey ? { "Idempotency-Key": mutation.idempotencyKey } : void 0;
|
|
248
263
|
}
|
|
@@ -274,6 +289,11 @@ function createChannelClient(options) {
|
|
|
274
289
|
{ cache: "no-store" }
|
|
275
290
|
)
|
|
276
291
|
},
|
|
292
|
+
/** Confirmation and unsubscribe links from waitlist emails. */
|
|
293
|
+
audience: {
|
|
294
|
+
verify: (token2) => linkRequest("/verify", { token: required(token2, "token") }),
|
|
295
|
+
unsubscribe: (key) => linkRequest("/unsubscribe", { key: required(key, "key") })
|
|
296
|
+
},
|
|
277
297
|
/** Tenant-level data exposed only to a dash-scoped channel token. */
|
|
278
298
|
dash: {
|
|
279
299
|
profile: () => request("channel.dash.profile", "/dash/profile"),
|
package/dist/dash-next.d.ts
CHANGED
package/dist/dash-next.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createNextChannelClient } from './chunk-
|
|
2
|
-
import { narrow } from './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
import { createNextChannelClient } from './chunk-EDG3ZGPF.js';
|
|
2
|
+
import { narrow } from './chunk-KCYSLD37.js';
|
|
3
|
+
import './chunk-LBOYLZ4J.js';
|
|
4
4
|
import './chunk-XPO7C3DW.js';
|
|
5
5
|
import 'server-only';
|
|
6
6
|
|
package/dist/dash.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createChannelClient, ChannelVisitor, CreateChannelClientOptions } from './index.js';
|
|
2
|
+
import './types-DrmlZASd.js';
|
|
2
3
|
import './webhooks.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -12,9 +13,10 @@ import './webhooks.js';
|
|
|
12
13
|
*
|
|
13
14
|
* `ping` and `geo` are deliberately included: both are scope-agnostic on the
|
|
14
15
|
* door (the credential self-check must answer for either scope, and geo lets
|
|
15
|
-
* a dash site localise pricing).
|
|
16
|
+
* a dash site localise pricing). `audience` is the scope-free email-link
|
|
17
|
+
* surface every waitlist site needs.
|
|
16
18
|
*/
|
|
17
|
-
type DashChannelClient = Pick<ReturnType<typeof createChannelClient>, "ping" | "geo" | "dash" | "assetUrl"> & {
|
|
19
|
+
type DashChannelClient = Pick<ReturnType<typeof createChannelClient>, "ping" | "geo" | "dash" | "audience" | "assetUrl"> & {
|
|
18
20
|
/** Request-scoped clone carrying signed visitor metadata (see ChannelVisitor). */
|
|
19
21
|
withVisitor(visitor: ChannelVisitor): DashChannelClient;
|
|
20
22
|
};
|
package/dist/dash.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { createDashChannelClient, narrow as narrowToDash } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { createDashChannelClient, narrow as narrowToDash } from './chunk-KCYSLD37.js';
|
|
2
|
+
import './chunk-LBOYLZ4J.js';
|
|
3
3
|
import './chunk-XPO7C3DW.js';
|