@boelabs/billete-sdk 1.1.0-canary.6 → 2.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 CHANGED
@@ -42,6 +42,10 @@ servidor y tu frontend.
42
42
  npm install @boelabs/billete-sdk
43
43
  ```
44
44
 
45
+ Cada versión del SDK habla una sola versión de la API, la que pide su opción `apiVersion`: una
46
+ versión mayor nueva del SDK es una versión nueva de la API. Las versiones beta de la API tienen su
47
+ SDK en `@boelabs/billete-sdk@beta`.
48
+
45
49
  El paquete tiene tres puntos de entrada:
46
50
 
47
51
  | Import | Dónde se usa | Para qué |
@@ -58,7 +62,7 @@ Crea una clave secreta en el dashboard (**Desarrolladores → Claves API**) y gu
58
62
  ```ts
59
63
  import { createBillete } from "@boelabs/billete-sdk";
60
64
 
61
- const billete = createBillete({ environment: "test" });
65
+ const billete = createBillete({ apiVersion: "2026-10-08", environment: "test" });
62
66
 
63
67
  const checkout = await billete.checkouts.create({
64
68
  plan: "plan_…",
@@ -86,6 +90,7 @@ solicite expresamente. En carritos, solo ofrece los demás métodos que todos lo
86
90
 
87
91
  ```ts
88
92
  const billete = createBillete({
93
+ apiVersion: "2026-10-08",
89
94
  environment: "production",
90
95
  apiKey: process.env.BILLETE_API_KEY,
91
96
  timeoutMs: 30_000,
@@ -251,7 +256,7 @@ return { token: session.token };
251
256
  // Navegador
252
257
  import { createClient } from "@boelabs/billete-sdk/client";
253
258
 
254
- const billete = createClient({ customerSession: token });
259
+ const billete = createClient({ apiVersion: "2026-10-08", customerSession: token });
255
260
 
256
261
  const { data: subscriptions } = await billete.customer.subscriptions();
257
262
  const tokens = await billete.customer.feature("tokens");
package/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- 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-Dz2ghaMl.js";
2
- import { $ as SubscriptionCreate, A as FulfillmentInput, B as PlanLinkCreate, C as CustomerSessionCreate, D as FeatureOperationCommit, E as FeatureCreate, F as PaymentLinkCreate, G as ProductCreate, H as PlanUpdate, I as PaymentLinkUpdate, J as RefundCreate, K as ProductLinkCreate, L as PlanCheckoutCreate, M as InvoiceCreate, N as InvoiceLineInput, O as FeatureOperationCreate, P as KEY_PATTERN, Q as SubscriptionChangePreviewInput, R as PlanCreate, S as CustomerMemberUpdate, T as EventSelector, U as PortalSessionCreate, V as PlanPriceInput, W as ProductCheckoutCreate, X as SubscriptionCancel, Y as RetireInput, Z as SubscriptionChangeCreate, _ as CouponUpdate, _t as PublicPortal, a as CheckoutCreate, at as FulfillmentOption, b as CustomerInput, c as ClientCheckoutUpdate, ct as PaymentMethodOption, d as ClientLinkCheckout, dt as PortalFeatures, et as SubscriptionUpdate, f as ClientPaymentCode, ft as PublicCheckout, g as CouponCreate, gt as PublicPaymentState, h as CollectInput, ht as PublicPaymentLink, i as AfterCompletionInput, it as CustomerSubscription, j as FulfillmentTrackingInput, k as FeatureUpdate, l as ClientFulfillmentProblem, lt as PaymentNextAction, m as ClientSubscriptionUpdate, mt as PublicInvoice, n as RequestOptions, nt as WebhookEndpointCreate, o as CheckoutItemInput, ot as PaymentInstructions, p as ClientSubscriptionCancel, pt as PublicFulfillment, q as ProductUpdate, r as TransportOptions, rt as WebhookEndpointUpdate, s as ClientCheckoutPay, st as PaymentMethodField, t as BilleteError, tt as VariantInput, u as ClientInvoicePay, ut as PaymentTestScenario, v as CustomFieldInput, w as CustomerUpdate, x as CustomerMemberCreate, y as CustomerCreate, z as PlanFeaturesInput } from "./errors-De_fISnn.js";
1
+ import { $ as SubscriptionCreate, A as FulfillmentInput, At as isApiVersionRetired, B as PlanLinkCreate, C as CustomerSessionCreate, Ct as ApiVersionStage, D as FeatureOperationCommit, Dt as apiVersionStage, E as FeatureCreate, Et as apiVersionLifecycle, F as PaymentLinkCreate, G as ProductCreate, H as PlanUpdate, I as PaymentLinkUpdate, J as RefundCreate, K as ProductLinkCreate, L as PlanCheckoutCreate, M as InvoiceCreate, N as InvoiceLineInput, O as FeatureOperationCreate, Ot as currentApiVersion, P as KEY_PATTERN, Q as SubscriptionChangePreviewInput, R as PlanCreate, S as CustomerMemberUpdate, St as ApiVersionLifecycle, T as EventSelector, Tt as LatestApiVersion, U as PortalSessionCreate, V as PlanPriceInput, W as ProductCheckoutCreate, X as SubscriptionCancel, Y as RetireInput, Z as SubscriptionChangeCreate, _ as CouponUpdate, _t as PublicPortal, a as CheckoutCreate, at as FulfillmentOption, b as CustomerInput, bt as API_VERSION_PATTERN, c as ClientCheckoutUpdate, ct as PaymentMethodOption, d as ClientLinkCheckout, dt as PortalFeatures, et as SubscriptionUpdate, f as ClientPaymentCode, ft as PublicCheckout, g as CouponCreate, gt as PublicPaymentState, h as CollectInput, ht as PublicPaymentLink, i as AfterCompletionInput, it as CustomerSubscription, j as FulfillmentTrackingInput, jt as supportedApiVersions, k as FeatureUpdate, kt as isApiVersion, l as ClientFulfillmentProblem, lt as PaymentNextAction, m as ClientSubscriptionUpdate, mt as PublicInvoice, n as RequestOptions, nt as WebhookEndpointCreate, o as CheckoutItemInput, ot as PaymentInstructions, p as ClientSubscriptionCancel, pt as PublicFulfillment, q as ProductUpdate, r as TransportOptions, rt as WebhookEndpointUpdate, s as ClientCheckoutPay, st as PaymentMethodField, t as BilleteError, tt as VariantInput, u as ClientInvoicePay, ut as PaymentTestScenario, v as CustomFieldInput, vt as API_VERSIONS, w as CustomerUpdate, wt as LATEST_API_VERSION, x as CustomerMemberCreate, xt as ApiVersion, y as CustomerCreate, yt as API_VERSION_HEADER, z as PlanFeaturesInput } from "./errors-Cu8XMn5I.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-CrmMdwBX.js";
3
3
  //#region src/create-client.d.ts
4
4
  interface ClientOptions extends TransportOptions {
5
5
  /**
@@ -14,12 +14,12 @@ 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({ customerSession: token });
17
+ * const billete = createClient({ apiVersion: "2026-10-08", customerSession: token });
18
18
  * const [subscription] = (await billete.customer.subscriptions()).data;
19
19
  * if (subscription?.renewal?.status === "overdue") showBanner(subscription.renewal);
20
20
  * ```
21
21
  */
22
- export declare function createClient(options?: ClientOptions): {
22
+ export declare function createClient(options: ClientOptions): {
23
23
  /** Offices offered by a carrier, refreshed daily by Billete. */
24
24
  carrierOffices: (carrier: Carrier, options?: RequestOptions) => Promise<List<CarrierOffice>>;
25
25
  checkouts: {
@@ -102,4 +102,4 @@ export declare function createClient(options?: ClientOptions): {
102
102
  };
103
103
  type BilleteClient = ReturnType<typeof createClient>;
104
104
  //#endregion
105
- export { type ACCOUNT_NUMBER_LENGTH, type API_ERROR_TYPES, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorEnvelope, type ApiErrorType, 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 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 findBank, type isLandlinePhone, type isMobilePhone, type nationalPhone, type tokenEnvironment, type tokenPrefix };
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 };
package/dist/client.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as segment, r as BilleteError, t as createTransport } from "./http-DNd4UhbT.js";
1
+ import { n as segment, r as BilleteError, t as createTransport } from "./http-CgBMbPS2.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,12 +6,12 @@ import { n as segment, r as BilleteError, t as createTransport } from "./http-DN
6
6
  * and customer data requires a short-lived customer session minted by your server.
7
7
  *
8
8
  * ```ts
9
- * const billete = createClient({ customerSession: token });
9
+ * const billete = createClient({ apiVersion: "2026-10-08", customerSession: token });
10
10
  * const [subscription] = (await billete.customer.subscriptions()).data;
11
11
  * if (subscription?.renewal?.status === "overdue") showBanner(subscription.renewal);
12
12
  * ```
13
13
  */
14
- function createClient(options = {}) {
14
+ function createClient(options) {
15
15
  const session = options.customerSession;
16
16
  const http = createTransport({
17
17
  ...options,
@@ -1,4 +1,48 @@
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-Dz2ghaMl.js";
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-CrmMdwBX.js";
2
+ //#region ../contracts/src/api-versions.d.ts
3
+ /**
4
+ * Billete API versions. Kept free of runtime dependencies: the dashboard, the API, the worker and
5
+ * the docs read it, and the public SDK pins its newest entry as a type.
6
+ *
7
+ * A version is named after the day it was published: `2026-11-01` is stable and
8
+ * `2026-11-01.beta` is a beta. Once published a version never changes; anything incompatible
9
+ * ships as a new version. Additive changes (new endpoints, optional fields) reach every version
10
+ * that is still supported.
11
+ */
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"];
14
+ type ApiVersion = (typeof API_VERSIONS)[number];
15
+ type LatestApiVersion = typeof API_VERSIONS extends readonly [...unknown[], infer Last] ? Last : never;
16
+ /** The version the code speaks: responses are built in its shape. Always the last entry. */
17
+ declare const LATEST_API_VERSION: LatestApiVersion;
18
+ /** The request header that names the version a request is written against. */
19
+ declare const API_VERSION_HEADER = "Billete-Version";
20
+ declare const API_VERSION_PATTERN: RegExp;
21
+ type ApiVersionStage = "stable" | "beta";
22
+ interface ApiVersionLifecycle {
23
+ stage: ApiVersionStage;
24
+ /** Day it was published (UTC), `YYYY-MM-DD`. */
25
+ releasedOn: string;
26
+ /** Day merchants start hearing about its retirement, once a successor exists. */
27
+ noticeOn: string | null;
28
+ /** First day requests with it are rejected, once a successor exists. */
29
+ retiresOn: string | null;
30
+ }
31
+ declare function isApiVersion(value: string): value is ApiVersion;
32
+ declare function apiVersionStage(version: string): ApiVersionStage;
33
+ /**
34
+ * When a version was published, when its retirement is announced and when it stops working. Both
35
+ * dates follow from the registry alone (a successor stable version starts the clock), so retiring a
36
+ * version needs no manual step.
37
+ */
38
+ declare function apiVersionLifecycle(version: string, registry?: readonly string[]): ApiVersionLifecycle;
39
+ declare function isApiVersionRetired(version: string, now: Date, registry?: readonly string[]): boolean;
40
+ /** Versions that still work on `now`, oldest first. */
41
+ declare function supportedApiVersions(now: Date): ApiVersion[];
42
+ declare function supportedApiVersions<T extends string>(now: Date, registry: readonly T[]): T[];
43
+ /** What new integrations should use: the newest stable version, or the newest beta before any. */
44
+ declare function currentApiVersion(): ApiVersion;
45
+ //#endregion
2
46
  //#region ../contracts/src/client.d.ts
3
47
  /**
4
48
  * A subscription as its customer sees it, in the browser: without the business's `metadata`, with
@@ -705,11 +749,15 @@ type EventSelector = "*" | EventType;
705
749
  interface WebhookEndpointCreate {
706
750
  url: string;
707
751
  events: EventSelector[];
752
+ /** Version its events are delivered in. Defaults to the version of the request. */
753
+ apiVersion?: ApiVersion;
708
754
  }
709
755
  interface WebhookEndpointUpdate {
710
756
  url?: string;
711
757
  events?: EventSelector[];
712
758
  enabled?: boolean;
759
+ /** Moves the endpoint to another supported version; its next deliveries use it. */
760
+ apiVersion?: ApiVersion;
713
761
  }
714
762
  interface CustomerSessionCreate {
715
763
  customer: string;
@@ -776,6 +824,13 @@ interface ClientFulfillmentProblem {
776
824
  //#endregion
777
825
  //#region src/http.d.ts
778
826
  interface TransportOptions {
827
+ /**
828
+ * The Billete API version your integration is written against. Required: Billete never changes
829
+ * a published version, so your integration keeps working until you choose to upgrade. Each SDK
830
+ * release speaks exactly one version; upgrading the SDK to a new major asks you to set the new
831
+ * one after reading what changed.
832
+ */
833
+ apiVersion: LatestApiVersion;
779
834
  /** Defaults to `BILLETE_BASE_URL` on the server, then `https://api.billete.run`. Use
780
835
  * `http://localhost:9999` in development. */
781
836
  baseUrl?: string;
@@ -804,4 +859,4 @@ declare class BilleteError extends Error {
804
859
  }, status: number);
805
860
  }
806
861
  //#endregion
807
- export { SubscriptionCreate as $, FulfillmentInput as A, PlanLinkCreate as B, CustomerSessionCreate as C, FeatureOperationCommit as D, FeatureCreate as E, PaymentLinkCreate as F, ProductCreate as G, PlanUpdate as H, PaymentLinkUpdate as I, RefundCreate as J, ProductLinkCreate as K, PlanCheckoutCreate as L, InvoiceCreate as M, InvoiceLineInput as N, FeatureOperationCreate as O, KEY_PATTERN as P, SubscriptionChangePreviewInput as Q, PlanCreate as R, CustomerMemberUpdate as S, EventSelector as T, PortalSessionCreate as U, PlanPriceInput as V, ProductCheckoutCreate as W, SubscriptionCancel as X, RetireInput as Y, SubscriptionChangeCreate as Z, CouponUpdate as _, PublicPortal as _t, CheckoutCreate as a, FulfillmentOption as at, CustomerInput as b, ClientCheckoutUpdate as c, PaymentMethodOption as ct, ClientLinkCheckout as d, PortalFeatures as dt, SubscriptionUpdate as et, ClientPaymentCode as f, PublicCheckout as ft, CouponCreate as g, PublicPaymentState as gt, CollectInput as h, PublicPaymentLink as ht, AfterCompletionInput as i, CustomerSubscription as it, FulfillmentTrackingInput as j, FeatureUpdate as k, ClientFulfillmentProblem as l, PaymentNextAction as lt, ClientSubscriptionUpdate as m, PublicInvoice as mt, RequestOptions as n, WebhookEndpointCreate as nt, CheckoutItemInput as o, PaymentInstructions as ot, ClientSubscriptionCancel as p, PublicFulfillment as pt, ProductUpdate as q, TransportOptions as r, WebhookEndpointUpdate as rt, ClientCheckoutPay as s, PaymentMethodField as st, BilleteError as t, VariantInput as tt, ClientInvoicePay as u, PaymentTestScenario as ut, CustomFieldInput as v, CustomerUpdate as w, CustomerMemberCreate as x, CustomerCreate as y, PlanFeaturesInput as z };
862
+ export { SubscriptionCreate as $, FulfillmentInput as A, isApiVersionRetired as At, PlanLinkCreate as B, CustomerSessionCreate as C, ApiVersionStage as Ct, FeatureOperationCommit as D, apiVersionStage as Dt, FeatureCreate as E, apiVersionLifecycle as Et, PaymentLinkCreate as F, ProductCreate as G, PlanUpdate as H, PaymentLinkUpdate as I, RefundCreate as J, ProductLinkCreate as K, PlanCheckoutCreate as L, InvoiceCreate as M, InvoiceLineInput as N, FeatureOperationCreate as O, currentApiVersion as Ot, KEY_PATTERN as P, SubscriptionChangePreviewInput as Q, PlanCreate as R, CustomerMemberUpdate as S, ApiVersionLifecycle as St, EventSelector as T, LatestApiVersion as Tt, PortalSessionCreate as U, PlanPriceInput as V, ProductCheckoutCreate as W, SubscriptionCancel as X, RetireInput as Y, SubscriptionChangeCreate as Z, CouponUpdate as _, PublicPortal as _t, CheckoutCreate as a, FulfillmentOption as at, CustomerInput as b, API_VERSION_PATTERN as bt, ClientCheckoutUpdate as c, PaymentMethodOption as ct, ClientLinkCheckout as d, PortalFeatures as dt, SubscriptionUpdate as et, ClientPaymentCode as f, PublicCheckout as ft, CouponCreate as g, PublicPaymentState as gt, CollectInput as h, PublicPaymentLink as ht, AfterCompletionInput as i, CustomerSubscription as it, FulfillmentTrackingInput as j, supportedApiVersions as jt, FeatureUpdate as k, isApiVersion as kt, ClientFulfillmentProblem as l, PaymentNextAction as lt, ClientSubscriptionUpdate as m, PublicInvoice as mt, RequestOptions as n, WebhookEndpointCreate as nt, CheckoutItemInput as o, PaymentInstructions as ot, ClientSubscriptionCancel as p, PublicFulfillment as pt, ProductUpdate as q, TransportOptions as r, WebhookEndpointUpdate as rt, ClientCheckoutPay as s, PaymentMethodField as st, BilleteError as t, VariantInput as tt, ClientInvoicePay as u, PaymentTestScenario as ut, CustomFieldInput as v, API_VERSIONS as vt, CustomerUpdate as w, LATEST_API_VERSION as wt, CustomerMemberCreate as x, ApiVersion as xt, CustomerCreate as y, API_VERSION_HEADER as yt, PlanFeaturesInput as z };
@@ -983,12 +983,19 @@ interface Payout extends Resource<"payout"> {
983
983
  interface WebhookEndpoint extends Resource<"webhook_endpoint"> {
984
984
  url: string;
985
985
  events: string[];
986
+ /**
987
+ * Version its events are delivered in. Typed as text: responses never change shape when new
988
+ * versions are published.
989
+ */
990
+ apiVersion: string;
986
991
  enabled: boolean;
987
992
  /** Returned only when the endpoint is created. */
988
993
  secret?: string;
989
994
  }
990
995
  interface Event<TData = Record<string, unknown>> extends Resource<"event"> {
991
996
  type: string;
997
+ /** The version whose shape `data` is in: the request's, or the webhook endpoint's. */
998
+ apiVersion: string;
992
999
  data: TData;
993
1000
  }
994
1001
  interface ExchangeRate {
@@ -1080,6 +1087,8 @@ type WebhookEvent = { [TType in EventType]: {
1080
1087
  id: string;
1081
1088
  object: "event";
1082
1089
  type: TType;
1090
+ /** The webhook endpoint's version: `data` comes in its shape. */
1091
+ apiVersion: string;
1083
1092
  environment: Environment;
1084
1093
  createdAt: string;
1085
1094
  data: EventDataMap[TType];
@@ -18,7 +18,7 @@ var BilleteError = class extends Error {
18
18
  };
19
19
  //#endregion
20
20
  //#region src/http.ts
21
- const SDK_VERSION = "1.1.0-canary.6";
21
+ const SDK_VERSION = "2.0.0";
22
22
  const DEFAULT_BASE_URL = "https://api.billete.run";
23
23
  const RETRYABLE_STATUS = /* @__PURE__ */ new Set([
24
24
  429,
@@ -58,6 +58,7 @@ async function toError(response) {
58
58
  }, response.status);
59
59
  }
60
60
  function createTransport(options) {
61
+ if (!options.apiVersion) throw new TypeError("Billete needs apiVersion: the API version your integration is written against");
61
62
  const baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;
62
63
  const fetchImpl = options.fetch ?? ((...args) => globalThis.fetch(...args));
63
64
  const timeoutMs = options.timeoutMs ?? 3e4;
@@ -66,6 +67,7 @@ function createTransport(options) {
66
67
  const token = options.token?.();
67
68
  const headers = {
68
69
  Accept: "application/json",
70
+ "Billete-Version": options.apiVersion,
69
71
  "X-Billete-Client": `billete-js/${SDK_VERSION}`,
70
72
  ...token ? { Authorization: `Bearer ${token}` } : {},
71
73
  ...request.body === void 0 ? {} : { "Content-Type": "application/json" },
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- 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-Dz2ghaMl.js";
2
- import { $ as SubscriptionCreate, A as FulfillmentInput, B as PlanLinkCreate, C as CustomerSessionCreate, D as FeatureOperationCommit, E as FeatureCreate, F as PaymentLinkCreate, G as ProductCreate, H as PlanUpdate, I as PaymentLinkUpdate, J as RefundCreate, K as ProductLinkCreate, L as PlanCheckoutCreate, M as InvoiceCreate, N as InvoiceLineInput, O as FeatureOperationCreate, P as KEY_PATTERN, Q as SubscriptionChangePreviewInput, R as PlanCreate, S as CustomerMemberUpdate, T as EventSelector, U as PortalSessionCreate, V as PlanPriceInput, W as ProductCheckoutCreate, X as SubscriptionCancel, Y as RetireInput, Z as SubscriptionChangeCreate, _ as CouponUpdate, _t as PublicPortal, a as CheckoutCreate, at as FulfillmentOption, b as CustomerInput, c as ClientCheckoutUpdate, ct as PaymentMethodOption, d as ClientLinkCheckout, dt as PortalFeatures, et as SubscriptionUpdate, f as ClientPaymentCode, ft as PublicCheckout, g as CouponCreate, gt as PublicPaymentState, h as CollectInput, ht as PublicPaymentLink, i as AfterCompletionInput, it as CustomerSubscription, j as FulfillmentTrackingInput, k as FeatureUpdate, l as ClientFulfillmentProblem, lt as PaymentNextAction, m as ClientSubscriptionUpdate, mt as PublicInvoice, n as RequestOptions, nt as WebhookEndpointCreate, o as CheckoutItemInput, ot as PaymentInstructions, p as ClientSubscriptionCancel, pt as PublicFulfillment, q as ProductUpdate, r as TransportOptions, rt as WebhookEndpointUpdate, s as ClientCheckoutPay, st as PaymentMethodField, t as BilleteError, tt as VariantInput, u as ClientInvoicePay, ut as PaymentTestScenario, v as CustomFieldInput, w as CustomerUpdate, x as CustomerMemberCreate, y as CustomerCreate, z as PlanFeaturesInput } from "./errors-De_fISnn.js";
1
+ import { $ as SubscriptionCreate, A as FulfillmentInput, At as isApiVersionRetired, B as PlanLinkCreate, C as CustomerSessionCreate, Ct as ApiVersionStage, D as FeatureOperationCommit, Dt as apiVersionStage, E as FeatureCreate, Et as apiVersionLifecycle, F as PaymentLinkCreate, G as ProductCreate, H as PlanUpdate, I as PaymentLinkUpdate, J as RefundCreate, K as ProductLinkCreate, L as PlanCheckoutCreate, M as InvoiceCreate, N as InvoiceLineInput, O as FeatureOperationCreate, Ot as currentApiVersion, P as KEY_PATTERN, Q as SubscriptionChangePreviewInput, R as PlanCreate, S as CustomerMemberUpdate, St as ApiVersionLifecycle, T as EventSelector, Tt as LatestApiVersion, U as PortalSessionCreate, V as PlanPriceInput, W as ProductCheckoutCreate, X as SubscriptionCancel, Y as RetireInput, Z as SubscriptionChangeCreate, _ as CouponUpdate, _t as PublicPortal, a as CheckoutCreate, at as FulfillmentOption, b as CustomerInput, bt as API_VERSION_PATTERN, c as ClientCheckoutUpdate, ct as PaymentMethodOption, d as ClientLinkCheckout, dt as PortalFeatures, et as SubscriptionUpdate, f as ClientPaymentCode, ft as PublicCheckout, g as CouponCreate, gt as PublicPaymentState, h as CollectInput, ht as PublicPaymentLink, i as AfterCompletionInput, it as CustomerSubscription, j as FulfillmentTrackingInput, jt as supportedApiVersions, k as FeatureUpdate, kt as isApiVersion, l as ClientFulfillmentProblem, lt as PaymentNextAction, m as ClientSubscriptionUpdate, mt as PublicInvoice, n as RequestOptions, nt as WebhookEndpointCreate, o as CheckoutItemInput, ot as PaymentInstructions, p as ClientSubscriptionCancel, pt as PublicFulfillment, q as ProductUpdate, r as TransportOptions, rt as WebhookEndpointUpdate, s as ClientCheckoutPay, st as PaymentMethodField, t as BilleteError, tt as VariantInput, u as ClientInvoicePay, ut as PaymentTestScenario, v as CustomFieldInput, vt as API_VERSIONS, w as CustomerUpdate, wt as LATEST_API_VERSION, x as CustomerMemberCreate, xt as ApiVersion, y as CustomerCreate, yt as API_VERSION_HEADER, z as PlanFeaturesInput } from "./errors-Cu8XMn5I.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-CrmMdwBX.js";
3
3
  import { WebhookVerificationError, verifyWebhook } from "./webhooks.js";
4
4
  //#region src/server.d.ts
5
5
  type Filters<T> = ListQuery & T;
@@ -24,7 +24,8 @@ interface BilleteOptions extends TransportOptions {
24
24
  * Server-side Billete client. Works in any runtime with `fetch` (Node, Bun, Deno, edge).
25
25
  *
26
26
  * ```ts
27
- * const billete = createBillete({ environment: "test" }); // reads BILLETE_API_KEY
27
+ * // Reads BILLETE_API_KEY.
28
+ * const billete = createBillete({ apiVersion: "2026-10-08", environment: "test" });
28
29
  * const { allowed } = await billete.features.consume("user_123", "tokens", 850);
29
30
  * ```
30
31
  */
@@ -317,4 +318,4 @@ export declare function createBillete(options: BilleteOptions): {
317
318
  /** The server client: what `createBillete` returns. */
318
319
  type Billete = ReturnType<typeof createBillete>;
319
320
  //#endregion
320
- export { type ACCOUNT_NUMBER_LENGTH, type API_ERROR_TYPES, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorEnvelope, type ApiErrorType, 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 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 findBank, type isLandlinePhone, type isMobilePhone, type nationalPhone, type tokenEnvironment, type tokenPrefix, verifyWebhook };
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 };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as segment, r as BilleteError, t as createTransport } from "./http-DNd4UhbT.js";
1
+ import { n as segment, r as BilleteError, t as createTransport } from "./http-CgBMbPS2.js";
2
2
  import { WebhookVerificationError, verifyWebhook } from "./webhooks.js";
3
3
  //#region ../contracts/src/environment.ts
4
4
  /**
@@ -63,7 +63,8 @@ function fromEnv(name) {
63
63
  * Server-side Billete client. Works in any runtime with `fetch` (Node, Bun, Deno, edge).
64
64
  *
65
65
  * ```ts
66
- * const billete = createBillete({ environment: "test" }); // reads BILLETE_API_KEY
66
+ * // Reads BILLETE_API_KEY.
67
+ * const billete = createBillete({ apiVersion: "2026-10-08", environment: "test" });
67
68
  * const { allowed } = await billete.features.consume("user_123", "tokens", 850);
68
69
  * ```
69
70
  */
@@ -1,4 +1,4 @@
1
- import { i as WebhookEvent } from "./events-Dz2ghaMl.js";
1
+ import { i as WebhookEvent } from "./events-CrmMdwBX.js";
2
2
  //#region src/webhooks.d.ts
3
3
  export declare class WebhookVerificationError extends Error {
4
4
  constructor(message: string);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boelabs/billete-sdk",
3
- "version": "1.1.0-canary.6",
3
+ "version": "2.0.0",
4
4
  "description": "Billete SDK: server client, browser client and webhook verification",
5
5
  "keywords": [
6
6
  "billete",