@boelabs/billete-sdk 9.0.0 → 9.2.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 +42 -42
- package/dist/client.d.ts +3 -5
- package/dist/client.js +2 -3
- package/dist/{errors-CTtPcwiO.d.ts → errors-BOTgfVNl.d.ts} +25 -44
- package/dist/{events-Dry7XWQH.d.ts → events-D9CrG3Kp.d.ts} +12 -16
- package/dist/{http-BMld1QWi.js → http-SRcg7gff.js} +3 -5
- package/dist/index.d.ts +3 -5
- package/dist/index.js +3 -5
- package/dist/webhooks.d.ts +2 -3
- package/dist/webhooks.js +1 -2
- package/package.json +4 -4
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
|
|
53
|
-
|
|
|
54
|
-
| `@boelabs/billete-sdk`
|
|
55
|
-
| `@boelabs/billete-sdk/client`
|
|
56
|
-
| `@boelabs/billete-sdk/webhooks` | Servidor
|
|
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
|
|
103
|
-
|
|
|
104
|
-
| `environment` | — (obligatoria)
|
|
105
|
-
| `apiKey`
|
|
106
|
-
| `baseUrl`
|
|
107
|
-
| `timeoutMs`
|
|
108
|
-
| `maxRetries`
|
|
109
|
-
| `fetch`
|
|
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
|
|
125
|
-
|
|
|
126
|
-
| `customers`
|
|
127
|
-
| `customerSessions` | `create`
|
|
128
|
-
| `portalSessions`
|
|
129
|
-
| `products`
|
|
130
|
-
| `plans`
|
|
131
|
-
| `features`
|
|
132
|
-
| `coupons`
|
|
133
|
-
| `checkouts`
|
|
134
|
-
| `paymentLinks`
|
|
135
|
-
| `invoices`
|
|
136
|
-
| `subscriptions`
|
|
137
|
-
| `payments`
|
|
138
|
-
| `fulfillments`
|
|
139
|
-
| `payouts`
|
|
140
|
-
| `balance`
|
|
141
|
-
| `webhookEndpoints` | `delete`
|
|
142
|
-
| `events`
|
|
143
|
-
| `exchangeRates`
|
|
144
|
-
| `currencies`
|
|
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
|
|
224
|
-
|
|
|
225
|
-
| `type`
|
|
226
|
-
| `code`
|
|
227
|
-
| `message`
|
|
228
|
-
| `status`
|
|
229
|
-
| `param`
|
|
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
|
|
2
|
-
import { $ as FulfillmentHandover, $t as
|
|
3
|
-
//#region src/create-client.d.ts
|
|
1
|
+
import { $ as PortalSessionCreate, A as CustomerSessionCreate, At as PublicMerchant, B as FulfillmentTrackingInput, Bt as LATEST_API_VERSION, 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_HEADER, G as PaymentLinkUpdate, Gt as isApiVersion, H as InvoiceLineInput, Ht as apiVersionLifecycle, I as FeatureUpdate, It as API_VERSION_PATTERN, J as PlanCreate, K as PlanCheckoutCreate, Kt as isApiVersionRetired, L as FulfillmentDeliverInput, Lt as ApiVersion, M as EventSelector, Mt as PublicPaymentState, N as FeatureCreate, Nt as PublicPortal, O as CustomerMemberCreate, Ot as PublicFulfillmentRefund, P as FeatureOperationCommit, Pt as API_VERSIONS, Q as PlanUpdate, R as FulfillmentHandoverInput, Rt as ApiVersionLifecycle, S as CollectInput, St as PortalFeatures, T as CustomFieldInput, Tt as PublicClaim, U as KEY_PATTERN, Ut as apiVersionStage, V as InvoiceCreate, Vt as LatestApiVersion, W as PaymentLinkCreate, Wt as currentApiVersion, 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 PublicPaymentLink, 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, qt as supportedApiVersions, 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 ApiVersionStage } from "./errors-BOTgfVNl.js";
|
|
2
|
+
import { $ as FulfillmentHandover, $t as ApiErrorType, A as Coupon, An as nationalPhone, At as RESET_FREQUENCIES, B as Event, Bt as SubscriptionChangePreview, C as CheckoutPurpose, Cn as TAX_BEHAVIORS, Ct as PlanSeats, D as ClaimReason, Dn as findBank, Dt as ProductImage, E as ClaimOutcome, En as VENEZUELAN_BANKS, Et as ProductCategory, F as CustomerFeature, Fn as tokenPrefix, Ft as SUBMIT_LABELS, G as Feature, Gt as USAGE_FEATURE_TYPES, H as FEATURE_TYPES, Ht as SubscriptionRenewal, I as CustomerMember, It as SUBSCRIPTION_STATUSES, J as FeatureReset, Jt as ReceiptReference, K as FeatureOperation, Kt as WebhookEndpoint, L as CustomerMemberList, Lt as SubmitLabel, M as CustomField, Mn as Environment, Mt as Refund, N as Customer, Nn as TokenKind, Nt as ResetFrequency, O as ClaimStatus, On as isLandlinePhone, Ot as ProductVariant, P as CustomerDetails, Pn as tokenEnvironment, Pt as RiskLevel, Q as FulfillmentChoice, Qt as ApiErrorEnvelope, R as CustomerSession, Rt as Subscription, S as CheckoutItem, Sn as SuspensionDays, St as PlanPrice, T as ClaimMessage, Tn as Timestamp, Tt as Product, U as FULFILLMENT_METHODS, Ut as SubscriptionStatus, V as ExchangeRate, Vt as SubscriptionChangeResult, W as FULFILLMENT_STATUSES, Wt as SubscriptionTerms, X as FeatureUsageResult, Xt as API_ERROR_TYPES, Y as FeatureType, Yt as ReceiptSend, Z as Fulfillment, Zt as ApiErrorBody, _ as CLAIM_STATUSES, _n as MAX_QUANTITY, _t as PaymentSettlement, a as WEBHOOK_TEST_EVENT, an as Address, at as Invoice, b as CarrierOffice, bn as MobilePrefix, bt as Plan, c as AfterCompletion, cn as BankCode, ct as LineItem, d as CANCELLATION_FEEDBACK, dn as Currency, dt as PRODUCT_CATEGORIES, en as PAYMENT_FAILURE_CODES, et as FulfillmentMethod, f as CARRIERS, fn as GRACE_PERIOD_DAYS, ft as Payment, g as CLAIM_REASONS, gn as ListSort, gt as PaymentLink, h as CLAIM_OUTCOMES, hn as ListQuery, ht as PaymentFeeDetails, i as SubscribableEventType, in as ACCOUNT_NUMBER_LENGTH, it as INVOICE_STATUSES, j as CurrencyAvailability, jn as ENVIRONMENTS, jt as RISK_LEVELS, k as CollectSettings, kn as isMobilePhone, kt as REFUND_MODES, l as Balance, ln as BillingMonths, lt as MAX_SEATS, m as CHECKOUT_PURPOSES, mn as List, mt as PaymentFailure, n as EventDataMap, nn as API_ERROR_CODES, nt as FulfillmentTracking, o as WebhookEvent, on as AddressInput, ot as InvoiceReason, p as CARRIER_TEST_SCENARIOS, pn as GracePeriodDays, pt as PaymentAttempt, q as FeatureOperationResult, qt as Weekday, r as EventType, rn as ApiErrorCode, rt as INVOICE_REASONS, s as Actor, sn as BILLING_MONTHS, st as InvoiceStatus, t as EVENT_TYPES, tn as PaymentFailureCode, tt as FulfillmentStatus, u as BalanceAmount, un as CURRENCIES, ut as PAYMENT_STATUSES, v as CancellationFeedback, vn as MOBILE_PREFIXES, vt as PaymentStatus, w as Claim, wn as TaxBehavior, wt as PortalSession, x as Checkout, xn as SUSPENSION_DAYS, xt as PlanFeatureValues, y as Carrier, yn as Metadata, yt as Payout, z as Deletion, zt as SubscriptionChange } from "./events-D9CrG3Kp.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
|
-
|
|
142
|
-
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 };
|
|
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 ProductImage, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicCheckoutItem, type PublicClaim, type PublicClaimSummary, type PublicFulfillment, type PublicFulfillmentRefund, type PublicInvoice, type PublicMerchant, 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-
|
|
2
|
-
|
|
1
|
+
import { n as segment, r as BilleteError, t as createTransport } from "./http-SRcg7gff.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 {
|
|
2
|
-
//#region ../contracts/src/api-versions.d.ts
|
|
1
|
+
import { $t as ApiErrorType, C as CheckoutPurpose, Ct as PlanSeats, D as ClaimReason, E as ClaimOutcome, Et as ProductCategory, J as FeatureReset, Jt as ReceiptReference, Lt as SubmitLabel, M as CustomField, Mn as Environment, Mt as Refund, O as ClaimStatus, P as CustomerDetails, Rt as Subscription, S as CheckoutItem, Sn as SuspensionDays, St as PlanPrice, T as ClaimMessage, Tn as Timestamp, Z as Fulfillment, Zt as ApiErrorBody, an as Address, b as CarrierOffice, c as AfterCompletion, ct as LineItem, dn as Currency, et as FulfillmentMethod, i as SubscribableEventType, k as CollectSettings, ln as BillingMonths, mt as PaymentFailure, nt as FulfillmentTracking, on as AddressInput, ot as InvoiceReason, pn as GracePeriodDays, rn as ApiErrorCode, st as InvoiceStatus, tn as PaymentFailureCode, tt as FulfillmentStatus, v as CancellationFeedback, vt as PaymentStatus, wn as TaxBehavior, y as Carrier, yn as Metadata } from "./events-D9CrG3Kp.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
|
-
/**
|
|
13
|
-
|
|
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,12 +44,18 @@ 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.
|
|
50
50
|
*/
|
|
51
|
+
/** The business a customer pays, as its pages show it. */
|
|
52
|
+
interface PublicMerchant {
|
|
53
|
+
name: string;
|
|
54
|
+
supportEmail: string | null;
|
|
55
|
+
supportPhone: string | null;
|
|
56
|
+
/** Its logo, when it uploaded one; otherwise pages show its initial. */
|
|
57
|
+
logoUrl: string | null;
|
|
58
|
+
}
|
|
51
59
|
interface CustomerSubscription extends Omit<Subscription, "metadata"> {
|
|
52
60
|
plan: {
|
|
53
61
|
name: string;
|
|
@@ -85,11 +93,7 @@ interface PortalFeatures {
|
|
|
85
93
|
interface PublicPortal {
|
|
86
94
|
object: "portal";
|
|
87
95
|
environment: Environment;
|
|
88
|
-
merchant:
|
|
89
|
-
name: string;
|
|
90
|
-
supportEmail: string | null;
|
|
91
|
-
supportPhone: string | null;
|
|
92
|
-
};
|
|
96
|
+
merchant: PublicMerchant;
|
|
93
97
|
customer: {
|
|
94
98
|
email: string;
|
|
95
99
|
name: string | null;
|
|
@@ -133,11 +137,7 @@ interface PublicInvoice {
|
|
|
133
137
|
url: string;
|
|
134
138
|
status: InvoiceStatus;
|
|
135
139
|
reason: InvoiceReason;
|
|
136
|
-
merchant:
|
|
137
|
-
name: string;
|
|
138
|
-
supportEmail: string | null;
|
|
139
|
-
supportPhone: string | null;
|
|
140
|
-
};
|
|
140
|
+
merchant: PublicMerchant;
|
|
141
141
|
email: string;
|
|
142
142
|
description: string | null;
|
|
143
143
|
lines: LineItem[];
|
|
@@ -161,6 +161,8 @@ interface PublicInvoice {
|
|
|
161
161
|
interface PublicCheckoutItem extends CheckoutItem {
|
|
162
162
|
/** The `lookupKey` of the plan or product, as it is now; `null` when it has none. */
|
|
163
163
|
lookupKey: string | null;
|
|
164
|
+
/** A product's photo as it is now (its variant's, or the principal); `null` for plans. */
|
|
165
|
+
imageUrl: string | null;
|
|
164
166
|
}
|
|
165
167
|
/** Browser-safe view of a checkout: everything needed to render and pay it, nothing internal. */
|
|
166
168
|
interface PublicCheckout {
|
|
@@ -182,11 +184,7 @@ interface PublicCheckout {
|
|
|
182
184
|
url: string;
|
|
183
185
|
status: "open" | "completed" | "expired";
|
|
184
186
|
purpose: CheckoutPurpose;
|
|
185
|
-
merchant:
|
|
186
|
-
name: string;
|
|
187
|
-
supportEmail: string | null;
|
|
188
|
-
supportPhone: string | null;
|
|
189
|
-
};
|
|
187
|
+
merchant: PublicMerchant;
|
|
190
188
|
email: string | null;
|
|
191
189
|
items: PublicCheckoutItem[];
|
|
192
190
|
currency: Currency;
|
|
@@ -259,11 +257,7 @@ interface PublicFulfillment {
|
|
|
259
257
|
id: string;
|
|
260
258
|
object: "fulfillment";
|
|
261
259
|
environment: Environment;
|
|
262
|
-
merchant:
|
|
263
|
-
name: string;
|
|
264
|
-
supportEmail: string | null;
|
|
265
|
-
supportPhone: string | null;
|
|
266
|
-
};
|
|
260
|
+
merchant: PublicMerchant;
|
|
267
261
|
method: FulfillmentMethod;
|
|
268
262
|
status: FulfillmentStatus;
|
|
269
263
|
option: FulfillmentOption;
|
|
@@ -287,6 +281,8 @@ interface PublicFulfillment {
|
|
|
287
281
|
* and never for a shipment, which the carrier hands over.
|
|
288
282
|
*/
|
|
289
283
|
handoverUrl: string | null;
|
|
284
|
+
/** When a shipment reached the carrier's office, waiting for the customer to pick it up. */
|
|
285
|
+
readyAt: Timestamp | null;
|
|
290
286
|
deliveredAt: Timestamp | null;
|
|
291
287
|
handover: Fulfillment["handover"];
|
|
292
288
|
confirmBy: Timestamp | null;
|
|
@@ -444,11 +440,7 @@ interface PublicPaymentLink {
|
|
|
444
440
|
type: "product" | "plan";
|
|
445
441
|
/** `false` when the link was deactivated or reached its payment limit. */
|
|
446
442
|
available: boolean;
|
|
447
|
-
merchant:
|
|
448
|
-
name: string;
|
|
449
|
-
supportEmail: string | null;
|
|
450
|
-
supportPhone: string | null;
|
|
451
|
-
};
|
|
443
|
+
merchant: PublicMerchant;
|
|
452
444
|
product: {
|
|
453
445
|
name: string;
|
|
454
446
|
description: string | null;
|
|
@@ -507,11 +499,7 @@ interface PublicClaimSummary {
|
|
|
507
499
|
interface PublicClaim extends PublicClaimSummary {
|
|
508
500
|
object: "claim";
|
|
509
501
|
environment: Environment;
|
|
510
|
-
merchant:
|
|
511
|
-
name: string;
|
|
512
|
-
supportEmail: string | null;
|
|
513
|
-
supportPhone: string | null;
|
|
514
|
-
};
|
|
502
|
+
merchant: PublicMerchant;
|
|
515
503
|
description: string;
|
|
516
504
|
messages: ClaimMessage[];
|
|
517
505
|
/** What the claim is about: the payment and what it bought. */
|
|
@@ -544,8 +532,6 @@ interface PublicClaim extends PublicClaimSummary {
|
|
|
544
532
|
withdrawnAt: Timestamp | null;
|
|
545
533
|
updatedAt: Timestamp;
|
|
546
534
|
}
|
|
547
|
-
//#endregion
|
|
548
|
-
//#region ../contracts/src/inputs.d.ts
|
|
549
535
|
/** Identifiers merchants choose and use in code: `ai_tokens`, `export-pdf`. */
|
|
550
536
|
declare const KEY_PATTERN: RegExp;
|
|
551
537
|
interface CustomerCreate {
|
|
@@ -1113,8 +1099,6 @@ type ClaimResolve = {
|
|
|
1113
1099
|
outcome: "business";
|
|
1114
1100
|
note: string;
|
|
1115
1101
|
};
|
|
1116
|
-
//#endregion
|
|
1117
|
-
//#region src/http.d.ts
|
|
1118
1102
|
interface TransportOptions {
|
|
1119
1103
|
/**
|
|
1120
1104
|
* The Billete API version your integration is written against. Required: Billete never changes
|
|
@@ -1141,8 +1125,6 @@ interface RequestOptions {
|
|
|
1141
1125
|
idempotencyKey?: string;
|
|
1142
1126
|
signal?: AbortSignal;
|
|
1143
1127
|
}
|
|
1144
|
-
//#endregion
|
|
1145
|
-
//#region src/errors.d.ts
|
|
1146
1128
|
/**
|
|
1147
1129
|
* What a failed request says: a code of the API (`API_ERROR_CODES` lists what each means), or the
|
|
1148
1130
|
* SDK's own when Billete could not be reached (`network_error`) or answered something unexpected
|
|
@@ -1161,5 +1143,4 @@ declare class BilleteError extends Error {
|
|
|
1161
1143
|
code: BilleteErrorCode;
|
|
1162
1144
|
}, status: number, options?: ErrorOptions);
|
|
1163
1145
|
}
|
|
1164
|
-
|
|
1165
|
-
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 };
|
|
1146
|
+
export { PortalSessionCreate as $, CustomerSessionCreate as A, PublicMerchant as At, FulfillmentTrackingInput as B, LATEST_API_VERSION 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_HEADER as Ft, PaymentLinkUpdate as G, isApiVersion as Gt, InvoiceLineInput as H, apiVersionLifecycle as Ht, FeatureUpdate as I, API_VERSION_PATTERN as It, PlanCreate as J, PlanCheckoutCreate as K, isApiVersionRetired as Kt, FulfillmentDeliverInput as L, ApiVersion as Lt, EventSelector as M, PublicPaymentState as Mt, FeatureCreate as N, PublicPortal as Nt, CustomerMemberCreate as O, PublicFulfillmentRefund as Ot, FeatureOperationCommit as P, API_VERSIONS as Pt, PlanUpdate as Q, FulfillmentHandoverInput as R, ApiVersionLifecycle as Rt, CollectInput as S, PortalFeatures as St, CustomFieldInput as T, PublicClaim as Tt, KEY_PATTERN as U, apiVersionStage as Ut, InvoiceCreate as V, LatestApiVersion as Vt, PaymentLinkCreate as W, currentApiVersion 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, PublicPaymentLink 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, supportedApiVersions as qt, 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, ApiVersionStage 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;
|
|
@@ -577,6 +565,11 @@ interface Deletion {
|
|
|
577
565
|
deletedAt: Timestamp | null;
|
|
578
566
|
deletedBy: Actor | null;
|
|
579
567
|
}
|
|
568
|
+
/** A photo of a product, served to anyone by its `url`. */
|
|
569
|
+
interface ProductImage {
|
|
570
|
+
id: string;
|
|
571
|
+
url: string;
|
|
572
|
+
}
|
|
580
573
|
interface ProductVariant extends Deletion {
|
|
581
574
|
id: string;
|
|
582
575
|
name: string;
|
|
@@ -588,6 +581,8 @@ interface ProductVariant extends Deletion {
|
|
|
588
581
|
reserved: number;
|
|
589
582
|
isDefault: boolean;
|
|
590
583
|
active: boolean;
|
|
584
|
+
/** Its photo among the product's `images`; `null` shows the product's principal one. */
|
|
585
|
+
imageId: string | null;
|
|
591
586
|
}
|
|
592
587
|
interface Product extends Resource<"product">, Deletion {
|
|
593
588
|
name: string;
|
|
@@ -598,6 +593,8 @@ interface Product extends Resource<"product">, Deletion {
|
|
|
598
593
|
lookupKey: string | null;
|
|
599
594
|
description: string | null;
|
|
600
595
|
imageUrl: string | null;
|
|
596
|
+
/** Its photos, the principal first, uploaded from the dashboard. */
|
|
597
|
+
images: ProductImage[];
|
|
601
598
|
category: ProductCategory;
|
|
602
599
|
/**
|
|
603
600
|
* How a `physical` product may be received, among the ways the business offers. Empty: it is
|
|
@@ -1125,6 +1122,8 @@ interface Fulfillment extends Resource<"fulfillment"> {
|
|
|
1125
1122
|
number: string;
|
|
1126
1123
|
reason: string;
|
|
1127
1124
|
} | null;
|
|
1125
|
+
/** When the carrier reported a shipment at the office, waiting for its customer. */
|
|
1126
|
+
readyAt: Timestamp | null;
|
|
1128
1127
|
deliveredAt: Timestamp | null;
|
|
1129
1128
|
/** How it was handed over, once the business did; `null` before, and for a shipment. */
|
|
1130
1129
|
handover: FulfillmentHandover | null;
|
|
@@ -1412,8 +1411,6 @@ interface PortalSession {
|
|
|
1412
1411
|
returnUrl: string | null;
|
|
1413
1412
|
expiresAt: Timestamp;
|
|
1414
1413
|
}
|
|
1415
|
-
//#endregion
|
|
1416
|
-
//#region ../contracts/src/events.d.ts
|
|
1417
1414
|
interface EventDataMap {
|
|
1418
1415
|
"product.updated": Product;
|
|
1419
1416
|
"product.deleted": Product;
|
|
@@ -1502,5 +1499,4 @@ type WebhookEvent = { [TType in EventType]: {
|
|
|
1502
1499
|
createdAt: string;
|
|
1503
1500
|
data: EventDataMap[TType];
|
|
1504
1501
|
}; }[EventType];
|
|
1505
|
-
|
|
1506
|
-
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 };
|
|
1502
|
+
export { FulfillmentHandover as $, ApiErrorType as $t, Coupon as A, nationalPhone as An, RESET_FREQUENCIES as At, Event as B, SubscriptionChangePreview as Bt, CheckoutPurpose as C, TAX_BEHAVIORS as Cn, PlanSeats as Ct, ClaimReason as D, findBank as Dn, ProductImage as Dt, ClaimOutcome as E, VENEZUELAN_BANKS as En, ProductCategory as Et, CustomerFeature as F, tokenPrefix as Fn, SUBMIT_LABELS as Ft, Feature as G, USAGE_FEATURE_TYPES as Gt, FEATURE_TYPES as H, SubscriptionRenewal as Ht, CustomerMember as I, SUBSCRIPTION_STATUSES as It, FeatureReset as J, ReceiptReference as Jt, FeatureOperation as K, WebhookEndpoint as Kt, CustomerMemberList as L, SubmitLabel as Lt, CustomField as M, Environment as Mn, Refund as Mt, Customer as N, TokenKind as Nn, ResetFrequency as Nt, ClaimStatus as O, isLandlinePhone as On, ProductVariant as Ot, CustomerDetails as P, tokenEnvironment as Pn, RiskLevel as Pt, FulfillmentChoice as Q, ApiErrorEnvelope as Qt, CustomerSession as R, Subscription as Rt, CheckoutItem as S, SuspensionDays as Sn, PlanPrice as St, ClaimMessage as T, Timestamp as Tn, Product as Tt, FULFILLMENT_METHODS as U, SubscriptionStatus as Ut, ExchangeRate as V, SubscriptionChangeResult as Vt, FULFILLMENT_STATUSES as W, SubscriptionTerms as Wt, FeatureUsageResult as X, API_ERROR_TYPES as Xt, FeatureType as Y, ReceiptSend as Yt, Fulfillment as Z, ApiErrorBody as Zt, CLAIM_STATUSES as _, MAX_QUANTITY as _n, PaymentSettlement as _t, WEBHOOK_TEST_EVENT as a, Address as an, Invoice as at, CarrierOffice as b, MobilePrefix as bn, Plan as bt, AfterCompletion as c, BankCode as cn, LineItem as ct, CANCELLATION_FEEDBACK as d, Currency as dn, PRODUCT_CATEGORIES as dt, PAYMENT_FAILURE_CODES as en, FulfillmentMethod as et, CARRIERS as f, GRACE_PERIOD_DAYS as fn, Payment as ft, CLAIM_REASONS as g, ListSort as gn, PaymentLink as gt, CLAIM_OUTCOMES as h, ListQuery as hn, PaymentFeeDetails as ht, SubscribableEventType as i, ACCOUNT_NUMBER_LENGTH as in, INVOICE_STATUSES as it, CurrencyAvailability as j, ENVIRONMENTS as jn, RISK_LEVELS as jt, CollectSettings as k, isMobilePhone as kn, REFUND_MODES as kt, Balance as l, BillingMonths as ln, MAX_SEATS as lt, CHECKOUT_PURPOSES as m, List as mn, PaymentFailure as mt, EventDataMap as n, API_ERROR_CODES as nn, FulfillmentTracking as nt, WebhookEvent as o, AddressInput as on, InvoiceReason as ot, CARRIER_TEST_SCENARIOS as p, GracePeriodDays as pn, PaymentAttempt as pt, FeatureOperationResult as q, Weekday as qt, EventType as r, ApiErrorCode as rn, INVOICE_REASONS as rt, Actor as s, BILLING_MONTHS as sn, InvoiceStatus as st, EVENT_TYPES as t, PaymentFailureCode as tn, FulfillmentStatus as tt, BalanceAmount as u, CURRENCIES as un, PAYMENT_STATUSES as ut, CancellationFeedback as v, MOBILE_PREFIXES as vn, PaymentStatus as vt, Claim as w, TaxBehavior as wn, PortalSession as wt, Checkout as x, SUSPENSION_DAYS as xn, PlanFeatureValues as xt, Carrier as y, Metadata as yn, Payout as yt, Deletion as z, SubscriptionChange as zt };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
const SDK_VERSION = "9.0.0";
|
|
19
|
+
// src/http.ts
|
|
20
|
+
const SDK_VERSION = "9.2.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
|
|
2
|
-
import { $ as
|
|
1
|
+
import { $ as FulfillmentHandover, $t as ApiErrorType, A as Coupon, An as nationalPhone, At as RESET_FREQUENCIES, B as Event, Bt as SubscriptionChangePreview, C as CheckoutPurpose, Cn as TAX_BEHAVIORS, Ct as PlanSeats, D as ClaimReason, Dn as findBank, Dt as ProductImage, E as ClaimOutcome, En as VENEZUELAN_BANKS, Et as ProductCategory, F as CustomerFeature, Fn as tokenPrefix, Ft as SUBMIT_LABELS, G as Feature, Gt as USAGE_FEATURE_TYPES, H as FEATURE_TYPES, Ht as SubscriptionRenewal, I as CustomerMember, It as SUBSCRIPTION_STATUSES, J as FeatureReset, Jt as ReceiptReference, K as FeatureOperation, Kt as WebhookEndpoint, L as CustomerMemberList, Lt as SubmitLabel, M as CustomField, Mn as Environment, Mt as Refund, N as Customer, Nn as TokenKind, Nt as ResetFrequency, O as ClaimStatus, On as isLandlinePhone, Ot as ProductVariant, P as CustomerDetails, Pn as tokenEnvironment, Pt as RiskLevel, Q as FulfillmentChoice, Qt as ApiErrorEnvelope, R as CustomerSession, Rt as Subscription, S as CheckoutItem, Sn as SuspensionDays, St as PlanPrice, T as ClaimMessage, Tn as Timestamp, Tt as Product, U as FULFILLMENT_METHODS, Ut as SubscriptionStatus, V as ExchangeRate, Vt as SubscriptionChangeResult, W as FULFILLMENT_STATUSES, Wt as SubscriptionTerms, X as FeatureUsageResult, Xt as API_ERROR_TYPES, Y as FeatureType, Yt as ReceiptSend, Z as Fulfillment, Zt as ApiErrorBody, _ as CLAIM_STATUSES, _n as MAX_QUANTITY, _t as PaymentSettlement, a as WEBHOOK_TEST_EVENT, an as Address, at as Invoice, b as CarrierOffice, bn as MobilePrefix, bt as Plan, c as AfterCompletion, cn as BankCode, ct as LineItem, d as CANCELLATION_FEEDBACK, dn as Currency, dt as PRODUCT_CATEGORIES, en as PAYMENT_FAILURE_CODES, et as FulfillmentMethod, f as CARRIERS, fn as GRACE_PERIOD_DAYS, ft as Payment, g as CLAIM_REASONS, gn as ListSort, gt as PaymentLink, h as CLAIM_OUTCOMES, hn as ListQuery, ht as PaymentFeeDetails, i as SubscribableEventType, in as ACCOUNT_NUMBER_LENGTH, it as INVOICE_STATUSES, j as CurrencyAvailability, jn as ENVIRONMENTS, jt as RISK_LEVELS, k as CollectSettings, kn as isMobilePhone, kt as REFUND_MODES, l as Balance, ln as BillingMonths, lt as MAX_SEATS, m as CHECKOUT_PURPOSES, mn as List, mt as PaymentFailure, n as EventDataMap, nn as API_ERROR_CODES, nt as FulfillmentTracking, o as WebhookEvent, on as AddressInput, ot as InvoiceReason, p as CARRIER_TEST_SCENARIOS, pn as GracePeriodDays, pt as PaymentAttempt, q as FeatureOperationResult, qt as Weekday, r as EventType, rn as ApiErrorCode, rt as INVOICE_REASONS, s as Actor, sn as BILLING_MONTHS, st as InvoiceStatus, t as EVENT_TYPES, tn as PaymentFailureCode, tt as FulfillmentStatus, u as BalanceAmount, un as CURRENCIES, ut as PAYMENT_STATUSES, v as CancellationFeedback, vn as MOBILE_PREFIXES, vt as PaymentStatus, w as Claim, wn as TaxBehavior, wt as PortalSession, x as Checkout, xn as SUSPENSION_DAYS, xt as PlanFeatureValues, y as Carrier, yn as Metadata, yt as Payout, z as Deletion, zt as SubscriptionChange } from "./events-D9CrG3Kp.js";
|
|
2
|
+
import { $ as PortalSessionCreate, A as CustomerSessionCreate, At as PublicMerchant, B as FulfillmentTrackingInput, Bt as LATEST_API_VERSION, 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_HEADER, G as PaymentLinkUpdate, Gt as isApiVersion, H as InvoiceLineInput, Ht as apiVersionLifecycle, I as FeatureUpdate, It as API_VERSION_PATTERN, J as PlanCreate, K as PlanCheckoutCreate, Kt as isApiVersionRetired, L as FulfillmentDeliverInput, Lt as ApiVersion, M as EventSelector, Mt as PublicPaymentState, N as FeatureCreate, Nt as PublicPortal, O as CustomerMemberCreate, Ot as PublicFulfillmentRefund, P as FeatureOperationCommit, Pt as API_VERSIONS, Q as PlanUpdate, R as FulfillmentHandoverInput, Rt as ApiVersionLifecycle, S as CollectInput, St as PortalFeatures, T as CustomFieldInput, Tt as PublicClaim, U as KEY_PATTERN, Ut as apiVersionStage, V as InvoiceCreate, Vt as LatestApiVersion, W as PaymentLinkCreate, Wt as currentApiVersion, 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 PublicPaymentLink, 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, qt as supportedApiVersions, 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 ApiVersionStage } from "./errors-BOTgfVNl.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
|
-
|
|
392
|
-
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 };
|
|
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 ProductImage, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicCheckoutItem, type PublicClaim, type PublicClaimSummary, type PublicFulfillment, type PublicFulfillmentRefund, type PublicInvoice, type PublicMerchant, 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-
|
|
1
|
+
import { n as segment, r as BilleteError, t as createTransport } from "./http-SRcg7gff.js";
|
|
2
2
|
import { WebhookVerificationError, verifyWebhook } from "./webhooks.js";
|
|
3
|
-
|
|
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
|
-
|
|
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 };
|
package/dist/webhooks.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { o as WebhookEvent } from "./events-
|
|
2
|
-
//#region src/webhooks.d.ts
|
|
1
|
+
import { o as WebhookEvent } from "./events-D9CrG3Kp.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
|
-
|
|
17
|
+
export {};
|
package/dist/webhooks.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
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.
|
|
3
|
+
"version": "9.2.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.
|
|
42
|
+
"tsdown": "0.23.4",
|
|
43
43
|
"typescript": "7.0.2",
|
|
44
|
-
"vite": "8.3.
|
|
45
|
-
"vitest": "5.0.
|
|
44
|
+
"vite": "8.3.5",
|
|
45
|
+
"vitest": "5.0.5"
|
|
46
46
|
},
|
|
47
47
|
"sideEffects": false,
|
|
48
48
|
"scripts": {
|