@fonderie/client 0.11.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 +84 -0
- package/dist/index.cjs +90 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +76 -1
- package/dist/index.d.ts +76 -1
- package/dist/index.js +90 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -197,6 +197,67 @@ interface IUsageResult {
|
|
|
197
197
|
total: number;
|
|
198
198
|
since: string;
|
|
199
199
|
}
|
|
200
|
+
interface IWalletDTO {
|
|
201
|
+
balance: string;
|
|
202
|
+
currency: string;
|
|
203
|
+
precision: number;
|
|
204
|
+
granted?: string;
|
|
205
|
+
purchased?: string;
|
|
206
|
+
spendPurchased?: boolean;
|
|
207
|
+
grantedExpiresAt?: string | null;
|
|
208
|
+
}
|
|
209
|
+
interface IWalletResult {
|
|
210
|
+
wallet: IWalletDTO;
|
|
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
|
+
}
|
|
200
261
|
interface IWorkspaceAddressDTO {
|
|
201
262
|
line1: string;
|
|
202
263
|
line2: string;
|
|
@@ -641,6 +702,9 @@ interface IRecordUsageInput {
|
|
|
641
702
|
metric: string;
|
|
642
703
|
quantity?: number;
|
|
643
704
|
}
|
|
705
|
+
interface IWalletPreferencesInput {
|
|
706
|
+
spendPurchased: boolean;
|
|
707
|
+
}
|
|
644
708
|
interface ICreatePlanInput {
|
|
645
709
|
name: string;
|
|
646
710
|
description?: string | null;
|
|
@@ -668,10 +732,21 @@ declare class BillingClient {
|
|
|
668
732
|
updatePlan(planId: string, input: IUpdatePlanInput): Promise<IApiResponse<IPlanResult>>;
|
|
669
733
|
deletePlan(planId: string): Promise<IApiResponse<undefined>>;
|
|
670
734
|
getSubscription(opts?: IReadOptions): Promise<IApiResponse<ISubscriptionResult>>;
|
|
735
|
+
cancelSubscription(input?: ICancelSubscriptionInput): Promise<IApiResponse<ISubscriptionChangeResult>>;
|
|
736
|
+
reactivateSubscription(): Promise<IApiResponse<ISubscriptionChangeResult>>;
|
|
671
737
|
createCheckoutSession(input: ICheckoutInput): Promise<IApiResponse<ICheckoutUrlResult>>;
|
|
672
738
|
createPortalSession(): Promise<IApiResponse<IPortalUrlResult>>;
|
|
673
739
|
recordUsage(input: IRecordUsageInput): Promise<IApiResponse<undefined>>;
|
|
674
740
|
getUsage(metric: string, opts?: IReadOptions): Promise<IApiResponse<IUsageResult>>;
|
|
741
|
+
getWallet(opts?: IReadOptions): Promise<IApiResponse<IWalletResult>>;
|
|
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>>;
|
|
675
750
|
}
|
|
676
751
|
|
|
677
752
|
interface IListCustomersInput {
|
|
@@ -1006,4 +1081,4 @@ declare class CourierAdminClient {
|
|
|
1006
1081
|
rollback(type: string, input: IRollbackTemplateInput, locale?: string | null): Promise<IApiResponse<ITemplateEntry>>;
|
|
1007
1082
|
}
|
|
1008
1083
|
|
|
1009
|
-
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 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
|
@@ -197,6 +197,67 @@ interface IUsageResult {
|
|
|
197
197
|
total: number;
|
|
198
198
|
since: string;
|
|
199
199
|
}
|
|
200
|
+
interface IWalletDTO {
|
|
201
|
+
balance: string;
|
|
202
|
+
currency: string;
|
|
203
|
+
precision: number;
|
|
204
|
+
granted?: string;
|
|
205
|
+
purchased?: string;
|
|
206
|
+
spendPurchased?: boolean;
|
|
207
|
+
grantedExpiresAt?: string | null;
|
|
208
|
+
}
|
|
209
|
+
interface IWalletResult {
|
|
210
|
+
wallet: IWalletDTO;
|
|
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
|
+
}
|
|
200
261
|
interface IWorkspaceAddressDTO {
|
|
201
262
|
line1: string;
|
|
202
263
|
line2: string;
|
|
@@ -641,6 +702,9 @@ interface IRecordUsageInput {
|
|
|
641
702
|
metric: string;
|
|
642
703
|
quantity?: number;
|
|
643
704
|
}
|
|
705
|
+
interface IWalletPreferencesInput {
|
|
706
|
+
spendPurchased: boolean;
|
|
707
|
+
}
|
|
644
708
|
interface ICreatePlanInput {
|
|
645
709
|
name: string;
|
|
646
710
|
description?: string | null;
|
|
@@ -668,10 +732,21 @@ declare class BillingClient {
|
|
|
668
732
|
updatePlan(planId: string, input: IUpdatePlanInput): Promise<IApiResponse<IPlanResult>>;
|
|
669
733
|
deletePlan(planId: string): Promise<IApiResponse<undefined>>;
|
|
670
734
|
getSubscription(opts?: IReadOptions): Promise<IApiResponse<ISubscriptionResult>>;
|
|
735
|
+
cancelSubscription(input?: ICancelSubscriptionInput): Promise<IApiResponse<ISubscriptionChangeResult>>;
|
|
736
|
+
reactivateSubscription(): Promise<IApiResponse<ISubscriptionChangeResult>>;
|
|
671
737
|
createCheckoutSession(input: ICheckoutInput): Promise<IApiResponse<ICheckoutUrlResult>>;
|
|
672
738
|
createPortalSession(): Promise<IApiResponse<IPortalUrlResult>>;
|
|
673
739
|
recordUsage(input: IRecordUsageInput): Promise<IApiResponse<undefined>>;
|
|
674
740
|
getUsage(metric: string, opts?: IReadOptions): Promise<IApiResponse<IUsageResult>>;
|
|
741
|
+
getWallet(opts?: IReadOptions): Promise<IApiResponse<IWalletResult>>;
|
|
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>>;
|
|
675
750
|
}
|
|
676
751
|
|
|
677
752
|
interface IListCustomersInput {
|
|
@@ -1006,4 +1081,4 @@ declare class CourierAdminClient {
|
|
|
1006
1081
|
rollback(type: string, input: IRollbackTemplateInput, locale?: string | null): Promise<IApiResponse<ITemplateEntry>>;
|
|
1007
1082
|
}
|
|
1008
1083
|
|
|
1009
|
-
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 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({
|
|
@@ -456,6 +478,74 @@ var BillingClient = class {
|
|
|
456
478
|
bust: opts?.bust
|
|
457
479
|
});
|
|
458
480
|
}
|
|
481
|
+
// ── Wallet ─────────────────────────────────────────────────────────────────────
|
|
482
|
+
getWallet(opts) {
|
|
483
|
+
return this.http.request({
|
|
484
|
+
method: "GET",
|
|
485
|
+
path: "/billing/wallet",
|
|
486
|
+
token: this.tokens.get(),
|
|
487
|
+
workspaceId: this.workspaceId,
|
|
488
|
+
bust: opts?.bust
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
setWalletPreferences(input) {
|
|
492
|
+
return this.http.request({
|
|
493
|
+
method: "POST",
|
|
494
|
+
path: "/billing/wallet/preferences",
|
|
495
|
+
body: input,
|
|
496
|
+
token: this.tokens.get(),
|
|
497
|
+
workspaceId: this.workspaceId
|
|
498
|
+
});
|
|
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
|
+
}
|
|
459
549
|
};
|
|
460
550
|
|
|
461
551
|
// src/modules/customers.ts
|