@saasquatch/component-environment 1.0.8 → 1.0.9
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/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/index.mjs +4 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ declare const PROGRAM_CONTEXT_NAME: ProgramContextName;
|
|
|
21
21
|
declare type UserIdentity = {
|
|
22
22
|
id: string;
|
|
23
23
|
accountId: string;
|
|
24
|
+
email?: string;
|
|
24
25
|
jwt?: string;
|
|
25
26
|
managedIdentity?: {
|
|
26
27
|
email: string;
|
|
@@ -39,6 +40,7 @@ interface DecodedSquatchJWT {
|
|
|
39
40
|
user: {
|
|
40
41
|
accountId: string;
|
|
41
42
|
id: string;
|
|
43
|
+
email?: string;
|
|
42
44
|
};
|
|
43
45
|
}
|
|
44
46
|
interface DecodedWidgetAPIJWT {
|
|
@@ -59,6 +61,7 @@ interface WidgetIdent {
|
|
|
59
61
|
token: string;
|
|
60
62
|
userId: string;
|
|
61
63
|
accountId: string;
|
|
64
|
+
email?: string;
|
|
62
65
|
locale?: string;
|
|
63
66
|
engagementMedium?: "POPUP" | "EMBED";
|
|
64
67
|
programId?: string;
|
package/dist/index.js
CHANGED
|
@@ -504,6 +504,7 @@ function userIdentityFromJwt(jwt) {
|
|
|
504
504
|
const exp = decoded.exp;
|
|
505
505
|
let userId = void 0;
|
|
506
506
|
let accountId = void 0;
|
|
507
|
+
let email = void 0;
|
|
507
508
|
if (isDecodedWidgetAPIJWT(decoded)) {
|
|
508
509
|
const matches = decoded.sub.match(/(.*):(.*)@(.*):users/);
|
|
509
510
|
if (matches == null ? void 0 : matches[1])
|
|
@@ -513,6 +514,7 @@ function userIdentityFromJwt(jwt) {
|
|
|
513
514
|
} else if (isDecodedSquatchJWT(decoded)) {
|
|
514
515
|
accountId = decoded.user.accountId;
|
|
515
516
|
userId = decoded.user.id;
|
|
517
|
+
email = decoded.user.email;
|
|
516
518
|
}
|
|
517
519
|
if (!userId || !accountId) {
|
|
518
520
|
debug6("No user information");
|
|
@@ -525,6 +527,7 @@ function userIdentityFromJwt(jwt) {
|
|
|
525
527
|
return {
|
|
526
528
|
id: userId,
|
|
527
529
|
accountId,
|
|
530
|
+
email,
|
|
528
531
|
jwt
|
|
529
532
|
};
|
|
530
533
|
} catch (e) {
|
|
@@ -546,6 +549,7 @@ function _getInitialValue() {
|
|
|
546
549
|
return {
|
|
547
550
|
id: sdk.widgetIdent.userId,
|
|
548
551
|
accountId: sdk.widgetIdent.accountId,
|
|
552
|
+
email: sdk.widgetIdent.email,
|
|
549
553
|
jwt: sdk.widgetIdent.token
|
|
550
554
|
};
|
|
551
555
|
case "SquatchPortal":
|
package/dist/index.mjs
CHANGED
|
@@ -455,6 +455,7 @@ function userIdentityFromJwt(jwt) {
|
|
|
455
455
|
const exp = decoded.exp;
|
|
456
456
|
let userId = void 0;
|
|
457
457
|
let accountId = void 0;
|
|
458
|
+
let email = void 0;
|
|
458
459
|
if (isDecodedWidgetAPIJWT(decoded)) {
|
|
459
460
|
const matches = decoded.sub.match(/(.*):(.*)@(.*):users/);
|
|
460
461
|
if (matches == null ? void 0 : matches[1])
|
|
@@ -464,6 +465,7 @@ function userIdentityFromJwt(jwt) {
|
|
|
464
465
|
} else if (isDecodedSquatchJWT(decoded)) {
|
|
465
466
|
accountId = decoded.user.accountId;
|
|
466
467
|
userId = decoded.user.id;
|
|
468
|
+
email = decoded.user.email;
|
|
467
469
|
}
|
|
468
470
|
if (!userId || !accountId) {
|
|
469
471
|
debug6("No user information");
|
|
@@ -476,6 +478,7 @@ function userIdentityFromJwt(jwt) {
|
|
|
476
478
|
return {
|
|
477
479
|
id: userId,
|
|
478
480
|
accountId,
|
|
481
|
+
email,
|
|
479
482
|
jwt
|
|
480
483
|
};
|
|
481
484
|
} catch (e) {
|
|
@@ -497,6 +500,7 @@ function _getInitialValue() {
|
|
|
497
500
|
return {
|
|
498
501
|
id: sdk.widgetIdent.userId,
|
|
499
502
|
accountId: sdk.widgetIdent.accountId,
|
|
503
|
+
email: sdk.widgetIdent.email,
|
|
500
504
|
jwt: sdk.widgetIdent.token
|
|
501
505
|
};
|
|
502
506
|
case "SquatchPortal":
|