
Research
/Security News
Popular Tinycolor npm Package Compromised in Supply Chain Attack Affecting 40+ Packages
Malicious update to @ctrl/tinycolor on npm is part of a supply-chain attack hitting 40+ packages across maintainers
@vtex/payment-flags
Advanced tools
A React component which renders payment flag SVGs. They are easier to handle and look really crisp on any size, and also use the most recent branding from each carrier.
Through NPM:
$ npm install @vtex/payment-flags
import PaymentFlagPicker from '@vtex/country-codes/modules/PaymentFlagPicker'
Through vtex.io:
Add vtex.payment-flags
to your manifest.json
dependencies
import { PaymentFlagPicker } from 'vtex.payment-flags'
This component takes in a code representing one of VTEX's paymentSystem
codes, fetches the SVG component related to that payment, and provides it as argument to a children function. You should render the component inside a container with the desired height, as they will fit 100% of such height. If a component associated with that paymentSystem is not found, such argument will be null
.
paymentSystem
from the Payments APInull
)PaymentFlagPicker.propTypes = {
paymentSystem: PropTypes.string.isRequired,
children: PropTypes.func.isRequired,
}
// Shall render an Amex card with height 'h2'
<PaymentFlagPicker paymentSystem={'1'}>
{FlagComponent =>
FlagComponent && (
<div className="h2">
<FlagComponent />
</div>
)
}
</PaymentFlagPicker>
There are still a few credit cards missing (Aura, Banricompras and some Colombian ones). Would be nice to have SVGs for Boleto, Apple Pay, Cash, and other stuff, and also a default SVG to render when nothing is found.
There are more flags available from where I took the first ones (here). Designers willing to help develop more flags should use that list as a style reference.
Author: Gustavo Silva (@akaFTS), with initial SVGs obtained from muffinresearch/payment-icons
This project is licensed under the MIT License.
FAQs
A React component which renders payment icons
We found that @vtex/payment-flags demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 33 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.
Research
/Security News
Malicious update to @ctrl/tinycolor on npm is part of a supply-chain attack hitting 40+ packages across maintainers
Security News
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.