Release v1.3.1
✨ New Features
Typed Event Payloads for React Handlers
All event handler props now have fully typed payloads instead of (event: any) => void. This provides autocomplete and compile-time safety when handling events from Payload components.
PayloadForm / PaymentForm / PaymentMethodForm:
<PayloadForm
clientToken="tok_123"
onSuccess={(evt) => {
// evt is typed as PayloadFormSuccessEvent
console.log(evt.transaction_id)
}}
onDeclined={(evt) => {
// evt is typed as PayloadFormDeclinedEvent
console.log(evt.message, evt.error_type)
}}
onProcessed={(evt) => {
// evt is typed as PayloadFormProcessedEvent
console.log(evt.transaction_id)
}}
/>PayloadInput:
<PayloadInput
attr="card_number"
onInvalid={(evt) => {
// evt is typed as PayloadInvalidEvent
console.log(evt.invalid) // Record<string, string>
}}
onChange={(evt) => {
// evt is typed as PayloadChangeEvent
console.log(evt.value, evt.form_id)
}}
/>Checkout / SecurePayment:
<Checkout
clientToken="tok_123"
onDeclined={(evt) => {
// evt is typed as PayloadCheckoutDeclinedEvent
console.log(evt.payments_attempted)
}}
/>ProcessingAccountForm:
<ProcessingAccountForm
clientToken="tok_123"
onAccountCreated={(evt) => {
// evt is typed as PayloadAccountCreatedEvent
console.log(evt.account.id)
}}
/>Exported event interfaces:
PayloadFormSuccessEventPayloadFormProcessedEventPayloadFormAuthorizedEventPayloadFormDeclinedEventPayloadCheckoutDeclinedEventPayloadErrorEventPayloadFormCreatedEventPayloadFormUpdatedEventPayloadAccountCreatedEventPayloadInvalidEventPayloadValidEventPayloadChangeEventPayloadFocusEventPayloadBlurEventPayloadLoadedEventPayloadClosedEventPayloadProcessingEvent
🔧 Improvements
- Type test coverage: Added compile-time assertions ensuring event payloads reject incorrect property access
📦 Dependencies
- Bumped
ajvfrom 6.12.6 to 6.14.0 in examples/react-16 and examples/react-18 - Bumped
rollupfrom 2.79.2 to 2.80.0 in examples/react-16 and examples/react-18 - Bumped
minimatchfrom 3.1.2 to 3.1.5 (root, examples/react-16, examples/react-18) - Ran
npm audit fixon root package
🔄 Breaking Changes
None — this release is fully backward compatible. All new features are additive. Existing (event: any) => void handlers will continue to work without changes.
Full Changelog: v1.3.0...v1.3.1