@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/README.md +16 -5
- package/dist/chunk-ATGQYDRM.js +334 -0
- package/dist/chunk-AX6L2XH3.js +599 -0
- package/dist/chunk-JDERR7M5.js +17 -0
- package/dist/chunk-RJQ4YEZV.js +180 -0
- package/dist/dash-next.d.ts +8 -5
- package/dist/dash-next.js +10 -11
- package/dist/dash.d.ts +7 -5
- package/dist/dash.js +3 -16
- package/dist/index.d.ts +1325 -27
- package/dist/index.js +2 -513
- package/dist/moving-lead-model/index.d.ts +417 -3
- package/dist/moving-lead-model/index.js +288 -2
- package/dist/next.d.ts +352 -103
- package/dist/next.js +3 -69
- package/dist/renderer.d.ts +11 -9
- package/dist/renderer.js +75 -95
- package/dist/webhooks.d.ts +28 -26
- package/dist/webhooks.js +1 -228
- package/package.json +5 -3
- package/dist/errors.d.ts +0 -12
- package/dist/errors.js +0 -19
- package/dist/moving-lead-model/address-model.d.ts +0 -12
- package/dist/moving-lead-model/address-model.js +0 -43
- package/dist/moving-lead-model/address-types.d.ts +0 -55
- package/dist/moving-lead-model/address-types.js +0 -12
- package/dist/moving-lead-model/quote-model.d.ts +0 -348
- package/dist/moving-lead-model/quote-model.js +0 -267
- package/dist/next-cart.d.ts +0 -76
- package/dist/next-cart.js +0 -87
- package/dist/next-session.d.ts +0 -121
- package/dist/next-session.js +0 -177
- package/dist/next-webhooks.d.ts +0 -58
- package/dist/next-webhooks.js +0 -109
- package/dist/types.d.ts +0 -1273
- package/dist/types.js +0 -1
package/dist/next.d.ts
CHANGED
|
@@ -1,5 +1,255 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
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
|
-
|
|
261
|
+
type NextChannelCachePolicy = "no-store" | {
|
|
12
262
|
revalidate: number;
|
|
13
263
|
tags?: string[];
|
|
14
264
|
tagsFor?: (pathname: string) => string[];
|
|
15
265
|
};
|
|
16
|
-
|
|
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
|
-
|
|
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
|
-
|
|
32
|
-
readonly ping: (challenge?: string) => Promise<
|
|
33
|
-
readonly withVisitor: (visitor:
|
|
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<
|
|
285
|
+
readonly detect: () => Promise<ChannelGeo>;
|
|
36
286
|
};
|
|
37
287
|
readonly dash: {
|
|
38
|
-
readonly profile: () => Promise<
|
|
39
|
-
readonly init: () => Promise<
|
|
40
|
-
readonly plans: () => Promise<
|
|
288
|
+
readonly profile: () => Promise<DashProfileResponse>;
|
|
289
|
+
readonly init: () => Promise<DashInitResponse>;
|
|
290
|
+
readonly plans: () => Promise<DashPlansResponse>;
|
|
41
291
|
readonly directory: {
|
|
42
|
-
readonly regions: () => Promise<
|
|
43
|
-
readonly list: (params?:
|
|
44
|
-
readonly get: (idOrSlug: string) => Promise<
|
|
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:
|
|
48
|
-
lead:
|
|
297
|
+
readonly create: (input: ChannelLeadInput, mutation?: ChannelMutationOptions) => Promise<{
|
|
298
|
+
lead: DashLead;
|
|
49
299
|
}>;
|
|
50
300
|
};
|
|
51
301
|
readonly leadPortal: {
|
|
52
|
-
readonly requestLink: (input:
|
|
53
|
-
readonly view: (token: string) => Promise<
|
|
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?:
|
|
308
|
+
readonly resolve: (params?: ChannelSiteResolveParams) => Promise<SiteDocument>;
|
|
59
309
|
};
|
|
60
310
|
readonly init: {
|
|
61
|
-
readonly get: () => Promise<
|
|
62
|
-
readonly light: () => Promise<
|
|
311
|
+
readonly get: () => Promise<PublicWorkspaceInit>;
|
|
312
|
+
readonly light: () => Promise<LightInitResponse>;
|
|
63
313
|
};
|
|
64
314
|
readonly pages: {
|
|
65
|
-
readonly list: (params?:
|
|
315
|
+
readonly list: (params?: ChannelListParams) => Promise<ListResponse<PublicPageSummary>>;
|
|
66
316
|
readonly get: (slug: string) => Promise<{
|
|
67
|
-
page:
|
|
317
|
+
page: PublicPage;
|
|
68
318
|
}>;
|
|
69
319
|
};
|
|
70
320
|
readonly products: {
|
|
71
|
-
readonly list: (params?:
|
|
321
|
+
readonly list: (params?: ChannelProductListParams) => Promise<ListResponse<Product>>;
|
|
72
322
|
readonly get: (slug: string) => Promise<{
|
|
73
|
-
product:
|
|
323
|
+
product: Product;
|
|
74
324
|
}>;
|
|
75
|
-
readonly media: (slug: string) => Promise<
|
|
325
|
+
readonly media: (slug: string) => Promise<ListResponse<ProductAsset>>;
|
|
76
326
|
};
|
|
77
327
|
readonly categories: {
|
|
78
|
-
readonly list: (params?:
|
|
79
|
-
readonly products: (slug: string) => Promise<
|
|
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?:
|
|
83
|
-
readonly products: (slug: string) => Promise<
|
|
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?:
|
|
336
|
+
readonly list: (params?: ChannelListParams) => Promise<ListResponse<CatalogBrand>>;
|
|
87
337
|
};
|
|
88
338
|
readonly cart: {
|
|
89
|
-
readonly get: (cartToken: string) => Promise<
|
|
90
|
-
readonly addItem: (input:
|
|
91
|
-
readonly updateItem: (itemId: string, input:
|
|
92
|
-
readonly removeItem: (itemId: string, cartToken: string, mutation?:
|
|
93
|
-
readonly clear: (cartToken: string, mutation?:
|
|
94
|
-
readonly merge: (input:
|
|
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<
|
|
98
|
-
readonly status: (orderId: string, params?:
|
|
99
|
-
readonly setCustomer: (orderId: string, input:
|
|
100
|
-
readonly setAddresses: (orderId: string, input:
|
|
101
|
-
readonly setFulfillment: (orderId: string, input:
|
|
102
|
-
readonly pay: (orderId: string, input:
|
|
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?:
|
|
106
|
-
readonly summary: () => Promise<
|
|
107
|
-
readonly submit: (input:
|
|
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<
|
|
362
|
+
readonly get: () => Promise<ThemeResponse>;
|
|
113
363
|
};
|
|
114
364
|
readonly menus: {
|
|
115
|
-
readonly get: (handle: string) => Promise<
|
|
365
|
+
readonly get: (handle: string) => Promise<MenuResponse>;
|
|
116
366
|
};
|
|
117
367
|
readonly blog: {
|
|
118
|
-
readonly list: (params?:
|
|
119
|
-
readonly get: (slug: string) => Promise<
|
|
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:
|
|
374
|
+
items: GivingEntry[];
|
|
125
375
|
}>;
|
|
126
376
|
readonly get: (slug: string) => Promise<{
|
|
127
|
-
entry:
|
|
377
|
+
entry: GivingEntry;
|
|
128
378
|
}>;
|
|
129
379
|
};
|
|
130
|
-
readonly start: (input:
|
|
380
|
+
readonly start: (input: StartGivingInput, mutation?: ChannelMutationOptions) => Promise<StartGivingResponse>;
|
|
131
381
|
};
|
|
132
382
|
readonly subscriptions: {
|
|
133
383
|
readonly plans: {
|
|
134
|
-
readonly list: () => Promise<
|
|
135
|
-
readonly get: (planId: string) => Promise<
|
|
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<
|
|
140
|
-
readonly checkout: (linkId: string, input:
|
|
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<
|
|
392
|
+
readonly get: (linkId: string, redemptionId: string) => Promise<PaymentLinkRedemptionStatusResponse>;
|
|
143
393
|
};
|
|
144
394
|
};
|
|
145
395
|
readonly print: {
|
|
146
|
-
readonly settings: () => Promise<
|
|
147
|
-
readonly quote: (input:
|
|
148
|
-
readonly intake: (input:
|
|
149
|
-
job:
|
|
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<
|
|
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<
|
|
164
|
-
readonly sendCode: (email: string) => Promise<
|
|
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<
|
|
169
|
-
readonly refresh: (refreshToken: string) => Promise<
|
|
418
|
+
}) => Promise<CustomerSession>;
|
|
419
|
+
readonly refresh: (refreshToken: string) => Promise<CustomerSession>;
|
|
170
420
|
};
|
|
171
421
|
readonly withCustomer: (session: string) => {
|
|
172
|
-
readonly me: () => Promise<
|
|
422
|
+
readonly me: () => Promise<CustomerResponse>;
|
|
173
423
|
readonly updateProfile: (input: {
|
|
174
424
|
name?: string;
|
|
175
425
|
phone?: string;
|
|
176
|
-
}) => Promise<
|
|
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:
|
|
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<
|
|
447
|
+
}) => Promise<CustomerSecurityActivityPage>;
|
|
198
448
|
readonly orders: {
|
|
199
|
-
readonly list: (params?:
|
|
449
|
+
readonly list: (params?: ChannelListParams) => Promise<ListResponse<Order>>;
|
|
200
450
|
readonly summary: () => Promise<{
|
|
201
|
-
summary:
|
|
451
|
+
summary: OrderSummary;
|
|
202
452
|
}>;
|
|
203
453
|
readonly get: (orderId: string) => Promise<{
|
|
204
|
-
order:
|
|
454
|
+
order: Order;
|
|
205
455
|
}>;
|
|
206
456
|
};
|
|
207
457
|
readonly addresses: {
|
|
208
|
-
readonly list: () => Promise<
|
|
209
|
-
readonly get: (addressId: string) => Promise<
|
|
210
|
-
readonly create: (input:
|
|
211
|
-
readonly update: (addressId: string, input:
|
|
212
|
-
readonly delete: (addressId: string, mutation?:
|
|
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:
|
|
465
|
+
readonly setDefault: (addressId: string, kind: SavedAddressDefaultKind, mutation?: ChannelMutationOptions) => Promise<SavedAddressResponse>;
|
|
216
466
|
};
|
|
217
467
|
readonly paymentMethods: {
|
|
218
|
-
readonly list: () => Promise<
|
|
219
|
-
readonly setup: (input:
|
|
220
|
-
readonly confirm: (input:
|
|
221
|
-
readonly setDefault: (methodId: string, mutation?:
|
|
222
|
-
readonly delete: (methodId: string, mutation?:
|
|
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:
|
|
226
|
-
readonly list: (params?:
|
|
227
|
-
readonly get: (agreementId: string) => Promise<
|
|
228
|
-
readonly source: (agreementId: string) => Promise<
|
|
229
|
-
readonly cancel: (agreementId: string, params?:
|
|
230
|
-
readonly pause: (agreementId: string, mutation?:
|
|
231
|
-
readonly resume: (agreementId: string, mutation?:
|
|
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?:
|
|
234
|
-
readonly get: (invoiceId: string) => Promise<
|
|
235
|
-
readonly payNow: (invoiceId: string, mutation?:
|
|
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<
|
|
240
|
-
readonly start: (input:
|
|
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:
|
|
245
|
-
lead:
|
|
494
|
+
readonly create: (input: ChannelLeadInput, mutation?: ChannelMutationOptions) => Promise<{
|
|
495
|
+
lead: LeadResponse;
|
|
246
496
|
}>;
|
|
247
497
|
};
|
|
248
498
|
};
|
|
249
|
-
|
|
250
|
-
export
|
|
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 };
|