react-native-my-survey-sdk 3.1.3 → 4.0.1
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/dist/components/XeboDropdownView.d.ts +6 -2
- package/dist/components/XeboDropdownView.d.ts.map +1 -1
- package/dist/components/XeboDropdownView.js +28 -19
- package/dist/components/XeboLanguageView.js +1 -1
- package/dist/components/XeboMultiNPSView.d.ts +4 -2
- package/dist/components/XeboMultiNPSView.d.ts.map +1 -1
- package/dist/components/XeboMultiNPSView.js +25 -27
- package/dist/components/XeboMultiRatingView.d.ts +4 -2
- package/dist/components/XeboMultiRatingView.d.ts.map +1 -1
- package/dist/components/XeboMultiRatingView.js +27 -20
- package/dist/components/XeboMultipleChoiceView.d.ts +6 -2
- package/dist/components/XeboMultipleChoiceView.d.ts.map +1 -1
- package/dist/components/XeboMultipleChoiceView.js +35 -38
- package/dist/components/XeboNPSView.d.ts +8 -2
- package/dist/components/XeboNPSView.d.ts.map +1 -1
- package/dist/components/XeboNPSView.js +307 -59
- package/dist/components/XeboPageView.d.ts +33 -0
- package/dist/components/XeboPageView.d.ts.map +1 -0
- package/dist/components/XeboPageView.js +190 -0
- package/dist/components/XeboRatingView.d.ts +20 -2
- package/dist/components/XeboRatingView.d.ts.map +1 -1
- package/dist/components/XeboRatingView.js +72 -46
- package/dist/components/XeboSingleChoiceView.d.ts +8 -2
- package/dist/components/XeboSingleChoiceView.d.ts.map +1 -1
- package/dist/components/XeboSingleChoiceView.js +42 -40
- package/dist/components/XeboSurveyModal.d.ts.map +1 -1
- package/dist/components/XeboSurveyModal.js +152 -37
- package/dist/components/XeboTextBoxView.d.ts +4 -2
- package/dist/components/XeboTextBoxView.d.ts.map +1 -1
- package/dist/components/XeboTextBoxView.js +28 -19
- package/dist/core/XeboLanguageService.d.ts.map +1 -1
- package/dist/core/XeboLanguageService.js +6 -0
- package/dist/core/XeboNetworkService.d.ts +12 -1
- package/dist/core/XeboNetworkService.d.ts.map +1 -1
- package/dist/core/XeboNetworkService.js +181 -64
- package/dist/core/XeboOfflineQueue.d.ts +2 -1
- package/dist/core/XeboOfflineQueue.d.ts.map +1 -1
- package/dist/core/XeboOfflineQueue.js +24 -10
- package/dist/core/XeboSurveyManager.d.ts +16 -1
- package/dist/core/XeboSurveyManager.d.ts.map +1 -1
- package/dist/core/XeboSurveyManager.js +120 -47
- package/dist/i18n/XeboRtl.d.ts +5 -0
- package/dist/i18n/XeboRtl.d.ts.map +1 -1
- package/dist/i18n/XeboRtl.js +11 -0
- package/dist/i18n/XeboStrings.d.ts +6 -0
- package/dist/i18n/XeboStrings.d.ts.map +1 -1
- package/dist/i18n/XeboStrings.js +19 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/models/XeboAPIModels.d.ts +93 -0
- package/dist/models/XeboAPIModels.d.ts.map +1 -1
- package/dist/models/XeboModels.d.ts +86 -2
- package/dist/models/XeboModels.d.ts.map +1 -1
- package/dist/models/XeboModels.js +24 -0
- package/dist/theme/XeboTheme.d.ts +7 -0
- package/dist/theme/XeboTheme.d.ts.map +1 -1
- package/dist/theme/XeboTheme.js +27 -13
- package/package.json +3 -4
|
@@ -7,7 +7,12 @@ exports.buildVerifyURL = buildVerifyURL;
|
|
|
7
7
|
exports.verifyApiKey = verifyApiKey;
|
|
8
8
|
exports.stripHTML = stripHTML;
|
|
9
9
|
exports.resolvePlaceholder = resolvePlaceholder;
|
|
10
|
+
exports.primaryButtonLabels = primaryButtonLabels;
|
|
10
11
|
exports.parseSurvey = parseSurvey;
|
|
12
|
+
exports.resolveSkipRule = resolveSkipRule;
|
|
13
|
+
exports.resolveDelayedBranch = resolveDelayedBranch;
|
|
14
|
+
exports.isQuestionDisplayed = isQuestionDisplayed;
|
|
15
|
+
exports.visibleOptions = visibleOptions;
|
|
11
16
|
exports.fetchCollector = fetchCollector;
|
|
12
17
|
exports.fetchSurveyRaw = fetchSurveyRaw;
|
|
13
18
|
exports.fetchSurvey = fetchSurvey;
|
|
@@ -31,16 +36,11 @@ function buildVerifyURL() {
|
|
|
31
36
|
async function verifyApiKey(verifyURL, zone, apiKey) {
|
|
32
37
|
var _a, _b, _c, _d, _e, _f;
|
|
33
38
|
const url = `${verifyURL}?zone=${encodeURIComponent(zone)}`;
|
|
34
|
-
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
35
|
-
console.log('[Xebo Step 0] Verifying API key');
|
|
36
|
-
console.log('URL:', url);
|
|
37
39
|
const res = await fetch(url, {
|
|
38
40
|
method: 'GET',
|
|
39
41
|
headers: { 'x-api-key': apiKey },
|
|
40
42
|
});
|
|
41
43
|
const json = await res.json();
|
|
42
|
-
console.log('[Xebo] Verify response status:', res.status);
|
|
43
|
-
console.log('[Xebo] Verify response:', JSON.stringify(json));
|
|
44
44
|
if (!res.ok) {
|
|
45
45
|
throw new Error(`[Xebo] verifyApiKey failed — HTTP ${res.status}: ${JSON.stringify(json)}`);
|
|
46
46
|
}
|
|
@@ -48,8 +48,6 @@ async function verifyApiKey(verifyURL, zone, apiKey) {
|
|
|
48
48
|
if (!token) {
|
|
49
49
|
throw new Error(`[Xebo] verifyApiKey — bearer token not found in response: ${JSON.stringify(json)}`);
|
|
50
50
|
}
|
|
51
|
-
console.log('[Xebo] Bearer token obtained successfully');
|
|
52
|
-
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
53
51
|
return token;
|
|
54
52
|
}
|
|
55
53
|
// ─── HTML stripping ───────────────────────────────────────────────────────────
|
|
@@ -92,7 +90,11 @@ function mapRatingStyle(apiType) {
|
|
|
92
90
|
case 'smileys': return 'emoji';
|
|
93
91
|
case '3d_emoji':
|
|
94
92
|
case '3d_emojis': return '3d_emoji';
|
|
95
|
-
default:
|
|
93
|
+
default:
|
|
94
|
+
// Numbered variants such as outline_emojis3 (shown as "Emoji 4" on the platform).
|
|
95
|
+
if (normalized.includes('emoji'))
|
|
96
|
+
return normalized.startsWith('outline') ? 'outline_emoji' : 'emoji';
|
|
97
|
+
return 'star';
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
100
|
function mapQuestionType(apiType) {
|
|
@@ -100,7 +102,8 @@ function mapQuestionType(apiType) {
|
|
|
100
102
|
case 'single_choice': return XeboModels_1.XeboQuestionType.singleChoice;
|
|
101
103
|
case 'multi_choice': return XeboModels_1.XeboQuestionType.multipleChoice;
|
|
102
104
|
case 'dropdown': return XeboModels_1.XeboQuestionType.dropdown;
|
|
103
|
-
case 'single_text':
|
|
105
|
+
case 'single_text':
|
|
106
|
+
case 'long_text': return XeboModels_1.XeboQuestionType.singleTextBox; // Text Area renders as the multiline box
|
|
104
107
|
case 'multi_text': return XeboModels_1.XeboQuestionType.multipleTextBox;
|
|
105
108
|
case 'nps':
|
|
106
109
|
case 'nps_pro': return XeboModels_1.XeboQuestionType.nps;
|
|
@@ -111,8 +114,19 @@ function mapQuestionType(apiType) {
|
|
|
111
114
|
default: return XeboModels_1.XeboQuestionType.singleChoice;
|
|
112
115
|
}
|
|
113
116
|
}
|
|
117
|
+
// ─── Survey parsing ───────────────────────────────────────────────────────────
|
|
118
|
+
/** A theme button colour, or undefined when the theme leaves it blank. */
|
|
119
|
+
function buttonColor(c) {
|
|
120
|
+
return (c === null || c === void 0 ? void 0 : c.bgColor) ? { background: c.bgColor, text: c.color || undefined } : undefined;
|
|
121
|
+
}
|
|
122
|
+
/** The survey's own button text, used for its primary language. */
|
|
123
|
+
function primaryButtonLabels(data) {
|
|
124
|
+
var _a, _b, _c, _d, _e;
|
|
125
|
+
const b = (_a = data.basicSettings) === null || _a === void 0 ? void 0 : _a.buttons;
|
|
126
|
+
return { next: (_b = b === null || b === void 0 ? void 0 : b.next) === null || _b === void 0 ? void 0 : _b.text, submit: (_c = b === null || b === void 0 ? void 0 : b.submit) === null || _c === void 0 ? void 0 : _c.text, ok: (_d = b === null || b === void 0 ? void 0 : b.okay) === null || _d === void 0 ? void 0 : _d.text, previous: (_e = b === null || b === void 0 ? void 0 : b.prev) === null || _e === void 0 ? void 0 : _e.text };
|
|
127
|
+
}
|
|
114
128
|
function parseSurvey(data, opts = {}) {
|
|
115
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
|
|
129
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38;
|
|
116
130
|
// Collect all follow-up question IDs (from NPS Pro configScale)
|
|
117
131
|
const followUpQuestionIds = new Set();
|
|
118
132
|
for (const block of data.blocks) {
|
|
@@ -128,22 +142,22 @@ function parseSurvey(data, opts = {}) {
|
|
|
128
142
|
}
|
|
129
143
|
const questions = [];
|
|
130
144
|
for (const block of data.blocks) {
|
|
145
|
+
const lastItem = block.questions[block.questions.length - 1];
|
|
131
146
|
for (const item of block.questions) {
|
|
132
147
|
const q = item.question;
|
|
133
|
-
//
|
|
134
|
-
|
|
148
|
+
// Only an explicit `separator: false` joins the next question; a missing flag keeps one per page.
|
|
149
|
+
const pageBreakAfter = item.separator !== false || item === lastItem;
|
|
150
|
+
// Skip follow-up questions (they're embedded inline) and hidden ones, keeping their page break.
|
|
151
|
+
if (followUpQuestionIds.has(q.uuid) || q.isHidden) {
|
|
152
|
+
if (pageBreakAfter && questions.length > 0)
|
|
153
|
+
questions[questions.length - 1].pageBreakAfter = true;
|
|
135
154
|
continue;
|
|
136
|
-
const type = mapQuestionType(q.quesType);
|
|
137
|
-
console.log(`[Xebo] Raw API question [${q.quesType}]:`, JSON.stringify(q, null, 2));
|
|
138
|
-
if (type === XeboModels_1.XeboQuestionType.dropdown) {
|
|
139
|
-
console.log('[Xebo] Dropdown raw options keys:', JSON.stringify(Object.keys((_d = q.options) !== null && _d !== void 0 ? _d : {})));
|
|
140
|
-
console.log('[Xebo] Dropdown options.row:', JSON.stringify((_e = q.options) === null || _e === void 0 ? void 0 : _e.row));
|
|
141
|
-
console.log('[Xebo] Full dropdown q.options:', JSON.stringify(q.options));
|
|
142
155
|
}
|
|
156
|
+
const type = mapQuestionType(q.quesType);
|
|
143
157
|
const rawOptions = q.options;
|
|
144
158
|
const rowSource = Array.isArray(rawOptions)
|
|
145
159
|
? rawOptions
|
|
146
|
-
: ((
|
|
160
|
+
: ((_f = (_e = (_d = rawOptions === null || rawOptions === void 0 ? void 0 : rawOptions.row) !== null && _d !== void 0 ? _d : rawOptions === null || rawOptions === void 0 ? void 0 : rawOptions.items) !== null && _e !== void 0 ? _e : rawOptions === null || rawOptions === void 0 ? void 0 : rawOptions.choices) !== null && _f !== void 0 ? _f : []);
|
|
147
161
|
const rows = rowSource.map((r) => {
|
|
148
162
|
var _a, _b, _c, _d, _e;
|
|
149
163
|
return ({
|
|
@@ -152,7 +166,7 @@ function parseSurvey(data, opts = {}) {
|
|
|
152
166
|
value: (_e = r.uuid) !== null && _e !== void 0 ? _e : r.id,
|
|
153
167
|
});
|
|
154
168
|
});
|
|
155
|
-
const cols = ((
|
|
169
|
+
const cols = ((_h = (_g = rawOptions === null || rawOptions === void 0 ? void 0 : rawOptions.col) !== null && _g !== void 0 ? _g : rawOptions === null || rawOptions === void 0 ? void 0 : rawOptions.columns) !== null && _h !== void 0 ? _h : []).map((c) => {
|
|
156
170
|
var _a, _b, _c, _d;
|
|
157
171
|
return ({
|
|
158
172
|
id: (_a = c.uuid) !== null && _a !== void 0 ? _a : c.id,
|
|
@@ -162,11 +176,11 @@ function parseSurvey(data, opts = {}) {
|
|
|
162
176
|
});
|
|
163
177
|
// Build conditional follow-ups for NPS Pro
|
|
164
178
|
const conditionalFollowUps = [];
|
|
165
|
-
const scales = (
|
|
179
|
+
const scales = (_k = (_j = q.settings) === null || _j === void 0 ? void 0 : _j.configScale) !== null && _k !== void 0 ? _k : [];
|
|
166
180
|
for (const scale of scales) {
|
|
167
181
|
if (scale.enabled === false)
|
|
168
182
|
continue;
|
|
169
|
-
const followUpQId = (
|
|
183
|
+
const followUpQId = (_l = scale.qId) === null || _l === void 0 ? void 0 : _l[0];
|
|
170
184
|
if (!followUpQId)
|
|
171
185
|
continue;
|
|
172
186
|
// Find the follow-up question in all blocks
|
|
@@ -181,7 +195,7 @@ function parseSurvey(data, opts = {}) {
|
|
|
181
195
|
if (followUpApiQ)
|
|
182
196
|
break;
|
|
183
197
|
}
|
|
184
|
-
const followUpOptions = ((
|
|
198
|
+
const followUpOptions = ((_o = (_m = followUpApiQ === null || followUpApiQ === void 0 ? void 0 : followUpApiQ.options) === null || _m === void 0 ? void 0 : _m.row) !== null && _o !== void 0 ? _o : []).map(r => ({
|
|
185
199
|
id: r.uuid,
|
|
186
200
|
text: stripHTML(r.text),
|
|
187
201
|
value: r.uuid,
|
|
@@ -189,40 +203,76 @@ function parseSurvey(data, opts = {}) {
|
|
|
189
203
|
conditionalFollowUps.push({
|
|
190
204
|
minRating: Number(scale.scale.min),
|
|
191
205
|
maxRating: Number(scale.scale.max),
|
|
192
|
-
followUpQuestion: stripHTML((
|
|
206
|
+
followUpQuestion: stripHTML((_p = followUpApiQ === null || followUpApiQ === void 0 ? void 0 : followUpApiQ.title) !== null && _p !== void 0 ? _p : ''),
|
|
193
207
|
followUpType: followUpApiQ ? mapQuestionType(followUpApiQ.quesType) : XeboModels_1.XeboQuestionType.singleTextBox,
|
|
194
208
|
followUpOptions,
|
|
195
209
|
questionId: followUpQId,
|
|
196
210
|
});
|
|
197
211
|
}
|
|
198
|
-
const
|
|
199
|
-
const
|
|
212
|
+
const skipLogic = [];
|
|
213
|
+
const delayedBranching = [];
|
|
214
|
+
const displayCriteriaIds = [];
|
|
215
|
+
const autoSelectOptionIds = [];
|
|
216
|
+
const optionDisplayRules = [];
|
|
217
|
+
for (const logic of (_q = q.logics) !== null && _q !== void 0 ? _q : []) {
|
|
218
|
+
for (const rule of (_r = logic.data) !== null && _r !== void 0 ? _r : []) {
|
|
219
|
+
const destination = {
|
|
220
|
+
destinationType: ((_s = rule.destination) === null || _s === void 0 ? void 0 : _s.type) || 'default',
|
|
221
|
+
destinationQuestionId: ((_t = rule.destination) === null || _t === void 0 ? void 0 : _t.qId) || undefined,
|
|
222
|
+
};
|
|
223
|
+
if (logic.type === 'skip') {
|
|
224
|
+
skipLogic.push(Object.assign({ rowId: ((_u = rule.answer) === null || _u === void 0 ? void 0 : _u.rowId) || undefined, colId: ((_v = rule.answer) === null || _v === void 0 ? void 0 : _v.colId) || undefined }, destination));
|
|
225
|
+
}
|
|
226
|
+
else if (logic.type === 'delayed_branching') {
|
|
227
|
+
delayedBranching.push(Object.assign({ criteriaId: rule.criteriaId || undefined }, destination));
|
|
228
|
+
}
|
|
229
|
+
else if (logic.type === 'question_display' && rule.criteriaId) {
|
|
230
|
+
displayCriteriaIds.push(rule.criteriaId);
|
|
231
|
+
}
|
|
232
|
+
else if (logic.type === 'auto_select' && ((_w = logic.subType) !== null && _w !== void 0 ? _w : 'simple') === 'simple') {
|
|
233
|
+
autoSelectOptionIds.push(...((_x = rule.optionIds) !== null && _x !== void 0 ? _x : []).filter(id => rows.some(r => r.id === id)));
|
|
234
|
+
}
|
|
235
|
+
else if (logic.type === 'options_display' && rule.criteriaId && ((_y = rule.optionIds) === null || _y === void 0 ? void 0 : _y.length)) {
|
|
236
|
+
optionDisplayRules.push({ criteriaId: rule.criteriaId, optionIds: rule.optionIds });
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
const npsSettings = (_z = q.settings) === null || _z === void 0 ? void 0 : _z.nps;
|
|
241
|
+
const ratingSettings = (_0 = q.settings) === null || _0 === void 0 ? void 0 : _0.rating;
|
|
200
242
|
const parsed = {
|
|
201
243
|
id: q.uuid,
|
|
202
244
|
type,
|
|
203
245
|
title: stripHTML(q.title),
|
|
204
|
-
subtitle: stripHTML((
|
|
246
|
+
subtitle: stripHTML((_1 = q.helperText) === null || _1 === void 0 ? void 0 : _1.text),
|
|
205
247
|
placeholder: resolvePlaceholder(q),
|
|
206
|
-
isRequired: (
|
|
248
|
+
isRequired: (_3 = (_2 = q.required) === null || _2 === void 0 ? void 0 : _2.enabled) !== null && _3 !== void 0 ? _3 : false,
|
|
207
249
|
options: rows.length > 0 ? rows : undefined,
|
|
208
250
|
columns: cols.length > 0 ? cols : undefined,
|
|
209
251
|
npsLabels: npsSettings
|
|
210
252
|
? {
|
|
211
253
|
lower: npsSettings.leftLabel,
|
|
212
254
|
upper: npsSettings.rightLabel,
|
|
213
|
-
detractorColor: (
|
|
214
|
-
passiveColor: (
|
|
215
|
-
promoterColor: (
|
|
255
|
+
detractorColor: (_4 = npsSettings.colors) === null || _4 === void 0 ? void 0 : _4.detractor,
|
|
256
|
+
passiveColor: (_5 = npsSettings.colors) === null || _5 === void 0 ? void 0 : _5.passive,
|
|
257
|
+
promoterColor: (_6 = npsSettings.colors) === null || _6 === void 0 ? void 0 : _6.promoter,
|
|
216
258
|
}
|
|
217
259
|
: undefined,
|
|
260
|
+
npsStyle: (npsSettings === null || npsSettings === void 0 ? void 0 : npsSettings.differentForMobile)
|
|
261
|
+
? (_8 = (_7 = npsSettings.mobile) === null || _7 === void 0 ? void 0 : _7.type) !== null && _8 !== void 0 ? _8 : npsSettings.type
|
|
262
|
+
: npsSettings === null || npsSettings === void 0 ? void 0 : npsSettings.type,
|
|
218
263
|
followUpQuestion: undefined,
|
|
219
264
|
conditionalFollowUps: conditionalFollowUps.length > 0 ? conditionalFollowUps : undefined,
|
|
265
|
+
skipLogic: skipLogic.length > 0 ? skipLogic : undefined,
|
|
266
|
+
delayedBranching: delayedBranching.length > 0 ? delayedBranching : undefined,
|
|
267
|
+
displayCriteriaIds: displayCriteriaIds.length > 0 ? displayCriteriaIds : undefined,
|
|
268
|
+
autoSelectOptionIds: autoSelectOptionIds.length > 0 ? autoSelectOptionIds : undefined,
|
|
269
|
+
optionDisplayRules: optionDisplayRules.length > 0 ? optionDisplayRules : undefined,
|
|
220
270
|
ratingStyle: ratingSettings ? mapRatingStyle(ratingSettings.type) : undefined,
|
|
221
271
|
showColLabels: ratingSettings === null || ratingSettings === void 0 ? void 0 : ratingSettings.colLabel,
|
|
222
272
|
ratingColor: ratingSettings === null || ratingSettings === void 0 ? void 0 : ratingSettings.color,
|
|
223
|
-
requiredMessage: opts.localized ? stripHTML((
|
|
273
|
+
requiredMessage: opts.localized ? stripHTML((_9 = q.required) === null || _9 === void 0 ? void 0 : _9.errMsg) || undefined : undefined,
|
|
274
|
+
pageBreakAfter,
|
|
224
275
|
};
|
|
225
|
-
console.log(`[Xebo] Parsed question [${type}]:`, JSON.stringify(parsed, null, 2));
|
|
226
276
|
questions.push(parsed);
|
|
227
277
|
}
|
|
228
278
|
}
|
|
@@ -245,6 +295,7 @@ function parseSurvey(data, opts = {}) {
|
|
|
245
295
|
});
|
|
246
296
|
const introPageRaw = data.introPage;
|
|
247
297
|
const thankYouPageRaw = data.thankYouPage;
|
|
298
|
+
const logicMeet = (_10 = data.completionRules) === null || _10 === void 0 ? void 0 : _10.logicMeet;
|
|
248
299
|
const survey = {
|
|
249
300
|
id: data.uuid,
|
|
250
301
|
name: data.displayTitle,
|
|
@@ -254,29 +305,117 @@ function parseSurvey(data, opts = {}) {
|
|
|
254
305
|
questions,
|
|
255
306
|
introPage: introPageRaw
|
|
256
307
|
? {
|
|
257
|
-
enabled: (
|
|
308
|
+
enabled: (_11 = introPageRaw.enabled) !== null && _11 !== void 0 ? _11 : false,
|
|
258
309
|
content: stripHTML(introPageRaw.content),
|
|
259
310
|
buttonText: introPageRaw.buttonText,
|
|
260
311
|
}
|
|
261
312
|
: undefined,
|
|
262
313
|
thankYouPage: thankYouPageRaw
|
|
263
314
|
? {
|
|
264
|
-
enabled: (
|
|
315
|
+
enabled: (_12 = thankYouPageRaw.enabled) !== null && _12 !== void 0 ? _12 : false,
|
|
265
316
|
content: stripHTML(thankYouPageRaw.content),
|
|
266
317
|
links: thankYouPageRaw.links,
|
|
267
318
|
}
|
|
268
319
|
: undefined,
|
|
320
|
+
disqualifyMessage: (logicMeet === null || logicMeet === void 0 ? void 0 : logicMeet.type) === 'msg' ? stripHTML(logicMeet.value) || undefined : undefined,
|
|
321
|
+
autoAdvance: ((_14 = (_13 = data.basicSettings) === null || _13 === void 0 ? void 0 : _13.questionView) === null || _14 === void 0 ? void 0 : _14.autoAdvance) === true,
|
|
322
|
+
showPrevious: ((_17 = (_16 = (_15 = data.basicSettings) === null || _15 === void 0 ? void 0 : _15.buttons) === null || _16 === void 0 ? void 0 : _16.prev) === null || _17 === void 0 ? void 0 : _17.enabled) !== false
|
|
323
|
+
&& ((_20 = (_19 = (_18 = data.basicSettings) === null || _18 === void 0 ? void 0 : _18.buttons) === null || _19 === void 0 ? void 0 : _19.navigations) === null || _20 === void 0 ? void 0 : _20.enabled) !== false,
|
|
324
|
+
// basicSettings isn't translated, so this is the primary text in every language.
|
|
325
|
+
previousIconOnly: !stripHTML((_23 = (_22 = (_21 = data.basicSettings) === null || _21 === void 0 ? void 0 : _21.buttons) === null || _22 === void 0 ? void 0 : _22.prev) === null || _23 === void 0 ? void 0 : _23.text),
|
|
326
|
+
showQuestionNumbers: ((_25 = (_24 = data.basicSettings) === null || _24 === void 0 ? void 0 : _24.questions) === null || _25 === void 0 ? void 0 : _25.numbers) === true,
|
|
327
|
+
buttonColors: {
|
|
328
|
+
primary: buttonColor((_28 = (_27 = (_26 = data.theme) === null || _26 === void 0 ? void 0 : _26.style) === null || _27 === void 0 ? void 0 : _27.btns) === null || _28 === void 0 ? void 0 : _28.primary),
|
|
329
|
+
next: buttonColor((_31 = (_30 = (_29 = data.theme) === null || _29 === void 0 ? void 0 : _29.style) === null || _30 === void 0 ? void 0 : _30.advance) === null || _31 === void 0 ? void 0 : _31.nextButton),
|
|
330
|
+
ok: buttonColor((_34 = (_33 = (_32 = data.theme) === null || _32 === void 0 ? void 0 : _32.style) === null || _33 === void 0 ? void 0 : _33.advance) === null || _34 === void 0 ? void 0 : _34.okButton),
|
|
331
|
+
previous: buttonColor((_37 = (_36 = (_35 = data.theme) === null || _35 === void 0 ? void 0 : _35.style) === null || _36 === void 0 ? void 0 : _36.advance) === null || _37 === void 0 ? void 0 : _37.previousButton),
|
|
332
|
+
},
|
|
333
|
+
criteria: (_38 = data.criteria) === null || _38 === void 0 ? void 0 : _38.map(c => {
|
|
334
|
+
var _a;
|
|
335
|
+
return ({
|
|
336
|
+
id: c.uuid,
|
|
337
|
+
conditions: ((_a = c.condition) !== null && _a !== void 0 ? _a : []).map(cond => {
|
|
338
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
339
|
+
return ({
|
|
340
|
+
type: (_b = (_a = cond.data) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : '',
|
|
341
|
+
questionId: (_e = (_d = (_c = cond.data) === null || _c === void 0 ? void 0 : _c.normal) === null || _d === void 0 ? void 0 : _d.quesId) !== null && _e !== void 0 ? _e : '',
|
|
342
|
+
optionIds: (_j = (_h = (_g = (_f = cond.data) === null || _f === void 0 ? void 0 : _f.normal) === null || _g === void 0 ? void 0 : _g.options) === null || _h === void 0 ? void 0 : _h.opts) !== null && _j !== void 0 ? _j : [],
|
|
343
|
+
selected: (_m = (_l = (_k = cond.data) === null || _k === void 0 ? void 0 : _k.normal) === null || _l === void 0 ? void 0 : _l.selected) !== null && _m !== void 0 ? _m : true,
|
|
344
|
+
operator: cond.operator,
|
|
345
|
+
});
|
|
346
|
+
}),
|
|
347
|
+
});
|
|
348
|
+
}),
|
|
269
349
|
};
|
|
270
|
-
console.log('[Xebo] Full parsed survey:', JSON.stringify(survey, null, 2));
|
|
271
350
|
return survey;
|
|
272
351
|
}
|
|
352
|
+
/** The skip rule matching this answer, or the "any other answer" rule. */
|
|
353
|
+
function resolveSkipRule(question, answer) {
|
|
354
|
+
var _a;
|
|
355
|
+
const rules = question === null || question === void 0 ? void 0 : question.skipLogic;
|
|
356
|
+
if (!rules)
|
|
357
|
+
return undefined;
|
|
358
|
+
const values = (_a = answer === null || answer === void 0 ? void 0 : answer.value) !== null && _a !== void 0 ? _a : [];
|
|
359
|
+
const matched = rules.find(r => (r.rowId || r.colId) &&
|
|
360
|
+
values.some(v => (!r.rowId || r.rowId === v.rowId) && (!r.colId || r.colId === v.colId)));
|
|
361
|
+
return matched !== null && matched !== void 0 ? matched : rules.find(r => !r.rowId && !r.colId);
|
|
362
|
+
}
|
|
363
|
+
function isConditionMet(cond, answers) {
|
|
364
|
+
var _a, _b;
|
|
365
|
+
if (cond.type !== 'normal')
|
|
366
|
+
return false;
|
|
367
|
+
const values = (_b = (_a = answers.find(a => a.questionId === cond.questionId)) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : [];
|
|
368
|
+
// Choice options are rows; rating/NPS scale points are columns.
|
|
369
|
+
const found = values.some(v => cond.optionIds.includes(v.rowId) || (!!v.colId && cond.optionIds.includes(v.colId)));
|
|
370
|
+
return cond.selected ? found : !found;
|
|
371
|
+
}
|
|
372
|
+
/** Conditions combine left to right using the operator on the preceding condition (default "and"). */
|
|
373
|
+
function isCriteriaMet(criteria, answers) {
|
|
374
|
+
return criteria.conditions.reduce((result, cond, i) => {
|
|
375
|
+
const met = isConditionMet(cond, answers);
|
|
376
|
+
if (i === 0)
|
|
377
|
+
return met;
|
|
378
|
+
return criteria.conditions[i - 1].operator === 'or' ? result || met : result && met;
|
|
379
|
+
}, false);
|
|
380
|
+
}
|
|
381
|
+
/** The delayed-branching rule whose criteria all answers so far meet, or the "otherwise" rule. */
|
|
382
|
+
function resolveDelayedBranch(question, criteria, answers) {
|
|
383
|
+
const rules = question === null || question === void 0 ? void 0 : question.delayedBranching;
|
|
384
|
+
if (!rules)
|
|
385
|
+
return undefined;
|
|
386
|
+
const met = rules.find(r => {
|
|
387
|
+
const c = r.criteriaId ? criteria === null || criteria === void 0 ? void 0 : criteria.find(x => x.id === r.criteriaId) : undefined;
|
|
388
|
+
return !!c && isCriteriaMet(c, answers);
|
|
389
|
+
});
|
|
390
|
+
return met !== null && met !== void 0 ? met : rules.find(r => !r.criteriaId);
|
|
391
|
+
}
|
|
392
|
+
/** False when the question has display logic and none of its criteria is met. */
|
|
393
|
+
function isQuestionDisplayed(question, criteria, answers) {
|
|
394
|
+
const ids = question.displayCriteriaIds;
|
|
395
|
+
if (!ids)
|
|
396
|
+
return true;
|
|
397
|
+
return ids.some(id => {
|
|
398
|
+
const c = criteria === null || criteria === void 0 ? void 0 : criteria.find(x => x.id === id);
|
|
399
|
+
return !!c && isCriteriaMet(c, answers);
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
/** The options to show: one named by options display logic needs one of its rules' criteria met. */
|
|
403
|
+
function visibleOptions(question, criteria, answers) {
|
|
404
|
+
const rules = question.optionDisplayRules;
|
|
405
|
+
if (!rules || !question.options)
|
|
406
|
+
return question.options;
|
|
407
|
+
const isMet = (criteriaId) => {
|
|
408
|
+
const c = criteria === null || criteria === void 0 ? void 0 : criteria.find(x => x.id === criteriaId);
|
|
409
|
+
return !!c && isCriteriaMet(c, answers);
|
|
410
|
+
};
|
|
411
|
+
return question.options.filter(o => {
|
|
412
|
+
const own = rules.filter(r => r.optionIds.includes(o.id));
|
|
413
|
+
return own.length === 0 || own.some(r => isMet(r.criteriaId));
|
|
414
|
+
});
|
|
415
|
+
}
|
|
273
416
|
async function fetchCollector(baseURL, collectorId, bearerToken) {
|
|
274
417
|
var _a;
|
|
275
418
|
const url = `${baseURL}/v3/collectors/collect/${collectorId}`;
|
|
276
|
-
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
277
|
-
console.log('[Xebo Step 1] Fetching collector');
|
|
278
|
-
console.log('URL:', url);
|
|
279
|
-
console.log('Collector ID:', collectorId);
|
|
280
419
|
const res = await fetch(url, { headers: { 'Authorization': `Bearer ${bearerToken}` } });
|
|
281
420
|
const json = await res.json();
|
|
282
421
|
// The API may return the collector object directly at the root OR wrapped in a `data` key
|
|
@@ -290,25 +429,13 @@ async function fetchCollector(baseURL, collectorId, bearerToken) {
|
|
|
290
429
|
uuid: payload.uuid,
|
|
291
430
|
mongoId: payload._id,
|
|
292
431
|
};
|
|
293
|
-
console.log('Collector UUID:', info.uuid);
|
|
294
|
-
console.log('Collector MongoId:', info.mongoId);
|
|
295
|
-
console.log('Survey ID:', info.surveyId);
|
|
296
|
-
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
297
432
|
return info;
|
|
298
433
|
}
|
|
299
434
|
/** Returns the unparsed survey JSON so translations can be merged before parsing. */
|
|
300
435
|
async function fetchSurveyRaw(baseURL, surveyId, bearerToken) {
|
|
301
|
-
var _a, _b, _c;
|
|
302
436
|
const url = `${baseURL}/v3/survey-management/surveys/${surveyId}`;
|
|
303
|
-
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
304
|
-
console.log('[Xebo Step 2] Fetching survey');
|
|
305
|
-
console.log('URL:', url);
|
|
306
437
|
const res = await fetch(url, { headers: { 'Authorization': `Bearer ${bearerToken}` } });
|
|
307
438
|
const json = await res.json();
|
|
308
|
-
console.log('[Xebo] Survey HTTP status:', res.status);
|
|
309
|
-
console.log('[Xebo] Survey data keys:', Object.keys((_a = json === null || json === void 0 ? void 0 : json.data) !== null && _a !== void 0 ? _a : {}));
|
|
310
|
-
console.log('[Xebo] blocks:', JSON.stringify((_c = (_b = json === null || json === void 0 ? void 0 : json.data) === null || _b === void 0 ? void 0 : _b.blocks) === null || _c === void 0 ? void 0 : _c.length));
|
|
311
|
-
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
312
439
|
if (!(json === null || json === void 0 ? void 0 : json.data)) {
|
|
313
440
|
throw new Error(`[Xebo] fetchSurvey — no data in response. HTTP ${res.status}`);
|
|
314
441
|
}
|
|
@@ -321,7 +448,7 @@ async function fetchSurvey(baseURL, surveyId, bearerToken) {
|
|
|
321
448
|
return parseSurvey(await fetchSurveyRaw(baseURL, surveyId, bearerToken));
|
|
322
449
|
}
|
|
323
450
|
async function submitResponse(feedbackBaseURL, surveyId, collectorUUID, bearerToken, answers, meta) {
|
|
324
|
-
var _a;
|
|
451
|
+
var _a, _b;
|
|
325
452
|
const url = `${feedbackBaseURL}/v3/survey-participation/${surveyId}/response/create-response`;
|
|
326
453
|
// Filter out auto thank-you answer
|
|
327
454
|
const filteredAnswers = answers.filter(a => a.questionId !== 'thank_you_auto');
|
|
@@ -358,7 +485,7 @@ async function submitResponse(feedbackBaseURL, surveyId, collectorUUID, bearerTo
|
|
|
358
485
|
const payload = {
|
|
359
486
|
collector_id: collectorUUID,
|
|
360
487
|
responses: [
|
|
361
|
-
Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ response_status: 'complete', mode: 'React Native SDK', userAgent }, ((meta === null || meta === void 0 ? void 0 : meta.startTime) && { start_time: meta.startTime })), ((meta === null || meta === void 0 ? void 0 : meta.endTime) && { end_time: meta.endTime })), (timeTakenSecs !== undefined && { time_spent: timeTakenSecs })), (Object.keys(customVariables).length > 0 && { custom_variables: customVariables })), ((meta === null || meta === void 0 ? void 0 : meta.qualityFlags) && { qualityFlags: meta.qualityFlags })), ((meta === null || meta === void 0 ? void 0 : meta.deviceInfo) && { deviceInfo: meta.deviceInfo })), ((meta === null || meta === void 0 ? void 0 : meta.geolocation) && { geoLocation: meta.geolocation })), { questions: filteredAnswers.map(a => ({
|
|
488
|
+
Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ response_status: (_b = meta === null || meta === void 0 ? void 0 : meta.status) !== null && _b !== void 0 ? _b : 'complete', mode: 'React Native SDK', userAgent }, ((meta === null || meta === void 0 ? void 0 : meta.startTime) && { start_time: meta.startTime })), ((meta === null || meta === void 0 ? void 0 : meta.endTime) && { end_time: meta.endTime })), (timeTakenSecs !== undefined && { time_spent: timeTakenSecs })), (Object.keys(customVariables).length > 0 && { custom_variables: customVariables })), ((meta === null || meta === void 0 ? void 0 : meta.qualityFlags) && { qualityFlags: meta.qualityFlags })), ((meta === null || meta === void 0 ? void 0 : meta.deviceInfo) && { deviceInfo: meta.deviceInfo })), ((meta === null || meta === void 0 ? void 0 : meta.geolocation) && { geoLocation: meta.geolocation })), { questions: filteredAnswers.map(a => ({
|
|
362
489
|
uuid: a.questionId,
|
|
363
490
|
answer: a.value.map(v => ({
|
|
364
491
|
row_id: v.rowId || null,
|
|
@@ -368,13 +495,6 @@ async function submitResponse(feedbackBaseURL, surveyId, collectorUUID, bearerTo
|
|
|
368
495
|
})) }),
|
|
369
496
|
],
|
|
370
497
|
};
|
|
371
|
-
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
372
|
-
console.log('[Xebo Step 3] Submitting response');
|
|
373
|
-
console.log('URL:', url);
|
|
374
|
-
console.log('Survey ID:', surveyId);
|
|
375
|
-
console.log('Collector ID:', collectorUUID);
|
|
376
|
-
console.log('Question count:', filteredAnswers.length);
|
|
377
|
-
console.log('Payload:', JSON.stringify(payload, null, 2));
|
|
378
498
|
const res = await fetch(url, {
|
|
379
499
|
method: 'POST',
|
|
380
500
|
headers: {
|
|
@@ -385,8 +505,5 @@ async function submitResponse(feedbackBaseURL, surveyId, collectorUUID, bearerTo
|
|
|
385
505
|
body: JSON.stringify(payload),
|
|
386
506
|
});
|
|
387
507
|
const responseJson = await res.json();
|
|
388
|
-
console.log('HTTP Status:', res.status);
|
|
389
|
-
console.log('Response JSON:', JSON.stringify(responseJson, null, 2));
|
|
390
|
-
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
391
508
|
return { ok: res.ok, status: res.status, responseJson };
|
|
392
509
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { XeboQueuedResponse } from '../models/XeboModels';
|
|
1
|
+
import { XeboQueuedResponse, XeboStorageAdapter } from '../models/XeboModels';
|
|
2
2
|
export declare const XeboOfflineQueue: {
|
|
3
|
+
setStorage(storage: XeboStorageAdapter | undefined): void;
|
|
3
4
|
enqueue(response: XeboQueuedResponse): Promise<void>;
|
|
4
5
|
getAll(): Promise<XeboQueuedResponse[]>;
|
|
5
6
|
saveAll(responses: XeboQueuedResponse[]): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XeboOfflineQueue.d.ts","sourceRoot":"","sources":["../../src/core/XeboOfflineQueue.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"XeboOfflineQueue.d.ts","sourceRoot":"","sources":["../../src/core/XeboOfflineQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAuB9E,eAAO,MAAM,gBAAgB;wBACP,kBAAkB,GAAG,SAAS,GAAG,IAAI;sBAIjC,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;cAM1C,OAAO,CAAC,kBAAkB,EAAE,CAAC;uBAUpB,kBAAkB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;aAI9C,OAAO,CAAC,IAAI,CAAC;CAG7B,CAAC"}
|
|
@@ -1,23 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.XeboOfflineQueue = void 0;
|
|
7
|
-
const async_storage_1 = __importDefault(require("@react-native-async-storage/async-storage"));
|
|
8
4
|
const STORAGE_KEY = 'com.xebo.offline_responses';
|
|
5
|
+
let customStorage = null;
|
|
6
|
+
let defaultStorage = null;
|
|
7
|
+
// Without a configured storage, offline responses don't survive an app restart.
|
|
8
|
+
function loadDefaultStorage() {
|
|
9
|
+
const memory = new Map();
|
|
10
|
+
return {
|
|
11
|
+
getItem: (key) => { var _a; return (_a = memory.get(key)) !== null && _a !== void 0 ? _a : null; },
|
|
12
|
+
setItem: (key, value) => void memory.set(key, value),
|
|
13
|
+
removeItem: (key) => void memory.delete(key),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function getStorage() {
|
|
17
|
+
if (customStorage)
|
|
18
|
+
return customStorage;
|
|
19
|
+
if (!defaultStorage)
|
|
20
|
+
defaultStorage = loadDefaultStorage();
|
|
21
|
+
return defaultStorage;
|
|
22
|
+
}
|
|
9
23
|
exports.XeboOfflineQueue = {
|
|
24
|
+
setStorage(storage) {
|
|
25
|
+
customStorage = storage !== null && storage !== void 0 ? storage : null;
|
|
26
|
+
},
|
|
10
27
|
async enqueue(response) {
|
|
11
28
|
const existing = await this.getAll();
|
|
12
29
|
existing.push(response);
|
|
13
30
|
await this.saveAll(existing);
|
|
14
|
-
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
15
|
-
console.log('[Xebo Offline Queue] Enqueued response:', response.responseId);
|
|
16
|
-
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
17
31
|
},
|
|
18
32
|
async getAll() {
|
|
19
33
|
try {
|
|
20
|
-
const raw = await
|
|
34
|
+
const raw = await getStorage().getItem(STORAGE_KEY);
|
|
21
35
|
if (!raw)
|
|
22
36
|
return [];
|
|
23
37
|
return JSON.parse(raw);
|
|
@@ -27,9 +41,9 @@ exports.XeboOfflineQueue = {
|
|
|
27
41
|
}
|
|
28
42
|
},
|
|
29
43
|
async saveAll(responses) {
|
|
30
|
-
await
|
|
44
|
+
await getStorage().setItem(STORAGE_KEY, JSON.stringify(responses));
|
|
31
45
|
},
|
|
32
46
|
async clear() {
|
|
33
|
-
await
|
|
47
|
+
await getStorage().removeItem(STORAGE_KEY);
|
|
34
48
|
},
|
|
35
49
|
};
|
|
@@ -6,7 +6,7 @@ declare class SimpleEventEmitter {
|
|
|
6
6
|
off(event: string, listener: Listener): this;
|
|
7
7
|
removeAllListeners(event?: string): this;
|
|
8
8
|
}
|
|
9
|
-
import { XeboSurvey, XeboAnswer, XeboConfig, XeboThemeConfig, XeboUserData } from '../models/XeboModels';
|
|
9
|
+
import { XeboSurvey, XeboAnswer, XeboConfig, XeboThemeConfig, XeboUserData, XeboQuestion, XeboChoice } from '../models/XeboModels';
|
|
10
10
|
import { XeboLanguagePageModel } from '../models/XeboLanguageModels';
|
|
11
11
|
export declare const XEBO_EVENTS: {
|
|
12
12
|
readonly SURVEY_LOADED: "survey_loaded";
|
|
@@ -30,10 +30,15 @@ declare class XeboSurveyManagerClass extends SimpleEventEmitter {
|
|
|
30
30
|
survey: XeboSurvey | null;
|
|
31
31
|
currentAnswers: XeboAnswer[];
|
|
32
32
|
currentQuestionIndex: number;
|
|
33
|
+
/** Indices of the questions shown together, starting at currentQuestionIndex. */
|
|
34
|
+
currentPage: number[];
|
|
35
|
+
/** Pages already passed, oldest first, so Previous can return to them. */
|
|
36
|
+
private pageHistory;
|
|
33
37
|
surveyStartTime: string;
|
|
34
38
|
resolvedCollectorUUID: string;
|
|
35
39
|
resolvedCollectorMongoId: string;
|
|
36
40
|
surveyVisible: boolean;
|
|
41
|
+
disqualified: boolean;
|
|
37
42
|
private rawSurveyData;
|
|
38
43
|
private resolvedSurveyId;
|
|
39
44
|
private onLanguageSelected?;
|
|
@@ -65,8 +70,18 @@ declare class XeboSurveyManagerClass extends SimpleEventEmitter {
|
|
|
65
70
|
private _presentInLanguage;
|
|
66
71
|
private _resolveDirection;
|
|
67
72
|
private _resetSession;
|
|
73
|
+
/** True when there is an earlier page to go back to. */
|
|
74
|
+
get canGoBack(): boolean;
|
|
75
|
+
/** The question's options left after options display logic, judged on the answers so far. */
|
|
76
|
+
optionsFor(question: XeboQuestion): XeboChoice[] | undefined;
|
|
77
|
+
/** Answers on the path actually taken, so ones left on pages abandoned via Previous aren't used. */
|
|
78
|
+
private _answersOnPath;
|
|
79
|
+
/** Questions from the current one up to the next page break; display logic is checked as the page opens. */
|
|
80
|
+
private _computePage;
|
|
68
81
|
recordAnswer(answer: XeboAnswer): void;
|
|
69
82
|
nextQuestion(): void;
|
|
83
|
+
/** Goes back to the page shown before this one; its answers stay recorded. */
|
|
84
|
+
previousPage(): boolean;
|
|
70
85
|
private _buildQualityFlags;
|
|
71
86
|
private _buildGeolocation;
|
|
72
87
|
private _submitCurrentSession;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XeboSurveyManager.d.ts","sourceRoot":"","sources":["../../src/core/XeboSurveyManager.ts"],"names":[],"mappings":"AAKA,KAAK,QAAQ,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AACzC,cAAM,kBAAkB;IACtB,OAAO,CAAC,UAAU,CAAsC;IACxD,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO;IAK5C,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAI3C,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAI5C,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;CAIzC;AAQD,OAAO,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,eAAe,EAEf,YAAY,
|
|
1
|
+
{"version":3,"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