@ozvi/sdk 1.0.0 → 1.1.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/README.md +2 -2
- package/dist/index.d.ts +9 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,8 +17,8 @@ const token = signOzviToken(
|
|
|
17
17
|
);
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
- `id` (required) is the person's stable id in your app; `role` can be `member` (default), `team` or `admin`; `locale` sets the board language.
|
|
21
|
-
- Tokens live 10 minutes by default (`{ expiresIn }` in seconds); the widget asks for a fresh one when it needs it.
|
|
20
|
+
- `id` (required) is the person's stable id in your app; `role` can be `member` (default), `team` or `admin`; `locale` (`sk`, `cs`, `en`, `pl`, `hu` or `de`) sets the board language when the board offers it.
|
|
21
|
+
- Tokens live 10 minutes by default (`{ expiresIn }` in seconds); the widget asks for a fresh one when it needs it. Ozvi refuses tokens that live longer than an hour (`exp` − `iat` > 3600) or carry no `iat`.
|
|
22
22
|
- `verifyOzviToken(token, secret)` checks a token the way Ozvi does, handy in tests.
|
|
23
23
|
|
|
24
24
|
The token is a standard HS256 JWT, so any language can make one without this package: see [Sign people in](https://ozvi.io/docs/widget#sign-in) for Python and PHP.
|
package/dist/index.d.ts
CHANGED
|
@@ -6,9 +6,13 @@
|
|
|
6
6
|
* locale: "en", traits: { company: "Acme", plan: "pro", mrr: 2900 } }, process.env.OZVI_SSO_SECRET!);
|
|
7
7
|
* // pass it to the widget: <ozvi-widget sso-token="..."> or https://feedback.example.com/sso?token=...
|
|
8
8
|
*
|
|
9
|
-
* `locale` (optional) forces the board language for this user ("sk" | "cs" | "en"), so the
|
|
10
|
-
* matches your app. Ignored when the board does not have that language enabled.
|
|
9
|
+
* `locale` (optional) forces the board language for this user ("sk" | "cs" | "en" | "pl" | "hu" | "de"), so the
|
|
10
|
+
* board matches your app. Ignored when the board does not have that language enabled.
|
|
11
|
+
*
|
|
12
|
+
* Ozvi refuses tokens without `iat` or living longer than an hour (`exp` − `iat` > 3600); the default is 10 minutes.
|
|
11
13
|
*/
|
|
14
|
+
/** Board languages a token may ask for (the board must have the language switched on). */
|
|
15
|
+
export type OzviLocale = "sk" | "cs" | "en" | "pl" | "hu" | "de";
|
|
12
16
|
export interface OzviUser {
|
|
13
17
|
/** Stable id in YOUR system. Ozvi keys the user on (project, id), never on e-mail alone. */
|
|
14
18
|
id: string;
|
|
@@ -24,8 +28,8 @@ export interface OzviUser {
|
|
|
24
28
|
avatarUrl?: string;
|
|
25
29
|
/** "team" can triage and write internal notes, "admin" can also change settings. Defaults to "member". */
|
|
26
30
|
role?: "member" | "team" | "admin";
|
|
27
|
-
/** UI language on the board and in e-mails
|
|
28
|
-
locale?:
|
|
31
|
+
/** UI language on the board and in e-mails; honoured only when the board offers it. Omit to let the browser decide. */
|
|
32
|
+
locale?: OzviLocale;
|
|
29
33
|
/**
|
|
30
34
|
* Customer data shown only to your team (item page "who wants it", ideas sorted by MRR, plan filter, MCP for
|
|
31
35
|
* triage tokens). Known names: `company`, `companyId` (people with the same id count as one company),
|
|
@@ -49,7 +53,7 @@ export interface OzviClaims extends OzviUser {
|
|
|
49
53
|
exp: number;
|
|
50
54
|
}
|
|
51
55
|
export interface SignOptions {
|
|
52
|
-
/** Token lifetime in seconds
|
|
56
|
+
/** Token lifetime in seconds, 600 by default (tokens are minted per page load). Ozvi refuses more than 3600. */
|
|
53
57
|
expiresIn?: number;
|
|
54
58
|
now?: () => number;
|
|
55
59
|
}
|