@explorins/pers-sdk-react-native 1.5.11 → 1.5.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@explorins/pers-sdk-react-native",
3
- "version": "1.5.11",
3
+ "version": "1.5.12",
4
4
  "description": "React Native SDK for PERS Platform - Tourism Loyalty System with Manager Pattern Architecture",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -151,12 +151,13 @@ export const useTransactionSigner = () => {
151
151
 
152
152
  // Try to extract tenantId from JWT token if available
153
153
  let tenantIdFromJWT: string | undefined;
154
+ let authToken: string | null | undefined;
154
155
  if (authProvider.getToken) {
155
156
  try {
156
- const token = await authProvider.getToken();
157
- if (token) {
157
+ authToken = await authProvider.getToken();
158
+ if (authToken) {
158
159
  // Decode JWT to get tenant information
159
- const tokenParts = token.split('.');
160
+ const tokenParts = authToken.split('.');
160
161
  if (tokenParts.length >= 2) {
161
162
  const payload = JSON.parse(atob(tokenParts[1]));
162
163
  console.log('[useTransactionSigner] JWT payload decoded:', payload);
@@ -249,13 +250,14 @@ export const useTransactionSigner = () => {
249
250
  console.log('[useTransactionSigner] Initializing tenant for tenantId:', config.tenantId);
250
251
 
251
252
  // We need to set the auth token first for tenant initialization
253
+ let authToken: string | null | undefined;
252
254
  if (authProvider) {
253
255
  try {
254
- const token = await authProvider.getToken();
255
- if (token) {
256
+ authToken = await authProvider.getToken();
257
+ if (authToken) {
256
258
  console.log('[useTransactionSigner] Setting auth token for tenant initialization');
257
259
  (PersService as any).configure({
258
- token: token
260
+ token: authToken
259
261
  });
260
262
  }
261
263
  } catch (tokenError) {
@@ -263,7 +265,7 @@ export const useTransactionSigner = () => {
263
265
  }
264
266
  }
265
267
 
266
- await (PersService as any).initializeTenant(config.tenantId);
268
+ await (PersService as any).initializeTenant(config.tenantId, authToken);
267
269
  console.log('[useTransactionSigner] Tenant initialized successfully');
268
270
 
269
271
  // Verify configuration