@c1m-public/channel-client 0.17.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,125 +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
  };
301
+ readonly leadPortal: {
302
+ readonly requestLink: (input: DashLeadPortalRequestLinkInput) => Promise<DashLeadPortalRequestLinkResponse>;
303
+ readonly view: (token: string) => Promise<DashLeadPortalView>;
304
+ };
51
305
  };
52
306
  readonly assetUrl: (pathOrUrl: string) => string;
53
307
  readonly site: {
54
- readonly resolve: (params?: import("./index.js").ChannelSiteResolveParams) => Promise<import("./types.js").SiteDocument>;
308
+ readonly resolve: (params?: ChannelSiteResolveParams) => Promise<SiteDocument>;
55
309
  };
56
310
  readonly init: {
57
- readonly get: () => Promise<import("./types.js").PublicWorkspaceInit>;
58
- readonly light: () => Promise<import("./types.js").LightInitResponse>;
311
+ readonly get: () => Promise<PublicWorkspaceInit>;
312
+ readonly light: () => Promise<LightInitResponse>;
59
313
  };
60
314
  readonly pages: {
61
- readonly list: (params?: import("./index.js").ChannelListParams) => Promise<import("./types.js").ListResponse<import("./types.js").PublicPageSummary>>;
315
+ readonly list: (params?: ChannelListParams) => Promise<ListResponse<PublicPageSummary>>;
62
316
  readonly get: (slug: string) => Promise<{
63
- page: import("./types.js").PublicPage;
317
+ page: PublicPage;
64
318
  }>;
65
319
  };
66
320
  readonly products: {
67
- readonly list: (params?: import("./index.js").ChannelProductListParams) => Promise<import("./types.js").ListResponse<import("./types.js").Product>>;
321
+ readonly list: (params?: ChannelProductListParams) => Promise<ListResponse<Product>>;
68
322
  readonly get: (slug: string) => Promise<{
69
- product: import("./types.js").Product;
323
+ product: Product;
70
324
  }>;
71
- readonly media: (slug: string) => Promise<import("./types.js").ListResponse<import("./types.js").ProductAsset>>;
325
+ readonly media: (slug: string) => Promise<ListResponse<ProductAsset>>;
72
326
  };
73
327
  readonly categories: {
74
- readonly list: (params?: import("./index.js").ChannelListParams) => Promise<import("./types.js").ListResponse<import("./types.js").CatalogCategory>>;
75
- readonly products: (slug: string) => Promise<import("./types.js").CatalogProductsResponse>;
328
+ readonly list: (params?: ChannelListParams) => Promise<ListResponse<CatalogCategory>>;
329
+ readonly products: (slug: string) => Promise<CatalogProductsResponse>;
76
330
  };
77
331
  readonly collections: {
78
- readonly list: (params?: import("./index.js").ChannelListParams) => Promise<import("./types.js").ListResponse<import("./types.js").CatalogCollection>>;
79
- readonly products: (slug: string) => Promise<import("./types.js").CatalogProductsResponse>;
332
+ readonly list: (params?: ChannelListParams) => Promise<ListResponse<CatalogCollection>>;
333
+ readonly products: (slug: string) => Promise<CatalogProductsResponse>;
80
334
  };
81
335
  readonly brands: {
82
- readonly list: (params?: import("./index.js").ChannelListParams) => Promise<import("./types.js").ListResponse<import("./types.js").CatalogBrand>>;
336
+ readonly list: (params?: ChannelListParams) => Promise<ListResponse<CatalogBrand>>;
83
337
  };
84
338
  readonly cart: {
85
- readonly get: (cartToken: string) => Promise<import("./types.js").CartResponse>;
86
- readonly addItem: (input: import("./types.js").AddCartItemInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").CartResponse>;
87
- readonly updateItem: (itemId: string, input: import("./types.js").UpdateCartItemInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").CartResponse>;
88
- readonly removeItem: (itemId: string, cartToken: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").CartResponse>;
89
- readonly clear: (cartToken: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").CartResponse>;
90
- 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>;
91
345
  };
92
346
  readonly checkout: {
93
- readonly options: (orderId: string, cartToken: string) => Promise<import("./types.js").CheckoutOptions>;
94
- readonly status: (orderId: string, params?: import("./index.js").ChannelCheckoutStatusParams) => Promise<import("./types.js").CheckoutStatusResponse>;
95
- readonly setCustomer: (orderId: string, input: import("./types.js").CheckoutCustomerInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").CartResponse>;
96
- readonly setAddresses: (orderId: string, input: import("./types.js").CheckoutAddressesInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").CartResponse>;
97
- readonly setFulfillment: (orderId: string, input: import("./types.js").CheckoutFulfillmentInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").CartResponse>;
98
- 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>;
99
353
  };
100
354
  readonly reviews: {
101
- readonly list: (params?: import("./index.js").ChannelListParams) => Promise<import("./types.js").ListResponse<import("./types.js").Review>>;
102
- readonly summary: () => Promise<import("./types.js").ReviewSummaryResponse>;
103
- 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<{
104
358
  message: string;
105
359
  }>;
106
360
  };
107
361
  readonly theme: {
108
- readonly get: () => Promise<import("./types.js").ThemeResponse>;
362
+ readonly get: () => Promise<ThemeResponse>;
109
363
  };
110
364
  readonly menus: {
111
- readonly get: (handle: string) => Promise<import("./types.js").MenuResponse>;
365
+ readonly get: (handle: string) => Promise<MenuResponse>;
112
366
  };
113
367
  readonly blog: {
114
- readonly list: (params?: import("./index.js").ChannelListParams) => Promise<import("./types.js").ListResponse<import("./types.js").BlogPost>>;
115
- readonly get: (slug: string) => Promise<import("./types.js").BlogPostResponse>;
368
+ readonly list: (params?: ChannelListParams) => Promise<ListResponse<BlogPost>>;
369
+ readonly get: (slug: string) => Promise<BlogPostResponse>;
116
370
  };
117
371
  readonly giving: {
118
372
  readonly entries: {
119
373
  readonly list: () => Promise<{
120
- items: import("./types.js").GivingEntry[];
374
+ items: GivingEntry[];
121
375
  }>;
122
376
  readonly get: (slug: string) => Promise<{
123
- entry: import("./types.js").GivingEntry;
377
+ entry: GivingEntry;
124
378
  }>;
125
379
  };
126
- 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>;
127
381
  };
128
382
  readonly subscriptions: {
129
383
  readonly plans: {
130
- readonly list: () => Promise<import("./types.js").SubscriptionPlanListResponse>;
131
- readonly get: (planId: string) => Promise<import("./types.js").SubscriptionPlanResponse>;
384
+ readonly list: () => Promise<SubscriptionPlanListResponse>;
385
+ readonly get: (planId: string) => Promise<SubscriptionPlanResponse>;
386
+ };
387
+ };
388
+ readonly paymentLinks: {
389
+ readonly get: (linkId: string) => Promise<PublicPaymentLinkResponse>;
390
+ readonly checkout: (linkId: string, input: PaymentLinkCheckoutInput, mutation?: ChannelMutationOptions) => Promise<PaymentLinkCheckoutResponse>;
391
+ readonly redemptions: {
392
+ readonly get: (linkId: string, redemptionId: string) => Promise<PaymentLinkRedemptionStatusResponse>;
132
393
  };
133
394
  };
134
395
  readonly print: {
135
- readonly settings: () => Promise<import("./types.js").PrintSettingsResponse>;
136
- readonly quote: (input: import("./types.js").PrintOptionsSelection, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").PrintQuoteResponse>;
137
- readonly intake: (input: import("./types.js").PrintIntakeInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<{
138
- 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;
139
400
  }>;
140
401
  };
141
402
  readonly dining: {
142
- readonly menu: (boardSlug: string) => Promise<import("./types.js").DiningMenu>;
403
+ readonly menu: (boardSlug: string) => Promise<DiningMenu>;
143
404
  };
144
405
  readonly auth: {
145
406
  readonly check: (email: string) => Promise<{
@@ -149,26 +410,26 @@ export declare function createNextChannelClient(options: CreateNextChannelClient
149
410
  email: string;
150
411
  name: string;
151
412
  phone?: string;
152
- }) => Promise<import("./types.js").CustomerSignupResponse>;
153
- readonly sendCode: (email: string) => Promise<import("./types.js").SendCodeResponse>;
413
+ }) => Promise<CustomerSignupResponse>;
414
+ readonly sendCode: (email: string) => Promise<SendCodeResponse>;
154
415
  readonly verifyCode: (input: {
155
416
  email: string;
156
417
  code: string;
157
- }) => Promise<import("./types.js").CustomerSession>;
158
- readonly refresh: (refreshToken: string) => Promise<import("./types.js").CustomerSession>;
418
+ }) => Promise<CustomerSession>;
419
+ readonly refresh: (refreshToken: string) => Promise<CustomerSession>;
159
420
  };
160
421
  readonly withCustomer: (session: string) => {
161
- readonly me: () => Promise<import("./types.js").CustomerResponse>;
422
+ readonly me: () => Promise<CustomerResponse>;
162
423
  readonly updateProfile: (input: {
163
424
  name?: string;
164
425
  phone?: string;
165
- }) => Promise<import("./types.js").CustomerResponse>;
426
+ }) => Promise<CustomerResponse>;
166
427
  readonly logout: () => Promise<{
167
428
  status?: string;
168
429
  }>;
169
430
  readonly sessions: {
170
431
  readonly list: () => Promise<{
171
- items: import("./types.js").CustomerAuthSession[];
432
+ items: CustomerAuthSession[];
172
433
  }>;
173
434
  readonly revoke: (sessionId: string) => Promise<{
174
435
  status?: string;
@@ -183,58 +444,57 @@ export declare function createNextChannelClient(options: CreateNextChannelClient
183
444
  readonly securityActivity: (params?: {
184
445
  category?: string;
185
446
  cursor?: string;
186
- }) => Promise<import("./types.js").CustomerSecurityActivityPage>;
447
+ }) => Promise<CustomerSecurityActivityPage>;
187
448
  readonly orders: {
188
- readonly list: (params?: import("./index.js").ChannelListParams) => Promise<import("./types.js").ListResponse<import("./types.js").Order>>;
449
+ readonly list: (params?: ChannelListParams) => Promise<ListResponse<Order>>;
189
450
  readonly summary: () => Promise<{
190
- summary: import("./types.js").OrderSummary;
451
+ summary: OrderSummary;
191
452
  }>;
192
453
  readonly get: (orderId: string) => Promise<{
193
- order: import("./types.js").Order;
454
+ order: Order;
194
455
  }>;
195
456
  };
196
457
  readonly addresses: {
197
- readonly list: () => Promise<import("./types.js").ListResponse<import("./types.js").SavedAddress>>;
198
- readonly get: (addressId: string) => Promise<import("./types.js").SavedAddressResponse>;
199
- readonly create: (input: import("./types.js").SavedAddressInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SavedAddressResponse>;
200
- readonly update: (addressId: string, input: import("./types.js").SavedAddressUpdateInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SavedAddressResponse>;
201
- 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<{
202
463
  status?: string;
203
464
  }>;
204
- 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>;
205
466
  };
206
467
  readonly paymentMethods: {
207
- readonly list: () => Promise<import("./types.js").ListResponse<import("./types.js").SavedPaymentMethod>>;
208
- readonly setup: (input: import("./types.js").PaymentMethodSetupInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").PaymentMethodSetupResult>;
209
- readonly confirm: (input: import("./types.js").PaymentMethodConfirmInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SavedPaymentMethod>;
210
- readonly setDefault: (methodId: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").PaymentMethodMutationResponse>;
211
- 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>;
212
473
  };
213
474
  readonly subscriptions: {
214
- readonly start: (input: import("./types.js").StartSubscriptionInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SubscriptionAgreementResponse>;
215
- readonly list: (params?: import("./index.js").ChannelSubscriptionListParams) => Promise<import("./types.js").SubscriptionListResponse>;
216
- readonly get: (agreementId: string) => Promise<import("./types.js").SubscriptionAgreementResponse>;
217
- readonly source: (agreementId: string) => Promise<import("./types.js").SubscriptionSourceResponse>;
218
- readonly cancel: (agreementId: string, params?: import("./index.js").ChannelSubscriptionCancelParams, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SubscriptionAgreementResponse>;
219
- readonly pause: (agreementId: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SubscriptionAgreementResponse>;
220
- 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>;
221
482
  readonly invoices: {
222
- readonly list: (agreementId: string, params?: import("./index.js").ChannelInvoiceListParams) => Promise<import("./types.js").SubscriptionInvoiceListResponse>;
223
- readonly get: (invoiceId: string) => Promise<import("./types.js").SubscriptionInvoiceResponse>;
224
- 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>;
225
486
  };
226
487
  };
227
488
  readonly giving: {
228
- readonly list: () => Promise<import("./types.js").GivingIntentListResponse>;
229
- 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>;
230
491
  };
231
492
  };
232
493
  readonly leads: {
233
- readonly create: (input: import("./index.js").ChannelLeadInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<{
234
- lead: import("./types.js").LeadResponse;
494
+ readonly create: (input: ChannelLeadInput, mutation?: ChannelMutationOptions) => Promise<{
495
+ lead: LeadResponse;
235
496
  }>;
236
497
  };
237
498
  };
238
- export * from "./next-session.js";
239
- export * from "./next-webhooks.js";
240
- 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 };