@openrails/billing-ui 0.258.1 → 0.259.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.
@@ -1,4 +1,4 @@
1
- export type OpenRailsErrorCode = "admission_captured" | "admission_not_found" | "already_owned" | "application_required" | "as_of_required" | "authentication_required" | "authentication_unavailable" | "authorization_unavailable" | "billing_archive_integrity" | "billing_archive_invalid_artifact" | "billing_archive_merchant_mismatch" | "billing_archive_not_empty" | "billing_archive_platform_cards" | "billing_archive_unavailable" | "billing_archive_unsupported_state" | "billing_policy_not_found" | "cancel_unsupported_on_rail" | "captcha_invalid" | "captcha_required" | "card_attempts_blocked" | "card_declined" | "card_not_saved" | "card_requires_https" | "card_vault_unknown" | "catalog_benefit_overlap" | "catalog_revision_conflict" | "charge_psp_incompatible" | "charge_psp_unknown" | "credential_expired" | "credential_revoked" | "credit_grant_held" | "credit_grant_not_found" | "credit_grant_unavailable" | "csrf_origin_denied" | "currency_unsupported" | "custodian_capture_unavailable" | "customer_action_required" | "customer_email_required" | "customer_issuer_mismatch" | "customer_not_found" | "customer_payment_unsupported" | "customer_session_required" | "dashboard_invalid" | "database_busy" | "default_payment_method_invalid" | "default_payment_method_required" | "default_rate_card_not_found" | "destructive_actions_held" | "embed_origins_required" | "entitlement_required" | "finding_action_failed" | "finding_not_actionable" | "finding_requires_merchant_config" | "hold_not_found" | "host_event_not_found" | "host_principal_invalid" | "idempotency_key_in_use" | "idempotency_key_required" | "idempotency_key_reused" | "insufficient_credits" | "insufficient_funds" | "internal_error" | "invalid_cursor" | "invalid_customer_id" | "invalid_host_event_request" | "invalid_param" | "invalid_payment_method" | "invalid_psp_reference" | "invalid_query" | "invalid_request_body" | "invalid_settlement_status_request" | "invoker_scoped_principal" | "merchant_config_read_only" | "merchant_mismatch" | "merchant_unresolved" | "meter_in_use" | "meter_rate_card_conflict" | "method_not_allowed" | "metrics_query_invalid" | "model_unavailable" | "network_account_linked" | "network_link_challenge_invalid" | "network_link_conflict" | "network_link_in_use" | "network_terms_required" | "order_action_not_allowed" | "order_attempt_closed" | "order_attempt_expired" | "order_has_recurring_line" | "order_line_unavailable" | "order_not_cancelable" | "order_not_payable" | "order_payment_in_progress" | "order_total_changed" | "pay_url_attempts_exhausted" | "pay_url_expired" | "pay_url_not_found" | "pay_url_unavailable" | "payment_duplicate_refused" | "payment_exceeds_due" | "payment_failed" | "payment_idempotency_conflict" | "payment_in_progress" | "payment_method_delete_failed" | "payment_method_delete_unsupported" | "payment_method_not_psp_vaulted" | "payment_method_not_usable" | "payment_method_psp_mismatch" | "payment_method_required" | "payment_method_same_vault" | "payment_method_stale" | "payment_method_update_failed" | "payment_method_update_unsupported" | "payment_not_found" | "payment_not_refundable" | "payment_not_retryable" | "payment_option_unavailable" | "payment_provider_rejected" | "permission_required" | "platform_vault_mixed_class" | "platform_vault_unavailable" | "platform_vault_unreachable" | "price_change_currency_mismatch" | "price_change_target_archived" | "price_increase_notice_too_short" | "price_key_cadence_conflict" | "price_key_not_found" | "price_migration_not_found" | "price_not_found" | "price_not_sellable" | "product_in_use" | "product_not_found" | "product_tier_group_conflict" | "product_tier_group_in_use" | "provider_cancel_held" | "provider_outcome_unknown" | "provider_price_unreadable" | "provider_writes_disabled" | "provider_writes_held" | "psp_claim_requires_proof" | "psp_credentials_rejected" | "psp_environment_refused" | "psp_exists" | "psp_key_taken" | "psp_last_active" | "psp_not_found" | "purchase_review_resolved" | "quantity_not_allowed" | "rate_card_product_not_found" | "rate_limit_exceeded" | "rebill_terms_committed" | "refund_failed" | "refund_rail_unavailable" | "refund_unsupported" | "request_body_too_large" | "resource_access_denied" | "resource_conflict" | "resource_not_found" | "revision_mismatch" | "route_not_found" | "running_charge_not_found" | "scheduled_change_exists" | "service_credential_customer_scope_denied" | "service_unavailable" | "solana_rpc_unavailable" | "solana_transaction_refused" | "step_up_required" | "step_up_unavailable" | "stored_credential_required" | "subscription_change_already_scheduled" | "subscription_change_cadence_unsupported" | "subscription_change_credit_exceeds_price" | "subscription_change_cycle_unknown" | "subscription_change_idempotency_conflict" | "subscription_change_idempotency_key_required" | "subscription_change_in_flight" | "subscription_change_period_unknown" | "subscription_change_provider_conflict" | "subscription_change_refused" | "subscription_change_renewal_due" | "subscription_change_requires_linked_plan" | "subscription_change_target_inactive" | "subscription_change_unsupported_on_rail" | "subscription_not_active" | "subscription_not_found" | "subscription_paid_through" | "subscription_resumable" | "trial_unsupported_on_rail" | "unknown_field" | "unsupported_media_type" | "usage_meter_invalid" | "usage_meter_not_found" | "usage_not_priced" | "usage_rate_card_invalid" | "webhook_account_mismatch" | "webhook_invalid";
1
+ export type OpenRailsErrorCode = "admission_captured" | "admission_not_found" | "already_owned" | "application_required" | "as_of_required" | "authentication_required" | "authentication_unavailable" | "authorization_unavailable" | "billing_archive_integrity" | "billing_archive_invalid_artifact" | "billing_archive_merchant_mismatch" | "billing_archive_not_empty" | "billing_archive_platform_cards" | "billing_archive_unavailable" | "billing_archive_unsupported_state" | "billing_policy_not_found" | "cancel_unsupported_on_rail" | "captcha_invalid" | "captcha_required" | "card_attempts_blocked" | "card_declined" | "card_not_saved" | "card_requires_https" | "card_vault_unknown" | "catalog_benefit_overlap" | "catalog_revision_conflict" | "charge_psp_incompatible" | "charge_psp_unknown" | "credential_expired" | "credential_revoked" | "credit_grant_held" | "credit_grant_not_found" | "credit_grant_unavailable" | "csrf_origin_denied" | "currency_unsupported" | "custodian_capture_unavailable" | "customer_action_required" | "customer_email_required" | "customer_issuer_mismatch" | "customer_not_found" | "customer_payment_unsupported" | "customer_session_required" | "customer_tenant_mismatch" | "dashboard_invalid" | "database_busy" | "default_payment_method_invalid" | "default_payment_method_required" | "default_rate_card_not_found" | "destructive_actions_held" | "embed_origins_required" | "entitlement_required" | "finding_action_failed" | "finding_not_actionable" | "finding_requires_merchant_config" | "hold_not_found" | "host_event_not_found" | "host_principal_invalid" | "idempotency_key_in_use" | "idempotency_key_required" | "idempotency_key_reused" | "insufficient_credits" | "insufficient_funds" | "internal_error" | "invalid_cursor" | "invalid_customer_id" | "invalid_host_event_request" | "invalid_param" | "invalid_payment_method" | "invalid_psp_reference" | "invalid_query" | "invalid_request_body" | "invalid_settlement_status_request" | "invoker_scoped_principal" | "merchant_config_read_only" | "merchant_mismatch" | "merchant_unresolved" | "meter_in_use" | "meter_rate_card_conflict" | "method_not_allowed" | "metrics_query_invalid" | "model_unavailable" | "network_account_linked" | "network_link_challenge_invalid" | "network_link_conflict" | "network_link_in_use" | "network_terms_required" | "order_action_not_allowed" | "order_attempt_closed" | "order_attempt_expired" | "order_has_recurring_line" | "order_line_unavailable" | "order_not_cancelable" | "order_not_payable" | "order_payment_in_progress" | "order_total_changed" | "pay_url_attempts_exhausted" | "pay_url_expired" | "pay_url_not_found" | "pay_url_unavailable" | "payment_duplicate_refused" | "payment_exceeds_due" | "payment_failed" | "payment_idempotency_conflict" | "payment_in_progress" | "payment_method_delete_failed" | "payment_method_delete_unsupported" | "payment_method_not_psp_vaulted" | "payment_method_not_usable" | "payment_method_psp_mismatch" | "payment_method_required" | "payment_method_same_vault" | "payment_method_stale" | "payment_method_update_failed" | "payment_method_update_unsupported" | "payment_not_found" | "payment_not_refundable" | "payment_not_retryable" | "payment_option_unavailable" | "payment_provider_rejected" | "permission_required" | "platform_vault_mixed_class" | "platform_vault_unavailable" | "platform_vault_unreachable" | "price_change_currency_mismatch" | "price_change_target_archived" | "price_increase_notice_too_short" | "price_key_cadence_conflict" | "price_key_not_found" | "price_migration_not_found" | "price_not_found" | "price_not_sellable" | "product_in_use" | "product_not_found" | "product_tier_group_conflict" | "product_tier_group_in_use" | "provider_cancel_held" | "provider_outcome_unknown" | "provider_price_unreadable" | "provider_writes_disabled" | "provider_writes_held" | "psp_claim_requires_proof" | "psp_credentials_rejected" | "psp_environment_refused" | "psp_exists" | "psp_key_taken" | "psp_last_active" | "psp_not_found" | "purchase_review_resolved" | "quantity_not_allowed" | "rate_card_product_not_found" | "rate_limit_exceeded" | "rebill_terms_committed" | "refund_failed" | "refund_rail_unavailable" | "refund_unsupported" | "request_body_too_large" | "resource_access_denied" | "resource_conflict" | "resource_not_found" | "revision_mismatch" | "route_not_found" | "running_charge_not_found" | "scheduled_change_exists" | "service_credential_customer_scope_denied" | "service_unavailable" | "solana_rpc_unavailable" | "solana_transaction_refused" | "step_up_required" | "step_up_unavailable" | "stored_credential_required" | "subscription_change_already_scheduled" | "subscription_change_cadence_unsupported" | "subscription_change_credit_exceeds_price" | "subscription_change_cycle_unknown" | "subscription_change_idempotency_conflict" | "subscription_change_idempotency_key_required" | "subscription_change_in_flight" | "subscription_change_period_unknown" | "subscription_change_provider_conflict" | "subscription_change_refused" | "subscription_change_renewal_due" | "subscription_change_requires_linked_plan" | "subscription_change_target_inactive" | "subscription_change_unsupported_on_rail" | "subscription_not_active" | "subscription_not_found" | "subscription_paid_through" | "subscription_resumable" | "trial_unsupported_on_rail" | "unknown_field" | "unsupported_media_type" | "usage_meter_invalid" | "usage_meter_not_found" | "usage_not_priced" | "usage_rate_card_invalid" | "webhook_account_mismatch" | "webhook_invalid";
2
2
  export type OpenRailsErrorType = "api_error" | "authentication_error" | "authorization_error" | "card_error" | "invalid_request_error" | "rate_limit_error";
3
3
  export declare const OPENRAILS_ERROR_CODES: Readonly<Record<OpenRailsErrorCode, {
4
4
  status: number;
@@ -681,6 +681,23 @@ export declare const OPENRAILS_ROUTES: readonly [{
681
681
  };
682
682
  readonly errors: readonly ["invalid_param", "subscription_not_found"];
683
683
  readonly errorSets: readonly ["tier:merchant"];
684
+ }, {
685
+ readonly method: "GET";
686
+ readonly path: "/v1/admin/subscriptions/{id}/history";
687
+ readonly group: "admin";
688
+ readonly auth: "merchant";
689
+ readonly permission: {
690
+ readonly merchant: "merchant:customer:read";
691
+ readonly root: "root:customer:read";
692
+ };
693
+ readonly sensitive: false;
694
+ readonly mountedWhen: null;
695
+ readonly request: null;
696
+ readonly responses: {
697
+ readonly 200: "SubscriptionHistory";
698
+ };
699
+ readonly errors: readonly ["invalid_cursor", "invalid_param", "invalid_query", "subscription_not_found"];
700
+ readonly errorSets: readonly ["tier:merchant", "request"];
684
701
  }, {
685
702
  readonly method: "POST";
686
703
  readonly path: "/v1/admin/subscriptions/{id}/cancel";
@@ -753,10 +753,21 @@ export type DeclaredBilling = {
753
753
  transactions?: DeclaredTransaction[];
754
754
  admin_grants?: DeclaredAdminGrant[];
755
755
  purchases?: DeclaredPurchase[];
756
+ historical_payments?: DeclaredHistoricalPayment[];
756
757
  };
757
758
  export type DeclaredCustomer = {
758
759
  customer?: string;
759
760
  };
761
+ export type DeclaredHistoricalPayment = {
762
+ source_id?: string;
763
+ customer?: string;
764
+ psp?: PSPRef;
765
+ rail?: string;
766
+ transaction_id?: string;
767
+ amount?: string;
768
+ currency?: string;
769
+ paid_at?: string;
770
+ };
760
771
  export type DeclaredOrderLine = {
761
772
  price?: string;
762
773
  quantity?: number;
@@ -2149,6 +2160,79 @@ export type SubscriptionDunning = {
2149
2160
  waiting_for_new_card: boolean;
2150
2161
  last_failure_reason: "authentication_required" | "blocked_by_psp" | "call_issuer" | "card_not_supported" | "communication_error" | "currency_not_supported" | "do_not_honor" | "duplicate_transaction" | "expired_card" | "fraudulent" | "gateway_rejected" | "generic_decline" | "incorrect_address" | "incorrect_cvc" | "incorrect_number" | "incorrect_zip" | "insufficient_funds" | "invalid_account" | "invalid_expiry" | "invalid_pin" | "invalid_request" | "issuer_unavailable" | "lost_card" | "merchant_config" | "no_such_issuer" | "over_limit" | "pickup_card" | "processing_error" | "restricted_card" | "retry_later" | "security_violation" | "stolen_card" | "stop_recurring" | "transaction_not_allowed" | "try_again_later" | "unknown" | "update_cardholder_data" | null;
2151
2162
  };
2163
+ export type SubscriptionHistory = {
2164
+ events: ListPage<SubscriptionHistoryEntry>;
2165
+ coverage: SubscriptionHistoryCoverage;
2166
+ };
2167
+ export type SubscriptionHistoryAttempt = {
2168
+ id: string;
2169
+ kind: string;
2170
+ category: string;
2171
+ reason?: string;
2172
+ action?: string;
2173
+ source: string;
2174
+ observed_via: string;
2175
+ amount: string;
2176
+ currency: string;
2177
+ psp_id: string;
2178
+ order_id?: string;
2179
+ payment_id?: string;
2180
+ renewal_id?: string;
2181
+ payment_method_id?: string;
2182
+ operation_id?: string;
2183
+ };
2184
+ export type SubscriptionHistoryAttribution = {
2185
+ origin?: string;
2186
+ actor?: string;
2187
+ executor?: string;
2188
+ operation_id?: string;
2189
+ };
2190
+ export type SubscriptionHistoryBillingState = {
2191
+ payment_method_id?: string;
2192
+ next_retry_at?: string;
2193
+ last_retry_at?: string;
2194
+ retry_attempts?: number;
2195
+ transient_retries?: number;
2196
+ grace_ends_at?: string;
2197
+ };
2198
+ export type SubscriptionHistoryChange = {
2199
+ kind: string;
2200
+ decision?: string;
2201
+ from: SubscriptionHistoryBillingState;
2202
+ to: SubscriptionHistoryBillingState;
2203
+ card_version_id?: string;
2204
+ };
2205
+ export type SubscriptionHistoryCoverage = {
2206
+ sources: string[];
2207
+ retention_days: number;
2208
+ gaps: string[];
2209
+ };
2210
+ export type SubscriptionHistoryEntry = {
2211
+ id: string;
2212
+ at: string;
2213
+ recorded_at: string;
2214
+ kind: string;
2215
+ transition?: SubscriptionHistoryTransition;
2216
+ attempt?: SubscriptionHistoryAttempt;
2217
+ change?: SubscriptionHistoryChange;
2218
+ attribution?: SubscriptionHistoryAttribution;
2219
+ operation?: SubscriptionHistoryOperation;
2220
+ };
2221
+ export type SubscriptionHistoryOperation = {
2222
+ id: string;
2223
+ kind: string;
2224
+ phase: string;
2225
+ attempt: number;
2226
+ reason?: string;
2227
+ };
2228
+ export type SubscriptionHistoryTransition = {
2229
+ from_status: "active" | "awaiting_method" | "canceled" | "past_due" | "pending" | "unverified" | null;
2230
+ to_status: "active" | "awaiting_method" | "canceled" | "past_due" | "pending" | "unverified";
2231
+ decision?: string;
2232
+ cancel_type?: string;
2233
+ from_period_end: string | null;
2234
+ to_period_end: string | null;
2235
+ };
2152
2236
  export type SubscriptionRetryNowResult = {
2153
2237
  subscription: Subscription;
2154
2238
  status: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openrails/billing-ui",
3
- "version": "0.258.1",
3
+ "version": "0.259.0",
4
4
  "description": "Embeddable OpenRails purchase and account-billing UI: client, React hooks and styled components.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -114,7 +114,7 @@
114
114
  "vite-plugin-dts": "^5.0.3",
115
115
  "vitest": "^4.1.11",
116
116
  "@tanstack/react-query": "^5.101.4",
117
- "@openrails/auth-ui": "1.29.1",
117
+ "@openrails/auth-ui": "1.30.0",
118
118
  "react-router-dom": "7.18.2"
119
119
  },
120
120
  "peerDependenciesMeta": {