# escalade-react-price

> A react component to display Escalade Sports pricing.

Latest version **1.1.7** (published 2018-03-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install escalade-react-price
pnpm add escalade-react-price
yarn add escalade-react-price
bun add escalade-react-price
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.7 |
| Published | 2018-03-05 |
| First published | 2018-02-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 250.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Kennedy Rose |
| Maintainers | ken85rose |
| Keywords | react, component, boilerplate |

## Links

- npm: https://www.npmjs.com/package/escalade-react-price
- Repository: https://github.com/escaladesports/escalade-react-price
- Homepage: https://github.com/escaladesports/escalade-react-price#readme
- Issues: https://github.com/escaladesports/escalade-react-price/issues
- npm.io page: https://npm.io/package/escalade-react-price

## Dependencies (4)

- [js-cookie](https://npm.io/package/js-cookie.md) ^2.2.0
- [styled-jsx](https://npm.io/package/styled-jsx.md) ^2.2.4
- [fetch-retry](https://npm.io/package/fetch-retry.md) ^1.1.1
- [escalade-price-store](https://npm.io/package/escalade-price-store.md) ^1.1.3

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.1.7 (latest) — 2018-03-05
- 1.1.6 — 2018-03-05
- 1.1.5 — 2018-03-05
- 1.1.4 — 2018-03-05
- 1.1.3 — 2018-03-05
- 1.1.2 — 2018-03-05
- 1.0.2 — 2018-02-14
- 1.0.1 — 2018-02-13
- 1.0.0 — 2018-02-13

## README

# Escalade Sports React Price Component

A react component to display Escalade Sports pricing.

## Installation

With Yarn:

```bash
yarn add escalade-react-price
```

Or npm:

```bash
npm install --save escalade-react-price
```

## Basic Usage

To display price for a single item:

```jsx
import { Price } from 'escalade-react-price'

...

<Price id='AT86A06455R' site='bear' />

{/* Or with render prop */}

<Price id='AT86A06455R' site='bear'>{price => {
	return <div>{price}</div>
}}</Price>

```

## Prefetch Prices

To prefetch prices for all or some products, you can either use the function directly (recommended) or use the component. Just pass in the IDs as well as any other options you would supply for the Price component.

Do this with all IDs on the site to make ensure there's no load times on any price components.

### Function

```jsx
import { prefetchPrices } from 'escalade-react-price'

...

componentWillMount(){
	prefetchPrices({
		site: 'bear',
		ids: [
			'AT86A06455R',
			'AK1450SR',
			'AFT2032140',
		]
	})
}
```

### Component

```jsx
import { PrefetchPrices } from 'escalade-react-price'

...

<PrefetchPrices
	site='bear'
	ids={[
		'AT86A06455R',
		'AK1450SR',
		'AFT2032140',
	]}
	/>
```


## Additional Properties

Property | Description | Type | Default
--- | --- | --- | ---
`id` | The ID to show pricing from (if using Price component) | String | `undefined`
`ids` | A list of IDs to prefetch pricing | Array | `undefined`
`site` | The site ID to pull pricing from | String | `process.env.SITE_ID || process.env.GATSBY_SITE_ID`
`unavailable` | Display property if pricing is unavailable | String or Component | `''`
`loading` | Display property while pricing is loading | String or Component | `''`
`cookies` | Saves fetched pricing to a cookie for quicker loading | Boolean | `true`
`cookieExpiration` | Number of days until cookie expirtes | Number | `1`
`pollInterval` | Length of time in milliseconds until all product pricing is fetched again | Number | `900000` (15 minutes)
`endpoint` | A URL or stage to fetch prices from | String | `process.env.PRICING_ENDPOINT || process.env.GATSBY_PRICING_ENDPOINT || 'production'`

---
_Source: https://npm.io/package/escalade-react-price · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
