@c1m-public/channel-client 0.15.0 → 0.16.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
@@ -250,13 +250,35 @@ separate, parallel reads. `dash.init()` is the same shape for dash sites
250
250
  (`branding`, `locale`, `seo`, `site`).
251
251
 
252
252
  The core also exposes the complete current channel door: public category,
253
- collection and brand navigation; published blog and giving reads; cart and
254
- checkout; Quick Print settings, quotes and multipart intake; assembled dining
255
- menus; and signed-in customer orders, addresses, giving history, saved payment
256
- methods and subscriptions. `pnpm contract:check` compares both client
253
+ collection and brand navigation; published blog and giving reads; subscription
254
+ plan reads for a membership picker; cart and checkout; Quick Print settings,
255
+ quotes and multipart intake; assembled dining menus; and signed-in customer
256
+ orders, addresses, giving history, saved payment methods and subscriptions. `pnpm contract:check` compares both client
257
257
  inventories with the canonical server OpenAPI document when the repositories
258
258
  are checked out together.
259
259
 
260
+ ## `./moving-lead-model`
261
+
262
+ A subpath carrying the moving-quote domain model: lead payload schemas, the
263
+ broker region/tag rules that decide which providers a lead reaches, and UK
264
+ address normalisation. It is not channel-transport code — it lives here because
265
+ commissioned sites already depend on this package and cannot import from the
266
+ saas monorepo, and duplicating a cross-repo wire contract per site is how the
267
+ copies start disagreeing. Extract it to its own package if it outgrows that.
268
+
269
+ ```ts
270
+ import {
271
+ buildMovingLeadPayload,
272
+ buildMovingBrokerCapturePayload,
273
+ isMovingLeadReady,
274
+ } from "@c1m-public/channel-client/moving-lead-model";
275
+ ```
276
+
277
+ `zod` (^4) is an **optional** peer dependency: required only if you import this
278
+ subpath, so the other entry points do not oblige every consumer to install it.
279
+ It is never bundled — two zod instances in one app break `instanceof` on schemas.
280
+
281
+
260
282
  ```ts
261
283
  // session: cookie codec + the contested-vs-expired refresh decision
262
284
  const session = createCustomerSession({ client: getChannelClient });
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import "server-only";
2
2
  export * from "./webhooks.js";
3
3
  export * from "./errors.js";
4
4
  export type * from "./types.js";
5
- import type { CatalogBrand, CatalogCategory, CatalogCollection, CatalogProductsResponse, BlogPostResponse, DiningMenu, DashDirectoryEntry, DashDirectoryProfileResponse, DashDirectoryRegion, DashInitResponse, DashLead, DashPlansResponse, DashProfileResponse, GivingEntry, GivingIntentListResponse, AddCartItemInput, CartResponse, CheckoutAddressesInput, CheckoutCustomerInput, CheckoutFulfillmentInput, CheckoutOptions, CheckoutPayInput, CheckoutPayResponse, CheckoutStatusResponse, ChannelPing, CustomerResponse, CustomerAuthSession, CustomerSecurityActivityPage, ChannelGeo, CustomerSession, CustomerSignupResponse, LeadResponse, LightInitResponse, ListResponse, Order, OrderSummary, MergeCartInput, SendCodeResponse, Product, ProductAsset, PrintIntakeInput, PrintJob, PrintOptionsSelection, PrintQuoteResponse, PrintSettingsResponse, PublicPage, PublicPageSummary, PublicSubmitReviewInput, PublicWorkspaceInit, MenuResponse, Review, ReviewSummaryResponse, SavedAddress, SavedAddressDefaultKind, SavedAddressInput, SavedAddressResponse, SavedAddressUpdateInput, SavedPaymentMethod, SiteDocument, StartGivingInput, StartGivingResponse, PaymentMethodConfirmInput, PaymentMethodMutationResponse, PaymentMethodSetupInput, PaymentMethodSetupResult, SubscriptionAgreementResponse, SubscriptionInvoiceListResponse, SubscriptionInvoiceResponse, SubscriptionListResponse, SubscriptionSourceResponse, ThemeResponse, UpdateCartItemInput } from "./types.js";
5
+ import type { CatalogBrand, CatalogCategory, CatalogCollection, CatalogProductsResponse, BlogPostResponse, DiningMenu, DashDirectoryEntry, DashDirectoryProfileResponse, DashDirectoryRegion, DashInitResponse, DashLead, DashPlansResponse, DashProfileResponse, GivingEntry, SubscriptionPlanListResponse, SubscriptionPlanResponse, GivingIntentListResponse, AddCartItemInput, CartResponse, CheckoutAddressesInput, CheckoutCustomerInput, CheckoutFulfillmentInput, CheckoutOptions, CheckoutPayInput, CheckoutPayResponse, CheckoutStatusResponse, ChannelPing, CustomerResponse, CustomerAuthSession, CustomerSecurityActivityPage, ChannelGeo, CustomerSession, CustomerSignupResponse, LeadResponse, LightInitResponse, ListResponse, Order, OrderSummary, MergeCartInput, SendCodeResponse, Product, ProductAsset, PrintIntakeInput, PrintJob, PrintOptionsSelection, PrintQuoteResponse, PrintSettingsResponse, PublicPage, PublicPageSummary, PublicSubmitReviewInput, PublicWorkspaceInit, MenuResponse, Review, ReviewSummaryResponse, SavedAddress, SavedAddressDefaultKind, SavedAddressInput, SavedAddressResponse, SavedAddressUpdateInput, SavedPaymentMethod, SiteDocument, StartGivingInput, StartGivingResponse, PaymentMethodConfirmInput, PaymentMethodMutationResponse, PaymentMethodSetupInput, PaymentMethodSetupResult, SubscriptionAgreementResponse, SubscriptionInvoiceListResponse, SubscriptionInvoiceResponse, SubscriptionListResponse, SubscriptionSourceResponse, ThemeResponse, UpdateCartItemInput } from "./types.js";
6
6
  export declare const DEFAULT_CHANNEL_API_URL = "https://api.saasdash.app";
7
7
  export interface ChannelRetryPolicy {
8
8
  attempts?: number;
@@ -39,7 +39,7 @@ export interface ChannelVisitor {
39
39
  userAgent?: string;
40
40
  }
41
41
  export type ChannelRequestOutcome = "success" | "api_error" | "network_error" | "timeout" | "invalid_response" | "cancelled";
42
- export type ChannelOperation = "channel.ping" | "channel.geo.detect" | "channel.site.resolve" | "channel.init.get" | "channel.init.light" | "content.pages.public.list.channel" | "content.pages.public.get.channel" | "shop.public.products.list.channel" | "shop.public.products.get.channel" | "shop.public.products.media.channel" | "reviews.public.list.channel" | "reviews.public.summary.channel" | "reviews.public.submit.channel" | "channel.theme.get" | "channel.menus.get" | "channel.blog.get" | "channel.blog.list" | "channel.giving.entries.list" | "channel.giving.entries.get" | "channel.giving.start" | "channel.print.settings" | "channel.print.quote" | "channel.print.intake" | "dining.public.board_menu.channel" | "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.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.dash.profile" | "channel.dash.init" | "channel.dash.plans" | "channel.dash.directory.regions" | "channel.dash.directory.browse" | "channel.dash.directory.get" | "channel.dash.leads.capture" | "growth.public_workspace.leads.capture.channel";
42
+ export type ChannelOperation = "channel.ping" | "channel.geo.detect" | "channel.site.resolve" | "channel.init.get" | "channel.init.light" | "content.pages.public.list.channel" | "content.pages.public.get.channel" | "shop.public.products.list.channel" | "shop.public.products.get.channel" | "shop.public.products.media.channel" | "reviews.public.list.channel" | "reviews.public.summary.channel" | "reviews.public.submit.channel" | "channel.theme.get" | "channel.menus.get" | "channel.blog.get" | "channel.blog.list" | "channel.giving.entries.list" | "channel.giving.entries.get" | "channel.giving.start" | "channel.subscriptions.plans.list" | "channel.subscriptions.plans.get" | "channel.print.settings" | "channel.print.quote" | "channel.print.intake" | "dining.public.board_menu.channel" | "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.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.dash.profile" | "channel.dash.init" | "channel.dash.plans" | "channel.dash.directory.regions" | "channel.dash.directory.browse" | "channel.dash.directory.get" | "channel.dash.leads.capture" | "growth.public_workspace.leads.capture.channel";
43
43
  export interface ChannelRequestObservation {
44
44
  operation: ChannelOperation;
45
45
  method: string;
@@ -211,6 +211,12 @@ export declare function createChannelClient(options: CreateChannelClientOptions)
211
211
  };
212
212
  readonly start: (input: StartGivingInput, mutation?: ChannelMutationOptions) => Promise<StartGivingResponse>;
213
213
  };
214
+ readonly subscriptions: {
215
+ readonly plans: {
216
+ readonly list: () => Promise<SubscriptionPlanListResponse>;
217
+ readonly get: (planId: string) => Promise<SubscriptionPlanResponse>;
218
+ };
219
+ };
214
220
  readonly print: {
215
221
  readonly settings: () => Promise<PrintSettingsResponse>;
216
222
  readonly quote: (input: PrintOptionsSelection, mutation?: ChannelMutationOptions) => Promise<PrintQuoteResponse>;
package/dist/index.js CHANGED
@@ -356,6 +356,14 @@ export function createChannelClient(options) {
356
356
  method: "POST", headers: mutationHeaders(mutation), body: JSON.stringify(input),
357
357
  }),
358
358
  },
359
+ subscriptions: {
360
+ // Plan catalogue for rendering a membership picker. Managing an agreement
361
+ // a customer already holds lives under withCustomer(...).subscriptions.
362
+ plans: {
363
+ list: () => request("channel.subscriptions.plans.list", "/subscriptions/plans"),
364
+ get: (planId) => request("channel.subscriptions.plans.get", `/subscriptions/plans/${encodePath(planId)}`),
365
+ },
366
+ },
359
367
  print: {
360
368
  settings: () => request("channel.print.settings", "/print/settings"),
361
369
  quote: (input, mutation) => request("channel.print.quote", "/print/quote", {
@@ -0,0 +1,12 @@
1
+ import type { MovingAddress } from "./quote-model";
2
+ interface ManualMovingAddressFields {
3
+ line1: string;
4
+ line2: string;
5
+ city: string;
6
+ postcode: string;
7
+ }
8
+ export declare function readConfirmedAddressLine(address: MovingAddress): string;
9
+ export declare function readConfirmedAddressMeta(address: MovingAddress): string;
10
+ export declare function readManualInitialAddress(address: MovingAddress | null, fallbackRaw: string): ManualMovingAddressFields;
11
+ export declare function buildManualMovingAddress(fields: ManualMovingAddressFields): MovingAddress;
12
+ export {};
@@ -0,0 +1,43 @@
1
+ const UK_POSTCODE_RE = /^[a-z]{1,2}\d[a-z\d]?\s*\d[a-z]{2}$/i;
2
+ export function readConfirmedAddressLine(address) {
3
+ return address.normalized?.address_line1 || address.address?.line_1 || address.display;
4
+ }
5
+ export function readConfirmedAddressMeta(address) {
6
+ return [
7
+ address.normalized?.address_line2 || address.address?.line_2,
8
+ address.normalized?.city || address.address?.post_town,
9
+ address.normalized?.postal_code || address.address?.postcode,
10
+ ].filter(Boolean).join(", ");
11
+ }
12
+ export function readManualInitialAddress(address, fallbackRaw) {
13
+ const raw = address?.rawQuery || fallbackRaw;
14
+ const rawLooksLikePostcode = UK_POSTCODE_RE.test(raw.trim());
15
+ return {
16
+ line1: address?.normalized?.address_line1 || address?.address?.line_1 || (rawLooksLikePostcode ? "" : raw),
17
+ line2: address?.normalized?.address_line2 || [address?.address?.line_2, address?.address?.line_3].filter(Boolean).join(", "),
18
+ city: address?.normalized?.city || address?.address?.post_town || "",
19
+ postcode: address?.normalized?.postal_code || address?.address?.postcode || (rawLooksLikePostcode ? raw.toUpperCase() : ""),
20
+ };
21
+ }
22
+ export function buildManualMovingAddress(fields) {
23
+ const line1 = fields.line1.trim();
24
+ const line2 = fields.line2.trim();
25
+ const city = fields.city.trim();
26
+ const postcode = fields.postcode.trim();
27
+ const display = [line1, line2, city, postcode]
28
+ .filter(Boolean)
29
+ .join(", ");
30
+ return {
31
+ display,
32
+ rawQuery: display,
33
+ address: null,
34
+ normalized: {
35
+ address_line1: line1,
36
+ address_line2: line2,
37
+ city,
38
+ state_region: "",
39
+ postal_code: postcode,
40
+ country_code: "GB",
41
+ },
42
+ };
43
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Address shapes from the platform's address-lookup response.
3
+ *
4
+ * These are copied here deliberately rather than imported. The saas monorepo
5
+ * declares them across `@mml/shared-types` and `@mml/shared-ui`, and neither is
6
+ * reachable from a commissioned site -- which is the whole reason this package
7
+ * exists. A domain model should not depend on a UI package in any case.
8
+ *
9
+ * They describe a wire response, so treat them as a contract: change them only
10
+ * when the address-lookup API changes.
11
+ */
12
+ export interface LookupAddress {
13
+ postcode: string;
14
+ line_1: string;
15
+ line_2: string;
16
+ line_3: string;
17
+ post_town: string;
18
+ county: string;
19
+ country: string;
20
+ building_name: string;
21
+ building_number: string;
22
+ thoroughfare: string;
23
+ organisation_name: string;
24
+ udprn: number;
25
+ longitude: number;
26
+ latitude: number;
27
+ }
28
+ export interface AddressLookupNormalizedAddress {
29
+ address_line1: string;
30
+ address_line2: string;
31
+ city: string;
32
+ state_region: string;
33
+ postal_code: string;
34
+ country_code: string;
35
+ latitude?: number;
36
+ longitude?: number;
37
+ udprn?: number;
38
+ }
39
+ export interface AddressLookupRegionSuggestion {
40
+ major_region_code: string;
41
+ major_region_label: string;
42
+ confidence: number;
43
+ match_source: string;
44
+ }
45
+ /**
46
+ * What an address picker hands back when someone selects a suggestion. The
47
+ * saas monorepo calls this `AddressAutocompleteResult` and ties it to a React
48
+ * component; the shape is the part that matters to the domain model.
49
+ */
50
+ export interface AddressSelection {
51
+ display: string;
52
+ address: LookupAddress | null;
53
+ normalized?: AddressLookupNormalizedAddress;
54
+ directory_region?: AddressLookupRegionSuggestion | null;
55
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Address shapes from the platform's address-lookup response.
3
+ *
4
+ * These are copied here deliberately rather than imported. The saas monorepo
5
+ * declares them across `@mml/shared-types` and `@mml/shared-ui`, and neither is
6
+ * reachable from a commissioned site -- which is the whole reason this package
7
+ * exists. A domain model should not depend on a UI package in any case.
8
+ *
9
+ * They describe a wire response, so treat them as a contract: change them only
10
+ * when the address-lookup API changes.
11
+ */
12
+ export {};
@@ -0,0 +1,3 @@
1
+ export type { AddressLookupNormalizedAddress, AddressLookupRegionSuggestion, AddressSelection, LookupAddress, } from "./address-types";
2
+ export * from "./address-model";
3
+ export * from "./quote-model";
@@ -0,0 +1,2 @@
1
+ export * from "./address-model";
2
+ export * from "./quote-model";
@@ -0,0 +1,348 @@
1
+ import type { AddressSelection } from "./address-types";
2
+ import { z } from "zod";
3
+ export type ContactPreference = "email" | "phone" | "any";
4
+ export type TimePreference = "morning" | "afternoon" | "evening" | "any";
5
+ export type MovingAddress = AddressSelection & {
6
+ rawQuery?: string;
7
+ };
8
+ export interface DistanceResult {
9
+ distanceMiles: number;
10
+ durationMinutes: number;
11
+ }
12
+ export declare function readAddressDisplay(address: MovingAddress | null, fallback: string): string;
13
+ export declare function hasStructuredMovingAddress(address: MovingAddress | null): boolean;
14
+ export declare function hasCoordinates(address: MovingAddress | null): address is MovingAddress & {
15
+ address: NonNullable<MovingAddress["address"]> & {
16
+ latitude: number;
17
+ longitude: number;
18
+ };
19
+ };
20
+ export declare function formatDuration(minutes: number): string;
21
+ export interface MovingLeadPayloadInput {
22
+ brand: string;
23
+ source: string;
24
+ name: string;
25
+ email: string;
26
+ phone: string;
27
+ preferredContact: ContactPreference;
28
+ preferredTime: TimePreference;
29
+ additionalNotes: string;
30
+ fromAddress: MovingAddress | null;
31
+ fromRaw: string;
32
+ toAddress: MovingAddress | null;
33
+ toRaw: string;
34
+ moveDate: string;
35
+ flexibleDate: boolean;
36
+ propertySize: string;
37
+ floorFrom: string;
38
+ floorTo: string;
39
+ hasLiftFrom: boolean;
40
+ hasLiftTo: boolean;
41
+ packingRequired: boolean;
42
+ storageRequired: boolean;
43
+ dismantlingRequired: boolean;
44
+ specialItems: string;
45
+ distance: DistanceResult | null;
46
+ }
47
+ export declare const movingLeadPayloadSchema: z.ZodObject<{
48
+ lead_type: z.ZodLiteral<"moving">;
49
+ brand: z.ZodString;
50
+ source: z.ZodString;
51
+ intent: z.ZodLiteral<"moving_quote">;
52
+ name: z.ZodString;
53
+ email: z.ZodString;
54
+ phone: z.ZodString;
55
+ preferred_contact: z.ZodEnum<{
56
+ email: "email";
57
+ phone: "phone";
58
+ any: "any";
59
+ }>;
60
+ preferred_time: z.ZodEnum<{
61
+ any: "any";
62
+ morning: "morning";
63
+ afternoon: "afternoon";
64
+ evening: "evening";
65
+ }>;
66
+ message: z.ZodString;
67
+ meta: z.ZodObject<{
68
+ from_address: z.ZodString;
69
+ to_address: z.ZodString;
70
+ from_postcode: z.ZodNullable<z.ZodString>;
71
+ to_postcode: z.ZodNullable<z.ZodString>;
72
+ move_date: z.ZodString;
73
+ flexible_date: z.ZodBoolean;
74
+ property_size: z.ZodString;
75
+ floor_from: z.ZodNumber;
76
+ floor_to: z.ZodNumber;
77
+ has_lift_from: z.ZodBoolean;
78
+ has_lift_to: z.ZodBoolean;
79
+ packing_required: z.ZodBoolean;
80
+ storage_required: z.ZodBoolean;
81
+ dismantling_required: z.ZodBoolean;
82
+ special_items: z.ZodArray<z.ZodString>;
83
+ additional_notes: z.ZodString;
84
+ distance_miles: z.ZodNullable<z.ZodNumber>;
85
+ duration_minutes: z.ZodNullable<z.ZodNumber>;
86
+ pickup_region: z.ZodNullable<z.ZodString>;
87
+ delivery_region: z.ZodNullable<z.ZodString>;
88
+ pickup_location: z.ZodObject<{
89
+ display: z.ZodString;
90
+ raw_query: z.ZodNullable<z.ZodString>;
91
+ postcode: z.ZodNullable<z.ZodString>;
92
+ latitude: z.ZodNullable<z.ZodNumber>;
93
+ longitude: z.ZodNullable<z.ZodNumber>;
94
+ udprn: z.ZodNullable<z.ZodNumber>;
95
+ normalized: z.ZodNullable<z.ZodObject<{
96
+ address_line1: z.ZodString;
97
+ address_line2: z.ZodString;
98
+ city: z.ZodString;
99
+ state_region: z.ZodString;
100
+ postal_code: z.ZodString;
101
+ country_code: z.ZodString;
102
+ latitude: z.ZodNullable<z.ZodNumber>;
103
+ longitude: z.ZodNullable<z.ZodNumber>;
104
+ udprn: z.ZodNullable<z.ZodNumber>;
105
+ }, z.core.$strip>>;
106
+ directory_region: z.ZodNullable<z.ZodObject<{
107
+ major_region_code: z.ZodString;
108
+ major_region_label: z.ZodString;
109
+ confidence: z.ZodNumber;
110
+ match_source: z.ZodString;
111
+ }, z.core.$strip>>;
112
+ }, z.core.$strip>;
113
+ delivery_location: z.ZodObject<{
114
+ display: z.ZodString;
115
+ raw_query: z.ZodNullable<z.ZodString>;
116
+ postcode: z.ZodNullable<z.ZodString>;
117
+ latitude: z.ZodNullable<z.ZodNumber>;
118
+ longitude: z.ZodNullable<z.ZodNumber>;
119
+ udprn: z.ZodNullable<z.ZodNumber>;
120
+ normalized: z.ZodNullable<z.ZodObject<{
121
+ address_line1: z.ZodString;
122
+ address_line2: z.ZodString;
123
+ city: z.ZodString;
124
+ state_region: z.ZodString;
125
+ postal_code: z.ZodString;
126
+ country_code: z.ZodString;
127
+ latitude: z.ZodNullable<z.ZodNumber>;
128
+ longitude: z.ZodNullable<z.ZodNumber>;
129
+ udprn: z.ZodNullable<z.ZodNumber>;
130
+ }, z.core.$strip>>;
131
+ directory_region: z.ZodNullable<z.ZodObject<{
132
+ major_region_code: z.ZodString;
133
+ major_region_label: z.ZodString;
134
+ confidence: z.ZodNumber;
135
+ match_source: z.ZodString;
136
+ }, z.core.$strip>>;
137
+ }, z.core.$strip>;
138
+ }, z.core.$strip>;
139
+ }, z.core.$strip>;
140
+ export declare const movingBrokerCapturePayloadSchema: z.ZodObject<{
141
+ source_type: z.ZodLiteral<"web">;
142
+ name: z.ZodString;
143
+ email: z.ZodString;
144
+ phone: z.ZodString;
145
+ message: z.ZodString;
146
+ region: z.ZodString;
147
+ tags: z.ZodArray<z.ZodString>;
148
+ meta: z.ZodObject<{
149
+ lead_type: z.ZodLiteral<"moving">;
150
+ brand: z.ZodString;
151
+ source: z.ZodString;
152
+ intent: z.ZodLiteral<"moving_quote">;
153
+ name: z.ZodString;
154
+ email: z.ZodString;
155
+ phone: z.ZodString;
156
+ preferred_contact: z.ZodEnum<{
157
+ email: "email";
158
+ phone: "phone";
159
+ any: "any";
160
+ }>;
161
+ preferred_time: z.ZodEnum<{
162
+ any: "any";
163
+ morning: "morning";
164
+ afternoon: "afternoon";
165
+ evening: "evening";
166
+ }>;
167
+ message: z.ZodString;
168
+ meta: z.ZodObject<{
169
+ from_address: z.ZodString;
170
+ to_address: z.ZodString;
171
+ from_postcode: z.ZodNullable<z.ZodString>;
172
+ to_postcode: z.ZodNullable<z.ZodString>;
173
+ move_date: z.ZodString;
174
+ flexible_date: z.ZodBoolean;
175
+ property_size: z.ZodString;
176
+ floor_from: z.ZodNumber;
177
+ floor_to: z.ZodNumber;
178
+ has_lift_from: z.ZodBoolean;
179
+ has_lift_to: z.ZodBoolean;
180
+ packing_required: z.ZodBoolean;
181
+ storage_required: z.ZodBoolean;
182
+ dismantling_required: z.ZodBoolean;
183
+ special_items: z.ZodArray<z.ZodString>;
184
+ additional_notes: z.ZodString;
185
+ distance_miles: z.ZodNullable<z.ZodNumber>;
186
+ duration_minutes: z.ZodNullable<z.ZodNumber>;
187
+ pickup_region: z.ZodNullable<z.ZodString>;
188
+ delivery_region: z.ZodNullable<z.ZodString>;
189
+ pickup_location: z.ZodObject<{
190
+ display: z.ZodString;
191
+ raw_query: z.ZodNullable<z.ZodString>;
192
+ postcode: z.ZodNullable<z.ZodString>;
193
+ latitude: z.ZodNullable<z.ZodNumber>;
194
+ longitude: z.ZodNullable<z.ZodNumber>;
195
+ udprn: z.ZodNullable<z.ZodNumber>;
196
+ normalized: z.ZodNullable<z.ZodObject<{
197
+ address_line1: z.ZodString;
198
+ address_line2: z.ZodString;
199
+ city: z.ZodString;
200
+ state_region: z.ZodString;
201
+ postal_code: z.ZodString;
202
+ country_code: z.ZodString;
203
+ latitude: z.ZodNullable<z.ZodNumber>;
204
+ longitude: z.ZodNullable<z.ZodNumber>;
205
+ udprn: z.ZodNullable<z.ZodNumber>;
206
+ }, z.core.$strip>>;
207
+ directory_region: z.ZodNullable<z.ZodObject<{
208
+ major_region_code: z.ZodString;
209
+ major_region_label: z.ZodString;
210
+ confidence: z.ZodNumber;
211
+ match_source: z.ZodString;
212
+ }, z.core.$strip>>;
213
+ }, z.core.$strip>;
214
+ delivery_location: z.ZodObject<{
215
+ display: z.ZodString;
216
+ raw_query: z.ZodNullable<z.ZodString>;
217
+ postcode: z.ZodNullable<z.ZodString>;
218
+ latitude: z.ZodNullable<z.ZodNumber>;
219
+ longitude: z.ZodNullable<z.ZodNumber>;
220
+ udprn: z.ZodNullable<z.ZodNumber>;
221
+ normalized: z.ZodNullable<z.ZodObject<{
222
+ address_line1: z.ZodString;
223
+ address_line2: z.ZodString;
224
+ city: z.ZodString;
225
+ state_region: z.ZodString;
226
+ postal_code: z.ZodString;
227
+ country_code: z.ZodString;
228
+ latitude: z.ZodNullable<z.ZodNumber>;
229
+ longitude: z.ZodNullable<z.ZodNumber>;
230
+ udprn: z.ZodNullable<z.ZodNumber>;
231
+ }, z.core.$strip>>;
232
+ directory_region: z.ZodNullable<z.ZodObject<{
233
+ major_region_code: z.ZodString;
234
+ major_region_label: z.ZodString;
235
+ confidence: z.ZodNumber;
236
+ match_source: z.ZodString;
237
+ }, z.core.$strip>>;
238
+ }, z.core.$strip>;
239
+ }, z.core.$strip>;
240
+ }, z.core.$strip>;
241
+ }, z.core.$strip>;
242
+ export declare const movingLeadSubmissionSchema: z.ZodObject<{
243
+ lead_type: z.ZodLiteral<"moving">;
244
+ brand: z.ZodString;
245
+ source: z.ZodString;
246
+ intent: z.ZodLiteral<"moving_quote">;
247
+ name: z.ZodString;
248
+ email: z.ZodString;
249
+ phone: z.ZodString;
250
+ preferred_contact: z.ZodEnum<{
251
+ email: "email";
252
+ phone: "phone";
253
+ any: "any";
254
+ }>;
255
+ preferred_time: z.ZodEnum<{
256
+ any: "any";
257
+ morning: "morning";
258
+ afternoon: "afternoon";
259
+ evening: "evening";
260
+ }>;
261
+ message: z.ZodString;
262
+ meta: z.ZodObject<{
263
+ from_address: z.ZodString;
264
+ to_address: z.ZodString;
265
+ from_postcode: z.ZodNullable<z.ZodString>;
266
+ to_postcode: z.ZodNullable<z.ZodString>;
267
+ move_date: z.ZodString;
268
+ flexible_date: z.ZodBoolean;
269
+ property_size: z.ZodString;
270
+ floor_from: z.ZodNumber;
271
+ floor_to: z.ZodNumber;
272
+ has_lift_from: z.ZodBoolean;
273
+ has_lift_to: z.ZodBoolean;
274
+ packing_required: z.ZodBoolean;
275
+ storage_required: z.ZodBoolean;
276
+ dismantling_required: z.ZodBoolean;
277
+ special_items: z.ZodArray<z.ZodString>;
278
+ additional_notes: z.ZodString;
279
+ distance_miles: z.ZodNullable<z.ZodNumber>;
280
+ duration_minutes: z.ZodNullable<z.ZodNumber>;
281
+ pickup_region: z.ZodNullable<z.ZodString>;
282
+ delivery_region: z.ZodNullable<z.ZodString>;
283
+ pickup_location: z.ZodObject<{
284
+ display: z.ZodString;
285
+ raw_query: z.ZodNullable<z.ZodString>;
286
+ postcode: z.ZodNullable<z.ZodString>;
287
+ latitude: z.ZodNullable<z.ZodNumber>;
288
+ longitude: z.ZodNullable<z.ZodNumber>;
289
+ udprn: z.ZodNullable<z.ZodNumber>;
290
+ normalized: z.ZodNullable<z.ZodObject<{
291
+ address_line1: z.ZodString;
292
+ address_line2: z.ZodString;
293
+ city: z.ZodString;
294
+ state_region: z.ZodString;
295
+ postal_code: z.ZodString;
296
+ country_code: z.ZodString;
297
+ latitude: z.ZodNullable<z.ZodNumber>;
298
+ longitude: z.ZodNullable<z.ZodNumber>;
299
+ udprn: z.ZodNullable<z.ZodNumber>;
300
+ }, z.core.$strip>>;
301
+ directory_region: z.ZodNullable<z.ZodObject<{
302
+ major_region_code: z.ZodString;
303
+ major_region_label: z.ZodString;
304
+ confidence: z.ZodNumber;
305
+ match_source: z.ZodString;
306
+ }, z.core.$strip>>;
307
+ }, z.core.$strip>;
308
+ delivery_location: z.ZodObject<{
309
+ display: z.ZodString;
310
+ raw_query: z.ZodNullable<z.ZodString>;
311
+ postcode: z.ZodNullable<z.ZodString>;
312
+ latitude: z.ZodNullable<z.ZodNumber>;
313
+ longitude: z.ZodNullable<z.ZodNumber>;
314
+ udprn: z.ZodNullable<z.ZodNumber>;
315
+ normalized: z.ZodNullable<z.ZodObject<{
316
+ address_line1: z.ZodString;
317
+ address_line2: z.ZodString;
318
+ city: z.ZodString;
319
+ state_region: z.ZodString;
320
+ postal_code: z.ZodString;
321
+ country_code: z.ZodString;
322
+ latitude: z.ZodNullable<z.ZodNumber>;
323
+ longitude: z.ZodNullable<z.ZodNumber>;
324
+ udprn: z.ZodNullable<z.ZodNumber>;
325
+ }, z.core.$strip>>;
326
+ directory_region: z.ZodNullable<z.ZodObject<{
327
+ major_region_code: z.ZodString;
328
+ major_region_label: z.ZodString;
329
+ confidence: z.ZodNumber;
330
+ match_source: z.ZodString;
331
+ }, z.core.$strip>>;
332
+ }, z.core.$strip>;
333
+ }, z.core.$strip>;
334
+ }, z.core.$strip>;
335
+ export type MovingLeadPayload = z.infer<typeof movingLeadPayloadSchema>;
336
+ export type MovingBrokerCapturePayload = z.infer<typeof movingBrokerCapturePayloadSchema>;
337
+ export declare function buildMovingLeadPayload(input: MovingLeadPayloadInput): MovingLeadPayload;
338
+ export declare function buildMovingBrokerCapturePayload(payload: MovingLeadPayload): MovingBrokerCapturePayload;
339
+ export declare function readQuoteSubmitError(response: Response): Promise<string>;
340
+ export interface MovingLeadReadinessContext {
341
+ fromAddress?: MovingAddress | null;
342
+ toAddress?: MovingAddress | null;
343
+ }
344
+ export declare function isMovingLeadReady(payload: MovingLeadPayload, context?: MovingLeadReadinessContext): boolean;
345
+ export declare function getMovingLeadValidationItems(payload: MovingLeadPayload, context?: MovingLeadReadinessContext): {
346
+ label: string;
347
+ valid: boolean;
348
+ }[];
@@ -0,0 +1,267 @@
1
+ import { z } from "zod";
2
+ export function readAddressDisplay(address, fallback) {
3
+ return address?.display || address?.rawQuery || fallback;
4
+ }
5
+ export function hasStructuredMovingAddress(address) {
6
+ const line1 = address?.normalized?.address_line1 || address?.address?.line_1 || "";
7
+ const city = address?.normalized?.city || address?.address?.post_town || "";
8
+ return line1.trim().length > 0 && city.trim().length > 0;
9
+ }
10
+ export function hasCoordinates(address) {
11
+ return Boolean(address?.address &&
12
+ typeof address.address.latitude === "number" &&
13
+ typeof address.address.longitude === "number");
14
+ }
15
+ export function formatDuration(minutes) {
16
+ if (minutes < 60)
17
+ return `${minutes} min`;
18
+ const hours = Math.floor(minutes / 60);
19
+ const remainder = minutes % 60;
20
+ return remainder ? `${hours} hr ${remainder} min` : `${hours} hr`;
21
+ }
22
+ const optionalNullableString = z.string().nullable();
23
+ const contactPreferenceSchema = z.enum(["email", "phone", "any"]);
24
+ const timePreferenceSchema = z.enum(["morning", "afternoon", "evening", "any"]);
25
+ const movingAddressLocationSchema = z.object({
26
+ display: z.string(),
27
+ raw_query: optionalNullableString,
28
+ postcode: optionalNullableString,
29
+ latitude: z.number().nullable(),
30
+ longitude: z.number().nullable(),
31
+ udprn: z.number().nullable(),
32
+ normalized: z.object({
33
+ address_line1: z.string(),
34
+ address_line2: z.string(),
35
+ city: z.string(),
36
+ state_region: z.string(),
37
+ postal_code: z.string(),
38
+ country_code: z.string(),
39
+ latitude: z.number().nullable(),
40
+ longitude: z.number().nullable(),
41
+ udprn: z.number().nullable(),
42
+ }).nullable(),
43
+ directory_region: z.object({
44
+ major_region_code: z.string(),
45
+ major_region_label: z.string(),
46
+ confidence: z.number(),
47
+ match_source: z.string(),
48
+ }).nullable(),
49
+ });
50
+ export const movingLeadPayloadSchema = z.object({
51
+ lead_type: z.literal("moving"),
52
+ brand: z.string().min(1),
53
+ source: z.string().min(1),
54
+ intent: z.literal("moving_quote"),
55
+ name: z.string(),
56
+ email: z.string(),
57
+ phone: z.string(),
58
+ preferred_contact: contactPreferenceSchema,
59
+ preferred_time: timePreferenceSchema,
60
+ message: z.string(),
61
+ meta: z.object({
62
+ from_address: z.string(),
63
+ to_address: z.string(),
64
+ from_postcode: optionalNullableString,
65
+ to_postcode: optionalNullableString,
66
+ move_date: z.string(),
67
+ flexible_date: z.boolean(),
68
+ property_size: z.string().min(1),
69
+ floor_from: z.number().int().min(0),
70
+ floor_to: z.number().int().min(0),
71
+ has_lift_from: z.boolean(),
72
+ has_lift_to: z.boolean(),
73
+ packing_required: z.boolean(),
74
+ storage_required: z.boolean(),
75
+ dismantling_required: z.boolean(),
76
+ special_items: z.array(z.string()),
77
+ additional_notes: z.string(),
78
+ distance_miles: z.number().nullable(),
79
+ duration_minutes: z.number().nullable(),
80
+ pickup_region: optionalNullableString,
81
+ delivery_region: optionalNullableString,
82
+ pickup_location: movingAddressLocationSchema,
83
+ delivery_location: movingAddressLocationSchema,
84
+ }),
85
+ });
86
+ export const movingBrokerCapturePayloadSchema = z.object({
87
+ source_type: z.literal("web"),
88
+ name: z.string(),
89
+ email: z.string(),
90
+ phone: z.string(),
91
+ message: z.string(),
92
+ region: z.string(),
93
+ tags: z.array(z.string()).min(1),
94
+ meta: movingLeadPayloadSchema,
95
+ });
96
+ export const movingLeadSubmissionSchema = movingLeadPayloadSchema.superRefine((payload, ctx) => {
97
+ if (!payload.meta.from_address.trim()) {
98
+ ctx.addIssue({ code: "custom", path: ["meta", "from_address"], message: "Pickup address is required." });
99
+ }
100
+ if (!payload.meta.to_address.trim()) {
101
+ ctx.addIssue({ code: "custom", path: ["meta", "to_address"], message: "Delivery address is required." });
102
+ }
103
+ if (!payload.name.trim()) {
104
+ ctx.addIssue({ code: "custom", path: ["name"], message: "Name is required." });
105
+ }
106
+ if (!payload.email.trim() && !payload.phone.trim()) {
107
+ ctx.addIssue({ code: "custom", path: ["email"], message: "Email or phone is required." });
108
+ }
109
+ if (payload.email.trim() && !z.email().safeParse(payload.email).success) {
110
+ ctx.addIssue({ code: "custom", path: ["email"], message: "Email must be valid." });
111
+ }
112
+ });
113
+ function readAddressPostcode(address) {
114
+ return address?.normalized?.postal_code || address?.address?.postcode || null;
115
+ }
116
+ function readAddressLatitude(address) {
117
+ return address?.normalized?.latitude ?? address?.address?.latitude ?? null;
118
+ }
119
+ function readAddressLongitude(address) {
120
+ return address?.normalized?.longitude ?? address?.address?.longitude ?? null;
121
+ }
122
+ function readAddressUdprn(address) {
123
+ return address?.normalized?.udprn ?? address?.address?.udprn ?? null;
124
+ }
125
+ function buildAddressLocation(address, fallback) {
126
+ const normalized = address?.normalized;
127
+ return {
128
+ display: readAddressDisplay(address, fallback),
129
+ raw_query: address?.rawQuery || fallback || null,
130
+ postcode: readAddressPostcode(address),
131
+ latitude: readAddressLatitude(address),
132
+ longitude: readAddressLongitude(address),
133
+ udprn: readAddressUdprn(address),
134
+ normalized: normalized
135
+ ? {
136
+ address_line1: normalized.address_line1,
137
+ address_line2: normalized.address_line2,
138
+ city: normalized.city,
139
+ state_region: normalized.state_region,
140
+ postal_code: normalized.postal_code,
141
+ country_code: normalized.country_code,
142
+ latitude: normalized.latitude ?? null,
143
+ longitude: normalized.longitude ?? null,
144
+ udprn: normalized.udprn ?? null,
145
+ }
146
+ : null,
147
+ directory_region: address?.directory_region ?? null,
148
+ };
149
+ }
150
+ export function buildMovingLeadPayload(input) {
151
+ const from = readAddressDisplay(input.fromAddress, input.fromRaw);
152
+ const to = readAddressDisplay(input.toAddress, input.toRaw);
153
+ return movingLeadPayloadSchema.parse({
154
+ lead_type: "moving",
155
+ brand: input.brand,
156
+ source: input.source,
157
+ intent: "moving_quote",
158
+ name: input.name,
159
+ email: input.email,
160
+ phone: input.phone,
161
+ preferred_contact: input.preferredContact,
162
+ preferred_time: input.preferredTime,
163
+ message: input.additionalNotes || `Moving request from ${from || "pickup"} to ${to || "delivery"}.`,
164
+ meta: {
165
+ from_address: from,
166
+ to_address: to,
167
+ from_postcode: input.fromAddress?.normalized?.postal_code ?? null,
168
+ to_postcode: input.toAddress?.normalized?.postal_code ?? null,
169
+ move_date: input.moveDate,
170
+ flexible_date: input.flexibleDate,
171
+ property_size: input.propertySize,
172
+ floor_from: Number(input.floorFrom),
173
+ floor_to: Number(input.floorTo),
174
+ has_lift_from: input.hasLiftFrom,
175
+ has_lift_to: input.hasLiftTo,
176
+ packing_required: input.packingRequired,
177
+ storage_required: input.storageRequired,
178
+ dismantling_required: input.dismantlingRequired,
179
+ special_items: input.specialItems
180
+ .split(",")
181
+ .map((item) => item.trim())
182
+ .filter(Boolean),
183
+ additional_notes: input.additionalNotes,
184
+ distance_miles: input.distance?.distanceMiles ?? null,
185
+ duration_minutes: input.distance?.durationMinutes ?? null,
186
+ pickup_region: input.fromAddress?.directory_region?.major_region_code ?? null,
187
+ delivery_region: input.toAddress?.directory_region?.major_region_code ?? null,
188
+ pickup_location: buildAddressLocation(input.fromAddress, input.fromRaw),
189
+ delivery_location: buildAddressLocation(input.toAddress, input.toRaw),
190
+ },
191
+ });
192
+ }
193
+ export function buildMovingBrokerCapturePayload(payload) {
194
+ const region = payload.meta.pickup_region || payload.meta.from_postcode || payload.meta.pickup_location.postcode || "";
195
+ return movingBrokerCapturePayloadSchema.parse({
196
+ source_type: "web",
197
+ name: payload.name,
198
+ email: payload.email,
199
+ phone: payload.phone,
200
+ message: payload.message,
201
+ region,
202
+ tags: ["moving", "direct", "main_site", payload.brand],
203
+ meta: payload,
204
+ });
205
+ }
206
+ // readQuoteSubmitError surfaces a human-readable reason from a failed /api/leads
207
+ // response. The lead route returns friendly `message` fields for its own
208
+ // rejections (cross-origin, app-not-available, contact-required, …); terse
209
+ // pass-through backend codes (e.g. "invalid input") fall back to a status-based
210
+ // message so the user is never shown a raw internal string.
211
+ export async function readQuoteSubmitError(response) {
212
+ const fallback = response.status >= 500
213
+ ? "Something went wrong on our end. Please try again shortly."
214
+ : "We could not submit this request. Please check the details and try again.";
215
+ try {
216
+ const body = (await response.json());
217
+ const message = typeof body.message === "string" ? body.message.trim() : "";
218
+ if (message && message.toLowerCase() !== "invalid input") {
219
+ return message;
220
+ }
221
+ }
222
+ catch {
223
+ // Non-JSON or empty body — use the status-based fallback.
224
+ }
225
+ return fallback;
226
+ }
227
+ export function isMovingLeadReady(payload, context = {}) {
228
+ if (!movingLeadSubmissionSchema.safeParse(payload).success)
229
+ return false;
230
+ if ("fromAddress" in context && !hasStructuredMovingAddress(context.fromAddress ?? null))
231
+ return false;
232
+ if ("toAddress" in context && !hasStructuredMovingAddress(context.toAddress ?? null))
233
+ return false;
234
+ return true;
235
+ }
236
+ export function getMovingLeadValidationItems(payload, context = {}) {
237
+ const result = movingLeadSubmissionSchema.safeParse(payload);
238
+ const issuePaths = new Set(result.success ? [] : result.error.issues.map((issue) => issue.path.join(".")));
239
+ const fromAddressValid = issuePaths.has("meta.from_address")
240
+ ? false
241
+ : "fromAddress" in context
242
+ ? hasStructuredMovingAddress(context.fromAddress ?? null)
243
+ : true;
244
+ const toAddressValid = issuePaths.has("meta.to_address")
245
+ ? false
246
+ : "toAddress" in context
247
+ ? hasStructuredMovingAddress(context.toAddress ?? null)
248
+ : true;
249
+ return [
250
+ {
251
+ label: "Pickup address",
252
+ valid: fromAddressValid,
253
+ },
254
+ {
255
+ label: "Delivery address",
256
+ valid: toAddressValid,
257
+ },
258
+ {
259
+ label: "Name",
260
+ valid: !issuePaths.has("name"),
261
+ },
262
+ {
263
+ label: "Email or phone",
264
+ valid: !issuePaths.has("email"),
265
+ },
266
+ ];
267
+ }
package/dist/next.d.ts CHANGED
@@ -125,6 +125,12 @@ export declare function createNextChannelClient(options: CreateNextChannelClient
125
125
  };
126
126
  readonly start: (input: import("./types.js").StartGivingInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").StartGivingResponse>;
127
127
  };
128
+ readonly subscriptions: {
129
+ readonly plans: {
130
+ readonly list: () => Promise<import("./types.js").SubscriptionPlanListResponse>;
131
+ readonly get: (planId: string) => Promise<import("./types.js").SubscriptionPlanResponse>;
132
+ };
133
+ };
128
134
  readonly print: {
129
135
  readonly settings: () => Promise<import("./types.js").PrintSettingsResponse>;
130
136
  readonly quote: (input: import("./types.js").PrintOptionsSelection, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").PrintQuoteResponse>;
package/dist/types.d.ts CHANGED
@@ -681,7 +681,8 @@ export interface StartGivingInput {
681
681
  }
682
682
  export interface StartGivingResponse {
683
683
  giving: GivingIntent;
684
- session: {
684
+ /** Present for one-time gifts. Recurring gifts start an account agreement. */
685
+ session?: {
685
686
  session_id: string;
686
687
  url: string;
687
688
  payment_intent_id?: string;
@@ -1175,3 +1176,22 @@ export interface ChannelPing {
1175
1176
  api_version: string;
1176
1177
  attestation?: string;
1177
1178
  }
1179
+ /** A subscription plan a workspace offers. Mirrors Go PlanOffer. */
1180
+ export interface SubscriptionPlanOffer {
1181
+ id: string;
1182
+ workspace_id: string;
1183
+ title: string;
1184
+ description?: string;
1185
+ currency: string;
1186
+ amount_cents: number;
1187
+ interval: string;
1188
+ is_active: boolean;
1189
+ created_at: string;
1190
+ updated_at: string;
1191
+ }
1192
+ export interface SubscriptionPlanListResponse {
1193
+ items: SubscriptionPlanOffer[];
1194
+ }
1195
+ export interface SubscriptionPlanResponse {
1196
+ plan: SubscriptionPlanOffer;
1197
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c1m-public/channel-client",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Typed server-side client for the MML headless Channel API",
@@ -39,6 +39,10 @@
39
39
  "./dash/next": {
40
40
  "types": "./dist/dash-next.d.ts",
41
41
  "default": "./dist/dash-next.js"
42
+ },
43
+ "./moving-lead-model": {
44
+ "types": "./dist/moving-lead-model/index.d.ts",
45
+ "default": "./dist/moving-lead-model/index.js"
42
46
  }
43
47
  },
44
48
  "files": [
@@ -54,8 +58,17 @@
54
58
  "dependencies": {
55
59
  "server-only": "0.0.1"
56
60
  },
61
+ "peerDependencies": {
62
+ "zod": "^4"
63
+ },
64
+ "peerDependenciesMeta": {
65
+ "zod": {
66
+ "optional": true
67
+ }
68
+ },
57
69
  "devDependencies": {
58
70
  "typescript": "5.9.3",
71
+ "zod": "^4.3.6",
59
72
  "vitest": "^4.1.4"
60
73
  },
61
74
  "scripts": {