@c1m-public/channel-client 0.39.0 → 1.1.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/{chunk-GPSFEKWL.js → chunk-AVIT2DZR.js} +1 -1
- package/dist/{chunk-LFHMWK6A.js → chunk-BHEDC47V.js} +61 -5
- package/dist/{chunk-VARU5HM6.js → chunk-THK57F6H.js} +2 -2
- package/dist/dash-next.d.ts +1 -1
- package/dist/dash-next.js +3 -3
- package/dist/dash.d.ts +4 -4
- package/dist/dash.js +2 -2
- package/dist/index.d.ts +46 -6
- package/dist/index.js +1 -1
- package/dist/next.d.ts +17 -3
- package/dist/next.js +2 -2
- package/dist/site.d.ts +7 -4
- package/dist/site.js +2 -2
- package/dist/{types-CgleEp97.d.ts → types-DWXo7QE3.d.ts} +48 -6
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isChannelAPIError, createChannelClient } from './chunk-
|
|
1
|
+
import { isChannelAPIError, createChannelClient } from './chunk-BHEDC47V.js';
|
|
2
2
|
import { parseChannelWebhookEvent, isChannelWebhookVerificationError, isChannelWebhookEventType, ChannelConfigurationError } from './chunk-XPO7C3DW.js';
|
|
3
3
|
import 'server-only';
|
|
4
4
|
|
|
@@ -191,6 +191,9 @@ async function visitorHeaders(token, method, path, visitor) {
|
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
193
|
function createChannelClient(options) {
|
|
194
|
+
return buildChannelClient(options);
|
|
195
|
+
}
|
|
196
|
+
function buildChannelClient(options, viewer) {
|
|
194
197
|
const baseUrl = (options.baseUrl === void 0 ? DEFAULT_CHANNEL_API_URL : required(options.baseUrl, "baseUrl")).replace(/\/+$/, "");
|
|
195
198
|
const token = required(options.token, "token");
|
|
196
199
|
if (!token.startsWith(CHANNEL_TOKEN_PREFIX)) throw new ChannelConfigurationError("token must start with sk_chan_");
|
|
@@ -215,12 +218,13 @@ function createChannelClient(options) {
|
|
|
215
218
|
if (signedVisitor) {
|
|
216
219
|
for (const [key, value] of Object.entries(signedVisitor)) headers.set(key, value);
|
|
217
220
|
}
|
|
218
|
-
|
|
221
|
+
const effectiveSession = session ?? viewer;
|
|
222
|
+
if (effectiveSession) headers.set("X-End-User-Token", effectiveSession);
|
|
219
223
|
if (init.body !== void 0 && !isFormDataBody(init.body) && !headers.has("Content-Type")) {
|
|
220
224
|
headers.set("Content-Type", "application/json");
|
|
221
225
|
}
|
|
222
226
|
const requestInit = { ...init, method, headers };
|
|
223
|
-
if (method !== "GET" ||
|
|
227
|
+
if (method !== "GET" || effectiveSession) {
|
|
224
228
|
requestInit.cache = "no-store";
|
|
225
229
|
}
|
|
226
230
|
try {
|
|
@@ -278,7 +282,15 @@ function createChannelClient(options) {
|
|
|
278
282
|
*/
|
|
279
283
|
ping: (challenge) => request("channel.ping", appendQuery("/ping", { challenge })),
|
|
280
284
|
/** Return a request-scoped client that signs trusted edge visitor metadata. */
|
|
281
|
-
withVisitor: (visitor) =>
|
|
285
|
+
withVisitor: (visitor) => buildChannelClient({ ...options, visitor }, viewer),
|
|
286
|
+
/**
|
|
287
|
+
* The full client for a member of a private site: every call carries the
|
|
288
|
+
* viewer's session (`X-End-User-Token`) and is never cached, so pages,
|
|
289
|
+
* catalog, menus, theme and the rest are served per viewer. Pass the
|
|
290
|
+
* session per request, as with `withCustomer`; do not keep the result
|
|
291
|
+
* across visitors. `withCustomer(session)` stays the account-only surface.
|
|
292
|
+
*/
|
|
293
|
+
withViewer: (session) => buildChannelClient(options, required(session, "session")),
|
|
282
294
|
geo: {
|
|
283
295
|
detect: () => request("channel.geo.detect", "/geo/detect")
|
|
284
296
|
},
|
|
@@ -294,11 +306,49 @@ function createChannelClient(options) {
|
|
|
294
306
|
{ cache: "no-store" }
|
|
295
307
|
)
|
|
296
308
|
},
|
|
297
|
-
/**
|
|
298
|
-
|
|
309
|
+
/**
|
|
310
|
+
* The workspace waitlist (workspace token): its gate, form settings and
|
|
311
|
+
* signups. A Dash token uses `dash.waitlist`. `verify` and `unsubscribe`
|
|
312
|
+
* follow the links in waitlist emails and work with any scope.
|
|
313
|
+
*/
|
|
314
|
+
waitlist: {
|
|
315
|
+
status: () => request("channel.waitlist.status", "/waitlist", { cache: "no-store" }),
|
|
316
|
+
form: () => request("channel.waitlist.form", "/waitlist/form", { cache: "no-store" }),
|
|
317
|
+
submit: (input, mutation) => request("channel.waitlist.submit", "/waitlist/entries", {
|
|
318
|
+
method: "POST",
|
|
319
|
+
headers: mutationHeaders(mutation),
|
|
320
|
+
body: JSON.stringify(input)
|
|
321
|
+
}),
|
|
299
322
|
verify: (token2) => linkRequest("/verify", { token: required(token2, "token") }),
|
|
300
323
|
unsubscribe: (key) => linkRequest("/unsubscribe", { key: required(key, "key") })
|
|
301
324
|
},
|
|
325
|
+
/**
|
|
326
|
+
* Lead file requests (workspace token, `leads.write`). The requester's
|
|
327
|
+
* token is the credential and travels in the JSON body. `begin` returns a
|
|
328
|
+
* presigned `upload_url`: the site PUTs the file there itself with
|
|
329
|
+
* `Content-Type: application/octet-stream`, then calls `complete`.
|
|
330
|
+
*/
|
|
331
|
+
fileRequests: {
|
|
332
|
+
view: (token2) => request("channel.file_requests.view", "/file-requests/view", {
|
|
333
|
+
method: "POST",
|
|
334
|
+
body: JSON.stringify({ token: required(token2, "token") })
|
|
335
|
+
}),
|
|
336
|
+
begin: (input, mutation) => request("channel.file_requests.uploads.begin", "/file-requests/uploads", {
|
|
337
|
+
method: "POST",
|
|
338
|
+
headers: mutationHeaders(mutation),
|
|
339
|
+
body: JSON.stringify({ ...input, token: required(input.token, "token") })
|
|
340
|
+
}),
|
|
341
|
+
complete: (input, mutation) => request("channel.file_requests.uploads.complete", "/file-requests/uploads/complete", {
|
|
342
|
+
method: "POST",
|
|
343
|
+
headers: mutationHeaders(mutation),
|
|
344
|
+
body: JSON.stringify({ ...input, token: required(input.token, "token") })
|
|
345
|
+
}),
|
|
346
|
+
close: (token2, mutation) => request("channel.file_requests.close", "/file-requests/close", {
|
|
347
|
+
method: "POST",
|
|
348
|
+
headers: mutationHeaders(mutation),
|
|
349
|
+
body: JSON.stringify({ token: required(token2, "token") })
|
|
350
|
+
})
|
|
351
|
+
},
|
|
302
352
|
/** Tenant-level data exposed only to a dash-scoped channel token. */
|
|
303
353
|
dash: {
|
|
304
354
|
profile: () => request("channel.dash.profile", "/dash/profile"),
|
|
@@ -356,6 +406,8 @@ function createChannelClient(options) {
|
|
|
356
406
|
},
|
|
357
407
|
assetUrl: (pathOrUrl) => new URL(required(pathOrUrl, "asset URL"), `${baseUrl}/`).toString(),
|
|
358
408
|
site: {
|
|
409
|
+
/** Whether the site is private; `member` is always false without a session. Use `withCustomer(session).site.access()` for a viewer. */
|
|
410
|
+
access: () => request("channel.site.access", "/site/access", { cache: "no-store" }),
|
|
359
411
|
resolve: (params = {}) => request("channel.site.resolve", appendQuery("/site/resolve", params))
|
|
360
412
|
},
|
|
361
413
|
init: {
|
|
@@ -594,6 +646,10 @@ function createChannelClient(options) {
|
|
|
594
646
|
withCustomer(session) {
|
|
595
647
|
const customerSession = required(session, "session");
|
|
596
648
|
return {
|
|
649
|
+
site: {
|
|
650
|
+
/** Whether this viewer is an invited, unbanned member who may see a private site. */
|
|
651
|
+
access: () => request("channel.site.access", "/site/access", { cache: "no-store" }, customerSession)
|
|
652
|
+
},
|
|
597
653
|
me: () => request("channel.auth.me", "/auth/me", {}, customerSession),
|
|
598
654
|
updateProfile: (input) => request("channel.auth.me.update", "/auth/me", { method: "PUT", body: JSON.stringify(input) }, customerSession),
|
|
599
655
|
logout: () => request("channel.auth.logout", "/auth/logout", { method: "POST" }, customerSession),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createChannelClient } from './chunk-
|
|
1
|
+
import { createChannelClient } from './chunk-BHEDC47V.js';
|
|
2
2
|
import 'server-only';
|
|
3
3
|
|
|
4
4
|
function narrow(client) {
|
|
@@ -6,7 +6,7 @@ function narrow(client) {
|
|
|
6
6
|
ping: client.ping,
|
|
7
7
|
geo: client.geo,
|
|
8
8
|
dash: client.dash,
|
|
9
|
-
|
|
9
|
+
waitlist: client.waitlist,
|
|
10
10
|
assetUrl: client.assetUrl,
|
|
11
11
|
withVisitor: (visitor) => narrow(client.withVisitor(visitor))
|
|
12
12
|
};
|
package/dist/dash-next.d.ts
CHANGED
package/dist/dash-next.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createNextChannelClient } from './chunk-
|
|
2
|
-
import { narrow } from './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
import { createNextChannelClient } from './chunk-AVIT2DZR.js';
|
|
2
|
+
import { narrow } from './chunk-THK57F6H.js';
|
|
3
|
+
import './chunk-BHEDC47V.js';
|
|
4
4
|
import './chunk-XPO7C3DW.js';
|
|
5
5
|
import 'server-only';
|
|
6
6
|
|
package/dist/dash.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createChannelClient, ChannelVisitor, CreateChannelClientOptions } from './index.js';
|
|
2
|
-
import './types-
|
|
2
|
+
import './types-DWXo7QE3.js';
|
|
3
3
|
import './webhooks.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -13,10 +13,10 @@ import './webhooks.js';
|
|
|
13
13
|
*
|
|
14
14
|
* `ping` and `geo` are deliberately included: both are scope-agnostic on the
|
|
15
15
|
* door (the credential self-check must answer for either scope, and geo lets
|
|
16
|
-
* a dash site localise pricing). `
|
|
17
|
-
* surface every waitlist site needs.
|
|
16
|
+
* a dash site localise pricing). `waitlist` is the scope-free email-link
|
|
17
|
+
* surface (verify, unsubscribe) every waitlist site needs.
|
|
18
18
|
*/
|
|
19
|
-
type DashChannelClient = Pick<ReturnType<typeof createChannelClient>, "ping" | "geo" | "dash" | "
|
|
19
|
+
type DashChannelClient = Pick<ReturnType<typeof createChannelClient>, "ping" | "geo" | "dash" | "waitlist" | "assetUrl"> & {
|
|
20
20
|
/** Request-scoped clone carrying signed visitor metadata (see ChannelVisitor). */
|
|
21
21
|
withVisitor(visitor: ChannelVisitor): DashChannelClient;
|
|
22
22
|
};
|
package/dist/dash.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { createDashChannelClient, narrow as narrowToDash } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { createDashChannelClient, narrow as narrowToDash } from './chunk-THK57F6H.js';
|
|
2
|
+
import './chunk-BHEDC47V.js';
|
|
3
3
|
import './chunk-XPO7C3DW.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as ChannelPing, j as ChannelGeo, P as PaymentCollectionAvailability, W as
|
|
2
|
-
export {
|
|
1
|
+
import { i as ChannelPing, j as ChannelGeo, P as PaymentCollectionAvailability, W as WaitlistGateStatus, k as WaitlistFormSettings, l as WaitlistSubmission, m as WaitlistAcknowledgement, n as WaitlistVerification, o as WaitlistUnsubscription, F as FileRequestView, p as FileRequestUploadInput, q as FileRequestUploadTicket, r as FileRequestCompleteInput, s as FileRequestReceivedFile, t as FileRequestClosed, D as DashProfileResponse, u as DashInitResponse, v as DashPlansResponse, L as ListResponse, w as DashDirectoryRegion, x as DashDirectoryEntry, y as DashDirectoryProfileResponse, z as DashLead, B as DashLeadPortalRequestLinkInput, E as DashLeadPortalRequestLinkResponse, G as DashLeadPortalView, H as DashMovingQuoteInput, I as DashMovingQuoteReceipt, J as DashMovingAddressList, K as DashMovingAddress, M as DashMovingDistance, S as SiteAccess, N as SiteDocument, Q as PublicWorkspaceInit, R as LightInitResponse, T as PublicPageSummary, U as PublicPage, V as Product, X as ProductAsset, Y as SlotsResponse, Z as DownloadResponse, a$ as BeginUploadInput, b0 as CompleteUploadInput, _ as ArtworkMutationReceipt, b1 as DecisionInput, $ as PublicConfiguration, a0 as PublicConfigurationQuoteInput, a1 as PublicConfigurationQuote, a2 as CatalogCategory, a3 as CatalogProductsResponse, a4 as CatalogCollection, a5 as CatalogBrand, a6 as CartLookupResponse, A as AddCartItemInput, C as CartResponse, a7 as UpdateCartItemInput, a8 as MergeCartInput, a as CheckoutOptions, b as CheckoutStatusResponse, c as CheckoutCustomerInput, d as CheckoutAddressesInput, e as CheckoutFulfillmentInput, f as CheckoutPayInput, g as CheckoutPayResponse, h as CheckoutCancelInput, a9 as Review, aa as ReviewSummaryResponse, ab as PublicSubmitReviewInput, ac as ThemeResponse, ad as MenuResponse, ae as BlogPost, af as BlogPostResponse, ag as GivingEntry, ah as StartGivingInput, ai as StartGivingResponse, aj as SubscriptionPlanListResponse, ak as SubscriptionPlanResponse, al as BookingService, am as BookingServiceResponse, an as BookingAvailabilityParams, ao as BookingAvailabilityResponse, ap as BookingQuoteParams, aq as BookingQuoteResponse, ar as CreateBookingHoldInput, as as BookingHoldResponse, at as PublicPaymentLinkResponse, au as PaymentLinkCheckoutInput, av as PaymentLinkCheckoutResponse, aw as PaymentLinkRedemptionStatusResponse, ax as PrintSettingsResponse, ay as PrintOptionsSelection, az as PrintQuoteResponse, aA as PrintIntakeInput, aB as PrintJob, aC as DiningMenu, aD as CustomerSignupResponse, aE as SendCodeResponse, aF as CustomerSession, aG as CustomerResponse, aH as CustomerAuthSession, aI as CustomerSecurityActivityPage, O as Order, aJ as OrderSummary, aK as SavedAddress, aL as SavedAddressResponse, aM as SavedAddressInput, aN as SavedAddressUpdateInput, aO as SavedPaymentMethod, aP as PaymentMethodSetupInput, aQ as PaymentMethodSetupResult, aR as PaymentMethodConfirmInput, aS as PaymentMethodMutationResponse, aT as StartSubscriptionInput, aU as SubscriptionAgreementResponse, aV as SubscriptionListResponse, aW as SubscriptionSourceResponse, aX as SubscriptionInvoiceListResponse, aY as SubscriptionInvoiceResponse, aZ as GivingIntentListResponse, a_ as LeadResponse, b2 as Slot } from './types-DWXo7QE3.js';
|
|
2
|
+
export { b3 as BookingAvailability, b4 as BookingCancellationPolicy, b5 as BookingCustomerInput, b6 as BookingFreeSpan, b7 as BookingHold, b8 as BookingIntakeQuestion, b9 as BookingPriceQuote, ba as BookingServicePricing, bb as BookingTimeRange, bc as CatalogProduct, bd as CheckoutAddress, be as CheckoutStatus, bf as ConfigDocument, bg as ConfigQuote, bh as ConfigSelectionRequest, bi as Customer, bj as CustomerSecurityActivity, bk as DashBrandingInfo, bl as DashDirectoryProfile, bm as DashLeadPortalMatch, bn as DashLeadPortalMovingSummary, bo as DashLeadPortalRequest, bp as DashLeadPortalRequestStatus, bq as DashLocaleInfo, br as DashPlan, bs as DashPlanPricing, bt as DashPlanRegion, bu as DashPublicPage, bv as DashPublicProfileInfo, bw as DashTenantInfo, bx as DiningAvailability, by as DiningAvailabilityRule, bz as DiningComboChoice, bA as DiningComboGroup, bB as DiningItemSize, bC as DiningMenuItem, bD as DiningModifier, bE as DiningModifierGroup, bF as DiningOffer, bG as DiningOfferBadge, bH as FileRequestTokenInput, bI as GivingIntent, bJ as Menu, bK as MenuItem, bL as OrderItem, bM as PaymentLinkRedemptionStatus, bN as PaymentMethodOption, bO as PaymentReadiness, bP as PrintBranding, bQ as PrintIntakeLimits, bR as PrintJobFile, bS as PrintPaperSize, bT as PrintPerPagePricing, bU as PrintPriceBreakdown, bV as PrintPriceLine, bW as PrintPricing, bX as PrintPricingOption, bY as ProductLineConfiguration, bZ as PublicGate, b_ as PublicPaymentLink, b$ as PublicSiteSignals, c0 as ShippingMethodOption, c1 as SiteGatedDocument, c2 as SiteRef, c3 as SiteResolvedDocument, c4 as SiteSubject, c5 as SubscriptionAgreement, c6 as SubscriptionInvoice, c7 as SubscriptionPlanOffer, c8 as SubscriptionSourceDisplay, c9 as WaitlistAttribution, ca as WorkspaceInfo } from './types-DWXo7QE3.js';
|
|
3
3
|
export { AnyChannelWebhookEvent, CHANNEL_WEBHOOK_EVENT_ID_HEADER, CHANNEL_WEBHOOK_EVENT_TYPES, CHANNEL_WEBHOOK_SIGNATURE_HEADER, CHANNEL_WEBHOOK_TIMESTAMP_HEADER, ChannelWebhookEvent, ChannelWebhookEventDataMap, ChannelWebhookEventType, ChannelWebhookVerificationCode, ChannelWebhookVerificationError, DEFAULT_TOLERANCE_SECONDS, FulfillmentEventData, LeadCreatedEventData, MenuUpdatedEventData, OrderEventData, PagePublishedEventData, ParseChannelWebhookEventOptions, ParsedChannelWebhookEvent, ProductEventData, ReviewPublishedEventData, ReviewSubmittedEventData, UnknownChannelWebhookEvent, VerifyChannelWebhookSignatureOptions, isChannelWebhookEventType, isChannelWebhookVerificationError, isKnownChannelWebhookEvent, parseChannelWebhookEvent, verifyChannelWebhookSignature } from './webhooks.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -26,6 +26,13 @@ type ArtworkCompleteInput = CompleteUploadInput & {
|
|
|
26
26
|
};
|
|
27
27
|
type ArtworkProofDecision = DecisionInput;
|
|
28
28
|
|
|
29
|
+
/** The artwork upload ticket. Written out here: the generated schema is `artwork_UploadTicket` upstream, to keep it apart from the file-request ticket. */
|
|
30
|
+
interface UploadTicket {
|
|
31
|
+
expires_at: string;
|
|
32
|
+
upload_id: string;
|
|
33
|
+
upload_url: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
29
36
|
declare const DEFAULT_CHANNEL_API_URL = "https://api.saasdash.app";
|
|
30
37
|
interface ChannelRetryPolicy {
|
|
31
38
|
/** Additional attempts after the first (default 1). */
|
|
@@ -69,7 +76,7 @@ interface ChannelVisitor {
|
|
|
69
76
|
userAgent?: string;
|
|
70
77
|
}
|
|
71
78
|
type ChannelRequestOutcome = "success" | "api_error" | "network_error" | "timeout" | "invalid_response" | "cancelled";
|
|
72
|
-
type ChannelOperation = "channel.commerce.artwork.list" | "channel.commerce.artwork.download" | "channel.commerce.artwork.decide" | "channel.commerce.artwork.uploads.begin" | "channel.commerce.artwork.uploads.complete" | "channel.ping" | "channel.geo.detect" | "channel.site.resolve" | "channel.init.get" | "channel.init.light" | "channel.pages.list" | "channel.pages.get" | "channel.catalog.products.list" | "channel.catalog.products.get" | "channel.catalog.products.media" | "channel.catalog.products.configuration.get" | "channel.catalog.products.configuration.quote" | "channel.reviews.list" | "channel.reviews.summary" | "channel.reviews.submit" | "channel.theme.get" | "channel.menus.get" | "channel.blog.get" | "channel.blog.list" | "channel.payments.availability" | "channel.giving.entries.list" | "channel.giving.entries.get" | "channel.giving.start" | "channel.subscriptions.plans.list" | "channel.subscriptions.plans.get" | "channel.subscriptions.start" | "channel.book.services.list" | "channel.book.services.get" | "channel.book.availability.get" | "channel.book.quote.get" | "channel.book.holds.create" | "channel.book.holds.checkout" | "channel.book.holds.get" | "channel.payment_links.get" | "channel.payment_links.checkout" | "channel.payment_links.redemptions.get" | "channel.print.settings" | "channel.print.quote" | "channel.print.intake" | "channel.menu.boards.menu" | "channel.auth.check" | "channel.auth.signup" | "channel.auth.send_code" | "channel.auth.verify_code" | "channel.auth.refresh" | "channel.auth.me" | "channel.auth.me.update" | "channel.auth.logout" | "channel.auth.sessions.list" | "channel.auth.sessions.revoke" | "channel.auth.sessions.revoke_others" | "channel.auth.sessions.revoke_all" | "channel.auth.security_activity.list" | "channel.account.addresses.list" | "channel.account.addresses.create" | "channel.account.addresses.get" | "channel.account.addresses.update" | "channel.account.addresses.delete" | "channel.account.addresses.set_default" | "channel.account.giving.list" | "channel.account.orders.list" | "channel.account.orders.summary" | "channel.account.orders.get" | "channel.account.payment_methods.list" | "channel.account.payment_methods.setup" | "channel.account.payment_methods.confirm" | "channel.account.payment_methods.default" | "channel.account.payment_methods.delete" | "channel.account.subscriptions.list" | "channel.account.subscriptions.get" | "channel.account.subscriptions.source" | "channel.account.subscriptions.cancel" | "channel.account.subscriptions.pause" | "channel.account.subscriptions.resume" | "channel.account.subscriptions.invoices.list" | "channel.account.subscriptions.invoices.get" | "channel.account.subscriptions.invoices.pay_now" | "channel.catalog.brands.list" | "channel.catalog.categories.list" | "channel.catalog.categories.products" | "channel.catalog.collections.list" | "channel.catalog.collections.products" | "channel.catalog.collections.get" | "channel.cart.get" | "channel.cart.items.add" | "channel.cart.items.update" | "channel.cart.items.remove" | "channel.cart.clear" | "channel.cart.merge" | "channel.checkout.options" | "channel.checkout.status" | "channel.checkout.customer.set" | "channel.checkout.addresses.set" | "channel.checkout.fulfillment.set" | "channel.checkout.pay" | "channel.checkout.cancel" | "channel.dash.profile" | "channel.dash.init" | "channel.dash.waitlist.status" | "channel.dash.waitlist.form" | "channel.dash.waitlist.submit" | "channel.dash.plans" | "channel.dash.directory.regions" | "channel.dash.directory.browse" | "channel.dash.directory.get" | "channel.dash.leads.capture" | "channel.dash.lead_portal.my_quotes" | "channel.dash.lead_portal.request_link" | "channel.dash.quote_requests.moving.capture" | "channel.dash.addresses.lookup" | "channel.dash.addresses.resolve" | "channel.dash.addresses.distance" | "channel.leads.capture";
|
|
79
|
+
type ChannelOperation = "channel.commerce.artwork.list" | "channel.commerce.artwork.download" | "channel.commerce.artwork.decide" | "channel.commerce.artwork.uploads.begin" | "channel.commerce.artwork.uploads.complete" | "channel.ping" | "channel.geo.detect" | "channel.site.access" | "channel.site.resolve" | "channel.init.get" | "channel.init.light" | "channel.pages.list" | "channel.pages.get" | "channel.catalog.products.list" | "channel.catalog.products.get" | "channel.catalog.products.media" | "channel.catalog.products.configuration.get" | "channel.catalog.products.configuration.quote" | "channel.reviews.list" | "channel.reviews.summary" | "channel.reviews.submit" | "channel.theme.get" | "channel.menus.get" | "channel.blog.get" | "channel.blog.list" | "channel.payments.availability" | "channel.giving.entries.list" | "channel.giving.entries.get" | "channel.giving.start" | "channel.subscriptions.plans.list" | "channel.subscriptions.plans.get" | "channel.subscriptions.start" | "channel.book.services.list" | "channel.book.services.get" | "channel.book.availability.get" | "channel.book.quote.get" | "channel.book.holds.create" | "channel.book.holds.checkout" | "channel.book.holds.get" | "channel.payment_links.get" | "channel.payment_links.checkout" | "channel.payment_links.redemptions.get" | "channel.print.settings" | "channel.print.quote" | "channel.print.intake" | "channel.menu.boards.menu" | "channel.auth.check" | "channel.auth.signup" | "channel.auth.send_code" | "channel.auth.verify_code" | "channel.auth.refresh" | "channel.auth.me" | "channel.auth.me.update" | "channel.auth.logout" | "channel.auth.sessions.list" | "channel.auth.sessions.revoke" | "channel.auth.sessions.revoke_others" | "channel.auth.sessions.revoke_all" | "channel.auth.security_activity.list" | "channel.account.addresses.list" | "channel.account.addresses.create" | "channel.account.addresses.get" | "channel.account.addresses.update" | "channel.account.addresses.delete" | "channel.account.addresses.set_default" | "channel.account.giving.list" | "channel.account.orders.list" | "channel.account.orders.summary" | "channel.account.orders.get" | "channel.account.payment_methods.list" | "channel.account.payment_methods.setup" | "channel.account.payment_methods.confirm" | "channel.account.payment_methods.default" | "channel.account.payment_methods.delete" | "channel.account.subscriptions.list" | "channel.account.subscriptions.get" | "channel.account.subscriptions.source" | "channel.account.subscriptions.cancel" | "channel.account.subscriptions.pause" | "channel.account.subscriptions.resume" | "channel.account.subscriptions.invoices.list" | "channel.account.subscriptions.invoices.get" | "channel.account.subscriptions.invoices.pay_now" | "channel.catalog.brands.list" | "channel.catalog.categories.list" | "channel.catalog.categories.products" | "channel.catalog.collections.list" | "channel.catalog.collections.products" | "channel.catalog.collections.get" | "channel.cart.get" | "channel.cart.items.add" | "channel.cart.items.update" | "channel.cart.items.remove" | "channel.cart.clear" | "channel.cart.merge" | "channel.checkout.options" | "channel.checkout.status" | "channel.checkout.customer.set" | "channel.checkout.addresses.set" | "channel.checkout.fulfillment.set" | "channel.checkout.pay" | "channel.checkout.cancel" | "channel.dash.profile" | "channel.dash.init" | "channel.waitlist.status" | "channel.waitlist.form" | "channel.waitlist.submit" | "channel.file_requests.view" | "channel.file_requests.uploads.begin" | "channel.file_requests.uploads.complete" | "channel.file_requests.close" | "channel.dash.waitlist.status" | "channel.dash.waitlist.form" | "channel.dash.waitlist.submit" | "channel.dash.plans" | "channel.dash.directory.regions" | "channel.dash.directory.browse" | "channel.dash.directory.get" | "channel.dash.leads.capture" | "channel.dash.lead_portal.my_quotes" | "channel.dash.lead_portal.request_link" | "channel.dash.quote_requests.moving.capture" | "channel.dash.addresses.lookup" | "channel.dash.addresses.resolve" | "channel.dash.addresses.distance" | "channel.leads.capture";
|
|
73
80
|
interface ChannelRequestObservation {
|
|
74
81
|
operation: ChannelOperation;
|
|
75
82
|
method: string;
|
|
@@ -150,6 +157,14 @@ declare function createChannelClient(options: CreateChannelClientOptions): {
|
|
|
150
157
|
readonly ping: (challenge?: string) => Promise<ChannelPing>;
|
|
151
158
|
/** Return a request-scoped client that signs trusted edge visitor metadata. */
|
|
152
159
|
readonly withVisitor: (visitor: ChannelVisitor) => /*elided*/ any;
|
|
160
|
+
/**
|
|
161
|
+
* The full client for a member of a private site: every call carries the
|
|
162
|
+
* viewer's session (`X-End-User-Token`) and is never cached, so pages,
|
|
163
|
+
* catalog, menus, theme and the rest are served per viewer. Pass the
|
|
164
|
+
* session per request, as with `withCustomer`; do not keep the result
|
|
165
|
+
* across visitors. `withCustomer(session)` stays the account-only surface.
|
|
166
|
+
*/
|
|
167
|
+
readonly withViewer: (session: string) => /*elided*/ any;
|
|
153
168
|
readonly geo: {
|
|
154
169
|
readonly detect: () => Promise<ChannelGeo>;
|
|
155
170
|
};
|
|
@@ -161,11 +176,30 @@ declare function createChannelClient(options: CreateChannelClientOptions): {
|
|
|
161
176
|
*/
|
|
162
177
|
readonly availability: () => Promise<PaymentCollectionAvailability>;
|
|
163
178
|
};
|
|
164
|
-
/**
|
|
165
|
-
|
|
179
|
+
/**
|
|
180
|
+
* The workspace waitlist (workspace token): its gate, form settings and
|
|
181
|
+
* signups. A Dash token uses `dash.waitlist`. `verify` and `unsubscribe`
|
|
182
|
+
* follow the links in waitlist emails and work with any scope.
|
|
183
|
+
*/
|
|
184
|
+
readonly waitlist: {
|
|
185
|
+
readonly status: () => Promise<WaitlistGateStatus>;
|
|
186
|
+
readonly form: () => Promise<WaitlistFormSettings>;
|
|
187
|
+
readonly submit: (input: WaitlistSubmission, mutation?: ChannelMutationOptions) => Promise<WaitlistAcknowledgement>;
|
|
166
188
|
readonly verify: (token: string) => Promise<WaitlistVerification>;
|
|
167
189
|
readonly unsubscribe: (key: string) => Promise<WaitlistUnsubscription>;
|
|
168
190
|
};
|
|
191
|
+
/**
|
|
192
|
+
* Lead file requests (workspace token, `leads.write`). The requester's
|
|
193
|
+
* token is the credential and travels in the JSON body. `begin` returns a
|
|
194
|
+
* presigned `upload_url`: the site PUTs the file there itself with
|
|
195
|
+
* `Content-Type: application/octet-stream`, then calls `complete`.
|
|
196
|
+
*/
|
|
197
|
+
readonly fileRequests: {
|
|
198
|
+
readonly view: (token: string) => Promise<FileRequestView>;
|
|
199
|
+
readonly begin: (input: FileRequestUploadInput, mutation?: ChannelMutationOptions) => Promise<FileRequestUploadTicket>;
|
|
200
|
+
readonly complete: (input: FileRequestCompleteInput, mutation?: ChannelMutationOptions) => Promise<FileRequestReceivedFile>;
|
|
201
|
+
readonly close: (token: string, mutation?: ChannelMutationOptions) => Promise<FileRequestClosed>;
|
|
202
|
+
};
|
|
169
203
|
/** Tenant-level data exposed only to a dash-scoped channel token. */
|
|
170
204
|
readonly dash: {
|
|
171
205
|
readonly profile: () => Promise<DashProfileResponse>;
|
|
@@ -201,6 +235,8 @@ declare function createChannelClient(options: CreateChannelClientOptions): {
|
|
|
201
235
|
};
|
|
202
236
|
readonly assetUrl: (pathOrUrl: string) => string;
|
|
203
237
|
readonly site: {
|
|
238
|
+
/** Whether the site is private; `member` is always false without a session. Use `withCustomer(session).site.access()` for a viewer. */
|
|
239
|
+
readonly access: () => Promise<SiteAccess>;
|
|
204
240
|
readonly resolve: (params?: ChannelSiteResolveParams) => Promise<SiteDocument>;
|
|
205
241
|
};
|
|
206
242
|
readonly init: {
|
|
@@ -354,6 +390,10 @@ declare function createChannelClient(options: CreateChannelClientOptions): {
|
|
|
354
390
|
* channel's workspace — another customer's order id returns 404.
|
|
355
391
|
*/
|
|
356
392
|
readonly withCustomer: (session: string) => {
|
|
393
|
+
readonly site: {
|
|
394
|
+
/** Whether this viewer is an invited, unbanned member who may see a private site. */
|
|
395
|
+
readonly access: () => Promise<SiteAccess>;
|
|
396
|
+
};
|
|
357
397
|
readonly me: () => Promise<CustomerResponse>;
|
|
358
398
|
readonly updateProfile: (input: {
|
|
359
399
|
name?: string;
|
|
@@ -432,4 +472,4 @@ declare function createChannelClient(options: CreateChannelClientOptions): {
|
|
|
432
472
|
};
|
|
433
473
|
};
|
|
434
474
|
|
|
435
|
-
export { AddCartItemInput, type ArtworkCompleteInput, ArtworkMutationReceipt, type ArtworkProofDecision, type ArtworkSlot, type ArtworkSlotsResponse, type ArtworkUploadInput, type ArtworkUploadTicket, BlogPost, BlogPostResponse, BookingAvailabilityParams, BookingAvailabilityResponse, BookingHoldResponse, BookingQuoteParams, BookingQuoteResponse, BookingService, BookingServiceResponse, CartLookupResponse, CartResponse, CatalogBrand, CatalogCategory, CatalogCollection, CatalogProductsResponse, ChannelAPIError, type ChannelCheckoutStatusParams, ChannelConfigurationError, ChannelGeo, type ChannelInvoiceListParams, type ChannelLeadInput, type ChannelListParams, type ChannelMutationOptions, type ChannelOperation, ChannelPing, type ChannelProductListParams, type ChannelRequestObservation, type ChannelRequestObserver, type ChannelRequestOutcome, type ChannelRetryPolicy, type ChannelSiteResolveParams, type ChannelSubscriptionCancelParams, type ChannelSubscriptionListParams, type ChannelVisitor, CheckoutAddressesInput, CheckoutCancelInput, CheckoutCustomerInput, CheckoutFulfillmentInput, CheckoutOptions, CheckoutPayInput, CheckoutPayResponse, CheckoutStatusResponse, CreateBookingHoldInput, type CreateChannelClientOptions, CustomerAuthSession, CustomerResponse, CustomerSecurityActivityPage, CustomerSession, CustomerSignupResponse, DEFAULT_CHANNEL_API_URL, DashDirectoryEntry, type DashDirectoryListParams, DashDirectoryProfileResponse, DashDirectoryRegion, DashInitResponse, DashLead, DashLeadPortalRequestLinkInput, DashLeadPortalRequestLinkResponse, DashLeadPortalView, DashMovingAddress, DashMovingAddressList, DashMovingDistance, DashMovingQuoteInput, DashMovingQuoteReceipt, DashPlansResponse, DashProfileResponse, DiningMenu, DownloadResponse, GivingEntry, GivingIntentListResponse, LeadResponse, LightInitResponse, ListResponse, MenuResponse, MergeCartInput, Order, OrderSummary, PaymentCollectionAvailability, PaymentLinkCheckoutInput, PaymentLinkCheckoutResponse, PaymentLinkRedemptionStatusResponse, PaymentMethodConfirmInput, PaymentMethodMutationResponse, PaymentMethodSetupInput, PaymentMethodSetupResult, PrintIntakeInput, PrintJob, PrintOptionsSelection, PrintQuoteResponse, PrintSettingsResponse, Product, ProductAsset, PublicConfiguration, PublicConfigurationQuote, PublicConfigurationQuoteInput, PublicPage, PublicPageSummary, PublicPaymentLinkResponse, PublicSubmitReviewInput, PublicWorkspaceInit, type RequiredIdempotency, Review, ReviewSummaryResponse, SavedAddress, SavedAddressInput, SavedAddressResponse, SavedAddressUpdateInput, SavedPaymentMethod, SendCodeResponse, SiteDocument, SlotsResponse, StartGivingInput, StartGivingResponse, StartSubscriptionInput, SubscriptionAgreementResponse, SubscriptionInvoiceListResponse, SubscriptionInvoiceResponse, SubscriptionListResponse, SubscriptionPlanListResponse, SubscriptionPlanResponse, SubscriptionSourceResponse, ThemeResponse, UpdateCartItemInput, UploadTicket, WaitlistAcknowledgement, WaitlistFormSettings, WaitlistGateStatus, WaitlistSubmission, WaitlistUnsubscription, WaitlistVerification, createChannelClient, isChannelAPIError, isChannelConfigurationError };
|
|
475
|
+
export { AddCartItemInput, type ArtworkCompleteInput, ArtworkMutationReceipt, type ArtworkProofDecision, type ArtworkSlot, type ArtworkSlotsResponse, type ArtworkUploadInput, type ArtworkUploadTicket, BlogPost, BlogPostResponse, BookingAvailabilityParams, BookingAvailabilityResponse, BookingHoldResponse, BookingQuoteParams, BookingQuoteResponse, BookingService, BookingServiceResponse, CartLookupResponse, CartResponse, CatalogBrand, CatalogCategory, CatalogCollection, CatalogProductsResponse, ChannelAPIError, type ChannelCheckoutStatusParams, ChannelConfigurationError, ChannelGeo, type ChannelInvoiceListParams, type ChannelLeadInput, type ChannelListParams, type ChannelMutationOptions, type ChannelOperation, ChannelPing, type ChannelProductListParams, type ChannelRequestObservation, type ChannelRequestObserver, type ChannelRequestOutcome, type ChannelRetryPolicy, type ChannelSiteResolveParams, type ChannelSubscriptionCancelParams, type ChannelSubscriptionListParams, type ChannelVisitor, CheckoutAddressesInput, CheckoutCancelInput, CheckoutCustomerInput, CheckoutFulfillmentInput, CheckoutOptions, CheckoutPayInput, CheckoutPayResponse, CheckoutStatusResponse, CreateBookingHoldInput, type CreateChannelClientOptions, CustomerAuthSession, CustomerResponse, CustomerSecurityActivityPage, CustomerSession, CustomerSignupResponse, DEFAULT_CHANNEL_API_URL, DashDirectoryEntry, type DashDirectoryListParams, DashDirectoryProfileResponse, DashDirectoryRegion, DashInitResponse, DashLead, DashLeadPortalRequestLinkInput, DashLeadPortalRequestLinkResponse, DashLeadPortalView, DashMovingAddress, DashMovingAddressList, DashMovingDistance, DashMovingQuoteInput, DashMovingQuoteReceipt, DashPlansResponse, DashProfileResponse, DiningMenu, DownloadResponse, FileRequestClosed, FileRequestCompleteInput, FileRequestReceivedFile, FileRequestUploadInput, FileRequestUploadTicket, FileRequestView, GivingEntry, GivingIntentListResponse, LeadResponse, LightInitResponse, ListResponse, MenuResponse, MergeCartInput, Order, OrderSummary, PaymentCollectionAvailability, PaymentLinkCheckoutInput, PaymentLinkCheckoutResponse, PaymentLinkRedemptionStatusResponse, PaymentMethodConfirmInput, PaymentMethodMutationResponse, PaymentMethodSetupInput, PaymentMethodSetupResult, PrintIntakeInput, PrintJob, PrintOptionsSelection, PrintQuoteResponse, PrintSettingsResponse, Product, ProductAsset, PublicConfiguration, PublicConfigurationQuote, PublicConfigurationQuoteInput, PublicPage, PublicPageSummary, PublicPaymentLinkResponse, PublicSubmitReviewInput, PublicWorkspaceInit, type RequiredIdempotency, Review, ReviewSummaryResponse, SavedAddress, SavedAddressInput, SavedAddressResponse, SavedAddressUpdateInput, SavedPaymentMethod, SendCodeResponse, SiteAccess, SiteDocument, SlotsResponse, StartGivingInput, StartGivingResponse, StartSubscriptionInput, SubscriptionAgreementResponse, SubscriptionInvoiceListResponse, SubscriptionInvoiceResponse, SubscriptionListResponse, SubscriptionPlanListResponse, SubscriptionPlanResponse, SubscriptionSourceResponse, ThemeResponse, UpdateCartItemInput, type UploadTicket, WaitlistAcknowledgement, WaitlistFormSettings, WaitlistGateStatus, WaitlistSubmission, WaitlistUnsubscription, WaitlistVerification, createChannelClient, isChannelAPIError, isChannelConfigurationError };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ChannelAPIError, DEFAULT_CHANNEL_API_URL, createChannelClient, isChannelAPIError } from './chunk-
|
|
1
|
+
export { ChannelAPIError, DEFAULT_CHANNEL_API_URL, createChannelClient, isChannelAPIError } from './chunk-BHEDC47V.js';
|
|
2
2
|
export { CHANNEL_WEBHOOK_EVENT_ID_HEADER, CHANNEL_WEBHOOK_EVENT_TYPES, CHANNEL_WEBHOOK_SIGNATURE_HEADER, CHANNEL_WEBHOOK_TIMESTAMP_HEADER, ChannelConfigurationError, ChannelWebhookVerificationError, DEFAULT_TOLERANCE_SECONDS, isChannelConfigurationError, isChannelWebhookEventType, isChannelWebhookVerificationError, isKnownChannelWebhookEvent, parseChannelWebhookEvent, verifyChannelWebhookSignature } from './chunk-XPO7C3DW.js';
|
package/dist/next.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createChannelClient, ChannelCheckoutStatusParams, ChannelMutationOptions, CreateChannelClientOptions, ChannelVisitor, DashDirectoryListParams, ChannelLeadInput, ChannelSiteResolveParams, ChannelListParams, ChannelProductListParams, ArtworkUploadInput, ArtworkCompleteInput, ArtworkProofDecision, RequiredIdempotency, ChannelSubscriptionListParams, ChannelSubscriptionCancelParams, ChannelInvoiceListParams } from './index.js';
|
|
2
|
-
import { O as Order, A as AddCartItemInput, C as CartResponse, a as CheckoutOptions, b as CheckoutStatusResponse, c as CheckoutCustomerInput, d as CheckoutAddressesInput, e as CheckoutFulfillmentInput, f as CheckoutPayInput, g as CheckoutPayResponse, h as CheckoutCancelInput, i as ChannelPing, j as ChannelGeo, P as PaymentCollectionAvailability, W as
|
|
1
|
+
import { createChannelClient, ChannelCheckoutStatusParams, ChannelMutationOptions, CreateChannelClientOptions, ChannelVisitor, DashDirectoryListParams, ChannelLeadInput, ChannelSiteResolveParams, ChannelListParams, ChannelProductListParams, ArtworkUploadInput, UploadTicket, ArtworkCompleteInput, ArtworkProofDecision, RequiredIdempotency, ChannelSubscriptionListParams, ChannelSubscriptionCancelParams, ChannelInvoiceListParams } from './index.js';
|
|
2
|
+
import { O as Order, A as AddCartItemInput, C as CartResponse, a as CheckoutOptions, b as CheckoutStatusResponse, c as CheckoutCustomerInput, d as CheckoutAddressesInput, e as CheckoutFulfillmentInput, f as CheckoutPayInput, g as CheckoutPayResponse, h as CheckoutCancelInput, i as ChannelPing, j as ChannelGeo, P as PaymentCollectionAvailability, W as WaitlistGateStatus, k as WaitlistFormSettings, l as WaitlistSubmission, m as WaitlistAcknowledgement, n as WaitlistVerification, o as WaitlistUnsubscription, F as FileRequestView, p as FileRequestUploadInput, q as FileRequestUploadTicket, r as FileRequestCompleteInput, s as FileRequestReceivedFile, t as FileRequestClosed, D as DashProfileResponse, u as DashInitResponse, v as DashPlansResponse, L as ListResponse, w as DashDirectoryRegion, x as DashDirectoryEntry, y as DashDirectoryProfileResponse, z as DashLead, B as DashLeadPortalRequestLinkInput, E as DashLeadPortalRequestLinkResponse, G as DashLeadPortalView, H as DashMovingQuoteInput, I as DashMovingQuoteReceipt, J as DashMovingAddressList, K as DashMovingAddress, M as DashMovingDistance, S as SiteAccess, N as SiteDocument, Q as PublicWorkspaceInit, R as LightInitResponse, T as PublicPageSummary, U as PublicPage, V as Product, X as ProductAsset, Y as SlotsResponse, Z as DownloadResponse, _ as ArtworkMutationReceipt, $ as PublicConfiguration, a0 as PublicConfigurationQuoteInput, a1 as PublicConfigurationQuote, a2 as CatalogCategory, a3 as CatalogProductsResponse, a4 as CatalogCollection, a5 as CatalogBrand, a6 as CartLookupResponse, a7 as UpdateCartItemInput, a8 as MergeCartInput, a9 as Review, aa as ReviewSummaryResponse, ab as PublicSubmitReviewInput, ac as ThemeResponse, ad as MenuResponse, ae as BlogPost, af as BlogPostResponse, ag as GivingEntry, ah as StartGivingInput, ai as StartGivingResponse, aj as SubscriptionPlanListResponse, ak as SubscriptionPlanResponse, al as BookingService, am as BookingServiceResponse, an as BookingAvailabilityParams, ao as BookingAvailabilityResponse, ap as BookingQuoteParams, aq as BookingQuoteResponse, ar as CreateBookingHoldInput, as as BookingHoldResponse, at as PublicPaymentLinkResponse, au as PaymentLinkCheckoutInput, av as PaymentLinkCheckoutResponse, aw as PaymentLinkRedemptionStatusResponse, ax as PrintSettingsResponse, ay as PrintOptionsSelection, az as PrintQuoteResponse, aA as PrintIntakeInput, aB as PrintJob, aC as DiningMenu, aD as CustomerSignupResponse, aE as SendCodeResponse, aF as CustomerSession, aG as CustomerResponse, aH as CustomerAuthSession, aI as CustomerSecurityActivityPage, aJ as OrderSummary, aK as SavedAddress, aL as SavedAddressResponse, aM as SavedAddressInput, aN as SavedAddressUpdateInput, aO as SavedPaymentMethod, aP as PaymentMethodSetupInput, aQ as PaymentMethodSetupResult, aR as PaymentMethodConfirmInput, aS as PaymentMethodMutationResponse, aT as StartSubscriptionInput, aU as SubscriptionAgreementResponse, aV as SubscriptionListResponse, aW as SubscriptionSourceResponse, aX as SubscriptionInvoiceListResponse, aY as SubscriptionInvoiceResponse, aZ as GivingIntentListResponse, a_ as LeadResponse } from './types-DWXo7QE3.js';
|
|
3
3
|
import { ChannelWebhookEventDataMap, ChannelWebhookEvent } from './webhooks.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -284,16 +284,26 @@ declare function defaultChannelCacheTags(pathname: string): string[];
|
|
|
284
284
|
declare function createNextChannelClient(options: CreateNextChannelClientOptions): {
|
|
285
285
|
readonly ping: (challenge?: string) => Promise<ChannelPing>;
|
|
286
286
|
readonly withVisitor: (visitor: ChannelVisitor) => /*elided*/ any;
|
|
287
|
+
readonly withViewer: (session: string) => /*elided*/ any;
|
|
287
288
|
readonly geo: {
|
|
288
289
|
readonly detect: () => Promise<ChannelGeo>;
|
|
289
290
|
};
|
|
290
291
|
readonly payments: {
|
|
291
292
|
readonly availability: () => Promise<PaymentCollectionAvailability>;
|
|
292
293
|
};
|
|
293
|
-
readonly
|
|
294
|
+
readonly waitlist: {
|
|
295
|
+
readonly status: () => Promise<WaitlistGateStatus>;
|
|
296
|
+
readonly form: () => Promise<WaitlistFormSettings>;
|
|
297
|
+
readonly submit: (input: WaitlistSubmission, mutation?: ChannelMutationOptions) => Promise<WaitlistAcknowledgement>;
|
|
294
298
|
readonly verify: (token: string) => Promise<WaitlistVerification>;
|
|
295
299
|
readonly unsubscribe: (key: string) => Promise<WaitlistUnsubscription>;
|
|
296
300
|
};
|
|
301
|
+
readonly fileRequests: {
|
|
302
|
+
readonly view: (token: string) => Promise<FileRequestView>;
|
|
303
|
+
readonly begin: (input: FileRequestUploadInput, mutation?: ChannelMutationOptions) => Promise<FileRequestUploadTicket>;
|
|
304
|
+
readonly complete: (input: FileRequestCompleteInput, mutation?: ChannelMutationOptions) => Promise<FileRequestReceivedFile>;
|
|
305
|
+
readonly close: (token: string, mutation?: ChannelMutationOptions) => Promise<FileRequestClosed>;
|
|
306
|
+
};
|
|
297
307
|
readonly dash: {
|
|
298
308
|
readonly profile: () => Promise<DashProfileResponse>;
|
|
299
309
|
readonly init: () => Promise<DashInitResponse>;
|
|
@@ -328,6 +338,7 @@ declare function createNextChannelClient(options: CreateNextChannelClientOptions
|
|
|
328
338
|
};
|
|
329
339
|
readonly assetUrl: (pathOrUrl: string) => string;
|
|
330
340
|
readonly site: {
|
|
341
|
+
readonly access: () => Promise<SiteAccess>;
|
|
331
342
|
readonly resolve: (params?: ChannelSiteResolveParams) => Promise<SiteDocument>;
|
|
332
343
|
};
|
|
333
344
|
readonly init: {
|
|
@@ -470,6 +481,9 @@ declare function createNextChannelClient(options: CreateNextChannelClientOptions
|
|
|
470
481
|
readonly refresh: (refreshToken: string) => Promise<CustomerSession>;
|
|
471
482
|
};
|
|
472
483
|
readonly withCustomer: (session: string) => {
|
|
484
|
+
readonly site: {
|
|
485
|
+
readonly access: () => Promise<SiteAccess>;
|
|
486
|
+
};
|
|
473
487
|
readonly me: () => Promise<CustomerResponse>;
|
|
474
488
|
readonly updateProfile: (input: {
|
|
475
489
|
name?: string;
|
package/dist/next.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { CHANNEL_CATALOG_CACHE_TAG, CHANNEL_SITE_CACHE_TAG, cartCookie, createCart, createChannelWebhookRoute, createCustomerSession, createNextChannelClient, defaultChannelCacheTags, safePublishedPath, sessionCookie } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { CHANNEL_CATALOG_CACHE_TAG, CHANNEL_SITE_CACHE_TAG, cartCookie, createCart, createChannelWebhookRoute, createCustomerSession, createNextChannelClient, defaultChannelCacheTags, safePublishedPath, sessionCookie } from './chunk-AVIT2DZR.js';
|
|
2
|
+
import './chunk-BHEDC47V.js';
|
|
3
3
|
import './chunk-XPO7C3DW.js';
|
package/dist/site.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c2 as SiteRef, bZ as PublicGate, b$ as PublicSiteSignals } from './types-DWXo7QE3.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Site signals: what a public site serves, decided from the `signals` block
|
|
@@ -76,12 +76,15 @@ type SiteDecision = {
|
|
|
76
76
|
* Decides one request, in the server's order: no public site, then an
|
|
77
77
|
* inactive owner, then the gate. Exempt paths are always served, and a
|
|
78
78
|
* waitlist or maintenance gate never takes over `UNAVAILABLE_PATH` or
|
|
79
|
-
* `PRIVATE_PATH`. `private` means
|
|
80
|
-
*
|
|
81
|
-
*
|
|
79
|
+
* `PRIVATE_PATH`. `private` means only invited members and the owner's signed
|
|
80
|
+
* editor preview may see the site. `/init` is shared-cached, so signals cannot
|
|
81
|
+
* carry membership: a frontend learns it from `site.access()` with the
|
|
82
|
+
* viewer's session and passes `member: true`, which serves a private site.
|
|
83
|
+
* `siteResponse` turns the decision into what a proxy does.
|
|
82
84
|
*/
|
|
83
85
|
declare function siteDecision(signals: SiteSignals, pathname: string, options?: {
|
|
84
86
|
exempt?: readonly string[];
|
|
87
|
+
member?: boolean;
|
|
85
88
|
}): SiteDecision;
|
|
86
89
|
/** What a proxy does with a request: serve it, redirect it, or rewrite it in place. */
|
|
87
90
|
type SiteResponse = {
|
package/dist/site.js
CHANGED
|
@@ -59,7 +59,7 @@ function siteDecision(signals, pathname, options = {}) {
|
|
|
59
59
|
if (signals.lifecycle !== "active") return { type: "inactive", lifecycle: signals.lifecycle };
|
|
60
60
|
const gate = signals.gate;
|
|
61
61
|
if (!gate || gate.placement !== "page") return { type: "serve" };
|
|
62
|
-
if (gate.kind === "private") return { type: "private" };
|
|
62
|
+
if (gate.kind === "private") return options.member === true ? { type: "serve" } : { type: "private" };
|
|
63
63
|
if (underPath(pathname, gate.path)) return { type: "gate-page", gate };
|
|
64
64
|
if (SITE_STATE_PATHS.some((prefix) => underPath(pathname, prefix))) return { type: "serve" };
|
|
65
65
|
if (gate.enforcement === "rewrite") {
|
|
@@ -110,7 +110,7 @@ function withSiteModeChoice(base, choice) {
|
|
|
110
110
|
function describeLiveGate(gate) {
|
|
111
111
|
if (!gate) return "Live \xB7 visitors see the normal site";
|
|
112
112
|
if (gate.kind === "maintenance") return "Maintenance \xB7 visitors see the maintenance notice";
|
|
113
|
-
if (gate.kind === "private") return "Private \xB7 only members see the site";
|
|
113
|
+
if (gate.kind === "private") return "Private \xB7 only invited members can see the site";
|
|
114
114
|
return gate.placement === "page" ? "Waitlist \xB7 every page redirects to /waitlist" : "Waitlist \xB7 the site stays open with a signup form";
|
|
115
115
|
}
|
|
116
116
|
function toDateTimeLocal(value) {
|
|
@@ -194,11 +194,6 @@ interface Slot {
|
|
|
194
194
|
interface SlotsResponse {
|
|
195
195
|
items: Slot[];
|
|
196
196
|
}
|
|
197
|
-
interface UploadTicket {
|
|
198
|
-
expires_at: string;
|
|
199
|
-
upload_id: string;
|
|
200
|
-
upload_url: string;
|
|
201
|
-
}
|
|
202
197
|
|
|
203
198
|
interface ListResponse<T> {
|
|
204
199
|
items: T[];
|
|
@@ -279,6 +274,46 @@ interface WaitlistVerification {
|
|
|
279
274
|
interface WaitlistUnsubscription {
|
|
280
275
|
unsubscribed: boolean;
|
|
281
276
|
}
|
|
277
|
+
/** A lead file request, as the requester sees it (`channel.file_requests.view`). */
|
|
278
|
+
interface FileRequestView {
|
|
279
|
+
business_name: string;
|
|
280
|
+
message?: string;
|
|
281
|
+
files_left: number;
|
|
282
|
+
max_file_bytes: number;
|
|
283
|
+
expires_at: string;
|
|
284
|
+
closed: boolean;
|
|
285
|
+
}
|
|
286
|
+
/** The request token rides in the JSON body of every file-request call. */
|
|
287
|
+
interface FileRequestTokenInput {
|
|
288
|
+
token: string;
|
|
289
|
+
}
|
|
290
|
+
interface FileRequestUploadInput {
|
|
291
|
+
token: string;
|
|
292
|
+
file_name: string;
|
|
293
|
+
content_type?: string;
|
|
294
|
+
size_bytes: number;
|
|
295
|
+
}
|
|
296
|
+
/** `PUT` the file to `upload_url` with `Content-Type: application/octet-stream`. */
|
|
297
|
+
interface FileRequestUploadTicket {
|
|
298
|
+
upload_id: string;
|
|
299
|
+
upload_url: string;
|
|
300
|
+
content_type: string;
|
|
301
|
+
expires_at: string;
|
|
302
|
+
}
|
|
303
|
+
interface FileRequestCompleteInput {
|
|
304
|
+
token: string;
|
|
305
|
+
upload_id: string;
|
|
306
|
+
}
|
|
307
|
+
interface FileRequestReceivedFile {
|
|
308
|
+
file_name: string;
|
|
309
|
+
content_type: string;
|
|
310
|
+
size_bytes: number;
|
|
311
|
+
files_left: number;
|
|
312
|
+
closed: boolean;
|
|
313
|
+
}
|
|
314
|
+
interface FileRequestClosed {
|
|
315
|
+
closed: boolean;
|
|
316
|
+
}
|
|
282
317
|
interface PublicWorkspaceInit {
|
|
283
318
|
signals?: PublicSiteSignals;
|
|
284
319
|
workspace: WorkspaceInfo;
|
|
@@ -821,6 +856,13 @@ interface SiteGatedDocument {
|
|
|
821
856
|
};
|
|
822
857
|
}
|
|
823
858
|
type SiteDocument = SiteResolvedDocument | SiteGatedDocument;
|
|
859
|
+
/** What the viewer's session may see of the site (`channel.site.access`). */
|
|
860
|
+
interface SiteAccess {
|
|
861
|
+
/** The site is private. */
|
|
862
|
+
private: boolean;
|
|
863
|
+
/** The viewer is an invited, unbanned member of the workspace. */
|
|
864
|
+
member: boolean;
|
|
865
|
+
}
|
|
824
866
|
interface MenuItem {
|
|
825
867
|
id: string;
|
|
826
868
|
parent_id?: string;
|
|
@@ -1752,4 +1794,4 @@ interface BookingQuoteParams {
|
|
|
1752
1794
|
endsAt?: string;
|
|
1753
1795
|
}
|
|
1754
1796
|
|
|
1755
|
-
export type {
|
|
1797
|
+
export type { PublicConfiguration as $, AddCartItemInput as A, DashLeadPortalRequestLinkInput as B, CartResponse as C, DashProfileResponse as D, DashLeadPortalRequestLinkResponse as E, FileRequestView as F, DashLeadPortalView as G, DashMovingQuoteInput as H, DashMovingQuoteReceipt as I, DashMovingAddressList as J, DashMovingAddress as K, ListResponse as L, DashMovingDistance as M, SiteDocument as N, Order as O, PaymentCollectionAvailability as P, PublicWorkspaceInit as Q, LightInitResponse as R, SiteAccess as S, PublicPageSummary as T, PublicPage as U, Product as V, WaitlistGateStatus as W, ProductAsset as X, SlotsResponse as Y, DownloadResponse as Z, ArtworkMutationReceipt as _, CheckoutOptions as a, BeginUploadInput as a$, PublicConfigurationQuoteInput as a0, PublicConfigurationQuote as a1, CatalogCategory as a2, CatalogProductsResponse as a3, CatalogCollection as a4, CatalogBrand as a5, CartLookupResponse as a6, UpdateCartItemInput as a7, MergeCartInput as a8, Review as a9, PrintIntakeInput as aA, PrintJob as aB, DiningMenu as aC, CustomerSignupResponse as aD, SendCodeResponse as aE, CustomerSession as aF, CustomerResponse as aG, CustomerAuthSession as aH, CustomerSecurityActivityPage as aI, OrderSummary as aJ, SavedAddress as aK, SavedAddressResponse as aL, SavedAddressInput as aM, SavedAddressUpdateInput as aN, SavedPaymentMethod as aO, PaymentMethodSetupInput as aP, PaymentMethodSetupResult as aQ, PaymentMethodConfirmInput as aR, PaymentMethodMutationResponse as aS, StartSubscriptionInput as aT, SubscriptionAgreementResponse as aU, SubscriptionListResponse as aV, SubscriptionSourceResponse as aW, SubscriptionInvoiceListResponse as aX, SubscriptionInvoiceResponse as aY, GivingIntentListResponse as aZ, LeadResponse as a_, ReviewSummaryResponse as aa, PublicSubmitReviewInput as ab, ThemeResponse as ac, MenuResponse as ad, BlogPost as ae, BlogPostResponse as af, GivingEntry as ag, StartGivingInput as ah, StartGivingResponse as ai, SubscriptionPlanListResponse as aj, SubscriptionPlanResponse as ak, BookingService as al, BookingServiceResponse as am, BookingAvailabilityParams as an, BookingAvailabilityResponse as ao, BookingQuoteParams as ap, BookingQuoteResponse as aq, CreateBookingHoldInput as ar, BookingHoldResponse as as, PublicPaymentLinkResponse as at, PaymentLinkCheckoutInput as au, PaymentLinkCheckoutResponse as av, PaymentLinkRedemptionStatusResponse as aw, PrintSettingsResponse as ax, PrintOptionsSelection as ay, PrintQuoteResponse as az, CheckoutStatusResponse as b, PublicSiteSignals as b$, CompleteUploadInput as b0, DecisionInput as b1, Slot as b2, BookingAvailability as b3, BookingCancellationPolicy as b4, BookingCustomerInput as b5, BookingFreeSpan as b6, BookingHold as b7, BookingIntakeQuestion as b8, BookingPriceQuote as b9, DiningComboGroup as bA, DiningItemSize as bB, DiningMenuItem as bC, DiningModifier as bD, DiningModifierGroup as bE, DiningOffer as bF, DiningOfferBadge as bG, FileRequestTokenInput as bH, GivingIntent as bI, Menu as bJ, MenuItem as bK, OrderItem as bL, PaymentLinkRedemptionStatus as bM, PaymentMethodOption as bN, PaymentReadiness as bO, PrintBranding as bP, PrintIntakeLimits as bQ, PrintJobFile as bR, PrintPaperSize as bS, PrintPerPagePricing as bT, PrintPriceBreakdown as bU, PrintPriceLine as bV, PrintPricing as bW, PrintPricingOption as bX, ProductLineConfiguration as bY, PublicGate as bZ, PublicPaymentLink as b_, BookingServicePricing as ba, BookingTimeRange as bb, CatalogProduct as bc, CheckoutAddress as bd, CheckoutStatus as be, ConfigDocument as bf, ConfigQuote as bg, ConfigSelectionRequest as bh, Customer as bi, CustomerSecurityActivity as bj, DashBrandingInfo as bk, DashDirectoryProfile as bl, DashLeadPortalMatch as bm, DashLeadPortalMovingSummary as bn, DashLeadPortalRequest as bo, DashLeadPortalRequestStatus as bp, DashLocaleInfo as bq, DashPlan as br, DashPlanPricing as bs, DashPlanRegion as bt, DashPublicPage as bu, DashPublicProfileInfo as bv, DashTenantInfo as bw, DiningAvailability as bx, DiningAvailabilityRule as by, DiningComboChoice as bz, CheckoutCustomerInput as c, ShippingMethodOption as c0, SiteGatedDocument as c1, SiteRef as c2, SiteResolvedDocument as c3, SiteSubject as c4, SubscriptionAgreement as c5, SubscriptionInvoice as c6, SubscriptionPlanOffer as c7, SubscriptionSourceDisplay as c8, WaitlistAttribution as c9, WorkspaceInfo as ca, CheckoutAddressesInput as d, CheckoutFulfillmentInput as e, CheckoutPayInput as f, CheckoutPayResponse as g, CheckoutCancelInput as h, ChannelPing as i, ChannelGeo as j, WaitlistFormSettings as k, WaitlistSubmission as l, WaitlistAcknowledgement as m, WaitlistVerification as n, WaitlistUnsubscription as o, FileRequestUploadInput as p, FileRequestUploadTicket as q, FileRequestCompleteInput as r, FileRequestReceivedFile as s, FileRequestClosed as t, DashInitResponse as u, DashPlansResponse as v, DashDirectoryRegion as w, DashDirectoryEntry as x, DashDirectoryProfileResponse as y, DashLead as z };
|