# @dbp-topics/library

> [GitLab Repository](https://gitlab.tugraz.at/dbp/library/library) | [npmjs package](https://www.npmjs.com/package/@dbp-topics/library) | [Unpkg CDN](https://unpkg.com/browse/@dbp-topics/library/)

Latest version **1.1.0** (published 2022-04-06) · LGPL-2.1-or-later license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @dbp-topics/library
pnpm add @dbp-topics/library
yarn add @dbp-topics/library
bun add @dbp-topics/library
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2022-04-06 |
| First published | 2021-05-12 |
| Weekly downloads | 0 |
| License | LGPL-2.1-or-later |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 18 |
| Unpacked size | 6.9 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | pbek, dbp-deploy |

## Links

- npm: https://www.npmjs.com/package/@dbp-topics/library
- Repository: https://gitlab.tugraz.at/dbp/library/library
- npm.io page: https://npm.io/package/@dbp-topics/library

## Dependencies (18)

- [lit](https://npm.io/package/lit.md) ^2.0.0
- [jquery](https://npm.io/package/jquery.md) ^3.5.1
- [i18next](https://npm.io/package/i18next.md) ^21.4.2
- [select2](https://npm.io/package/select2.md) ^4.0.13
- [suggestions](https://npm.io/package/suggestions.md) ^1.7.0
- [universal-router](https://npm.io/package/universal-router.md) ^9.0.1
- [@dbp-toolkit/auth](https://npm.io/package/@dbp-toolkit/auth.md) ^0.3.0
- [@dbp-toolkit/common](https://npm.io/package/@dbp-toolkit/common.md) ^0.3.0
- [@dbp-toolkit/app-shell](https://npm.io/package/@dbp-toolkit/app-shell.md) ^0.3.0
- [@open-wc/scoped-elements](https://npm.io/package/@open-wc/scoped-elements.md) ^2.0.0
- [@dbp-toolkit/notification](https://npm.io/package/@dbp-toolkit/notification.md) ^0.3.0
- [@dbp-toolkit/person-select](https://npm.io/package/@dbp-toolkit/person-select.md) ^0.3.0
- [@dbp-toolkit/person-profile](https://npm.io/package/@dbp-toolkit/person-profile.md) ^0.2.0
- [@dbp-toolkit/data-table-view](https://npm.io/package/@dbp-toolkit/data-table-view.md) ^0.3.0
- [@dbp-toolkit/language-select](https://npm.io/package/@dbp-toolkit/language-select.md) ^0.3.0
- [@dbp-toolkit/organization-select](https://npm.io/package/@dbp-toolkit/organization-select.md) ^0.2.0
- [@dbp-toolkit/font-source-sans-pro](https://npm.io/package/@dbp-toolkit/font-source-sans-pro.md) ^0.2.0
- [@dbp-toolkit/knowledge-base-web-page-element-view](https://npm.io/package/@dbp-toolkit/knowledge-base-web-page-element-view.md) ^0.2.0

## Recent versions

- 1.1.0 (latest) — 2022-04-06
- 1.0.14 — 2022-04-05
- 1.0.13 — 2022-01-03
- 1.0.12 — 2021-11-30
- 1.0.11 — 2021-11-18
- 1.0.10 — 2021-10-12
- 1.0.9 — 2021-10-12
- 1.0.8 — 2021-09-30
- 1.0.7 — 2021-07-27
- 1.0.6 — 2021-07-21
- 1.0.5 — 2021-06-17
- 1.0.4 — 2021-06-14
- 1.0.3 — 2021-05-20
- 1.0.2 — 2021-05-19
- 1.0.1 — 2021-05-12
- … 1 more at https://npm.io/package/@dbp-topics/library/versions

## README

# Library Application

[GitLab Repository](https://gitlab.tugraz.at/dbp/library/library) |
[npmjs package](https://www.npmjs.com/package/@dbp-topics/library) |
[Unpkg CDN](https://unpkg.com/browse/@dbp-topics/library/)

![overview](docs/overview.svg)

## Prerequisites

- You need library officer permissions to be allowed to use the application
- You need the [API server](https://gitlab.tugraz.at/dbp/middleware/api) running on <http://127.0.0.1:8000> or access the [official api server](https://api.tugraz.at/)

## Local development

```bash
# get the source
git clone git@gitlab.tugraz.at:dbp/library/library.git
cd library
git submodule update --init

# install dependencies
yarn install

# constantly build dist/bundle.js and run a local web-server on port 8001 
yarn run watch-local

# run tests
yarn test
```

Jump to <http://localhost:8001> and you should get a Single Sign On login page.

Example book barcodes: `+F58330104`, `+F58019101`, `+F53498803`


## Remote development

<https://dbp-dev.tugraz.at/apps/library>

Run `yarn run watch-dev` to build the `dist/bundle.js` constantly and upload the `dist` folder to the server.

## Roll back a release

```bash
COMPOSER_VENDOR_DIR=_temp composer require "deployer/deployer" "deployer/recipes"
# Check if the config is pointing to the server you want
./_temp/bin/dep config:hosts production
# Do the rollback
./_temp/bin/dep rollback production
```

## Demo system

<https://dbp-demo.tugraz.at/apps/library>

Build bundle for the demo environment

```bash
APP_ENV=demo yarn run build
```

## Using this app as pre-built package

### Install app

If you want to install the DBP Library App in a new folder `library-app` with a path prefix `/` you can call:

```bash
npx @digital-blueprint/cli install-app library library-app /
```

Afterwards you can point your Apache web-server to `library-app/public`.

Make sure you are allowing `.htaccess` files in your Apache configuration.

Also make sure to add all of your resources you are using (like your API and Keycloak servers) to the
`Content-Security-Policy` in your `library-app/public/.htaccess`, so the browser allows access to those sites.

You can also use this app directly from the [Unpkg CDN](https://unpkg.com/browse/@dbp-topics/library/)
for example like this: [dbp-library/index.html](https://gitlab.tugraz.at/dbp/library/library/-/tree/master/examples/dbp-library/index.html)

Note that you will need a Keycloak server along with a client id for the domain you are running this html on.

### Update app

If you want to update the DBP Library App in the current folder you can call:

```bash
npx @digital-blueprint/cli update-app library
```

## Activities

### dbp-library-book-list

You can use this activity to list all books for an organisation. You cal also filter
the list by location and/or by inventory year. 

Note that you will need a Keycloak server along with a client id for the domain you are running this html on.

#### Attributes

- `lang` (optional, default: `de`): set to `de` or `en` for German or English
    - example `lang="de"`
- `entry-point-url` (optional, default is the TU Graz entry point url): entry point url to access the api
    - example `entry-point-url="https://api-dev.tugraz.at"`
- `auth` object: you need to set that object property for the auth token
    - example auth property: `{token: "THE_BEARER_TOKEN"}`
    - note: most often this should be an attribute that is not set directly, but subscribed at a provider
- `organization-id` (optional, default is the first in organisations list): id of the organisation library to which the user needs access rights.
  - example: `organization-id="1190-F2050"`

### dbp-library-budget

You can use this activity to retrieve the budget for an organisation library.

Note that you will need a Keycloak server along with a client id for the domain you are running this html on.

#### Attributes

- `lang` (optional, default: `de`): set to `de` or `en` for German or English
  - example `lang="de"`
- `entry-point-url` (optional, default is the TU Graz entry point url): entry point url to access the api
  - example `entry-point-url="https://api-dev.tugraz.at"`
- `auth` object: you need to set that object property for the auth token
  - example auth property: `{token: "THE_BEARER_TOKEN"}`
  - note: most often this should be an attribute that is not set directly, but subscribed at a provider
- `organization-id` (optional, default is the first in organisations list): id of the organisation library to which the user needs access rights.
  - example: `organization-id="681-F1490"`

### dbp-library-create-loan

You can use this activity to

Note that you will need a Keycloak server along with a client id for the domain you are running this html on.

#### Attributes

- `lang` (optional, default: `de`): set to `de` or `en` for German or English
  - example `lang="de"`
- `entry-point-url` (optional, default is the TU Graz entry point url): entry point url to access the api
  - example `entry-point-url="https://api-dev.tugraz.at"`
- `auth` object: you need to set that object property for the auth token
  - example auth property: `{token: "THE_BEARER_TOKEN"}`
  - note: most often this should be an attribute that is not set directly, but subscribed at a provider
- `organization-id` (optional, default is the first in organisations list): id of the organisation library to which the user needs access rights.
  - example: `organization-id="681-F1490"`
- `book-offer-id`: id of the book to borrow
  - example: `book-offer-id="+F20313804"`
- `person-id`: id of the person to borrow the book
  - example: `person-id="demo1dbp"`

### dbp-library-loan-list

You can use this activity to all loans for an organisation library.

Note that you will need a Keycloak server along with a client id for the domain you are running this html on.

#### Attributes

- `lang` (optional, default: `de`): set to `de` or `en` for German or English
  - example `lang="de"`
- `entry-point-url` (optional, default is the TU Graz entry point url): entry point url to access the api
  - example `entry-point-url="https://api-dev.tugraz.at"`
- `auth` object: you need to set that object property for the auth token
  - example auth property: `{token: "THE_BEARER_TOKEN"}`
  - note: most often this should be an attribute that is not set directly, but subscribed at a provider
- `organization-id` (optional, default is the first in organisations list): id of the organisation library to which the user needs access rights.
  - example: `organization-id="1190-F2050"`

### dbp-library-order-list

You can use this activity to list the orders for an organisation library.

Note that you will need a Keycloak server along with a client id for the domain you are running this html on.

#### Attributes

- `lang` (optional, default: `de`): set to `de` or `en` for German or English
  - example `lang="de"`
- `entry-point-url` (optional, default is the TU Graz entry point url): entry point url to access the api
  - example `entry-point-url="https://api-dev.tugraz.at"`
- `auth` object: you need to set that object property for the auth token
  - example auth property: `{token: "THE_BEARER_TOKEN"}`
  - note: most often this should be an attribute that is not set directly, but subscribed at a provider
- `organization-id` (optional, default is the first in organisations list): id of the organisation library to which the user needs access rights.
  - example: `organization-id="1190-F2050"`

### dbp-library-renew-loan

You can use this activity to list all loans a person has. The organisation is used as a filter (so each library officer 
sees only loans for books he/she has to manage).

Note that you will need a Keycloak server along with a client id for the domain you are running this html on.

#### Attributes

- `lang` (optional, default: `de`): set to `de` or `en` for German or English
  - example `lang="de"`
- `entry-point-url` (optional, default is the TU Graz entry point url): entry point url to access the api
  - example `entry-point-url="https://api-dev.tugraz.at"`
- `auth` object: you need to set that object property for the auth token
  - example auth property: `{token: "THE_BEARER_TOKEN"}`
  - note: most often this should be an attribute that is not set directly, but subscribed at a provider
- `person-id`: id of the person to borrow the book
  - example: `person-id="demo1dbp"`
- `organization-id` (optional, default is the first in organisations list): id of the organisation library to which the user needs access rights.
  - example: `organization-id="681-F1490"`

### dbp-library-return-book

You can use this activity to return a borrowed book. Each library office can only accept books from the library he/she
manages.

Note that you will need a Keycloak server along with a client id for the domain you are running this html on.

#### Attributes

- `lang` (optional, default: `de`): set to `de` or `en` for German or English
  - example `lang="de"`
- `entry-point-url` (optional, default is the TU Graz entry point url): entry point url to access the api
  - example `entry-point-url="https://api-dev.tugraz.at"`
- `auth` object: you need to set that object property for the auth token
  - example auth property: `{token: "THE_BEARER_TOKEN"}`
  - note: most often this should be an attribute that is not set directly, but subscribed at a provider
- `organization-id` (optional, default is the first in organisations list): id of the organisation library to which the user needs access rights.
  - example: `organization-id="681-F1490"`
- `book-offer-id`: id of the book to borrow
  - example: `book-offer-id="+F20313804"`

### dbp-library-shelving

You can use this activity to store the place (on the shelf) for a added/returned book. Each library office can only 
shelf books she/he manages. 

Note that you will need a Keycloak server along with a client id for the domain you are running this html on.

#### Attributes

- `lang` (optional, default: `de`): set to `de` or `en` for German or English
  - example `lang="de"`
- `entry-point-url` (optional, default is the TU Graz entry point url): entry point url to access the api
  - example `entry-point-url="https://api-dev.tugraz.at"`
- `auth` object: you need to set that object property for the auth token
  - example auth property: `{token: "THE_BEARER_TOKEN"}`
  - note: most often this should be an attribute that is not set directly, but subscribed at a provider
- `organization-id` (optional, default is the first in organisations list): id of the organisation library to which the user needs access rights.
  - example: `organization-id="681-F1490"`
- `book-offer-id`: id of the book to borrow
  - example: `book-offer-id="+F20313804"`

## "dbp-library" Slots

These are common slots for the appshell. You can find the documentation of these slot in the `README.md` of the appshell webcomponent.

## Design Note

To ensure a uniform and responsive design the activity should occupy 100% of the window width when the activity width is less than 768 px.

## Mandatory attributes

If you are not using the `provider-root` attribute to "terminate" all provider attributes
you need to manually add these attributes so that the topic will work properly:

```html
<dbp-library
    auth
    requested-login-status
    analytics-event
>
</dbp-library>
```

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