Skip to content

Commit e8fa660

Browse files
boehlerlukasclaude
andauthored
fix: getIdentity() typing keeps the user fields; version 19.5.1 (#207)
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
1 parent 1db8435 commit e8fa660

4 files changed

Lines changed: 21 additions & 4 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 19.5.1
4+
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.
5+
36
## 19.5.0
47
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.
58
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.

‎index.d.ts‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,21 @@ export namespace Gleap {
493493
* The current session, including `gleapId`, `gleapHash` and `grant` (the signed-session
494494
* credential a signed identify returns; null when the session is not signed).
495495
*/
496-
function getIdentity(): { gleapId: string | null; gleapHash: string | null; grant: string | null; [key: string]: any };
496+
/**
497+
* The current session: the identified user's data (userId, name, email, phone, … as before) plus
498+
* gleapId/gleapHash and, on a Signed project, the session grant. Guests have no userId.
499+
*/
500+
function getIdentity(): {
501+
userId: string;
502+
name?: string;
503+
email?: string;
504+
phone?: string;
505+
companyId?: string;
506+
gleapId: string | null;
507+
gleapHash: string | null;
508+
grant: string | null;
509+
[key: string]: any;
510+
};
497511
function isUserIdentified(): boolean;
498512
function setReplayOptions(options: {
499513
blockClass?: string | RegExp;

‎package-lock.json‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"description": "JavaScript and TypeScript SDK for Gleap, an Intercom alternative with AI customer support, live chat, in-app bug reporting and customer feedback.",
33
"name": "gleap",
4-
"version": "19.5.0",
4+
"version": "19.5.1",
55
"main": "build/cjs/index.js",
66
"module": "build/esm/index.mjs",
77
"exports": {

0 commit comments

Comments
 (0)