@c1m-public/channel-client 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/next.d.ts CHANGED
@@ -1,5 +1,255 @@
1
- import "server-only";
2
- import { type CreateChannelClientOptions } from "./index.js";
1
+ import { createChannelClient, Order, AddCartItemInput, CartResponse, CheckoutOptions, ChannelCheckoutStatusParams, CheckoutStatusResponse, CheckoutCustomerInput, CheckoutAddressesInput, CheckoutFulfillmentInput, CheckoutPayInput, ChannelMutationOptions, CheckoutPayResponse, CreateChannelClientOptions, ChannelPing, ChannelVisitor, ChannelGeo, DashProfileResponse, DashInitResponse, DashPlansResponse, ListResponse, DashDirectoryRegion, DashDirectoryListParams, DashDirectoryEntry, DashDirectoryProfileResponse, ChannelLeadInput, DashLead, DashLeadPortalRequestLinkInput, DashLeadPortalRequestLinkResponse, DashLeadPortalView, ChannelSiteResolveParams, SiteDocument, PublicWorkspaceInit, LightInitResponse, ChannelListParams, PublicPageSummary, PublicPage, ChannelProductListParams, Product, ProductAsset, CatalogCategory, CatalogProductsResponse, CatalogCollection, CatalogBrand, UpdateCartItemInput, MergeCartInput, Review, ReviewSummaryResponse, PublicSubmitReviewInput, ThemeResponse, MenuResponse, BlogPost, BlogPostResponse, GivingEntry, StartGivingInput, StartGivingResponse, SubscriptionPlanListResponse, SubscriptionPlanResponse, PublicPaymentLinkResponse, PaymentLinkCheckoutInput, PaymentLinkCheckoutResponse, PaymentLinkRedemptionStatusResponse, PrintSettingsResponse, PrintOptionsSelection, PrintQuoteResponse, PrintIntakeInput, PrintJob, DiningMenu, CustomerSignupResponse, SendCodeResponse, CustomerSession, CustomerResponse, CustomerAuthSession, CustomerSecurityActivityPage, OrderSummary, SavedAddress, SavedAddressResponse, SavedAddressInput, SavedAddressUpdateInput, SavedAddressDefaultKind, SavedPaymentMethod, PaymentMethodSetupInput, PaymentMethodSetupResult, PaymentMethodConfirmInput, PaymentMethodMutationResponse, StartSubscriptionInput, SubscriptionAgreementResponse, ChannelSubscriptionListParams, SubscriptionListResponse, SubscriptionSourceResponse, ChannelSubscriptionCancelParams, ChannelInvoiceListParams, SubscriptionInvoiceListResponse, SubscriptionInvoiceResponse, GivingIntentListResponse, LeadResponse } from './index.js';
2
+ import { ChannelWebhookEventDataMap, ChannelWebhookEvent } from './webhooks.js';
3
+
4
+ /**
5
+ * Customer-session kit for Next.js sites.
6
+ *
7
+ * Every headless C1M site needs the same ~250 lines: an httpOnly cookie codec,
8
+ * a refresh-skew decision, and — the part nobody gets right twice — the
9
+ * contested-vs-expired distinction. This kit ships them once.
10
+ *
11
+ * Framework-honest: no `next` imports. The codec returns names, values and
12
+ * attribute objects; the app applies them with `next/headers` or `NextResponse`
13
+ * (a Server Component cannot write cookies, so WHERE they are applied is
14
+ * necessarily the app's decision: proxy.ts or a Server Action).
15
+ */
16
+ /** What the session cookie holds. `expiresAt` is the ACCESS token's expiry. */
17
+ interface SessionTokens {
18
+ accessToken: string;
19
+ refreshToken: string;
20
+ expiresAt: string;
21
+ }
22
+ /** A signed-in customer, normalized for rendering. */
23
+ interface SessionCustomer {
24
+ id: string;
25
+ email: string;
26
+ name: string;
27
+ }
28
+ interface SessionCookieAttributes {
29
+ httpOnly: true;
30
+ secure: true;
31
+ sameSite: "lax";
32
+ path: "/";
33
+ maxAge: number;
34
+ }
35
+ /**
36
+ * The one definition of the session cookie. A second definition is how a cookie
37
+ * ends up readable on one path and not another.
38
+ */
39
+ declare const sessionCookie: {
40
+ readonly name: "__Host-c1m_session";
41
+ readonly attributes: (_isProduction?: boolean) => SessionCookieAttributes;
42
+ readonly serialize: (tokens: SessionTokens) => string;
43
+ /**
44
+ * A cookie is attacker-controlled input: truncated, stale-shaped, or
45
+ * hand-written. Anything unreadable is "not signed in", never a crash.
46
+ */
47
+ readonly parse: (raw: string | undefined) => SessionTokens | null;
48
+ readonly needsRefresh: (tokens: SessionTokens, now?: number) => boolean;
49
+ };
50
+ type RequestCodeOutcome = {
51
+ state: "sent";
52
+ } | {
53
+ state: "failed";
54
+ };
55
+ type SignInOutcome = {
56
+ state: "signed-in";
57
+ customer: SessionCustomer;
58
+ tokens: SessionTokens;
59
+ /** Ready to hand to cookies().set(...) — name, value, attributes. */
60
+ cookie: {
61
+ name: string;
62
+ value: string;
63
+ attributes: SessionCookieAttributes;
64
+ };
65
+ } | {
66
+ state: "invalid-code";
67
+ } | {
68
+ state: "failed";
69
+ };
70
+ /**
71
+ * What to do with the session cookie after a refresh attempt.
72
+ *
73
+ * `keep` and `clear` are NOT interchangeable. Clearing when the customer merely
74
+ * lost a race with their own second tab discards the fresh token that tab just
75
+ * stored — logging them out of a live session. The server keeps the token
76
+ * family alive for a short rotation grace window and reports the loser as
77
+ * `refresh_contested` precisely so clients can tell the two apart.
78
+ */
79
+ type SessionRefreshResult = {
80
+ action: "keep";
81
+ } | {
82
+ action: "write";
83
+ value: string;
84
+ attributes: SessionCookieAttributes;
85
+ } | {
86
+ action: "clear";
87
+ };
88
+ type SessionClient = Pick<ReturnType<typeof createChannelClient>, "auth" | "withCustomer">;
89
+ interface CreateCustomerSessionOptions {
90
+ /** The channel client, or a lazy resolver (the singleton pattern). */
91
+ client: SessionClient | (() => SessionClient);
92
+ }
93
+ /**
94
+ * The session surface a site actually needs, mapped to intentional outcomes —
95
+ * a route renders "that code was wrong" without ever seeing an HTTP status.
96
+ */
97
+ declare function createCustomerSession(options: CreateCustomerSessionOptions): {
98
+ readonly cookie: {
99
+ readonly name: "__Host-c1m_session";
100
+ readonly attributes: (_isProduction?: boolean) => SessionCookieAttributes;
101
+ readonly serialize: (tokens: SessionTokens) => string;
102
+ /**
103
+ * A cookie is attacker-controlled input: truncated, stale-shaped, or
104
+ * hand-written. Anything unreadable is "not signed in", never a crash.
105
+ */
106
+ readonly parse: (raw: string | undefined) => SessionTokens | null;
107
+ readonly needsRefresh: (tokens: SessionTokens, now?: number) => boolean;
108
+ };
109
+ readonly requestCode: (email: string) => Promise<RequestCodeOutcome>;
110
+ readonly signIn: (email: string, code: string) => Promise<SignInOutcome>;
111
+ /**
112
+ * Decide what this request should do to the session cookie. Designed to be
113
+ * the whole body of proxy.ts.
114
+ */
115
+ readonly refresh: (raw: string | undefined) => Promise<SessionRefreshResult>;
116
+ /** Who is signed in, or null. Never throws — a broken cookie is "signed out". */
117
+ readonly getCustomer: (raw: string | undefined) => Promise<SessionCustomer | null>;
118
+ /** Best-effort server logout; the caller clears the cookie REGARDLESS. */
119
+ readonly signOut: (raw: string | undefined) => Promise<void>;
120
+ };
121
+ type CustomerSessionKit = ReturnType<typeof createCustomerSession>;
122
+
123
+ /**
124
+ * Webhook route factory: the whole app/api/webhooks/c1m/route.ts in one call.
125
+ *
126
+ * import { revalidatePath, revalidateTag } from "next/cache";
127
+ * export const POST = createChannelWebhookRoute({
128
+ * secret: () => process.env.C1M_CHANNEL_WEBHOOK_SECRET!,
129
+ * invalidate: { revalidatePath, revalidateTag },
130
+ * });
131
+ *
132
+ * The invalidator is injected rather than imported here on purpose: it keeps
133
+ * this module free of `next` (bundler-safe, unit-testable with a fake), and it
134
+ * is the app's two-line import — not eighty lines of verification, dispatch,
135
+ * path-safety and error-mapping boilerplate.
136
+ */
137
+ /** The cache tag every anonymous site read is filed under. */
138
+ declare const CHANNEL_SITE_CACHE_TAG = "channel:site";
139
+ /**
140
+ * The cache tag catalog reads (product list, product detail) are filed under.
141
+ * `product.*` events bust this tag by default, so a merchant's price edit
142
+ * reaches the storefront on the next request instead of at the end of a TTL.
143
+ */
144
+ declare const CHANNEL_CATALOG_CACHE_TAG = "channel:catalog";
145
+ interface ChannelCacheInvalidator {
146
+ revalidatePath(path: string): void;
147
+ revalidateTag(tag: string): void;
148
+ }
149
+ interface ChannelWebhookRouteLogger {
150
+ info(message: string, context?: Record<string, unknown>): void;
151
+ warn(message: string, context?: Record<string, unknown>): void;
152
+ error(message: string, context?: Record<string, unknown>): void;
153
+ }
154
+ type ChannelWebhookHandlers = {
155
+ [T in keyof ChannelWebhookEventDataMap]?: (event: ChannelWebhookEvent<T>, invalidate: ChannelCacheInvalidator) => void | Promise<void>;
156
+ };
157
+ interface CreateChannelWebhookRouteOptions {
158
+ /** The whsec_ signing secret, or a lazy resolver (resolved per request so builds without env pass). */
159
+ secret: string | (() => string);
160
+ /** Next's cache invalidation, injected: `{ revalidatePath, revalidateTag }` from next/cache. */
161
+ invalidate: ChannelCacheInvalidator;
162
+ /**
163
+ * Per-event handlers. A handler REPLACES the built-in behavior for that type;
164
+ * types without a handler get the default (page.published revalidates the
165
+ * site tag + the published path; everything else is acknowledged and ignored
166
+ * — delivery is at-least-once, so an unhandled event must still 204 or the
167
+ * server will retry it for hours).
168
+ */
169
+ onEvent?: ChannelWebhookHandlers;
170
+ logger?: ChannelWebhookRouteLogger;
171
+ }
172
+ /**
173
+ * A route_pattern arrives from the network; it is input, not truth. Reject
174
+ * anything that is not a plain absolute path before handing it to the cache.
175
+ */
176
+ declare function safePublishedPath(path: string): string | undefined;
177
+ /** Build the POST handler for the channel webhook endpoint. */
178
+ declare function createChannelWebhookRoute(options: CreateChannelWebhookRouteOptions): (request: Request) => Promise<Response>;
179
+
180
+ interface CartCookieAttributes {
181
+ httpOnly: true;
182
+ secure: boolean;
183
+ sameSite: "lax";
184
+ path: "/";
185
+ maxAge: number;
186
+ }
187
+ declare const cartCookie: {
188
+ readonly name: "cart_token";
189
+ readonly attributes: (isProduction?: boolean) => CartCookieAttributes;
190
+ /**
191
+ * The client mints the token (the server accepts any sufficiently-random
192
+ * bearer key and creates the cart row on first use).
193
+ */
194
+ readonly mint: () => string;
195
+ /** Tolerant read: an absent or garbage cookie means "no cart yet". */
196
+ readonly parse: (raw: string | undefined) => string | null;
197
+ };
198
+ type CartClient = Pick<ReturnType<typeof createChannelClient>, "cart" | "checkout">;
199
+ interface CreateCartOptions {
200
+ /** The channel client, or a lazy resolver (the singleton pattern). */
201
+ client: CartClient | (() => CartClient);
202
+ }
203
+ /**
204
+ * Cart + checkout, with the token threading done for you. Every method returns
205
+ * the cart's underlying ORDER — checkout steps are addressed by its id.
206
+ */
207
+ declare function createCart(options: CreateCartOptions): {
208
+ readonly cookie: {
209
+ readonly name: "cart_token";
210
+ readonly attributes: (isProduction?: boolean) => CartCookieAttributes;
211
+ /**
212
+ * The client mints the token (the server accepts any sufficiently-random
213
+ * bearer key and creates the cart row on first use).
214
+ */
215
+ readonly mint: () => string;
216
+ /** Tolerant read: an absent or garbage cookie means "no cart yet". */
217
+ readonly parse: (raw: string | undefined) => string | null;
218
+ };
219
+ /** Null when the token has no cart yet — a new visitor, not an error. */
220
+ readonly get: (cartToken: string) => Promise<Order | null>;
221
+ readonly addItem: (input: AddCartItemInput) => Promise<CartResponse>;
222
+ readonly updateItem: (itemId: string, cartToken: string, quantity: number) => Promise<CartResponse>;
223
+ readonly removeItem: (itemId: string, cartToken: string) => Promise<CartResponse>;
224
+ readonly clear: (cartToken: string) => Promise<CartResponse>;
225
+ /**
226
+ * Call in the same Server Action that sets the session cookie: the guest's
227
+ * cart follows the customer into their account instead of evaporating at
228
+ * the sign-in door.
229
+ */
230
+ readonly mergeOnSignIn: (guestCartToken: string, customerCartToken: string) => Promise<CartResponse>;
231
+ /** Checkout steps, addressed by the order the cart became. */
232
+ readonly checkout: {
233
+ readonly options: (orderId: string, cartToken: string) => Promise<CheckoutOptions>;
234
+ readonly status: (orderId: string, params?: ChannelCheckoutStatusParams) => Promise<CheckoutStatusResponse>;
235
+ readonly setCustomer: (orderId: string, input: CheckoutCustomerInput) => Promise<CartResponse>;
236
+ readonly setAddresses: (orderId: string, input: CheckoutAddressesInput) => Promise<CartResponse>;
237
+ readonly setFulfillment: (orderId: string, input: CheckoutFulfillmentInput) => Promise<CartResponse>;
238
+ /**
239
+ * Returns the Stripe-hosted redirect URL. `return_url` is REQUIRED for a
240
+ * channel checkout (our API's host means nothing to your shopper) and
241
+ * must be on the channel's registered site_url — the server refuses
242
+ * anything else, because an unchecked return URL is an open redirect.
243
+ */
244
+ readonly pay: (orderId: string, input: CheckoutPayInput & {
245
+ return_url: string;
246
+ }, attempt: ChannelMutationOptions & {
247
+ idempotencyKey: string;
248
+ }) => Promise<CheckoutPayResponse>;
249
+ };
250
+ };
251
+ type CartKit = ReturnType<typeof createCart>;
252
+
3
253
  /**
4
254
  * Cache policy for anonymous GETs. `tags` are applied to every cached read;
5
255
  * `tagsFor` (or the default classifier) adds per-request tags so a webhook
@@ -8,12 +258,12 @@ import { type CreateChannelClientOptions } from "./index.js";
8
258
  * `channel:site` (busted by `page.published`). Without this the kit's default
9
259
  * `product.*` handler invalidates a tag no fetch carries.
10
260
  */
11
- export type NextChannelCachePolicy = "no-store" | {
261
+ type NextChannelCachePolicy = "no-store" | {
12
262
  revalidate: number;
13
263
  tags?: string[];
14
264
  tagsFor?: (pathname: string) => string[];
15
265
  };
16
- export interface CreateNextChannelClientOptions extends Omit<CreateChannelClientOptions, "fetch"> {
266
+ interface CreateNextChannelClientOptions extends Omit<CreateChannelClientOptions, "fetch"> {
17
267
  fetch?: typeof globalThis.fetch;
18
268
  cache?: NextChannelCachePolicy;
19
269
  }
@@ -21,136 +271,136 @@ export interface CreateNextChannelClientOptions extends Omit<CreateChannelClient
21
271
  * Default classifier: catalog reads → `channel:catalog`, all other anonymous
22
272
  * reads → `channel:site`. Exported so a site can compose it with its own tags.
23
273
  */
24
- export declare function defaultChannelCacheTags(pathname: string): string[];
274
+ declare function defaultChannelCacheTags(pathname: string): string[];
25
275
  /**
26
276
  * Build the Channel API client with Next.js Data Cache semantics.
27
277
  *
28
278
  * Only anonymous GETs may receive `next.revalidate`; customer-scoped reads and
29
279
  * mutations are forced to `no-store` by both this adapter and the core client.
30
280
  */
31
- export declare function createNextChannelClient(options: CreateNextChannelClientOptions): {
32
- readonly ping: (challenge?: string) => Promise<import("./types.js").ChannelPing>;
33
- readonly withVisitor: (visitor: import("./index.js").ChannelVisitor) => /*elided*/ any;
281
+ declare function createNextChannelClient(options: CreateNextChannelClientOptions): {
282
+ readonly ping: (challenge?: string) => Promise<ChannelPing>;
283
+ readonly withVisitor: (visitor: ChannelVisitor) => /*elided*/ any;
34
284
  readonly geo: {
35
- readonly detect: () => Promise<import("./types.js").ChannelGeo>;
285
+ readonly detect: () => Promise<ChannelGeo>;
36
286
  };
37
287
  readonly dash: {
38
- readonly profile: () => Promise<import("./types.js").DashProfileResponse>;
39
- readonly init: () => Promise<import("./types.js").DashInitResponse>;
40
- readonly plans: () => Promise<import("./types.js").DashPlansResponse>;
288
+ readonly profile: () => Promise<DashProfileResponse>;
289
+ readonly init: () => Promise<DashInitResponse>;
290
+ readonly plans: () => Promise<DashPlansResponse>;
41
291
  readonly directory: {
42
- readonly regions: () => Promise<import("./types.js").ListResponse<import("./types.js").DashDirectoryRegion>>;
43
- readonly list: (params?: import("./index.js").DashDirectoryListParams) => Promise<import("./types.js").ListResponse<import("./types.js").DashDirectoryEntry>>;
44
- readonly get: (idOrSlug: string) => Promise<import("./types.js").DashDirectoryProfileResponse>;
292
+ readonly regions: () => Promise<ListResponse<DashDirectoryRegion>>;
293
+ readonly list: (params?: DashDirectoryListParams) => Promise<ListResponse<DashDirectoryEntry>>;
294
+ readonly get: (idOrSlug: string) => Promise<DashDirectoryProfileResponse>;
45
295
  };
46
296
  readonly leads: {
47
- readonly create: (input: import("./index.js").ChannelLeadInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<{
48
- lead: import("./types.js").DashLead;
297
+ readonly create: (input: ChannelLeadInput, mutation?: ChannelMutationOptions) => Promise<{
298
+ lead: DashLead;
49
299
  }>;
50
300
  };
51
301
  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>;
302
+ readonly requestLink: (input: DashLeadPortalRequestLinkInput) => Promise<DashLeadPortalRequestLinkResponse>;
303
+ readonly view: (token: string) => Promise<DashLeadPortalView>;
54
304
  };
55
305
  };
56
306
  readonly assetUrl: (pathOrUrl: string) => string;
57
307
  readonly site: {
58
- readonly resolve: (params?: import("./index.js").ChannelSiteResolveParams) => Promise<import("./types.js").SiteDocument>;
308
+ readonly resolve: (params?: ChannelSiteResolveParams) => Promise<SiteDocument>;
59
309
  };
60
310
  readonly init: {
61
- readonly get: () => Promise<import("./types.js").PublicWorkspaceInit>;
62
- readonly light: () => Promise<import("./types.js").LightInitResponse>;
311
+ readonly get: () => Promise<PublicWorkspaceInit>;
312
+ readonly light: () => Promise<LightInitResponse>;
63
313
  };
64
314
  readonly pages: {
65
- readonly list: (params?: import("./index.js").ChannelListParams) => Promise<import("./types.js").ListResponse<import("./types.js").PublicPageSummary>>;
315
+ readonly list: (params?: ChannelListParams) => Promise<ListResponse<PublicPageSummary>>;
66
316
  readonly get: (slug: string) => Promise<{
67
- page: import("./types.js").PublicPage;
317
+ page: PublicPage;
68
318
  }>;
69
319
  };
70
320
  readonly products: {
71
- readonly list: (params?: import("./index.js").ChannelProductListParams) => Promise<import("./types.js").ListResponse<import("./types.js").Product>>;
321
+ readonly list: (params?: ChannelProductListParams) => Promise<ListResponse<Product>>;
72
322
  readonly get: (slug: string) => Promise<{
73
- product: import("./types.js").Product;
323
+ product: Product;
74
324
  }>;
75
- readonly media: (slug: string) => Promise<import("./types.js").ListResponse<import("./types.js").ProductAsset>>;
325
+ readonly media: (slug: string) => Promise<ListResponse<ProductAsset>>;
76
326
  };
77
327
  readonly categories: {
78
- readonly list: (params?: import("./index.js").ChannelListParams) => Promise<import("./types.js").ListResponse<import("./types.js").CatalogCategory>>;
79
- readonly products: (slug: string) => Promise<import("./types.js").CatalogProductsResponse>;
328
+ readonly list: (params?: ChannelListParams) => Promise<ListResponse<CatalogCategory>>;
329
+ readonly products: (slug: string) => Promise<CatalogProductsResponse>;
80
330
  };
81
331
  readonly collections: {
82
- readonly list: (params?: import("./index.js").ChannelListParams) => Promise<import("./types.js").ListResponse<import("./types.js").CatalogCollection>>;
83
- readonly products: (slug: string) => Promise<import("./types.js").CatalogProductsResponse>;
332
+ readonly list: (params?: ChannelListParams) => Promise<ListResponse<CatalogCollection>>;
333
+ readonly products: (slug: string) => Promise<CatalogProductsResponse>;
84
334
  };
85
335
  readonly brands: {
86
- readonly list: (params?: import("./index.js").ChannelListParams) => Promise<import("./types.js").ListResponse<import("./types.js").CatalogBrand>>;
336
+ readonly list: (params?: ChannelListParams) => Promise<ListResponse<CatalogBrand>>;
87
337
  };
88
338
  readonly cart: {
89
- readonly get: (cartToken: string) => Promise<import("./types.js").CartResponse>;
90
- readonly addItem: (input: import("./types.js").AddCartItemInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").CartResponse>;
91
- readonly updateItem: (itemId: string, input: import("./types.js").UpdateCartItemInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").CartResponse>;
92
- readonly removeItem: (itemId: string, cartToken: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").CartResponse>;
93
- readonly clear: (cartToken: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").CartResponse>;
94
- readonly merge: (input: import("./types.js").MergeCartInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").CartResponse>;
339
+ readonly get: (cartToken: string) => Promise<CartResponse>;
340
+ readonly addItem: (input: AddCartItemInput, mutation?: ChannelMutationOptions) => Promise<CartResponse>;
341
+ readonly updateItem: (itemId: string, input: UpdateCartItemInput, mutation?: ChannelMutationOptions) => Promise<CartResponse>;
342
+ readonly removeItem: (itemId: string, cartToken: string, mutation?: ChannelMutationOptions) => Promise<CartResponse>;
343
+ readonly clear: (cartToken: string, mutation?: ChannelMutationOptions) => Promise<CartResponse>;
344
+ readonly merge: (input: MergeCartInput, mutation?: ChannelMutationOptions) => Promise<CartResponse>;
95
345
  };
96
346
  readonly checkout: {
97
- readonly options: (orderId: string, cartToken: string) => Promise<import("./types.js").CheckoutOptions>;
98
- readonly status: (orderId: string, params?: import("./index.js").ChannelCheckoutStatusParams) => Promise<import("./types.js").CheckoutStatusResponse>;
99
- readonly setCustomer: (orderId: string, input: import("./types.js").CheckoutCustomerInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").CartResponse>;
100
- readonly setAddresses: (orderId: string, input: import("./types.js").CheckoutAddressesInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").CartResponse>;
101
- readonly setFulfillment: (orderId: string, input: import("./types.js").CheckoutFulfillmentInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").CartResponse>;
102
- readonly pay: (orderId: string, input: import("./types.js").CheckoutPayInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").CheckoutPayResponse>;
347
+ readonly options: (orderId: string, cartToken: string) => Promise<CheckoutOptions>;
348
+ readonly status: (orderId: string, params?: ChannelCheckoutStatusParams) => Promise<CheckoutStatusResponse>;
349
+ readonly setCustomer: (orderId: string, input: CheckoutCustomerInput, mutation?: ChannelMutationOptions) => Promise<CartResponse>;
350
+ readonly setAddresses: (orderId: string, input: CheckoutAddressesInput, mutation?: ChannelMutationOptions) => Promise<CartResponse>;
351
+ readonly setFulfillment: (orderId: string, input: CheckoutFulfillmentInput, mutation?: ChannelMutationOptions) => Promise<CartResponse>;
352
+ readonly pay: (orderId: string, input: CheckoutPayInput, mutation?: ChannelMutationOptions) => Promise<CheckoutPayResponse>;
103
353
  };
104
354
  readonly reviews: {
105
- readonly list: (params?: import("./index.js").ChannelListParams) => Promise<import("./types.js").ListResponse<import("./types.js").Review>>;
106
- readonly summary: () => Promise<import("./types.js").ReviewSummaryResponse>;
107
- readonly submit: (input: import("./types.js").PublicSubmitReviewInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<{
355
+ readonly list: (params?: ChannelListParams) => Promise<ListResponse<Review>>;
356
+ readonly summary: () => Promise<ReviewSummaryResponse>;
357
+ readonly submit: (input: PublicSubmitReviewInput, mutation?: ChannelMutationOptions) => Promise<{
108
358
  message: string;
109
359
  }>;
110
360
  };
111
361
  readonly theme: {
112
- readonly get: () => Promise<import("./types.js").ThemeResponse>;
362
+ readonly get: () => Promise<ThemeResponse>;
113
363
  };
114
364
  readonly menus: {
115
- readonly get: (handle: string) => Promise<import("./types.js").MenuResponse>;
365
+ readonly get: (handle: string) => Promise<MenuResponse>;
116
366
  };
117
367
  readonly blog: {
118
- readonly list: (params?: import("./index.js").ChannelListParams) => Promise<import("./types.js").ListResponse<import("./types.js").BlogPost>>;
119
- readonly get: (slug: string) => Promise<import("./types.js").BlogPostResponse>;
368
+ readonly list: (params?: ChannelListParams) => Promise<ListResponse<BlogPost>>;
369
+ readonly get: (slug: string) => Promise<BlogPostResponse>;
120
370
  };
121
371
  readonly giving: {
122
372
  readonly entries: {
123
373
  readonly list: () => Promise<{
124
- items: import("./types.js").GivingEntry[];
374
+ items: GivingEntry[];
125
375
  }>;
126
376
  readonly get: (slug: string) => Promise<{
127
- entry: import("./types.js").GivingEntry;
377
+ entry: GivingEntry;
128
378
  }>;
129
379
  };
130
- readonly start: (input: import("./types.js").StartGivingInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").StartGivingResponse>;
380
+ readonly start: (input: StartGivingInput, mutation?: ChannelMutationOptions) => Promise<StartGivingResponse>;
131
381
  };
132
382
  readonly subscriptions: {
133
383
  readonly plans: {
134
- readonly list: () => Promise<import("./types.js").SubscriptionPlanListResponse>;
135
- readonly get: (planId: string) => Promise<import("./types.js").SubscriptionPlanResponse>;
384
+ readonly list: () => Promise<SubscriptionPlanListResponse>;
385
+ readonly get: (planId: string) => Promise<SubscriptionPlanResponse>;
136
386
  };
137
387
  };
138
388
  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>;
389
+ readonly get: (linkId: string) => Promise<PublicPaymentLinkResponse>;
390
+ readonly checkout: (linkId: string, input: PaymentLinkCheckoutInput, mutation?: ChannelMutationOptions) => Promise<PaymentLinkCheckoutResponse>;
141
391
  readonly redemptions: {
142
- readonly get: (linkId: string, redemptionId: string) => Promise<import("./types.js").PaymentLinkRedemptionStatusResponse>;
392
+ readonly get: (linkId: string, redemptionId: string) => Promise<PaymentLinkRedemptionStatusResponse>;
143
393
  };
144
394
  };
145
395
  readonly print: {
146
- readonly settings: () => Promise<import("./types.js").PrintSettingsResponse>;
147
- readonly quote: (input: import("./types.js").PrintOptionsSelection, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").PrintQuoteResponse>;
148
- readonly intake: (input: import("./types.js").PrintIntakeInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<{
149
- job: import("./types.js").PrintJob;
396
+ readonly settings: () => Promise<PrintSettingsResponse>;
397
+ readonly quote: (input: PrintOptionsSelection, mutation?: ChannelMutationOptions) => Promise<PrintQuoteResponse>;
398
+ readonly intake: (input: PrintIntakeInput, mutation?: ChannelMutationOptions) => Promise<{
399
+ job: PrintJob;
150
400
  }>;
151
401
  };
152
402
  readonly dining: {
153
- readonly menu: (boardSlug: string) => Promise<import("./types.js").DiningMenu>;
403
+ readonly menu: (boardSlug: string) => Promise<DiningMenu>;
154
404
  };
155
405
  readonly auth: {
156
406
  readonly check: (email: string) => Promise<{
@@ -160,26 +410,26 @@ export declare function createNextChannelClient(options: CreateNextChannelClient
160
410
  email: string;
161
411
  name: string;
162
412
  phone?: string;
163
- }) => Promise<import("./types.js").CustomerSignupResponse>;
164
- readonly sendCode: (email: string) => Promise<import("./types.js").SendCodeResponse>;
413
+ }) => Promise<CustomerSignupResponse>;
414
+ readonly sendCode: (email: string) => Promise<SendCodeResponse>;
165
415
  readonly verifyCode: (input: {
166
416
  email: string;
167
417
  code: string;
168
- }) => Promise<import("./types.js").CustomerSession>;
169
- readonly refresh: (refreshToken: string) => Promise<import("./types.js").CustomerSession>;
418
+ }) => Promise<CustomerSession>;
419
+ readonly refresh: (refreshToken: string) => Promise<CustomerSession>;
170
420
  };
171
421
  readonly withCustomer: (session: string) => {
172
- readonly me: () => Promise<import("./types.js").CustomerResponse>;
422
+ readonly me: () => Promise<CustomerResponse>;
173
423
  readonly updateProfile: (input: {
174
424
  name?: string;
175
425
  phone?: string;
176
- }) => Promise<import("./types.js").CustomerResponse>;
426
+ }) => Promise<CustomerResponse>;
177
427
  readonly logout: () => Promise<{
178
428
  status?: string;
179
429
  }>;
180
430
  readonly sessions: {
181
431
  readonly list: () => Promise<{
182
- items: import("./types.js").CustomerAuthSession[];
432
+ items: CustomerAuthSession[];
183
433
  }>;
184
434
  readonly revoke: (sessionId: string) => Promise<{
185
435
  status?: string;
@@ -194,58 +444,57 @@ export declare function createNextChannelClient(options: CreateNextChannelClient
194
444
  readonly securityActivity: (params?: {
195
445
  category?: string;
196
446
  cursor?: string;
197
- }) => Promise<import("./types.js").CustomerSecurityActivityPage>;
447
+ }) => Promise<CustomerSecurityActivityPage>;
198
448
  readonly orders: {
199
- readonly list: (params?: import("./index.js").ChannelListParams) => Promise<import("./types.js").ListResponse<import("./types.js").Order>>;
449
+ readonly list: (params?: ChannelListParams) => Promise<ListResponse<Order>>;
200
450
  readonly summary: () => Promise<{
201
- summary: import("./types.js").OrderSummary;
451
+ summary: OrderSummary;
202
452
  }>;
203
453
  readonly get: (orderId: string) => Promise<{
204
- order: import("./types.js").Order;
454
+ order: Order;
205
455
  }>;
206
456
  };
207
457
  readonly addresses: {
208
- readonly list: () => Promise<import("./types.js").ListResponse<import("./types.js").SavedAddress>>;
209
- readonly get: (addressId: string) => Promise<import("./types.js").SavedAddressResponse>;
210
- readonly create: (input: import("./types.js").SavedAddressInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SavedAddressResponse>;
211
- readonly update: (addressId: string, input: import("./types.js").SavedAddressUpdateInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SavedAddressResponse>;
212
- readonly delete: (addressId: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<{
458
+ readonly list: () => Promise<ListResponse<SavedAddress>>;
459
+ readonly get: (addressId: string) => Promise<SavedAddressResponse>;
460
+ readonly create: (input: SavedAddressInput, mutation?: ChannelMutationOptions) => Promise<SavedAddressResponse>;
461
+ readonly update: (addressId: string, input: SavedAddressUpdateInput, mutation?: ChannelMutationOptions) => Promise<SavedAddressResponse>;
462
+ readonly delete: (addressId: string, mutation?: ChannelMutationOptions) => Promise<{
213
463
  status?: string;
214
464
  }>;
215
- readonly setDefault: (addressId: string, kind: import("./types.js").SavedAddressDefaultKind, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SavedAddressResponse>;
465
+ readonly setDefault: (addressId: string, kind: SavedAddressDefaultKind, mutation?: ChannelMutationOptions) => Promise<SavedAddressResponse>;
216
466
  };
217
467
  readonly paymentMethods: {
218
- readonly list: () => Promise<import("./types.js").ListResponse<import("./types.js").SavedPaymentMethod>>;
219
- readonly setup: (input: import("./types.js").PaymentMethodSetupInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").PaymentMethodSetupResult>;
220
- readonly confirm: (input: import("./types.js").PaymentMethodConfirmInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SavedPaymentMethod>;
221
- readonly setDefault: (methodId: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").PaymentMethodMutationResponse>;
222
- readonly delete: (methodId: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").PaymentMethodMutationResponse>;
468
+ readonly list: () => Promise<ListResponse<SavedPaymentMethod>>;
469
+ readonly setup: (input: PaymentMethodSetupInput, mutation?: ChannelMutationOptions) => Promise<PaymentMethodSetupResult>;
470
+ readonly confirm: (input: PaymentMethodConfirmInput, mutation?: ChannelMutationOptions) => Promise<SavedPaymentMethod>;
471
+ readonly setDefault: (methodId: string, mutation?: ChannelMutationOptions) => Promise<PaymentMethodMutationResponse>;
472
+ readonly delete: (methodId: string, mutation?: ChannelMutationOptions) => Promise<PaymentMethodMutationResponse>;
223
473
  };
224
474
  readonly subscriptions: {
225
- readonly start: (input: import("./types.js").StartSubscriptionInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SubscriptionAgreementResponse>;
226
- readonly list: (params?: import("./index.js").ChannelSubscriptionListParams) => Promise<import("./types.js").SubscriptionListResponse>;
227
- readonly get: (agreementId: string) => Promise<import("./types.js").SubscriptionAgreementResponse>;
228
- readonly source: (agreementId: string) => Promise<import("./types.js").SubscriptionSourceResponse>;
229
- readonly cancel: (agreementId: string, params?: import("./index.js").ChannelSubscriptionCancelParams, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SubscriptionAgreementResponse>;
230
- readonly pause: (agreementId: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SubscriptionAgreementResponse>;
231
- readonly resume: (agreementId: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SubscriptionAgreementResponse>;
475
+ readonly start: (input: StartSubscriptionInput, mutation?: ChannelMutationOptions) => Promise<SubscriptionAgreementResponse>;
476
+ readonly list: (params?: ChannelSubscriptionListParams) => Promise<SubscriptionListResponse>;
477
+ readonly get: (agreementId: string) => Promise<SubscriptionAgreementResponse>;
478
+ readonly source: (agreementId: string) => Promise<SubscriptionSourceResponse>;
479
+ readonly cancel: (agreementId: string, params?: ChannelSubscriptionCancelParams, mutation?: ChannelMutationOptions) => Promise<SubscriptionAgreementResponse>;
480
+ readonly pause: (agreementId: string, mutation?: ChannelMutationOptions) => Promise<SubscriptionAgreementResponse>;
481
+ readonly resume: (agreementId: string, mutation?: ChannelMutationOptions) => Promise<SubscriptionAgreementResponse>;
232
482
  readonly invoices: {
233
- readonly list: (agreementId: string, params?: import("./index.js").ChannelInvoiceListParams) => Promise<import("./types.js").SubscriptionInvoiceListResponse>;
234
- readonly get: (invoiceId: string) => Promise<import("./types.js").SubscriptionInvoiceResponse>;
235
- readonly payNow: (invoiceId: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SubscriptionInvoiceResponse>;
483
+ readonly list: (agreementId: string, params?: ChannelInvoiceListParams) => Promise<SubscriptionInvoiceListResponse>;
484
+ readonly get: (invoiceId: string) => Promise<SubscriptionInvoiceResponse>;
485
+ readonly payNow: (invoiceId: string, mutation?: ChannelMutationOptions) => Promise<SubscriptionInvoiceResponse>;
236
486
  };
237
487
  };
238
488
  readonly giving: {
239
- readonly list: () => Promise<import("./types.js").GivingIntentListResponse>;
240
- readonly start: (input: import("./types.js").StartGivingInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").StartGivingResponse>;
489
+ readonly list: () => Promise<GivingIntentListResponse>;
490
+ readonly start: (input: StartGivingInput, mutation?: ChannelMutationOptions) => Promise<StartGivingResponse>;
241
491
  };
242
492
  };
243
493
  readonly leads: {
244
- readonly create: (input: import("./index.js").ChannelLeadInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<{
245
- lead: import("./types.js").LeadResponse;
494
+ readonly create: (input: ChannelLeadInput, mutation?: ChannelMutationOptions) => Promise<{
495
+ lead: LeadResponse;
246
496
  }>;
247
497
  };
248
498
  };
249
- export * from "./next-session.js";
250
- export * from "./next-webhooks.js";
251
- export * from "./next-cart.js";
499
+
500
+ export { CHANNEL_CATALOG_CACHE_TAG, CHANNEL_SITE_CACHE_TAG, type CartCookieAttributes, type CartKit, type ChannelCacheInvalidator, type ChannelWebhookHandlers, type ChannelWebhookRouteLogger, type CreateCartOptions, type CreateChannelWebhookRouteOptions, type CreateCustomerSessionOptions, type CreateNextChannelClientOptions, type CustomerSessionKit, type NextChannelCachePolicy, type RequestCodeOutcome, type SessionCookieAttributes, type SessionCustomer, type SessionRefreshResult, type SessionTokens, type SignInOutcome, cartCookie, createCart, createChannelWebhookRoute, createCustomerSession, createNextChannelClient, defaultChannelCacheTags, safePublishedPath, sessionCookie };