@boelabs/billete-sdk 9.0.0 → 9.1.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
@@ -49,11 +49,11 @@ SDK en `@boelabs/billete-sdk@beta`.
49
49
 
50
50
  El paquete tiene tres puntos de entrada:
51
51
 
52
- | Import | Dónde se usa | Para qué |
53
- | --- | --- | --- |
54
- | `@boelabs/billete-sdk` | Servidor | Toda la API, con tu clave secreta |
55
- | `@boelabs/billete-sdk/client` | Navegador | Checkout y estado de un cliente, sin clave secreta |
56
- | `@boelabs/billete-sdk/webhooks` | Servidor | Verificar la firma de los webhooks |
52
+ | Import | Dónde se usa | Para qué |
53
+ | ------------------------------- | ------------ | -------------------------------------------------- |
54
+ | `@boelabs/billete-sdk` | Servidor | Toda la API, con tu clave secreta |
55
+ | `@boelabs/billete-sdk/client` | Navegador | Checkout y estado de un cliente, sin clave secreta |
56
+ | `@boelabs/billete-sdk/webhooks` | Servidor | Verificar la firma de los webhooks |
57
57
 
58
58
  ## Inicio rápido
59
59
 
@@ -99,14 +99,14 @@ const billete = createBillete({
99
99
  });
100
100
  ```
101
101
 
102
- | Opción | Por defecto | Descripción |
103
- | --- | --- | --- |
104
- | `environment` | — (obligatoria) | `"test"` o `"production"`. Debe coincidir con la clave. |
105
- | `apiKey` | `BILLETE_API_KEY` | Clave secreta: `sk_test_…` o `sk_prod_…`. |
106
- | `baseUrl` | `BILLETE_BASE_URL`, o `https://api.billete.run` | URL de la API. |
107
- | `timeoutMs` | `30000` | Tiempo máximo por intento. |
108
- | `maxRetries` | `2` | Reintentos ante errores de red, `429` y `5xx`. |
109
- | `fetch` | `globalThis.fetch` | Implementación de `fetch` propia (proxies, tests). |
102
+ | Opción | Por defecto | Descripción |
103
+ | ------------- | ----------------------------------------------- | ------------------------------------------------------- |
104
+ | `environment` | — (obligatoria) | `"test"` o `"production"`. Debe coincidir con la clave. |
105
+ | `apiKey` | `BILLETE_API_KEY` | Clave secreta: `sk_test_…` o `sk_prod_…`. |
106
+ | `baseUrl` | `BILLETE_BASE_URL`, o `https://api.billete.run` | URL de la API. |
107
+ | `timeoutMs` | `30000` | Tiempo máximo por intento. |
108
+ | `maxRetries` | `2` | Reintentos ante errores de red, `429` y `5xx`. |
109
+ | `fetch` | `globalThis.fetch` | Implementación de `fetch` propia (proxies, tests). |
110
110
 
111
111
  Si `environment` no coincide con el prefijo de la clave, `createBillete` lanza un error: una
112
112
  clave de prueba nunca opera en producción ni al revés. Por la misma razón, el cliente de servidor
@@ -121,27 +121,27 @@ se niega a crearse en un navegador.
121
121
  Todos los métodos devuelven promesas con el recurso tipado. Los recursos con listado tienen
122
122
  `create`, `retrieve`, `update`, `list` e `iterate`, además de sus acciones propias:
123
123
 
124
- | Recurso | Acciones propias |
125
- | --- | --- |
126
- | `customers` | — |
127
- | `customerSessions` | `create` |
128
- | `portalSessions` | `create` (enlace al portal del cliente, válido 60 minutos) |
129
- | `products` | `delete`, `deleteVariant` |
130
- | `plans` | `delete` |
131
- | `features` | `delete`, `check`, `isEnabled`, `listForCustomer`, `consume`, `release`, `set` |
132
- | `coupons` | `delete` |
133
- | `checkouts` | `expire` |
134
- | `paymentLinks` | `delete` |
135
- | `invoices` | `void` (cobros: renovaciones y cobros sueltos, con página de pago en `url`) |
136
- | `subscriptions` | `cancel`, `resume` |
137
- | `payments` | `refund`, `listRefunds` |
138
- | `fulfillments` | `deliver`, `submitTracking` (entregas de productos físicos; también `retrieve`, `list` e `iterate`) |
139
- | `payouts` | — |
140
- | `balance` | `retrieve` |
141
- | `webhookEndpoints` | `delete` |
142
- | `events` | `retrieve`, `list`, `iterate` |
143
- | `exchangeRates` | `list` |
144
- | `currencies` | `list` |
124
+ | Recurso | Acciones propias |
125
+ | ------------------ | --------------------------------------------------------------------------------------------------- |
126
+ | `customers` | — |
127
+ | `customerSessions` | `create` |
128
+ | `portalSessions` | `create` (enlace al portal del cliente, válido 60 minutos) |
129
+ | `products` | `delete`, `deleteVariant` |
130
+ | `plans` | `delete` |
131
+ | `features` | `delete`, `check`, `isEnabled`, `listForCustomer`, `consume`, `release`, `set` |
132
+ | `coupons` | `delete` |
133
+ | `checkouts` | `expire` |
134
+ | `paymentLinks` | `delete` |
135
+ | `invoices` | `void` (cobros: renovaciones y cobros sueltos, con página de pago en `url`) |
136
+ | `subscriptions` | `cancel`, `resume` |
137
+ | `payments` | `refund`, `listRefunds` |
138
+ | `fulfillments` | `deliver`, `submitTracking` (entregas de productos físicos; también `retrieve`, `list` e `iterate`) |
139
+ | `payouts` | — |
140
+ | `balance` | `retrieve` |
141
+ | `webhookEndpoints` | `delete` |
142
+ | `events` | `retrieve`, `list`, `iterate` |
143
+ | `exchangeRates` | `list` |
144
+ | `currencies` | `list` |
145
145
 
146
146
  ### Ejemplo: plan con cuotas
147
147
 
@@ -220,14 +220,14 @@ try {
220
220
  }
221
221
  ```
222
222
 
223
- | Propiedad | Descripción |
224
- | --- | --- |
225
- | `type` | Categoría: `invalid_request`, `authentication`, `permission`, `not_found`, `conflict`, `validation`, `rate_limit`, `provider`, `internal` o `network`. |
226
- | `code` | Código estable, apto para decidir en tu código: uno del [catálogo](https://billete.run/docs/api/errors#catálogo-de-códigos) (`BilleteErrorCode`), o `network_error` / `invalid_response` del SDK. |
227
- | `message` | Descripción legible del error. |
228
- | `status` | Código HTTP (`0` si no hubo respuesta). |
229
- | `param` | Campo que causó el error, cuando aplica. |
230
- | `requestId` | Identificador de la petición; inclúyelo al pedir soporte. |
223
+ | Propiedad | Descripción |
224
+ | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
225
+ | `type` | Categoría: `invalid_request`, `authentication`, `permission`, `not_found`, `conflict`, `validation`, `rate_limit`, `provider`, `internal` o `network`. |
226
+ | `code` | Código estable, apto para decidir en tu código: uno del [catálogo](https://billete.run/docs/api/errors#catálogo-de-códigos) (`BilleteErrorCode`), o `network_error` / `invalid_response` del SDK. |
227
+ | `message` | Descripción legible del error. |
228
+ | `status` | Código HTTP (`0` si no hubo respuesta). |
229
+ | `param` | Campo que causó el error, cuando aplica. |
230
+ | `requestId` | Identificador de la petición; inclúyelo al pedir soporte. |
231
231
 
232
232
  ## Idempotencia y reintentos
233
233
 
package/dist/client.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { $ as PortalSessionCreate, A as CustomerSessionCreate, At as PublicPaymentLink, B as FulfillmentTrackingInput, Bt as LatestApiVersion, C as CouponCreate, Ct as PublicCheckout, D as CustomerInput, Dt as PublicFulfillment, E as CustomerCreate, Et as PublicClaimSummary, F as FeatureOperationCreate, Ft as API_VERSION_PATTERN, G as PaymentLinkUpdate, Gt as isApiVersionRetired, H as InvoiceLineInput, Ht as apiVersionStage, I as FeatureUpdate, It as ApiVersion, J as PlanCreate, K as PlanCheckoutCreate, Kt as supportedApiVersions, L as FulfillmentDeliverInput, Lt as ApiVersionLifecycle, M as EventSelector, Mt as PublicPortal, N as FeatureCreate, Nt as API_VERSIONS, O as CustomerMemberCreate, Ot as PublicFulfillmentRefund, P as FeatureOperationCommit, Pt as API_VERSION_HEADER, Q as PlanUpdate, R as FulfillmentHandoverInput, Rt as ApiVersionStage, S as CollectInput, St as PortalFeatures, T as CustomFieldInput, Tt as PublicClaim, U as KEY_PATTERN, Ut as currentApiVersion, V as InvoiceCreate, Vt as apiVersionLifecycle, W as PaymentLinkCreate, Wt as isApiVersion, X as PlanLinkCreate, Y as PlanFeaturesInput, Z as PlanPriceInput, _ as ClientPaymentCode, _t as PaymentInstructions, a as AfterCompletionInput, at as RefundCreate, b as ClientSubscriptionSeats, bt as PaymentNextAction, c as ClaimResolve, ct as SubscriptionChangePreviewInput, d as ClientCheckoutUpdate, dt as VariantInput, et as ProductCheckoutCreate, f as ClientClaimCreate, ft as WebhookEndpointCreate, g as ClientLinkCheckout, gt as FulfillmentOption, h as ClientInvoicePay, ht as CustomerSubscriptionChangeResult, i as TransportOptions, it as ProductUpdate, j as CustomerUpdate, jt as PublicPaymentState, k as CustomerMemberUpdate, kt as PublicInvoice, l as ClaimRespond, lt as SubscriptionCreate, m as ClientFulfillmentProblem, mt as CustomerSubscription, n as BilleteErrorCode, nt as ProductCreate, o as CheckoutCreate, ot as SubscriptionCancel, p as ClientCustomerClaimCreate, pt as WebhookEndpointUpdate, q as PlanCouponCreate, r as RequestOptions, rt as ProductLinkCreate, s as CheckoutItemInput, st as SubscriptionChangeCreate, t as BilleteError, tt as ProductCouponCreate, u as ClientCheckoutPay, ut as SubscriptionUpdate, v as ClientRefundDestination, vt as PaymentMethodField, w as CouponUpdate, wt as PublicCheckoutItem, x as ClientSubscriptionUpdate, xt as PaymentTestScenario, y as ClientSubscriptionCancel, yt as PaymentMethodOption, z as FulfillmentInput, zt as LATEST_API_VERSION } from "./errors-CTtPcwiO.js";
2
- import { $ as FulfillmentHandover, $t as PAYMENT_FAILURE_CODES, A as Coupon, An as ENVIRONMENTS, At as RISK_LEVELS, B as Event, Bt as SubscriptionChangeResult, C as CheckoutPurpose, Cn as TaxBehavior, Ct as PlanSeats, D as ClaimReason, Dn as isLandlinePhone, Dt as ProductVariant, E as ClaimOutcome, En as findBank, Et as ProductCategory, F as CustomerFeature, Ft as SUBSCRIPTION_STATUSES, G as Feature, Gt as WebhookEndpoint, H as FEATURE_TYPES, Ht as SubscriptionStatus, I as CustomerMember, It as SubmitLabel, J as FeatureReset, Jt as ReceiptSend, K as FeatureOperation, Kt as Weekday, L as CustomerMemberList, Lt as Subscription, M as CustomField, Mn as TokenKind, Mt as ResetFrequency, N as Customer, Nn as tokenEnvironment, Nt as RiskLevel, O as ClaimStatus, On as isMobilePhone, Ot as REFUND_MODES, P as CustomerDetails, Pn as tokenPrefix, Pt as SUBMIT_LABELS, Q as FulfillmentChoice, Qt as ApiErrorType, R as CustomerSession, Rt as SubscriptionChange, S as CheckoutItem, Sn as TAX_BEHAVIORS, St as PlanPrice, T as ClaimMessage, Tn as VENEZUELAN_BANKS, Tt as Product, U as FULFILLMENT_METHODS, Ut as SubscriptionTerms, V as ExchangeRate, Vt as SubscriptionRenewal, W as FULFILLMENT_STATUSES, Wt as USAGE_FEATURE_TYPES, X as FeatureUsageResult, Xt as ApiErrorBody, Y as FeatureType, Yt as API_ERROR_TYPES, Z as Fulfillment, Zt as ApiErrorEnvelope, _ as CLAIM_STATUSES, _n as MOBILE_PREFIXES, _t as PaymentSettlement, a as WEBHOOK_TEST_EVENT, an as AddressInput, at as Invoice, b as CarrierOffice, bn as SUSPENSION_DAYS, bt as Plan, c as AfterCompletion, cn as BillingMonths, ct as LineItem, d as CANCELLATION_FEEDBACK, dn as GRACE_PERIOD_DAYS, dt as PRODUCT_CATEGORIES, en as PaymentFailureCode, et as FulfillmentMethod, f as CARRIERS, fn as GracePeriodDays, ft as Payment, g as CLAIM_REASONS, gn as MAX_QUANTITY, gt as PaymentLink, h as CLAIM_OUTCOMES, hn as ListSort, ht as PaymentFeeDetails, i as SubscribableEventType, in as Address, it as INVOICE_STATUSES, j as CurrencyAvailability, jn as Environment, jt as Refund, k as CollectSettings, kn as nationalPhone, kt as RESET_FREQUENCIES, l as Balance, ln as CURRENCIES, lt as MAX_SEATS, m as CHECKOUT_PURPOSES, mn as ListQuery, mt as PaymentFailure, n as EventDataMap, nn as ApiErrorCode, nt as FulfillmentTracking, o as WebhookEvent, on as BILLING_MONTHS, ot as InvoiceReason, p as CARRIER_TEST_SCENARIOS, pn as List, pt as PaymentAttempt, q as FeatureOperationResult, qt as ReceiptReference, r as EventType, rn as ACCOUNT_NUMBER_LENGTH, rt as INVOICE_REASONS, s as Actor, sn as BankCode, st as InvoiceStatus, t as EVENT_TYPES, tn as API_ERROR_CODES, tt as FulfillmentStatus, u as BalanceAmount, un as Currency, ut as PAYMENT_STATUSES, v as CancellationFeedback, vn as Metadata, vt as PaymentStatus, w as Claim, wn as Timestamp, wt as PortalSession, x as Checkout, xn as SuspensionDays, xt as PlanFeatureValues, y as Carrier, yn as MobilePrefix, yt as Payout, z as Deletion, zt as SubscriptionChangePreview } from "./events-Dry7XWQH.js";
3
- //#region src/create-client.d.ts
1
+ import { $ as PortalSessionCreate, A as CustomerSessionCreate, At as PublicPaymentLink, B as FulfillmentTrackingInput, Bt as LatestApiVersion, C as CouponCreate, Ct as PublicCheckout, D as CustomerInput, Dt as PublicFulfillment, E as CustomerCreate, Et as PublicClaimSummary, F as FeatureOperationCreate, Ft as API_VERSION_PATTERN, G as PaymentLinkUpdate, Gt as isApiVersionRetired, H as InvoiceLineInput, Ht as apiVersionStage, I as FeatureUpdate, It as ApiVersion, J as PlanCreate, K as PlanCheckoutCreate, Kt as supportedApiVersions, L as FulfillmentDeliverInput, Lt as ApiVersionLifecycle, M as EventSelector, Mt as PublicPortal, N as FeatureCreate, Nt as API_VERSIONS, O as CustomerMemberCreate, Ot as PublicFulfillmentRefund, P as FeatureOperationCommit, Pt as API_VERSION_HEADER, Q as PlanUpdate, R as FulfillmentHandoverInput, Rt as ApiVersionStage, S as CollectInput, St as PortalFeatures, T as CustomFieldInput, Tt as PublicClaim, U as KEY_PATTERN, Ut as currentApiVersion, V as InvoiceCreate, Vt as apiVersionLifecycle, W as PaymentLinkCreate, Wt as isApiVersion, X as PlanLinkCreate, Y as PlanFeaturesInput, Z as PlanPriceInput, _ as ClientPaymentCode, _t as PaymentInstructions, a as AfterCompletionInput, at as RefundCreate, b as ClientSubscriptionSeats, bt as PaymentNextAction, c as ClaimResolve, ct as SubscriptionChangePreviewInput, d as ClientCheckoutUpdate, dt as VariantInput, et as ProductCheckoutCreate, f as ClientClaimCreate, ft as WebhookEndpointCreate, g as ClientLinkCheckout, gt as FulfillmentOption, h as ClientInvoicePay, ht as CustomerSubscriptionChangeResult, i as TransportOptions, it as ProductUpdate, j as CustomerUpdate, jt as PublicPaymentState, k as CustomerMemberUpdate, kt as PublicInvoice, l as ClaimRespond, lt as SubscriptionCreate, m as ClientFulfillmentProblem, mt as CustomerSubscription, n as BilleteErrorCode, nt as ProductCreate, o as CheckoutCreate, ot as SubscriptionCancel, p as ClientCustomerClaimCreate, pt as WebhookEndpointUpdate, q as PlanCouponCreate, r as RequestOptions, rt as ProductLinkCreate, s as CheckoutItemInput, st as SubscriptionChangeCreate, t as BilleteError, tt as ProductCouponCreate, u as ClientCheckoutPay, ut as SubscriptionUpdate, v as ClientRefundDestination, vt as PaymentMethodField, w as CouponUpdate, wt as PublicCheckoutItem, x as ClientSubscriptionUpdate, xt as PaymentTestScenario, y as ClientSubscriptionCancel, yt as PaymentMethodOption, z as FulfillmentInput, zt as LATEST_API_VERSION } from "./errors-B7u708iH.js";
2
+ import { $ as FulfillmentHandover, $t as PAYMENT_FAILURE_CODES, A as Coupon, An as ENVIRONMENTS, At as RISK_LEVELS, B as Event, Bt as SubscriptionChangeResult, C as CheckoutPurpose, Cn as TaxBehavior, Ct as PlanSeats, D as ClaimReason, Dn as isLandlinePhone, Dt as ProductVariant, E as ClaimOutcome, En as findBank, Et as ProductCategory, F as CustomerFeature, Ft as SUBSCRIPTION_STATUSES, G as Feature, Gt as WebhookEndpoint, H as FEATURE_TYPES, Ht as SubscriptionStatus, I as CustomerMember, It as SubmitLabel, J as FeatureReset, Jt as ReceiptSend, K as FeatureOperation, Kt as Weekday, L as CustomerMemberList, Lt as Subscription, M as CustomField, Mn as TokenKind, Mt as ResetFrequency, N as Customer, Nn as tokenEnvironment, Nt as RiskLevel, O as ClaimStatus, On as isMobilePhone, Ot as REFUND_MODES, P as CustomerDetails, Pn as tokenPrefix, Pt as SUBMIT_LABELS, Q as FulfillmentChoice, Qt as ApiErrorType, R as CustomerSession, Rt as SubscriptionChange, S as CheckoutItem, Sn as TAX_BEHAVIORS, St as PlanPrice, T as ClaimMessage, Tn as VENEZUELAN_BANKS, Tt as Product, U as FULFILLMENT_METHODS, Ut as SubscriptionTerms, V as ExchangeRate, Vt as SubscriptionRenewal, W as FULFILLMENT_STATUSES, Wt as USAGE_FEATURE_TYPES, X as FeatureUsageResult, Xt as ApiErrorBody, Y as FeatureType, Yt as API_ERROR_TYPES, Z as Fulfillment, Zt as ApiErrorEnvelope, _ as CLAIM_STATUSES, _n as MOBILE_PREFIXES, _t as PaymentSettlement, a as WEBHOOK_TEST_EVENT, an as AddressInput, at as Invoice, b as CarrierOffice, bn as SUSPENSION_DAYS, bt as Plan, c as AfterCompletion, cn as BillingMonths, ct as LineItem, d as CANCELLATION_FEEDBACK, dn as GRACE_PERIOD_DAYS, dt as PRODUCT_CATEGORIES, en as PaymentFailureCode, et as FulfillmentMethod, f as CARRIERS, fn as GracePeriodDays, ft as Payment, g as CLAIM_REASONS, gn as MAX_QUANTITY, gt as PaymentLink, h as CLAIM_OUTCOMES, hn as ListSort, ht as PaymentFeeDetails, i as SubscribableEventType, in as Address, it as INVOICE_STATUSES, j as CurrencyAvailability, jn as Environment, jt as Refund, k as CollectSettings, kn as nationalPhone, kt as RESET_FREQUENCIES, l as Balance, ln as CURRENCIES, lt as MAX_SEATS, m as CHECKOUT_PURPOSES, mn as ListQuery, mt as PaymentFailure, n as EventDataMap, nn as ApiErrorCode, nt as FulfillmentTracking, o as WebhookEvent, on as BILLING_MONTHS, ot as InvoiceReason, p as CARRIER_TEST_SCENARIOS, pn as List, pt as PaymentAttempt, q as FeatureOperationResult, qt as ReceiptReference, r as EventType, rn as ACCOUNT_NUMBER_LENGTH, rt as INVOICE_REASONS, s as Actor, sn as BankCode, st as InvoiceStatus, t as EVENT_TYPES, tn as API_ERROR_CODES, tt as FulfillmentStatus, u as BalanceAmount, un as Currency, ut as PAYMENT_STATUSES, v as CancellationFeedback, vn as Metadata, vt as PaymentStatus, w as Claim, wn as Timestamp, wt as PortalSession, x as Checkout, xn as SuspensionDays, xt as PlanFeatureValues, y as Carrier, yn as MobilePrefix, yt as Payout, z as Deletion, zt as SubscriptionChangePreview } from "./events-TqSJMxqF.js";
4
3
  interface ClientOptions extends TransportOptions {
5
4
  /**
6
5
  * Token from `billete.customerSessions.create()` on your server. Needed only for the
@@ -138,5 +137,4 @@ export declare function createClient(options: ClientOptions): {
138
137
  };
139
138
  };
140
139
  type BilleteClient = ReturnType<typeof createClient>;
141
- //#endregion
142
140
  export { type ACCOUNT_NUMBER_LENGTH, type API_ERROR_CODES, 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 ApiErrorCode, type ApiErrorEnvelope, type ApiErrorType, type ApiVersion, type ApiVersionLifecycle, type ApiVersionStage, type BILLING_MONTHS, type Balance, type BalanceAmount, type BankCode, type BilleteClient, BilleteError, type BilleteErrorCode, type BillingMonths, type CANCELLATION_FEEDBACK, type CARRIERS, type CARRIER_TEST_SCENARIOS, type CHECKOUT_PURPOSES, type CLAIM_OUTCOMES, type CLAIM_REASONS, type CLAIM_STATUSES, type CURRENCIES, type CancellationFeedback, type Carrier, type CarrierOffice, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPurpose, type Claim, type ClaimMessage, type ClaimOutcome, type ClaimReason, type ClaimResolve, type ClaimRespond, type ClaimStatus, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientClaimCreate, type ClientCustomerClaimCreate, type ClientFulfillmentProblem, type ClientInvoicePay, type ClientLinkCheckout, type ClientOptions, type ClientPaymentCode, type ClientRefundDestination, 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 Deletion, 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 FulfillmentDeliverInput, type FulfillmentHandover, type FulfillmentHandoverInput, 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 PaymentFeeDetails, 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 PlanCouponCreate, 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 ProductCouponCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicCheckoutItem, type PublicClaim, type PublicClaimSummary, type PublicFulfillment, type PublicFulfillmentRefund, type PublicInvoice, type PublicPaymentLink, type PublicPaymentState, type PublicPortal, type REFUND_MODES, type RESET_FREQUENCIES, type RISK_LEVELS, type ReceiptReference, type ReceiptSend, type Refund, type RefundCreate, type RequestOptions, type ResetFrequency, type RiskLevel, type SUBMIT_LABELS, type SUBSCRIPTION_STATUSES, type SUSPENSION_DAYS, type SubmitLabel, type SubscribableEventType, 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 SuspensionDays, type TAX_BEHAVIORS, type TaxBehavior, type Timestamp, type TokenKind, type USAGE_FEATURE_TYPES, type VENEZUELAN_BANKS, type VariantInput, type WEBHOOK_TEST_EVENT, 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,5 +1,5 @@
1
- import { n as segment, r as BilleteError, t as createTransport } from "./http-BMld1QWi.js";
2
- //#region src/create-client.ts
1
+ import { n as segment, r as BilleteError, t as createTransport } from "./http-B4z0Sbfu.js";
2
+ // src/create-client.ts
3
3
  /**
4
4
  * Browser client. It never holds a secret key: checkouts and Cobros are addressed by their
5
5
  * unguessable ID
@@ -304,5 +304,4 @@ list: (options) => http.request({
304
304
  }
305
305
  };
306
306
  }
307
- //#endregion
308
307
  export { BilleteError, createClient };
@@ -1,5 +1,4 @@
1
- import { C as CheckoutPurpose, Cn as TaxBehavior, Ct as PlanSeats, D as ClaimReason, E as ClaimOutcome, Et as ProductCategory, It as SubmitLabel, J as FeatureReset, Lt as Subscription, M as CustomField, O as ClaimStatus, P as CustomerDetails, Qt as ApiErrorType, S as CheckoutItem, St as PlanPrice, T as ClaimMessage, Xt as ApiErrorBody, Z as Fulfillment, an as AddressInput, b as CarrierOffice, c as AfterCompletion, cn as BillingMonths, ct as LineItem, en as PaymentFailureCode, et as FulfillmentMethod, fn as GracePeriodDays, i as SubscribableEventType, in as Address, jn as Environment, jt as Refund, k as CollectSettings, mt as PaymentFailure, nn as ApiErrorCode, nt as FulfillmentTracking, ot as InvoiceReason, qt as ReceiptReference, st as InvoiceStatus, tt as FulfillmentStatus, un as Currency, v as CancellationFeedback, vn as Metadata, vt as PaymentStatus, wn as Timestamp, xn as SuspensionDays, y as Carrier } from "./events-Dry7XWQH.js";
2
- //#region ../contracts/src/api-versions.d.ts
1
+ import { C as CheckoutPurpose, Cn as TaxBehavior, Ct as PlanSeats, D as ClaimReason, E as ClaimOutcome, Et as ProductCategory, It as SubmitLabel, J as FeatureReset, Lt as Subscription, M as CustomField, O as ClaimStatus, P as CustomerDetails, Qt as ApiErrorType, S as CheckoutItem, St as PlanPrice, T as ClaimMessage, Xt as ApiErrorBody, Z as Fulfillment, an as AddressInput, b as CarrierOffice, c as AfterCompletion, cn as BillingMonths, ct as LineItem, en as PaymentFailureCode, et as FulfillmentMethod, fn as GracePeriodDays, i as SubscribableEventType, in as Address, jn as Environment, jt as Refund, k as CollectSettings, mt as PaymentFailure, nn as ApiErrorCode, nt as FulfillmentTracking, ot as InvoiceReason, qt as ReceiptReference, st as InvoiceStatus, tt as FulfillmentStatus, un as Currency, v as CancellationFeedback, vn as Metadata, vt as PaymentStatus, wn as Timestamp, xn as SuspensionDays, y as Carrier } from "./events-TqSJMxqF.js";
3
2
  /**
4
3
  * Billete API versions. Kept free of runtime dependencies: the dashboard, the API, the worker and
5
4
  * the docs read it, and the public SDK pins its newest entry as a type.
@@ -9,8 +8,11 @@ import { C as CheckoutPurpose, Cn as TaxBehavior, Ct as PlanSeats, D as ClaimRea
9
8
  * ships as a new version. Additive changes (new endpoints, optional fields) reach every version
10
9
  * that is still supported.
11
10
  */
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", "2026-10-09", "2026-10-10", "2026-10-16", "2026-10-19", "2026-10-20", "2026-10-21", "2026-10-24.beta", "2026-10-24"];
11
+ /**
12
+ * Every version published, oldest first. The history starts at `2026-10-24`, the first version
13
+ * open to businesses. Append only: retired versions stay listed.
14
+ */
15
+ declare const API_VERSIONS: readonly ["2026-10-24"];
14
16
  type ApiVersion = (typeof API_VERSIONS)[number];
15
17
  type LatestApiVersion = typeof API_VERSIONS extends readonly [...unknown[], infer Last] ? Last : never;
16
18
  /** The version the code speaks: responses are built in its shape. Always the last entry. */
@@ -42,8 +44,6 @@ declare function supportedApiVersions(now: Date): ApiVersion[];
42
44
  declare function supportedApiVersions<T extends string>(now: Date, registry: readonly T[]): T[];
43
45
  /** What new integrations should use: the newest stable version, or the newest beta before any. */
44
46
  declare function currentApiVersion(): ApiVersion;
45
- //#endregion
46
- //#region ../contracts/src/client.d.ts
47
47
  /**
48
48
  * A subscription as its customer sees it, in the browser: without the business's `metadata`, with
49
49
  * its plan's name and the cycles the customer may switch to.
@@ -287,6 +287,8 @@ interface PublicFulfillment {
287
287
  * and never for a shipment, which the carrier hands over.
288
288
  */
289
289
  handoverUrl: string | null;
290
+ /** When a shipment reached the carrier's office, waiting for the customer to pick it up. */
291
+ readyAt: Timestamp | null;
290
292
  deliveredAt: Timestamp | null;
291
293
  handover: Fulfillment["handover"];
292
294
  confirmBy: Timestamp | null;
@@ -544,8 +546,6 @@ interface PublicClaim extends PublicClaimSummary {
544
546
  withdrawnAt: Timestamp | null;
545
547
  updatedAt: Timestamp;
546
548
  }
547
- //#endregion
548
- //#region ../contracts/src/inputs.d.ts
549
549
  /** Identifiers merchants choose and use in code: `ai_tokens`, `export-pdf`. */
550
550
  declare const KEY_PATTERN: RegExp;
551
551
  interface CustomerCreate {
@@ -1113,8 +1113,6 @@ type ClaimResolve = {
1113
1113
  outcome: "business";
1114
1114
  note: string;
1115
1115
  };
1116
- //#endregion
1117
- //#region src/http.d.ts
1118
1116
  interface TransportOptions {
1119
1117
  /**
1120
1118
  * The Billete API version your integration is written against. Required: Billete never changes
@@ -1141,8 +1139,6 @@ interface RequestOptions {
1141
1139
  idempotencyKey?: string;
1142
1140
  signal?: AbortSignal;
1143
1141
  }
1144
- //#endregion
1145
- //#region src/errors.d.ts
1146
1142
  /**
1147
1143
  * What a failed request says: a code of the API (`API_ERROR_CODES` lists what each means), or the
1148
1144
  * SDK's own when Billete could not be reached (`network_error`) or answered something unexpected
@@ -1161,5 +1157,4 @@ declare class BilleteError extends Error {
1161
1157
  code: BilleteErrorCode;
1162
1158
  }, status: number, options?: ErrorOptions);
1163
1159
  }
1164
- //#endregion
1165
1160
  export { PortalSessionCreate as $, CustomerSessionCreate as A, PublicPaymentLink as At, FulfillmentTrackingInput as B, LatestApiVersion as Bt, CouponCreate as C, PublicCheckout as Ct, CustomerInput as D, PublicFulfillment as Dt, CustomerCreate as E, PublicClaimSummary as Et, FeatureOperationCreate as F, API_VERSION_PATTERN as Ft, PaymentLinkUpdate as G, isApiVersionRetired as Gt, InvoiceLineInput as H, apiVersionStage as Ht, FeatureUpdate as I, ApiVersion as It, PlanCreate as J, PlanCheckoutCreate as K, supportedApiVersions as Kt, FulfillmentDeliverInput as L, ApiVersionLifecycle as Lt, EventSelector as M, PublicPortal as Mt, FeatureCreate as N, API_VERSIONS as Nt, CustomerMemberCreate as O, PublicFulfillmentRefund as Ot, FeatureOperationCommit as P, API_VERSION_HEADER as Pt, PlanUpdate as Q, FulfillmentHandoverInput as R, ApiVersionStage as Rt, CollectInput as S, PortalFeatures as St, CustomFieldInput as T, PublicClaim as Tt, KEY_PATTERN as U, currentApiVersion as Ut, InvoiceCreate as V, apiVersionLifecycle as Vt, PaymentLinkCreate as W, isApiVersion as Wt, PlanLinkCreate as X, PlanFeaturesInput as Y, PlanPriceInput as Z, ClientPaymentCode as _, PaymentInstructions as _t, AfterCompletionInput as a, RefundCreate as at, ClientSubscriptionSeats as b, PaymentNextAction as bt, ClaimResolve as c, SubscriptionChangePreviewInput as ct, ClientCheckoutUpdate as d, VariantInput as dt, ProductCheckoutCreate as et, ClientClaimCreate as f, WebhookEndpointCreate as ft, ClientLinkCheckout as g, FulfillmentOption as gt, ClientInvoicePay as h, CustomerSubscriptionChangeResult as ht, TransportOptions as i, ProductUpdate as it, CustomerUpdate as j, PublicPaymentState as jt, CustomerMemberUpdate as k, PublicInvoice as kt, ClaimRespond as l, SubscriptionCreate as lt, ClientFulfillmentProblem as m, CustomerSubscription as mt, BilleteErrorCode as n, ProductCreate as nt, CheckoutCreate as o, SubscriptionCancel as ot, ClientCustomerClaimCreate as p, WebhookEndpointUpdate as pt, PlanCouponCreate as q, RequestOptions as r, ProductLinkCreate as rt, CheckoutItemInput as s, SubscriptionChangeCreate as st, BilleteError as t, ProductCouponCreate as tt, ClientCheckoutPay as u, SubscriptionUpdate as ut, ClientRefundDestination as v, PaymentMethodField as vt, CouponUpdate as w, PublicCheckoutItem as wt, ClientSubscriptionUpdate as x, PaymentTestScenario as xt, ClientSubscriptionCancel as y, PaymentMethodOption as yt, FulfillmentInput as z, LATEST_API_VERSION as zt };
@@ -1,4 +1,3 @@
1
- //#region ../contracts/src/environment.d.ts
2
1
  /**
3
2
  * Environments and the credentials that name them. Kept free of runtime dependencies: the public
4
3
  * SDK bundles this module to check API keys.
@@ -17,8 +16,6 @@ declare function tokenPrefix(kind: TokenKind, environment: Environment): string;
17
16
  * The environment a token belongs to by its prefix, or `null` when it is not that kind of token.
18
17
  */
19
18
  declare function tokenEnvironment(kind: TokenKind, token: string): Environment | null;
20
- //#endregion
21
- //#region ../contracts/src/common.d.ts
22
19
  /** Currencies Billete can price in. Availability depends on the registered payment providers. */
23
20
  declare const CURRENCIES: readonly ["VES", "USD", "EUR", "USDT"];
24
21
  type Currency = (typeof CURRENCIES)[number];
@@ -255,8 +252,6 @@ interface List<T> {
255
252
  }
256
253
  /** ISO 8601 timestamp in UTC. */
257
254
  type Timestamp = string;
258
- //#endregion
259
- //#region ../contracts/src/error-codes.d.ts
260
255
  /**
261
256
  * Every `code` the API may answer with in `/v1` and `/v1/client`, with what it means. Stable: an
262
257
  * integration may decide on them. A new code is an incompatible change and ships in a new API
@@ -294,7 +289,6 @@ declare const API_ERROR_CODES: {
294
289
  readonly claim_messages_limit: "Este reclamo ya tiene demasiados mensajes: es momento de resolverlo.";
295
290
  readonly claim_not_found: "No existe el reclamo.";
296
291
  readonly coupon_already_used: "Ya usaste este cupón.";
297
- readonly coupon_applies_to_required: "Indica si el cupón es para productos o para planes (appliesTo).";
298
292
  readonly coupon_currency_mismatch: "El cupón solo aplica a precios en otra moneda.";
299
293
  readonly coupon_deleted: "Este cupón fue eliminado y no puede modificarse.";
300
294
  readonly coupon_exhausted: "El cupón alcanzó su límite de usos.";
@@ -482,8 +476,6 @@ declare const API_ERROR_CODES: {
482
476
  readonly webhook_url_unresolvable: "No pudimos resolver el dominio del webhook.";
483
477
  };
484
478
  type ApiErrorCode = keyof typeof API_ERROR_CODES;
485
- //#endregion
486
- //#region ../contracts/src/errors.d.ts
487
479
  declare const API_ERROR_TYPES: readonly ["invalid_request", "authentication", "permission", "not_found", "conflict", "validation", "rate_limit", "provider", "internal"];
488
480
  type ApiErrorType = (typeof API_ERROR_TYPES)[number];
489
481
  interface ApiErrorBody {
@@ -507,8 +499,6 @@ declare const PAYMENT_FAILURE_CODES: readonly ["insufficient_funds", "payment_no
507
499
  /** The payer left the page while it waited for their code, and did not come back in time. */
508
500
  "abandoned"];
509
501
  type PaymentFailureCode = (typeof PAYMENT_FAILURE_CODES)[number];
510
- //#endregion
511
- //#region ../contracts/src/receipts.d.ts
512
502
  interface ReceiptReference {
513
503
  id: string;
514
504
  number: string;
@@ -516,8 +506,6 @@ interface ReceiptReference {
516
506
  interface ReceiptSend {
517
507
  email?: string;
518
508
  }
519
- //#endregion
520
- //#region ../contracts/src/resources.d.ts
521
509
  interface Resource<TObject extends string> {
522
510
  id: string;
523
511
  object: TObject;
@@ -1125,6 +1113,8 @@ interface Fulfillment extends Resource<"fulfillment"> {
1125
1113
  number: string;
1126
1114
  reason: string;
1127
1115
  } | null;
1116
+ /** When the carrier reported a shipment at the office, waiting for its customer. */
1117
+ readyAt: Timestamp | null;
1128
1118
  deliveredAt: Timestamp | null;
1129
1119
  /** How it was handed over, once the business did; `null` before, and for a shipment. */
1130
1120
  handover: FulfillmentHandover | null;
@@ -1412,8 +1402,6 @@ interface PortalSession {
1412
1402
  returnUrl: string | null;
1413
1403
  expiresAt: Timestamp;
1414
1404
  }
1415
- //#endregion
1416
- //#region ../contracts/src/events.d.ts
1417
1405
  interface EventDataMap {
1418
1406
  "product.updated": Product;
1419
1407
  "product.deleted": Product;
@@ -1502,5 +1490,4 @@ type WebhookEvent = { [TType in EventType]: {
1502
1490
  createdAt: string;
1503
1491
  data: EventDataMap[TType];
1504
1492
  }; }[EventType];
1505
- //#endregion
1506
1493
  export { FulfillmentHandover as $, PAYMENT_FAILURE_CODES as $t, Coupon as A, ENVIRONMENTS as An, RISK_LEVELS as At, Event as B, SubscriptionChangeResult as Bt, CheckoutPurpose as C, TaxBehavior as Cn, PlanSeats as Ct, ClaimReason as D, isLandlinePhone as Dn, ProductVariant as Dt, ClaimOutcome as E, findBank as En, ProductCategory as Et, CustomerFeature as F, SUBSCRIPTION_STATUSES as Ft, Feature as G, WebhookEndpoint as Gt, FEATURE_TYPES as H, SubscriptionStatus as Ht, CustomerMember as I, SubmitLabel as It, FeatureReset as J, ReceiptSend as Jt, FeatureOperation as K, Weekday as Kt, CustomerMemberList as L, Subscription as Lt, CustomField as M, TokenKind as Mn, ResetFrequency as Mt, Customer as N, tokenEnvironment as Nn, RiskLevel as Nt, ClaimStatus as O, isMobilePhone as On, REFUND_MODES as Ot, CustomerDetails as P, tokenPrefix as Pn, SUBMIT_LABELS as Pt, FulfillmentChoice as Q, ApiErrorType as Qt, CustomerSession as R, SubscriptionChange as Rt, CheckoutItem as S, TAX_BEHAVIORS as Sn, PlanPrice as St, ClaimMessage as T, VENEZUELAN_BANKS as Tn, Product as Tt, FULFILLMENT_METHODS as U, SubscriptionTerms as Ut, ExchangeRate as V, SubscriptionRenewal as Vt, FULFILLMENT_STATUSES as W, USAGE_FEATURE_TYPES as Wt, FeatureUsageResult as X, ApiErrorBody as Xt, FeatureType as Y, API_ERROR_TYPES as Yt, Fulfillment as Z, ApiErrorEnvelope as Zt, CLAIM_STATUSES as _, MOBILE_PREFIXES as _n, PaymentSettlement as _t, WEBHOOK_TEST_EVENT as a, AddressInput as an, Invoice as at, CarrierOffice as b, SUSPENSION_DAYS as bn, Plan as bt, AfterCompletion as c, BillingMonths as cn, LineItem as ct, CANCELLATION_FEEDBACK as d, GRACE_PERIOD_DAYS as dn, PRODUCT_CATEGORIES as dt, PaymentFailureCode as en, FulfillmentMethod as et, CARRIERS as f, GracePeriodDays as fn, Payment as ft, CLAIM_REASONS as g, MAX_QUANTITY as gn, PaymentLink as gt, CLAIM_OUTCOMES as h, ListSort as hn, PaymentFeeDetails as ht, SubscribableEventType as i, Address as in, INVOICE_STATUSES as it, CurrencyAvailability as j, Environment as jn, Refund as jt, CollectSettings as k, nationalPhone as kn, RESET_FREQUENCIES as kt, Balance as l, CURRENCIES as ln, MAX_SEATS as lt, CHECKOUT_PURPOSES as m, ListQuery as mn, PaymentFailure as mt, EventDataMap as n, ApiErrorCode as nn, FulfillmentTracking as nt, WebhookEvent as o, BILLING_MONTHS as on, InvoiceReason as ot, CARRIER_TEST_SCENARIOS as p, List as pn, PaymentAttempt as pt, FeatureOperationResult as q, ReceiptReference as qt, EventType as r, ACCOUNT_NUMBER_LENGTH as rn, INVOICE_REASONS as rt, Actor as s, BankCode as sn, InvoiceStatus as st, EVENT_TYPES as t, API_ERROR_CODES as tn, FulfillmentStatus as tt, BalanceAmount as u, Currency as un, PAYMENT_STATUSES as ut, CancellationFeedback as v, Metadata as vn, PaymentStatus as vt, Claim as w, Timestamp as wn, PortalSession as wt, Checkout as x, SuspensionDays as xn, PlanFeatureValues as xt, Carrier as y, MobilePrefix as yn, Payout as yt, Deletion as z, SubscriptionChangePreview as zt };
@@ -1,4 +1,4 @@
1
- //#region src/errors.ts
1
+ // src/errors.ts
2
2
  /** Any failed Billete request. `type`/`code` are stable and safe to branch on. */
3
3
  var BilleteError = class extends Error {
4
4
  type;
@@ -16,9 +16,8 @@ var BilleteError = class extends Error {
16
16
  this.requestId = body.requestId;
17
17
  }
18
18
  };
19
- //#endregion
20
- //#region src/http.ts
21
- const SDK_VERSION = "9.0.0";
19
+ // src/http.ts
20
+ const SDK_VERSION = "9.1.0";
22
21
  const DEFAULT_BASE_URL = "https://api.billete.run";
23
22
  const RETRYABLE_STATUS = /* @__PURE__ */ new Set([
24
23
  429,
@@ -147,5 +146,4 @@ function createTransport(options) {
147
146
  function segment(value) {
148
147
  return encodeURIComponent(value);
149
148
  }
150
- //#endregion
151
149
  export { segment as n, BilleteError as r, createTransport as t };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import { $ as PortalSessionCreate, A as CustomerSessionCreate, At as PublicPaymentLink, B as FulfillmentTrackingInput, Bt as LatestApiVersion, C as CouponCreate, Ct as PublicCheckout, D as CustomerInput, Dt as PublicFulfillment, E as CustomerCreate, Et as PublicClaimSummary, F as FeatureOperationCreate, Ft as API_VERSION_PATTERN, G as PaymentLinkUpdate, Gt as isApiVersionRetired, H as InvoiceLineInput, Ht as apiVersionStage, I as FeatureUpdate, It as ApiVersion, J as PlanCreate, K as PlanCheckoutCreate, Kt as supportedApiVersions, L as FulfillmentDeliverInput, Lt as ApiVersionLifecycle, M as EventSelector, Mt as PublicPortal, N as FeatureCreate, Nt as API_VERSIONS, O as CustomerMemberCreate, Ot as PublicFulfillmentRefund, P as FeatureOperationCommit, Pt as API_VERSION_HEADER, Q as PlanUpdate, R as FulfillmentHandoverInput, Rt as ApiVersionStage, S as CollectInput, St as PortalFeatures, T as CustomFieldInput, Tt as PublicClaim, U as KEY_PATTERN, Ut as currentApiVersion, V as InvoiceCreate, Vt as apiVersionLifecycle, W as PaymentLinkCreate, Wt as isApiVersion, X as PlanLinkCreate, Y as PlanFeaturesInput, Z as PlanPriceInput, _ as ClientPaymentCode, _t as PaymentInstructions, a as AfterCompletionInput, at as RefundCreate, b as ClientSubscriptionSeats, bt as PaymentNextAction, c as ClaimResolve, ct as SubscriptionChangePreviewInput, d as ClientCheckoutUpdate, dt as VariantInput, et as ProductCheckoutCreate, f as ClientClaimCreate, ft as WebhookEndpointCreate, g as ClientLinkCheckout, gt as FulfillmentOption, h as ClientInvoicePay, ht as CustomerSubscriptionChangeResult, i as TransportOptions, it as ProductUpdate, j as CustomerUpdate, jt as PublicPaymentState, k as CustomerMemberUpdate, kt as PublicInvoice, l as ClaimRespond, lt as SubscriptionCreate, m as ClientFulfillmentProblem, mt as CustomerSubscription, n as BilleteErrorCode, nt as ProductCreate, o as CheckoutCreate, ot as SubscriptionCancel, p as ClientCustomerClaimCreate, pt as WebhookEndpointUpdate, q as PlanCouponCreate, r as RequestOptions, rt as ProductLinkCreate, s as CheckoutItemInput, st as SubscriptionChangeCreate, t as BilleteError, tt as ProductCouponCreate, u as ClientCheckoutPay, ut as SubscriptionUpdate, v as ClientRefundDestination, vt as PaymentMethodField, w as CouponUpdate, wt as PublicCheckoutItem, x as ClientSubscriptionUpdate, xt as PaymentTestScenario, y as ClientSubscriptionCancel, yt as PaymentMethodOption, z as FulfillmentInput, zt as LATEST_API_VERSION } from "./errors-CTtPcwiO.js";
2
- import { $ as FulfillmentHandover, $t as PAYMENT_FAILURE_CODES, A as Coupon, An as ENVIRONMENTS, At as RISK_LEVELS, B as Event, Bt as SubscriptionChangeResult, C as CheckoutPurpose, Cn as TaxBehavior, Ct as PlanSeats, D as ClaimReason, Dn as isLandlinePhone, Dt as ProductVariant, E as ClaimOutcome, En as findBank, Et as ProductCategory, F as CustomerFeature, Ft as SUBSCRIPTION_STATUSES, G as Feature, Gt as WebhookEndpoint, H as FEATURE_TYPES, Ht as SubscriptionStatus, I as CustomerMember, It as SubmitLabel, J as FeatureReset, Jt as ReceiptSend, K as FeatureOperation, Kt as Weekday, L as CustomerMemberList, Lt as Subscription, M as CustomField, Mn as TokenKind, Mt as ResetFrequency, N as Customer, Nn as tokenEnvironment, Nt as RiskLevel, O as ClaimStatus, On as isMobilePhone, Ot as REFUND_MODES, P as CustomerDetails, Pn as tokenPrefix, Pt as SUBMIT_LABELS, Q as FulfillmentChoice, Qt as ApiErrorType, R as CustomerSession, Rt as SubscriptionChange, S as CheckoutItem, Sn as TAX_BEHAVIORS, St as PlanPrice, T as ClaimMessage, Tn as VENEZUELAN_BANKS, Tt as Product, U as FULFILLMENT_METHODS, Ut as SubscriptionTerms, V as ExchangeRate, Vt as SubscriptionRenewal, W as FULFILLMENT_STATUSES, Wt as USAGE_FEATURE_TYPES, X as FeatureUsageResult, Xt as ApiErrorBody, Y as FeatureType, Yt as API_ERROR_TYPES, Z as Fulfillment, Zt as ApiErrorEnvelope, _ as CLAIM_STATUSES, _n as MOBILE_PREFIXES, _t as PaymentSettlement, a as WEBHOOK_TEST_EVENT, an as AddressInput, at as Invoice, b as CarrierOffice, bn as SUSPENSION_DAYS, bt as Plan, c as AfterCompletion, cn as BillingMonths, ct as LineItem, d as CANCELLATION_FEEDBACK, dn as GRACE_PERIOD_DAYS, dt as PRODUCT_CATEGORIES, en as PaymentFailureCode, et as FulfillmentMethod, f as CARRIERS, fn as GracePeriodDays, ft as Payment, g as CLAIM_REASONS, gn as MAX_QUANTITY, gt as PaymentLink, h as CLAIM_OUTCOMES, hn as ListSort, ht as PaymentFeeDetails, i as SubscribableEventType, in as Address, it as INVOICE_STATUSES, j as CurrencyAvailability, jn as Environment, jt as Refund, k as CollectSettings, kn as nationalPhone, kt as RESET_FREQUENCIES, l as Balance, ln as CURRENCIES, lt as MAX_SEATS, m as CHECKOUT_PURPOSES, mn as ListQuery, mt as PaymentFailure, n as EventDataMap, nn as ApiErrorCode, nt as FulfillmentTracking, o as WebhookEvent, on as BILLING_MONTHS, ot as InvoiceReason, p as CARRIER_TEST_SCENARIOS, pn as List, pt as PaymentAttempt, q as FeatureOperationResult, qt as ReceiptReference, r as EventType, rn as ACCOUNT_NUMBER_LENGTH, rt as INVOICE_REASONS, s as Actor, sn as BankCode, st as InvoiceStatus, t as EVENT_TYPES, tn as API_ERROR_CODES, tt as FulfillmentStatus, u as BalanceAmount, un as Currency, ut as PAYMENT_STATUSES, v as CancellationFeedback, vn as Metadata, vt as PaymentStatus, w as Claim, wn as Timestamp, wt as PortalSession, x as Checkout, xn as SuspensionDays, xt as PlanFeatureValues, y as Carrier, yn as MobilePrefix, yt as Payout, z as Deletion, zt as SubscriptionChangePreview } from "./events-Dry7XWQH.js";
1
+ import { $ as FulfillmentHandover, $t as PAYMENT_FAILURE_CODES, A as Coupon, An as ENVIRONMENTS, At as RISK_LEVELS, B as Event, Bt as SubscriptionChangeResult, C as CheckoutPurpose, Cn as TaxBehavior, Ct as PlanSeats, D as ClaimReason, Dn as isLandlinePhone, Dt as ProductVariant, E as ClaimOutcome, En as findBank, Et as ProductCategory, F as CustomerFeature, Ft as SUBSCRIPTION_STATUSES, G as Feature, Gt as WebhookEndpoint, H as FEATURE_TYPES, Ht as SubscriptionStatus, I as CustomerMember, It as SubmitLabel, J as FeatureReset, Jt as ReceiptSend, K as FeatureOperation, Kt as Weekday, L as CustomerMemberList, Lt as Subscription, M as CustomField, Mn as TokenKind, Mt as ResetFrequency, N as Customer, Nn as tokenEnvironment, Nt as RiskLevel, O as ClaimStatus, On as isMobilePhone, Ot as REFUND_MODES, P as CustomerDetails, Pn as tokenPrefix, Pt as SUBMIT_LABELS, Q as FulfillmentChoice, Qt as ApiErrorType, R as CustomerSession, Rt as SubscriptionChange, S as CheckoutItem, Sn as TAX_BEHAVIORS, St as PlanPrice, T as ClaimMessage, Tn as VENEZUELAN_BANKS, Tt as Product, U as FULFILLMENT_METHODS, Ut as SubscriptionTerms, V as ExchangeRate, Vt as SubscriptionRenewal, W as FULFILLMENT_STATUSES, Wt as USAGE_FEATURE_TYPES, X as FeatureUsageResult, Xt as ApiErrorBody, Y as FeatureType, Yt as API_ERROR_TYPES, Z as Fulfillment, Zt as ApiErrorEnvelope, _ as CLAIM_STATUSES, _n as MOBILE_PREFIXES, _t as PaymentSettlement, a as WEBHOOK_TEST_EVENT, an as AddressInput, at as Invoice, b as CarrierOffice, bn as SUSPENSION_DAYS, bt as Plan, c as AfterCompletion, cn as BillingMonths, ct as LineItem, d as CANCELLATION_FEEDBACK, dn as GRACE_PERIOD_DAYS, dt as PRODUCT_CATEGORIES, en as PaymentFailureCode, et as FulfillmentMethod, f as CARRIERS, fn as GracePeriodDays, ft as Payment, g as CLAIM_REASONS, gn as MAX_QUANTITY, gt as PaymentLink, h as CLAIM_OUTCOMES, hn as ListSort, ht as PaymentFeeDetails, i as SubscribableEventType, in as Address, it as INVOICE_STATUSES, j as CurrencyAvailability, jn as Environment, jt as Refund, k as CollectSettings, kn as nationalPhone, kt as RESET_FREQUENCIES, l as Balance, ln as CURRENCIES, lt as MAX_SEATS, m as CHECKOUT_PURPOSES, mn as ListQuery, mt as PaymentFailure, n as EventDataMap, nn as ApiErrorCode, nt as FulfillmentTracking, o as WebhookEvent, on as BILLING_MONTHS, ot as InvoiceReason, p as CARRIER_TEST_SCENARIOS, pn as List, pt as PaymentAttempt, q as FeatureOperationResult, qt as ReceiptReference, r as EventType, rn as ACCOUNT_NUMBER_LENGTH, rt as INVOICE_REASONS, s as Actor, sn as BankCode, st as InvoiceStatus, t as EVENT_TYPES, tn as API_ERROR_CODES, tt as FulfillmentStatus, u as BalanceAmount, un as Currency, ut as PAYMENT_STATUSES, v as CancellationFeedback, vn as Metadata, vt as PaymentStatus, w as Claim, wn as Timestamp, wt as PortalSession, x as Checkout, xn as SuspensionDays, xt as PlanFeatureValues, y as Carrier, yn as MobilePrefix, yt as Payout, z as Deletion, zt as SubscriptionChangePreview } from "./events-TqSJMxqF.js";
2
+ import { $ as PortalSessionCreate, A as CustomerSessionCreate, At as PublicPaymentLink, B as FulfillmentTrackingInput, Bt as LatestApiVersion, C as CouponCreate, Ct as PublicCheckout, D as CustomerInput, Dt as PublicFulfillment, E as CustomerCreate, Et as PublicClaimSummary, F as FeatureOperationCreate, Ft as API_VERSION_PATTERN, G as PaymentLinkUpdate, Gt as isApiVersionRetired, H as InvoiceLineInput, Ht as apiVersionStage, I as FeatureUpdate, It as ApiVersion, J as PlanCreate, K as PlanCheckoutCreate, Kt as supportedApiVersions, L as FulfillmentDeliverInput, Lt as ApiVersionLifecycle, M as EventSelector, Mt as PublicPortal, N as FeatureCreate, Nt as API_VERSIONS, O as CustomerMemberCreate, Ot as PublicFulfillmentRefund, P as FeatureOperationCommit, Pt as API_VERSION_HEADER, Q as PlanUpdate, R as FulfillmentHandoverInput, Rt as ApiVersionStage, S as CollectInput, St as PortalFeatures, T as CustomFieldInput, Tt as PublicClaim, U as KEY_PATTERN, Ut as currentApiVersion, V as InvoiceCreate, Vt as apiVersionLifecycle, W as PaymentLinkCreate, Wt as isApiVersion, X as PlanLinkCreate, Y as PlanFeaturesInput, Z as PlanPriceInput, _ as ClientPaymentCode, _t as PaymentInstructions, a as AfterCompletionInput, at as RefundCreate, b as ClientSubscriptionSeats, bt as PaymentNextAction, c as ClaimResolve, ct as SubscriptionChangePreviewInput, d as ClientCheckoutUpdate, dt as VariantInput, et as ProductCheckoutCreate, f as ClientClaimCreate, ft as WebhookEndpointCreate, g as ClientLinkCheckout, gt as FulfillmentOption, h as ClientInvoicePay, ht as CustomerSubscriptionChangeResult, i as TransportOptions, it as ProductUpdate, j as CustomerUpdate, jt as PublicPaymentState, k as CustomerMemberUpdate, kt as PublicInvoice, l as ClaimRespond, lt as SubscriptionCreate, m as ClientFulfillmentProblem, mt as CustomerSubscription, n as BilleteErrorCode, nt as ProductCreate, o as CheckoutCreate, ot as SubscriptionCancel, p as ClientCustomerClaimCreate, pt as WebhookEndpointUpdate, q as PlanCouponCreate, r as RequestOptions, rt as ProductLinkCreate, s as CheckoutItemInput, st as SubscriptionChangeCreate, t as BilleteError, tt as ProductCouponCreate, u as ClientCheckoutPay, ut as SubscriptionUpdate, v as ClientRefundDestination, vt as PaymentMethodField, w as CouponUpdate, wt as PublicCheckoutItem, x as ClientSubscriptionUpdate, xt as PaymentTestScenario, y as ClientSubscriptionCancel, yt as PaymentMethodOption, z as FulfillmentInput, zt as LATEST_API_VERSION } from "./errors-B7u708iH.js";
3
3
  import { WebhookVerificationError, verifyWebhook } from "./webhooks.js";
4
- //#region src/server.d.ts
5
4
  type Filters<T> = ListQuery & T;
6
5
  type MemberOptions = RequestOptions & {
7
6
  member?: string;
@@ -388,5 +387,4 @@ export declare function createBillete(options: BilleteOptions): {
388
387
  };
389
388
  /** The server client: what `createBillete` returns. */
390
389
  type Billete = ReturnType<typeof createBillete>;
391
- //#endregion
392
390
  export { type ACCOUNT_NUMBER_LENGTH, type API_ERROR_CODES, 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 ApiErrorCode, type ApiErrorEnvelope, type ApiErrorType, type ApiVersion, type ApiVersionLifecycle, type ApiVersionStage, type BILLING_MONTHS, type Balance, type BalanceAmount, type BankCode, type Billete, BilleteError, type BilleteErrorCode, type BilleteOptions, type BillingMonths, type CANCELLATION_FEEDBACK, type CARRIERS, type CARRIER_TEST_SCENARIOS, type CHECKOUT_PURPOSES, type CLAIM_OUTCOMES, type CLAIM_REASONS, type CLAIM_STATUSES, type CURRENCIES, type CancellationFeedback, type Carrier, type CarrierOffice, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPurpose, type Claim, type ClaimMessage, type ClaimOutcome, type ClaimReason, type ClaimResolve, type ClaimRespond, type ClaimStatus, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientClaimCreate, type ClientCustomerClaimCreate, type ClientFulfillmentProblem, type ClientInvoicePay, type ClientLinkCheckout, type ClientPaymentCode, type ClientRefundDestination, 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 Deletion, 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 FulfillmentDeliverInput, type FulfillmentHandover, type FulfillmentHandoverInput, 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 PaymentFeeDetails, 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 PlanCouponCreate, 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 ProductCouponCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicCheckoutItem, type PublicClaim, type PublicClaimSummary, type PublicFulfillment, type PublicFulfillmentRefund, type PublicInvoice, type PublicPaymentLink, type PublicPaymentState, type PublicPortal, type REFUND_MODES, type RESET_FREQUENCIES, type RISK_LEVELS, type ReceiptReference, type ReceiptSend, type Refund, type RefundCreate, type RequestOptions, type ResetFrequency, type RiskLevel, type SUBMIT_LABELS, type SUBSCRIPTION_STATUSES, type SUSPENSION_DAYS, type SubmitLabel, type SubscribableEventType, 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 SuspensionDays, type TAX_BEHAVIORS, type TaxBehavior, type Timestamp, type TokenKind, type TransportOptions, type USAGE_FEATURE_TYPES, type VENEZUELAN_BANKS, type VariantInput, type WEBHOOK_TEST_EVENT, 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,6 +1,6 @@
1
- import { n as segment, r as BilleteError, t as createTransport } from "./http-BMld1QWi.js";
1
+ import { n as segment, r as BilleteError, t as createTransport } from "./http-B4z0Sbfu.js";
2
2
  import { WebhookVerificationError, verifyWebhook } from "./webhooks.js";
3
- //#region ../contracts/src/environment.ts
3
+ // ../contracts/src/environment.ts
4
4
  /**
5
5
  * Environments and the credentials that name them. Kept free of runtime dependencies: the public
6
6
  * SDK bundles this module to check API keys.
@@ -25,8 +25,7 @@ function tokenPrefix(kind, environment) {
25
25
  function tokenEnvironment(kind, token) {
26
26
  return ENVIRONMENTS.find((environment) => token.startsWith(tokenPrefix(kind, environment))) ?? null;
27
27
  }
28
- //#endregion
29
- //#region src/server.ts
28
+ // src/server.ts
30
29
  function collection(http, path) {
31
30
  return {
32
31
  create: (input, options) => http.request({
@@ -488,5 +487,4 @@ verify: (payload, headers, secret) => verifyWebhook({
488
487
  }) }
489
488
  };
490
489
  }
491
- //#endregion
492
490
  export { BilleteError, WebhookVerificationError, createBillete, verifyWebhook };
@@ -1,5 +1,4 @@
1
- import { o as WebhookEvent } from "./events-Dry7XWQH.js";
2
- //#region src/webhooks.d.ts
1
+ import { o as WebhookEvent } from "./events-TqSJMxqF.js";
3
2
  export declare class WebhookVerificationError extends Error {
4
3
  constructor(message: string);
5
4
  }
@@ -15,4 +14,4 @@ export declare function verifyWebhook(input: {
15
14
  toleranceSeconds?: number;
16
15
  now?: Date;
17
16
  }): Promise<WebhookEvent>;
18
- //#endregion
17
+ export {};
package/dist/webhooks.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/webhooks.ts
1
+ // src/webhooks.ts
2
2
  var WebhookVerificationError = class extends Error {
3
3
  constructor(message) {
4
4
  super(message);
@@ -40,5 +40,4 @@ async function verifyWebhook(input) {
40
40
  if (!signatures.split(" ").some((candidate) => candidate.startsWith("v1,") && constantTimeEqual(candidate.slice(3), expected))) throw new WebhookVerificationError("Invalid webhook signature");
41
41
  return JSON.parse(input.payload);
42
42
  }
43
- //#endregion
44
43
  export { WebhookVerificationError, verifyWebhook };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boelabs/billete-sdk",
3
- "version": "9.0.0",
3
+ "version": "9.1.0",
4
4
  "description": "Billete SDK: server client, browser client and webhook verification",
5
5
  "keywords": [
6
6
  "billete",
@@ -39,10 +39,10 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@boelabs/billete-contracts": "0.1.0",
42
- "tsdown": "0.23.0",
42
+ "tsdown": "0.23.4",
43
43
  "typescript": "7.0.2",
44
- "vite": "8.3.1",
45
- "vitest": "5.0.2"
44
+ "vite": "8.3.5",
45
+ "vitest": "5.0.5"
46
46
  },
47
47
  "sideEffects": false,
48
48
  "scripts": {