
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
react-basket
Advanced tools
A shopping basket components library for React based on material-ui components.
A shopping basket components library for React based on material-ui components.
You can access the demo page from demo site.
If you have any sort of doubt, idea or just want to talk about the project, feel free to join our chat on Gitter :)
npm install react-basket
import { DataProvider, BasketItem } from "react-basket";
export class MyBasketDataProvider implements DataProvider {
registerToChanges(callback: (items: BasketItem[]) => void) {
// You can call callback functions if you socket.io/pusher or something like it.
}
products = [
{ id: "1", name: 'Computer', price: 1722.44, quantity: 1 },
{ id: "2", name: 'Phone', price: 522.14, quantity: 1 }
];
items = [
{ id: "1", name: 'Computer', price: 1722.44, quantity: 1 },
{ id: "2", name: 'Phone', price: 522.14, quantity: 2 }
];
getInitialData = (): Promise<BasketItem[]> => {
return new Promise<BasketItem[]>((resolve, reject) => {
setTimeout(() => {
resolve(this.items)
}, 1000)
});
}
onAllItemsDeleted(): Promise<BasketItem[]> {
return new Promise<BasketItem[]>((resolve, reject) => {
setTimeout(() => {
this.items = [];
resolve(this.items)
}, 1000)
});
}
onItemAdded(id: string): Promise<BasketItem[]> {
return new Promise<BasketItem[]>((resolve, reject) => {
setTimeout(() => {
let index = this.items.findIndex(item => item.id === id);
if (index > -1) {
this.items[index].quantity++;
}
else {
const index = this.products.findIndex(item => item.id === id);
if (index > -1) {
const item = {...this.products[index]};
this.items.push(item);
}
}
resolve(this.items)
}, 1000)
});
}
onItemDeleted = (id: string): Promise<BasketItem[]> => {
return new Promise<BasketItem[]>((resolve, reject) => {
setTimeout(() => {
const index = this.items.findIndex(item => item.id === id);
if (index > -1) {
this.items.splice(index, 1);
}
resolve(this.items)
}, 1000)
});
}
}
I used Typescript, but you can use pure javascript.
You should add BasketProvider component in root of your application with a data provider implementation.
class App extends React.Component {
render() {
const { classes } = this.props;
return (
<BasketProvider dataProvider={new MyBasketDataProvider()}>
<div> your all components will be here </div>
</>BasketProvider>
);
}
}
It connects to BasketProvider and take data from it.
import { Basket } from 'react-basket';
<Basket />
import { withBasketData } from 'react-basket';
import { IconButton, Badge } from '@material-ui/core';
import ShoppingCart from '@material-ui/icons/ShoppingCart';
const MyComponent = (props) => (
<IconButton color="inherit">
<Badge badgeContent={props.basketData.items.length} color="secondary">
<ShoppingCart />
</Badge>
</IconButton>
)
export default withBasketData(MyComponent);
This project is licensed under the terms of the MIT license.
FAQs
A shopping basket components library for React based on material-ui components.
The npm package react-basket receives a total of 24 weekly downloads. As such, react-basket popularity was classified as not popular.
We found that react-basket demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.