@redacto.io/consent-sdk-react-native 5.0.0-beta.8 → 5.0.0-beta.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.
@@ -11968,6 +11968,14 @@ var decodeJwtToken = (token) => {
11968
11968
  return null;
11969
11969
  }
11970
11970
  };
11971
+ var resolveContactFromJwt = (decoded) => {
11972
+ if (!decoded) {
11973
+ return null;
11974
+ }
11975
+ const userData = decoded.user_data || {};
11976
+ const candidate = decoded.contact || decoded.primary_email || userData.primary_email || userData.primary_mobile || userData.org_user_id;
11977
+ return typeof candidate === "string" && candidate.trim() !== "" ? candidate : null;
11978
+ };
11971
11979
  var isJwtExpired = (token, bufferSeconds = 30) => {
11972
11980
  if (!token || typeof token !== "string") return true;
11973
11981
  try {
@@ -12127,10 +12135,9 @@ function extractJwtAuthData(token) {
12127
12135
  if (!decoded) {
12128
12136
  return { email: null, organizationId: null, workspaceId: null, organizationName: null };
12129
12137
  }
12130
- const userData = decoded.user_data;
12131
- const userEmail = decoded.contact || decoded.primary_email || decoded.email || decoded.user_uuid || decoded.sub || (userData && typeof userData === "object" ? userData.primary_email || userData.email || userData.contact : null) || null;
12138
+ const contact = resolveContactFromJwt(decoded) || getStoredValue("email");
12132
12139
  return {
12133
- email: typeof userEmail === "string" ? userEmail : null,
12140
+ email: typeof contact === "string" && contact.trim() !== "" ? contact : null,
12134
12141
  organizationId: decoded.organisation_uuid || null,
12135
12142
  workspaceId: decoded.workspace_uuid || null,
12136
12143
  organizationName: decoded.organisation_name || null
@@ -11853,6 +11853,14 @@ var decodeJwtToken = (token) => {
11853
11853
  return null;
11854
11854
  }
11855
11855
  };
11856
+ var resolveContactFromJwt = (decoded) => {
11857
+ if (!decoded) {
11858
+ return null;
11859
+ }
11860
+ const userData = decoded.user_data || {};
11861
+ const candidate = decoded.contact || decoded.primary_email || userData.primary_email || userData.primary_mobile || userData.org_user_id;
11862
+ return typeof candidate === "string" && candidate.trim() !== "" ? candidate : null;
11863
+ };
11856
11864
  var isJwtExpired = (token, bufferSeconds = 30) => {
11857
11865
  if (!token || typeof token !== "string") return true;
11858
11866
  try {
@@ -12012,10 +12020,9 @@ function extractJwtAuthData(token) {
12012
12020
  if (!decoded) {
12013
12021
  return { email: null, organizationId: null, workspaceId: null, organizationName: null };
12014
12022
  }
12015
- const userData = decoded.user_data;
12016
- const userEmail = decoded.contact || decoded.primary_email || decoded.email || decoded.user_uuid || decoded.sub || (userData && typeof userData === "object" ? userData.primary_email || userData.email || userData.contact : null) || null;
12023
+ const contact = resolveContactFromJwt(decoded) || getStoredValue("email");
12017
12024
  return {
12018
- email: typeof userEmail === "string" ? userEmail : null,
12025
+ email: typeof contact === "string" && contact.trim() !== "" ? contact : null,
12019
12026
  organizationId: decoded.organisation_uuid || null,
12020
12027
  workspaceId: decoded.workspace_uuid || null,
12021
12028
  organizationName: decoded.organisation_name || null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redacto.io/consent-sdk-react-native",
3
- "version": "5.0.0-beta.8",
3
+ "version": "5.0.0-beta.9",
4
4
  "description": "React Native SDK for integrating Redacto consent notices and privacy center in mobile apps.",
5
5
  "keywords": [
6
6
  "consent",