@lacagnottedesproches/lcdp-js-lite 1.12.0 โ 1.12.1
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/README.md +64 -4
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,9 +1,69 @@
|
|
|
1
1
|
[](https://github.com/lacagnottedesproches/afina-js-lite/actions/workflows/test.js.yml)
|
|
2
|
-
|
|
3
|
-
[](https://github.com/lacagnottedesproches/afina-js-lite/actions/workflows/node.js.yml)
|
|
2
|
+
[](https://www.npmjs.com/package/@lacagnottedesproches/lcdp-js-lite)
|
|
4
3
|
|
|
5
4
|
<div align="center">
|
|
6
|
-
<h1>La Cagnotte des Proches
|
|
5
|
+
<h1>La Cagnotte des Proches โ JS SDK</h1>
|
|
6
|
+
<p>Typed loader for the La Cagnotte des Proches SDK, in the browser and on the server.</p>
|
|
7
|
+
<p>
|
|
8
|
+
<a href="https://docs.lacagnottedesproches.fr/lcdpjs/"><strong>Documentation</strong></a> ยท
|
|
9
|
+
<a href="https://docs.lacagnottedesproches.fr/">API reference</a>
|
|
10
|
+
</p>
|
|
7
11
|
</div>
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @lacagnottedesproches/lcdp-js-lite @stripe/stripe-js
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`@stripe/stripe-js` (>= 3) is a peer dependency.
|
|
20
|
+
|
|
21
|
+
## Browser: `loadLCDP`
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { loadLCDP } from "@lacagnottedesproches/lcdp-js-lite";
|
|
25
|
+
|
|
26
|
+
const lcdp = await loadLCDP("pk_your_public_key");
|
|
27
|
+
// lcdp is null during server-side rendering
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Options:
|
|
31
|
+
|
|
32
|
+
| Option | Default | Description |
|
|
33
|
+
| ------------- | ------------------------------------- | -------------------------------------------------------------- |
|
|
34
|
+
| `api_url` | `https://api.lacagnottedesproches.fr` | API base URL. Never take it from user input. |
|
|
35
|
+
| `sdk_version` | โ | Pin a specific SDK bundle version. |
|
|
36
|
+
| `stripe` | `true` | Set `false` on read-only pages to skip loading Stripe.js. |
|
|
37
|
+
|
|
38
|
+
The SDK is loaded once. Calling `loadLCDP` again returns the same instance.
|
|
39
|
+
|
|
40
|
+
## Server: `requestLCDP`
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { requestLCDP } from "@lacagnottedesproches/lcdp-js-lite";
|
|
44
|
+
|
|
45
|
+
const api = requestLCDP(process.env.LCDP_SECRET_KEY!);
|
|
46
|
+
const account = await api.getAccount(accountId);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- **Server only.** It throws if `window` exists, so your secret key never reaches the browser.
|
|
50
|
+
- Every request has a 30 s timeout.
|
|
51
|
+
- On HTTP errors, the promise rejects with the API error `detail`.
|
|
52
|
+
|
|
53
|
+
Available methods: `createAccount`, `createPot`, `createAccountAndPot`, `updatePot`, `createPayout`, `getAccount`, `updateAccount`, `updateAccountIdentity`, `updateAccountBank`.
|
|
54
|
+
|
|
55
|
+
## TypeScript
|
|
56
|
+
|
|
57
|
+
All types are exported from the package:
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import type { LCDP, LCDPApi } from "@lacagnottedesproches/lcdp-js-lite";
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Documentation
|
|
64
|
+
|
|
65
|
+
Full guides and the API reference: **https://docs.lacagnottedesproches.fr/lcdpjs/**
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
[GPL-3.0-only](./LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lacagnottedesproches/lcdp-js-lite",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.1",
|
|
4
4
|
"description": "LCDP JS Lite",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "rm -rf dist/ && rollup -c",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"test:types": "tsd --files __tests__/types.test-d.ts",
|
|
16
16
|
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
|
|
17
17
|
"test:update-snapshots": "jest --updateSnapshot",
|
|
18
|
-
"test:clear-cache": "jest --clearCache"
|
|
18
|
+
"test:clear-cache": "jest --clearCache",
|
|
19
|
+
"docs": "typedoc src/index.ts --out docs"
|
|
19
20
|
},
|
|
20
21
|
"main": "dist/index.js",
|
|
21
22
|
"module": "dist/index.mjs",
|