@c1m-public/channel-client 0.17.0 → 0.19.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 CHANGED
@@ -256,8 +256,9 @@ separate, parallel reads. `dash.init()` is the same shape for dash sites
256
256
  The core also exposes the complete current channel door: public category,
257
257
  collection and brand navigation; published blog and giving reads; subscription
258
258
  plan reads and authenticated acquisition; cart and checkout; Quick Print settings,
259
- quotes and multipart intake; assembled dining menus; and signed-in customer
260
- orders, addresses, giving history, saved payment methods and subscriptions. `pnpm contract:check` compares both client
259
+ quotes and multipart intake; assembled dining menus; the dash Lead Match
260
+ Portal; and signed-in customer orders, addresses, giving history, saved payment
261
+ methods and subscriptions. `pnpm contract:check` compares both client
261
262
  inventories with the canonical server OpenAPI document when the repositories
262
263
  are checked out together.
263
264
 
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import "server-only";
2
2
  export * from "./webhooks.js";
3
3
  export * from "./errors.js";
4
4
  export type * from "./types.js";
5
- import type { CatalogBrand, CatalogCategory, CatalogCollection, CatalogProductsResponse, BlogPostResponse, DiningMenu, DashDirectoryEntry, DashDirectoryProfileResponse, DashDirectoryRegion, DashInitResponse, DashLead, DashPlansResponse, DashProfileResponse, GivingEntry, SubscriptionPlanListResponse, SubscriptionPlanResponse, StartSubscriptionInput, GivingIntentListResponse, AddCartItemInput, CartResponse, CheckoutAddressesInput, CheckoutCustomerInput, CheckoutFulfillmentInput, CheckoutOptions, CheckoutPayInput, CheckoutPayResponse, CheckoutStatusResponse, ChannelPing, CustomerResponse, CustomerAuthSession, CustomerSecurityActivityPage, ChannelGeo, CustomerSession, CustomerSignupResponse, LeadResponse, LightInitResponse, ListResponse, Order, OrderSummary, MergeCartInput, SendCodeResponse, Product, ProductAsset, PrintIntakeInput, PrintJob, PrintOptionsSelection, PrintQuoteResponse, PrintSettingsResponse, PublicPage, PublicPageSummary, PublicSubmitReviewInput, PublicWorkspaceInit, MenuResponse, Review, ReviewSummaryResponse, SavedAddress, SavedAddressDefaultKind, SavedAddressInput, SavedAddressResponse, SavedAddressUpdateInput, SavedPaymentMethod, SiteDocument, StartGivingInput, StartGivingResponse, PaymentMethodConfirmInput, PaymentMethodMutationResponse, PaymentMethodSetupInput, PaymentMethodSetupResult, SubscriptionAgreementResponse, SubscriptionInvoiceListResponse, SubscriptionInvoiceResponse, SubscriptionListResponse, SubscriptionSourceResponse, ThemeResponse, UpdateCartItemInput } from "./types.js";
5
+ import type { CatalogBrand, CatalogCategory, CatalogCollection, CatalogProductsResponse, BlogPostResponse, DiningMenu, DashDirectoryEntry, DashDirectoryProfileResponse, DashDirectoryRegion, DashInitResponse, DashLead, DashLeadPortalRequestLinkInput, DashLeadPortalRequestLinkResponse, DashLeadPortalView, DashPlansResponse, DashProfileResponse, GivingEntry, SubscriptionPlanListResponse, SubscriptionPlanResponse, StartSubscriptionInput, GivingIntentListResponse, AddCartItemInput, CartResponse, CheckoutAddressesInput, CheckoutCustomerInput, CheckoutFulfillmentInput, CheckoutOptions, CheckoutPayInput, CheckoutPayResponse, CheckoutStatusResponse, ChannelPing, CustomerResponse, CustomerAuthSession, CustomerSecurityActivityPage, ChannelGeo, CustomerSession, CustomerSignupResponse, LeadResponse, LightInitResponse, ListResponse, Order, OrderSummary, MergeCartInput, SendCodeResponse, Product, ProductAsset, PrintIntakeInput, PrintJob, PrintOptionsSelection, PrintQuoteResponse, PrintSettingsResponse, PublicPage, PublicPageSummary, PublicSubmitReviewInput, PublicWorkspaceInit, MenuResponse, Review, ReviewSummaryResponse, SavedAddress, SavedAddressDefaultKind, SavedAddressInput, SavedAddressResponse, SavedAddressUpdateInput, SavedPaymentMethod, SiteDocument, StartGivingInput, StartGivingResponse, PaymentMethodConfirmInput, PaymentMethodMutationResponse, PaymentMethodSetupInput, PaymentMethodSetupResult, PaymentLinkCheckoutInput, PaymentLinkCheckoutResponse, PaymentLinkRedemptionStatusResponse, PublicPaymentLinkResponse, SubscriptionAgreementResponse, SubscriptionInvoiceListResponse, SubscriptionInvoiceResponse, SubscriptionListResponse, SubscriptionSourceResponse, ThemeResponse, UpdateCartItemInput } from "./types.js";
6
6
  export declare const DEFAULT_CHANNEL_API_URL = "https://api.saasdash.app";
7
7
  export interface ChannelRetryPolicy {
8
8
  attempts?: number;
@@ -39,7 +39,7 @@ export interface ChannelVisitor {
39
39
  userAgent?: string;
40
40
  }
41
41
  export type ChannelRequestOutcome = "success" | "api_error" | "network_error" | "timeout" | "invalid_response" | "cancelled";
42
- export 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.giving.entries.list" | "channel.giving.entries.get" | "channel.giving.start" | "channel.subscriptions.plans.list" | "channel.subscriptions.plans.get" | "channel.subscriptions.start" | "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" | "growth.public_workspace.leads.capture.channel";
42
+ export 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.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";
43
43
  export interface ChannelRequestObservation {
44
44
  operation: ChannelOperation;
45
45
  method: string;
@@ -134,6 +134,10 @@ export declare function createChannelClient(options: CreateChannelClientOptions)
134
134
  lead: DashLead;
135
135
  }>;
136
136
  };
137
+ readonly leadPortal: {
138
+ readonly requestLink: (input: DashLeadPortalRequestLinkInput) => Promise<DashLeadPortalRequestLinkResponse>;
139
+ readonly view: (token: string) => Promise<DashLeadPortalView>;
140
+ };
137
141
  };
138
142
  readonly assetUrl: (pathOrUrl: string) => string;
139
143
  readonly site: {
@@ -217,6 +221,13 @@ export declare function createChannelClient(options: CreateChannelClientOptions)
217
221
  readonly get: (planId: string) => Promise<SubscriptionPlanResponse>;
218
222
  };
219
223
  };
224
+ readonly paymentLinks: {
225
+ readonly get: (linkId: string) => Promise<PublicPaymentLinkResponse>;
226
+ readonly checkout: (linkId: string, input: PaymentLinkCheckoutInput, mutation?: ChannelMutationOptions) => Promise<PaymentLinkCheckoutResponse>;
227
+ readonly redemptions: {
228
+ readonly get: (linkId: string, redemptionId: string) => Promise<PaymentLinkRedemptionStatusResponse>;
229
+ };
230
+ };
220
231
  readonly print: {
221
232
  readonly settings: () => Promise<PrintSettingsResponse>;
222
233
  readonly quote: (input: PrintOptionsSelection, mutation?: ChannelMutationOptions) => Promise<PrintQuoteResponse>;
package/dist/index.js CHANGED
@@ -255,6 +255,14 @@ export function createChannelClient(options) {
255
255
  method: "POST", headers: mutationHeaders(mutation), body: JSON.stringify(input),
256
256
  }),
257
257
  },
258
+ // The Lead Match Portal. A requester asks for a signed link by email,
259
+ // then views their quote requests with the token that link carries. Not
260
+ // a customer session: the token is the only credential, and view() takes
261
+ // it explicitly so a site never has to hold it in a cookie.
262
+ leadPortal: {
263
+ requestLink: (input) => request("channel.dash.lead_portal.request_link", "/dash/lead-portal/request-link", { method: "POST", body: JSON.stringify(input) }),
264
+ view: (token) => request("channel.dash.lead_portal.my_quotes", appendQuery("/dash/lead-portal/my-quotes", { token })),
265
+ },
258
266
  },
259
267
  assetUrl: (pathOrUrl) => new URL(required(pathOrUrl, "asset URL"), `${baseUrl}/`).toString(),
260
268
  site: {
@@ -364,6 +372,13 @@ export function createChannelClient(options) {
364
372
  get: (planId) => request("channel.subscriptions.plans.get", `/subscriptions/plans/${encodePath(planId)}`),
365
373
  },
366
374
  },
375
+ paymentLinks: {
376
+ get: (linkId) => request("monetization.payment_links.public_get.channel", `/payment-links/${encodePath(linkId)}`),
377
+ checkout: (linkId, input, mutation) => request("monetization.payment_links.public_checkout.channel", `/payment-links/${encodePath(linkId)}/checkout`, { method: "POST", headers: mutationHeaders(mutation), body: JSON.stringify(input) }),
378
+ redemptions: {
379
+ get: (linkId, redemptionId) => request("monetization.payment_links.public_redemption_get.channel", `/payment-links/${encodePath(linkId)}/redemptions/${encodePath(redemptionId)}`),
380
+ },
381
+ },
367
382
  print: {
368
383
  settings: () => request("channel.print.settings", "/print/settings"),
369
384
  quote: (input, mutation) => request("channel.print.quote", "/print/quote", {
package/dist/next.d.ts CHANGED
@@ -48,6 +48,10 @@ export declare function createNextChannelClient(options: CreateNextChannelClient
48
48
  lead: import("./types.js").DashLead;
49
49
  }>;
50
50
  };
51
+ readonly leadPortal: {
52
+ readonly requestLink: (input: import("./types.js").DashLeadPortalRequestLinkInput) => Promise<import("./types.js").DashLeadPortalRequestLinkResponse>;
53
+ readonly view: (token: string) => Promise<import("./types.js").DashLeadPortalView>;
54
+ };
51
55
  };
52
56
  readonly assetUrl: (pathOrUrl: string) => string;
53
57
  readonly site: {
@@ -131,6 +135,13 @@ export declare function createNextChannelClient(options: CreateNextChannelClient
131
135
  readonly get: (planId: string) => Promise<import("./types.js").SubscriptionPlanResponse>;
132
136
  };
133
137
  };
138
+ readonly paymentLinks: {
139
+ readonly get: (linkId: string) => Promise<import("./types.js").PublicPaymentLinkResponse>;
140
+ readonly checkout: (linkId: string, input: import("./types.js").PaymentLinkCheckoutInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").PaymentLinkCheckoutResponse>;
141
+ readonly redemptions: {
142
+ readonly get: (linkId: string, redemptionId: string) => Promise<import("./types.js").PaymentLinkRedemptionStatusResponse>;
143
+ };
144
+ };
134
145
  readonly print: {
135
146
  readonly settings: () => Promise<import("./types.js").PrintSettingsResponse>;
136
147
  readonly quote: (input: import("./types.js").PrintOptionsSelection, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").PrintQuoteResponse>;
package/dist/types.d.ts CHANGED
@@ -212,6 +212,44 @@ export interface DashDirectoryProfile extends DashDirectoryEntry {
212
212
  export interface DashDirectoryProfileResponse {
213
213
  profile: DashDirectoryProfile;
214
214
  }
215
+ /** A requester's view of their quote requests, unlocked by a signed portal link. */
216
+ export interface DashLeadPortalView {
217
+ email: string;
218
+ requests: DashLeadPortalRequest[];
219
+ }
220
+ export type DashLeadPortalRequestStatus = "received" | "matching" | "matched" | "closed";
221
+ export interface DashLeadPortalRequest {
222
+ reference: string;
223
+ submittedAt: string;
224
+ status: DashLeadPortalRequestStatus;
225
+ summary?: DashLeadPortalMovingSummary;
226
+ matches: DashLeadPortalMatch[];
227
+ }
228
+ export interface DashLeadPortalMovingSummary {
229
+ from?: string;
230
+ to?: string;
231
+ moveDate?: string;
232
+ size?: string;
233
+ }
234
+ export interface DashLeadPortalMatch {
235
+ workspaceId: string;
236
+ name: string;
237
+ category?: string;
238
+ logoUrl?: string;
239
+ coverageArea?: string;
240
+ verified?: boolean;
241
+ rating?: number;
242
+ reviewCount?: number;
243
+ responded?: boolean;
244
+ }
245
+ export interface DashLeadPortalRequestLinkInput {
246
+ email: string;
247
+ }
248
+ /** Deliberately non-enumerating: the same shape whether or not the email exists. */
249
+ export interface DashLeadPortalRequestLinkResponse {
250
+ ok: boolean;
251
+ message: string;
252
+ }
215
253
  export interface DashLead {
216
254
  id: string;
217
255
  owner_scope?: string;
@@ -688,6 +726,40 @@ export interface StartGivingResponse {
688
726
  payment_intent_id?: string;
689
727
  };
690
728
  }
729
+ export interface PublicPaymentLink {
730
+ id: string;
731
+ title: string;
732
+ description?: string;
733
+ amount_cents: number;
734
+ currency: string;
735
+ allow_custom_amount: boolean;
736
+ minimum_amount_cents?: number;
737
+ maximum_amount_cents?: number;
738
+ }
739
+ export interface PublicPaymentLinkResponse {
740
+ payment_link: PublicPaymentLink;
741
+ }
742
+ export interface PaymentLinkCheckoutInput {
743
+ /** Omit for fixed-price links. Required when a custom-price link has no default. */
744
+ amount_cents?: number;
745
+ customer_email?: string;
746
+ customer_name?: string;
747
+ }
748
+ export type PaymentLinkRedemptionStatus = "pending" | "checkout_ready" | "succeeded" | "failed" | "refunded" | "disputed" | "charged_back";
749
+ export interface PaymentLinkCheckoutResponse {
750
+ redemption_id: string;
751
+ status: PaymentLinkRedemptionStatus;
752
+ session: {
753
+ session_id: string;
754
+ url: string;
755
+ payment_intent_id?: string;
756
+ };
757
+ }
758
+ export interface PaymentLinkRedemptionStatusResponse {
759
+ redemption_id: string;
760
+ status: PaymentLinkRedemptionStatus;
761
+ failure_code?: string;
762
+ }
691
763
  export interface PrintPerPagePricing {
692
764
  bw_cents: number;
693
765
  colour_cents: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c1m-public/channel-client",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Typed server-side client for the MML headless Channel API",