Skip to content

v1.3.1

Latest

Choose a tag to compare

@ianhalpern ianhalpern released this 04 Mar 00:52
v1.3.1
65ed643

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:

  • PayloadFormSuccessEvent
  • PayloadFormProcessedEvent
  • PayloadFormAuthorizedEvent
  • PayloadFormDeclinedEvent
  • PayloadCheckoutDeclinedEvent
  • PayloadErrorEvent
  • PayloadFormCreatedEvent
  • PayloadFormUpdatedEvent
  • PayloadAccountCreatedEvent
  • PayloadInvalidEvent
  • PayloadValidEvent
  • PayloadChangeEvent
  • PayloadFocusEvent
  • PayloadBlurEvent
  • PayloadLoadedEvent
  • PayloadClosedEvent
  • PayloadProcessingEvent

🔧 Improvements

  • Type test coverage: Added compile-time assertions ensuring event payloads reject incorrect property access

📦 Dependencies

  • Bumped ajv from 6.12.6 to 6.14.0 in examples/react-16 and examples/react-18
  • Bumped rollup from 2.79.2 to 2.80.0 in examples/react-16 and examples/react-18
  • Bumped minimatch from 3.1.2 to 3.1.5 (root, examples/react-16, examples/react-18)
  • Ran npm audit fix on 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