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