
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
react-datatrans-light-box
Advanced tools
Official Datatrans light box library for showing our payment page in React applications. React is defined as a peer dependency and expected to be made available by your project. Other than that this library is completely dependency-free.
Beginning with v3.0.0, this component is using the Datatrans Payment JSON API.
If you're still using the legacy XML API, please refer to react-datatrans-light-box v2.0.2.
# Use with current JSON API
npm install react-datatrans-light-box
# Use with legacy XML API (supported by react-datatrans-light-box <= 2.x)
npm install react-datatrans-light-box@2
import React, { useState } from 'react'
import Lightbox from 'react-datatrans-light-box'
export default (props) => {
const { transactionId } = props
const [lightbox, showLightbox] = useState(false)
const onLoaded = () => console.log('Loaded')
const onOpened = () => console.log('Opened')
const onCancelled = () => showLightbox(false)
const onError = (data) => {
console.log('Error:', data)
showLightbox(false)
}
return <div>
<h1>Datatrans Lightbox Demo</h1>
<div>
{lightbox
? <Lightbox
transactionId={transactionId}
production={true}
onLoaded={this.onLoaded}
onOpened={this.onOpened}
onCancelled={this.onCancelled}
onError={this.onError}
/>
: <button onClick={() => showLightbox(true)}>Start Lightbox</button>
}
</div>
</div>
}
The Lightbox component takes the following properties as input.
Property | Mandatory | Type | Description |
---|---|---|---|
transactionId | Yes | String | Transaction ID returned by Initializing Transactions. |
production | No | Boolean | Indicates whether requests hit Datatrans' production or sandbox environment. Defaults to false (sandbox). |
onLoaded | No | Function | Called when payment page is loaded. |
onOpened | No | Function | Called when payment page is opened. |
onCancelled | No | Function | Called when user has cancelled payment. |
onError | No | Function | Called when there was an error loading the payment page. |
FAQs
Datatrans Lightbox component for React apps
The npm package react-datatrans-light-box receives a total of 1,557 weekly downloads. As such, react-datatrans-light-box popularity was classified as popular.
We found that react-datatrans-light-box demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.