open-index/open-npm huggingface dataset:
npm package: @schibsted/niche-capi-sdk
Description: This library consists o 2 main parts:
Latest version: 3.1.3

# `niche-capi-sdk`

This library consists o 2 main parts:

- Capi SDK
- Set of functions to work with Capi data

## Capi SDK

### Methods

- getArticleById
- getImageUrl
- getImage
- getArticleIds
- getAuthorByIdOrSlug
- getTagByIdOrSlug
- searchArticles
- getRelatedArticles
- registerQuizQuestion

### Set of functions to work with Capi data

Transfromations are grouped into 2 categories, those working on a single component level and those working on a list of components. Single component transformations should be used where possible, they are easier to understand, faster and should be safer. Multiple component transformations must be used when you need to add, remove or reorder components.

### Changes in transformations

After introducing any breaking changes in article transformations, make sure that it will be working correctly for all sites that are already using them - Godt, Tek, MinMote.
npm package: @schibsted/niche-privacy-permissions
Description: [Documentation](https://docs.schibsted.io/privacy-settings/privacy-permissions/)
Latest version: 0.5.5

# `niche-privacy-permissions`

[Documentation](https://docs.schibsted.io/privacy-settings/privacy-permissions/)

[Privacy permissions API swagger](https://docs.schibsted.io/privacy-settings/privacy-permissions/api/)
npm package: @schibsted/niche-schibsted-account
Description: This package is a wrapper around `@schibsted/account-sdk-browser` that makes it easier to use for Niche team.
Latest version: 0.4.4

# `niche-schibsted-account`

This package is a wrapper around `@schibsted/account-sdk-browser` that makes it easier to use for Niche team.

## What are additional things it does in coparison to SDK?

- override logout function to allow passing `redirectUrl` (`window.location.href` by default) to it.
- assigns instance if SDK to `window.Identity` - it is used like that by core comments.
- sends events for initialization and user change
- runs simplified login logic
- runs auto-login logic

## Local development

First install dependencies
clone repository, open terminal and run.

```bash
npm ci
```

Next start transpiling the source code:

```bash
npm run dev
```

### Linking

Note: order of command execution is important.

In order to make your project available as package locally:

```bash
npm link
```

And in project you need:

```bash
npm link @schibsted/niche-schibsted-account
```

Since library has `react` as peer dependency you need to make sure to pass `react` manually to the library if you want to use linked version. The easiest way to do so is to declare `react` as a webpack alias, e.g.

```js
config.resolve.alias.react = path.resolve('./node_modules/react');
```

If the project you use this package in, does not have webpack, you can try https://benjaminwfox.com/blog/tech/why-isnt-npm-link-working#if-you-use-react.

And now you are all good. Your project will now use the local version of niche-schibsted-account instead of the one in node_modules.
npm package: @schibsted/niche-stylizr
Description: Takes a text and a styles-array and converts it by calling the handlers supplied when creating a stylizr instance.
Latest version: 2.2.2

# `niche-stylizr`

Takes a text and a styles-array and converts it by calling the handlers supplied when creating a stylizr instance.

## Usage

```js
// stylizr-instance.js
import React from 'react';
import stylizr from 'stylizr';

const stylizrInstance = stylizr({
    'style:em': (text, key) => <em key={key}>{text}</em>,
});

export default stylizrInstance;

// ----

// another-file.js
import React from 'react';
import ReactDOM from 'react-dom';
import stylizr from './stylizr-instance';

ReactDOM.render(
    <MyComponent>
        {stylizr('This is my text', [
            {
                offset: 5,
                length: 2,
                type: 'style:em',
            },
        ])}
    </MyComponent>,
    document.getElementById('react-root')
);
```
npm package: @schibsted/niche-utils
Description: This package contains utilities used in multiple projects and packages used by Niche team. **Use at your own risk.**
Latest version: 0.7.2

# `niche-utils`

This package contains utilities used in multiple projects and packages used by Niche team. **Use at your own risk.**

## Exported methods

### `getEventTarget`

Safely returns new EventTarget instance. If `EventTarget` is not supported, returns `document.createElement('a')` which should work the same way.

### `getFromLocalStorage`, `saveToLocalStorage`, `removeFromLocalStorage`

Local storage methods to safely get, save and remove data from local storage. If local storage is not supported, get returns `undefined` and other methods do nothing.