react-native-my-survey-sdk 2.2.36 → 2.2.38
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
|
@@ -405,6 +405,11 @@ export async function submitResponse(
|
|
|
405
405
|
if (meta.userData.uniqueId) customVariables.unique_id = meta.userData.uniqueId;
|
|
406
406
|
if (meta.userData.country) customVariables.country = meta.userData.country;
|
|
407
407
|
if (meta.userData.city) customVariables.city = meta.userData.city;
|
|
408
|
+
if (meta.userData.eData) {
|
|
409
|
+
Object.entries(meta.userData.eData).forEach(([key, value]) => {
|
|
410
|
+
if (key && value) customVariables[key] = value;
|
|
411
|
+
});
|
|
412
|
+
}
|
|
408
413
|
}
|
|
409
414
|
|
|
410
415
|
// time_spent in whole seconds, derived from netTimeDuration (minutes)
|
|
@@ -412,12 +417,18 @@ export async function submitResponse(
|
|
|
412
417
|
? Math.round(meta.qualityFlags.data.survey.netTimeDuration * 60)
|
|
413
418
|
: undefined;
|
|
414
419
|
|
|
420
|
+
const osVersion = (meta?.osVersion ?? '').replace(/^(ios|android)\s*/i, '');
|
|
421
|
+
const userAgent = meta?.platform === 'ios'
|
|
422
|
+
? `Mozilla/5.0 (iPhone; CPU iPhone OS ${osVersion.replace(/\./g, '_')} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148`
|
|
423
|
+
: `Mozilla/5.0 (Linux; Android ${osVersion}; Mobile) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36`;
|
|
424
|
+
|
|
415
425
|
const payload: Record<string, unknown> = {
|
|
416
426
|
collector_id: collectorUUID,
|
|
417
427
|
responses: [
|
|
418
428
|
{
|
|
419
429
|
response_status: 'complete',
|
|
420
430
|
mode: 'React Native SDK',
|
|
431
|
+
userAgent,
|
|
421
432
|
...(meta?.startTime && { start_time: meta.startTime }),
|
|
422
433
|
...(meta?.endTime && { end_time: meta.endTime }),
|
|
423
434
|
...(timeTakenSecs !== undefined && { time_spent: timeTakenSecs }),
|
|
@@ -445,13 +456,6 @@ export async function submitResponse(
|
|
|
445
456
|
console.log('Question count:', filteredAnswers.length);
|
|
446
457
|
console.log('Payload:', JSON.stringify(payload, null, 2));
|
|
447
458
|
|
|
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
459
|
const res = await fetch(url, {
|
|
456
460
|
method: 'POST',
|
|
457
461
|
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
|
},
|