@c1m-public/channel-client 0.8.0 → 0.9.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
@@ -51,6 +51,14 @@ const channel = createChannelClient({
51
51
  baseUrl: process.env.C1M_API_URL!,
52
52
  token: process.env.C1M_CHANNEL_TOKEN!,
53
53
  });
54
+
55
+ const category = await channel.categories.products("electric-cars");
56
+
57
+ // Customer credentials are request-scoped and never stored on the shared
58
+ // channel client. Every account read is forced to no-store.
59
+ const account = channel.withCustomer(customerAccessToken);
60
+ const addresses = await account.addresses.list();
61
+ const subscriptions = await account.subscriptions.list({ status: "active" });
54
62
  ```
55
63
 
56
64
  The package must only be imported from server modules. Never expose the token in
@@ -113,7 +121,6 @@ Build and inspect before publishing:
113
121
  pnpm --filter @c1m-public/channel-client test:run
114
122
  pnpm --filter @c1m-public/channel-client build
115
123
  pnpm --filter @c1m-public/channel-client pack
116
- npm publish --access public
117
124
  ```
118
125
 
119
126
  Publishing runs through npm Trusted Publishing and GitHub OIDC. Push a protected
@@ -155,10 +162,13 @@ const catalog = createNextChannelClient({
155
162
  const products = await catalog.products.list();
156
163
  ```
157
164
 
158
- The core also exposes the complete current channel door: published blog lists,
159
- giving entries and checkout start, Quick Print settings/quotes/multipart intake,
160
- and assembled dining menus. `pnpm contract:check` compares the client inventory
161
- with the canonical server OpenAPI document when both repositories are present.
165
+ The core also exposes the complete current channel door: public category,
166
+ collection and brand navigation; published blog and giving reads; cart and
167
+ checkout; Quick Print settings, quotes and multipart intake; assembled dining
168
+ menus; and signed-in customer orders, addresses, giving history, saved payment
169
+ methods and subscriptions. `pnpm contract:check` compares both client
170
+ inventories with the canonical server OpenAPI document when the repositories
171
+ are checked out together.
162
172
 
163
173
  ```ts
164
174
  // session: cookie codec + the contested-vs-expired refresh decision
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  export * from "./webhooks.js";
2
2
  export type * from "./types.js";
3
- export type { BlogPost, BlogPostResponse, DiningMenu, GivingEntry, GivingIntent, AddCartItemInput, CartResponse, CheckoutAddress, CheckoutAddressesInput, CheckoutCustomerInput, CheckoutFulfillmentInput, CheckoutOptions, CheckoutPayInput, CheckoutPayResponse, CheckoutStatus, CheckoutStatusResponse, ChannelPing, Customer, CustomerResponse, CustomerSession, CustomerSignupResponse, LeadResponse, Order, OrderItem, OrderSummary, MergeCartInput, SendCodeResponse, LightInitResponse, ListResponse, Product, ProductAsset, PrintIntakeInput, PrintJob, PrintOptionsSelection, PrintQuoteResponse, PrintSettingsResponse, PublicPage, PublicPageSummary, PublicSubmitReviewInput, PublicWorkspaceInit, Menu, MenuItem, MenuResponse, Review, ReviewSummaryResponse, PaymentMethodOption, PaymentReadiness, ShippingMethodOption, SiteDocument, SiteGatedDocument, SiteResolvedDocument, StartGivingInput, StartGivingResponse, ThemeResponse, UpdateCartItemInput, } from "./types";
4
- import type { BlogPostResponse, DiningMenu, GivingEntry, AddCartItemInput, CartResponse, CheckoutAddressesInput, CheckoutCustomerInput, CheckoutFulfillmentInput, CheckoutOptions, CheckoutPayInput, CheckoutPayResponse, CheckoutStatusResponse, ChannelPing, CustomerResponse, CustomerSession, CustomerSignupResponse, LeadResponse, LightInitResponse, ListResponse, Order, OrderSummary, MergeCartInput, SendCodeResponse, Product, ProductAsset, PrintIntakeInput, PrintJob, PrintOptionsSelection, PrintQuoteResponse, PrintSettingsResponse, PublicPage, PublicPageSummary, PublicSubmitReviewInput, PublicWorkspaceInit, MenuResponse, Review, ReviewSummaryResponse, SiteDocument, StartGivingInput, StartGivingResponse, ThemeResponse, UpdateCartItemInput } from "./types";
3
+ import type { CatalogBrand, CatalogCategory, CatalogCollection, CatalogProductsResponse, BlogPostResponse, DiningMenu, GivingEntry, GivingIntentListResponse, AddCartItemInput, CartResponse, CheckoutAddressesInput, CheckoutCustomerInput, CheckoutFulfillmentInput, CheckoutOptions, CheckoutPayInput, CheckoutPayResponse, CheckoutStatusResponse, ChannelPing, CustomerResponse, 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
4
  export interface ChannelRetryPolicy {
6
5
  attempts?: number;
7
6
  maxDelayMs?: number;
@@ -17,7 +16,7 @@ export interface CreateChannelClientOptions {
17
16
  signal?: AbortSignal;
18
17
  }
19
18
  export type ChannelRequestOutcome = "success" | "api_error" | "network_error" | "timeout" | "invalid_response" | "cancelled";
20
- export type ChannelOperation = "channel.ping" | "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.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.account.orders.list" | "channel.account.orders.summary" | "channel.account.orders.get" | "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" | "growth.public_workspace.leads.capture.channel";
19
+ export type ChannelOperation = "channel.ping" | "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.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.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" | "growth.public_workspace.leads.capture.channel";
21
20
  export interface ChannelRequestObservation {
22
21
  operation: ChannelOperation;
23
22
  method: string;
@@ -61,6 +60,15 @@ export interface ChannelCheckoutStatusParams {
61
60
  cartToken?: string;
62
61
  checkoutSessionId?: string;
63
62
  }
63
+ export interface ChannelSubscriptionListParams extends ChannelListParams {
64
+ status?: string;
65
+ }
66
+ export interface ChannelSubscriptionCancelParams {
67
+ immediate?: boolean;
68
+ }
69
+ export interface ChannelInvoiceListParams {
70
+ limit?: number;
71
+ }
64
72
  export declare class ChannelAPIError extends Error {
65
73
  readonly status: number;
66
74
  readonly code: string;
@@ -101,6 +109,17 @@ export declare function createChannelClient(options: CreateChannelClientOptions)
101
109
  }>;
102
110
  readonly media: (slug: string) => Promise<ListResponse<ProductAsset>>;
103
111
  };
112
+ readonly categories: {
113
+ readonly list: (params?: ChannelListParams) => Promise<ListResponse<CatalogCategory>>;
114
+ readonly products: (slug: string) => Promise<CatalogProductsResponse>;
115
+ };
116
+ readonly collections: {
117
+ readonly list: (params?: ChannelListParams) => Promise<ListResponse<CatalogCollection>>;
118
+ readonly products: (slug: string) => Promise<CatalogProductsResponse>;
119
+ };
120
+ readonly brands: {
121
+ readonly list: (params?: ChannelListParams) => Promise<ListResponse<CatalogBrand>>;
122
+ };
104
123
  readonly cart: {
105
124
  readonly get: (cartToken: string) => Promise<CartResponse>;
106
125
  readonly addItem: (input: AddCartItemInput, mutation?: ChannelMutationOptions) => Promise<CartResponse>;
@@ -200,7 +219,38 @@ export declare function createChannelClient(options: CreateChannelClientOptions)
200
219
  order: Order;
201
220
  }>;
202
221
  };
222
+ readonly addresses: {
223
+ readonly list: () => Promise<ListResponse<SavedAddress>>;
224
+ readonly get: (addressId: string) => Promise<SavedAddressResponse>;
225
+ readonly create: (input: SavedAddressInput, mutation?: ChannelMutationOptions) => Promise<SavedAddressResponse>;
226
+ readonly update: (addressId: string, input: SavedAddressUpdateInput, mutation?: ChannelMutationOptions) => Promise<SavedAddressResponse>;
227
+ readonly delete: (addressId: string, mutation?: ChannelMutationOptions) => Promise<{
228
+ status?: string;
229
+ }>;
230
+ readonly setDefault: (addressId: string, kind: SavedAddressDefaultKind, mutation?: ChannelMutationOptions) => Promise<SavedAddressResponse>;
231
+ };
232
+ readonly paymentMethods: {
233
+ readonly list: () => Promise<ListResponse<SavedPaymentMethod>>;
234
+ readonly setup: (input: PaymentMethodSetupInput, mutation?: ChannelMutationOptions) => Promise<PaymentMethodSetupResult>;
235
+ readonly confirm: (input: PaymentMethodConfirmInput, mutation?: ChannelMutationOptions) => Promise<SavedPaymentMethod>;
236
+ readonly setDefault: (methodId: string, mutation?: ChannelMutationOptions) => Promise<PaymentMethodMutationResponse>;
237
+ readonly delete: (methodId: string, mutation?: ChannelMutationOptions) => Promise<PaymentMethodMutationResponse>;
238
+ };
239
+ readonly subscriptions: {
240
+ readonly list: (params?: ChannelSubscriptionListParams) => Promise<SubscriptionListResponse>;
241
+ readonly get: (agreementId: string) => Promise<SubscriptionAgreementResponse>;
242
+ readonly source: (agreementId: string) => Promise<SubscriptionSourceResponse>;
243
+ readonly cancel: (agreementId: string, params?: ChannelSubscriptionCancelParams, mutation?: ChannelMutationOptions) => Promise<SubscriptionAgreementResponse>;
244
+ readonly pause: (agreementId: string, mutation?: ChannelMutationOptions) => Promise<SubscriptionAgreementResponse>;
245
+ readonly resume: (agreementId: string, mutation?: ChannelMutationOptions) => Promise<SubscriptionAgreementResponse>;
246
+ readonly invoices: {
247
+ readonly list: (agreementId: string, params?: ChannelInvoiceListParams) => Promise<SubscriptionInvoiceListResponse>;
248
+ readonly get: (invoiceId: string) => Promise<SubscriptionInvoiceResponse>;
249
+ readonly payNow: (invoiceId: string, mutation?: ChannelMutationOptions) => Promise<SubscriptionInvoiceResponse>;
250
+ };
251
+ };
203
252
  readonly giving: {
253
+ readonly list: () => Promise<GivingIntentListResponse>;
204
254
  readonly start: (input: StartGivingInput, mutation?: ChannelMutationOptions) => Promise<StartGivingResponse>;
205
255
  };
206
256
  };
package/dist/index.js CHANGED
@@ -210,6 +210,17 @@ export function createChannelClient(options) {
210
210
  get: (slug) => request("shop.public.products.get.channel", `/products/${encodePath(slug)}`),
211
211
  media: (slug) => request("shop.public.products.media.channel", `/products/${encodePath(slug)}/media`),
212
212
  },
213
+ categories: {
214
+ list: (params = {}) => request("channel.catalog.categories.list", appendQuery("/categories", params)),
215
+ products: (slug) => request("channel.catalog.categories.products", `/categories/by-slug/${encodePath(slug)}/products`),
216
+ },
217
+ collections: {
218
+ list: (params = {}) => request("channel.catalog.collections.list", appendQuery("/collections", params)),
219
+ products: (slug) => request("channel.catalog.collections.products", `/collections/by-slug/${encodePath(slug)}/products`),
220
+ },
221
+ brands: {
222
+ list: (params = {}) => request("channel.catalog.brands.list", appendQuery("/brands", params)),
223
+ },
213
224
  cart: {
214
225
  get: (cartToken) => request("channel.cart.get", appendQuery("/cart", { cart_token: required(cartToken, "cartToken") })),
215
226
  addItem: (input, mutation) => request("channel.cart.items.add", "/cart/items", {
@@ -337,7 +348,60 @@ export function createChannelClient(options) {
337
348
  summary: () => request("channel.account.orders.summary", "/account/orders/summary", {}, customerSession),
338
349
  get: (orderId) => request("channel.account.orders.get", `/account/orders/${encodePath(orderId)}`, {}, customerSession),
339
350
  },
351
+ addresses: {
352
+ list: () => request("channel.account.addresses.list", "/account/addresses", {}, customerSession),
353
+ get: (addressId) => request("channel.account.addresses.get", `/account/addresses/${encodePath(addressId)}`, {}, customerSession),
354
+ create: (input, mutation) => request("channel.account.addresses.create", "/account/addresses", {
355
+ method: "POST", headers: mutationHeaders(mutation), body: JSON.stringify(input),
356
+ }, customerSession),
357
+ update: (addressId, input, mutation) => request("channel.account.addresses.update", `/account/addresses/${encodePath(addressId)}`, {
358
+ method: "PUT", headers: mutationHeaders(mutation), body: JSON.stringify(input),
359
+ }, customerSession),
360
+ delete: (addressId, mutation) => request("channel.account.addresses.delete", `/account/addresses/${encodePath(addressId)}`, {
361
+ method: "DELETE", headers: mutationHeaders(mutation),
362
+ }, customerSession),
363
+ setDefault: (addressId, kind, mutation) => request("channel.account.addresses.set_default", `/account/addresses/${encodePath(addressId)}/default`, {
364
+ method: "POST", headers: mutationHeaders(mutation), body: JSON.stringify({ kind }),
365
+ }, customerSession),
366
+ },
367
+ paymentMethods: {
368
+ list: () => request("channel.account.payment_methods.list", "/account/payment-methods", {}, customerSession),
369
+ setup: (input, mutation) => request("channel.account.payment_methods.setup", "/account/payment-methods/setup", {
370
+ method: "POST", headers: mutationHeaders(mutation), body: JSON.stringify(input),
371
+ }, customerSession),
372
+ confirm: (input, mutation) => request("channel.account.payment_methods.confirm", "/account/payment-methods/confirm", {
373
+ method: "POST", headers: mutationHeaders(mutation), body: JSON.stringify(input),
374
+ }, customerSession),
375
+ setDefault: (methodId, mutation) => request("channel.account.payment_methods.default", `/account/payment-methods/${encodePath(methodId)}/default`, {
376
+ method: "POST", headers: mutationHeaders(mutation),
377
+ }, customerSession),
378
+ delete: (methodId, mutation) => request("channel.account.payment_methods.delete", `/account/payment-methods/${encodePath(methodId)}`, {
379
+ method: "DELETE", headers: mutationHeaders(mutation),
380
+ }, customerSession),
381
+ },
382
+ subscriptions: {
383
+ list: (params = {}) => request("channel.account.subscriptions.list", appendQuery("/account/subscriptions", params), {}, customerSession),
384
+ get: (agreementId) => request("channel.account.subscriptions.get", `/account/subscriptions/${encodePath(agreementId)}`, {}, customerSession),
385
+ source: (agreementId) => request("channel.account.subscriptions.source", `/account/subscriptions/${encodePath(agreementId)}/source`, {}, customerSession),
386
+ cancel: (agreementId, params = {}, mutation) => request("channel.account.subscriptions.cancel", appendQuery(`/account/subscriptions/${encodePath(agreementId)}/cancel`, params), {
387
+ method: "POST", headers: mutationHeaders(mutation),
388
+ }, customerSession),
389
+ pause: (agreementId, mutation) => request("channel.account.subscriptions.pause", `/account/subscriptions/${encodePath(agreementId)}/pause`, {
390
+ method: "POST", headers: mutationHeaders(mutation),
391
+ }, customerSession),
392
+ resume: (agreementId, mutation) => request("channel.account.subscriptions.resume", `/account/subscriptions/${encodePath(agreementId)}/resume`, {
393
+ method: "POST", headers: mutationHeaders(mutation),
394
+ }, customerSession),
395
+ invoices: {
396
+ list: (agreementId, params = {}) => request("channel.account.subscriptions.invoices.list", appendQuery(`/account/subscriptions/${encodePath(agreementId)}/invoices`, params), {}, customerSession),
397
+ get: (invoiceId) => request("channel.account.subscriptions.invoices.get", `/account/subscriptions/invoices/${encodePath(invoiceId)}`, {}, customerSession),
398
+ payNow: (invoiceId, mutation) => request("channel.account.subscriptions.invoices.pay_now", `/account/subscriptions/invoices/${encodePath(invoiceId)}/pay-now`, {
399
+ method: "POST", headers: mutationHeaders(mutation),
400
+ }, customerSession),
401
+ },
402
+ },
340
403
  giving: {
404
+ list: () => request("channel.account.giving.list", "/account/giving", {}, customerSession),
341
405
  start: (input, mutation) => request("channel.giving.start", "/give/start", {
342
406
  method: "POST", headers: mutationHeaders(mutation), body: JSON.stringify(input),
343
407
  }, customerSession),
package/dist/next.d.ts CHANGED
@@ -37,6 +37,17 @@ export declare function createNextChannelClient(options: CreateNextChannelClient
37
37
  }>;
38
38
  readonly media: (slug: string) => Promise<import("./types.js").ListResponse<import("./types.js").ProductAsset>>;
39
39
  };
40
+ readonly categories: {
41
+ readonly list: (params?: import("./index.js").ChannelListParams) => Promise<import("./types.js").ListResponse<import("./types.js").CatalogCategory>>;
42
+ readonly products: (slug: string) => Promise<import("./types.js").CatalogProductsResponse>;
43
+ };
44
+ readonly collections: {
45
+ readonly list: (params?: import("./index.js").ChannelListParams) => Promise<import("./types.js").ListResponse<import("./types.js").CatalogCollection>>;
46
+ readonly products: (slug: string) => Promise<import("./types.js").CatalogProductsResponse>;
47
+ };
48
+ readonly brands: {
49
+ readonly list: (params?: import("./index.js").ChannelListParams) => Promise<import("./types.js").ListResponse<import("./types.js").CatalogBrand>>;
50
+ };
40
51
  readonly cart: {
41
52
  readonly get: (cartToken: string) => Promise<import("./types.js").CartResponse>;
42
53
  readonly addItem: (input: import("./types.js").AddCartItemInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").CartResponse>;
@@ -125,7 +136,38 @@ export declare function createNextChannelClient(options: CreateNextChannelClient
125
136
  order: import("./types.js").Order;
126
137
  }>;
127
138
  };
139
+ readonly addresses: {
140
+ readonly list: () => Promise<import("./types.js").ListResponse<import("./types.js").SavedAddress>>;
141
+ readonly get: (addressId: string) => Promise<import("./types.js").SavedAddressResponse>;
142
+ readonly create: (input: import("./types.js").SavedAddressInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SavedAddressResponse>;
143
+ readonly update: (addressId: string, input: import("./types.js").SavedAddressUpdateInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SavedAddressResponse>;
144
+ readonly delete: (addressId: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<{
145
+ status?: string;
146
+ }>;
147
+ readonly setDefault: (addressId: string, kind: import("./types.js").SavedAddressDefaultKind, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SavedAddressResponse>;
148
+ };
149
+ readonly paymentMethods: {
150
+ readonly list: () => Promise<import("./types.js").ListResponse<import("./types.js").SavedPaymentMethod>>;
151
+ readonly setup: (input: import("./types.js").PaymentMethodSetupInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").PaymentMethodSetupResult>;
152
+ readonly confirm: (input: import("./types.js").PaymentMethodConfirmInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SavedPaymentMethod>;
153
+ readonly setDefault: (methodId: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").PaymentMethodMutationResponse>;
154
+ readonly delete: (methodId: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").PaymentMethodMutationResponse>;
155
+ };
156
+ readonly subscriptions: {
157
+ readonly list: (params?: import("./index.js").ChannelSubscriptionListParams) => Promise<import("./types.js").SubscriptionListResponse>;
158
+ readonly get: (agreementId: string) => Promise<import("./types.js").SubscriptionAgreementResponse>;
159
+ readonly source: (agreementId: string) => Promise<import("./types.js").SubscriptionSourceResponse>;
160
+ readonly cancel: (agreementId: string, params?: import("./index.js").ChannelSubscriptionCancelParams, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SubscriptionAgreementResponse>;
161
+ readonly pause: (agreementId: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SubscriptionAgreementResponse>;
162
+ readonly resume: (agreementId: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SubscriptionAgreementResponse>;
163
+ readonly invoices: {
164
+ readonly list: (agreementId: string, params?: import("./index.js").ChannelInvoiceListParams) => Promise<import("./types.js").SubscriptionInvoiceListResponse>;
165
+ readonly get: (invoiceId: string) => Promise<import("./types.js").SubscriptionInvoiceResponse>;
166
+ readonly payNow: (invoiceId: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SubscriptionInvoiceResponse>;
167
+ };
168
+ };
128
169
  readonly giving: {
170
+ readonly list: () => Promise<import("./types.js").GivingIntentListResponse>;
129
171
  readonly start: (input: import("./types.js").StartGivingInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").StartGivingResponse>;
130
172
  };
131
173
  };
package/dist/types.d.ts CHANGED
@@ -82,6 +82,12 @@ export interface Product {
82
82
  price_cents: number;
83
83
  currency: string;
84
84
  inventory_qty: number;
85
+ /**
86
+ * Stripe product tax code (e.g. `txcd_99999999`). Drives how Stripe Automatic Tax
87
+ * categorises the product at checkout — a book, a hot meal and a t-shirt are taxed
88
+ * differently in most places. Empty means the merchant's Stripe account default.
89
+ */
90
+ tax_code?: string;
85
91
  status: "draft" | "published" | "archived";
86
92
  primary_image_url?: string;
87
93
  options?: unknown[];
@@ -110,6 +116,60 @@ export interface ProductAsset {
110
116
  };
111
117
  created_at: string;
112
118
  }
119
+ export interface CatalogCategory {
120
+ id: string;
121
+ workspace_id: string;
122
+ name: string;
123
+ slug: string;
124
+ description?: string;
125
+ is_active: boolean;
126
+ sort_order: number;
127
+ product_count: number;
128
+ metadata: unknown;
129
+ created_at: string;
130
+ updated_at: string;
131
+ }
132
+ export interface CatalogCollection {
133
+ id: string;
134
+ workspace_id: string;
135
+ title: string;
136
+ slug: string;
137
+ description?: string;
138
+ created_at: string;
139
+ updated_at: string;
140
+ }
141
+ export interface CatalogBrand {
142
+ id: string;
143
+ workspace_id: string;
144
+ name: string;
145
+ slug: string;
146
+ description?: string;
147
+ website_url?: string;
148
+ is_active: boolean;
149
+ sort_order: number;
150
+ metadata: unknown;
151
+ created_at: string;
152
+ updated_at: string;
153
+ }
154
+ export interface CatalogProduct {
155
+ id: string;
156
+ slug: string;
157
+ title: string;
158
+ price_cents: number;
159
+ currency: string;
160
+ base_price_cents?: number;
161
+ base_currency?: string;
162
+ price_source?: string;
163
+ fx_rate?: number;
164
+ fx_provider?: string;
165
+ fx_quoted_at?: string;
166
+ primary_image_url?: string;
167
+ status: string;
168
+ }
169
+ export interface CatalogProductsResponse {
170
+ products: CatalogProduct[];
171
+ count: number;
172
+ }
113
173
  export interface Review {
114
174
  id: string;
115
175
  rating: number;
@@ -268,6 +328,156 @@ export interface GivingIntent {
268
328
  updated_at: string;
269
329
  refunded_at?: string;
270
330
  }
331
+ export interface GivingIntentListResponse {
332
+ items: GivingIntent[];
333
+ }
334
+ export interface SavedAddress {
335
+ id: string;
336
+ end_user_id: string;
337
+ label: string;
338
+ name: string;
339
+ phone: string;
340
+ line1: string;
341
+ line2: string;
342
+ city: string;
343
+ region: string;
344
+ postal_code: string;
345
+ country_code: string;
346
+ is_default_shipping: boolean;
347
+ is_default_billing: boolean;
348
+ created_at: string;
349
+ updated_at: string;
350
+ }
351
+ export interface SavedAddressInput {
352
+ line1: string;
353
+ city: string;
354
+ country_code: string;
355
+ label?: string;
356
+ name?: string;
357
+ phone?: string;
358
+ line2?: string;
359
+ region?: string;
360
+ postal_code?: string;
361
+ is_default_shipping?: boolean;
362
+ is_default_billing?: boolean;
363
+ }
364
+ export type SavedAddressUpdateInput = SavedAddressInput;
365
+ export type SavedAddressDefaultKind = "shipping" | "billing";
366
+ export interface SavedAddressResponse {
367
+ address: SavedAddress;
368
+ }
369
+ export interface SavedPaymentMethod {
370
+ id: string;
371
+ workspace_id: string;
372
+ end_user_ref?: string;
373
+ provider: string;
374
+ provider_customer_id?: string;
375
+ provider_payment_method_id: string;
376
+ status: string;
377
+ is_default: boolean;
378
+ display_brand?: string;
379
+ display_last4?: string;
380
+ exp_month?: number;
381
+ exp_year?: number;
382
+ created_at: string;
383
+ updated_at: string;
384
+ }
385
+ export interface PaymentMethodSetupInput {
386
+ provider: string;
387
+ }
388
+ export interface PaymentMethodSetupResult {
389
+ type: string;
390
+ client_secret?: string;
391
+ publishable_key?: string;
392
+ }
393
+ export interface PaymentMethodConfirmInput {
394
+ provider: string;
395
+ setup_intent_id?: string;
396
+ payment_method_id?: string;
397
+ }
398
+ export interface PaymentMethodMutationResponse {
399
+ success: boolean;
400
+ }
401
+ export interface SubscriptionAgreement {
402
+ id: string;
403
+ workspace_id: string;
404
+ source_kind: string;
405
+ source_id: string;
406
+ end_user_ref?: string;
407
+ status: string;
408
+ provider: string;
409
+ provider_ref?: string;
410
+ provider_customer_ref?: string;
411
+ plan_id?: string;
412
+ initial_invoice_id?: string;
413
+ currency: string;
414
+ amount_cents: number;
415
+ interval: string;
416
+ current_period_start?: string;
417
+ current_period_end?: string;
418
+ trial_ends_at?: string;
419
+ cancel_at_period_end: boolean;
420
+ canceled_at?: string;
421
+ meta?: Record<string, unknown>;
422
+ created_at: string;
423
+ updated_at: string;
424
+ }
425
+ export interface SubscriptionAgreementResponse {
426
+ agreement: SubscriptionAgreement;
427
+ }
428
+ export interface SubscriptionListResponse {
429
+ items: SubscriptionAgreement[];
430
+ has_more: boolean;
431
+ next_cursor?: string;
432
+ }
433
+ export interface SubscriptionInvoice {
434
+ id: string;
435
+ workspace_id: string;
436
+ agreement_id: string;
437
+ source_kind: string;
438
+ source_id: string;
439
+ invoice_number: string;
440
+ status: string;
441
+ currency: string;
442
+ subtotal_cents: number;
443
+ tax_cents: number;
444
+ total_cents: number;
445
+ paid_cents: number;
446
+ period_start?: string;
447
+ period_end?: string;
448
+ due_at?: string;
449
+ paid_at?: string;
450
+ payment_id?: string;
451
+ attempt_count: number;
452
+ failure_code?: string;
453
+ failure_message?: string;
454
+ meta?: Record<string, unknown>;
455
+ created_at: string;
456
+ updated_at: string;
457
+ }
458
+ export interface SubscriptionInvoiceResponse {
459
+ invoice: SubscriptionInvoice;
460
+ }
461
+ export interface SubscriptionInvoiceListResponse {
462
+ items: SubscriptionInvoice[];
463
+ has_more: boolean;
464
+ next_cursor?: string;
465
+ }
466
+ export interface SubscriptionSourceDisplay {
467
+ source_app: string;
468
+ source_kind: string;
469
+ source_id: string;
470
+ app_label: string;
471
+ object_label: string;
472
+ subtitle?: string;
473
+ variant?: string;
474
+ admin_href?: string;
475
+ customer_href?: string;
476
+ status?: string;
477
+ }
478
+ export interface SubscriptionSourceResponse {
479
+ source_display: SubscriptionSourceDisplay;
480
+ }
271
481
  export interface StartGivingInput {
272
482
  variant?: string;
273
483
  title?: string;
@@ -613,6 +823,8 @@ export interface OrderItem {
613
823
  quantity: number;
614
824
  unit_price_cents: number;
615
825
  line_total_cents: number;
826
+ /** Stripe product tax code, snapshotted from the product at order time. */
827
+ tax_code?: string;
616
828
  [key: string]: unknown;
617
829
  }
618
830
  export interface CartResponse {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c1m-public/channel-client",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Typed server-side client for the MML headless Channel API",