react-native-my-survey-sdk 2.2.17 → 2.2.19
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
|
@@ -349,40 +349,23 @@ export async function submitResponse(
|
|
|
349
349
|
// Filter out auto thank-you answer
|
|
350
350
|
const filteredAnswers = answers.filter(a => a.questionId !== 'thank_you_auto');
|
|
351
351
|
|
|
352
|
-
//
|
|
353
|
-
|
|
354
|
-
if (meta?.
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
);
|
|
352
|
+
// Build custom_variables — the platform maps these to Name, Email, Mobile, Unique Id fields
|
|
353
|
+
const customVariables: Record<string, string> = {};
|
|
354
|
+
if (meta?.userData) {
|
|
355
|
+
if (meta.userData.name) customVariables.name = meta.userData.name;
|
|
356
|
+
if (meta.userData.email) customVariables.email = meta.userData.email;
|
|
357
|
+
if (meta.userData.phone) customVariables.mobile = meta.userData.phone;
|
|
358
|
+
if (meta.userData.uniqueId) customVariables.uid = meta.userData.uniqueId;
|
|
359
|
+
if (meta.userData.country) customVariables.country = meta.userData.country;
|
|
360
|
+
if (meta.userData.city) customVariables.city = meta.userData.city;
|
|
358
361
|
}
|
|
359
362
|
|
|
360
363
|
const payload: Record<string, unknown> = {
|
|
361
364
|
collector_id: collectorUUID,
|
|
362
|
-
mode: 'React Native SDK',
|
|
363
|
-
...(meta?.userData && {
|
|
364
|
-
respondent: {
|
|
365
|
-
name: meta.userData.name,
|
|
366
|
-
email: meta.userData.email,
|
|
367
|
-
phone: meta.userData.phone,
|
|
368
|
-
unique_id: meta.userData.uniqueId,
|
|
369
|
-
country: meta.userData.country,
|
|
370
|
-
city: meta.userData.city,
|
|
371
|
-
},
|
|
372
|
-
}),
|
|
373
|
-
device_info: {
|
|
374
|
-
device: meta?.deviceModel ?? 'Unknown',
|
|
375
|
-
platform: meta?.platform ?? 'mobile',
|
|
376
|
-
os_version: meta?.osVersion ?? '',
|
|
377
|
-
},
|
|
378
|
-
timing: {
|
|
379
|
-
start_time: meta?.startTime,
|
|
380
|
-
end_time: meta?.endTime,
|
|
381
|
-
time_spent_seconds: timeSpentSeconds,
|
|
382
|
-
},
|
|
383
365
|
responses: [
|
|
384
366
|
{
|
|
385
367
|
response_status: 'complete',
|
|
368
|
+
...(Object.keys(customVariables).length > 0 && { custom_variables: customVariables }),
|
|
386
369
|
questions: filteredAnswers.map(a => ({
|
|
387
370
|
uuid: a.questionId,
|
|
388
371
|
answer: a.value.map(v => ({
|