@c1m-public/channel-client 0.19.0 → 0.21.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-BSTXJIVL.js +334 -0
- package/dist/chunk-C44TGKRK.js +611 -0
- package/dist/chunk-FRUWMKQP.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 +1339 -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 +355 -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, PaymentCollectionAvailability, 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,139 @@ 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>;
|
|
286
|
+
};
|
|
287
|
+
readonly payments: {
|
|
288
|
+
readonly availability: () => Promise<PaymentCollectionAvailability>;
|
|
36
289
|
};
|
|
37
290
|
readonly dash: {
|
|
38
|
-
readonly profile: () => Promise<
|
|
39
|
-
readonly init: () => Promise<
|
|
40
|
-
readonly plans: () => Promise<
|
|
291
|
+
readonly profile: () => Promise<DashProfileResponse>;
|
|
292
|
+
readonly init: () => Promise<DashInitResponse>;
|
|
293
|
+
readonly plans: () => Promise<DashPlansResponse>;
|
|
41
294
|
readonly directory: {
|
|
42
|
-
readonly regions: () => Promise<
|
|
43
|
-
readonly list: (params?:
|
|
44
|
-
readonly get: (idOrSlug: string) => Promise<
|
|
295
|
+
readonly regions: () => Promise<ListResponse<DashDirectoryRegion>>;
|
|
296
|
+
readonly list: (params?: DashDirectoryListParams) => Promise<ListResponse<DashDirectoryEntry>>;
|
|
297
|
+
readonly get: (idOrSlug: string) => Promise<DashDirectoryProfileResponse>;
|
|
45
298
|
};
|
|
46
299
|
readonly leads: {
|
|
47
|
-
readonly create: (input:
|
|
48
|
-
lead:
|
|
300
|
+
readonly create: (input: ChannelLeadInput, mutation?: ChannelMutationOptions) => Promise<{
|
|
301
|
+
lead: DashLead;
|
|
49
302
|
}>;
|
|
50
303
|
};
|
|
51
304
|
readonly leadPortal: {
|
|
52
|
-
readonly requestLink: (input:
|
|
53
|
-
readonly view: (token: string) => Promise<
|
|
305
|
+
readonly requestLink: (input: DashLeadPortalRequestLinkInput) => Promise<DashLeadPortalRequestLinkResponse>;
|
|
306
|
+
readonly view: (token: string) => Promise<DashLeadPortalView>;
|
|
54
307
|
};
|
|
55
308
|
};
|
|
56
309
|
readonly assetUrl: (pathOrUrl: string) => string;
|
|
57
310
|
readonly site: {
|
|
58
|
-
readonly resolve: (params?:
|
|
311
|
+
readonly resolve: (params?: ChannelSiteResolveParams) => Promise<SiteDocument>;
|
|
59
312
|
};
|
|
60
313
|
readonly init: {
|
|
61
|
-
readonly get: () => Promise<
|
|
62
|
-
readonly light: () => Promise<
|
|
314
|
+
readonly get: () => Promise<PublicWorkspaceInit>;
|
|
315
|
+
readonly light: () => Promise<LightInitResponse>;
|
|
63
316
|
};
|
|
64
317
|
readonly pages: {
|
|
65
|
-
readonly list: (params?:
|
|
318
|
+
readonly list: (params?: ChannelListParams) => Promise<ListResponse<PublicPageSummary>>;
|
|
66
319
|
readonly get: (slug: string) => Promise<{
|
|
67
|
-
page:
|
|
320
|
+
page: PublicPage;
|
|
68
321
|
}>;
|
|
69
322
|
};
|
|
70
323
|
readonly products: {
|
|
71
|
-
readonly list: (params?:
|
|
324
|
+
readonly list: (params?: ChannelProductListParams) => Promise<ListResponse<Product>>;
|
|
72
325
|
readonly get: (slug: string) => Promise<{
|
|
73
|
-
product:
|
|
326
|
+
product: Product;
|
|
74
327
|
}>;
|
|
75
|
-
readonly media: (slug: string) => Promise<
|
|
328
|
+
readonly media: (slug: string) => Promise<ListResponse<ProductAsset>>;
|
|
76
329
|
};
|
|
77
330
|
readonly categories: {
|
|
78
|
-
readonly list: (params?:
|
|
79
|
-
readonly products: (slug: string) => Promise<
|
|
331
|
+
readonly list: (params?: ChannelListParams) => Promise<ListResponse<CatalogCategory>>;
|
|
332
|
+
readonly products: (slug: string) => Promise<CatalogProductsResponse>;
|
|
80
333
|
};
|
|
81
334
|
readonly collections: {
|
|
82
|
-
readonly list: (params?:
|
|
83
|
-
readonly products: (slug: string) => Promise<
|
|
335
|
+
readonly list: (params?: ChannelListParams) => Promise<ListResponse<CatalogCollection>>;
|
|
336
|
+
readonly products: (slug: string) => Promise<CatalogProductsResponse>;
|
|
84
337
|
};
|
|
85
338
|
readonly brands: {
|
|
86
|
-
readonly list: (params?:
|
|
339
|
+
readonly list: (params?: ChannelListParams) => Promise<ListResponse<CatalogBrand>>;
|
|
87
340
|
};
|
|
88
341
|
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:
|
|
342
|
+
readonly get: (cartToken: string) => Promise<CartResponse>;
|
|
343
|
+
readonly addItem: (input: AddCartItemInput, mutation?: ChannelMutationOptions) => Promise<CartResponse>;
|
|
344
|
+
readonly updateItem: (itemId: string, input: UpdateCartItemInput, mutation?: ChannelMutationOptions) => Promise<CartResponse>;
|
|
345
|
+
readonly removeItem: (itemId: string, cartToken: string, mutation?: ChannelMutationOptions) => Promise<CartResponse>;
|
|
346
|
+
readonly clear: (cartToken: string, mutation?: ChannelMutationOptions) => Promise<CartResponse>;
|
|
347
|
+
readonly merge: (input: MergeCartInput, mutation?: ChannelMutationOptions) => Promise<CartResponse>;
|
|
95
348
|
};
|
|
96
349
|
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:
|
|
350
|
+
readonly options: (orderId: string, cartToken: string) => Promise<CheckoutOptions>;
|
|
351
|
+
readonly status: (orderId: string, params?: ChannelCheckoutStatusParams) => Promise<CheckoutStatusResponse>;
|
|
352
|
+
readonly setCustomer: (orderId: string, input: CheckoutCustomerInput, mutation?: ChannelMutationOptions) => Promise<CartResponse>;
|
|
353
|
+
readonly setAddresses: (orderId: string, input: CheckoutAddressesInput, mutation?: ChannelMutationOptions) => Promise<CartResponse>;
|
|
354
|
+
readonly setFulfillment: (orderId: string, input: CheckoutFulfillmentInput, mutation?: ChannelMutationOptions) => Promise<CartResponse>;
|
|
355
|
+
readonly pay: (orderId: string, input: CheckoutPayInput, mutation?: ChannelMutationOptions) => Promise<CheckoutPayResponse>;
|
|
103
356
|
};
|
|
104
357
|
readonly reviews: {
|
|
105
|
-
readonly list: (params?:
|
|
106
|
-
readonly summary: () => Promise<
|
|
107
|
-
readonly submit: (input:
|
|
358
|
+
readonly list: (params?: ChannelListParams) => Promise<ListResponse<Review>>;
|
|
359
|
+
readonly summary: () => Promise<ReviewSummaryResponse>;
|
|
360
|
+
readonly submit: (input: PublicSubmitReviewInput, mutation?: ChannelMutationOptions) => Promise<{
|
|
108
361
|
message: string;
|
|
109
362
|
}>;
|
|
110
363
|
};
|
|
111
364
|
readonly theme: {
|
|
112
|
-
readonly get: () => Promise<
|
|
365
|
+
readonly get: () => Promise<ThemeResponse>;
|
|
113
366
|
};
|
|
114
367
|
readonly menus: {
|
|
115
|
-
readonly get: (handle: string) => Promise<
|
|
368
|
+
readonly get: (handle: string) => Promise<MenuResponse>;
|
|
116
369
|
};
|
|
117
370
|
readonly blog: {
|
|
118
|
-
readonly list: (params?:
|
|
119
|
-
readonly get: (slug: string) => Promise<
|
|
371
|
+
readonly list: (params?: ChannelListParams) => Promise<ListResponse<BlogPost>>;
|
|
372
|
+
readonly get: (slug: string) => Promise<BlogPostResponse>;
|
|
120
373
|
};
|
|
121
374
|
readonly giving: {
|
|
122
375
|
readonly entries: {
|
|
123
376
|
readonly list: () => Promise<{
|
|
124
|
-
items:
|
|
377
|
+
items: GivingEntry[];
|
|
125
378
|
}>;
|
|
126
379
|
readonly get: (slug: string) => Promise<{
|
|
127
|
-
entry:
|
|
380
|
+
entry: GivingEntry;
|
|
128
381
|
}>;
|
|
129
382
|
};
|
|
130
|
-
readonly start: (input:
|
|
383
|
+
readonly start: (input: StartGivingInput, mutation?: ChannelMutationOptions) => Promise<StartGivingResponse>;
|
|
131
384
|
};
|
|
132
385
|
readonly subscriptions: {
|
|
133
386
|
readonly plans: {
|
|
134
|
-
readonly list: () => Promise<
|
|
135
|
-
readonly get: (planId: string) => Promise<
|
|
387
|
+
readonly list: () => Promise<SubscriptionPlanListResponse>;
|
|
388
|
+
readonly get: (planId: string) => Promise<SubscriptionPlanResponse>;
|
|
136
389
|
};
|
|
137
390
|
};
|
|
138
391
|
readonly paymentLinks: {
|
|
139
|
-
readonly get: (linkId: string) => Promise<
|
|
140
|
-
readonly checkout: (linkId: string, input:
|
|
392
|
+
readonly get: (linkId: string) => Promise<PublicPaymentLinkResponse>;
|
|
393
|
+
readonly checkout: (linkId: string, input: PaymentLinkCheckoutInput, mutation?: ChannelMutationOptions) => Promise<PaymentLinkCheckoutResponse>;
|
|
141
394
|
readonly redemptions: {
|
|
142
|
-
readonly get: (linkId: string, redemptionId: string) => Promise<
|
|
395
|
+
readonly get: (linkId: string, redemptionId: string) => Promise<PaymentLinkRedemptionStatusResponse>;
|
|
143
396
|
};
|
|
144
397
|
};
|
|
145
398
|
readonly print: {
|
|
146
|
-
readonly settings: () => Promise<
|
|
147
|
-
readonly quote: (input:
|
|
148
|
-
readonly intake: (input:
|
|
149
|
-
job:
|
|
399
|
+
readonly settings: () => Promise<PrintSettingsResponse>;
|
|
400
|
+
readonly quote: (input: PrintOptionsSelection, mutation?: ChannelMutationOptions) => Promise<PrintQuoteResponse>;
|
|
401
|
+
readonly intake: (input: PrintIntakeInput, mutation?: ChannelMutationOptions) => Promise<{
|
|
402
|
+
job: PrintJob;
|
|
150
403
|
}>;
|
|
151
404
|
};
|
|
152
405
|
readonly dining: {
|
|
153
|
-
readonly menu: (boardSlug: string) => Promise<
|
|
406
|
+
readonly menu: (boardSlug: string) => Promise<DiningMenu>;
|
|
154
407
|
};
|
|
155
408
|
readonly auth: {
|
|
156
409
|
readonly check: (email: string) => Promise<{
|
|
@@ -160,26 +413,26 @@ export declare function createNextChannelClient(options: CreateNextChannelClient
|
|
|
160
413
|
email: string;
|
|
161
414
|
name: string;
|
|
162
415
|
phone?: string;
|
|
163
|
-
}) => Promise<
|
|
164
|
-
readonly sendCode: (email: string) => Promise<
|
|
416
|
+
}) => Promise<CustomerSignupResponse>;
|
|
417
|
+
readonly sendCode: (email: string) => Promise<SendCodeResponse>;
|
|
165
418
|
readonly verifyCode: (input: {
|
|
166
419
|
email: string;
|
|
167
420
|
code: string;
|
|
168
|
-
}) => Promise<
|
|
169
|
-
readonly refresh: (refreshToken: string) => Promise<
|
|
421
|
+
}) => Promise<CustomerSession>;
|
|
422
|
+
readonly refresh: (refreshToken: string) => Promise<CustomerSession>;
|
|
170
423
|
};
|
|
171
424
|
readonly withCustomer: (session: string) => {
|
|
172
|
-
readonly me: () => Promise<
|
|
425
|
+
readonly me: () => Promise<CustomerResponse>;
|
|
173
426
|
readonly updateProfile: (input: {
|
|
174
427
|
name?: string;
|
|
175
428
|
phone?: string;
|
|
176
|
-
}) => Promise<
|
|
429
|
+
}) => Promise<CustomerResponse>;
|
|
177
430
|
readonly logout: () => Promise<{
|
|
178
431
|
status?: string;
|
|
179
432
|
}>;
|
|
180
433
|
readonly sessions: {
|
|
181
434
|
readonly list: () => Promise<{
|
|
182
|
-
items:
|
|
435
|
+
items: CustomerAuthSession[];
|
|
183
436
|
}>;
|
|
184
437
|
readonly revoke: (sessionId: string) => Promise<{
|
|
185
438
|
status?: string;
|
|
@@ -194,58 +447,57 @@ export declare function createNextChannelClient(options: CreateNextChannelClient
|
|
|
194
447
|
readonly securityActivity: (params?: {
|
|
195
448
|
category?: string;
|
|
196
449
|
cursor?: string;
|
|
197
|
-
}) => Promise<
|
|
450
|
+
}) => Promise<CustomerSecurityActivityPage>;
|
|
198
451
|
readonly orders: {
|
|
199
|
-
readonly list: (params?:
|
|
452
|
+
readonly list: (params?: ChannelListParams) => Promise<ListResponse<Order>>;
|
|
200
453
|
readonly summary: () => Promise<{
|
|
201
|
-
summary:
|
|
454
|
+
summary: OrderSummary;
|
|
202
455
|
}>;
|
|
203
456
|
readonly get: (orderId: string) => Promise<{
|
|
204
|
-
order:
|
|
457
|
+
order: Order;
|
|
205
458
|
}>;
|
|
206
459
|
};
|
|
207
460
|
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?:
|
|
461
|
+
readonly list: () => Promise<ListResponse<SavedAddress>>;
|
|
462
|
+
readonly get: (addressId: string) => Promise<SavedAddressResponse>;
|
|
463
|
+
readonly create: (input: SavedAddressInput, mutation?: ChannelMutationOptions) => Promise<SavedAddressResponse>;
|
|
464
|
+
readonly update: (addressId: string, input: SavedAddressUpdateInput, mutation?: ChannelMutationOptions) => Promise<SavedAddressResponse>;
|
|
465
|
+
readonly delete: (addressId: string, mutation?: ChannelMutationOptions) => Promise<{
|
|
213
466
|
status?: string;
|
|
214
467
|
}>;
|
|
215
|
-
readonly setDefault: (addressId: string, kind:
|
|
468
|
+
readonly setDefault: (addressId: string, kind: SavedAddressDefaultKind, mutation?: ChannelMutationOptions) => Promise<SavedAddressResponse>;
|
|
216
469
|
};
|
|
217
470
|
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?:
|
|
471
|
+
readonly list: () => Promise<ListResponse<SavedPaymentMethod>>;
|
|
472
|
+
readonly setup: (input: PaymentMethodSetupInput, mutation?: ChannelMutationOptions) => Promise<PaymentMethodSetupResult>;
|
|
473
|
+
readonly confirm: (input: PaymentMethodConfirmInput, mutation?: ChannelMutationOptions) => Promise<SavedPaymentMethod>;
|
|
474
|
+
readonly setDefault: (methodId: string, mutation?: ChannelMutationOptions) => Promise<PaymentMethodMutationResponse>;
|
|
475
|
+
readonly delete: (methodId: string, mutation?: ChannelMutationOptions) => Promise<PaymentMethodMutationResponse>;
|
|
223
476
|
};
|
|
224
477
|
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?:
|
|
478
|
+
readonly start: (input: StartSubscriptionInput, mutation?: ChannelMutationOptions) => Promise<SubscriptionAgreementResponse>;
|
|
479
|
+
readonly list: (params?: ChannelSubscriptionListParams) => Promise<SubscriptionListResponse>;
|
|
480
|
+
readonly get: (agreementId: string) => Promise<SubscriptionAgreementResponse>;
|
|
481
|
+
readonly source: (agreementId: string) => Promise<SubscriptionSourceResponse>;
|
|
482
|
+
readonly cancel: (agreementId: string, params?: ChannelSubscriptionCancelParams, mutation?: ChannelMutationOptions) => Promise<SubscriptionAgreementResponse>;
|
|
483
|
+
readonly pause: (agreementId: string, mutation?: ChannelMutationOptions) => Promise<SubscriptionAgreementResponse>;
|
|
484
|
+
readonly resume: (agreementId: string, mutation?: ChannelMutationOptions) => Promise<SubscriptionAgreementResponse>;
|
|
232
485
|
readonly invoices: {
|
|
233
|
-
readonly list: (agreementId: string, params?:
|
|
234
|
-
readonly get: (invoiceId: string) => Promise<
|
|
235
|
-
readonly payNow: (invoiceId: string, mutation?:
|
|
486
|
+
readonly list: (agreementId: string, params?: ChannelInvoiceListParams) => Promise<SubscriptionInvoiceListResponse>;
|
|
487
|
+
readonly get: (invoiceId: string) => Promise<SubscriptionInvoiceResponse>;
|
|
488
|
+
readonly payNow: (invoiceId: string, mutation?: ChannelMutationOptions) => Promise<SubscriptionInvoiceResponse>;
|
|
236
489
|
};
|
|
237
490
|
};
|
|
238
491
|
readonly giving: {
|
|
239
|
-
readonly list: () => Promise<
|
|
240
|
-
readonly start: (input:
|
|
492
|
+
readonly list: () => Promise<GivingIntentListResponse>;
|
|
493
|
+
readonly start: (input: StartGivingInput, mutation?: ChannelMutationOptions) => Promise<StartGivingResponse>;
|
|
241
494
|
};
|
|
242
495
|
};
|
|
243
496
|
readonly leads: {
|
|
244
|
-
readonly create: (input:
|
|
245
|
-
lead:
|
|
497
|
+
readonly create: (input: ChannelLeadInput, mutation?: ChannelMutationOptions) => Promise<{
|
|
498
|
+
lead: LeadResponse;
|
|
246
499
|
}>;
|
|
247
500
|
};
|
|
248
501
|
};
|
|
249
|
-
|
|
250
|
-
export
|
|
251
|
-
export * from "./next-cart.js";
|
|
502
|
+
|
|
503
|
+
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 };
|