@explorins/pers-sdk-react-native 1.5.4 → 1.5.6

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.4",
3
+ "version": "1.5.6",
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",
@@ -134,7 +134,9 @@ export const useTransactionSigner = () => {
134
134
 
135
135
  // Get configuration from the PERS SDK
136
136
  const sdkConfig = (sdk as any).config || {};
137
+ console.log('[useTransactionSigner] SDK config:', sdkConfig);
137
138
  const apiProjectKey = sdkConfig.apiProjectKey || 'demo-project-key';
139
+ console.log('[useTransactionSigner] Extracted API project key:', apiProjectKey);
138
140
  const tenantId = sdkConfig.tenantId || 'vq-demo';
139
141
 
140
142
  initializeSigner({
@@ -176,10 +178,28 @@ export const useTransactionSigner = () => {
176
178
  try {
177
179
  console.log('[useTransactionSigner] Initializing PERS transaction signer...');
178
180
 
179
- // TODO: accept direct project key in signer sdk
181
+ // Configure the PERS service with the project key before creating SDK
182
+ if (config?.projectKey) {
183
+ console.log('[useTransactionSigner] Configuring PERS service with project key:', config.projectKey);
184
+ try {
185
+ // Import and configure the PERS service
186
+ const { PersService } = await import('@explorins/pers-signer/react-native');
187
+ console.log('[useTransactionSigner] PersService imported successfully');
188
+ (PersService as any).configure({
189
+ projectKey: config.projectKey
190
+ });
191
+ console.log('[useTransactionSigner] PERS service configured with project key');
192
+
193
+ // Verify configuration
194
+ const persConfig = (PersService as any).getConfig();
195
+ console.log('[useTransactionSigner] PERS service config after configuration:', persConfig);
196
+ } catch (configError) {
197
+ console.error('[useTransactionSigner] Failed to configure PERS service:', configError);
198
+ }
199
+ }
200
+
180
201
  const signerSDK = await createPersSignerSDK({
181
202
  tenantId: config?.tenantId,
182
- // projectKey: config?.projectKey,
183
203
  ethersProviderUrl: config?.ethersProviderUrl || DEFAULT_ETHERS_PROVIDER
184
204
  });
185
205
 
@@ -245,7 +265,9 @@ export const useTransactionSigner = () => {
245
265
 
246
266
  // Get PERS access token from the main SDK
247
267
  const authProvider = (sdk as any).authProvider || (sdk as any)._authProvider;
268
+ console.log('[useTransactionSigner] Auth provider found:', !!authProvider);
248
269
  const persAccessToken = authProvider ? await authProvider.getToken() : '';
270
+ console.log('[useTransactionSigner] PERS access token extracted:', persAccessToken ? 'Token found' : 'No token');
249
271
 
250
272
  // Authenticate user with blockchain signer and pass PERS token
251
273
  console.log('[useTransactionSigner] Authenticating user with signer:', signerUserInfo.identifier);