@c1m-public/channel-client 0.38.0 → 0.39.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 CHANGED
@@ -323,10 +323,12 @@ maintenance or private), the owner's `lifecycle`, `visibility` and
323
323
  `site_enabled`. Decide a request from it and never recompute availability:
324
324
 
325
325
  ```ts
326
- import { normalizeSignals, siteDecision } from "@c1m-public/channel-client/site";
326
+ import { normalizeSignals, siteDecision, siteResponse } from "@c1m-public/channel-client/site";
327
327
 
328
328
  const decision = siteDecision(normalizeSignals(init), pathname, { exempt: ["/account"] });
329
329
  // serve | no-site | inactive | private | gate-page | redirect | rewrite
330
+ const response = siteResponse(decision);
331
+ // serve | redirect | rewrite (path, status, retryAfter?)
330
332
  ```
331
333
 
332
334
  The order is the server's: no public site, then an inactive owner, then the
@@ -336,6 +338,13 @@ sessions checks membership before showing its private page. A backend that
336
338
  predates `signals` is read from its top-level `gate` as an active, public
337
339
  site.
338
340
 
341
+ `siteResponse` is what a proxy does with a decision. Only `serve` and
342
+ `gate-page` pass through. No site rewrites to `UNAVAILABLE_PATH`
343
+ (`/unavailable`) with 404, an inactive owner to the same path with 503, and a
344
+ private site to `PRIVATE_PATH` (`/private`) with 403. A waitlist or
345
+ maintenance gate never takes over those two paths, so each page should 404
346
+ itself when the site is available.
347
+
339
348
  `SITE_MODE_CHOICES`, `siteModeChoice`, `withSiteModeChoice`,
340
349
  `describeLiveGate`, `toDateTimeLocal` and `fromDateTimeLocal` are the shared
341
350
  pieces of a site-mode settings form.
@@ -1,7 +1,7 @@
1
1
  import { DashChannelClient } from './dash.js';
2
2
  import { CreateNextChannelClientOptions } from './next.js';
3
3
  import './index.js';
4
- import './types-CPdlxf5p.js';
4
+ import './types-CgleEp97.js';
5
5
  import './webhooks.js';
6
6
 
7
7
  /**
package/dist/dash.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createChannelClient, ChannelVisitor, CreateChannelClientOptions } from './index.js';
2
- import './types-CPdlxf5p.js';
2
+ import './types-CgleEp97.js';
3
3
  import './webhooks.js';
4
4
 
5
5
  /**
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { i as ChannelPing, j as ChannelGeo, P as PaymentCollectionAvailability, W as WaitlistVerification, k as WaitlistUnsubscription, D as DashProfileResponse, l as DashInitResponse, m as WaitlistGateStatus, n as WaitlistFormSettings, o as WaitlistSubmission, p as WaitlistAcknowledgement, q as DashPlansResponse, L as ListResponse, r as DashDirectoryRegion, s as DashDirectoryEntry, t as DashDirectoryProfileResponse, u as DashLead, v as DashLeadPortalRequestLinkInput, w as DashLeadPortalRequestLinkResponse, x as DashLeadPortalView, y as DashMovingQuoteInput, z as DashMovingQuoteReceipt, B as DashMovingAddressList, E as DashMovingAddress, F as DashMovingDistance, S as SiteDocument, G as PublicWorkspaceInit, H as LightInitResponse, I as PublicPageSummary, J as PublicPage, K as Product, M as ProductAsset, N as SlotsResponse, Q as DownloadResponse, aV as BeginUploadInput, U as UploadTicket, aW as CompleteUploadInput, R as ArtworkMutationReceipt, aX as DecisionInput, T as PublicConfiguration, V as PublicConfigurationQuoteInput, X as PublicConfigurationQuote, Y as CatalogCategory, Z as CatalogProductsResponse, _ as CatalogCollection, $ as CatalogBrand, a0 as CartLookupResponse, A as AddCartItemInput, C as CartResponse, a1 as UpdateCartItemInput, a2 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, a3 as Review, a4 as ReviewSummaryResponse, a5 as PublicSubmitReviewInput, a6 as ThemeResponse, a7 as MenuResponse, a8 as BlogPost, a9 as BlogPostResponse, aa as GivingEntry, ab as StartGivingInput, ac as StartGivingResponse, ad as SubscriptionPlanListResponse, ae as SubscriptionPlanResponse, af as BookingService, ag as BookingServiceResponse, ah as BookingAvailabilityParams, ai as BookingAvailabilityResponse, aj as BookingQuoteParams, ak as BookingQuoteResponse, al as CreateBookingHoldInput, am as BookingHoldResponse, an as PublicPaymentLinkResponse, ao as PaymentLinkCheckoutInput, ap as PaymentLinkCheckoutResponse, aq as PaymentLinkRedemptionStatusResponse, ar as PrintSettingsResponse, as as PrintOptionsSelection, at as PrintQuoteResponse, au as PrintIntakeInput, av as PrintJob, aw as DiningMenu, ax as CustomerSignupResponse, ay as SendCodeResponse, az as CustomerSession, aA as CustomerResponse, aB as CustomerAuthSession, aC as CustomerSecurityActivityPage, O as Order, aD as OrderSummary, aE as SavedAddress, aF as SavedAddressResponse, aG as SavedAddressInput, aH as SavedAddressUpdateInput, aI as SavedPaymentMethod, aJ as PaymentMethodSetupInput, aK as PaymentMethodSetupResult, aL as PaymentMethodConfirmInput, aM as PaymentMethodMutationResponse, aN as StartSubscriptionInput, aO as SubscriptionAgreementResponse, aP as SubscriptionListResponse, aQ as SubscriptionSourceResponse, aR as SubscriptionInvoiceListResponse, aS as SubscriptionInvoiceResponse, aT as GivingIntentListResponse, aU as LeadResponse, aY as Slot } from './types-CPdlxf5p.js';
2
- export { aZ as BookingAvailability, a_ as BookingCancellationPolicy, a$ as BookingCustomerInput, b0 as BookingFreeSpan, b1 as BookingHold, b2 as BookingIntakeQuestion, b3 as BookingPriceQuote, b4 as BookingServicePricing, b5 as BookingTimeRange, b6 as CatalogProduct, b7 as CheckoutAddress, b8 as CheckoutStatus, b9 as ConfigDocument, ba as ConfigQuote, bb as ConfigSelectionRequest, bc as Customer, bd as CustomerSecurityActivity, be as DashBrandingInfo, bf as DashDirectoryProfile, bg as DashLeadPortalMatch, bh as DashLeadPortalMovingSummary, bi as DashLeadPortalRequest, bj as DashLeadPortalRequestStatus, bk as DashLocaleInfo, bl as DashPlan, bm as DashPlanPricing, bn as DashPlanRegion, bo as DashPublicPage, bp as DashPublicProfileInfo, bq as DashTenantInfo, br as DiningAvailability, bs as DiningAvailabilityRule, bt as DiningComboChoice, bu as DiningComboGroup, bv as DiningItemSize, bw as DiningMenuItem, bx as DiningModifier, by as DiningModifierGroup, bz as DiningOffer, bA as DiningOfferBadge, bB as GivingIntent, bC as Menu, bD as MenuItem, bE as OrderItem, bF as PaymentLinkRedemptionStatus, bG as PaymentMethodOption, bH as PaymentReadiness, bI as PrintBranding, bJ as PrintIntakeLimits, bK as PrintJobFile, bL as PrintPaperSize, bM as PrintPerPagePricing, bN as PrintPriceBreakdown, bO as PrintPriceLine, bP as PrintPricing, bQ as PrintPricingOption, bR as ProductLineConfiguration, bS as PublicGate, bT as PublicPaymentLink, bU as PublicSiteSignals, bV as ShippingMethodOption, bW as SiteGatedDocument, bX as SiteRef, bY as SiteResolvedDocument, bZ as SiteSubject, b_ as SubscriptionAgreement, b$ as SubscriptionInvoice, c0 as SubscriptionPlanOffer, c1 as SubscriptionSourceDisplay, c2 as WaitlistAttribution, c3 as WorkspaceInfo } from './types-CPdlxf5p.js';
1
+ import { i as ChannelPing, j as ChannelGeo, P as PaymentCollectionAvailability, W as WaitlistVerification, k as WaitlistUnsubscription, D as DashProfileResponse, l as DashInitResponse, m as WaitlistGateStatus, n as WaitlistFormSettings, o as WaitlistSubmission, p as WaitlistAcknowledgement, q as DashPlansResponse, L as ListResponse, r as DashDirectoryRegion, s as DashDirectoryEntry, t as DashDirectoryProfileResponse, u as DashLead, v as DashLeadPortalRequestLinkInput, w as DashLeadPortalRequestLinkResponse, x as DashLeadPortalView, y as DashMovingQuoteInput, z as DashMovingQuoteReceipt, B as DashMovingAddressList, E as DashMovingAddress, F as DashMovingDistance, S as SiteDocument, G as PublicWorkspaceInit, H as LightInitResponse, I as PublicPageSummary, J as PublicPage, K as Product, M as ProductAsset, N as SlotsResponse, Q as DownloadResponse, aV as BeginUploadInput, U as UploadTicket, aW as CompleteUploadInput, R as ArtworkMutationReceipt, aX as DecisionInput, T as PublicConfiguration, V as PublicConfigurationQuoteInput, X as PublicConfigurationQuote, Y as CatalogCategory, Z as CatalogProductsResponse, _ as CatalogCollection, $ as CatalogBrand, a0 as CartLookupResponse, A as AddCartItemInput, C as CartResponse, a1 as UpdateCartItemInput, a2 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, a3 as Review, a4 as ReviewSummaryResponse, a5 as PublicSubmitReviewInput, a6 as ThemeResponse, a7 as MenuResponse, a8 as BlogPost, a9 as BlogPostResponse, aa as GivingEntry, ab as StartGivingInput, ac as StartGivingResponse, ad as SubscriptionPlanListResponse, ae as SubscriptionPlanResponse, af as BookingService, ag as BookingServiceResponse, ah as BookingAvailabilityParams, ai as BookingAvailabilityResponse, aj as BookingQuoteParams, ak as BookingQuoteResponse, al as CreateBookingHoldInput, am as BookingHoldResponse, an as PublicPaymentLinkResponse, ao as PaymentLinkCheckoutInput, ap as PaymentLinkCheckoutResponse, aq as PaymentLinkRedemptionStatusResponse, ar as PrintSettingsResponse, as as PrintOptionsSelection, at as PrintQuoteResponse, au as PrintIntakeInput, av as PrintJob, aw as DiningMenu, ax as CustomerSignupResponse, ay as SendCodeResponse, az as CustomerSession, aA as CustomerResponse, aB as CustomerAuthSession, aC as CustomerSecurityActivityPage, O as Order, aD as OrderSummary, aE as SavedAddress, aF as SavedAddressResponse, aG as SavedAddressInput, aH as SavedAddressUpdateInput, aI as SavedPaymentMethod, aJ as PaymentMethodSetupInput, aK as PaymentMethodSetupResult, aL as PaymentMethodConfirmInput, aM as PaymentMethodMutationResponse, aN as StartSubscriptionInput, aO as SubscriptionAgreementResponse, aP as SubscriptionListResponse, aQ as SubscriptionSourceResponse, aR as SubscriptionInvoiceListResponse, aS as SubscriptionInvoiceResponse, aT as GivingIntentListResponse, aU as LeadResponse, aY as Slot } from './types-CgleEp97.js';
2
+ export { aZ as BookingAvailability, a_ as BookingCancellationPolicy, a$ as BookingCustomerInput, b0 as BookingFreeSpan, b1 as BookingHold, b2 as BookingIntakeQuestion, b3 as BookingPriceQuote, b4 as BookingServicePricing, b5 as BookingTimeRange, b6 as CatalogProduct, b7 as CheckoutAddress, b8 as CheckoutStatus, b9 as ConfigDocument, ba as ConfigQuote, bb as ConfigSelectionRequest, bc as Customer, bd as CustomerSecurityActivity, be as DashBrandingInfo, bf as DashDirectoryProfile, bg as DashLeadPortalMatch, bh as DashLeadPortalMovingSummary, bi as DashLeadPortalRequest, bj as DashLeadPortalRequestStatus, bk as DashLocaleInfo, bl as DashPlan, bm as DashPlanPricing, bn as DashPlanRegion, bo as DashPublicPage, bp as DashPublicProfileInfo, bq as DashTenantInfo, br as DiningAvailability, bs as DiningAvailabilityRule, bt as DiningComboChoice, bu as DiningComboGroup, bv as DiningItemSize, bw as DiningMenuItem, bx as DiningModifier, by as DiningModifierGroup, bz as DiningOffer, bA as DiningOfferBadge, bB as GivingIntent, bC as Menu, bD as MenuItem, bE as OrderItem, bF as PaymentLinkRedemptionStatus, bG as PaymentMethodOption, bH as PaymentReadiness, bI as PrintBranding, bJ as PrintIntakeLimits, bK as PrintJobFile, bL as PrintPaperSize, bM as PrintPerPagePricing, bN as PrintPriceBreakdown, bO as PrintPriceLine, bP as PrintPricing, bQ as PrintPricingOption, bR as ProductLineConfiguration, bS as PublicGate, bT as PublicPaymentLink, bU as PublicSiteSignals, bV as ShippingMethodOption, bW as SiteGatedDocument, bX as SiteRef, bY as SiteResolvedDocument, bZ as SiteSubject, b_ as SubscriptionAgreement, b$ as SubscriptionInvoice, c0 as SubscriptionPlanOffer, c1 as SubscriptionSourceDisplay, c2 as WaitlistAttribution, c3 as WorkspaceInfo } from './types-CgleEp97.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
  /**
package/dist/next.d.ts CHANGED
@@ -1,5 +1,5 @@
1
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 WaitlistVerification, k as WaitlistUnsubscription, D as DashProfileResponse, l as DashInitResponse, m as WaitlistGateStatus, n as WaitlistFormSettings, o as WaitlistSubmission, p as WaitlistAcknowledgement, q as DashPlansResponse, L as ListResponse, r as DashDirectoryRegion, s as DashDirectoryEntry, t as DashDirectoryProfileResponse, u as DashLead, v as DashLeadPortalRequestLinkInput, w as DashLeadPortalRequestLinkResponse, x as DashLeadPortalView, y as DashMovingQuoteInput, z as DashMovingQuoteReceipt, B as DashMovingAddressList, E as DashMovingAddress, F as DashMovingDistance, S as SiteDocument, G as PublicWorkspaceInit, H as LightInitResponse, I as PublicPageSummary, J as PublicPage, K as Product, M as ProductAsset, N as SlotsResponse, Q as DownloadResponse, U as UploadTicket, R as ArtworkMutationReceipt, T as PublicConfiguration, V as PublicConfigurationQuoteInput, X as PublicConfigurationQuote, Y as CatalogCategory, Z as CatalogProductsResponse, _ as CatalogCollection, $ as CatalogBrand, a0 as CartLookupResponse, a1 as UpdateCartItemInput, a2 as MergeCartInput, a3 as Review, a4 as ReviewSummaryResponse, a5 as PublicSubmitReviewInput, a6 as ThemeResponse, a7 as MenuResponse, a8 as BlogPost, a9 as BlogPostResponse, aa as GivingEntry, ab as StartGivingInput, ac as StartGivingResponse, ad as SubscriptionPlanListResponse, ae as SubscriptionPlanResponse, af as BookingService, ag as BookingServiceResponse, ah as BookingAvailabilityParams, ai as BookingAvailabilityResponse, aj as BookingQuoteParams, ak as BookingQuoteResponse, al as CreateBookingHoldInput, am as BookingHoldResponse, an as PublicPaymentLinkResponse, ao as PaymentLinkCheckoutInput, ap as PaymentLinkCheckoutResponse, aq as PaymentLinkRedemptionStatusResponse, ar as PrintSettingsResponse, as as PrintOptionsSelection, at as PrintQuoteResponse, au as PrintIntakeInput, av as PrintJob, aw as DiningMenu, ax as CustomerSignupResponse, ay as SendCodeResponse, az as CustomerSession, aA as CustomerResponse, aB as CustomerAuthSession, aC as CustomerSecurityActivityPage, aD as OrderSummary, aE as SavedAddress, aF as SavedAddressResponse, aG as SavedAddressInput, aH as SavedAddressUpdateInput, aI as SavedPaymentMethod, aJ as PaymentMethodSetupInput, aK as PaymentMethodSetupResult, aL as PaymentMethodConfirmInput, aM as PaymentMethodMutationResponse, aN as StartSubscriptionInput, aO as SubscriptionAgreementResponse, aP as SubscriptionListResponse, aQ as SubscriptionSourceResponse, aR as SubscriptionInvoiceListResponse, aS as SubscriptionInvoiceResponse, aT as GivingIntentListResponse, aU as LeadResponse } from './types-CPdlxf5p.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 WaitlistVerification, k as WaitlistUnsubscription, D as DashProfileResponse, l as DashInitResponse, m as WaitlistGateStatus, n as WaitlistFormSettings, o as WaitlistSubmission, p as WaitlistAcknowledgement, q as DashPlansResponse, L as ListResponse, r as DashDirectoryRegion, s as DashDirectoryEntry, t as DashDirectoryProfileResponse, u as DashLead, v as DashLeadPortalRequestLinkInput, w as DashLeadPortalRequestLinkResponse, x as DashLeadPortalView, y as DashMovingQuoteInput, z as DashMovingQuoteReceipt, B as DashMovingAddressList, E as DashMovingAddress, F as DashMovingDistance, S as SiteDocument, G as PublicWorkspaceInit, H as LightInitResponse, I as PublicPageSummary, J as PublicPage, K as Product, M as ProductAsset, N as SlotsResponse, Q as DownloadResponse, U as UploadTicket, R as ArtworkMutationReceipt, T as PublicConfiguration, V as PublicConfigurationQuoteInput, X as PublicConfigurationQuote, Y as CatalogCategory, Z as CatalogProductsResponse, _ as CatalogCollection, $ as CatalogBrand, a0 as CartLookupResponse, a1 as UpdateCartItemInput, a2 as MergeCartInput, a3 as Review, a4 as ReviewSummaryResponse, a5 as PublicSubmitReviewInput, a6 as ThemeResponse, a7 as MenuResponse, a8 as BlogPost, a9 as BlogPostResponse, aa as GivingEntry, ab as StartGivingInput, ac as StartGivingResponse, ad as SubscriptionPlanListResponse, ae as SubscriptionPlanResponse, af as BookingService, ag as BookingServiceResponse, ah as BookingAvailabilityParams, ai as BookingAvailabilityResponse, aj as BookingQuoteParams, ak as BookingQuoteResponse, al as CreateBookingHoldInput, am as BookingHoldResponse, an as PublicPaymentLinkResponse, ao as PaymentLinkCheckoutInput, ap as PaymentLinkCheckoutResponse, aq as PaymentLinkRedemptionStatusResponse, ar as PrintSettingsResponse, as as PrintOptionsSelection, at as PrintQuoteResponse, au as PrintIntakeInput, av as PrintJob, aw as DiningMenu, ax as CustomerSignupResponse, ay as SendCodeResponse, az as CustomerSession, aA as CustomerResponse, aB as CustomerAuthSession, aC as CustomerSecurityActivityPage, aD as OrderSummary, aE as SavedAddress, aF as SavedAddressResponse, aG as SavedAddressInput, aH as SavedAddressUpdateInput, aI as SavedPaymentMethod, aJ as PaymentMethodSetupInput, aK as PaymentMethodSetupResult, aL as PaymentMethodConfirmInput, aM as PaymentMethodMutationResponse, aN as StartSubscriptionInput, aO as SubscriptionAgreementResponse, aP as SubscriptionListResponse, aQ as SubscriptionSourceResponse, aR as SubscriptionInvoiceListResponse, aS as SubscriptionInvoiceResponse, aT as GivingIntentListResponse, aU as LeadResponse } from './types-CgleEp97.js';
3
3
  import { ChannelWebhookEventDataMap, ChannelWebhookEvent } from './webhooks.js';
4
4
 
5
5
  /**
package/dist/site.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { bX as SiteRef, bS as PublicGate, bU as PublicSiteSignals } from './types-CPdlxf5p.js';
1
+ import { bX as SiteRef, bS as PublicGate, bU as PublicSiteSignals } from './types-CgleEp97.js';
2
2
 
3
3
  /**
4
4
  * Site signals: what a public site serves, decided from the `signals` block
@@ -37,6 +37,10 @@ interface SiteSignals {
37
37
  * links) through `exempt`.
38
38
  */
39
39
  declare const GATE_EXEMPT_PATHS: readonly string[];
40
+ /** Where a site renders "not available" (no site on the plan, or an inactive owner). */
41
+ declare const UNAVAILABLE_PATH = "/unavailable";
42
+ /** Where a site renders "this site is private". */
43
+ declare const PRIVATE_PATH = "/private";
40
44
  /**
41
45
  * Keeps only a gate this client can enforce. An unknown kind is dropped, so a
42
46
  * mode added on the server after a site shipped never breaks that site.
@@ -70,13 +74,33 @@ type SiteDecision = {
70
74
  };
71
75
  /**
72
76
  * Decides one request, in the server's order: no public site, then an
73
- * inactive owner, then the gate. Exempt paths are always served. `private`
74
- * means the public may not see the site; a site with member sessions checks
75
- * membership (site/resolve does) before showing its private page.
77
+ * inactive owner, then the gate. Exempt paths are always served, and a
78
+ * waitlist or maintenance gate never takes over `UNAVAILABLE_PATH` or
79
+ * `PRIVATE_PATH`. `private` means the public may not see the site; a site with
80
+ * member sessions checks membership (site/resolve does) before showing its
81
+ * private page. `siteResponse` turns the decision into what a proxy does.
76
82
  */
77
83
  declare function siteDecision(signals: SiteSignals, pathname: string, options?: {
78
84
  exempt?: readonly string[];
79
85
  }): SiteDecision;
86
+ /** What a proxy does with a request: serve it, redirect it, or rewrite it in place. */
87
+ type SiteResponse = {
88
+ type: "serve";
89
+ } | {
90
+ type: "redirect";
91
+ path: string;
92
+ } | {
93
+ type: "rewrite";
94
+ path: string;
95
+ status: number;
96
+ retryAfter?: number;
97
+ };
98
+ /**
99
+ * One decision as a response. `serve` and `gate-page` pass through; no site answers
100
+ * 404 and an inactive owner 503 at `UNAVAILABLE_PATH`, a private site 403 at
101
+ * `PRIVATE_PATH`.
102
+ */
103
+ declare function siteResponse(decision: SiteDecision): SiteResponse;
80
104
  /** A site mode as an owner picks it: mode and placement in one choice. */
81
105
  type SiteModeChoice = "off" | "waitlist-page" | "waitlist-block" | "maintenance";
82
106
  interface SiteModeFields {
@@ -98,4 +122,4 @@ declare function toDateTimeLocal(value?: string): string;
98
122
  /** A datetime-local value back to RFC 3339; undefined when empty or invalid. */
99
123
  declare function fromDateTimeLocal(value: string): string | undefined;
100
124
 
101
- export { GATE_EXEMPT_PATHS, PublicGate, PublicSiteSignals, SITE_MODE_CHOICES, type SiteDecision, type SiteGate, type SiteGateKind, type SiteModeChoice, type SiteModeFields, SiteRef, type SiteSignals, describeLiveGate, fromDateTimeLocal, normalizeGate, normalizeSignals, siteDecision, siteModeChoice, toDateTimeLocal, withSiteModeChoice };
125
+ export { GATE_EXEMPT_PATHS, PRIVATE_PATH, PublicGate, PublicSiteSignals, SITE_MODE_CHOICES, type SiteDecision, type SiteGate, type SiteGateKind, type SiteModeChoice, type SiteModeFields, SiteRef, type SiteResponse, type SiteSignals, UNAVAILABLE_PATH, describeLiveGate, fromDateTimeLocal, normalizeGate, normalizeSignals, siteDecision, siteModeChoice, siteResponse, toDateTimeLocal, withSiteModeChoice };
package/dist/site.js CHANGED
@@ -11,6 +11,9 @@ var GATE_EXEMPT_PATHS = [
11
11
  "/cookies",
12
12
  "/legal"
13
13
  ];
14
+ var UNAVAILABLE_PATH = "/unavailable";
15
+ var PRIVATE_PATH = "/private";
16
+ var SITE_STATE_PATHS = [UNAVAILABLE_PATH, PRIVATE_PATH];
14
17
  var DEFAULT_GATE_PATH = { waitlist: "/waitlist", maintenance: "/maintenance" };
15
18
  function safePath(path) {
16
19
  return typeof path === "string" && path.startsWith("/") && !path.startsWith("//") ? path : void 0;
@@ -58,11 +61,29 @@ function siteDecision(signals, pathname, options = {}) {
58
61
  if (!gate || gate.placement !== "page") return { type: "serve" };
59
62
  if (gate.kind === "private") return { type: "private" };
60
63
  if (underPath(pathname, gate.path)) return { type: "gate-page", gate };
64
+ if (SITE_STATE_PATHS.some((prefix) => underPath(pathname, prefix))) return { type: "serve" };
61
65
  if (gate.enforcement === "rewrite") {
62
66
  return { type: "rewrite", path: gate.path, status: gate.status ?? 200, ...gate.retryAfter ? { retryAfter: gate.retryAfter } : {} };
63
67
  }
64
68
  return { type: "redirect", path: gate.path };
65
69
  }
70
+ function siteResponse(decision) {
71
+ switch (decision.type) {
72
+ case "serve":
73
+ case "gate-page":
74
+ return { type: "serve" };
75
+ case "no-site":
76
+ return { type: "rewrite", path: UNAVAILABLE_PATH, status: 404 };
77
+ case "inactive":
78
+ return { type: "rewrite", path: UNAVAILABLE_PATH, status: 503 };
79
+ case "private":
80
+ return { type: "rewrite", path: PRIVATE_PATH, status: 403 };
81
+ case "redirect":
82
+ return { type: "redirect", path: decision.path };
83
+ case "rewrite":
84
+ return { type: "rewrite", path: decision.path, status: decision.status, ...decision.retryAfter ? { retryAfter: decision.retryAfter } : {} };
85
+ }
86
+ }
66
87
  var SITE_MODE_CHOICES = [
67
88
  { value: "off", label: "Live", description: "Visitors see the normal site." },
68
89
  { value: "waitlist-page", label: "Waitlist page", description: "Every storefront page redirects to /waitlist. Account and legal pages stay reachable." },
@@ -104,4 +125,4 @@ function fromDateTimeLocal(value) {
104
125
  return Number.isNaN(date.getTime()) ? void 0 : date.toISOString();
105
126
  }
106
127
 
107
- export { GATE_EXEMPT_PATHS, SITE_MODE_CHOICES, describeLiveGate, fromDateTimeLocal, normalizeGate, normalizeSignals, siteDecision, siteModeChoice, toDateTimeLocal, withSiteModeChoice };
128
+ export { GATE_EXEMPT_PATHS, PRIVATE_PATH, SITE_MODE_CHOICES, UNAVAILABLE_PATH, describeLiveGate, fromDateTimeLocal, normalizeGate, normalizeSignals, siteDecision, siteModeChoice, siteResponse, toDateTimeLocal, withSiteModeChoice };
@@ -37,17 +37,9 @@ interface Choice {
37
37
  description?: string;
38
38
  key: string;
39
39
  label: string;
40
+ lead_days?: number;
40
41
  price?: PriceChange;
41
42
  }
42
- interface ChoiceGroup {
43
- choices: Choice[];
44
- key: string;
45
- kind: string;
46
- label: string;
47
- max_picks?: number;
48
- min_picks?: number;
49
- required?: boolean;
50
- }
51
43
  interface ChoiceRule {
52
44
  allowed: string[];
53
45
  in: string[];
@@ -59,9 +51,7 @@ interface CompleteUploadInput {
59
51
  cart_token?: string;
60
52
  }
61
53
  interface ConfigDocument {
62
- base_price?: number;
63
- groups: ChoiceGroup[];
64
- inputs?: CustomerInputs;
54
+ fields: ConfigField[];
65
55
  minimum_total?: number;
66
56
  notes?: string;
67
57
  quantity?: QuantityPricing;
@@ -69,6 +59,31 @@ interface ConfigDocument {
69
59
  setup_fee?: number;
70
60
  version: number;
71
61
  }
62
+ interface ConfigField {
63
+ bleed_mm?: number;
64
+ choices?: Choice[];
65
+ formats?: string[];
66
+ key: string;
67
+ label: string;
68
+ max_height_mm?: number;
69
+ max_length?: number;
70
+ max_mb?: number;
71
+ max_picks?: number;
72
+ max_width_mm?: number;
73
+ min_billable_area_mm2?: number;
74
+ min_dpi?: number;
75
+ min_height_mm?: number;
76
+ min_picks?: number;
77
+ min_width_mm?: number;
78
+ multi?: boolean;
79
+ proof_required?: boolean;
80
+ rate_per_m2?: number;
81
+ required?: boolean;
82
+ safe_mm?: number;
83
+ trim_h_mm?: number;
84
+ trim_w_mm?: number;
85
+ type: string;
86
+ }
72
87
  interface ConfigQuote {
73
88
  doc_hash: string;
74
89
  lead_days: number;
@@ -84,14 +99,12 @@ interface ConfigSelection {
84
99
  dimensions?: CustomSize;
85
100
  quantity?: number;
86
101
  text?: Record<string, string>;
87
- turnaround?: string;
88
102
  }
89
103
  interface ConfigSelectionRequest {
90
104
  choices?: Record<string, string[]>;
91
105
  dimensions?: CustomSizeRequest;
92
106
  quantity?: number;
93
107
  text?: Record<string, string>;
94
- turnaround?: string;
95
108
  }
96
109
  interface CustomSize {
97
110
  height_mm: number;
@@ -101,26 +114,11 @@ interface CustomSizeRequest {
101
114
  height_mm?: number;
102
115
  width_mm?: number;
103
116
  }
104
- interface CustomerInputs {
105
- artwork?: ArtworkSlot[];
106
- dimensions?: DimensionPricing;
107
- text?: TextInput[];
108
- turnaround?: TurnaroundOption[];
109
- }
110
117
  interface DecisionInput {
111
118
  approve?: boolean;
112
119
  cart_token: string;
113
120
  version: number;
114
121
  }
115
- interface DimensionPricing {
116
- label?: string;
117
- max_height_mm: number;
118
- max_width_mm: number;
119
- min_billable_area_mm2?: number;
120
- min_height_mm: number;
121
- min_width_mm: number;
122
- rate_per_m2: number;
123
- }
124
122
  interface DownloadResponse {
125
123
  expires_in: number;
126
124
  url: string;
@@ -164,6 +162,7 @@ interface PublicConfigurationQuote {
164
162
  interface PublicConfigurationQuoteInput {
165
163
  revision_id?: string;
166
164
  selection?: ConfigSelectionRequest;
165
+ variant_id?: string;
167
166
  }
168
167
  interface QuantityPricing {
169
168
  axes?: string[];
@@ -195,19 +194,6 @@ interface Slot {
195
194
  interface SlotsResponse {
196
195
  items: Slot[];
197
196
  }
198
- interface TextInput {
199
- key: string;
200
- label: string;
201
- max_length: number;
202
- required?: boolean;
203
- }
204
- interface TurnaroundOption {
205
- default?: boolean;
206
- key: string;
207
- label: string;
208
- lead_days: number;
209
- surcharge?: PriceChange;
210
- }
211
197
  interface UploadTicket {
212
198
  expires_at: string;
213
199
  upload_id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c1m-public/channel-client",
3
- "version": "0.38.0",
3
+ "version": "0.39.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Typed server-side client for the MML headless Channel API",