react-native-my-survey-sdk 2.2.23 → 2.2.25

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": "react-native-my-survey-sdk",
3
- "version": "2.2.23",
3
+ "version": "2.2.25",
4
4
  "description": "Xebo survey collection SDK for React Native",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -373,6 +373,9 @@ export async function submitResponse(
373
373
 
374
374
  const payload: Record<string, unknown> = {
375
375
  collector_id: collectorUUID,
376
+ ...(meta?.qualityFlags && { qualityFlags: meta.qualityFlags }),
377
+ ...(meta?.deviceInfo && { deviceInfo: meta.deviceInfo }),
378
+ ...(meta?.geolocation && { geoLocation: meta.geolocation }),
376
379
  responses: [
377
380
  {
378
381
  response_status: 'complete',
@@ -386,9 +389,6 @@ export async function submitResponse(
386
389
  text: v.text || null,
387
390
  })),
388
391
  })),
389
- ...(meta?.qualityFlags && { qualityFlags: meta.qualityFlags }),
390
- ...(meta?.deviceInfo && { deviceInfo: meta.deviceInfo }),
391
- ...(meta?.geolocation && { geolocation: meta.geolocation }),
392
392
  },
393
393
  ],
394
394
  };
@@ -401,9 +401,20 @@ export async function submitResponse(
401
401
  console.log('Question count:', filteredAnswers.length);
402
402
  console.log('Payload:', JSON.stringify(payload, null, 2));
403
403
 
404
+ // Send a mobile User-Agent so the backend parses deviceInfo, geoLocation, and qualityFlags
405
+ // the same way it does for type-17 browser-based submissions.
406
+ const osVersion = (meta?.osVersion ?? '').replace(/^(ios|android)\s*/i, '');
407
+ const userAgent = meta?.platform === 'ios'
408
+ ? `Mozilla/5.0 (iPhone; CPU iPhone OS ${osVersion.replace(/\./g, '_')} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148`
409
+ : `Mozilla/5.0 (Linux; Android ${osVersion}; Mobile) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36`;
410
+
404
411
  const res = await fetch(url, {
405
412
  method: 'POST',
406
- headers: { 'x-api-key': apiKey, 'Content-Type': 'application/json' },
413
+ headers: {
414
+ 'x-api-key': apiKey,
415
+ 'Content-Type': 'application/json',
416
+ 'User-Agent': userAgent,
417
+ },
407
418
  body: JSON.stringify(payload),
408
419
  });
409
420
 
@@ -127,7 +127,7 @@ export interface XeboDeviceInfo {
127
127
 
128
128
  export interface XeboGeolocation {
129
129
  type: string;
130
- coordinates: [number | null, number | null];
130
+ coordinates: (number | null)[];
131
131
  country: string | null;
132
132
  city: string | null;
133
133
  region: string | null;