@propel-nsl/propel-react-native-sdk 1.0.2 → 1.0.4

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,8 +1,17 @@
1
1
  {
2
2
  "name": "@propel-nsl/propel-react-native-sdk",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Propel Mobile SDK - React Native Core",
5
- "files": ["src/", "src-app/", "lib/", "assets/", "index.ts", "CLIENT_INTEGRATION_GUIDE.md", "RN_HOST_INTEGRATION.md", "README.md"],
5
+ "files": [
6
+ "src/",
7
+ "src-app/",
8
+ "lib/",
9
+ "assets/",
10
+ "index.ts",
11
+ "CLIENT_INTEGRATION_GUIDE.md",
12
+ "RN_HOST_INTEGRATION.md",
13
+ "README.md"
14
+ ],
6
15
  "main": "index.ts",
7
16
  "react-native": "lib/index.ts",
8
17
  "types": "lib/index.ts",
@@ -53,11 +62,21 @@
53
62
  "redux-saga": ">=1.0.0"
54
63
  },
55
64
  "peerDependenciesMeta": {
56
- "@react-native-clipboard/clipboard": { "optional": true },
57
- "@react-native-community/masked-view": { "optional": true },
58
- "react-native-image-picker": { "optional": true },
59
- "react-native-permissions": { "optional": true },
60
- "react-native-fast-image": { "optional": true }
65
+ "@react-native-clipboard/clipboard": {
66
+ "optional": true
67
+ },
68
+ "@react-native-community/masked-view": {
69
+ "optional": true
70
+ },
71
+ "react-native-image-picker": {
72
+ "optional": true
73
+ },
74
+ "react-native-permissions": {
75
+ "optional": true
76
+ },
77
+ "react-native-fast-image": {
78
+ "optional": true
79
+ }
61
80
  },
62
81
  "devDependencies": {
63
82
  "@babel/core": "^7.25.2",
package/src/SDKApp.tsx CHANGED
@@ -253,6 +253,8 @@ const SDKApp: React.FC<any> = (props) => {
253
253
  navigateToTransactionHistory(from);
254
254
  } else if (target === 'Redeem') {
255
255
  navigateToRedeem(from);
256
+ } else if (target === 'Dashboard') {
257
+ console.log('🚀 Dashboard navigation after auth - no special navigation needed, using default flow');
256
258
  }
257
259
  },
258
260
  [authenticateSDK, navigateToTransactionHistory, navigateToRedeem]
@@ -309,6 +311,14 @@ const SDKApp: React.FC<any> = (props) => {
309
311
  lastSegment === 'redeem_screen' ||
310
312
  lastSegment === 'redeemscreen';
311
313
 
314
+ const isDashboard =
315
+ normalized === 'dashboard' ||
316
+ normalized === 'dash' ||
317
+ normalized === 'home' ||
318
+ lastSegment === 'dashboard' ||
319
+ lastSegment === 'dash' ||
320
+ lastSegment === 'home';
321
+
312
322
  if (isRedemptionHistory || isTransactionHistory) {
313
323
  // Prevent duplicate handling
314
324
  if (deepLinkHandledRef.current) {
@@ -330,6 +340,16 @@ const SDKApp: React.FC<any> = (props) => {
330
340
  console.log('🚀 Intent matched! Will authenticate then navigate to Redeem...');
331
341
  pendingDeepLinkRef.current = { target: 'Redeem', from: 'HostApp' };
332
342
  authenticateAndNavigate('Redeem', 'HostApp');
343
+ } else if (isDashboard) {
344
+ // Prevent duplicate handling
345
+ if (deepLinkHandledRef.current) {
346
+ console.log('🚀 Deep link already handled, skipping duplicate call');
347
+ return;
348
+ }
349
+ deepLinkHandledRef.current = true;
350
+ console.log('🚀 Intent matched! Will authenticate then navigate to Dashboard...');
351
+ pendingDeepLinkRef.current = { target: 'Dashboard', from: 'HostApp' };
352
+ authenticateAndNavigate('Dashboard', 'HostApp');
333
353
  }
334
354
  },
335
355
  [authenticateAndNavigate]
@@ -33,8 +33,11 @@ const getDeviceId = async (): Promise<string> => {
33
33
 
34
34
 
35
35
  const createAuthHeader = async (token: string): Promise<string> => {
36
- const deviceId = await getDeviceId();
37
- return `Token token=${token};client_key=mobile_app;device_id=device123;client_id=7b170ef2-c0a0-4968-a832-d308d54a8419;user_type=end_user;language_code=en;`;
36
+ // Try to get device ID from SDK credentials first (from host app), then fallback to device info
37
+ const creds = getSDKCredentials();
38
+ const deviceId = creds?.deviceId || await getDeviceId();
39
+ console.log('createAuthHeader: Using device ID:', deviceId, '(from host:', !!creds?.deviceId, ')');
40
+ return `Token token=${token};client_key=mobile_app;device_id=${deviceId};client_id=7b170ef2-c0a0-4968-a832-d308d54a8419;user_type=end_user;language_code=en;`;
38
41
  };
39
42
 
40
43
 
@@ -67,8 +70,12 @@ export const sdkAuthApi = async () => {
67
70
 
68
71
  const environment = creds.environment?.toUpperCase?.() || "PRODUCTION";
69
72
 
73
+ const resolvedDeviceId = creds.deviceId && typeof creds.deviceId === 'object' && typeof (creds.deviceId as any).then === 'function'
74
+ ? await (creds.deviceId as Promise<string>)
75
+ : creds.deviceId;
76
+
70
77
  const payload = {
71
- device_id: creds.deviceId || "device123",
78
+ device_id: resolvedDeviceId || await getDeviceId(),
72
79
  client_name: creds.clientName || "AndroidApp",
73
80
  client_version: creds.clientVersion || "1.0.0",
74
81
  environment,
@@ -83,7 +90,33 @@ export const sdkAuthApi = async () => {
83
90
  "Content-Type": "application/json",
84
91
  };
85
92
 
86
- return api1.post(ENDPOINTS.SDK_AUTH_INIT, payload, { headers });
93
+ // Log complete authentication request
94
+ console.log('=== SDK AUTH API REQUEST ===');
95
+ console.log('URL:', ENDPOINTS.SDK_AUTH_INIT);
96
+ console.log('Headers:', {
97
+ "X-Auth-Token": creds.authToken.substring(0, 20) + '...',
98
+ "X-Auth-Id": creds.authId,
99
+ "Content-Type": "application/json",
100
+ });
101
+ console.log('Payload:', JSON.stringify(payload, null, 2));
102
+ console.log('=============================');
103
+
104
+ try {
105
+ const response = await api1.post(ENDPOINTS.SDK_AUTH_INIT, payload, { headers });
106
+
107
+ console.log('=== SDK AUTH API RESPONSE ===');
108
+ console.log('Status:', response.status);
109
+ console.log('Response Data:', JSON.stringify(response.data, null, 2));
110
+ console.log('==============================');
111
+
112
+ return response;
113
+ } catch (error: any) {
114
+ console.log('=== SDK AUTH API ERROR ===');
115
+ console.log('Error:', error?.response?.data || error?.message);
116
+ console.log('Status:', error?.response?.status);
117
+ console.log('==========================');
118
+ throw error;
119
+ }
87
120
  };
88
121
  export const myOrdersApi = async () => {
89
122
  try {