diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dbafb1e..08ef6f44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 19.5.1 +Fixed: the `getIdentity()` typing lists the identified user's fields again (`userId`, `name`, `email`, `phone`, `companyId`) next to `gleapId`, `gleapHash` and `grant`; 19.5.0 typed only the session pair and the grant, which broke TypeScript callers that read the user from it. No runtime change. + ## 19.5.0 Added: signed customer identity. `Gleap.setUserJwt(token)` identifies the user with an identity token (HS256 JWT signed by your backend); its `userId` claim names the user and every other claim lands on the contact as signed data. The token is kept in memory only, and the call never rejects: refusals are logged. Added: `Gleap.setUserJwtProvider(provider)` hands Gleap a function that returns a fresh identity token; it is called when the current token expired or is about to. diff --git a/index.d.ts b/index.d.ts index ba76c12e..cd46880a 100644 --- a/index.d.ts +++ b/index.d.ts @@ -493,7 +493,21 @@ export namespace Gleap { * The current session, including `gleapId`, `gleapHash` and `grant` (the signed-session * credential a signed identify returns; null when the session is not signed). */ - function getIdentity(): { gleapId: string | null; gleapHash: string | null; grant: string | null; [key: string]: any }; + /** + * The current session: the identified user's data (userId, name, email, phone, … as before) plus + * gleapId/gleapHash and, on a Signed project, the session grant. Guests have no userId. + */ + function getIdentity(): { + userId: string; + name?: string; + email?: string; + phone?: string; + companyId?: string; + gleapId: string | null; + gleapHash: string | null; + grant: string | null; + [key: string]: any; + }; function isUserIdentified(): boolean; function setReplayOptions(options: { blockClass?: string | RegExp; diff --git a/package-lock.json b/package-lock.json index c2a21376..b36f48e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gleap", - "version": "19.5.0", + "version": "19.5.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "gleap", - "version": "19.5.0", + "version": "19.5.1", "license": "Commercial", "dependencies": { "@floating-ui/dom": "^1.7.5", diff --git a/package.json b/package.json index a51f564c..8b82c972 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "description": "JavaScript and TypeScript SDK for Gleap, an Intercom alternative with AI customer support, live chat, in-app bug reporting and customer feedback.", "name": "gleap", - "version": "19.5.0", + "version": "19.5.1", "main": "build/cjs/index.js", "module": "build/esm/index.mjs", "exports": {