# reco-slider

> Carousel for Product Recommendations

Latest version **0.1.9** (published 2022-01-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install reco-slider
pnpm add reco-slider
yarn add reco-slider
bun add reco-slider
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.9 |
| Published | 2022-01-21 |
| First published | 2021-09-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 98.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Markus Lill |
| Maintainers | malill |

## Links

- npm: https://www.npmjs.com/package/reco-slider
- Repository: https://github.com/recommender-system/reco-slider
- Homepage: https://github.com/recommender-system/reco-slider#readme
- Issues: https://github.com/recommender-system/reco-slider/issues
- npm.io page: https://npm.io/package/reco-slider

## Recent versions

- 0.1.9 (latest) — 2022-01-21
- 0.1.8 — 2022-01-19
- 0.1.7 — 2021-11-17
- 0.1.6 — 2021-11-11
- 0.1.5 — 2021-11-10
- 0.1.4 — 2021-11-10
- 0.1.3 — 2021-11-03
- 0.1.2 — 2021-11-03
- 0.1.1 — 2021-11-02
- 0.1.0 — 2021-10-27
- 0.0.10 — 2021-10-26
- 0.0.9 — 2021-10-26
- 0.0.8 — 2021-09-20
- 0.0.7 — 2021-09-10
- 0.0.6 — 2021-09-09
- … 5 more at https://npm.io/package/reco-slider/versions

## README

# Recommendation Slider (RecoSlider) - Wiki

Carousel for product recommendations.

For **Recommender System** documentation see: https://recommender-system.github.io/

| Note that recommendations for the carousel component must be provided by a **custom endpoint** (e.g. see GitHub Repo [reco-api][reco-api])

## CDN

Add the following link to the css file in your `<head>` section:
```html
<!-- needed by recoslider.js (START) -->
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.css' />
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.min.css' />
<!-- needed by recoslider.js (END) -->

<!-- Add the recoslider-theme.css if you want default styling -->
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/reco-slider/recoslider/recoslider-theme.css'>
```

Then, before your closing ```<body>``` tag add:

```html
<!-- needed by recoslider.js (START) -->
<script src="https://cdn.jsdelivr.net/npm/js-cookie@3.0.1/dist/js.cookie.min.js"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js'></script>
<!-- needed by recoslider.js (END) -->
<script src='https://cdn.jsdelivr.net/npm/reco-slider/recoslider/recoslider.min.js'></script>
```

### Getting Started

Add a `<div>` tag with a custom class name:

```html
<div class="your-reco-slider"> </div>
```

Initialize the recoslider with (at least):

```js
$(function () {
    $('.your-reco-slider').recoSlider({
        url: 'https://******' // replace with custom endpoint
    });
});
```

### Configuration 

Available configuration fields for `reco-slider` (beside slick slider congfiguration):
```js
{
    url: 'https://******', // replace with custom endpoint (or list of endpoints) -> sends ajax GET request for fetching items
    varParams: {
        item_id_seed: $("#example-product-id").innerText // dynamic attributes that will be added to URL attribute
    }, 
    urlProbs: [.2, .8, ...], // if URL attribute provides a list -> probabilites of sampling from URL list
    title: 'Top Recommendations', // title above slider
    evidenceUrl: 'https://******' // endpoint for tracking consumer interaction
}
```



## Troubleshooting

### SAP Commerce 

- since jQuery is already loaded by SAP Commerce System, an error occurs by simply loading the snippets as describes above, saying that `... slick() is not a function` or `...recoSlider() is not a function`. For solution see https://stackoverflow.com/questions/6109847/jquery-is-not-a-function-error. Also note that the SAP Commerce Plugin does NOT use `$(function()...` to wait for the DOM to be loaded.

[reco-api]: https://github.com/recommender-system/reco-api

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