react-native-my-survey-sdk 2.2.36 → 2.2.37
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
|
@@ -412,12 +412,18 @@ export async function submitResponse(
|
|
|
412
412
|
? Math.round(meta.qualityFlags.data.survey.netTimeDuration * 60)
|
|
413
413
|
: undefined;
|
|
414
414
|
|
|
415
|
+
const osVersion = (meta?.osVersion ?? '').replace(/^(ios|android)\s*/i, '');
|
|
416
|
+
const userAgent = meta?.platform === 'ios'
|
|
417
|
+
? `Mozilla/5.0 (iPhone; CPU iPhone OS ${osVersion.replace(/\./g, '_')} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148`
|
|
418
|
+
: `Mozilla/5.0 (Linux; Android ${osVersion}; Mobile) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36`;
|
|
419
|
+
|
|
415
420
|
const payload: Record<string, unknown> = {
|
|
416
421
|
collector_id: collectorUUID,
|
|
417
422
|
responses: [
|
|
418
423
|
{
|
|
419
424
|
response_status: 'complete',
|
|
420
425
|
mode: 'React Native SDK',
|
|
426
|
+
userAgent,
|
|
421
427
|
...(meta?.startTime && { start_time: meta.startTime }),
|
|
422
428
|
...(meta?.endTime && { end_time: meta.endTime }),
|
|
423
429
|
...(timeTakenSecs !== undefined && { time_spent: timeTakenSecs }),
|
|
@@ -445,13 +451,6 @@ export async function submitResponse(
|
|
|
445
451
|
console.log('Question count:', filteredAnswers.length);
|
|
446
452
|
console.log('Payload:', JSON.stringify(payload, null, 2));
|
|
447
453
|
|
|
448
|
-
// Send a mobile User-Agent so the backend parses deviceInfo, geoLocation, and qualityFlags
|
|
449
|
-
// the same way it does for type-17 browser-based submissions.
|
|
450
|
-
const osVersion = (meta?.osVersion ?? '').replace(/^(ios|android)\s*/i, '');
|
|
451
|
-
const userAgent = meta?.platform === 'ios'
|
|
452
|
-
? `Mozilla/5.0 (iPhone; CPU iPhone OS ${osVersion.replace(/\./g, '_')} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148`
|
|
453
|
-
: `Mozilla/5.0 (Linux; Android ${osVersion}; Mobile) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36`;
|
|
454
|
-
|
|
455
454
|
const res = await fetch(url, {
|
|
456
455
|
method: 'POST',
|
|
457
456
|
headers: {
|
|
@@ -312,7 +312,7 @@ class XeboSurveyManagerClass extends SimpleEventEmitter {
|
|
|
312
312
|
qualityFlags: this._buildQualityFlags(),
|
|
313
313
|
geolocation: this._buildGeolocation(),
|
|
314
314
|
deviceInfo: {
|
|
315
|
-
type: '
|
|
315
|
+
type: 'mobile',
|
|
316
316
|
os: Platform.OS === 'ios' ? 'ios' : 'android',
|
|
317
317
|
browser: Platform.OS === 'ios' ? 'safari' : 'chrome',
|
|
318
318
|
},
|