@fonderie/client 0.12.0 → 0.13.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/brain/signatures.md +64 -0
- package/dist/index.cjs +71 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +59 -1
- package/dist/index.d.ts +59 -1
- package/dist/index.js +71 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -209,6 +209,55 @@ interface IWalletDTO {
|
|
|
209
209
|
interface IWalletResult {
|
|
210
210
|
wallet: IWalletDTO;
|
|
211
211
|
}
|
|
212
|
+
interface IWalletTransactionDTO {
|
|
213
|
+
id: string;
|
|
214
|
+
type: string;
|
|
215
|
+
amount: string;
|
|
216
|
+
balanceAfter: string;
|
|
217
|
+
currency: string;
|
|
218
|
+
description: string | null;
|
|
219
|
+
providerTxId: string | null;
|
|
220
|
+
metadata: Record<string, unknown>;
|
|
221
|
+
createdAt: string;
|
|
222
|
+
}
|
|
223
|
+
interface IWalletTransactionsResult {
|
|
224
|
+
transactions: IWalletTransactionDTO[];
|
|
225
|
+
nextCursor: string | null;
|
|
226
|
+
}
|
|
227
|
+
interface IWalletCheckoutInput {
|
|
228
|
+
packId: string;
|
|
229
|
+
}
|
|
230
|
+
interface ICancelSubscriptionInput {
|
|
231
|
+
atPeriodEnd?: boolean;
|
|
232
|
+
}
|
|
233
|
+
interface ISubscriptionChangeResult {
|
|
234
|
+
atPeriodEnd: boolean;
|
|
235
|
+
status: string;
|
|
236
|
+
currentPeriodEnd: string | null;
|
|
237
|
+
}
|
|
238
|
+
interface IPaymentMethodDTO {
|
|
239
|
+
brand: string;
|
|
240
|
+
last4: string;
|
|
241
|
+
expMonth: number;
|
|
242
|
+
expYear: number;
|
|
243
|
+
}
|
|
244
|
+
interface IPaymentMethodResult {
|
|
245
|
+
paymentMethod: IPaymentMethodDTO | null;
|
|
246
|
+
}
|
|
247
|
+
interface IInvoiceDTO {
|
|
248
|
+
id: string;
|
|
249
|
+
number: string | null;
|
|
250
|
+
amountDue: string;
|
|
251
|
+
amountPaid: string;
|
|
252
|
+
currency: string;
|
|
253
|
+
status: string;
|
|
254
|
+
created: string;
|
|
255
|
+
hostedInvoiceUrl: string | null;
|
|
256
|
+
invoicePdf: string | null;
|
|
257
|
+
}
|
|
258
|
+
interface IInvoicesResult {
|
|
259
|
+
invoices: IInvoiceDTO[];
|
|
260
|
+
}
|
|
212
261
|
interface IWorkspaceAddressDTO {
|
|
213
262
|
line1: string;
|
|
214
263
|
line2: string;
|
|
@@ -683,12 +732,21 @@ declare class BillingClient {
|
|
|
683
732
|
updatePlan(planId: string, input: IUpdatePlanInput): Promise<IApiResponse<IPlanResult>>;
|
|
684
733
|
deletePlan(planId: string): Promise<IApiResponse<undefined>>;
|
|
685
734
|
getSubscription(opts?: IReadOptions): Promise<IApiResponse<ISubscriptionResult>>;
|
|
735
|
+
cancelSubscription(input?: ICancelSubscriptionInput): Promise<IApiResponse<ISubscriptionChangeResult>>;
|
|
736
|
+
reactivateSubscription(): Promise<IApiResponse<ISubscriptionChangeResult>>;
|
|
686
737
|
createCheckoutSession(input: ICheckoutInput): Promise<IApiResponse<ICheckoutUrlResult>>;
|
|
687
738
|
createPortalSession(): Promise<IApiResponse<IPortalUrlResult>>;
|
|
688
739
|
recordUsage(input: IRecordUsageInput): Promise<IApiResponse<undefined>>;
|
|
689
740
|
getUsage(metric: string, opts?: IReadOptions): Promise<IApiResponse<IUsageResult>>;
|
|
690
741
|
getWallet(opts?: IReadOptions): Promise<IApiResponse<IWalletResult>>;
|
|
691
742
|
setWalletPreferences(input: IWalletPreferencesInput): Promise<IApiResponse<IWalletResult>>;
|
|
743
|
+
createWalletCheckout(input: IWalletCheckoutInput): Promise<IApiResponse<ICheckoutUrlResult>>;
|
|
744
|
+
getWalletTransactions(opts?: IReadOptions & {
|
|
745
|
+
cursor?: string;
|
|
746
|
+
limit?: number;
|
|
747
|
+
}): Promise<IApiResponse<IWalletTransactionsResult>>;
|
|
748
|
+
getPaymentMethod(opts?: IReadOptions): Promise<IApiResponse<IPaymentMethodResult>>;
|
|
749
|
+
listInvoices(opts?: IReadOptions): Promise<IApiResponse<IInvoicesResult>>;
|
|
692
750
|
}
|
|
693
751
|
|
|
694
752
|
interface IListCustomersInput {
|
|
@@ -1023,4 +1081,4 @@ declare class CourierAdminClient {
|
|
|
1023
1081
|
rollback(type: string, input: IRollbackTemplateInput, locale?: string | null): Promise<IApiResponse<ITemplateEntry>>;
|
|
1024
1082
|
}
|
|
1025
1083
|
|
|
1026
|
-
export { AuditClient, AuthClient, BillingClient, ConfigAdminClient, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IApiError, type IApiResponse, type IAuditEventDTO, type IAuditPageResult, type IBlacklistCustomerInput, type ICache, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginInput, type ILoginResult, type IMeResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRequestConfig, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletDTO, type IWalletPreferencesInput, type IWalletResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, type SubscriberType, WebhooksClient, WorkspacesClient, createMemoryCache, isMfaRequired };
|
|
1084
|
+
export { AuditClient, AuthClient, BillingClient, ConfigAdminClient, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IApiError, type IApiResponse, type IAuditEventDTO, type IAuditPageResult, type IBlacklistCustomerInput, type ICache, type ICancelSubscriptionInput, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IInvoiceDTO, type IInvoicesResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginInput, type ILoginResult, type IMeResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPaymentMethodDTO, type IPaymentMethodResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRequestConfig, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionChangeResult, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletCheckoutInput, type IWalletDTO, type IWalletPreferencesInput, type IWalletResult, type IWalletTransactionDTO, type IWalletTransactionsResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, type SubscriberType, WebhooksClient, WorkspacesClient, createMemoryCache, isMfaRequired };
|
package/dist/index.d.ts
CHANGED
|
@@ -209,6 +209,55 @@ interface IWalletDTO {
|
|
|
209
209
|
interface IWalletResult {
|
|
210
210
|
wallet: IWalletDTO;
|
|
211
211
|
}
|
|
212
|
+
interface IWalletTransactionDTO {
|
|
213
|
+
id: string;
|
|
214
|
+
type: string;
|
|
215
|
+
amount: string;
|
|
216
|
+
balanceAfter: string;
|
|
217
|
+
currency: string;
|
|
218
|
+
description: string | null;
|
|
219
|
+
providerTxId: string | null;
|
|
220
|
+
metadata: Record<string, unknown>;
|
|
221
|
+
createdAt: string;
|
|
222
|
+
}
|
|
223
|
+
interface IWalletTransactionsResult {
|
|
224
|
+
transactions: IWalletTransactionDTO[];
|
|
225
|
+
nextCursor: string | null;
|
|
226
|
+
}
|
|
227
|
+
interface IWalletCheckoutInput {
|
|
228
|
+
packId: string;
|
|
229
|
+
}
|
|
230
|
+
interface ICancelSubscriptionInput {
|
|
231
|
+
atPeriodEnd?: boolean;
|
|
232
|
+
}
|
|
233
|
+
interface ISubscriptionChangeResult {
|
|
234
|
+
atPeriodEnd: boolean;
|
|
235
|
+
status: string;
|
|
236
|
+
currentPeriodEnd: string | null;
|
|
237
|
+
}
|
|
238
|
+
interface IPaymentMethodDTO {
|
|
239
|
+
brand: string;
|
|
240
|
+
last4: string;
|
|
241
|
+
expMonth: number;
|
|
242
|
+
expYear: number;
|
|
243
|
+
}
|
|
244
|
+
interface IPaymentMethodResult {
|
|
245
|
+
paymentMethod: IPaymentMethodDTO | null;
|
|
246
|
+
}
|
|
247
|
+
interface IInvoiceDTO {
|
|
248
|
+
id: string;
|
|
249
|
+
number: string | null;
|
|
250
|
+
amountDue: string;
|
|
251
|
+
amountPaid: string;
|
|
252
|
+
currency: string;
|
|
253
|
+
status: string;
|
|
254
|
+
created: string;
|
|
255
|
+
hostedInvoiceUrl: string | null;
|
|
256
|
+
invoicePdf: string | null;
|
|
257
|
+
}
|
|
258
|
+
interface IInvoicesResult {
|
|
259
|
+
invoices: IInvoiceDTO[];
|
|
260
|
+
}
|
|
212
261
|
interface IWorkspaceAddressDTO {
|
|
213
262
|
line1: string;
|
|
214
263
|
line2: string;
|
|
@@ -683,12 +732,21 @@ declare class BillingClient {
|
|
|
683
732
|
updatePlan(planId: string, input: IUpdatePlanInput): Promise<IApiResponse<IPlanResult>>;
|
|
684
733
|
deletePlan(planId: string): Promise<IApiResponse<undefined>>;
|
|
685
734
|
getSubscription(opts?: IReadOptions): Promise<IApiResponse<ISubscriptionResult>>;
|
|
735
|
+
cancelSubscription(input?: ICancelSubscriptionInput): Promise<IApiResponse<ISubscriptionChangeResult>>;
|
|
736
|
+
reactivateSubscription(): Promise<IApiResponse<ISubscriptionChangeResult>>;
|
|
686
737
|
createCheckoutSession(input: ICheckoutInput): Promise<IApiResponse<ICheckoutUrlResult>>;
|
|
687
738
|
createPortalSession(): Promise<IApiResponse<IPortalUrlResult>>;
|
|
688
739
|
recordUsage(input: IRecordUsageInput): Promise<IApiResponse<undefined>>;
|
|
689
740
|
getUsage(metric: string, opts?: IReadOptions): Promise<IApiResponse<IUsageResult>>;
|
|
690
741
|
getWallet(opts?: IReadOptions): Promise<IApiResponse<IWalletResult>>;
|
|
691
742
|
setWalletPreferences(input: IWalletPreferencesInput): Promise<IApiResponse<IWalletResult>>;
|
|
743
|
+
createWalletCheckout(input: IWalletCheckoutInput): Promise<IApiResponse<ICheckoutUrlResult>>;
|
|
744
|
+
getWalletTransactions(opts?: IReadOptions & {
|
|
745
|
+
cursor?: string;
|
|
746
|
+
limit?: number;
|
|
747
|
+
}): Promise<IApiResponse<IWalletTransactionsResult>>;
|
|
748
|
+
getPaymentMethod(opts?: IReadOptions): Promise<IApiResponse<IPaymentMethodResult>>;
|
|
749
|
+
listInvoices(opts?: IReadOptions): Promise<IApiResponse<IInvoicesResult>>;
|
|
692
750
|
}
|
|
693
751
|
|
|
694
752
|
interface IListCustomersInput {
|
|
@@ -1023,4 +1081,4 @@ declare class CourierAdminClient {
|
|
|
1023
1081
|
rollback(type: string, input: IRollbackTemplateInput, locale?: string | null): Promise<IApiResponse<ITemplateEntry>>;
|
|
1024
1082
|
}
|
|
1025
1083
|
|
|
1026
|
-
export { AuditClient, AuthClient, BillingClient, ConfigAdminClient, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IApiError, type IApiResponse, type IAuditEventDTO, type IAuditPageResult, type IBlacklistCustomerInput, type ICache, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginInput, type ILoginResult, type IMeResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRequestConfig, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletDTO, type IWalletPreferencesInput, type IWalletResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, type SubscriberType, WebhooksClient, WorkspacesClient, createMemoryCache, isMfaRequired };
|
|
1084
|
+
export { AuditClient, AuthClient, BillingClient, ConfigAdminClient, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IApiError, type IApiResponse, type IAuditEventDTO, type IAuditPageResult, type IBlacklistCustomerInput, type ICache, type ICancelSubscriptionInput, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IInvoiceDTO, type IInvoicesResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginInput, type ILoginResult, type IMeResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPaymentMethodDTO, type IPaymentMethodResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRequestConfig, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionChangeResult, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletCheckoutInput, type IWalletDTO, type IWalletPreferencesInput, type IWalletResult, type IWalletTransactionDTO, type IWalletTransactionsResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, type SubscriberType, WebhooksClient, WorkspacesClient, createMemoryCache, isMfaRequired };
|
package/dist/index.js
CHANGED
|
@@ -419,6 +419,28 @@ var BillingClient = class {
|
|
|
419
419
|
bust: opts?.bust
|
|
420
420
|
});
|
|
421
421
|
}
|
|
422
|
+
// First-party cancel — no portal round-trip. Default keeps access until the
|
|
423
|
+
// paid-through date; pass { atPeriodEnd: false } to end it immediately. 501
|
|
424
|
+
// when the provider has no first-party cancel (the portal remains a fallback).
|
|
425
|
+
cancelSubscription(input) {
|
|
426
|
+
return this.http.request({
|
|
427
|
+
method: "POST",
|
|
428
|
+
path: "/billing/subscription/cancel",
|
|
429
|
+
body: input ?? {},
|
|
430
|
+
token: this.tokens.get(),
|
|
431
|
+
workspaceId: this.workspaceId
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
// Un-cancel a subscription scheduled to cancel at period end. Idempotent; 409
|
|
435
|
+
// when the subscription is already fully canceled (start a new checkout).
|
|
436
|
+
reactivateSubscription() {
|
|
437
|
+
return this.http.request({
|
|
438
|
+
method: "POST",
|
|
439
|
+
path: "/billing/subscription/reactivate",
|
|
440
|
+
token: this.tokens.get(),
|
|
441
|
+
workspaceId: this.workspaceId
|
|
442
|
+
});
|
|
443
|
+
}
|
|
422
444
|
// ── Checkout / portal ────────────────────────────────────────────────────────
|
|
423
445
|
createCheckoutSession(input) {
|
|
424
446
|
return this.http.request({
|
|
@@ -475,6 +497,55 @@ var BillingClient = class {
|
|
|
475
497
|
workspaceId: this.workspaceId
|
|
476
498
|
});
|
|
477
499
|
}
|
|
500
|
+
// Start a one-time credit-pack purchase. Returns a hosted checkout URL to
|
|
501
|
+
// redirect the buyer to; the wallet is credited by the payment webhook.
|
|
502
|
+
createWalletCheckout(input) {
|
|
503
|
+
return this.http.request({
|
|
504
|
+
method: "POST",
|
|
505
|
+
path: "/billing/wallet/checkout",
|
|
506
|
+
body: input,
|
|
507
|
+
token: this.tokens.get(),
|
|
508
|
+
workspaceId: this.workspaceId
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
// The wallet ledger, newest first — every credit/debit with a running
|
|
512
|
+
// balanceAfter. Cursor-paginated: pass the previous result's `nextCursor`.
|
|
513
|
+
getWalletTransactions(opts) {
|
|
514
|
+
const params = new URLSearchParams();
|
|
515
|
+
if (opts?.cursor) params.set("cursor", opts.cursor);
|
|
516
|
+
if (opts?.limit !== void 0) params.set("limit", String(opts.limit));
|
|
517
|
+
const qs = params.toString();
|
|
518
|
+
return this.http.request({
|
|
519
|
+
method: "GET",
|
|
520
|
+
path: `/billing/wallet/transactions${qs ? "?" + qs : ""}`,
|
|
521
|
+
token: this.tokens.get(),
|
|
522
|
+
workspaceId: this.workspaceId,
|
|
523
|
+
bust: opts?.bust
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
// ── Account ──────────────────────────────────────────────────────────────────
|
|
527
|
+
// The customer's card on file (brand/last4/expiry), or { paymentMethod: null }
|
|
528
|
+
// when none is stored. 501 when the provider can't retrieve it.
|
|
529
|
+
getPaymentMethod(opts) {
|
|
530
|
+
return this.http.request({
|
|
531
|
+
method: "GET",
|
|
532
|
+
path: "/billing/payment-method",
|
|
533
|
+
token: this.tokens.get(),
|
|
534
|
+
workspaceId: this.workspaceId,
|
|
535
|
+
bust: opts?.bust
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
// The customer's invoices, newest first — each links out to the hosted
|
|
539
|
+
// invoice / PDF. 501 when the provider can't list them.
|
|
540
|
+
listInvoices(opts) {
|
|
541
|
+
return this.http.request({
|
|
542
|
+
method: "GET",
|
|
543
|
+
path: "/billing/invoices",
|
|
544
|
+
token: this.tokens.get(),
|
|
545
|
+
workspaceId: this.workspaceId,
|
|
546
|
+
bust: opts?.bust
|
|
547
|
+
});
|
|
548
|
+
}
|
|
478
549
|
};
|
|
479
550
|
|
|
480
551
|
// src/modules/customers.ts
|