@boelabs/billete-sdk 4.0.0 → 4.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/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as SubscriptionCancel, A as FeatureUpdate, At as apiVersionLifecycle, B as PlanCreate, C as CustomerMemberUpdate, Ct as API_VERSION_HEADER, D as FeatureCreate, Dt as ApiVersionStage, E as EventSelector, Et as ApiVersionLifecycle, F as KEY_PATTERN, Ft as supportedApiVersions, G as PortalSessionCreate, H as PlanLinkCreate, I as PaymentLinkCreate, J as ProductCreate, K as ProductCheckoutCreate, L as PaymentLinkUpdate, M as FulfillmentTrackingInput, Mt as currentApiVersion, N as InvoiceCreate, Nt as isApiVersion, O as FeatureOperationCommit, Ot as LATEST_API_VERSION, P as InvoiceLineInput, Pt as isApiVersionRetired, Q as RetireInput, R as PlanCheckoutCreate, S as CustomerMemberCreate, St as API_VERSIONS, T as CustomerUpdate, Tt as ApiVersion, U as PlanPriceInput, V as PlanFeaturesInput, W as PlanUpdate, X as ProductUpdate, Y as ProductLinkCreate, Z as RefundCreate, _ as CouponCreate, _t as PublicFulfillment, a as CheckoutCreate, at as WebhookEndpointCreate, b as CustomerCreate, bt as PublicPaymentState, c as ClientCheckoutUpdate, ct as CustomerSubscriptionChangeResult, d as ClientLinkCheckout, dt as PaymentMethodField, et as SubscriptionChangeCreate, f as ClientPaymentCode, ft as PaymentMethodOption, g as CollectInput, gt as PublicCheckout, h as ClientSubscriptionUpdate, ht as PortalFeatures, i as AfterCompletionInput, it as VariantInput, j as FulfillmentInput, jt as apiVersionStage, k as FeatureOperationCreate, kt as LatestApiVersion, l as ClientFulfillmentProblem, lt as FulfillmentOption, m as ClientSubscriptionSeats, mt as PaymentTestScenario, n as RequestOptions, nt as SubscriptionCreate, o as CheckoutItemInput, ot as WebhookEndpointUpdate, p as ClientSubscriptionCancel, pt as PaymentNextAction, q as ProductCouponCreate, r as TransportOptions, rt as SubscriptionUpdate, s as ClientCheckoutPay, st as CustomerSubscription, t as BilleteError, tt as SubscriptionChangePreviewInput, u as ClientInvoicePay, ut as PaymentInstructions, v as CouponUpdate, vt as PublicInvoice, w as CustomerSessionCreate, wt as API_VERSION_PATTERN, x as CustomerInput, xt as PublicPortal, y as CustomFieldInput, yt as PublicPaymentLink, z as PlanCouponCreate } from "./errors-D0dmjljM.js";
1
+ import { $ as SubscriptionCancel, A as FeatureUpdate, At as apiVersionLifecycle, B as PlanCreate, C as CustomerMemberUpdate, Ct as API_VERSION_HEADER, D as FeatureCreate, Dt as ApiVersionStage, E as EventSelector, Et as ApiVersionLifecycle, F as KEY_PATTERN, Ft as supportedApiVersions, G as PortalSessionCreate, H as PlanLinkCreate, I as PaymentLinkCreate, J as ProductCreate, K as ProductCheckoutCreate, L as PaymentLinkUpdate, M as FulfillmentTrackingInput, Mt as currentApiVersion, N as InvoiceCreate, Nt as isApiVersion, O as FeatureOperationCommit, Ot as LATEST_API_VERSION, P as InvoiceLineInput, Pt as isApiVersionRetired, Q as RetireInput, R as PlanCheckoutCreate, S as CustomerMemberCreate, St as API_VERSIONS, T as CustomerUpdate, Tt as ApiVersion, U as PlanPriceInput, V as PlanFeaturesInput, W as PlanUpdate, X as ProductUpdate, Y as ProductLinkCreate, Z as RefundCreate, _ as CouponCreate, _t as PublicFulfillment, a as CheckoutCreate, at as WebhookEndpointCreate, b as CustomerCreate, bt as PublicPaymentState, c as ClientCheckoutUpdate, ct as CustomerSubscriptionChangeResult, d as ClientLinkCheckout, dt as PaymentMethodField, et as SubscriptionChangeCreate, f as ClientPaymentCode, ft as PaymentMethodOption, g as CollectInput, gt as PublicCheckout, h as ClientSubscriptionUpdate, ht as PortalFeatures, i as AfterCompletionInput, it as VariantInput, j as FulfillmentInput, jt as apiVersionStage, k as FeatureOperationCreate, kt as LatestApiVersion, l as ClientFulfillmentProblem, lt as FulfillmentOption, m as ClientSubscriptionSeats, mt as PaymentTestScenario, n as RequestOptions, nt as SubscriptionCreate, o as CheckoutItemInput, ot as WebhookEndpointUpdate, p as ClientSubscriptionCancel, pt as PaymentNextAction, q as ProductCouponCreate, r as TransportOptions, rt as SubscriptionUpdate, s as ClientCheckoutPay, st as CustomerSubscription, t as BilleteError, tt as SubscriptionChangePreviewInput, u as ClientInvoicePay, ut as PaymentInstructions, v as CouponUpdate, vt as PublicInvoice, w as CustomerSessionCreate, wt as API_VERSION_PATTERN, x as CustomerInput, xt as PublicPortal, y as CustomFieldInput, yt as PublicPaymentLink, z as PlanCouponCreate } from "./errors-AObvDES-.js";
2
2
  import { $ as PRODUCT_CATEGORIES, $t as ListQuery, A as ExchangeRate, At as SubscriptionTerms, B as Fulfillment, Bt as PAYMENT_FAILURE_CODES, C as Customer, Ct as SubmitLabel, D as CustomerMemberList, Dt as SubscriptionChangeResult, E as CustomerMember, Et as SubscriptionChangePreview, F as FeatureOperation, Ft as ReceiptSend, G as INVOICE_REASONS, Gt as BILLING_MONTHS, H as FulfillmentMethod, Ht as ACCOUNT_NUMBER_LENGTH, I as FeatureOperationResult, It as API_ERROR_TYPES, J as InvoiceReason, Jt as CURRENCIES, K as INVOICE_STATUSES, Kt as BankCode, L as FeatureReset, Lt as ApiErrorBody, M as FULFILLMENT_METHODS, Mt as WebhookEndpoint, N as FULFILLMENT_STATUSES, Nt as Weekday, O as CustomerSession, Ot as SubscriptionRenewal, P as Feature, Pt as ReceiptReference, Q as PAYMENT_STATUSES, Qt as List, R as FeatureType, Rt as ApiErrorEnvelope, S as CustomField, St as SUBSCRIPTION_STATUSES, T as CustomerFeature, Tt as SubscriptionChange, U as FulfillmentStatus, Ut as Address, V as FulfillmentChoice, Vt as PaymentFailureCode, W as FulfillmentTracking, Wt as AddressInput, X as LineItem, Xt as GRACE_PERIOD_DAYS, Y as InvoiceStatus, Yt as Currency, Z as MAX_SEATS, Zt as GracePeriodDays, _ as CheckoutItem, _n as tokenPrefix, _t as Refund, a as Actor, an as TAX_BEHAVIORS, at as PaymentStatus, b as Coupon, bt as RiskLevel, c as BalanceAmount, cn as VENEZUELAN_BANKS, ct as PlanFeatureValues, d as CARRIER_TEST_SCENARIOS, dn as isMobilePhone, dt as PortalSession, en as ListSort, et as Payment, f as CHECKOUT_PURPOSES, fn as nationalPhone, ft as Product, g as Checkout, gn as tokenEnvironment, gt as RISK_LEVELS, h as CarrierOffice, hn as TokenKind, ht as RESET_FREQUENCIES, i as WebhookEvent, in as MobilePrefix, it as PaymentSettlement, j as FEATURE_TYPES, jt as USAGE_FEATURE_TYPES, k as Event, kt as SubscriptionStatus, l as CANCELLATION_FEEDBACK, ln as findBank, lt as PlanPrice, m as Carrier, mn as Environment, mt as ProductVariant, n as EventDataMap, nn as MOBILE_PREFIXES, nt as PaymentFailure, o as AfterCompletion, on as TaxBehavior, ot as Payout, p as CancellationFeedback, pn as ENVIRONMENTS, pt as ProductCategory, q as Invoice, qt as BillingMonths, r as EventType, rn as Metadata, rt as PaymentLink, s as Balance, sn as Timestamp, st as Plan, t as EVENT_TYPES, tn as MAX_QUANTITY, tt as PaymentAttempt, u as CARRIERS, un as isLandlinePhone, ut as PlanSeats, v as CheckoutPurpose, vt as ResetFrequency, w as CustomerDetails, wt as Subscription, x as CurrencyAvailability, xt as SUBMIT_LABELS, y as CollectSettings, yt as Retirement, z as FeatureUsageResult, zt as ApiErrorType } from "./events-C0pKiZ_h.js";
3
3
  //#region src/create-client.d.ts
4
4
  interface ClientOptions extends TransportOptions {
package/dist/client.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as segment, r as BilleteError, t as createTransport } from "./http-BuqnZQ6s.js";
1
+ import { n as segment, r as BilleteError, t as createTransport } from "./http-D1e4okoX.js";
2
2
  //#region src/create-client.ts
3
3
  /**
4
4
  * Browser client. It never holds a secret key: checkouts and Cobros are addressed by their
@@ -617,6 +617,11 @@ interface SubscriptionChangePreviewInput {
617
617
  * trial instead and charges the new terms from today.
618
618
  */
619
619
  endTrial?: boolean;
620
+ /**
621
+ * A coupon for the new plan, on a change paid now that starts a new period: it discounts that
622
+ * payment and becomes the subscription's coupon for the rest of its `payments`.
623
+ */
624
+ coupon?: string;
620
625
  }
621
626
  interface SubscriptionChangeCreate extends SubscriptionChangePreviewInput {
622
627
  when: "now" | "renewal";
@@ -626,6 +631,8 @@ interface SubscriptionChangeCreate extends SubscriptionChangePreviewInput {
626
631
  */
627
632
  disableExcessMembers?: boolean;
628
633
  acceptUnusedCredit?: boolean;
634
+ /** Lets the customer apply a coupon in the change's checkout. */
635
+ allowCoupons?: boolean;
629
636
  successUrl?: string;
630
637
  cancelUrl?: string;
631
638
  }
@@ -18,7 +18,7 @@ var BilleteError = class extends Error {
18
18
  };
19
19
  //#endregion
20
20
  //#region src/http.ts
21
- const SDK_VERSION = "4.0.0";
21
+ const SDK_VERSION = "4.1.0";
22
22
  const DEFAULT_BASE_URL = "https://api.billete.run";
23
23
  const RETRYABLE_STATUS = /* @__PURE__ */ new Set([
24
24
  429,
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as SubscriptionCancel, A as FeatureUpdate, At as apiVersionLifecycle, B as PlanCreate, C as CustomerMemberUpdate, Ct as API_VERSION_HEADER, D as FeatureCreate, Dt as ApiVersionStage, E as EventSelector, Et as ApiVersionLifecycle, F as KEY_PATTERN, Ft as supportedApiVersions, G as PortalSessionCreate, H as PlanLinkCreate, I as PaymentLinkCreate, J as ProductCreate, K as ProductCheckoutCreate, L as PaymentLinkUpdate, M as FulfillmentTrackingInput, Mt as currentApiVersion, N as InvoiceCreate, Nt as isApiVersion, O as FeatureOperationCommit, Ot as LATEST_API_VERSION, P as InvoiceLineInput, Pt as isApiVersionRetired, Q as RetireInput, R as PlanCheckoutCreate, S as CustomerMemberCreate, St as API_VERSIONS, T as CustomerUpdate, Tt as ApiVersion, U as PlanPriceInput, V as PlanFeaturesInput, W as PlanUpdate, X as ProductUpdate, Y as ProductLinkCreate, Z as RefundCreate, _ as CouponCreate, _t as PublicFulfillment, a as CheckoutCreate, at as WebhookEndpointCreate, b as CustomerCreate, bt as PublicPaymentState, c as ClientCheckoutUpdate, ct as CustomerSubscriptionChangeResult, d as ClientLinkCheckout, dt as PaymentMethodField, et as SubscriptionChangeCreate, f as ClientPaymentCode, ft as PaymentMethodOption, g as CollectInput, gt as PublicCheckout, h as ClientSubscriptionUpdate, ht as PortalFeatures, i as AfterCompletionInput, it as VariantInput, j as FulfillmentInput, jt as apiVersionStage, k as FeatureOperationCreate, kt as LatestApiVersion, l as ClientFulfillmentProblem, lt as FulfillmentOption, m as ClientSubscriptionSeats, mt as PaymentTestScenario, n as RequestOptions, nt as SubscriptionCreate, o as CheckoutItemInput, ot as WebhookEndpointUpdate, p as ClientSubscriptionCancel, pt as PaymentNextAction, q as ProductCouponCreate, r as TransportOptions, rt as SubscriptionUpdate, s as ClientCheckoutPay, st as CustomerSubscription, t as BilleteError, tt as SubscriptionChangePreviewInput, u as ClientInvoicePay, ut as PaymentInstructions, v as CouponUpdate, vt as PublicInvoice, w as CustomerSessionCreate, wt as API_VERSION_PATTERN, x as CustomerInput, xt as PublicPortal, y as CustomFieldInput, yt as PublicPaymentLink, z as PlanCouponCreate } from "./errors-D0dmjljM.js";
1
+ import { $ as SubscriptionCancel, A as FeatureUpdate, At as apiVersionLifecycle, B as PlanCreate, C as CustomerMemberUpdate, Ct as API_VERSION_HEADER, D as FeatureCreate, Dt as ApiVersionStage, E as EventSelector, Et as ApiVersionLifecycle, F as KEY_PATTERN, Ft as supportedApiVersions, G as PortalSessionCreate, H as PlanLinkCreate, I as PaymentLinkCreate, J as ProductCreate, K as ProductCheckoutCreate, L as PaymentLinkUpdate, M as FulfillmentTrackingInput, Mt as currentApiVersion, N as InvoiceCreate, Nt as isApiVersion, O as FeatureOperationCommit, Ot as LATEST_API_VERSION, P as InvoiceLineInput, Pt as isApiVersionRetired, Q as RetireInput, R as PlanCheckoutCreate, S as CustomerMemberCreate, St as API_VERSIONS, T as CustomerUpdate, Tt as ApiVersion, U as PlanPriceInput, V as PlanFeaturesInput, W as PlanUpdate, X as ProductUpdate, Y as ProductLinkCreate, Z as RefundCreate, _ as CouponCreate, _t as PublicFulfillment, a as CheckoutCreate, at as WebhookEndpointCreate, b as CustomerCreate, bt as PublicPaymentState, c as ClientCheckoutUpdate, ct as CustomerSubscriptionChangeResult, d as ClientLinkCheckout, dt as PaymentMethodField, et as SubscriptionChangeCreate, f as ClientPaymentCode, ft as PaymentMethodOption, g as CollectInput, gt as PublicCheckout, h as ClientSubscriptionUpdate, ht as PortalFeatures, i as AfterCompletionInput, it as VariantInput, j as FulfillmentInput, jt as apiVersionStage, k as FeatureOperationCreate, kt as LatestApiVersion, l as ClientFulfillmentProblem, lt as FulfillmentOption, m as ClientSubscriptionSeats, mt as PaymentTestScenario, n as RequestOptions, nt as SubscriptionCreate, o as CheckoutItemInput, ot as WebhookEndpointUpdate, p as ClientSubscriptionCancel, pt as PaymentNextAction, q as ProductCouponCreate, r as TransportOptions, rt as SubscriptionUpdate, s as ClientCheckoutPay, st as CustomerSubscription, t as BilleteError, tt as SubscriptionChangePreviewInput, u as ClientInvoicePay, ut as PaymentInstructions, v as CouponUpdate, vt as PublicInvoice, w as CustomerSessionCreate, wt as API_VERSION_PATTERN, x as CustomerInput, xt as PublicPortal, y as CustomFieldInput, yt as PublicPaymentLink, z as PlanCouponCreate } from "./errors-AObvDES-.js";
2
2
  import { $ as PRODUCT_CATEGORIES, $t as ListQuery, A as ExchangeRate, At as SubscriptionTerms, B as Fulfillment, Bt as PAYMENT_FAILURE_CODES, C as Customer, Ct as SubmitLabel, D as CustomerMemberList, Dt as SubscriptionChangeResult, E as CustomerMember, Et as SubscriptionChangePreview, F as FeatureOperation, Ft as ReceiptSend, G as INVOICE_REASONS, Gt as BILLING_MONTHS, H as FulfillmentMethod, Ht as ACCOUNT_NUMBER_LENGTH, I as FeatureOperationResult, It as API_ERROR_TYPES, J as InvoiceReason, Jt as CURRENCIES, K as INVOICE_STATUSES, Kt as BankCode, L as FeatureReset, Lt as ApiErrorBody, M as FULFILLMENT_METHODS, Mt as WebhookEndpoint, N as FULFILLMENT_STATUSES, Nt as Weekday, O as CustomerSession, Ot as SubscriptionRenewal, P as Feature, Pt as ReceiptReference, Q as PAYMENT_STATUSES, Qt as List, R as FeatureType, Rt as ApiErrorEnvelope, S as CustomField, St as SUBSCRIPTION_STATUSES, T as CustomerFeature, Tt as SubscriptionChange, U as FulfillmentStatus, Ut as Address, V as FulfillmentChoice, Vt as PaymentFailureCode, W as FulfillmentTracking, Wt as AddressInput, X as LineItem, Xt as GRACE_PERIOD_DAYS, Y as InvoiceStatus, Yt as Currency, Z as MAX_SEATS, Zt as GracePeriodDays, _ as CheckoutItem, _n as tokenPrefix, _t as Refund, a as Actor, an as TAX_BEHAVIORS, at as PaymentStatus, b as Coupon, bt as RiskLevel, c as BalanceAmount, cn as VENEZUELAN_BANKS, ct as PlanFeatureValues, d as CARRIER_TEST_SCENARIOS, dn as isMobilePhone, dt as PortalSession, en as ListSort, et as Payment, f as CHECKOUT_PURPOSES, fn as nationalPhone, ft as Product, g as Checkout, gn as tokenEnvironment, gt as RISK_LEVELS, h as CarrierOffice, hn as TokenKind, ht as RESET_FREQUENCIES, i as WebhookEvent, in as MobilePrefix, it as PaymentSettlement, j as FEATURE_TYPES, jt as USAGE_FEATURE_TYPES, k as Event, kt as SubscriptionStatus, l as CANCELLATION_FEEDBACK, ln as findBank, lt as PlanPrice, m as Carrier, mn as Environment, mt as ProductVariant, n as EventDataMap, nn as MOBILE_PREFIXES, nt as PaymentFailure, o as AfterCompletion, on as TaxBehavior, ot as Payout, p as CancellationFeedback, pn as ENVIRONMENTS, pt as ProductCategory, q as Invoice, qt as BillingMonths, r as EventType, rn as Metadata, rt as PaymentLink, s as Balance, sn as Timestamp, st as Plan, t as EVENT_TYPES, tn as MAX_QUANTITY, tt as PaymentAttempt, u as CARRIERS, un as isLandlinePhone, ut as PlanSeats, v as CheckoutPurpose, vt as ResetFrequency, w as CustomerDetails, wt as Subscription, x as CurrencyAvailability, xt as SUBMIT_LABELS, y as CollectSettings, yt as Retirement, z as FeatureUsageResult, zt as ApiErrorType } from "./events-C0pKiZ_h.js";
3
3
  import { WebhookVerificationError, verifyWebhook } from "./webhooks.js";
4
4
  //#region src/server.d.ts
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as segment, r as BilleteError, t as createTransport } from "./http-BuqnZQ6s.js";
1
+ import { n as segment, r as BilleteError, t as createTransport } from "./http-D1e4okoX.js";
2
2
  import { WebhookVerificationError, verifyWebhook } from "./webhooks.js";
3
3
  //#region ../contracts/src/environment.ts
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boelabs/billete-sdk",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "Billete SDK: server client, browser client and webhook verification",
5
5
  "keywords": [
6
6
  "billete",