bkper-js 2.31.1 → 2.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ See what's new and what has changed in bkper-js
4
4
 
5
5
  ## 2026
6
6
 
7
+ **March 2026**
8
+
9
+ - Added `Book.batchUpdateAccounts`
10
+ - Added `Book.batchDeleteAccounts`
11
+
7
12
  **February 2026**
8
13
 
9
14
  - Added `User.getGivenName`
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [Bkper REST API]: https://bkper.com/docs/#rest-api
1
+ [Bkper REST API]: https://bkper.com/docs/api/rest
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/bkper-js?color=%235889e4)](https://www.npmjs.com/package/bkper-js)
4
4
 
@@ -8,8 +8,8 @@ It provides a set of classes and functions to interact with the Bkper API, inclu
8
8
 
9
9
  ## Documentation
10
10
 
11
- - [Developer Docs](https://bkper.com/docs)
12
- - [API Reference](https://bkper.com/docs/bkper-js/)
11
+ - [Developer Docs](https://bkper.com/docs)
12
+ - [API Reference](https://bkper.com/docs/api/bkper-js/)
13
13
 
14
14
  ## Installation
15
15
 
@@ -33,6 +33,47 @@ yarn add bkper-js
33
33
 
34
34
  ## Usage
35
35
 
36
+ ### CDN / Browser
37
+
38
+ The simplest way to use bkper-js in a browser — no build tools, no npm, just a `<script>` tag and a valid access token. Works on **any domain**.
39
+
40
+ ```html
41
+ <script src="https://cdn.jsdelivr.net/npm/bkper-js@2/dist/bkper.min.js"></script>
42
+ <script>
43
+ const { Bkper } = bkperjs;
44
+
45
+ async function listBooks(token) {
46
+ Bkper.setConfig({
47
+ oauthTokenProvider: async () => token,
48
+ });
49
+ const bkper = new Bkper();
50
+ return await bkper.getBooks();
51
+ }
52
+
53
+ // Example: prompt for a token and list books
54
+ document.addEventListener('DOMContentLoaded', () => {
55
+ document.getElementById('go').addEventListener('click', async () => {
56
+ const token = document.getElementById('token').value;
57
+ const books = await listBooks(token);
58
+ document.getElementById('output').textContent = books.map(b => b.getName()).join('\n');
59
+ });
60
+ });
61
+ </script>
62
+
63
+ <input id="token" placeholder="Paste your access token" />
64
+ <button id="go">List Books</button>
65
+ <pre id="output"></pre>
66
+ ```
67
+
68
+ Get an access token with the [Bkper CLI](https://www.npmjs.com/package/bkper):
69
+
70
+ ```bash
71
+ bkper auth login # one-time setup
72
+ bkper auth token # prints a token (valid for 1 hour)
73
+ ```
74
+
75
+ Pin to a specific version by replacing `@2` with e.g. `@2.31.0`.
76
+
36
77
  ### Node.js / CLI Scripts
37
78
 
38
79
  For local scripts and CLI tools, use the [bkper](https://www.npmjs.com/package/bkper) CLI package for authentication:
@@ -60,8 +101,25 @@ console.log(`You have ${books.length} books`);
60
101
 
61
102
  First, login via CLI: `bkper auth login`
62
103
 
104
+ ### npm + Bundler
105
+
106
+ If you are using a bundler (Vite, webpack, esbuild, etc.), install from npm and provide an access token the same way as the CDN example:
107
+
108
+ ```typescript
109
+ import { Bkper } from 'bkper-js';
110
+
111
+ Bkper.setConfig({
112
+ oauthTokenProvider: async () => 'your-access-token',
113
+ });
114
+
115
+ const bkper = new Bkper();
116
+ const books = await bkper.getBooks();
117
+ ```
118
+
63
119
  ### Web Applications on \*.bkper.app
64
120
 
121
+ > **Note:** `@bkper/web-auth` **only works on `*.bkper.app` subdomains**. Its session cookies are scoped to the `.bkper.app` domain and will not work on any other domain. For apps on other domains, use the [CDN / Browser](#cdn--browser) approach with an access token instead.
122
+
65
123
  For apps hosted on `*.bkper.app` subdomains, use the [@bkper/web-auth](https://www.npmjs.com/package/@bkper/web-auth) SDK for built-in OAuth login flow:
66
124
 
67
125
  ```typescript
@@ -89,35 +147,6 @@ const books = await bkper.getBooks();
89
147
 
90
148
  See the [@bkper/web-auth documentation](https://bkper.com/docs/auth-sdk) for more details.
91
149
 
92
- ### CDN / Browser
93
-
94
- Use bkper-js directly in any browser environment with a valid access token — no build tools required. Available via [jsDelivr](https://www.jsdelivr.com/) or [unpkg](https://unpkg.com/):
95
-
96
- ```html
97
- <script src="https://cdn.jsdelivr.net/npm/bkper-js@2/dist/bkper.min.js"></script>
98
- <script>
99
- const { Bkper } = bkperjs;
100
-
101
- Bkper.setConfig({
102
- oauthTokenProvider: async () => 'your-access-token',
103
- });
104
-
105
- const b = new Bkper();
106
- const books = await b.getBooks();
107
- </script>
108
- ```
109
-
110
- Pin to a specific version by replacing `@2` with an exact version like `@2.31.0`.
111
-
112
- You can obtain an access token using the [Bkper CLI](https://www.npmjs.com/package/bkper):
113
-
114
- ```bash
115
- bkper auth login # one-time setup
116
- bkper auth token # prints the access token
117
- ```
118
-
119
- Access tokens expire after 1 hour. For short-lived use like prototyping or testing this is fine — just run `bkper auth token` again to get a fresh one.
120
-
121
150
  ### API Key (Optional)
122
151
 
123
152
  API keys are optional and only needed for dedicated quota limits. If not provided, requests use a shared managed quota via the Bkper API proxy.