@c1m-public/channel-client 0.21.0 → 0.23.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 { ChannelConfigurationError } from './chunk-RJQ4YEZV.js';
1
+ import { ChannelConfigurationError } from './chunk-WZXLYXDN.js';
2
2
  import 'server-only';
3
3
 
4
4
  // ../transport/src/index.ts
@@ -52,7 +52,7 @@ function isRetryableRequest(method, headers, retry) {
52
52
  if (method === "GET") return true;
53
53
  return retry.idempotentWrites === true && headers.has("Idempotency-Key");
54
54
  }
55
- async function performRequest(transport, url, init, observe) {
55
+ async function performRequest(transport, url, init, observe, decode) {
56
56
  const method = (init.method ?? "GET").toUpperCase();
57
57
  const headers = new Headers(init.headers);
58
58
  const startedAt = Date.now();
@@ -113,7 +113,8 @@ async function performRequest(transport, url, init, observe) {
113
113
  payload = void 0;
114
114
  } else {
115
115
  const text = await response.text();
116
- payload = text ? JSON.parse(text) : void 0;
116
+ const parsed = text ? JSON.parse(text) : void 0;
117
+ payload = decode ? decode(parsed) : parsed;
117
118
  }
118
119
  } catch {
119
120
  return fail({ outcome: "invalid_response", status, code: "", message: "", requestId });
@@ -327,6 +328,7 @@ function createChannelClient(options) {
327
328
  },
328
329
  collections: {
329
330
  list: (params = {}) => request("channel.catalog.collections.list", appendQuery("/collections", params)),
331
+ get: (slug) => request("shop.public.collections.get.channel", `/collections/by-slug/${encodePath(slug)}`),
330
332
  products: (slug) => request("channel.catalog.collections.products", `/collections/by-slug/${encodePath(slug)}/products`)
331
333
  },
332
334
  brands: {
@@ -475,7 +477,7 @@ function createChannelClient(options) {
475
477
  }
476
478
  },
477
479
  dining: {
478
- menu: (boardSlug) => request("dining.public.board_menu.channel", `/dining/boards/${encodePath(boardSlug)}/menu`)
480
+ menu: (boardSlug) => request("menu.public.board_menu.channel", `/menu/boards/${encodePath(boardSlug)}/menu`)
479
481
  },
480
482
  // Customer sign-in. These are anonymous calls — they CREATE a session.
481
483
  auth: {
@@ -1,5 +1,5 @@
1
- import { isChannelAPIError, createChannelClient } from './chunk-C44TGKRK.js';
2
- import { parseChannelWebhookEvent, isChannelWebhookVerificationError, isChannelWebhookEventType, ChannelConfigurationError } from './chunk-RJQ4YEZV.js';
1
+ import { isChannelAPIError, createChannelClient } from './chunk-HNTW6N5F.js';
2
+ import { parseChannelWebhookEvent, isChannelWebhookVerificationError, isChannelWebhookEventType, ChannelConfigurationError } from './chunk-WZXLYXDN.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,4 +1,4 @@
1
- import { createChannelClient } from './chunk-C44TGKRK.js';
1
+ import { createChannelClient } from './chunk-HNTW6N5F.js';
2
2
  import 'server-only';
3
3
 
4
4
  function narrow(client) {
@@ -20,6 +20,9 @@ var CHANNEL_WEBHOOK_EVENT_TYPES = [
20
20
  "review.submitted",
21
21
  "review.published",
22
22
  "page.published",
23
+ "page.updated",
24
+ "page.deleted",
25
+ "menu.updated",
23
26
  "product.created",
24
27
  "product.updated",
25
28
  "product.deleted"
@@ -168,8 +171,12 @@ function isKnownEventData(type, value) {
168
171
  return hasStrings(value, ["source", "submitted_at"]) && typeof value.rating === "number";
169
172
  case "review.published":
170
173
  return hasStrings(value, ["review_id", "source"]) && typeof value.rating === "number" && (value.published_at === void 0 || typeof value.published_at === "string");
174
+ case "menu.updated":
175
+ return typeof value.handle === "string" && value.handle.trim().length > 0;
176
+ case "page.updated":
177
+ case "page.deleted":
171
178
  case "page.published":
172
- return hasStrings(value, ["page_id", "route_pattern", "title"]) && (value.published_at === void 0 || typeof value.published_at === "string");
179
+ 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
180
  case "product.created":
174
181
  case "product.updated":
175
182
  case "product.deleted":
package/dist/dash-next.js CHANGED
@@ -1,7 +1,7 @@
1
- import { createNextChannelClient } from './chunk-BSTXJIVL.js';
2
- import { narrow } from './chunk-FRUWMKQP.js';
3
- import './chunk-C44TGKRK.js';
4
- import './chunk-RJQ4YEZV.js';
1
+ import { createNextChannelClient } from './chunk-LSVDR73B.js';
2
+ import { narrow } from './chunk-SRHMGRCV.js';
3
+ import './chunk-HNTW6N5F.js';
4
+ import './chunk-WZXLYXDN.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-FRUWMKQP.js';
2
- import './chunk-C44TGKRK.js';
3
- import './chunk-RJQ4YEZV.js';
1
+ export { createDashChannelClient, narrow as narrowToDash } from './chunk-SRHMGRCV.js';
2
+ import './chunk-HNTW6N5F.js';
3
+ import './chunk-WZXLYXDN.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[];
@@ -269,7 +269,7 @@ interface DashLead {
269
269
  }
270
270
  interface PublicPageSummary {
271
271
  id: string;
272
- saas_app: string;
272
+ dash_id: string;
273
273
  workspace_id: string;
274
274
  source: string;
275
275
  route_kind: string;
@@ -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
  }
@@ -444,7 +445,7 @@ interface LeadResponse {
444
445
  interface SiteSubject {
445
446
  kind: "workspace";
446
447
  id: string;
447
- saas_app?: string;
448
+ dash_id?: string;
448
449
  display_name?: string;
449
450
  }
450
451
  interface SiteResolvedDocument {
@@ -1005,7 +1006,7 @@ interface DiningMenuItem {
1005
1006
  combo_groups?: DiningComboGroup[];
1006
1007
  }
1007
1008
  interface DiningMenu {
1008
- saas_app: string;
1009
+ dash_id: string;
1009
1010
  workspace_id: string;
1010
1011
  board: {
1011
1012
  id: string;
@@ -1256,7 +1257,7 @@ interface OrderSummary {
1256
1257
  interface ChannelPing {
1257
1258
  channel_id: string;
1258
1259
  workspace_id: string;
1259
- saas_app: string;
1260
+ dash_id: string;
1260
1261
  scope: "workspace" | "dash";
1261
1262
  api_version: string;
1262
1263
  attestation?: string;
@@ -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-C44TGKRK.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-HNTW6N5F.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-WZXLYXDN.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-BSTXJIVL.js';
2
- import './chunk-C44TGKRK.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-LSVDR73B.js';
2
+ import './chunk-HNTW6N5F.js';
3
+ import './chunk-WZXLYXDN.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-WZXLYXDN.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c1m-public/channel-client",
3
- "version": "0.21.0",
3
+ "version": "0.23.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Typed server-side client for the MML headless Channel API",