@c1m-public/channel-client 0.19.0 → 0.21.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/dist/next.js CHANGED
@@ -1,69 +1,3 @@
1
- import "server-only";
2
- import { ChannelConfigurationError, createChannelClient } from "./index.js";
3
- /** Cache tags — mirrored from next-webhooks so the two files agree by name. */
4
- const SITE_TAG = "channel:site";
5
- const CATALOG_TAG = "channel:catalog";
6
- const CATALOG_PATH = /^\/api\/v1\/channel\/(products|categories|collections|brands)(\/|$|\?)/;
7
- /**
8
- * Default classifier: catalog reads → `channel:catalog`, all other anonymous
9
- * reads → `channel:site`. Exported so a site can compose it with its own tags.
10
- */
11
- export function defaultChannelCacheTags(pathname) {
12
- return CATALOG_PATH.test(pathname) ? [CATALOG_TAG] : [SITE_TAG];
13
- }
14
- function pathnameOf(input) {
15
- try {
16
- const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
17
- return new URL(url, "http://placeholder.invalid").pathname;
18
- }
19
- catch {
20
- return "";
21
- }
22
- }
23
- function validateCachePolicy(policy) {
24
- if (policy === "no-store")
25
- return;
26
- if (!Number.isFinite(policy.revalidate) || policy.revalidate < 0) {
27
- throw new ChannelConfigurationError("cache.revalidate must be a non-negative finite number");
28
- }
29
- }
30
- /**
31
- * Build the Channel API client with Next.js Data Cache semantics.
32
- *
33
- * Only anonymous GETs may receive `next.revalidate`; customer-scoped reads and
34
- * mutations are forced to `no-store` by both this adapter and the core client.
35
- */
36
- export function createNextChannelClient(options) {
37
- const { cache = "no-store", fetch: suppliedFetch, ...coreOptions } = options;
38
- validateCachePolicy(cache);
39
- const fetcher = suppliedFetch ?? globalThis.fetch;
40
- if (!fetcher)
41
- throw new ChannelConfigurationError("fetch implementation is required");
42
- const nextFetch = (input, init = {}) => {
43
- const request = { ...init };
44
- const method = (request.method ?? "GET").toUpperCase();
45
- const customerScoped = new Headers(request.headers).has("X-End-User-Token");
46
- if (method === "GET" && !customerScoped && cache !== "no-store") {
47
- delete request.cache;
48
- const classify = cache.tagsFor ?? defaultChannelCacheTags;
49
- const tags = Array.from(new Set([...(cache.tags ?? []), ...classify(pathnameOf(input))]));
50
- request.next = {
51
- revalidate: cache.revalidate,
52
- ...(tags.length ? { tags } : {}),
53
- };
54
- }
55
- else {
56
- delete request.next;
57
- request.cache = "no-store";
58
- }
59
- return fetcher(input, request);
60
- };
61
- return createChannelClient({ ...coreOptions, fetch: nextFetch });
62
- }
63
- // The kits: the ~600 lines of plumbing every headless site was copy-pasting —
64
- // session cookie + refresh decision, the webhook route, the cart's token
65
- // threading — shipped once, injection-shaped, framework-honest (no `next`
66
- // imports; apps pass next/cache + apply cookies where Next allows writes).
67
- export * from "./next-session.js";
68
- export * from "./next-webhooks.js";
69
- export * from "./next-cart.js";
1
+ export { CHANNEL_CATALOG_CACHE_TAG, CHANNEL_SITE_CACHE_TAG, cartCookie, createCart, createChannelWebhookRoute, createCustomerSession, createNextChannelClient, defaultChannelCacheTags, safePublishedPath, sessionCookie } from './chunk-BSTXJIVL.js';
2
+ import './chunk-C44TGKRK.js';
3
+ import './chunk-RJQ4YEZV.js';
@@ -1,7 +1,7 @@
1
1
  /** Framework-neutral canonical site-document traversal. UI packages provide
2
2
  * the block registry; this package owns document validation, responsive CSS
3
3
  * safety and deterministic tree traversal shared by hosted and headless sites. */
4
- export interface SiteBuilderNode {
4
+ interface SiteBuilderNode {
5
5
  id: string;
6
6
  kind: string;
7
7
  props?: Record<string, unknown>;
@@ -13,22 +13,22 @@ export interface SiteBuilderNode {
13
13
  };
14
14
  children?: SiteBuilderNode[];
15
15
  }
16
- export interface SiteBuilderDocument {
16
+ interface SiteBuilderDocument {
17
17
  zones: Array<{
18
18
  id: string;
19
19
  kind?: string;
20
20
  nodes: SiteBuilderNode[];
21
21
  }>;
22
22
  }
23
- export interface RenderBlockInput<T> {
23
+ interface RenderBlockInput<T> {
24
24
  node: SiteBuilderNode;
25
25
  children: T[];
26
26
  index: number;
27
27
  siblingCount: number;
28
28
  data?: unknown;
29
29
  }
30
- export type SiteBlockRegistry<T> = Record<string, (input: RenderBlockInput<T>) => T>;
31
- export interface RenderSiteOptions<T> {
30
+ type SiteBlockRegistry<T> = Record<string, (input: RenderBlockInput<T>) => T>;
31
+ interface RenderSiteOptions<T> {
32
32
  registry: SiteBlockRegistry<T>;
33
33
  dataByNodeId?: Record<string, unknown>;
34
34
  /** Exact node replacements for application-owned slots such as cart or
@@ -37,10 +37,12 @@ export interface RenderSiteOptions<T> {
37
37
  onUnknownBlock?: (node: SiteBuilderNode) => void;
38
38
  zone?: string;
39
39
  }
40
- export declare function isSiteBuilderDocument(value: unknown): value is SiteBuilderDocument;
41
- export declare function renderSiteDocument<T>(document: unknown, options: RenderSiteOptions<T>): T[];
42
- export declare function safeStyleRule(properties: Record<string, unknown>): string;
43
- export declare function collectResponsiveCSS(document: unknown, widths?: {
40
+ declare function isSiteBuilderDocument(value: unknown): value is SiteBuilderDocument;
41
+ declare function renderSiteDocument<T>(document: unknown, options: RenderSiteOptions<T>): T[];
42
+ declare function safeStyleRule(properties: Record<string, unknown>): string;
43
+ declare function collectResponsiveCSS(document: unknown, widths?: {
44
44
  mobile?: number;
45
45
  tablet?: number;
46
46
  }): string;
47
+
48
+ export { type RenderBlockInput, type RenderSiteOptions, type SiteBlockRegistry, type SiteBuilderDocument, type SiteBuilderNode, collectResponsiveCSS, isSiteBuilderDocument, renderSiteDocument, safeStyleRule };
package/dist/renderer.js CHANGED
@@ -1,101 +1,81 @@
1
- /** Framework-neutral canonical site-document traversal. UI packages provide
2
- * the block registry; this package owns document validation, responsive CSS
3
- * safety and deterministic tree traversal shared by hosted and headless sites. */
4
- export function isSiteBuilderDocument(value) {
5
- if (typeof value !== "object" || value === null)
6
- return false;
7
- const zones = value.zones;
8
- return Array.isArray(zones) && zones.every((zone) => typeof zone === "object" && zone !== null && typeof zone.id === "string" && Array.isArray(zone.nodes));
1
+ // src/renderer.ts
2
+ function isSiteBuilderDocument(value) {
3
+ if (typeof value !== "object" || value === null) return false;
4
+ const zones = value.zones;
5
+ return Array.isArray(zones) && zones.every(
6
+ (zone) => typeof zone === "object" && zone !== null && typeof zone.id === "string" && Array.isArray(zone.nodes)
7
+ );
9
8
  }
10
- export function renderSiteDocument(document, options) {
11
- if (!isSiteBuilderDocument(document))
12
- return [];
13
- const zone = document.zones.find((item) => item.kind === options.zone || item.id === options.zone)
14
- ?? document.zones.find((item) => item.kind === "body")
15
- ?? document.zones.find((item) => item.id === "body");
16
- if (!zone)
17
- return [];
18
- const renderNodes = (nodes) => nodes.flatMap((node, index) => {
19
- if (node.props?.hidden === true)
20
- return [];
21
- if (options.nodeOverrides && Object.prototype.hasOwnProperty.call(options.nodeOverrides, node.id)) {
22
- return [options.nodeOverrides[node.id]];
23
- }
24
- const renderer = options.registry[node.kind];
25
- if (!renderer) {
26
- options.onUnknownBlock?.(node);
27
- return [];
28
- }
29
- return [renderer({
30
- node,
31
- children: renderNodes(Array.isArray(node.children) ? node.children : []),
32
- index,
33
- siblingCount: nodes.length,
34
- data: options.dataByNodeId?.[node.id],
35
- })];
36
- });
37
- return renderNodes(zone.nodes);
9
+ function renderSiteDocument(document, options) {
10
+ if (!isSiteBuilderDocument(document)) return [];
11
+ const zone = document.zones.find((item) => item.kind === options.zone || item.id === options.zone) ?? document.zones.find((item) => item.kind === "body") ?? document.zones.find((item) => item.id === "body");
12
+ if (!zone) return [];
13
+ const renderNodes = (nodes) => nodes.flatMap((node, index) => {
14
+ if (node.props?.hidden === true) return [];
15
+ if (options.nodeOverrides && Object.prototype.hasOwnProperty.call(options.nodeOverrides, node.id)) {
16
+ return [options.nodeOverrides[node.id]];
17
+ }
18
+ const renderer = options.registry[node.kind];
19
+ if (!renderer) {
20
+ options.onUnknownBlock?.(node);
21
+ return [];
22
+ }
23
+ return [renderer({
24
+ node,
25
+ children: renderNodes(Array.isArray(node.children) ? node.children : []),
26
+ index,
27
+ siblingCount: nodes.length,
28
+ data: options.dataByNodeId?.[node.id]
29
+ })];
30
+ });
31
+ return renderNodes(zone.nodes);
38
32
  }
39
- const propertyPattern = /^(--[a-z0-9-]+|[a-z][a-z0-9-]*)$/;
40
- // Node styles are emitted inside a raw <style> element. Reject declaration and
41
- // rule breakout, CSS escapes and every resource-loading function. Builder
42
- // styles do not need external resources; assets belong in typed block props.
43
- const unsafeValuePattern = /[<>{};@\\]|(?:url|image-set|image|cross-fade)[\s\u00a0]*\(|expression[\s\u00a0]*\(|javascript[\s\u00a0]*:/i;
44
- export function safeStyleRule(properties) {
45
- return Object.entries(properties).flatMap(([property, value]) => {
46
- const cssProperty = property.replace(/[A-Z]/g, (character) => `-${character.toLowerCase()}`);
47
- if (!propertyPattern.test(cssProperty) || value === undefined || value === null || typeof value === "object")
48
- return [];
49
- const cssValue = String(value).trim();
50
- if (!cssValue || unsafeValuePattern.test(cssValue))
51
- return [];
52
- return [`${cssProperty}:${cssValue} !important`];
53
- }).join(";");
33
+ var propertyPattern = /^(--[a-z0-9-]+|[a-z][a-z0-9-]*)$/;
34
+ var unsafeValuePattern = /[<>{};@\\]|(?:url|image-set|image|cross-fade)[\s\u00a0]*\(|expression[\s\u00a0]*\(|javascript[\s\u00a0]*:/i;
35
+ function safeStyleRule(properties) {
36
+ return Object.entries(properties).flatMap(([property, value]) => {
37
+ const cssProperty = property.replace(/[A-Z]/g, (character) => `-${character.toLowerCase()}`);
38
+ if (!propertyPattern.test(cssProperty) || value === void 0 || value === null || typeof value === "object") return [];
39
+ const cssValue = String(value).trim();
40
+ if (!cssValue || unsafeValuePattern.test(cssValue)) return [];
41
+ return [`${cssProperty}:${cssValue} !important`];
42
+ }).join(";");
54
43
  }
55
- export function collectResponsiveCSS(document, widths = {}) {
56
- if (!isSiteBuilderDocument(document))
57
- return "";
58
- const mobile = widths.mobile ?? 390;
59
- const tablet = widths.tablet ?? 768;
60
- const rules = [];
61
- const walk = (nodes) => {
62
- for (const node of nodes) {
63
- const escapedID = node.id.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/[\r\n]/g, "");
64
- const selector = `[data-mml-nid="${escapedID}"]`;
65
- const visibility = normalizeResponsiveVisibility(node.props?.responsiveVisibility);
66
- const tabletRule = safeStyleRule(node.style?.tablet ?? {});
67
- const mobileRule = safeStyleRule(node.style?.mobile ?? {});
68
- const hoverRule = safeStyleRule(node.style?.hover ?? {});
69
- const focusRule = safeStyleRule(node.style?.focus ?? {});
70
- if (visibility.desktop === false)
71
- rules.push(`@media (min-width:${tablet + 1}px){${selector}{display:none !important}}`);
72
- if (visibility.tablet === false)
73
- rules.push(`@media (min-width:${mobile + 1}px) and (max-width:${tablet}px){${selector}{display:none !important}}`);
74
- if (visibility.mobile === false)
75
- rules.push(`@media (max-width:${mobile}px){${selector}{display:none !important}}`);
76
- if (tabletRule)
77
- rules.push(`@media (max-width:${tablet}px){${selector}{${tabletRule}}}`);
78
- if (mobileRule)
79
- rules.push(`@media (max-width:${mobile}px){${selector}{${mobileRule}}}`);
80
- if (hoverRule)
81
- rules.push(`${selector}:hover{${hoverRule}}`);
82
- if (focusRule)
83
- rules.push(`${selector}:focus{${focusRule}}`);
84
- walk(Array.isArray(node.children) ? node.children : []);
85
- }
86
- };
87
- for (const zone of document.zones)
88
- walk(zone.nodes);
89
- return rules.join("");
44
+ function collectResponsiveCSS(document, widths = {}) {
45
+ if (!isSiteBuilderDocument(document)) return "";
46
+ const mobile = widths.mobile ?? 390;
47
+ const tablet = widths.tablet ?? 768;
48
+ const rules = [];
49
+ const walk = (nodes) => {
50
+ for (const node of nodes) {
51
+ const escapedID = node.id.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/[\r\n]/g, "");
52
+ const selector = `[data-mml-nid="${escapedID}"]`;
53
+ const visibility = normalizeResponsiveVisibility(node.props?.responsiveVisibility);
54
+ const tabletRule = safeStyleRule(node.style?.tablet ?? {});
55
+ const mobileRule = safeStyleRule(node.style?.mobile ?? {});
56
+ const hoverRule = safeStyleRule(node.style?.hover ?? {});
57
+ const focusRule = safeStyleRule(node.style?.focus ?? {});
58
+ if (visibility.desktop === false) rules.push(`@media (min-width:${tablet + 1}px){${selector}{display:none !important}}`);
59
+ if (visibility.tablet === false) rules.push(`@media (min-width:${mobile + 1}px) and (max-width:${tablet}px){${selector}{display:none !important}}`);
60
+ if (visibility.mobile === false) rules.push(`@media (max-width:${mobile}px){${selector}{display:none !important}}`);
61
+ if (tabletRule) rules.push(`@media (max-width:${tablet}px){${selector}{${tabletRule}}}`);
62
+ if (mobileRule) rules.push(`@media (max-width:${mobile}px){${selector}{${mobileRule}}}`);
63
+ if (hoverRule) rules.push(`${selector}:hover{${hoverRule}}`);
64
+ if (focusRule) rules.push(`${selector}:focus{${focusRule}}`);
65
+ walk(Array.isArray(node.children) ? node.children : []);
66
+ }
67
+ };
68
+ for (const zone of document.zones) walk(zone.nodes);
69
+ return rules.join("");
90
70
  }
91
71
  function normalizeResponsiveVisibility(value) {
92
- if (typeof value !== "object" || value === null || Array.isArray(value))
93
- return {};
94
- const source = value;
95
- const result = {};
96
- for (const device of ["desktop", "tablet", "mobile"]) {
97
- if (typeof source[device] === "boolean")
98
- result[device] = source[device];
99
- }
100
- return result;
72
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
73
+ const source = value;
74
+ const result = {};
75
+ for (const device of ["desktop", "tablet", "mobile"]) {
76
+ if (typeof source[device] === "boolean") result[device] = source[device];
77
+ }
78
+ return result;
101
79
  }
80
+
81
+ export { collectResponsiveCSS, isSiteBuilderDocument, renderSiteDocument, safeStyleRule };
@@ -9,9 +9,9 @@
9
9
  * PII-free fields; fetch the detail back through the channel client. Data POSTed
10
10
  * to your server can never be reached by a GDPR erasure on ours.
11
11
  */
12
- export declare const CHANNEL_WEBHOOK_EVENT_TYPES: readonly ["order.created", "order.paid", "order.updated", "order.cancelled", "order.refunded", "lead.created", "review.submitted", "review.published", "page.published", "product.created", "product.updated", "product.deleted"];
13
- export type ChannelWebhookEventType = (typeof CHANNEL_WEBHOOK_EVENT_TYPES)[number];
14
- export interface OrderEventData {
12
+ declare const CHANNEL_WEBHOOK_EVENT_TYPES: readonly ["order.created", "order.paid", "order.updated", "order.cancelled", "order.refunded", "lead.created", "review.submitted", "review.published", "page.published", "product.created", "product.updated", "product.deleted"];
13
+ type ChannelWebhookEventType = (typeof CHANNEL_WEBHOOK_EVENT_TYPES)[number];
14
+ interface OrderEventData {
15
15
  order_id: string;
16
16
  order_number: string;
17
17
  status: string;
@@ -20,7 +20,7 @@ export interface OrderEventData {
20
20
  total_cents: number;
21
21
  created_at: string;
22
22
  }
23
- export interface LeadCreatedEventData {
23
+ interface LeadCreatedEventData {
24
24
  lead_id: string;
25
25
  source: string;
26
26
  created_at: string;
@@ -30,7 +30,7 @@ export interface LeadCreatedEventData {
30
30
  * nothing about whether the review was ever published. Useful for intake
31
31
  * analytics; do not use it to revalidate a reviews page.
32
32
  */
33
- export interface ReviewSubmittedEventData {
33
+ interface ReviewSubmittedEventData {
34
34
  rating: number;
35
35
  source: string;
36
36
  submitted_at: string;
@@ -39,13 +39,13 @@ export interface ReviewSubmittedEventData {
39
39
  * Fired when a review clears moderation. Unlike `review.submitted` this one
40
40
  * carries the review id — it is the event a reviews page revalidates on.
41
41
  */
42
- export interface ReviewPublishedEventData {
42
+ interface ReviewPublishedEventData {
43
43
  review_id: string;
44
44
  rating: number;
45
45
  source: string;
46
46
  published_at?: string;
47
47
  }
48
- export interface PagePublishedEventData {
48
+ interface PagePublishedEventData {
49
49
  page_id: string;
50
50
  route_pattern: string;
51
51
  title: string;
@@ -57,12 +57,12 @@ export interface PagePublishedEventData {
57
57
  * stock back through the channel client — a webhook body is a cache-busting
58
58
  * signal, not a data feed.
59
59
  */
60
- export interface ProductEventData {
60
+ interface ProductEventData {
61
61
  product_id: string;
62
62
  slug?: string;
63
63
  status?: string;
64
64
  }
65
- export interface ChannelWebhookEventDataMap {
65
+ interface ChannelWebhookEventDataMap {
66
66
  "order.created": OrderEventData;
67
67
  "order.paid": OrderEventData;
68
68
  "order.updated": OrderEventData;
@@ -76,7 +76,7 @@ export interface ChannelWebhookEventDataMap {
76
76
  "product.updated": ProductEventData;
77
77
  "product.deleted": ProductEventData;
78
78
  }
79
- export interface ChannelWebhookEvent<T extends ChannelWebhookEventType = ChannelWebhookEventType> {
79
+ interface ChannelWebhookEvent<T extends ChannelWebhookEventType = ChannelWebhookEventType> {
80
80
  /** The originating event id. Delivery is AT-LEAST-ONCE — use this to dedupe. */
81
81
  id: string;
82
82
  type: T;
@@ -87,11 +87,11 @@ export interface ChannelWebhookEvent<T extends ChannelWebhookEventType = Channel
87
87
  channel_id?: string;
88
88
  data: ChannelWebhookEventDataMap[T];
89
89
  }
90
- export type AnyChannelWebhookEvent = {
90
+ type AnyChannelWebhookEvent = {
91
91
  [T in ChannelWebhookEventType]: ChannelWebhookEvent<T>;
92
92
  }[ChannelWebhookEventType];
93
93
  /** A valid signed envelope for an event introduced by a newer API version. */
94
- export interface UnknownChannelWebhookEvent {
94
+ interface UnknownChannelWebhookEvent {
95
95
  id: string;
96
96
  type: string;
97
97
  api_version: string;
@@ -100,11 +100,11 @@ export interface UnknownChannelWebhookEvent {
100
100
  channel_id?: string;
101
101
  data: unknown;
102
102
  }
103
- export type ParsedChannelWebhookEvent = AnyChannelWebhookEvent | UnknownChannelWebhookEvent;
104
- export declare function isChannelWebhookEventType(value: string): value is ChannelWebhookEventType;
105
- export declare function isKnownChannelWebhookEvent(event: ParsedChannelWebhookEvent): event is AnyChannelWebhookEvent;
106
- export type ChannelWebhookVerificationCode = "missing_signature" | "missing_timestamp" | "invalid_timestamp" | "timestamp_out_of_tolerance" | "invalid_signature" | "invalid_payload";
107
- export declare class ChannelWebhookVerificationError extends Error {
103
+ type ParsedChannelWebhookEvent = AnyChannelWebhookEvent | UnknownChannelWebhookEvent;
104
+ declare function isChannelWebhookEventType(value: string): value is ChannelWebhookEventType;
105
+ declare function isKnownChannelWebhookEvent(event: ParsedChannelWebhookEvent): event is AnyChannelWebhookEvent;
106
+ type ChannelWebhookVerificationCode = "missing_signature" | "missing_timestamp" | "invalid_timestamp" | "timestamp_out_of_tolerance" | "invalid_signature" | "invalid_payload";
107
+ declare class ChannelWebhookVerificationError extends Error {
108
108
  readonly code: ChannelWebhookVerificationCode;
109
109
  constructor(message: string, code: ChannelWebhookVerificationCode);
110
110
  }
@@ -113,13 +113,13 @@ export declare class ChannelWebhookVerificationError extends Error {
113
113
  * transformed test bundles. Exported so any consumer writing its own route
114
114
  * handler can branch on "unverifiable request" without re-deriving this.
115
115
  */
116
- export declare function isChannelWebhookVerificationError(error: unknown): error is ChannelWebhookVerificationError;
117
- export declare const CHANNEL_WEBHOOK_SIGNATURE_HEADER = "X-C1M-Signature";
118
- export declare const CHANNEL_WEBHOOK_TIMESTAMP_HEADER = "X-C1M-Timestamp";
119
- export declare const CHANNEL_WEBHOOK_EVENT_ID_HEADER = "X-C1M-Event-ID";
116
+ declare function isChannelWebhookVerificationError(error: unknown): error is ChannelWebhookVerificationError;
117
+ declare const CHANNEL_WEBHOOK_SIGNATURE_HEADER = "X-C1M-Signature";
118
+ declare const CHANNEL_WEBHOOK_TIMESTAMP_HEADER = "X-C1M-Timestamp";
119
+ declare const CHANNEL_WEBHOOK_EVENT_ID_HEADER = "X-C1M-Event-ID";
120
120
  /** Five minutes. Bounds how long a captured request stays replayable. */
121
- export declare const DEFAULT_TOLERANCE_SECONDS = 300;
122
- export interface VerifyChannelWebhookSignatureOptions {
121
+ declare const DEFAULT_TOLERANCE_SECONDS = 300;
122
+ interface VerifyChannelWebhookSignatureOptions {
123
123
  /**
124
124
  * The RAW request body, exactly as received. Re-serializing a parsed object
125
125
  * (`JSON.stringify(await req.json())`) will not reproduce the signed bytes and
@@ -144,8 +144,8 @@ export interface VerifyChannelWebhookSignatureOptions {
144
144
  *
145
145
  * @throws {ChannelWebhookVerificationError} if the request is not authentic.
146
146
  */
147
- export declare function verifyChannelWebhookSignature(options: VerifyChannelWebhookSignatureOptions): Promise<void>;
148
- export interface ParseChannelWebhookEventOptions {
147
+ declare function verifyChannelWebhookSignature(options: VerifyChannelWebhookSignatureOptions): Promise<void>;
148
+ interface ParseChannelWebhookEventOptions {
149
149
  secret: string;
150
150
  toleranceSeconds?: number;
151
151
  now?: () => number;
@@ -172,4 +172,6 @@ export interface ParseChannelWebhookEventOptions {
172
172
  *
173
173
  * @throws {ChannelWebhookVerificationError} if the request is not authentic.
174
174
  */
175
- export declare function parseChannelWebhookEvent(request: Request, options: ParseChannelWebhookEventOptions): Promise<ParsedChannelWebhookEvent>;
175
+ declare function parseChannelWebhookEvent(request: Request, options: ParseChannelWebhookEventOptions): Promise<ParsedChannelWebhookEvent>;
176
+
177
+ export { type AnyChannelWebhookEvent, CHANNEL_WEBHOOK_EVENT_ID_HEADER, CHANNEL_WEBHOOK_EVENT_TYPES, CHANNEL_WEBHOOK_SIGNATURE_HEADER, CHANNEL_WEBHOOK_TIMESTAMP_HEADER, type ChannelWebhookEvent, type ChannelWebhookEventDataMap, type ChannelWebhookEventType, type ChannelWebhookVerificationCode, ChannelWebhookVerificationError, DEFAULT_TOLERANCE_SECONDS, type LeadCreatedEventData, type OrderEventData, type PagePublishedEventData, type ParseChannelWebhookEventOptions, type ParsedChannelWebhookEvent, type ProductEventData, type ReviewPublishedEventData, type ReviewSubmittedEventData, type UnknownChannelWebhookEvent, type VerifyChannelWebhookSignatureOptions, isChannelWebhookEventType, isChannelWebhookVerificationError, isKnownChannelWebhookEvent, parseChannelWebhookEvent, verifyChannelWebhookSignature };