@c1m-public/channel-client 0.22.0 → 0.24.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.
@@ -1,4 +1,4 @@
1
- import { createChannelClient } from './chunk-S74HRBIF.js';
1
+ import { createChannelClient } from './chunk-LG43JMFW.js';
2
2
  import 'server-only';
3
3
 
4
4
  function narrow(client) {
@@ -1,5 +1,5 @@
1
- import { isChannelAPIError, createChannelClient } from './chunk-S74HRBIF.js';
2
- import { parseChannelWebhookEvent, isChannelWebhookVerificationError, isChannelWebhookEventType, ChannelConfigurationError } from './chunk-RJQ4YEZV.js';
1
+ import { isChannelAPIError, createChannelClient } from './chunk-LG43JMFW.js';
2
+ import { parseChannelWebhookEvent, isChannelWebhookVerificationError, isChannelWebhookEventType, ChannelConfigurationError } from './chunk-P3HX34X7.js';
3
3
  import 'server-only';
4
4
 
5
5
  var MAX_AGE_SECONDS = 60 * 60 * 24 * 30;
@@ -153,11 +153,18 @@ function errorMessage(error) {
153
153
  return error instanceof Error ? error.message : String(error);
154
154
  }
155
155
  function defaultBehavior(event, invalidate) {
156
- if (event.type === "page.published") {
156
+ if (event.type === "menu.updated") {
157
+ invalidate.revalidateTag(CHANNEL_SITE_CACHE_TAG);
158
+ return void 0;
159
+ }
160
+ if (event.type === "page.published" || event.type === "page.updated" || event.type === "page.deleted") {
157
161
  const path = safePublishedPath(event.data.route_pattern);
158
- if (!path) throw new Error("page.published contains an invalid route_pattern");
162
+ if (!path) throw new Error(`${event.type} contains an invalid route_pattern`);
163
+ const previous = event.data.previous_route_pattern === void 0 ? void 0 : safePublishedPath(event.data.previous_route_pattern);
164
+ if (event.data.previous_route_pattern !== void 0 && !previous) throw new Error(`${event.type} contains an invalid previous_route_pattern`);
159
165
  invalidate.revalidateTag(CHANNEL_SITE_CACHE_TAG);
160
166
  invalidate.revalidatePath(path);
167
+ if (previous && previous !== path) invalidate.revalidatePath(previous);
161
168
  return path;
162
169
  }
163
170
  if (event.type === "product.created" || event.type === "product.updated" || event.type === "product.deleted") {
@@ -305,6 +312,13 @@ function validateCachePolicy(policy) {
305
312
  throw new ChannelConfigurationError("cache.revalidate must be a non-negative finite number");
306
313
  }
307
314
  }
315
+ function isRequestScoped(headers, pathname) {
316
+ if (headers.has("X-End-User-Token")) return true;
317
+ for (const name of headers.keys()) {
318
+ if (name.toLowerCase().startsWith("x-c1m-visitor-")) return true;
319
+ }
320
+ return pathname === "/api/v1/channel/ping";
321
+ }
308
322
  function createNextChannelClient(options) {
309
323
  const { cache = "no-store", fetch: suppliedFetch, ...coreOptions } = options;
310
324
  validateCachePolicy(cache);
@@ -313,11 +327,12 @@ function createNextChannelClient(options) {
313
327
  const nextFetch = (input, init = {}) => {
314
328
  const request = { ...init };
315
329
  const method = (request.method ?? "GET").toUpperCase();
316
- const customerScoped = new Headers(request.headers).has("X-End-User-Token");
317
- if (method === "GET" && !customerScoped && cache !== "no-store") {
330
+ const pathname = pathnameOf(input);
331
+ const scoped = isRequestScoped(new Headers(request.headers), pathname);
332
+ if (method === "GET" && !scoped && cache !== "no-store") {
318
333
  delete request.cache;
319
334
  const classify = cache.tagsFor ?? defaultChannelCacheTags;
320
- const tags = Array.from(/* @__PURE__ */ new Set([...cache.tags ?? [], ...classify(pathnameOf(input))]));
335
+ const tags = Array.from(/* @__PURE__ */ new Set([...cache.tags ?? [], ...classify(pathname)]));
321
336
  request.next = {
322
337
  revalidate: cache.revalidate,
323
338
  ...tags.length ? { tags } : {}
@@ -1,32 +1,8 @@
1
- import { ChannelConfigurationError } from './chunk-RJQ4YEZV.js';
1
+ import { ChannelConfigurationError } from './chunk-P3HX34X7.js';
2
2
  import 'server-only';
3
3
 
4
- // ../transport/src/index.ts
4
+ // ../resilience/src/index.ts
5
5
  var RETRYABLE_STATUSES = /* @__PURE__ */ new Set([429, 502, 503, 504]);
6
- var TransportError = class extends Error {
7
- constructor(failure) {
8
- super(failure.message || failure.outcome);
9
- this.failure = failure;
10
- this.name = "TransportError";
11
- }
12
- failure;
13
- };
14
- function isTransportError(error) {
15
- return error instanceof TransportError || typeof error === "object" && error !== null && error.name === "TransportError";
16
- }
17
- function positiveNumber(value, label, fail) {
18
- if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) throw fail(`${label} must be a positive finite number`);
19
- return value;
20
- }
21
- function nonNegativeInteger(value, label, fail) {
22
- if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) throw fail(`${label} must be a non-negative safe integer`);
23
- return value;
24
- }
25
- function requiredString(value, label, fail) {
26
- const normalized = typeof value === "string" ? value.trim() : "";
27
- if (!normalized) throw fail(`${label} is required`);
28
- return normalized;
29
- }
30
6
  function backoffDelay(attempt, maxDelayMs) {
31
7
  const base = Math.min(250 * 2 ** Math.max(attempt, 0), maxDelayMs);
32
8
  return Math.floor(Math.random() * base);
@@ -52,6 +28,32 @@ function isRetryableRequest(method, headers, retry) {
52
28
  if (method === "GET") return true;
53
29
  return retry.idempotentWrites === true && headers.has("Idempotency-Key");
54
30
  }
31
+
32
+ // ../transport/src/index.ts
33
+ var TransportError = class extends Error {
34
+ constructor(failure) {
35
+ super(failure.message || failure.outcome);
36
+ this.failure = failure;
37
+ this.name = "TransportError";
38
+ }
39
+ failure;
40
+ };
41
+ function isTransportError(error) {
42
+ return error instanceof TransportError || typeof error === "object" && error !== null && error.name === "TransportError";
43
+ }
44
+ function positiveNumber(value, label, fail) {
45
+ if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) throw fail(`${label} must be a positive finite number`);
46
+ return value;
47
+ }
48
+ function nonNegativeInteger(value, label, fail) {
49
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) throw fail(`${label} must be a non-negative safe integer`);
50
+ return value;
51
+ }
52
+ function requiredString(value, label, fail) {
53
+ const normalized = typeof value === "string" ? value.trim() : "";
54
+ if (!normalized) throw fail(`${label} is required`);
55
+ return normalized;
56
+ }
55
57
  async function performRequest(transport, url, init, observe, decode) {
56
58
  const method = (init.method ?? "GET").toUpperCase();
57
59
  const headers = new Headers(init.headers);
@@ -328,6 +330,7 @@ function createChannelClient(options) {
328
330
  },
329
331
  collections: {
330
332
  list: (params = {}) => request("channel.catalog.collections.list", appendQuery("/collections", params)),
333
+ get: (slug) => request("shop.public.collections.get.channel", `/collections/by-slug/${encodePath(slug)}`),
331
334
  products: (slug) => request("channel.catalog.collections.products", `/collections/by-slug/${encodePath(slug)}/products`)
332
335
  },
333
336
  brands: {
@@ -476,7 +479,7 @@ function createChannelClient(options) {
476
479
  }
477
480
  },
478
481
  dining: {
479
- menu: (boardSlug) => request("dining.public.board_menu.channel", `/dining/boards/${encodePath(boardSlug)}/menu`)
482
+ menu: (boardSlug) => request("menu.public.board_menu.channel", `/menu/boards/${encodePath(boardSlug)}/menu`)
480
483
  },
481
484
  // Customer sign-in. These are anonymous calls — they CREATE a session.
482
485
  auth: {
@@ -9,21 +9,11 @@ function isChannelConfigurationError(error) {
9
9
  return error instanceof ChannelConfigurationError || typeof error === "object" && error !== null && error.name === "ChannelConfigurationError";
10
10
  }
11
11
 
12
+ // src/generated/webhook-events.ts
13
+ var GENERATED_CHANNEL_WEBHOOK_EVENT_TYPES = ["order.created", "order.paid", "order.updated", "order.cancelled", "order.refunded", "lead.created", "review.submitted", "review.published", "page.published", "page.updated", "page.deleted", "menu.updated", "product.created", "product.updated", "product.deleted"];
14
+
12
15
  // src/webhooks.ts
13
- var CHANNEL_WEBHOOK_EVENT_TYPES = [
14
- "order.created",
15
- "order.paid",
16
- "order.updated",
17
- "order.cancelled",
18
- "order.refunded",
19
- "lead.created",
20
- "review.submitted",
21
- "review.published",
22
- "page.published",
23
- "product.created",
24
- "product.updated",
25
- "product.deleted"
26
- ];
16
+ var CHANNEL_WEBHOOK_EVENT_TYPES = GENERATED_CHANNEL_WEBHOOK_EVENT_TYPES;
27
17
  function isChannelWebhookEventType(value) {
28
18
  return CHANNEL_WEBHOOK_EVENT_TYPES.includes(value);
29
19
  }
@@ -168,8 +158,12 @@ function isKnownEventData(type, value) {
168
158
  return hasStrings(value, ["source", "submitted_at"]) && typeof value.rating === "number";
169
159
  case "review.published":
170
160
  return hasStrings(value, ["review_id", "source"]) && typeof value.rating === "number" && (value.published_at === void 0 || typeof value.published_at === "string");
161
+ case "menu.updated":
162
+ return typeof value.handle === "string" && value.handle.trim().length > 0;
163
+ case "page.updated":
164
+ case "page.deleted":
171
165
  case "page.published":
172
- return hasStrings(value, ["page_id", "route_pattern", "title"]) && (value.published_at === void 0 || typeof value.published_at === "string");
166
+ return hasStrings(value, ["page_id", "route_pattern", "title"]) && (value.published_at === void 0 || typeof value.published_at === "string") && (value.previous_route_pattern === void 0 || typeof value.previous_route_pattern === "string");
173
167
  case "product.created":
174
168
  case "product.updated":
175
169
  case "product.deleted":
package/dist/dash-next.js CHANGED
@@ -1,7 +1,7 @@
1
- import { createNextChannelClient } from './chunk-L6GZU55H.js';
2
- import { narrow } from './chunk-KXPPMNNQ.js';
3
- import './chunk-S74HRBIF.js';
4
- import './chunk-RJQ4YEZV.js';
1
+ import { createNextChannelClient } from './chunk-6VQ4ZTZI.js';
2
+ import { narrow } from './chunk-3K45GH6B.js';
3
+ import './chunk-LG43JMFW.js';
4
+ import './chunk-P3HX34X7.js';
5
5
  import 'server-only';
6
6
 
7
7
  function createNextDashChannelClient(options) {
package/dist/dash.js CHANGED
@@ -1,3 +1,3 @@
1
- export { createDashChannelClient, narrow as narrowToDash } from './chunk-KXPPMNNQ.js';
2
- import './chunk-S74HRBIF.js';
3
- import './chunk-RJQ4YEZV.js';
1
+ export { createDashChannelClient, narrow as narrowToDash } from './chunk-3K45GH6B.js';
2
+ import './chunk-LG43JMFW.js';
3
+ import './chunk-P3HX34X7.js';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { AnyChannelWebhookEvent, CHANNEL_WEBHOOK_EVENT_ID_HEADER, CHANNEL_WEBHOOK_EVENT_TYPES, CHANNEL_WEBHOOK_SIGNATURE_HEADER, CHANNEL_WEBHOOK_TIMESTAMP_HEADER, ChannelWebhookEvent, ChannelWebhookEventDataMap, ChannelWebhookEventType, ChannelWebhookVerificationCode, ChannelWebhookVerificationError, DEFAULT_TOLERANCE_SECONDS, LeadCreatedEventData, OrderEventData, PagePublishedEventData, ParseChannelWebhookEventOptions, ParsedChannelWebhookEvent, ProductEventData, ReviewPublishedEventData, ReviewSubmittedEventData, UnknownChannelWebhookEvent, VerifyChannelWebhookSignatureOptions, isChannelWebhookEventType, isChannelWebhookVerificationError, isKnownChannelWebhookEvent, parseChannelWebhookEvent, verifyChannelWebhookSignature } from './webhooks.js';
1
+ export { AnyChannelWebhookEvent, CHANNEL_WEBHOOK_EVENT_ID_HEADER, CHANNEL_WEBHOOK_EVENT_TYPES, CHANNEL_WEBHOOK_SIGNATURE_HEADER, CHANNEL_WEBHOOK_TIMESTAMP_HEADER, ChannelWebhookEvent, ChannelWebhookEventDataMap, ChannelWebhookEventType, ChannelWebhookVerificationCode, ChannelWebhookVerificationError, DEFAULT_TOLERANCE_SECONDS, LeadCreatedEventData, MenuUpdatedEventData, OrderEventData, PagePublishedEventData, ParseChannelWebhookEventOptions, ParsedChannelWebhookEvent, ProductEventData, ReviewPublishedEventData, ReviewSubmittedEventData, UnknownChannelWebhookEvent, VerifyChannelWebhookSignatureOptions, isChannelWebhookEventType, isChannelWebhookVerificationError, isKnownChannelWebhookEvent, parseChannelWebhookEvent, verifyChannelWebhookSignature } from './webhooks.js';
2
2
 
3
3
  interface ListResponse<T> {
4
4
  items: T[];
@@ -59,8 +59,8 @@ interface LightInitResponse {
59
59
  logo_dark_url?: string;
60
60
  logo_square_url?: string;
61
61
  enabled_features: string[];
62
- preferences?: {
63
- currency?: string;
62
+ settings?: {
63
+ currency_code?: string;
64
64
  locale?: string;
65
65
  timezone?: string;
66
66
  };
@@ -118,7 +118,7 @@ interface DashInitResponse {
118
118
  }
119
119
  interface DashPublicPage {
120
120
  profile: DashPublicProfileInfo & {
121
- tenant_id: string;
121
+ dash_id: string;
122
122
  status: string;
123
123
  display_name?: string;
124
124
  is_private: boolean;
@@ -367,6 +367,7 @@ interface CatalogCollection {
367
367
  title: string;
368
368
  slug: string;
369
369
  description?: string;
370
+ product_count?: number;
370
371
  created_at: string;
371
372
  updated_at: string;
372
373
  }
@@ -1341,7 +1342,7 @@ interface ChannelVisitor {
1341
1342
  userAgent?: string;
1342
1343
  }
1343
1344
  type ChannelRequestOutcome = "success" | "api_error" | "network_error" | "timeout" | "invalid_response" | "cancelled";
1344
- type ChannelOperation = "channel.ping" | "channel.geo.detect" | "channel.site.resolve" | "channel.init.get" | "channel.init.light" | "content.pages.public.list.channel" | "content.pages.public.get.channel" | "shop.public.products.list.channel" | "shop.public.products.get.channel" | "shop.public.products.media.channel" | "reviews.public.list.channel" | "reviews.public.summary.channel" | "reviews.public.submit.channel" | "channel.theme.get" | "channel.menus.get" | "channel.blog.get" | "channel.blog.list" | "channel.payments.availability" | "channel.giving.entries.list" | "channel.giving.entries.get" | "channel.giving.start" | "channel.subscriptions.plans.list" | "channel.subscriptions.plans.get" | "channel.subscriptions.start" | "monetization.payment_links.public_get.channel" | "monetization.payment_links.public_checkout.channel" | "monetization.payment_links.public_redemption_get.channel" | "channel.print.settings" | "channel.print.quote" | "channel.print.intake" | "dining.public.board_menu.channel" | "channel.auth.check" | "channel.auth.signup" | "channel.auth.send_code" | "channel.auth.verify_code" | "channel.auth.refresh" | "channel.auth.me" | "channel.auth.me.update" | "channel.auth.logout" | "channel.auth.sessions.list" | "channel.auth.sessions.revoke" | "channel.auth.sessions.revoke_others" | "channel.auth.sessions.revoke_all" | "channel.auth.security_activity.list" | "channel.account.addresses.list" | "channel.account.addresses.create" | "channel.account.addresses.get" | "channel.account.addresses.update" | "channel.account.addresses.delete" | "channel.account.addresses.set_default" | "channel.account.giving.list" | "channel.account.orders.list" | "channel.account.orders.summary" | "channel.account.orders.get" | "channel.account.payment_methods.list" | "channel.account.payment_methods.setup" | "channel.account.payment_methods.confirm" | "channel.account.payment_methods.default" | "channel.account.payment_methods.delete" | "channel.account.subscriptions.list" | "channel.account.subscriptions.get" | "channel.account.subscriptions.source" | "channel.account.subscriptions.cancel" | "channel.account.subscriptions.pause" | "channel.account.subscriptions.resume" | "channel.account.subscriptions.invoices.list" | "channel.account.subscriptions.invoices.get" | "channel.account.subscriptions.invoices.pay_now" | "channel.catalog.brands.list" | "channel.catalog.categories.list" | "channel.catalog.categories.products" | "channel.catalog.collections.list" | "channel.catalog.collections.products" | "channel.cart.get" | "channel.cart.items.add" | "channel.cart.items.update" | "channel.cart.items.remove" | "channel.cart.clear" | "channel.cart.merge" | "channel.checkout.options" | "channel.checkout.status" | "channel.checkout.customer.set" | "channel.checkout.addresses.set" | "channel.checkout.fulfillment.set" | "channel.checkout.pay" | "channel.dash.profile" | "channel.dash.init" | "channel.dash.plans" | "channel.dash.directory.regions" | "channel.dash.directory.browse" | "channel.dash.directory.get" | "channel.dash.leads.capture" | "channel.dash.lead_portal.my_quotes" | "channel.dash.lead_portal.request_link" | "growth.public_workspace.leads.capture.channel";
1345
+ type ChannelOperation = "channel.ping" | "channel.geo.detect" | "channel.site.resolve" | "channel.init.get" | "channel.init.light" | "content.pages.public.list.channel" | "content.pages.public.get.channel" | "shop.public.products.list.channel" | "shop.public.products.get.channel" | "shop.public.products.media.channel" | "reviews.public.list.channel" | "reviews.public.summary.channel" | "reviews.public.submit.channel" | "channel.theme.get" | "channel.menus.get" | "channel.blog.get" | "channel.blog.list" | "channel.payments.availability" | "channel.giving.entries.list" | "channel.giving.entries.get" | "channel.giving.start" | "channel.subscriptions.plans.list" | "channel.subscriptions.plans.get" | "channel.subscriptions.start" | "monetization.payment_links.public_get.channel" | "monetization.payment_links.public_checkout.channel" | "monetization.payment_links.public_redemption_get.channel" | "channel.print.settings" | "channel.print.quote" | "channel.print.intake" | "menu.public.board_menu.channel" | "channel.auth.check" | "channel.auth.signup" | "channel.auth.send_code" | "channel.auth.verify_code" | "channel.auth.refresh" | "channel.auth.me" | "channel.auth.me.update" | "channel.auth.logout" | "channel.auth.sessions.list" | "channel.auth.sessions.revoke" | "channel.auth.sessions.revoke_others" | "channel.auth.sessions.revoke_all" | "channel.auth.security_activity.list" | "channel.account.addresses.list" | "channel.account.addresses.create" | "channel.account.addresses.get" | "channel.account.addresses.update" | "channel.account.addresses.delete" | "channel.account.addresses.set_default" | "channel.account.giving.list" | "channel.account.orders.list" | "channel.account.orders.summary" | "channel.account.orders.get" | "channel.account.payment_methods.list" | "channel.account.payment_methods.setup" | "channel.account.payment_methods.confirm" | "channel.account.payment_methods.default" | "channel.account.payment_methods.delete" | "channel.account.subscriptions.list" | "channel.account.subscriptions.get" | "channel.account.subscriptions.source" | "channel.account.subscriptions.cancel" | "channel.account.subscriptions.pause" | "channel.account.subscriptions.resume" | "channel.account.subscriptions.invoices.list" | "channel.account.subscriptions.invoices.get" | "channel.account.subscriptions.invoices.pay_now" | "channel.catalog.brands.list" | "channel.catalog.categories.list" | "channel.catalog.categories.products" | "channel.catalog.collections.list" | "channel.catalog.collections.products" | "shop.public.collections.get.channel" | "channel.cart.get" | "channel.cart.items.add" | "channel.cart.items.update" | "channel.cart.items.remove" | "channel.cart.clear" | "channel.cart.merge" | "channel.checkout.options" | "channel.checkout.status" | "channel.checkout.customer.set" | "channel.checkout.addresses.set" | "channel.checkout.fulfillment.set" | "channel.checkout.pay" | "channel.dash.profile" | "channel.dash.init" | "channel.dash.plans" | "channel.dash.directory.regions" | "channel.dash.directory.browse" | "channel.dash.directory.get" | "channel.dash.leads.capture" | "channel.dash.lead_portal.my_quotes" | "channel.dash.lead_portal.request_link" | "growth.public_workspace.leads.capture.channel";
1345
1346
  interface ChannelRequestObservation {
1346
1347
  operation: ChannelOperation;
1347
1348
  method: string;
@@ -1476,6 +1477,9 @@ declare function createChannelClient(options: CreateChannelClientOptions): {
1476
1477
  };
1477
1478
  readonly collections: {
1478
1479
  readonly list: (params?: ChannelListParams) => Promise<ListResponse<CatalogCollection>>;
1480
+ readonly get: (slug: string) => Promise<{
1481
+ collection: CatalogCollection;
1482
+ }>;
1479
1483
  readonly products: (slug: string) => Promise<CatalogProductsResponse>;
1480
1484
  };
1481
1485
  readonly brands: {
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { ChannelAPIError, DEFAULT_CHANNEL_API_URL, createChannelClient, isChannelAPIError } from './chunk-S74HRBIF.js';
2
- export { CHANNEL_WEBHOOK_EVENT_ID_HEADER, CHANNEL_WEBHOOK_EVENT_TYPES, CHANNEL_WEBHOOK_SIGNATURE_HEADER, CHANNEL_WEBHOOK_TIMESTAMP_HEADER, ChannelConfigurationError, ChannelWebhookVerificationError, DEFAULT_TOLERANCE_SECONDS, isChannelConfigurationError, isChannelWebhookEventType, isChannelWebhookVerificationError, isKnownChannelWebhookEvent, parseChannelWebhookEvent, verifyChannelWebhookSignature } from './chunk-RJQ4YEZV.js';
1
+ export { ChannelAPIError, DEFAULT_CHANNEL_API_URL, createChannelClient, isChannelAPIError } from './chunk-LG43JMFW.js';
2
+ export { CHANNEL_WEBHOOK_EVENT_ID_HEADER, CHANNEL_WEBHOOK_EVENT_TYPES, CHANNEL_WEBHOOK_SIGNATURE_HEADER, CHANNEL_WEBHOOK_TIMESTAMP_HEADER, ChannelConfigurationError, ChannelWebhookVerificationError, DEFAULT_TOLERANCE_SECONDS, isChannelConfigurationError, isChannelWebhookEventType, isChannelWebhookVerificationError, isKnownChannelWebhookEvent, parseChannelWebhookEvent, verifyChannelWebhookSignature } from './chunk-P3HX34X7.js';
package/dist/next.d.ts CHANGED
@@ -275,8 +275,9 @@ declare function defaultChannelCacheTags(pathname: string): string[];
275
275
  /**
276
276
  * Build the Channel API client with Next.js Data Cache semantics.
277
277
  *
278
- * Only anonymous GETs may receive `next.revalidate`; customer-scoped reads and
279
- * mutations are forced to `no-store` by both this adapter and the core client.
278
+ * Only anonymous, unscoped GETs may receive `next.revalidate`; customer- or
279
+ * visitor-scoped reads, the attestation ping, and mutations are forced to
280
+ * `no-store` by this adapter (mutations also by the core client).
280
281
  */
281
282
  declare function createNextChannelClient(options: CreateNextChannelClientOptions): {
282
283
  readonly ping: (challenge?: string) => Promise<ChannelPing>;
@@ -333,6 +334,9 @@ declare function createNextChannelClient(options: CreateNextChannelClientOptions
333
334
  };
334
335
  readonly collections: {
335
336
  readonly list: (params?: ChannelListParams) => Promise<ListResponse<CatalogCollection>>;
337
+ readonly get: (slug: string) => Promise<{
338
+ collection: CatalogCollection;
339
+ }>;
336
340
  readonly products: (slug: string) => Promise<CatalogProductsResponse>;
337
341
  };
338
342
  readonly brands: {
package/dist/next.js CHANGED
@@ -1,3 +1,3 @@
1
- export { CHANNEL_CATALOG_CACHE_TAG, CHANNEL_SITE_CACHE_TAG, cartCookie, createCart, createChannelWebhookRoute, createCustomerSession, createNextChannelClient, defaultChannelCacheTags, safePublishedPath, sessionCookie } from './chunk-L6GZU55H.js';
2
- import './chunk-S74HRBIF.js';
3
- import './chunk-RJQ4YEZV.js';
1
+ export { CHANNEL_CATALOG_CACHE_TAG, CHANNEL_SITE_CACHE_TAG, cartCookie, createCart, createChannelWebhookRoute, createCustomerSession, createNextChannelClient, defaultChannelCacheTags, safePublishedPath, sessionCookie } from './chunk-6VQ4ZTZI.js';
2
+ import './chunk-LG43JMFW.js';
3
+ import './chunk-P3HX34X7.js';
@@ -9,7 +9,7 @@
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
- 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"];
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", "page.updated", "page.deleted", "menu.updated", "product.created", "product.updated", "product.deleted"];
13
13
  type ChannelWebhookEventType = (typeof CHANNEL_WEBHOOK_EVENT_TYPES)[number];
14
14
  interface OrderEventData {
15
15
  order_id: string;
@@ -45,7 +45,11 @@ interface ReviewPublishedEventData {
45
45
  source: string;
46
46
  published_at?: string;
47
47
  }
48
+ interface MenuUpdatedEventData {
49
+ handle: string;
50
+ }
48
51
  interface PagePublishedEventData {
52
+ previous_route_pattern?: string;
49
53
  page_id: string;
50
54
  route_pattern: string;
51
55
  title: string;
@@ -72,6 +76,9 @@ interface ChannelWebhookEventDataMap {
72
76
  "review.submitted": ReviewSubmittedEventData;
73
77
  "review.published": ReviewPublishedEventData;
74
78
  "page.published": PagePublishedEventData;
79
+ "page.updated": PagePublishedEventData;
80
+ "page.deleted": PagePublishedEventData;
81
+ "menu.updated": MenuUpdatedEventData;
75
82
  "product.created": ProductEventData;
76
83
  "product.updated": ProductEventData;
77
84
  "product.deleted": ProductEventData;
@@ -174,4 +181,4 @@ interface ParseChannelWebhookEventOptions {
174
181
  */
175
182
  declare function parseChannelWebhookEvent(request: Request, options: ParseChannelWebhookEventOptions): Promise<ParsedChannelWebhookEvent>;
176
183
 
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 };
184
+ 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 MenuUpdatedEventData, type OrderEventData, type PagePublishedEventData, type ParseChannelWebhookEventOptions, type ParsedChannelWebhookEvent, type ProductEventData, type ReviewPublishedEventData, type ReviewSubmittedEventData, type UnknownChannelWebhookEvent, type VerifyChannelWebhookSignatureOptions, isChannelWebhookEventType, isChannelWebhookVerificationError, isKnownChannelWebhookEvent, parseChannelWebhookEvent, verifyChannelWebhookSignature };
package/dist/webhooks.js CHANGED
@@ -1 +1 @@
1
- export { CHANNEL_WEBHOOK_EVENT_ID_HEADER, CHANNEL_WEBHOOK_EVENT_TYPES, CHANNEL_WEBHOOK_SIGNATURE_HEADER, CHANNEL_WEBHOOK_TIMESTAMP_HEADER, ChannelWebhookVerificationError, DEFAULT_TOLERANCE_SECONDS, isChannelWebhookEventType, isChannelWebhookVerificationError, isKnownChannelWebhookEvent, parseChannelWebhookEvent, verifyChannelWebhookSignature } from './chunk-RJQ4YEZV.js';
1
+ export { CHANNEL_WEBHOOK_EVENT_ID_HEADER, CHANNEL_WEBHOOK_EVENT_TYPES, CHANNEL_WEBHOOK_SIGNATURE_HEADER, CHANNEL_WEBHOOK_TIMESTAMP_HEADER, ChannelWebhookVerificationError, DEFAULT_TOLERANCE_SECONDS, isChannelWebhookEventType, isChannelWebhookVerificationError, isKnownChannelWebhookEvent, parseChannelWebhookEvent, verifyChannelWebhookSignature } from './chunk-P3HX34X7.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c1m-public/channel-client",
3
- "version": "0.22.0",
3
+ "version": "0.24.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Typed server-side client for the MML headless Channel API",
@@ -67,10 +67,11 @@
67
67
  }
68
68
  },
69
69
  "devDependencies": {
70
+ "tsup": "^8.5.1",
70
71
  "typescript": "5.9.3",
71
- "zod": "^4.3.6",
72
72
  "vitest": "^4.1.4",
73
- "tsup": "^8.5.1",
73
+ "zod": "^4.3.6",
74
+ "@c1m-public/resilience": "0.1.0",
74
75
  "@c1m-public/transport": "0.0.0"
75
76
  },
76
77
  "scripts": {