react-native-my-survey-sdk 2.2.15 → 2.2.17
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
|
@@ -41,39 +41,36 @@ const _androidNavBar = Platform.OS === 'android'
|
|
|
41
41
|
: 0;
|
|
42
42
|
|
|
43
43
|
function computeSheetHeight(question: XeboQuestion | null, screen: ModalScreen): number {
|
|
44
|
-
if (screen === 'thankYou') return SCREEN_HEIGHT * 0.
|
|
45
|
-
if (screen === 'intro') return SCREEN_HEIGHT * 0.
|
|
46
|
-
if (!question) return SCREEN_HEIGHT * 0.
|
|
44
|
+
if (screen === 'thankYou') return SCREEN_HEIGHT * 0.30;
|
|
45
|
+
if (screen === 'intro') return SCREEN_HEIGHT * 0.35;
|
|
46
|
+
if (!question) return SCREEN_HEIGHT * 0.42;
|
|
47
47
|
switch (question.type) {
|
|
48
48
|
case XeboQuestionType.multiNps:
|
|
49
49
|
case XeboQuestionType.multiRating: {
|
|
50
50
|
const rowCount = question.options?.length ?? 3;
|
|
51
|
-
return Math.min(SCREEN_HEIGHT * 0.
|
|
51
|
+
return Math.min(SCREEN_HEIGHT * 0.70, SCREEN_HEIGHT * (0.22 + rowCount * 0.13));
|
|
52
52
|
}
|
|
53
53
|
case XeboQuestionType.nps:
|
|
54
54
|
return (question.conditionalFollowUps?.length ?? 0) > 0
|
|
55
|
-
? SCREEN_HEIGHT * 0.
|
|
56
|
-
: SCREEN_HEIGHT * 0.
|
|
55
|
+
? SCREEN_HEIGHT * 0.55
|
|
56
|
+
: SCREEN_HEIGHT * 0.34;
|
|
57
57
|
case XeboQuestionType.rating:
|
|
58
|
-
return question.followUpQuestion ? SCREEN_HEIGHT * 0.
|
|
58
|
+
return question.followUpQuestion ? SCREEN_HEIGHT * 0.50 : SCREEN_HEIGHT * 0.34;
|
|
59
59
|
case XeboQuestionType.singleTextBox:
|
|
60
|
-
|
|
61
|
-
return SCREEN_HEIGHT * 0.40;
|
|
60
|
+
return SCREEN_HEIGHT * 0.35;
|
|
62
61
|
case XeboQuestionType.multipleTextBox: {
|
|
63
62
|
const fieldCount = question.options?.length ?? 1;
|
|
64
|
-
return Math.min(SCREEN_HEIGHT * 0.
|
|
63
|
+
return Math.min(SCREEN_HEIGHT * 0.65, SCREEN_HEIGHT * (0.26 + fieldCount * 0.10));
|
|
65
64
|
}
|
|
66
65
|
case XeboQuestionType.dropdown:
|
|
67
|
-
|
|
68
|
-
// Minimum ~0.62 regardless of whether options are parsed yet
|
|
69
|
-
return SCREEN_HEIGHT * 0.62;
|
|
66
|
+
return SCREEN_HEIGHT * 0.55;
|
|
70
67
|
case XeboQuestionType.singleChoice:
|
|
71
68
|
case XeboQuestionType.multipleChoice: {
|
|
72
69
|
const optCount = question.options?.length ?? 0;
|
|
73
|
-
return Math.min(SCREEN_HEIGHT * 0.
|
|
70
|
+
return Math.min(SCREEN_HEIGHT * 0.72, SCREEN_HEIGHT * (0.24 + optCount * 0.075));
|
|
74
71
|
}
|
|
75
72
|
default:
|
|
76
|
-
return SCREEN_HEIGHT * 0.
|
|
73
|
+
return SCREEN_HEIGHT * 0.42;
|
|
77
74
|
}
|
|
78
75
|
}
|
|
79
76
|
|
|
@@ -118,15 +118,19 @@ export function parseSurvey(data: APISurveyResponse['data']): XeboSurvey {
|
|
|
118
118
|
console.log('[Xebo] Dropdown options.row:', JSON.stringify(q.options?.row));
|
|
119
119
|
console.log('[Xebo] Full dropdown q.options:', JSON.stringify(q.options));
|
|
120
120
|
}
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
const rawOptions = q.options as any;
|
|
122
|
+
const rowSource: any[] = Array.isArray(rawOptions)
|
|
123
|
+
? rawOptions
|
|
124
|
+
: (rawOptions?.row ?? rawOptions?.items ?? rawOptions?.choices ?? []);
|
|
125
|
+
const rows: XeboChoice[] = rowSource.map((r: any) => ({
|
|
126
|
+
id: r.uuid ?? r.id,
|
|
127
|
+
text: stripHTML(r.text ?? r.label ?? r.value ?? ''),
|
|
128
|
+
value: r.uuid ?? r.id,
|
|
125
129
|
}));
|
|
126
|
-
const cols: XeboChoice[] = (
|
|
127
|
-
id: c.uuid,
|
|
128
|
-
text: stripHTML(c.text),
|
|
129
|
-
value: c.uuid,
|
|
130
|
+
const cols: XeboChoice[] = (rawOptions?.col ?? rawOptions?.columns ?? []).map((c: any) => ({
|
|
131
|
+
id: c.uuid ?? c.id,
|
|
132
|
+
text: stripHTML(c.text ?? c.label ?? ''),
|
|
133
|
+
value: c.uuid ?? c.id,
|
|
130
134
|
}));
|
|
131
135
|
|
|
132
136
|
// Build conditional follow-ups for NPS Pro
|