@c1m-public/channel-client 0.8.0 → 0.10.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 +53 -7
- package/dist/index.d.ts +74 -4
- package/dist/index.js +81 -1
- package/dist/next.d.ts +57 -0
- package/dist/types.d.ts +346 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,8 +13,9 @@ transport core.
|
|
|
13
13
|
- `@c1m-public/channel-client/webhooks` — framework-neutral webhook events and
|
|
14
14
|
signature verification.
|
|
15
15
|
|
|
16
|
-
Channel credentials resolve the tenant and
|
|
17
|
-
URLs never carry
|
|
16
|
+
Channel credentials resolve the tenant and scope at the API door (plus the
|
|
17
|
+
workspace for workspace-scoped channels), so site URLs never carry those
|
|
18
|
+
identifiers.
|
|
18
19
|
|
|
19
20
|
### Next.js
|
|
20
21
|
|
|
@@ -51,8 +52,51 @@ const channel = createChannelClient({
|
|
|
51
52
|
baseUrl: process.env.C1M_API_URL!,
|
|
52
53
|
token: process.env.C1M_CHANNEL_TOKEN!,
|
|
53
54
|
});
|
|
55
|
+
|
|
56
|
+
const category = await channel.categories.products("electric-cars");
|
|
57
|
+
|
|
58
|
+
// A dash-scoped token exposes the dash's own public site data through the
|
|
59
|
+
// same transport. Workspace-only calls return 404 for this token by design.
|
|
60
|
+
const dash = await channel.dash.init();
|
|
61
|
+
const directory = await channel.dash.directory.list({ region: "london" });
|
|
62
|
+
|
|
63
|
+
// Customer credentials are request-scoped and never stored on the shared
|
|
64
|
+
// channel client. Every account read is forced to no-store.
|
|
65
|
+
const account = channel.withCustomer(customerAccessToken);
|
|
66
|
+
const addresses = await account.addresses.list();
|
|
67
|
+
const subscriptions = await account.subscriptions.list({ status: "active" });
|
|
54
68
|
```
|
|
55
69
|
|
|
70
|
+
### Headless customer OTP
|
|
71
|
+
|
|
72
|
+
Customer OTP is available through the same end-user auth handler used by the
|
|
73
|
+
first-party workspace application. The channel token identifies the app and
|
|
74
|
+
workspace; the returned customer session must remain request-scoped.
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import { isChannelAPIError } from "@c1m-public/channel-client";
|
|
78
|
+
|
|
79
|
+
await channel.auth.sendCode("customer@example.com");
|
|
80
|
+
|
|
81
|
+
try {
|
|
82
|
+
const session = await channel.auth.verifyCode({
|
|
83
|
+
email: "customer@example.com",
|
|
84
|
+
code: submittedCode,
|
|
85
|
+
});
|
|
86
|
+
// Store tokens in secure, HTTP-only host cookies owned by your application.
|
|
87
|
+
} catch (error) {
|
|
88
|
+
if (isChannelAPIError(error)) {
|
|
89
|
+
// invalid_code (401), too_many_attempts (429), account_disabled (403)
|
|
90
|
+
// are stable recovery states. Unknown failures include requestId for support.
|
|
91
|
+
console.error("customer sign-in failed", error.code, error.requestId);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Do not call Channel API auth directly from a browser: doing so would expose the
|
|
97
|
+
channel credential. Use a server action or route handler and return only safe
|
|
98
|
+
error code, status, and request reference to the UI.
|
|
99
|
+
|
|
56
100
|
The package must only be imported from server modules. Never expose the token in
|
|
57
101
|
`NEXT_PUBLIC_*`, Client Components, browser storage, HTML, source maps, logs, or
|
|
58
102
|
asset requests. The `/next` entry point enforces Next's `server-only` boundary;
|
|
@@ -113,7 +157,6 @@ Build and inspect before publishing:
|
|
|
113
157
|
pnpm --filter @c1m-public/channel-client test:run
|
|
114
158
|
pnpm --filter @c1m-public/channel-client build
|
|
115
159
|
pnpm --filter @c1m-public/channel-client pack
|
|
116
|
-
npm publish --access public
|
|
117
160
|
```
|
|
118
161
|
|
|
119
162
|
Publishing runs through npm Trusted Publishing and GitHub OIDC. Push a protected
|
|
@@ -155,10 +198,13 @@ const catalog = createNextChannelClient({
|
|
|
155
198
|
const products = await catalog.products.list();
|
|
156
199
|
```
|
|
157
200
|
|
|
158
|
-
The core also exposes the complete current channel door:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
201
|
+
The core also exposes the complete current channel door: public category,
|
|
202
|
+
collection and brand navigation; published blog and giving reads; cart and
|
|
203
|
+
checkout; Quick Print settings, quotes and multipart intake; assembled dining
|
|
204
|
+
menus; and signed-in customer orders, addresses, giving history, saved payment
|
|
205
|
+
methods and subscriptions. `pnpm contract:check` compares both client
|
|
206
|
+
inventories with the canonical server OpenAPI document when the repositories
|
|
207
|
+
are checked out together.
|
|
162
208
|
|
|
163
209
|
```ts
|
|
164
210
|
// session: cookie codec + the contested-vs-expired refresh decision
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from "./webhooks.js";
|
|
2
2
|
export type * from "./types.js";
|
|
3
|
-
|
|
4
|
-
import type { BlogPostResponse, DiningMenu, GivingEntry, AddCartItemInput, CartResponse, CheckoutAddressesInput, CheckoutCustomerInput, CheckoutFulfillmentInput, CheckoutOptions, CheckoutPayInput, CheckoutPayResponse, CheckoutStatusResponse, ChannelPing, CustomerResponse, CustomerSession, CustomerSignupResponse, LeadResponse, LightInitResponse, ListResponse, Order, OrderSummary, MergeCartInput, SendCodeResponse, Product, ProductAsset, PrintIntakeInput, PrintJob, PrintOptionsSelection, PrintQuoteResponse, PrintSettingsResponse, PublicPage, PublicPageSummary, PublicSubmitReviewInput, PublicWorkspaceInit, MenuResponse, Review, ReviewSummaryResponse, SiteDocument, StartGivingInput, StartGivingResponse, ThemeResponse, UpdateCartItemInput } from "./types";
|
|
3
|
+
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, 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
4
|
export interface ChannelRetryPolicy {
|
|
6
5
|
attempts?: number;
|
|
7
6
|
maxDelayMs?: number;
|
|
@@ -17,7 +16,7 @@ export interface CreateChannelClientOptions {
|
|
|
17
16
|
signal?: AbortSignal;
|
|
18
17
|
}
|
|
19
18
|
export type ChannelRequestOutcome = "success" | "api_error" | "network_error" | "timeout" | "invalid_response" | "cancelled";
|
|
20
|
-
export type ChannelOperation = "channel.ping" | "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.account.orders.list" | "channel.account.orders.summary" | "channel.account.orders.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" | "growth.public_workspace.leads.capture.channel";
|
|
19
|
+
export type ChannelOperation = "channel.ping" | "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.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";
|
|
21
20
|
export interface ChannelRequestObservation {
|
|
22
21
|
operation: ChannelOperation;
|
|
23
22
|
method: string;
|
|
@@ -54,6 +53,10 @@ export interface ChannelLeadInput {
|
|
|
54
53
|
source?: string;
|
|
55
54
|
meta?: Record<string, unknown>;
|
|
56
55
|
}
|
|
56
|
+
export interface DashDirectoryListParams extends ChannelListParams {
|
|
57
|
+
category?: string;
|
|
58
|
+
region?: string;
|
|
59
|
+
}
|
|
57
60
|
export interface ChannelMutationOptions {
|
|
58
61
|
idempotencyKey?: string;
|
|
59
62
|
}
|
|
@@ -61,6 +64,15 @@ export interface ChannelCheckoutStatusParams {
|
|
|
61
64
|
cartToken?: string;
|
|
62
65
|
checkoutSessionId?: string;
|
|
63
66
|
}
|
|
67
|
+
export interface ChannelSubscriptionListParams extends ChannelListParams {
|
|
68
|
+
status?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface ChannelSubscriptionCancelParams {
|
|
71
|
+
immediate?: boolean;
|
|
72
|
+
}
|
|
73
|
+
export interface ChannelInvoiceListParams {
|
|
74
|
+
limit?: number;
|
|
75
|
+
}
|
|
64
76
|
export declare class ChannelAPIError extends Error {
|
|
65
77
|
readonly status: number;
|
|
66
78
|
readonly code: string;
|
|
@@ -75,11 +87,27 @@ export declare function createChannelClient(options: CreateChannelClientOptions)
|
|
|
75
87
|
*
|
|
76
88
|
* The cheapest call on the door — it does no database work server-side. Use
|
|
77
89
|
* it as a deployment health check: a 200 means C1M_CHANNEL_TOKEN is right and
|
|
78
|
-
* aimed at the
|
|
90
|
+
* aimed at the scope you expect. A ChannelAPIError with status 401 means
|
|
79
91
|
* the token is bad, revoked, or the channel is disabled (the door will not
|
|
80
92
|
* say which). A 503 means C1M is unavailable — NOT that your token is wrong.
|
|
81
93
|
*/
|
|
82
94
|
readonly ping: () => Promise<ChannelPing>;
|
|
95
|
+
/** Tenant-level data exposed only to a dash-scoped channel token. */
|
|
96
|
+
readonly dash: {
|
|
97
|
+
readonly profile: () => Promise<DashProfileResponse>;
|
|
98
|
+
readonly init: () => Promise<DashInitResponse>;
|
|
99
|
+
readonly plans: () => Promise<DashPlansResponse>;
|
|
100
|
+
readonly directory: {
|
|
101
|
+
readonly regions: () => Promise<ListResponse<DashDirectoryRegion>>;
|
|
102
|
+
readonly list: (params?: DashDirectoryListParams) => Promise<ListResponse<DashDirectoryEntry>>;
|
|
103
|
+
readonly get: (idOrSlug: string) => Promise<DashDirectoryProfileResponse>;
|
|
104
|
+
};
|
|
105
|
+
readonly leads: {
|
|
106
|
+
readonly create: (input: ChannelLeadInput, mutation?: ChannelMutationOptions) => Promise<{
|
|
107
|
+
lead: DashLead;
|
|
108
|
+
}>;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
83
111
|
readonly assetUrl: (pathOrUrl: string) => string;
|
|
84
112
|
readonly site: {
|
|
85
113
|
readonly resolve: (params?: ChannelSiteResolveParams) => Promise<SiteDocument>;
|
|
@@ -101,6 +129,17 @@ export declare function createChannelClient(options: CreateChannelClientOptions)
|
|
|
101
129
|
}>;
|
|
102
130
|
readonly media: (slug: string) => Promise<ListResponse<ProductAsset>>;
|
|
103
131
|
};
|
|
132
|
+
readonly categories: {
|
|
133
|
+
readonly list: (params?: ChannelListParams) => Promise<ListResponse<CatalogCategory>>;
|
|
134
|
+
readonly products: (slug: string) => Promise<CatalogProductsResponse>;
|
|
135
|
+
};
|
|
136
|
+
readonly collections: {
|
|
137
|
+
readonly list: (params?: ChannelListParams) => Promise<ListResponse<CatalogCollection>>;
|
|
138
|
+
readonly products: (slug: string) => Promise<CatalogProductsResponse>;
|
|
139
|
+
};
|
|
140
|
+
readonly brands: {
|
|
141
|
+
readonly list: (params?: ChannelListParams) => Promise<ListResponse<CatalogBrand>>;
|
|
142
|
+
};
|
|
104
143
|
readonly cart: {
|
|
105
144
|
readonly get: (cartToken: string) => Promise<CartResponse>;
|
|
106
145
|
readonly addItem: (input: AddCartItemInput, mutation?: ChannelMutationOptions) => Promise<CartResponse>;
|
|
@@ -200,7 +239,38 @@ export declare function createChannelClient(options: CreateChannelClientOptions)
|
|
|
200
239
|
order: Order;
|
|
201
240
|
}>;
|
|
202
241
|
};
|
|
242
|
+
readonly addresses: {
|
|
243
|
+
readonly list: () => Promise<ListResponse<SavedAddress>>;
|
|
244
|
+
readonly get: (addressId: string) => Promise<SavedAddressResponse>;
|
|
245
|
+
readonly create: (input: SavedAddressInput, mutation?: ChannelMutationOptions) => Promise<SavedAddressResponse>;
|
|
246
|
+
readonly update: (addressId: string, input: SavedAddressUpdateInput, mutation?: ChannelMutationOptions) => Promise<SavedAddressResponse>;
|
|
247
|
+
readonly delete: (addressId: string, mutation?: ChannelMutationOptions) => Promise<{
|
|
248
|
+
status?: string;
|
|
249
|
+
}>;
|
|
250
|
+
readonly setDefault: (addressId: string, kind: SavedAddressDefaultKind, mutation?: ChannelMutationOptions) => Promise<SavedAddressResponse>;
|
|
251
|
+
};
|
|
252
|
+
readonly paymentMethods: {
|
|
253
|
+
readonly list: () => Promise<ListResponse<SavedPaymentMethod>>;
|
|
254
|
+
readonly setup: (input: PaymentMethodSetupInput, mutation?: ChannelMutationOptions) => Promise<PaymentMethodSetupResult>;
|
|
255
|
+
readonly confirm: (input: PaymentMethodConfirmInput, mutation?: ChannelMutationOptions) => Promise<SavedPaymentMethod>;
|
|
256
|
+
readonly setDefault: (methodId: string, mutation?: ChannelMutationOptions) => Promise<PaymentMethodMutationResponse>;
|
|
257
|
+
readonly delete: (methodId: string, mutation?: ChannelMutationOptions) => Promise<PaymentMethodMutationResponse>;
|
|
258
|
+
};
|
|
259
|
+
readonly subscriptions: {
|
|
260
|
+
readonly list: (params?: ChannelSubscriptionListParams) => Promise<SubscriptionListResponse>;
|
|
261
|
+
readonly get: (agreementId: string) => Promise<SubscriptionAgreementResponse>;
|
|
262
|
+
readonly source: (agreementId: string) => Promise<SubscriptionSourceResponse>;
|
|
263
|
+
readonly cancel: (agreementId: string, params?: ChannelSubscriptionCancelParams, mutation?: ChannelMutationOptions) => Promise<SubscriptionAgreementResponse>;
|
|
264
|
+
readonly pause: (agreementId: string, mutation?: ChannelMutationOptions) => Promise<SubscriptionAgreementResponse>;
|
|
265
|
+
readonly resume: (agreementId: string, mutation?: ChannelMutationOptions) => Promise<SubscriptionAgreementResponse>;
|
|
266
|
+
readonly invoices: {
|
|
267
|
+
readonly list: (agreementId: string, params?: ChannelInvoiceListParams) => Promise<SubscriptionInvoiceListResponse>;
|
|
268
|
+
readonly get: (invoiceId: string) => Promise<SubscriptionInvoiceResponse>;
|
|
269
|
+
readonly payNow: (invoiceId: string, mutation?: ChannelMutationOptions) => Promise<SubscriptionInvoiceResponse>;
|
|
270
|
+
};
|
|
271
|
+
};
|
|
203
272
|
readonly giving: {
|
|
273
|
+
readonly list: () => Promise<GivingIntentListResponse>;
|
|
204
274
|
readonly start: (input: StartGivingInput, mutation?: ChannelMutationOptions) => Promise<StartGivingResponse>;
|
|
205
275
|
};
|
|
206
276
|
};
|
package/dist/index.js
CHANGED
|
@@ -188,11 +188,27 @@ export function createChannelClient(options) {
|
|
|
188
188
|
*
|
|
189
189
|
* The cheapest call on the door — it does no database work server-side. Use
|
|
190
190
|
* it as a deployment health check: a 200 means C1M_CHANNEL_TOKEN is right and
|
|
191
|
-
* aimed at the
|
|
191
|
+
* aimed at the scope you expect. A ChannelAPIError with status 401 means
|
|
192
192
|
* the token is bad, revoked, or the channel is disabled (the door will not
|
|
193
193
|
* say which). A 503 means C1M is unavailable — NOT that your token is wrong.
|
|
194
194
|
*/
|
|
195
195
|
ping: () => request("channel.ping", "/ping"),
|
|
196
|
+
/** Tenant-level data exposed only to a dash-scoped channel token. */
|
|
197
|
+
dash: {
|
|
198
|
+
profile: () => request("channel.dash.profile", "/dash/profile"),
|
|
199
|
+
init: () => request("channel.dash.init", "/dash/init"),
|
|
200
|
+
plans: () => request("channel.dash.plans", "/dash/plans"),
|
|
201
|
+
directory: {
|
|
202
|
+
regions: () => request("channel.dash.directory.regions", "/dash/directory/regions"),
|
|
203
|
+
list: (params = {}) => request("channel.dash.directory.browse", appendQuery("/dash/directory", params)),
|
|
204
|
+
get: (idOrSlug) => request("channel.dash.directory.get", `/dash/directory/${encodePath(idOrSlug)}`),
|
|
205
|
+
},
|
|
206
|
+
leads: {
|
|
207
|
+
create: (input, mutation) => request("channel.dash.leads.capture", "/dash/leads", {
|
|
208
|
+
method: "POST", headers: mutationHeaders(mutation), body: JSON.stringify(input),
|
|
209
|
+
}),
|
|
210
|
+
},
|
|
211
|
+
},
|
|
196
212
|
assetUrl: (pathOrUrl) => new URL(required(pathOrUrl, "asset URL"), `${baseUrl}/`).toString(),
|
|
197
213
|
site: {
|
|
198
214
|
resolve: (params = {}) => request("channel.site.resolve", appendQuery("/site/resolve", params)),
|
|
@@ -210,6 +226,17 @@ export function createChannelClient(options) {
|
|
|
210
226
|
get: (slug) => request("shop.public.products.get.channel", `/products/${encodePath(slug)}`),
|
|
211
227
|
media: (slug) => request("shop.public.products.media.channel", `/products/${encodePath(slug)}/media`),
|
|
212
228
|
},
|
|
229
|
+
categories: {
|
|
230
|
+
list: (params = {}) => request("channel.catalog.categories.list", appendQuery("/categories", params)),
|
|
231
|
+
products: (slug) => request("channel.catalog.categories.products", `/categories/by-slug/${encodePath(slug)}/products`),
|
|
232
|
+
},
|
|
233
|
+
collections: {
|
|
234
|
+
list: (params = {}) => request("channel.catalog.collections.list", appendQuery("/collections", params)),
|
|
235
|
+
products: (slug) => request("channel.catalog.collections.products", `/collections/by-slug/${encodePath(slug)}/products`),
|
|
236
|
+
},
|
|
237
|
+
brands: {
|
|
238
|
+
list: (params = {}) => request("channel.catalog.brands.list", appendQuery("/brands", params)),
|
|
239
|
+
},
|
|
213
240
|
cart: {
|
|
214
241
|
get: (cartToken) => request("channel.cart.get", appendQuery("/cart", { cart_token: required(cartToken, "cartToken") })),
|
|
215
242
|
addItem: (input, mutation) => request("channel.cart.items.add", "/cart/items", {
|
|
@@ -337,7 +364,60 @@ export function createChannelClient(options) {
|
|
|
337
364
|
summary: () => request("channel.account.orders.summary", "/account/orders/summary", {}, customerSession),
|
|
338
365
|
get: (orderId) => request("channel.account.orders.get", `/account/orders/${encodePath(orderId)}`, {}, customerSession),
|
|
339
366
|
},
|
|
367
|
+
addresses: {
|
|
368
|
+
list: () => request("channel.account.addresses.list", "/account/addresses", {}, customerSession),
|
|
369
|
+
get: (addressId) => request("channel.account.addresses.get", `/account/addresses/${encodePath(addressId)}`, {}, customerSession),
|
|
370
|
+
create: (input, mutation) => request("channel.account.addresses.create", "/account/addresses", {
|
|
371
|
+
method: "POST", headers: mutationHeaders(mutation), body: JSON.stringify(input),
|
|
372
|
+
}, customerSession),
|
|
373
|
+
update: (addressId, input, mutation) => request("channel.account.addresses.update", `/account/addresses/${encodePath(addressId)}`, {
|
|
374
|
+
method: "PUT", headers: mutationHeaders(mutation), body: JSON.stringify(input),
|
|
375
|
+
}, customerSession),
|
|
376
|
+
delete: (addressId, mutation) => request("channel.account.addresses.delete", `/account/addresses/${encodePath(addressId)}`, {
|
|
377
|
+
method: "DELETE", headers: mutationHeaders(mutation),
|
|
378
|
+
}, customerSession),
|
|
379
|
+
setDefault: (addressId, kind, mutation) => request("channel.account.addresses.set_default", `/account/addresses/${encodePath(addressId)}/default`, {
|
|
380
|
+
method: "POST", headers: mutationHeaders(mutation), body: JSON.stringify({ kind }),
|
|
381
|
+
}, customerSession),
|
|
382
|
+
},
|
|
383
|
+
paymentMethods: {
|
|
384
|
+
list: () => request("channel.account.payment_methods.list", "/account/payment-methods", {}, customerSession),
|
|
385
|
+
setup: (input, mutation) => request("channel.account.payment_methods.setup", "/account/payment-methods/setup", {
|
|
386
|
+
method: "POST", headers: mutationHeaders(mutation), body: JSON.stringify(input),
|
|
387
|
+
}, customerSession),
|
|
388
|
+
confirm: (input, mutation) => request("channel.account.payment_methods.confirm", "/account/payment-methods/confirm", {
|
|
389
|
+
method: "POST", headers: mutationHeaders(mutation), body: JSON.stringify(input),
|
|
390
|
+
}, customerSession),
|
|
391
|
+
setDefault: (methodId, mutation) => request("channel.account.payment_methods.default", `/account/payment-methods/${encodePath(methodId)}/default`, {
|
|
392
|
+
method: "POST", headers: mutationHeaders(mutation),
|
|
393
|
+
}, customerSession),
|
|
394
|
+
delete: (methodId, mutation) => request("channel.account.payment_methods.delete", `/account/payment-methods/${encodePath(methodId)}`, {
|
|
395
|
+
method: "DELETE", headers: mutationHeaders(mutation),
|
|
396
|
+
}, customerSession),
|
|
397
|
+
},
|
|
398
|
+
subscriptions: {
|
|
399
|
+
list: (params = {}) => request("channel.account.subscriptions.list", appendQuery("/account/subscriptions", params), {}, customerSession),
|
|
400
|
+
get: (agreementId) => request("channel.account.subscriptions.get", `/account/subscriptions/${encodePath(agreementId)}`, {}, customerSession),
|
|
401
|
+
source: (agreementId) => request("channel.account.subscriptions.source", `/account/subscriptions/${encodePath(agreementId)}/source`, {}, customerSession),
|
|
402
|
+
cancel: (agreementId, params = {}, mutation) => request("channel.account.subscriptions.cancel", appendQuery(`/account/subscriptions/${encodePath(agreementId)}/cancel`, params), {
|
|
403
|
+
method: "POST", headers: mutationHeaders(mutation),
|
|
404
|
+
}, customerSession),
|
|
405
|
+
pause: (agreementId, mutation) => request("channel.account.subscriptions.pause", `/account/subscriptions/${encodePath(agreementId)}/pause`, {
|
|
406
|
+
method: "POST", headers: mutationHeaders(mutation),
|
|
407
|
+
}, customerSession),
|
|
408
|
+
resume: (agreementId, mutation) => request("channel.account.subscriptions.resume", `/account/subscriptions/${encodePath(agreementId)}/resume`, {
|
|
409
|
+
method: "POST", headers: mutationHeaders(mutation),
|
|
410
|
+
}, customerSession),
|
|
411
|
+
invoices: {
|
|
412
|
+
list: (agreementId, params = {}) => request("channel.account.subscriptions.invoices.list", appendQuery(`/account/subscriptions/${encodePath(agreementId)}/invoices`, params), {}, customerSession),
|
|
413
|
+
get: (invoiceId) => request("channel.account.subscriptions.invoices.get", `/account/subscriptions/invoices/${encodePath(invoiceId)}`, {}, customerSession),
|
|
414
|
+
payNow: (invoiceId, mutation) => request("channel.account.subscriptions.invoices.pay_now", `/account/subscriptions/invoices/${encodePath(invoiceId)}/pay-now`, {
|
|
415
|
+
method: "POST", headers: mutationHeaders(mutation),
|
|
416
|
+
}, customerSession),
|
|
417
|
+
},
|
|
418
|
+
},
|
|
340
419
|
giving: {
|
|
420
|
+
list: () => request("channel.account.giving.list", "/account/giving", {}, customerSession),
|
|
341
421
|
start: (input, mutation) => request("channel.giving.start", "/give/start", {
|
|
342
422
|
method: "POST", headers: mutationHeaders(mutation), body: JSON.stringify(input),
|
|
343
423
|
}, customerSession),
|
package/dist/next.d.ts
CHANGED
|
@@ -16,6 +16,21 @@ export interface CreateNextChannelClientOptions extends Omit<CreateChannelClient
|
|
|
16
16
|
*/
|
|
17
17
|
export declare function createNextChannelClient(options: CreateNextChannelClientOptions): {
|
|
18
18
|
readonly ping: () => Promise<import("./types.js").ChannelPing>;
|
|
19
|
+
readonly dash: {
|
|
20
|
+
readonly profile: () => Promise<import("./types.js").DashProfileResponse>;
|
|
21
|
+
readonly init: () => Promise<import("./types.js").DashInitResponse>;
|
|
22
|
+
readonly plans: () => Promise<import("./types.js").DashPlansResponse>;
|
|
23
|
+
readonly directory: {
|
|
24
|
+
readonly regions: () => Promise<import("./types.js").ListResponse<import("./types.js").DashDirectoryRegion>>;
|
|
25
|
+
readonly list: (params?: import("./index.js").DashDirectoryListParams) => Promise<import("./types.js").ListResponse<import("./types.js").DashDirectoryEntry>>;
|
|
26
|
+
readonly get: (idOrSlug: string) => Promise<import("./types.js").DashDirectoryProfileResponse>;
|
|
27
|
+
};
|
|
28
|
+
readonly leads: {
|
|
29
|
+
readonly create: (input: import("./index.js").ChannelLeadInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<{
|
|
30
|
+
lead: import("./types.js").DashLead;
|
|
31
|
+
}>;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
19
34
|
readonly assetUrl: (pathOrUrl: string) => string;
|
|
20
35
|
readonly site: {
|
|
21
36
|
readonly resolve: (params?: import("./index.js").ChannelSiteResolveParams) => Promise<import("./types.js").SiteDocument>;
|
|
@@ -37,6 +52,17 @@ export declare function createNextChannelClient(options: CreateNextChannelClient
|
|
|
37
52
|
}>;
|
|
38
53
|
readonly media: (slug: string) => Promise<import("./types.js").ListResponse<import("./types.js").ProductAsset>>;
|
|
39
54
|
};
|
|
55
|
+
readonly categories: {
|
|
56
|
+
readonly list: (params?: import("./index.js").ChannelListParams) => Promise<import("./types.js").ListResponse<import("./types.js").CatalogCategory>>;
|
|
57
|
+
readonly products: (slug: string) => Promise<import("./types.js").CatalogProductsResponse>;
|
|
58
|
+
};
|
|
59
|
+
readonly collections: {
|
|
60
|
+
readonly list: (params?: import("./index.js").ChannelListParams) => Promise<import("./types.js").ListResponse<import("./types.js").CatalogCollection>>;
|
|
61
|
+
readonly products: (slug: string) => Promise<import("./types.js").CatalogProductsResponse>;
|
|
62
|
+
};
|
|
63
|
+
readonly brands: {
|
|
64
|
+
readonly list: (params?: import("./index.js").ChannelListParams) => Promise<import("./types.js").ListResponse<import("./types.js").CatalogBrand>>;
|
|
65
|
+
};
|
|
40
66
|
readonly cart: {
|
|
41
67
|
readonly get: (cartToken: string) => Promise<import("./types.js").CartResponse>;
|
|
42
68
|
readonly addItem: (input: import("./types.js").AddCartItemInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").CartResponse>;
|
|
@@ -125,7 +151,38 @@ export declare function createNextChannelClient(options: CreateNextChannelClient
|
|
|
125
151
|
order: import("./types.js").Order;
|
|
126
152
|
}>;
|
|
127
153
|
};
|
|
154
|
+
readonly addresses: {
|
|
155
|
+
readonly list: () => Promise<import("./types.js").ListResponse<import("./types.js").SavedAddress>>;
|
|
156
|
+
readonly get: (addressId: string) => Promise<import("./types.js").SavedAddressResponse>;
|
|
157
|
+
readonly create: (input: import("./types.js").SavedAddressInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SavedAddressResponse>;
|
|
158
|
+
readonly update: (addressId: string, input: import("./types.js").SavedAddressUpdateInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SavedAddressResponse>;
|
|
159
|
+
readonly delete: (addressId: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<{
|
|
160
|
+
status?: string;
|
|
161
|
+
}>;
|
|
162
|
+
readonly setDefault: (addressId: string, kind: import("./types.js").SavedAddressDefaultKind, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SavedAddressResponse>;
|
|
163
|
+
};
|
|
164
|
+
readonly paymentMethods: {
|
|
165
|
+
readonly list: () => Promise<import("./types.js").ListResponse<import("./types.js").SavedPaymentMethod>>;
|
|
166
|
+
readonly setup: (input: import("./types.js").PaymentMethodSetupInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").PaymentMethodSetupResult>;
|
|
167
|
+
readonly confirm: (input: import("./types.js").PaymentMethodConfirmInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SavedPaymentMethod>;
|
|
168
|
+
readonly setDefault: (methodId: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").PaymentMethodMutationResponse>;
|
|
169
|
+
readonly delete: (methodId: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").PaymentMethodMutationResponse>;
|
|
170
|
+
};
|
|
171
|
+
readonly subscriptions: {
|
|
172
|
+
readonly list: (params?: import("./index.js").ChannelSubscriptionListParams) => Promise<import("./types.js").SubscriptionListResponse>;
|
|
173
|
+
readonly get: (agreementId: string) => Promise<import("./types.js").SubscriptionAgreementResponse>;
|
|
174
|
+
readonly source: (agreementId: string) => Promise<import("./types.js").SubscriptionSourceResponse>;
|
|
175
|
+
readonly cancel: (agreementId: string, params?: import("./index.js").ChannelSubscriptionCancelParams, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SubscriptionAgreementResponse>;
|
|
176
|
+
readonly pause: (agreementId: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SubscriptionAgreementResponse>;
|
|
177
|
+
readonly resume: (agreementId: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SubscriptionAgreementResponse>;
|
|
178
|
+
readonly invoices: {
|
|
179
|
+
readonly list: (agreementId: string, params?: import("./index.js").ChannelInvoiceListParams) => Promise<import("./types.js").SubscriptionInvoiceListResponse>;
|
|
180
|
+
readonly get: (invoiceId: string) => Promise<import("./types.js").SubscriptionInvoiceResponse>;
|
|
181
|
+
readonly payNow: (invoiceId: string, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").SubscriptionInvoiceResponse>;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
128
184
|
readonly giving: {
|
|
185
|
+
readonly list: () => Promise<import("./types.js").GivingIntentListResponse>;
|
|
129
186
|
readonly start: (input: import("./types.js").StartGivingInput, mutation?: import("./index.js").ChannelMutationOptions) => Promise<import("./types.js").StartGivingResponse>;
|
|
130
187
|
};
|
|
131
188
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -40,6 +40,139 @@ export interface LightInitResponse {
|
|
|
40
40
|
enabled_features: string[];
|
|
41
41
|
etag?: string;
|
|
42
42
|
}
|
|
43
|
+
export interface DashTenantInfo {
|
|
44
|
+
id: string;
|
|
45
|
+
display_name: string;
|
|
46
|
+
managed_domain?: string;
|
|
47
|
+
status: string;
|
|
48
|
+
}
|
|
49
|
+
export interface DashPublicProfileInfo {
|
|
50
|
+
discoverable: boolean;
|
|
51
|
+
category?: string;
|
|
52
|
+
headline?: string;
|
|
53
|
+
short_description?: string;
|
|
54
|
+
about?: string;
|
|
55
|
+
logo_url?: string;
|
|
56
|
+
header_media_url?: string;
|
|
57
|
+
pricing_summary?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface DashInitResponse {
|
|
60
|
+
tenant: DashTenantInfo;
|
|
61
|
+
public_profile: DashPublicProfileInfo;
|
|
62
|
+
}
|
|
63
|
+
export interface DashPublicPage {
|
|
64
|
+
profile: DashPublicProfileInfo & {
|
|
65
|
+
tenant_id: string;
|
|
66
|
+
status: string;
|
|
67
|
+
display_name?: string;
|
|
68
|
+
is_private: boolean;
|
|
69
|
+
allow_free_memberships: boolean;
|
|
70
|
+
primary_color?: string;
|
|
71
|
+
logo_square_url?: string;
|
|
72
|
+
favicon_url?: string;
|
|
73
|
+
cover_url?: string;
|
|
74
|
+
gallery_items?: Array<{
|
|
75
|
+
url: string;
|
|
76
|
+
kind: string;
|
|
77
|
+
alt_text?: string;
|
|
78
|
+
caption?: string;
|
|
79
|
+
}>;
|
|
80
|
+
[key: string]: unknown;
|
|
81
|
+
};
|
|
82
|
+
owner_name?: string;
|
|
83
|
+
user_count: number;
|
|
84
|
+
workspace_counts: Record<string, number>;
|
|
85
|
+
media: Array<{
|
|
86
|
+
kind: string;
|
|
87
|
+
url: string;
|
|
88
|
+
alt_text?: string;
|
|
89
|
+
caption?: string;
|
|
90
|
+
}>;
|
|
91
|
+
}
|
|
92
|
+
export interface DashProfileResponse {
|
|
93
|
+
page: DashPublicPage;
|
|
94
|
+
}
|
|
95
|
+
export interface DashPlanPricing {
|
|
96
|
+
currency: string;
|
|
97
|
+
currency_symbol?: string;
|
|
98
|
+
monthly_price: number;
|
|
99
|
+
yearly_price: number;
|
|
100
|
+
}
|
|
101
|
+
export interface DashPlan {
|
|
102
|
+
id: string;
|
|
103
|
+
name: string;
|
|
104
|
+
description: string;
|
|
105
|
+
level: number;
|
|
106
|
+
is_public: boolean;
|
|
107
|
+
is_free: boolean;
|
|
108
|
+
trial_days?: number;
|
|
109
|
+
highlights: string[];
|
|
110
|
+
limits: Record<string, number>;
|
|
111
|
+
pricing: Record<string, DashPlanPricing>;
|
|
112
|
+
}
|
|
113
|
+
export interface DashPlanRegion {
|
|
114
|
+
code: string;
|
|
115
|
+
name: string;
|
|
116
|
+
currency: string;
|
|
117
|
+
locale: string;
|
|
118
|
+
timezone: string;
|
|
119
|
+
market_code?: string;
|
|
120
|
+
}
|
|
121
|
+
export interface DashPlansResponse {
|
|
122
|
+
plans: DashPlan[];
|
|
123
|
+
regions: DashPlanRegion[];
|
|
124
|
+
default_region: string;
|
|
125
|
+
}
|
|
126
|
+
export interface DashDirectoryRegion {
|
|
127
|
+
code: string;
|
|
128
|
+
label: string;
|
|
129
|
+
country_code?: string;
|
|
130
|
+
sort_order: number;
|
|
131
|
+
count: number;
|
|
132
|
+
}
|
|
133
|
+
export interface DashDirectoryEntry {
|
|
134
|
+
workspace_id: string;
|
|
135
|
+
slug: string;
|
|
136
|
+
name: string;
|
|
137
|
+
tagline?: string;
|
|
138
|
+
category?: string;
|
|
139
|
+
logo_url?: string;
|
|
140
|
+
logo_square_url?: string;
|
|
141
|
+
primary_color?: string;
|
|
142
|
+
review_count: number;
|
|
143
|
+
average_rating: number;
|
|
144
|
+
verified: boolean;
|
|
145
|
+
service_tags: unknown;
|
|
146
|
+
major_region_code?: string;
|
|
147
|
+
major_region_label?: string;
|
|
148
|
+
upcoming_events?: unknown[];
|
|
149
|
+
}
|
|
150
|
+
export interface DashDirectoryProfile extends DashDirectoryEntry {
|
|
151
|
+
display_name?: string;
|
|
152
|
+
description?: string;
|
|
153
|
+
logo_light_url?: string;
|
|
154
|
+
logo_dark_url?: string;
|
|
155
|
+
verified_at?: string;
|
|
156
|
+
created_at: string;
|
|
157
|
+
}
|
|
158
|
+
export interface DashDirectoryProfileResponse {
|
|
159
|
+
profile: DashDirectoryProfile;
|
|
160
|
+
}
|
|
161
|
+
export interface DashLead {
|
|
162
|
+
id: string;
|
|
163
|
+
owner_scope?: string;
|
|
164
|
+
owner_id?: string;
|
|
165
|
+
name?: string;
|
|
166
|
+
email?: string;
|
|
167
|
+
phone?: string;
|
|
168
|
+
message?: string;
|
|
169
|
+
source: string;
|
|
170
|
+
channel_id?: string;
|
|
171
|
+
status: string;
|
|
172
|
+
meta?: Record<string, unknown>;
|
|
173
|
+
created_at: string;
|
|
174
|
+
updated_at: string;
|
|
175
|
+
}
|
|
43
176
|
export interface PublicPageSummary {
|
|
44
177
|
id: string;
|
|
45
178
|
saas_app: string;
|
|
@@ -82,6 +215,12 @@ export interface Product {
|
|
|
82
215
|
price_cents: number;
|
|
83
216
|
currency: string;
|
|
84
217
|
inventory_qty: number;
|
|
218
|
+
/**
|
|
219
|
+
* Stripe product tax code (e.g. `txcd_99999999`). Drives how Stripe Automatic Tax
|
|
220
|
+
* categorises the product at checkout — a book, a hot meal and a t-shirt are taxed
|
|
221
|
+
* differently in most places. Empty means the merchant's Stripe account default.
|
|
222
|
+
*/
|
|
223
|
+
tax_code?: string;
|
|
85
224
|
status: "draft" | "published" | "archived";
|
|
86
225
|
primary_image_url?: string;
|
|
87
226
|
options?: unknown[];
|
|
@@ -110,6 +249,60 @@ export interface ProductAsset {
|
|
|
110
249
|
};
|
|
111
250
|
created_at: string;
|
|
112
251
|
}
|
|
252
|
+
export interface CatalogCategory {
|
|
253
|
+
id: string;
|
|
254
|
+
workspace_id: string;
|
|
255
|
+
name: string;
|
|
256
|
+
slug: string;
|
|
257
|
+
description?: string;
|
|
258
|
+
is_active: boolean;
|
|
259
|
+
sort_order: number;
|
|
260
|
+
product_count: number;
|
|
261
|
+
metadata: unknown;
|
|
262
|
+
created_at: string;
|
|
263
|
+
updated_at: string;
|
|
264
|
+
}
|
|
265
|
+
export interface CatalogCollection {
|
|
266
|
+
id: string;
|
|
267
|
+
workspace_id: string;
|
|
268
|
+
title: string;
|
|
269
|
+
slug: string;
|
|
270
|
+
description?: string;
|
|
271
|
+
created_at: string;
|
|
272
|
+
updated_at: string;
|
|
273
|
+
}
|
|
274
|
+
export interface CatalogBrand {
|
|
275
|
+
id: string;
|
|
276
|
+
workspace_id: string;
|
|
277
|
+
name: string;
|
|
278
|
+
slug: string;
|
|
279
|
+
description?: string;
|
|
280
|
+
website_url?: string;
|
|
281
|
+
is_active: boolean;
|
|
282
|
+
sort_order: number;
|
|
283
|
+
metadata: unknown;
|
|
284
|
+
created_at: string;
|
|
285
|
+
updated_at: string;
|
|
286
|
+
}
|
|
287
|
+
export interface CatalogProduct {
|
|
288
|
+
id: string;
|
|
289
|
+
slug: string;
|
|
290
|
+
title: string;
|
|
291
|
+
price_cents: number;
|
|
292
|
+
currency: string;
|
|
293
|
+
base_price_cents?: number;
|
|
294
|
+
base_currency?: string;
|
|
295
|
+
price_source?: string;
|
|
296
|
+
fx_rate?: number;
|
|
297
|
+
fx_provider?: string;
|
|
298
|
+
fx_quoted_at?: string;
|
|
299
|
+
primary_image_url?: string;
|
|
300
|
+
status: string;
|
|
301
|
+
}
|
|
302
|
+
export interface CatalogProductsResponse {
|
|
303
|
+
products: CatalogProduct[];
|
|
304
|
+
count: number;
|
|
305
|
+
}
|
|
113
306
|
export interface Review {
|
|
114
307
|
id: string;
|
|
115
308
|
rating: number;
|
|
@@ -268,6 +461,156 @@ export interface GivingIntent {
|
|
|
268
461
|
updated_at: string;
|
|
269
462
|
refunded_at?: string;
|
|
270
463
|
}
|
|
464
|
+
export interface GivingIntentListResponse {
|
|
465
|
+
items: GivingIntent[];
|
|
466
|
+
}
|
|
467
|
+
export interface SavedAddress {
|
|
468
|
+
id: string;
|
|
469
|
+
end_user_id: string;
|
|
470
|
+
label: string;
|
|
471
|
+
name: string;
|
|
472
|
+
phone: string;
|
|
473
|
+
line1: string;
|
|
474
|
+
line2: string;
|
|
475
|
+
city: string;
|
|
476
|
+
region: string;
|
|
477
|
+
postal_code: string;
|
|
478
|
+
country_code: string;
|
|
479
|
+
is_default_shipping: boolean;
|
|
480
|
+
is_default_billing: boolean;
|
|
481
|
+
created_at: string;
|
|
482
|
+
updated_at: string;
|
|
483
|
+
}
|
|
484
|
+
export interface SavedAddressInput {
|
|
485
|
+
line1: string;
|
|
486
|
+
city: string;
|
|
487
|
+
country_code: string;
|
|
488
|
+
label?: string;
|
|
489
|
+
name?: string;
|
|
490
|
+
phone?: string;
|
|
491
|
+
line2?: string;
|
|
492
|
+
region?: string;
|
|
493
|
+
postal_code?: string;
|
|
494
|
+
is_default_shipping?: boolean;
|
|
495
|
+
is_default_billing?: boolean;
|
|
496
|
+
}
|
|
497
|
+
export type SavedAddressUpdateInput = SavedAddressInput;
|
|
498
|
+
export type SavedAddressDefaultKind = "shipping" | "billing";
|
|
499
|
+
export interface SavedAddressResponse {
|
|
500
|
+
address: SavedAddress;
|
|
501
|
+
}
|
|
502
|
+
export interface SavedPaymentMethod {
|
|
503
|
+
id: string;
|
|
504
|
+
workspace_id: string;
|
|
505
|
+
end_user_ref?: string;
|
|
506
|
+
provider: string;
|
|
507
|
+
provider_customer_id?: string;
|
|
508
|
+
provider_payment_method_id: string;
|
|
509
|
+
status: string;
|
|
510
|
+
is_default: boolean;
|
|
511
|
+
display_brand?: string;
|
|
512
|
+
display_last4?: string;
|
|
513
|
+
exp_month?: number;
|
|
514
|
+
exp_year?: number;
|
|
515
|
+
created_at: string;
|
|
516
|
+
updated_at: string;
|
|
517
|
+
}
|
|
518
|
+
export interface PaymentMethodSetupInput {
|
|
519
|
+
provider: string;
|
|
520
|
+
}
|
|
521
|
+
export interface PaymentMethodSetupResult {
|
|
522
|
+
type: string;
|
|
523
|
+
client_secret?: string;
|
|
524
|
+
publishable_key?: string;
|
|
525
|
+
}
|
|
526
|
+
export interface PaymentMethodConfirmInput {
|
|
527
|
+
provider: string;
|
|
528
|
+
setup_intent_id?: string;
|
|
529
|
+
payment_method_id?: string;
|
|
530
|
+
}
|
|
531
|
+
export interface PaymentMethodMutationResponse {
|
|
532
|
+
success: boolean;
|
|
533
|
+
}
|
|
534
|
+
export interface SubscriptionAgreement {
|
|
535
|
+
id: string;
|
|
536
|
+
workspace_id: string;
|
|
537
|
+
source_kind: string;
|
|
538
|
+
source_id: string;
|
|
539
|
+
end_user_ref?: string;
|
|
540
|
+
status: string;
|
|
541
|
+
provider: string;
|
|
542
|
+
provider_ref?: string;
|
|
543
|
+
provider_customer_ref?: string;
|
|
544
|
+
plan_id?: string;
|
|
545
|
+
initial_invoice_id?: string;
|
|
546
|
+
currency: string;
|
|
547
|
+
amount_cents: number;
|
|
548
|
+
interval: string;
|
|
549
|
+
current_period_start?: string;
|
|
550
|
+
current_period_end?: string;
|
|
551
|
+
trial_ends_at?: string;
|
|
552
|
+
cancel_at_period_end: boolean;
|
|
553
|
+
canceled_at?: string;
|
|
554
|
+
meta?: Record<string, unknown>;
|
|
555
|
+
created_at: string;
|
|
556
|
+
updated_at: string;
|
|
557
|
+
}
|
|
558
|
+
export interface SubscriptionAgreementResponse {
|
|
559
|
+
agreement: SubscriptionAgreement;
|
|
560
|
+
}
|
|
561
|
+
export interface SubscriptionListResponse {
|
|
562
|
+
items: SubscriptionAgreement[];
|
|
563
|
+
has_more: boolean;
|
|
564
|
+
next_cursor?: string;
|
|
565
|
+
}
|
|
566
|
+
export interface SubscriptionInvoice {
|
|
567
|
+
id: string;
|
|
568
|
+
workspace_id: string;
|
|
569
|
+
agreement_id: string;
|
|
570
|
+
source_kind: string;
|
|
571
|
+
source_id: string;
|
|
572
|
+
invoice_number: string;
|
|
573
|
+
status: string;
|
|
574
|
+
currency: string;
|
|
575
|
+
subtotal_cents: number;
|
|
576
|
+
tax_cents: number;
|
|
577
|
+
total_cents: number;
|
|
578
|
+
paid_cents: number;
|
|
579
|
+
period_start?: string;
|
|
580
|
+
period_end?: string;
|
|
581
|
+
due_at?: string;
|
|
582
|
+
paid_at?: string;
|
|
583
|
+
payment_id?: string;
|
|
584
|
+
attempt_count: number;
|
|
585
|
+
failure_code?: string;
|
|
586
|
+
failure_message?: string;
|
|
587
|
+
meta?: Record<string, unknown>;
|
|
588
|
+
created_at: string;
|
|
589
|
+
updated_at: string;
|
|
590
|
+
}
|
|
591
|
+
export interface SubscriptionInvoiceResponse {
|
|
592
|
+
invoice: SubscriptionInvoice;
|
|
593
|
+
}
|
|
594
|
+
export interface SubscriptionInvoiceListResponse {
|
|
595
|
+
items: SubscriptionInvoice[];
|
|
596
|
+
has_more: boolean;
|
|
597
|
+
next_cursor?: string;
|
|
598
|
+
}
|
|
599
|
+
export interface SubscriptionSourceDisplay {
|
|
600
|
+
source_app: string;
|
|
601
|
+
source_kind: string;
|
|
602
|
+
source_id: string;
|
|
603
|
+
app_label: string;
|
|
604
|
+
object_label: string;
|
|
605
|
+
subtitle?: string;
|
|
606
|
+
variant?: string;
|
|
607
|
+
admin_href?: string;
|
|
608
|
+
customer_href?: string;
|
|
609
|
+
status?: string;
|
|
610
|
+
}
|
|
611
|
+
export interface SubscriptionSourceResponse {
|
|
612
|
+
source_display: SubscriptionSourceDisplay;
|
|
613
|
+
}
|
|
271
614
|
export interface StartGivingInput {
|
|
272
615
|
variant?: string;
|
|
273
616
|
title?: string;
|
|
@@ -613,6 +956,8 @@ export interface OrderItem {
|
|
|
613
956
|
quantity: number;
|
|
614
957
|
unit_price_cents: number;
|
|
615
958
|
line_total_cents: number;
|
|
959
|
+
/** Stripe product tax code, snapshotted from the product at order time. */
|
|
960
|
+
tax_code?: string;
|
|
616
961
|
[key: string]: unknown;
|
|
617
962
|
}
|
|
618
963
|
export interface CartResponse {
|
|
@@ -725,5 +1070,6 @@ export interface ChannelPing {
|
|
|
725
1070
|
channel_id: string;
|
|
726
1071
|
workspace_id: string;
|
|
727
1072
|
saas_app: string;
|
|
1073
|
+
scope: "workspace" | "dash";
|
|
728
1074
|
api_version: string;
|
|
729
1075
|
}
|