@boelabs/billete-sdk 2.0.0 → 3.0.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 +3 -3
- package/dist/client.d.ts +9 -4
- package/dist/client.js +12 -2
- package/dist/{errors-Cu8XMn5I.d.ts → errors-BRQlJDjy.d.ts} +69 -7
- package/dist/{events-CrmMdwBX.d.ts → events-rtkF8fBQ.d.ts} +16 -2
- package/dist/{http-CgBMbPS2.js → http-PMxK43GM.js} +1 -1
- package/dist/index.d.ts +8 -6
- package/dist/index.js +6 -2
- package/dist/webhooks.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ Crea una clave secreta en el dashboard (**Desarrolladores → Claves API**) y gu
|
|
|
62
62
|
```ts
|
|
63
63
|
import { createBillete } from "@boelabs/billete-sdk";
|
|
64
64
|
|
|
65
|
-
const billete = createBillete({ apiVersion: "2026-10-
|
|
65
|
+
const billete = createBillete({ apiVersion: "2026-10-09", environment: "test" });
|
|
66
66
|
|
|
67
67
|
const checkout = await billete.checkouts.create({
|
|
68
68
|
plan: "plan_…",
|
|
@@ -90,7 +90,7 @@ solicite expresamente. En carritos, solo ofrece los demás métodos que todos lo
|
|
|
90
90
|
|
|
91
91
|
```ts
|
|
92
92
|
const billete = createBillete({
|
|
93
|
-
apiVersion: "2026-10-
|
|
93
|
+
apiVersion: "2026-10-09",
|
|
94
94
|
environment: "production",
|
|
95
95
|
apiKey: process.env.BILLETE_API_KEY,
|
|
96
96
|
timeoutMs: 30_000,
|
|
@@ -256,7 +256,7 @@ return { token: session.token };
|
|
|
256
256
|
// Navegador
|
|
257
257
|
import { createClient } from "@boelabs/billete-sdk/client";
|
|
258
258
|
|
|
259
|
-
const billete = createClient({ apiVersion: "2026-10-
|
|
259
|
+
const billete = createClient({ apiVersion: "2026-10-09", customerSession: token });
|
|
260
260
|
|
|
261
261
|
const { data: subscriptions } = await billete.customer.subscriptions();
|
|
262
262
|
const tokens = await billete.customer.feature("tokens");
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $ as PRODUCT_CATEGORIES, $t as ListQuery, A as ExchangeRate, At as SubscriptionTerms, B as Fulfillment, Bt as PAYMENT_FAILURE_CODES, C as Customer, Ct as SubmitLabel, D as CustomerMemberList, Dt as SubscriptionChangeResult, E as CustomerMember, Et as SubscriptionChangePreview, F as FeatureOperation, Ft as ReceiptSend, G as INVOICE_REASONS, Gt as BILLING_MONTHS, H as FulfillmentMethod, Ht as ACCOUNT_NUMBER_LENGTH, I as FeatureOperationResult, It as API_ERROR_TYPES, J as InvoiceReason, Jt as CURRENCIES, K as INVOICE_STATUSES, Kt as BankCode, L as FeatureReset, Lt as ApiErrorBody, M as FULFILLMENT_METHODS, Mt as WebhookEndpoint, N as FULFILLMENT_STATUSES, Nt as Weekday, O as CustomerSession, Ot as SubscriptionRenewal, P as Feature, Pt as ReceiptReference, Q as PAYMENT_STATUSES, Qt as List, R as FeatureType, Rt as ApiErrorEnvelope, S as CustomField, St as SUBSCRIPTION_STATUSES, T as CustomerFeature, Tt as SubscriptionChange, U as FulfillmentStatus, Ut as Address, V as FulfillmentChoice, Vt as PaymentFailureCode, W as FulfillmentTracking, Wt as AddressInput, X as LineItem, Xt as GRACE_PERIOD_DAYS, Y as InvoiceStatus, Yt as Currency, Z as MAX_SEATS, Zt as GracePeriodDays, _ as CheckoutItem, _n as tokenPrefix, _t as Refund, a as Actor, an as TAX_BEHAVIORS, at as PaymentStatus, b as Coupon, bt as RiskLevel, c as BalanceAmount, cn as VENEZUELAN_BANKS, ct as PlanFeatureValues, d as CARRIER_TEST_SCENARIOS, dn as isMobilePhone, dt as PortalSession, en as ListSort, et as Payment, f as CHECKOUT_PURPOSES, fn as nationalPhone, ft as Product, g as Checkout, gn as tokenEnvironment, gt as RISK_LEVELS, h as CarrierOffice, hn as TokenKind, ht as RESET_FREQUENCIES, i as WebhookEvent, in as MobilePrefix, it as PaymentSettlement, j as FEATURE_TYPES, jt as USAGE_FEATURE_TYPES, k as Event, kt as SubscriptionStatus, l as CANCELLATION_FEEDBACK, ln as findBank, lt as PlanPrice, m as Carrier, mn as Environment, mt as ProductVariant, n as EventDataMap, nn as MOBILE_PREFIXES, nt as PaymentFailure, o as AfterCompletion, on as TaxBehavior, ot as Payout, p as CancellationFeedback, pn as ENVIRONMENTS, pt as ProductCategory, q as Invoice, qt as BillingMonths, r as EventType, rn as Metadata, rt as PaymentLink, s as Balance, sn as Timestamp, st as Plan, t as EVENT_TYPES, tn as MAX_QUANTITY, tt as PaymentAttempt, u as CARRIERS, un as isLandlinePhone, ut as PlanSeats, v as CheckoutPurpose, vt as ResetFrequency, w as CustomerDetails, wt as Subscription, x as CurrencyAvailability, xt as SUBMIT_LABELS, y as CollectSettings, yt as Retirement, z as FeatureUsageResult, zt as ApiErrorType } from "./events-
|
|
1
|
+
import { $ as SubscriptionChangePreviewInput, A as FeatureUpdate, At as currentApiVersion, B as PlanFeaturesInput, C as CustomerMemberUpdate, Ct as ApiVersion, D as FeatureCreate, Dt as LatestApiVersion, E as EventSelector, Et as LATEST_API_VERSION, F as KEY_PATTERN, G as ProductCheckoutCreate, H as PlanPriceInput, I as PaymentLinkCreate, J as ProductUpdate, K as ProductCreate, L as PaymentLinkUpdate, M as FulfillmentTrackingInput, Mt as isApiVersionRetired, N as InvoiceCreate, Nt as supportedApiVersions, O as FeatureOperationCommit, Ot as apiVersionLifecycle, P as InvoiceLineInput, Q as SubscriptionChangeCreate, R as PlanCheckoutCreate, S as CustomerMemberCreate, St as API_VERSION_PATTERN, T as CustomerUpdate, Tt as ApiVersionStage, U as PlanUpdate, V as PlanLinkCreate, W as PortalSessionCreate, X as RetireInput, Y as RefundCreate, Z as SubscriptionCancel, _ as CouponCreate, _t as PublicPaymentLink, a as CheckoutCreate, at as CustomerSubscription, b as CustomerCreate, bt as API_VERSIONS, c as ClientCheckoutUpdate, ct as PaymentInstructions, d as ClientLinkCheckout, dt as PaymentNextAction, et as SubscriptionCreate, f as ClientPaymentCode, ft as PaymentTestScenario, g as CollectInput, gt as PublicInvoice, h as ClientSubscriptionUpdate, ht as PublicFulfillment, i as AfterCompletionInput, it as WebhookEndpointUpdate, j as FulfillmentInput, jt as isApiVersion, k as FeatureOperationCreate, kt as apiVersionStage, l as ClientFulfillmentProblem, lt as PaymentMethodField, m as ClientSubscriptionSeats, mt as PublicCheckout, n as RequestOptions, nt as VariantInput, o as CheckoutItemInput, ot as CustomerSubscriptionChangeResult, p as ClientSubscriptionCancel, pt as PortalFeatures, q as ProductLinkCreate, r as TransportOptions, rt as WebhookEndpointCreate, s as ClientCheckoutPay, st as FulfillmentOption, t as BilleteError, tt as SubscriptionUpdate, u as ClientInvoicePay, ut as PaymentMethodOption, v as CouponUpdate, vt as PublicPaymentState, w as CustomerSessionCreate, wt as ApiVersionLifecycle, x as CustomerInput, xt as API_VERSION_HEADER, y as CustomFieldInput, yt as PublicPortal, z as PlanCreate } from "./errors-BRQlJDjy.js";
|
|
2
|
+
import { $ as PRODUCT_CATEGORIES, $t as ListQuery, A as ExchangeRate, At as SubscriptionTerms, B as Fulfillment, Bt as PAYMENT_FAILURE_CODES, C as Customer, Ct as SubmitLabel, D as CustomerMemberList, Dt as SubscriptionChangeResult, E as CustomerMember, Et as SubscriptionChangePreview, F as FeatureOperation, Ft as ReceiptSend, G as INVOICE_REASONS, Gt as BILLING_MONTHS, H as FulfillmentMethod, Ht as ACCOUNT_NUMBER_LENGTH, I as FeatureOperationResult, It as API_ERROR_TYPES, J as InvoiceReason, Jt as CURRENCIES, K as INVOICE_STATUSES, Kt as BankCode, L as FeatureReset, Lt as ApiErrorBody, M as FULFILLMENT_METHODS, Mt as WebhookEndpoint, N as FULFILLMENT_STATUSES, Nt as Weekday, O as CustomerSession, Ot as SubscriptionRenewal, P as Feature, Pt as ReceiptReference, Q as PAYMENT_STATUSES, Qt as List, R as FeatureType, Rt as ApiErrorEnvelope, S as CustomField, St as SUBSCRIPTION_STATUSES, T as CustomerFeature, Tt as SubscriptionChange, U as FulfillmentStatus, Ut as Address, V as FulfillmentChoice, Vt as PaymentFailureCode, W as FulfillmentTracking, Wt as AddressInput, X as LineItem, Xt as GRACE_PERIOD_DAYS, Y as InvoiceStatus, Yt as Currency, Z as MAX_SEATS, Zt as GracePeriodDays, _ as CheckoutItem, _n as tokenPrefix, _t as Refund, a as Actor, an as TAX_BEHAVIORS, at as PaymentStatus, b as Coupon, bt as RiskLevel, c as BalanceAmount, cn as VENEZUELAN_BANKS, ct as PlanFeatureValues, d as CARRIER_TEST_SCENARIOS, dn as isMobilePhone, dt as PortalSession, en as ListSort, et as Payment, f as CHECKOUT_PURPOSES, fn as nationalPhone, ft as Product, g as Checkout, gn as tokenEnvironment, gt as RISK_LEVELS, h as CarrierOffice, hn as TokenKind, ht as RESET_FREQUENCIES, i as WebhookEvent, in as MobilePrefix, it as PaymentSettlement, j as FEATURE_TYPES, jt as USAGE_FEATURE_TYPES, k as Event, kt as SubscriptionStatus, l as CANCELLATION_FEEDBACK, ln as findBank, lt as PlanPrice, m as Carrier, mn as Environment, mt as ProductVariant, n as EventDataMap, nn as MOBILE_PREFIXES, nt as PaymentFailure, o as AfterCompletion, on as TaxBehavior, ot as Payout, p as CancellationFeedback, pn as ENVIRONMENTS, pt as ProductCategory, q as Invoice, qt as BillingMonths, r as EventType, rn as Metadata, rt as PaymentLink, s as Balance, sn as Timestamp, st as Plan, t as EVENT_TYPES, tn as MAX_QUANTITY, tt as PaymentAttempt, u as CARRIERS, un as isLandlinePhone, ut as PlanSeats, v as CheckoutPurpose, vt as ResetFrequency, w as CustomerDetails, wt as Subscription, x as CurrencyAvailability, xt as SUBMIT_LABELS, y as CollectSettings, yt as Retirement, z as FeatureUsageResult, zt as ApiErrorType } from "./events-rtkF8fBQ.js";
|
|
3
3
|
//#region src/create-client.d.ts
|
|
4
4
|
interface ClientOptions extends TransportOptions {
|
|
5
5
|
/**
|
|
@@ -14,7 +14,7 @@ interface ClientOptions extends TransportOptions {
|
|
|
14
14
|
* and customer data requires a short-lived customer session minted by your server.
|
|
15
15
|
*
|
|
16
16
|
* ```ts
|
|
17
|
-
* const billete = createClient({ apiVersion: "2026-10-
|
|
17
|
+
* const billete = createClient({ apiVersion: "2026-10-09", customerSession: token });
|
|
18
18
|
* const [subscription] = (await billete.customer.subscriptions()).data;
|
|
19
19
|
* if (subscription?.renewal?.status === "overdue") showBanner(subscription.renewal);
|
|
20
20
|
* ```
|
|
@@ -94,6 +94,11 @@ export declare function createClient(options: ClientOptions): {
|
|
|
94
94
|
resumeSubscription: (id: string, options?: RequestOptions) => Promise<CustomerSubscription>;
|
|
95
95
|
/** Switches the billing cycle from the next renewal. */
|
|
96
96
|
updateSubscription: (id: string, input: ClientSubscriptionUpdate, options?: RequestOptions) => Promise<CustomerSubscription>;
|
|
97
|
+
/**
|
|
98
|
+
* Buys more seats now, paid in the checkout it returns (`type: "checkout"`), or leaves fewer
|
|
99
|
+
* from the next renewal; during a trial both apply now. Only for plans charged per seat.
|
|
100
|
+
*/
|
|
101
|
+
changeSeats: (id: string, input: ClientSubscriptionSeats, options?: RequestOptions) => Promise<CustomerSubscriptionChangeResult>;
|
|
97
102
|
/** Withdraws the mandate: renewals are then paid by hand from their Cobro. */
|
|
98
103
|
stopAutoCharge: (id: string, options?: RequestOptions) => Promise<CustomerSubscription>;
|
|
99
104
|
features: (options?: RequestOptions) => Promise<List<CustomerFeature>>;
|
|
@@ -102,4 +107,4 @@ export declare function createClient(options: ClientOptions): {
|
|
|
102
107
|
};
|
|
103
108
|
type BilleteClient = ReturnType<typeof createClient>;
|
|
104
109
|
//#endregion
|
|
105
|
-
export { type ACCOUNT_NUMBER_LENGTH, type API_ERROR_TYPES, type API_VERSIONS, type API_VERSION_HEADER, type API_VERSION_PATTERN, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorEnvelope, type ApiErrorType, type ApiVersion, type ApiVersionLifecycle, type ApiVersionStage, type BILLING_MONTHS, type Balance, type BalanceAmount, type BankCode, type BilleteClient, BilleteError, type BillingMonths, type CANCELLATION_FEEDBACK, type CARRIERS, type CARRIER_TEST_SCENARIOS, type CHECKOUT_PURPOSES, type CURRENCIES, type CancellationFeedback, type Carrier, type CarrierOffice, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPurpose, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientFulfillmentProblem, type ClientInvoicePay, type ClientLinkCheckout, type ClientOptions, type ClientPaymentCode, type ClientSubscriptionCancel, type ClientSubscriptionUpdate, type CollectInput, type CollectSettings, type Coupon, type CouponCreate, type CouponUpdate, type Currency, type CurrencyAvailability, type CustomField, type CustomFieldInput, type Customer, type CustomerCreate, type CustomerDetails, type CustomerFeature, type CustomerInput, type CustomerMember, type CustomerMemberCreate, type CustomerMemberList, type CustomerMemberUpdate, type CustomerSession, type CustomerSessionCreate, type CustomerSubscription, type CustomerUpdate, type ENVIRONMENTS, type EVENT_TYPES, type Environment, type Event, type EventDataMap, type EventSelector, type EventType, type ExchangeRate, type FEATURE_TYPES, type FULFILLMENT_METHODS, type FULFILLMENT_STATUSES, type Feature, type FeatureCreate, type FeatureOperation, type FeatureOperationCommit, type FeatureOperationCreate, type FeatureOperationResult, type FeatureReset, type FeatureType, type FeatureUpdate, type FeatureUsageResult, type Fulfillment, type FulfillmentChoice, type FulfillmentInput, type FulfillmentMethod, type FulfillmentOption, type FulfillmentStatus, type FulfillmentTracking, type FulfillmentTrackingInput, type GRACE_PERIOD_DAYS, type GracePeriodDays, type INVOICE_REASONS, type INVOICE_STATUSES, type Invoice, type InvoiceCreate, type InvoiceLineInput, type InvoiceReason, type InvoiceStatus, type KEY_PATTERN, type LATEST_API_VERSION, type LatestApiVersion, type LineItem, type List, type ListQuery, type ListSort, type MAX_QUANTITY, type MAX_SEATS, type MOBILE_PREFIXES, type Metadata, type MobilePrefix, type PAYMENT_FAILURE_CODES, type PAYMENT_STATUSES, type PRODUCT_CATEGORIES, type Payment, type PaymentAttempt, type PaymentFailure, type PaymentFailureCode, type PaymentInstructions, type PaymentLink, type PaymentLinkCreate, type PaymentLinkUpdate, type PaymentMethodField, type PaymentMethodOption, type PaymentNextAction, type PaymentSettlement, type PaymentStatus, type PaymentTestScenario, type Payout, type Plan, type PlanCheckoutCreate, type PlanCreate, type PlanFeatureValues, type PlanFeaturesInput, type PlanLinkCreate, type PlanPrice, type PlanPriceInput, type PlanSeats, type PlanUpdate, type PortalFeatures, type PortalSession, type PortalSessionCreate, type Product, type ProductCategory, type ProductCheckoutCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicFulfillment, type PublicInvoice, type PublicPaymentLink, type PublicPaymentState, type PublicPortal, type RESET_FREQUENCIES, type RISK_LEVELS, type ReceiptReference, type ReceiptSend, type Refund, type RefundCreate, type RequestOptions, type ResetFrequency, type RetireInput, type Retirement, type RiskLevel, type SUBMIT_LABELS, type SUBSCRIPTION_STATUSES, type SubmitLabel, type Subscription, type SubscriptionCancel, type SubscriptionChange, type SubscriptionChangeCreate, type SubscriptionChangePreview, type SubscriptionChangePreviewInput, type SubscriptionChangeResult, type SubscriptionCreate, type SubscriptionRenewal, type SubscriptionStatus, type SubscriptionTerms, type SubscriptionUpdate, type TAX_BEHAVIORS, type TaxBehavior, type Timestamp, type TokenKind, type USAGE_FEATURE_TYPES, type VENEZUELAN_BANKS, type VariantInput, type WebhookEndpoint, type WebhookEndpointCreate, type WebhookEndpointUpdate, type WebhookEvent, type Weekday, type apiVersionLifecycle, type apiVersionStage, type currentApiVersion, type findBank, type isApiVersion, type isApiVersionRetired, type isLandlinePhone, type isMobilePhone, type nationalPhone, type supportedApiVersions, type tokenEnvironment, type tokenPrefix };
|
|
110
|
+
export { type ACCOUNT_NUMBER_LENGTH, type API_ERROR_TYPES, type API_VERSIONS, type API_VERSION_HEADER, type API_VERSION_PATTERN, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorEnvelope, type ApiErrorType, type ApiVersion, type ApiVersionLifecycle, type ApiVersionStage, type BILLING_MONTHS, type Balance, type BalanceAmount, type BankCode, type BilleteClient, BilleteError, type BillingMonths, type CANCELLATION_FEEDBACK, type CARRIERS, type CARRIER_TEST_SCENARIOS, type CHECKOUT_PURPOSES, type CURRENCIES, type CancellationFeedback, type Carrier, type CarrierOffice, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPurpose, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientFulfillmentProblem, type ClientInvoicePay, type ClientLinkCheckout, type ClientOptions, type ClientPaymentCode, type ClientSubscriptionCancel, type ClientSubscriptionSeats, type ClientSubscriptionUpdate, type CollectInput, type CollectSettings, type Coupon, type CouponCreate, type CouponUpdate, type Currency, type CurrencyAvailability, type CustomField, type CustomFieldInput, type Customer, type CustomerCreate, type CustomerDetails, type CustomerFeature, type CustomerInput, type CustomerMember, type CustomerMemberCreate, type CustomerMemberList, type CustomerMemberUpdate, type CustomerSession, type CustomerSessionCreate, type CustomerSubscription, type CustomerSubscriptionChangeResult, type CustomerUpdate, type ENVIRONMENTS, type EVENT_TYPES, type Environment, type Event, type EventDataMap, type EventSelector, type EventType, type ExchangeRate, type FEATURE_TYPES, type FULFILLMENT_METHODS, type FULFILLMENT_STATUSES, type Feature, type FeatureCreate, type FeatureOperation, type FeatureOperationCommit, type FeatureOperationCreate, type FeatureOperationResult, type FeatureReset, type FeatureType, type FeatureUpdate, type FeatureUsageResult, type Fulfillment, type FulfillmentChoice, type FulfillmentInput, type FulfillmentMethod, type FulfillmentOption, type FulfillmentStatus, type FulfillmentTracking, type FulfillmentTrackingInput, type GRACE_PERIOD_DAYS, type GracePeriodDays, type INVOICE_REASONS, type INVOICE_STATUSES, type Invoice, type InvoiceCreate, type InvoiceLineInput, type InvoiceReason, type InvoiceStatus, type KEY_PATTERN, type LATEST_API_VERSION, type LatestApiVersion, type LineItem, type List, type ListQuery, type ListSort, type MAX_QUANTITY, type MAX_SEATS, type MOBILE_PREFIXES, type Metadata, type MobilePrefix, type PAYMENT_FAILURE_CODES, type PAYMENT_STATUSES, type PRODUCT_CATEGORIES, type Payment, type PaymentAttempt, type PaymentFailure, type PaymentFailureCode, type PaymentInstructions, type PaymentLink, type PaymentLinkCreate, type PaymentLinkUpdate, type PaymentMethodField, type PaymentMethodOption, type PaymentNextAction, type PaymentSettlement, type PaymentStatus, type PaymentTestScenario, type Payout, type Plan, type PlanCheckoutCreate, type PlanCreate, type PlanFeatureValues, type PlanFeaturesInput, type PlanLinkCreate, type PlanPrice, type PlanPriceInput, type PlanSeats, type PlanUpdate, type PortalFeatures, type PortalSession, type PortalSessionCreate, type Product, type ProductCategory, type ProductCheckoutCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicFulfillment, type PublicInvoice, type PublicPaymentLink, type PublicPaymentState, type PublicPortal, type RESET_FREQUENCIES, type RISK_LEVELS, type ReceiptReference, type ReceiptSend, type Refund, type RefundCreate, type RequestOptions, type ResetFrequency, type RetireInput, type Retirement, type RiskLevel, type SUBMIT_LABELS, type SUBSCRIPTION_STATUSES, type SubmitLabel, type Subscription, type SubscriptionCancel, type SubscriptionChange, type SubscriptionChangeCreate, type SubscriptionChangePreview, type SubscriptionChangePreviewInput, type SubscriptionChangeResult, type SubscriptionCreate, type SubscriptionRenewal, type SubscriptionStatus, type SubscriptionTerms, type SubscriptionUpdate, type TAX_BEHAVIORS, type TaxBehavior, type Timestamp, type TokenKind, type USAGE_FEATURE_TYPES, type VENEZUELAN_BANKS, type VariantInput, type WebhookEndpoint, type WebhookEndpointCreate, type WebhookEndpointUpdate, type WebhookEvent, type Weekday, type apiVersionLifecycle, type apiVersionStage, type currentApiVersion, type findBank, type isApiVersion, type isApiVersionRetired, type isLandlinePhone, type isMobilePhone, type nationalPhone, type supportedApiVersions, type tokenEnvironment, type tokenPrefix };
|
package/dist/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as segment, r as BilleteError, t as createTransport } from "./http-
|
|
1
|
+
import { n as segment, r as BilleteError, t as createTransport } from "./http-PMxK43GM.js";
|
|
2
2
|
//#region src/create-client.ts
|
|
3
3
|
/**
|
|
4
4
|
* Browser client. It never holds a secret key: checkouts and Cobros are addressed by their
|
|
@@ -6,7 +6,7 @@ import { n as segment, r as BilleteError, t as createTransport } from "./http-Cg
|
|
|
6
6
|
* and customer data requires a short-lived customer session minted by your server.
|
|
7
7
|
*
|
|
8
8
|
* ```ts
|
|
9
|
-
* const billete = createClient({ apiVersion: "2026-10-
|
|
9
|
+
* const billete = createClient({ apiVersion: "2026-10-09", customerSession: token });
|
|
10
10
|
* const [subscription] = (await billete.customer.subscriptions()).data;
|
|
11
11
|
* if (subscription?.renewal?.status === "overdue") showBanner(subscription.renewal);
|
|
12
12
|
* ```
|
|
@@ -195,6 +195,16 @@ list: (options) => http.request({
|
|
|
195
195
|
body: input,
|
|
196
196
|
options
|
|
197
197
|
}),
|
|
198
|
+
/**
|
|
199
|
+
* Buys more seats now, paid in the checkout it returns (`type: "checkout"`), or leaves fewer
|
|
200
|
+
* from the next renewal; during a trial both apply now. Only for plans charged per seat.
|
|
201
|
+
*/
|
|
202
|
+
changeSeats: (id, input, options) => http.request({
|
|
203
|
+
method: "POST",
|
|
204
|
+
path: `/v1/client/customer/subscriptions/${segment(id)}/seats`,
|
|
205
|
+
body: input,
|
|
206
|
+
options
|
|
207
|
+
}),
|
|
198
208
|
/** Withdraws the mandate: renewals are then paid by hand from their Cobro. */
|
|
199
209
|
stopAutoCharge: (id, options) => http.request({
|
|
200
210
|
method: "POST",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as Fulfillment, Ct as SubmitLabel, H as FulfillmentMethod, J as InvoiceReason, L as FeatureReset, Lt as ApiErrorBody, Pt as ReceiptReference, S as CustomField, U as FulfillmentStatus, Ut as Address, W as FulfillmentTracking, Wt as AddressInput, X as LineItem, Y as InvoiceStatus, Yt as Currency, Zt as GracePeriodDays, _ as CheckoutItem, at as PaymentStatus, h as CarrierOffice, lt as PlanPrice, m as Carrier, mn as Environment, nt as PaymentFailure, o as AfterCompletion, on as TaxBehavior, p as CancellationFeedback, pt as ProductCategory, qt as BillingMonths, r as EventType, rn as Metadata, sn as Timestamp, ut as PlanSeats, v as CheckoutPurpose, w as CustomerDetails, wt as Subscription, y as CollectSettings, zt as ApiErrorType } from "./events-
|
|
1
|
+
import { B as Fulfillment, Ct as SubmitLabel, H as FulfillmentMethod, J as InvoiceReason, L as FeatureReset, Lt as ApiErrorBody, Pt as ReceiptReference, S as CustomField, U as FulfillmentStatus, Ut as Address, W as FulfillmentTracking, Wt as AddressInput, X as LineItem, Y as InvoiceStatus, Yt as Currency, Zt as GracePeriodDays, _ as CheckoutItem, at as PaymentStatus, h as CarrierOffice, lt as PlanPrice, m as Carrier, mn as Environment, nt as PaymentFailure, o as AfterCompletion, on as TaxBehavior, p as CancellationFeedback, pt as ProductCategory, qt as BillingMonths, r as EventType, rn as Metadata, sn as Timestamp, ut as PlanSeats, v as CheckoutPurpose, w as CustomerDetails, wt as Subscription, y as CollectSettings, zt as ApiErrorType } from "./events-rtkF8fBQ.js";
|
|
2
2
|
//#region ../contracts/src/api-versions.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Billete API versions. Kept free of runtime dependencies: the dashboard, the API, the worker and
|
|
@@ -10,7 +10,7 @@ import { B as Fulfillment, Ct as SubmitLabel, H as FulfillmentMethod, J as Invoi
|
|
|
10
10
|
* that is still supported.
|
|
11
11
|
*/
|
|
12
12
|
/** Every version ever published, oldest first. Append only: retired versions stay listed. */
|
|
13
|
-
declare const API_VERSIONS: readonly ["2026-10-07.beta", "2026-10-08"];
|
|
13
|
+
declare const API_VERSIONS: readonly ["2026-10-07.beta", "2026-10-08", "2026-10-09"];
|
|
14
14
|
type ApiVersion = (typeof API_VERSIONS)[number];
|
|
15
15
|
type LatestApiVersion = typeof API_VERSIONS extends readonly [...unknown[], infer Last] ? Last : never;
|
|
16
16
|
/** The version the code speaks: responses are built in its shape. Always the last entry. */
|
|
@@ -52,8 +52,20 @@ interface CustomerSubscription extends Omit<Subscription, "metadata"> {
|
|
|
52
52
|
plan: {
|
|
53
53
|
name: string;
|
|
54
54
|
cycles: PlanPrice[];
|
|
55
|
+
seats: PlanSeats;
|
|
55
56
|
};
|
|
56
57
|
}
|
|
58
|
+
/** What a customer's change from the portal did: applied, scheduled, or a checkout to pay it. */
|
|
59
|
+
type CustomerSubscriptionChangeResult = {
|
|
60
|
+
type: "applied" | "scheduled";
|
|
61
|
+
subscription: CustomerSubscription;
|
|
62
|
+
} | {
|
|
63
|
+
type: "checkout";
|
|
64
|
+
checkout: {
|
|
65
|
+
id: string;
|
|
66
|
+
url: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
57
69
|
/** What the business lets its customers do from the portal. */
|
|
58
70
|
interface PortalFeatures {
|
|
59
71
|
/** Paid and closed Cobros are listed; open ones always are, so they can be paid. */
|
|
@@ -64,6 +76,8 @@ interface PortalFeatures {
|
|
|
64
76
|
cancellationReasons: boolean;
|
|
65
77
|
/** Switch between the plan's billing cycles, from the next renewal. */
|
|
66
78
|
switchCycle: boolean;
|
|
79
|
+
/** Buy more seats of a plan charged per seat, or fewer from the next renewal. */
|
|
80
|
+
changeSeats: boolean;
|
|
67
81
|
/** Turn off automatic charging and pay each renewal by hand. */
|
|
68
82
|
stopAutoCharge: boolean;
|
|
69
83
|
}
|
|
@@ -173,9 +187,14 @@ interface PublicCheckout {
|
|
|
173
187
|
trialDays: number | null;
|
|
174
188
|
couponCode: string | null;
|
|
175
189
|
allowCoupons: boolean;
|
|
176
|
-
/** The customer may change the quantity of the single item. */
|
|
190
|
+
/** The customer may change the quantity of the single item: units, or seats of a plan. */
|
|
177
191
|
adjustableQuantity: boolean;
|
|
178
|
-
/**
|
|
192
|
+
/** Fewest units the customer can choose: 1, or the plan's minimum seats. */
|
|
193
|
+
minQuantity: number;
|
|
194
|
+
/**
|
|
195
|
+
* Most units the customer can choose right now: the link's limit, capped by stock, or the
|
|
196
|
+
* plan's maximum seats.
|
|
197
|
+
*/
|
|
179
198
|
maxQuantity: number;
|
|
180
199
|
/**
|
|
181
200
|
* Variants the customer may switch between for a product checkout. `maxQuantity` is the most
|
|
@@ -394,9 +413,15 @@ interface PublicPaymentLink {
|
|
|
394
413
|
trialDays: number;
|
|
395
414
|
cycles: PlanPrice[];
|
|
396
415
|
} | null;
|
|
397
|
-
/**
|
|
416
|
+
/**
|
|
417
|
+
* The customer chooses how many units to buy, or how many seats of a plan charged per seat;
|
|
418
|
+
* otherwise every purchase is one unit, or the plan's minimum seats.
|
|
419
|
+
*/
|
|
398
420
|
adjustableQuantity: boolean;
|
|
399
|
-
/**
|
|
421
|
+
/**
|
|
422
|
+
* Most units (or seats) per purchase when `adjustableQuantity`; `null` leaves stock (or the
|
|
423
|
+
* plan's maximum) as the only limit.
|
|
424
|
+
*/
|
|
400
425
|
maxQuantity: number | null;
|
|
401
426
|
/** Effective required details; fulfillment adds name and phone to the saved preferences. */
|
|
402
427
|
collect: CollectSettings;
|
|
@@ -427,10 +452,16 @@ interface CustomerUpdate {
|
|
|
427
452
|
interface CustomerMemberCreate {
|
|
428
453
|
externalId: string;
|
|
429
454
|
name?: string;
|
|
455
|
+
/**
|
|
456
|
+
* Takes a seat before the others when there are fewer seats than active members (the
|
|
457
|
+
* organization's admin, say). Defaults to `false`.
|
|
458
|
+
*/
|
|
459
|
+
priority?: boolean;
|
|
430
460
|
metadata?: Metadata;
|
|
431
461
|
}
|
|
432
462
|
interface CustomerMemberUpdate {
|
|
433
463
|
name?: string | null;
|
|
464
|
+
priority?: boolean;
|
|
434
465
|
metadata?: Metadata;
|
|
435
466
|
}
|
|
436
467
|
interface FeatureOperationCreate {
|
|
@@ -581,9 +612,19 @@ interface SubscriptionChangePreviewInput {
|
|
|
581
612
|
plan?: string;
|
|
582
613
|
months?: BillingMonths;
|
|
583
614
|
quantity?: number;
|
|
615
|
+
/**
|
|
616
|
+
* During a trial a change made `now` applies at no cost and the trial goes on; `true` ends the
|
|
617
|
+
* trial instead and charges the new terms from today.
|
|
618
|
+
*/
|
|
619
|
+
endTrial?: boolean;
|
|
584
620
|
}
|
|
585
621
|
interface SubscriptionChangeCreate extends SubscriptionChangePreviewInput {
|
|
586
622
|
when: "now" | "renewal";
|
|
623
|
+
/**
|
|
624
|
+
* Accepts a change that leaves fewer seats than active members: the ones without a seat lose
|
|
625
|
+
* access (`enabled: false`) until seats free up. Otherwise it fails with `seats_in_use`.
|
|
626
|
+
*/
|
|
627
|
+
disableExcessMembers?: boolean;
|
|
587
628
|
acceptUnusedCredit?: boolean;
|
|
588
629
|
successUrl?: string;
|
|
589
630
|
cancelUrl?: string;
|
|
@@ -659,6 +700,13 @@ interface PlanLinkCreate extends PaymentLinkFields {
|
|
|
659
700
|
type: "plan";
|
|
660
701
|
plan: string;
|
|
661
702
|
months?: BillingMonths[];
|
|
703
|
+
/**
|
|
704
|
+
* Lets the customer choose how many seats to buy, within the plan's range; only for plans
|
|
705
|
+
* charged per seat. Defaults to the plan's minimum.
|
|
706
|
+
*/
|
|
707
|
+
adjustableQuantity?: boolean;
|
|
708
|
+
/** Most seats per purchase; only with `adjustableQuantity`. Omit to allow the plan's maximum. */
|
|
709
|
+
maxQuantity?: number;
|
|
662
710
|
}
|
|
663
711
|
type PaymentLinkCreate = ProductLinkCreate | PlanLinkCreate;
|
|
664
712
|
interface PaymentLinkUpdate {
|
|
@@ -694,7 +742,14 @@ interface ProductCheckoutCreate extends CheckoutFields {
|
|
|
694
742
|
items: CheckoutItemInput[];
|
|
695
743
|
}
|
|
696
744
|
interface PlanCheckoutCreate extends CheckoutFields {
|
|
745
|
+
/** Seats of a plan charged per seat; fixed unless `adjustableQuantity`. */
|
|
697
746
|
quantity?: number;
|
|
747
|
+
/**
|
|
748
|
+
* Lets the customer choose the seats in the checkout, within the plan's range, starting at
|
|
749
|
+
* `quantity` (or the plan's minimum). Defaults to `true` for a plan charged per seat when
|
|
750
|
+
* `quantity` is omitted.
|
|
751
|
+
*/
|
|
752
|
+
adjustableQuantity?: boolean;
|
|
698
753
|
plan: string;
|
|
699
754
|
months: BillingMonths;
|
|
700
755
|
}
|
|
@@ -772,6 +827,13 @@ interface PortalSessionCreate {
|
|
|
772
827
|
interface ClientSubscriptionUpdate {
|
|
773
828
|
months: BillingMonths;
|
|
774
829
|
}
|
|
830
|
+
/**
|
|
831
|
+
* The seats a customer wants from the portal: more are paid now for what is left of the period;
|
|
832
|
+
* fewer apply from the next renewal (during a trial, both apply now).
|
|
833
|
+
*/
|
|
834
|
+
interface ClientSubscriptionSeats {
|
|
835
|
+
quantity: number;
|
|
836
|
+
}
|
|
775
837
|
interface ClientCheckoutUpdate {
|
|
776
838
|
quantity?: number;
|
|
777
839
|
variant?: string;
|
|
@@ -859,4 +921,4 @@ declare class BilleteError extends Error {
|
|
|
859
921
|
}, status: number);
|
|
860
922
|
}
|
|
861
923
|
//#endregion
|
|
862
|
-
export {
|
|
924
|
+
export { SubscriptionChangePreviewInput as $, FeatureUpdate as A, currentApiVersion as At, PlanFeaturesInput as B, CustomerMemberUpdate as C, ApiVersion as Ct, FeatureCreate as D, LatestApiVersion as Dt, EventSelector as E, LATEST_API_VERSION as Et, KEY_PATTERN as F, ProductCheckoutCreate as G, PlanPriceInput as H, PaymentLinkCreate as I, ProductUpdate as J, ProductCreate as K, PaymentLinkUpdate as L, FulfillmentTrackingInput as M, isApiVersionRetired as Mt, InvoiceCreate as N, supportedApiVersions as Nt, FeatureOperationCommit as O, apiVersionLifecycle as Ot, InvoiceLineInput as P, SubscriptionChangeCreate as Q, PlanCheckoutCreate as R, CustomerMemberCreate as S, API_VERSION_PATTERN as St, CustomerUpdate as T, ApiVersionStage as Tt, PlanUpdate as U, PlanLinkCreate as V, PortalSessionCreate as W, RetireInput as X, RefundCreate as Y, SubscriptionCancel as Z, CouponCreate as _, PublicPaymentLink as _t, CheckoutCreate as a, CustomerSubscription as at, CustomerCreate as b, API_VERSIONS as bt, ClientCheckoutUpdate as c, PaymentInstructions as ct, ClientLinkCheckout as d, PaymentNextAction as dt, SubscriptionCreate as et, ClientPaymentCode as f, PaymentTestScenario as ft, CollectInput as g, PublicInvoice as gt, ClientSubscriptionUpdate as h, PublicFulfillment as ht, AfterCompletionInput as i, WebhookEndpointUpdate as it, FulfillmentInput as j, isApiVersion as jt, FeatureOperationCreate as k, apiVersionStage as kt, ClientFulfillmentProblem as l, PaymentMethodField as lt, ClientSubscriptionSeats as m, PublicCheckout as mt, RequestOptions as n, VariantInput as nt, CheckoutItemInput as o, CustomerSubscriptionChangeResult as ot, ClientSubscriptionCancel as p, PortalFeatures as pt, ProductLinkCreate as q, TransportOptions as r, WebhookEndpointCreate as rt, ClientCheckoutPay as s, FulfillmentOption as st, BilleteError as t, SubscriptionUpdate as tt, ClientInvoicePay as u, PaymentMethodOption as ut, CouponUpdate as v, PublicPaymentState as vt, CustomerSessionCreate as w, ApiVersionLifecycle as wt, CustomerInput as x, API_VERSION_HEADER as xt, CustomFieldInput as y, PublicPortal as yt, PlanCreate as z };
|
|
@@ -304,6 +304,9 @@ interface CustomerMember extends Resource<"customer_member"> {
|
|
|
304
304
|
externalId: string;
|
|
305
305
|
name: string | null;
|
|
306
306
|
status: "active" | "removed";
|
|
307
|
+
/** Takes a seat before members without priority; then the longest active go first. */
|
|
308
|
+
priority: boolean;
|
|
309
|
+
/** Active and within the seats: what the customer's subscriptions grant all add up. */
|
|
307
310
|
enabled: boolean;
|
|
308
311
|
activeSince: Timestamp;
|
|
309
312
|
removedAt: Timestamp | null;
|
|
@@ -590,9 +593,15 @@ interface PaymentLink extends Resource<"payment_link">, Retirement {
|
|
|
590
593
|
productId: string | null;
|
|
591
594
|
/** Variants offered for a product link; `null` offers every active variant. */
|
|
592
595
|
variantIds: string[] | null;
|
|
593
|
-
/**
|
|
596
|
+
/**
|
|
597
|
+
* The customer chooses how many units to buy, or how many seats of a plan charged per seat;
|
|
598
|
+
* otherwise every purchase is one unit, or the plan's minimum seats.
|
|
599
|
+
*/
|
|
594
600
|
adjustableQuantity: boolean;
|
|
595
|
-
/**
|
|
601
|
+
/**
|
|
602
|
+
* Most units (or seats) per purchase when `adjustableQuantity`; `null` leaves stock (or the
|
|
603
|
+
* plan's maximum) as the only limit.
|
|
604
|
+
*/
|
|
596
605
|
maxQuantity: number | null;
|
|
597
606
|
planId: string | null;
|
|
598
607
|
/** Billing cycles offered for a plan link; `null` offers every plan price. */
|
|
@@ -700,6 +709,11 @@ interface SubscriptionChangePreview {
|
|
|
700
709
|
version: number;
|
|
701
710
|
currentPeriodEnd: Timestamp;
|
|
702
711
|
periodEndIfPaidNow?: Timestamp;
|
|
712
|
+
/**
|
|
713
|
+
* Active members the change leaves without a seat: remove them first, or accept it with
|
|
714
|
+
* `disableExcessMembers`.
|
|
715
|
+
*/
|
|
716
|
+
excessMembers: number;
|
|
703
717
|
}
|
|
704
718
|
type SubscriptionChangeResult = {
|
|
705
719
|
type: "scheduled" | "applied";
|
|
@@ -18,7 +18,7 @@ var BilleteError = class extends Error {
|
|
|
18
18
|
};
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/http.ts
|
|
21
|
-
const SDK_VERSION = "
|
|
21
|
+
const SDK_VERSION = "3.0.0";
|
|
22
22
|
const DEFAULT_BASE_URL = "https://api.billete.run";
|
|
23
23
|
const RETRYABLE_STATUS = /* @__PURE__ */ new Set([
|
|
24
24
|
429,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $ as PRODUCT_CATEGORIES, $t as ListQuery, A as ExchangeRate, At as SubscriptionTerms, B as Fulfillment, Bt as PAYMENT_FAILURE_CODES, C as Customer, Ct as SubmitLabel, D as CustomerMemberList, Dt as SubscriptionChangeResult, E as CustomerMember, Et as SubscriptionChangePreview, F as FeatureOperation, Ft as ReceiptSend, G as INVOICE_REASONS, Gt as BILLING_MONTHS, H as FulfillmentMethod, Ht as ACCOUNT_NUMBER_LENGTH, I as FeatureOperationResult, It as API_ERROR_TYPES, J as InvoiceReason, Jt as CURRENCIES, K as INVOICE_STATUSES, Kt as BankCode, L as FeatureReset, Lt as ApiErrorBody, M as FULFILLMENT_METHODS, Mt as WebhookEndpoint, N as FULFILLMENT_STATUSES, Nt as Weekday, O as CustomerSession, Ot as SubscriptionRenewal, P as Feature, Pt as ReceiptReference, Q as PAYMENT_STATUSES, Qt as List, R as FeatureType, Rt as ApiErrorEnvelope, S as CustomField, St as SUBSCRIPTION_STATUSES, T as CustomerFeature, Tt as SubscriptionChange, U as FulfillmentStatus, Ut as Address, V as FulfillmentChoice, Vt as PaymentFailureCode, W as FulfillmentTracking, Wt as AddressInput, X as LineItem, Xt as GRACE_PERIOD_DAYS, Y as InvoiceStatus, Yt as Currency, Z as MAX_SEATS, Zt as GracePeriodDays, _ as CheckoutItem, _n as tokenPrefix, _t as Refund, a as Actor, an as TAX_BEHAVIORS, at as PaymentStatus, b as Coupon, bt as RiskLevel, c as BalanceAmount, cn as VENEZUELAN_BANKS, ct as PlanFeatureValues, d as CARRIER_TEST_SCENARIOS, dn as isMobilePhone, dt as PortalSession, en as ListSort, et as Payment, f as CHECKOUT_PURPOSES, fn as nationalPhone, ft as Product, g as Checkout, gn as tokenEnvironment, gt as RISK_LEVELS, h as CarrierOffice, hn as TokenKind, ht as RESET_FREQUENCIES, i as WebhookEvent, in as MobilePrefix, it as PaymentSettlement, j as FEATURE_TYPES, jt as USAGE_FEATURE_TYPES, k as Event, kt as SubscriptionStatus, l as CANCELLATION_FEEDBACK, ln as findBank, lt as PlanPrice, m as Carrier, mn as Environment, mt as ProductVariant, n as EventDataMap, nn as MOBILE_PREFIXES, nt as PaymentFailure, o as AfterCompletion, on as TaxBehavior, ot as Payout, p as CancellationFeedback, pn as ENVIRONMENTS, pt as ProductCategory, q as Invoice, qt as BillingMonths, r as EventType, rn as Metadata, rt as PaymentLink, s as Balance, sn as Timestamp, st as Plan, t as EVENT_TYPES, tn as MAX_QUANTITY, tt as PaymentAttempt, u as CARRIERS, un as isLandlinePhone, ut as PlanSeats, v as CheckoutPurpose, vt as ResetFrequency, w as CustomerDetails, wt as Subscription, x as CurrencyAvailability, xt as SUBMIT_LABELS, y as CollectSettings, yt as Retirement, z as FeatureUsageResult, zt as ApiErrorType } from "./events-
|
|
1
|
+
import { $ as SubscriptionChangePreviewInput, A as FeatureUpdate, At as currentApiVersion, B as PlanFeaturesInput, C as CustomerMemberUpdate, Ct as ApiVersion, D as FeatureCreate, Dt as LatestApiVersion, E as EventSelector, Et as LATEST_API_VERSION, F as KEY_PATTERN, G as ProductCheckoutCreate, H as PlanPriceInput, I as PaymentLinkCreate, J as ProductUpdate, K as ProductCreate, L as PaymentLinkUpdate, M as FulfillmentTrackingInput, Mt as isApiVersionRetired, N as InvoiceCreate, Nt as supportedApiVersions, O as FeatureOperationCommit, Ot as apiVersionLifecycle, P as InvoiceLineInput, Q as SubscriptionChangeCreate, R as PlanCheckoutCreate, S as CustomerMemberCreate, St as API_VERSION_PATTERN, T as CustomerUpdate, Tt as ApiVersionStage, U as PlanUpdate, V as PlanLinkCreate, W as PortalSessionCreate, X as RetireInput, Y as RefundCreate, Z as SubscriptionCancel, _ as CouponCreate, _t as PublicPaymentLink, a as CheckoutCreate, at as CustomerSubscription, b as CustomerCreate, bt as API_VERSIONS, c as ClientCheckoutUpdate, ct as PaymentInstructions, d as ClientLinkCheckout, dt as PaymentNextAction, et as SubscriptionCreate, f as ClientPaymentCode, ft as PaymentTestScenario, g as CollectInput, gt as PublicInvoice, h as ClientSubscriptionUpdate, ht as PublicFulfillment, i as AfterCompletionInput, it as WebhookEndpointUpdate, j as FulfillmentInput, jt as isApiVersion, k as FeatureOperationCreate, kt as apiVersionStage, l as ClientFulfillmentProblem, lt as PaymentMethodField, m as ClientSubscriptionSeats, mt as PublicCheckout, n as RequestOptions, nt as VariantInput, o as CheckoutItemInput, ot as CustomerSubscriptionChangeResult, p as ClientSubscriptionCancel, pt as PortalFeatures, q as ProductLinkCreate, r as TransportOptions, rt as WebhookEndpointCreate, s as ClientCheckoutPay, st as FulfillmentOption, t as BilleteError, tt as SubscriptionUpdate, u as ClientInvoicePay, ut as PaymentMethodOption, v as CouponUpdate, vt as PublicPaymentState, w as CustomerSessionCreate, wt as ApiVersionLifecycle, x as CustomerInput, xt as API_VERSION_HEADER, y as CustomFieldInput, yt as PublicPortal, z as PlanCreate } from "./errors-BRQlJDjy.js";
|
|
2
|
+
import { $ as PRODUCT_CATEGORIES, $t as ListQuery, A as ExchangeRate, At as SubscriptionTerms, B as Fulfillment, Bt as PAYMENT_FAILURE_CODES, C as Customer, Ct as SubmitLabel, D as CustomerMemberList, Dt as SubscriptionChangeResult, E as CustomerMember, Et as SubscriptionChangePreview, F as FeatureOperation, Ft as ReceiptSend, G as INVOICE_REASONS, Gt as BILLING_MONTHS, H as FulfillmentMethod, Ht as ACCOUNT_NUMBER_LENGTH, I as FeatureOperationResult, It as API_ERROR_TYPES, J as InvoiceReason, Jt as CURRENCIES, K as INVOICE_STATUSES, Kt as BankCode, L as FeatureReset, Lt as ApiErrorBody, M as FULFILLMENT_METHODS, Mt as WebhookEndpoint, N as FULFILLMENT_STATUSES, Nt as Weekday, O as CustomerSession, Ot as SubscriptionRenewal, P as Feature, Pt as ReceiptReference, Q as PAYMENT_STATUSES, Qt as List, R as FeatureType, Rt as ApiErrorEnvelope, S as CustomField, St as SUBSCRIPTION_STATUSES, T as CustomerFeature, Tt as SubscriptionChange, U as FulfillmentStatus, Ut as Address, V as FulfillmentChoice, Vt as PaymentFailureCode, W as FulfillmentTracking, Wt as AddressInput, X as LineItem, Xt as GRACE_PERIOD_DAYS, Y as InvoiceStatus, Yt as Currency, Z as MAX_SEATS, Zt as GracePeriodDays, _ as CheckoutItem, _n as tokenPrefix, _t as Refund, a as Actor, an as TAX_BEHAVIORS, at as PaymentStatus, b as Coupon, bt as RiskLevel, c as BalanceAmount, cn as VENEZUELAN_BANKS, ct as PlanFeatureValues, d as CARRIER_TEST_SCENARIOS, dn as isMobilePhone, dt as PortalSession, en as ListSort, et as Payment, f as CHECKOUT_PURPOSES, fn as nationalPhone, ft as Product, g as Checkout, gn as tokenEnvironment, gt as RISK_LEVELS, h as CarrierOffice, hn as TokenKind, ht as RESET_FREQUENCIES, i as WebhookEvent, in as MobilePrefix, it as PaymentSettlement, j as FEATURE_TYPES, jt as USAGE_FEATURE_TYPES, k as Event, kt as SubscriptionStatus, l as CANCELLATION_FEEDBACK, ln as findBank, lt as PlanPrice, m as Carrier, mn as Environment, mt as ProductVariant, n as EventDataMap, nn as MOBILE_PREFIXES, nt as PaymentFailure, o as AfterCompletion, on as TaxBehavior, ot as Payout, p as CancellationFeedback, pn as ENVIRONMENTS, pt as ProductCategory, q as Invoice, qt as BillingMonths, r as EventType, rn as Metadata, rt as PaymentLink, s as Balance, sn as Timestamp, st as Plan, t as EVENT_TYPES, tn as MAX_QUANTITY, tt as PaymentAttempt, u as CARRIERS, un as isLandlinePhone, ut as PlanSeats, v as CheckoutPurpose, vt as ResetFrequency, w as CustomerDetails, wt as Subscription, x as CurrencyAvailability, xt as SUBMIT_LABELS, y as CollectSettings, yt as Retirement, z as FeatureUsageResult, zt as ApiErrorType } from "./events-rtkF8fBQ.js";
|
|
3
3
|
import { WebhookVerificationError, verifyWebhook } from "./webhooks.js";
|
|
4
4
|
//#region src/server.d.ts
|
|
5
5
|
type Filters<T> = ListQuery & T;
|
|
@@ -25,7 +25,7 @@ interface BilleteOptions extends TransportOptions {
|
|
|
25
25
|
*
|
|
26
26
|
* ```ts
|
|
27
27
|
* // Reads BILLETE_API_KEY.
|
|
28
|
-
* const billete = createBillete({ apiVersion: "2026-10-
|
|
28
|
+
* const billete = createBillete({ apiVersion: "2026-10-09", environment: "test" });
|
|
29
29
|
* const { allowed } = await billete.features.consume("user_123", "tokens", 850);
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
@@ -100,8 +100,6 @@ export declare function createBillete(options: BilleteOptions): {
|
|
|
100
100
|
};
|
|
101
101
|
features: {
|
|
102
102
|
create: (input: FeatureCreate, options?: RequestOptions) => Promise<Feature>;
|
|
103
|
-
retrieve: (id: string, options?: RequestOptions) => Promise<Feature>;
|
|
104
|
-
update: (id: string, input: FeatureUpdate, options?: RequestOptions) => Promise<Feature>;
|
|
105
103
|
list: (query?: Filters<{
|
|
106
104
|
sort?: ListSort<"created" | "name">;
|
|
107
105
|
}>, options?: RequestOptions) => Promise<List<Feature>>;
|
|
@@ -109,6 +107,10 @@ export declare function createBillete(options: BilleteOptions): {
|
|
|
109
107
|
iterate: (query?: Filters<{
|
|
110
108
|
sort?: ListSort<"created" | "name">;
|
|
111
109
|
}>) => AsyncGenerator<Feature, any, any>;
|
|
110
|
+
/** A feature by its `key` (`tokens`) or its `feat_` ID. */
|
|
111
|
+
retrieve: (key: string, options?: RequestOptions) => Promise<Feature>;
|
|
112
|
+
/** Renames a feature or changes its schedule; `key` also takes its `feat_` ID. */
|
|
113
|
+
update: (key: string, input: FeatureUpdate, options?: RequestOptions) => Promise<Feature>;
|
|
112
114
|
/**
|
|
113
115
|
* Reserves `amount` of a metered feature for one job: it counts as used right away and the
|
|
114
116
|
* operation is closed later through `features.operations`. Repeating `operation` returns the
|
|
@@ -318,4 +320,4 @@ export declare function createBillete(options: BilleteOptions): {
|
|
|
318
320
|
/** The server client: what `createBillete` returns. */
|
|
319
321
|
type Billete = ReturnType<typeof createBillete>;
|
|
320
322
|
//#endregion
|
|
321
|
-
export { type ACCOUNT_NUMBER_LENGTH, type API_ERROR_TYPES, type API_VERSIONS, type API_VERSION_HEADER, type API_VERSION_PATTERN, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorEnvelope, type ApiErrorType, type ApiVersion, type ApiVersionLifecycle, type ApiVersionStage, type BILLING_MONTHS, type Balance, type BalanceAmount, type BankCode, type Billete, BilleteError, type BilleteOptions, type BillingMonths, type CANCELLATION_FEEDBACK, type CARRIERS, type CARRIER_TEST_SCENARIOS, type CHECKOUT_PURPOSES, type CURRENCIES, type CancellationFeedback, type Carrier, type CarrierOffice, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPurpose, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientFulfillmentProblem, type ClientInvoicePay, type ClientLinkCheckout, type ClientPaymentCode, type ClientSubscriptionCancel, type ClientSubscriptionUpdate, type CollectInput, type CollectSettings, type Coupon, type CouponCreate, type CouponUpdate, type Currency, type CurrencyAvailability, type CustomField, type CustomFieldInput, type Customer, type CustomerCreate, type CustomerDetails, type CustomerFeature, type CustomerInput, type CustomerMember, type CustomerMemberCreate, type CustomerMemberList, type CustomerMemberUpdate, type CustomerSession, type CustomerSessionCreate, type CustomerSubscription, type CustomerUpdate, type ENVIRONMENTS, type EVENT_TYPES, type Environment, type Event, type EventDataMap, type EventSelector, type EventType, type ExchangeRate, type FEATURE_TYPES, type FULFILLMENT_METHODS, type FULFILLMENT_STATUSES, type Feature, type FeatureCreate, type FeatureOperation, type FeatureOperationCommit, type FeatureOperationCreate, type FeatureOperationResult, type FeatureReset, type FeatureType, type FeatureUpdate, type FeatureUsageResult, type Fulfillment, type FulfillmentChoice, type FulfillmentInput, type FulfillmentMethod, type FulfillmentOption, type FulfillmentStatus, type FulfillmentTracking, type FulfillmentTrackingInput, type GRACE_PERIOD_DAYS, type GracePeriodDays, type INVOICE_REASONS, type INVOICE_STATUSES, type Invoice, type InvoiceCreate, type InvoiceLineInput, type InvoiceReason, type InvoiceStatus, type KEY_PATTERN, type LATEST_API_VERSION, type LatestApiVersion, type LineItem, type List, type ListQuery, type ListSort, type MAX_QUANTITY, type MAX_SEATS, type MOBILE_PREFIXES, type Metadata, type MobilePrefix, type PAYMENT_FAILURE_CODES, type PAYMENT_STATUSES, type PRODUCT_CATEGORIES, type Payment, type PaymentAttempt, type PaymentFailure, type PaymentFailureCode, type PaymentInstructions, type PaymentLink, type PaymentLinkCreate, type PaymentLinkUpdate, type PaymentMethodField, type PaymentMethodOption, type PaymentNextAction, type PaymentSettlement, type PaymentStatus, type PaymentTestScenario, type Payout, type Plan, type PlanCheckoutCreate, type PlanCreate, type PlanFeatureValues, type PlanFeaturesInput, type PlanLinkCreate, type PlanPrice, type PlanPriceInput, type PlanSeats, type PlanUpdate, type PortalFeatures, type PortalSession, type PortalSessionCreate, type Product, type ProductCategory, type ProductCheckoutCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicFulfillment, type PublicInvoice, type PublicPaymentLink, type PublicPaymentState, type PublicPortal, type RESET_FREQUENCIES, type RISK_LEVELS, type ReceiptReference, type ReceiptSend, type Refund, type RefundCreate, type RequestOptions, type ResetFrequency, type RetireInput, type Retirement, type RiskLevel, type SUBMIT_LABELS, type SUBSCRIPTION_STATUSES, type SubmitLabel, type Subscription, type SubscriptionCancel, type SubscriptionChange, type SubscriptionChangeCreate, type SubscriptionChangePreview, type SubscriptionChangePreviewInput, type SubscriptionChangeResult, type SubscriptionCreate, type SubscriptionRenewal, type SubscriptionStatus, type SubscriptionTerms, type SubscriptionUpdate, type TAX_BEHAVIORS, type TaxBehavior, type Timestamp, type TokenKind, type TransportOptions, type USAGE_FEATURE_TYPES, type VENEZUELAN_BANKS, type VariantInput, type WebhookEndpoint, type WebhookEndpointCreate, type WebhookEndpointUpdate, type WebhookEvent, WebhookVerificationError, type Weekday, type apiVersionLifecycle, type apiVersionStage, type currentApiVersion, type findBank, type isApiVersion, type isApiVersionRetired, type isLandlinePhone, type isMobilePhone, type nationalPhone, type supportedApiVersions, type tokenEnvironment, type tokenPrefix, verifyWebhook };
|
|
323
|
+
export { type ACCOUNT_NUMBER_LENGTH, type API_ERROR_TYPES, type API_VERSIONS, type API_VERSION_HEADER, type API_VERSION_PATTERN, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorEnvelope, type ApiErrorType, type ApiVersion, type ApiVersionLifecycle, type ApiVersionStage, type BILLING_MONTHS, type Balance, type BalanceAmount, type BankCode, type Billete, BilleteError, type BilleteOptions, type BillingMonths, type CANCELLATION_FEEDBACK, type CARRIERS, type CARRIER_TEST_SCENARIOS, type CHECKOUT_PURPOSES, type CURRENCIES, type CancellationFeedback, type Carrier, type CarrierOffice, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPurpose, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientFulfillmentProblem, type ClientInvoicePay, type ClientLinkCheckout, type ClientPaymentCode, type ClientSubscriptionCancel, type ClientSubscriptionSeats, type ClientSubscriptionUpdate, type CollectInput, type CollectSettings, type Coupon, type CouponCreate, type CouponUpdate, type Currency, type CurrencyAvailability, type CustomField, type CustomFieldInput, type Customer, type CustomerCreate, type CustomerDetails, type CustomerFeature, type CustomerInput, type CustomerMember, type CustomerMemberCreate, type CustomerMemberList, type CustomerMemberUpdate, type CustomerSession, type CustomerSessionCreate, type CustomerSubscription, type CustomerSubscriptionChangeResult, type CustomerUpdate, type ENVIRONMENTS, type EVENT_TYPES, type Environment, type Event, type EventDataMap, type EventSelector, type EventType, type ExchangeRate, type FEATURE_TYPES, type FULFILLMENT_METHODS, type FULFILLMENT_STATUSES, type Feature, type FeatureCreate, type FeatureOperation, type FeatureOperationCommit, type FeatureOperationCreate, type FeatureOperationResult, type FeatureReset, type FeatureType, type FeatureUpdate, type FeatureUsageResult, type Fulfillment, type FulfillmentChoice, type FulfillmentInput, type FulfillmentMethod, type FulfillmentOption, type FulfillmentStatus, type FulfillmentTracking, type FulfillmentTrackingInput, type GRACE_PERIOD_DAYS, type GracePeriodDays, type INVOICE_REASONS, type INVOICE_STATUSES, type Invoice, type InvoiceCreate, type InvoiceLineInput, type InvoiceReason, type InvoiceStatus, type KEY_PATTERN, type LATEST_API_VERSION, type LatestApiVersion, type LineItem, type List, type ListQuery, type ListSort, type MAX_QUANTITY, type MAX_SEATS, type MOBILE_PREFIXES, type Metadata, type MobilePrefix, type PAYMENT_FAILURE_CODES, type PAYMENT_STATUSES, type PRODUCT_CATEGORIES, type Payment, type PaymentAttempt, type PaymentFailure, type PaymentFailureCode, type PaymentInstructions, type PaymentLink, type PaymentLinkCreate, type PaymentLinkUpdate, type PaymentMethodField, type PaymentMethodOption, type PaymentNextAction, type PaymentSettlement, type PaymentStatus, type PaymentTestScenario, type Payout, type Plan, type PlanCheckoutCreate, type PlanCreate, type PlanFeatureValues, type PlanFeaturesInput, type PlanLinkCreate, type PlanPrice, type PlanPriceInput, type PlanSeats, type PlanUpdate, type PortalFeatures, type PortalSession, type PortalSessionCreate, type Product, type ProductCategory, type ProductCheckoutCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicFulfillment, type PublicInvoice, type PublicPaymentLink, type PublicPaymentState, type PublicPortal, type RESET_FREQUENCIES, type RISK_LEVELS, type ReceiptReference, type ReceiptSend, type Refund, type RefundCreate, type RequestOptions, type ResetFrequency, type RetireInput, type Retirement, type RiskLevel, type SUBMIT_LABELS, type SUBSCRIPTION_STATUSES, type SubmitLabel, type Subscription, type SubscriptionCancel, type SubscriptionChange, type SubscriptionChangeCreate, type SubscriptionChangePreview, type SubscriptionChangePreviewInput, type SubscriptionChangeResult, type SubscriptionCreate, type SubscriptionRenewal, type SubscriptionStatus, type SubscriptionTerms, type SubscriptionUpdate, type TAX_BEHAVIORS, type TaxBehavior, type Timestamp, type TokenKind, type TransportOptions, type USAGE_FEATURE_TYPES, type VENEZUELAN_BANKS, type VariantInput, type WebhookEndpoint, type WebhookEndpointCreate, type WebhookEndpointUpdate, type WebhookEvent, WebhookVerificationError, type Weekday, type apiVersionLifecycle, type apiVersionStage, type currentApiVersion, type findBank, type isApiVersion, type isApiVersionRetired, type isLandlinePhone, type isMobilePhone, type nationalPhone, type supportedApiVersions, type tokenEnvironment, type tokenPrefix, verifyWebhook };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as segment, r as BilleteError, t as createTransport } from "./http-
|
|
1
|
+
import { n as segment, r as BilleteError, t as createTransport } from "./http-PMxK43GM.js";
|
|
2
2
|
import { WebhookVerificationError, verifyWebhook } from "./webhooks.js";
|
|
3
3
|
//#region ../contracts/src/environment.ts
|
|
4
4
|
/**
|
|
@@ -64,7 +64,7 @@ function fromEnv(name) {
|
|
|
64
64
|
*
|
|
65
65
|
* ```ts
|
|
66
66
|
* // Reads BILLETE_API_KEY.
|
|
67
|
-
* const billete = createBillete({ apiVersion: "2026-10-
|
|
67
|
+
* const billete = createBillete({ apiVersion: "2026-10-09", environment: "test" });
|
|
68
68
|
* const { allowed } = await billete.features.consume("user_123", "tokens", 850);
|
|
69
69
|
* ```
|
|
70
70
|
*/
|
|
@@ -159,6 +159,10 @@ create: (input, options) => http.request({
|
|
|
159
159
|
const operationPath = (operation, action) => `/v1/feature-operations/${segment(operation)}${action ? `/${action}` : ""}`;
|
|
160
160
|
const features = {
|
|
161
161
|
...featureCrud,
|
|
162
|
+
/** A feature by its `key` (`tokens`) or its `feat_` ID. */
|
|
163
|
+
retrieve: (key, options) => featureCrud.retrieve(key, options),
|
|
164
|
+
/** Renames a feature or changes its schedule; `key` also takes its `feat_` ID. */
|
|
165
|
+
update: (key, input, options) => featureCrud.update(key, input, options),
|
|
162
166
|
/**
|
|
163
167
|
* Reserves `amount` of a metered feature for one job: it counts as used right away and the
|
|
164
168
|
* operation is closed later through `features.operations`. Repeating `operation` returns the
|
package/dist/webhooks.d.ts
CHANGED