react-native-my-survey-sdk 2.2.38 → 3.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.
Files changed (75) hide show
  1. package/dist/components/XeboDropdownView.d.ts +10 -0
  2. package/dist/components/XeboDropdownView.d.ts.map +1 -0
  3. package/dist/components/XeboDropdownView.js +190 -0
  4. package/dist/components/XeboIntroView.d.ts +9 -0
  5. package/dist/components/XeboIntroView.d.ts.map +1 -0
  6. package/dist/components/XeboIntroView.js +54 -0
  7. package/dist/components/XeboMultiNPSView.d.ts +10 -0
  8. package/dist/components/XeboMultiNPSView.d.ts.map +1 -0
  9. package/dist/components/XeboMultiNPSView.js +170 -0
  10. package/dist/components/XeboMultiRatingView.d.ts +10 -0
  11. package/dist/components/XeboMultiRatingView.d.ts.map +1 -0
  12. package/dist/components/XeboMultiRatingView.js +154 -0
  13. package/dist/components/XeboMultipleChoiceView.d.ts +10 -0
  14. package/dist/components/XeboMultipleChoiceView.d.ts.map +1 -0
  15. package/dist/components/XeboMultipleChoiceView.js +188 -0
  16. package/dist/components/XeboNPSView.d.ts +10 -0
  17. package/dist/components/XeboNPSView.d.ts.map +1 -0
  18. package/dist/components/XeboNPSView.js +269 -0
  19. package/dist/components/XeboRatingView.d.ts +10 -0
  20. package/dist/components/XeboRatingView.d.ts.map +1 -0
  21. package/dist/components/XeboRatingView.js +248 -0
  22. package/dist/components/XeboSingleChoiceView.d.ts +10 -0
  23. package/dist/components/XeboSingleChoiceView.d.ts.map +1 -0
  24. package/dist/components/XeboSingleChoiceView.js +172 -0
  25. package/dist/components/XeboSurveyModal.d.ts +3 -0
  26. package/dist/components/XeboSurveyModal.d.ts.map +1 -0
  27. package/dist/components/XeboSurveyModal.js +345 -0
  28. package/dist/components/XeboTextBoxView.d.ts +10 -0
  29. package/dist/components/XeboTextBoxView.d.ts.map +1 -0
  30. package/dist/components/XeboTextBoxView.js +176 -0
  31. package/dist/components/XeboThankYouView.d.ts +9 -0
  32. package/dist/components/XeboThankYouView.d.ts.map +1 -0
  33. package/dist/components/XeboThankYouView.js +115 -0
  34. package/dist/core/XeboNetworkService.d.ts +34 -0
  35. package/dist/core/XeboNetworkService.d.ts.map +1 -0
  36. package/dist/core/XeboNetworkService.js +367 -0
  37. package/dist/core/XeboOfflineQueue.d.ts +8 -0
  38. package/dist/core/XeboOfflineQueue.d.ts.map +1 -0
  39. package/dist/core/XeboOfflineQueue.js +35 -0
  40. package/dist/core/XeboSurveyManager.d.ts +59 -0
  41. package/dist/core/XeboSurveyManager.d.ts.map +1 -0
  42. package/dist/core/XeboSurveyManager.js +351 -0
  43. package/dist/index.d.ts +5 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +12 -0
  46. package/dist/models/XeboAPIModels.d.ts +82 -0
  47. package/dist/models/XeboAPIModels.d.ts.map +1 -0
  48. package/dist/models/XeboAPIModels.js +4 -0
  49. package/dist/models/XeboModels.d.ts +141 -0
  50. package/dist/models/XeboModels.d.ts.map +1 -0
  51. package/dist/models/XeboModels.js +17 -0
  52. package/dist/theme/XeboTheme.d.ts +11 -0
  53. package/dist/theme/XeboTheme.d.ts.map +1 -0
  54. package/dist/theme/XeboTheme.js +25 -0
  55. package/package.json +10 -3
  56. package/babel.config.js +0 -4
  57. package/src/components/XeboDropdownView.tsx +0 -197
  58. package/src/components/XeboIntroView.tsx +0 -68
  59. package/src/components/XeboMultiNPSView.tsx +0 -166
  60. package/src/components/XeboMultiRatingView.tsx +0 -165
  61. package/src/components/XeboMultipleChoiceView.tsx +0 -183
  62. package/src/components/XeboNPSView.tsx +0 -315
  63. package/src/components/XeboRatingView.tsx +0 -267
  64. package/src/components/XeboSingleChoiceView.tsx +0 -168
  65. package/src/components/XeboSurveyModal.tsx +0 -360
  66. package/src/components/XeboTextBoxView.tsx +0 -188
  67. package/src/components/XeboThankYouView.tsx +0 -100
  68. package/src/core/XeboNetworkService.ts +0 -476
  69. package/src/core/XeboOfflineQueue.ts +0 -33
  70. package/src/core/XeboSurveyManager.ts +0 -422
  71. package/src/index.ts +0 -23
  72. package/src/models/XeboAPIModels.ts +0 -80
  73. package/src/models/XeboModels.ts +0 -169
  74. package/src/theme/XeboTheme.ts +0 -33
  75. package/tsconfig.json +0 -17
@@ -0,0 +1,351 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.XeboSurveyManager = exports.XEBO_EVENTS = void 0;
7
+ const netinfo_1 = __importDefault(require("@react-native-community/netinfo"));
8
+ const react_native_device_info_1 = __importDefault(require("react-native-device-info"));
9
+ const react_native_1 = require("react-native");
10
+ class SimpleEventEmitter {
11
+ constructor() {
12
+ this._listeners = new Map();
13
+ }
14
+ emit(event, ...args) {
15
+ var _a;
16
+ const fns = (_a = this._listeners.get(event)) !== null && _a !== void 0 ? _a : [];
17
+ fns.forEach(fn => fn(...args));
18
+ return fns.length > 0;
19
+ }
20
+ on(event, listener) {
21
+ var _a;
22
+ this._listeners.set(event, [...((_a = this._listeners.get(event)) !== null && _a !== void 0 ? _a : []), listener]);
23
+ return this;
24
+ }
25
+ off(event, listener) {
26
+ var _a;
27
+ this._listeners.set(event, ((_a = this._listeners.get(event)) !== null && _a !== void 0 ? _a : []).filter(l => l !== listener));
28
+ return this;
29
+ }
30
+ removeAllListeners(event) {
31
+ event ? this._listeners.delete(event) : this._listeners.clear();
32
+ return this;
33
+ }
34
+ }
35
+ const uuidv4 = () => 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
36
+ const r = (Math.random() * 16) | 0;
37
+ return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16);
38
+ });
39
+ const XeboNetworkService_1 = require("./XeboNetworkService");
40
+ const XeboOfflineQueue_1 = require("./XeboOfflineQueue");
41
+ const XeboTheme_1 = require("../theme/XeboTheme");
42
+ // ─── Event names ──────────────────────────────────────────────────────────────
43
+ exports.XEBO_EVENTS = {
44
+ SURVEY_LOADED: 'survey_loaded',
45
+ QUESTION_CHANGED: 'question_changed',
46
+ SURVEY_VISIBLE: 'survey_visible',
47
+ SURVEY_DISMISSED: 'survey_dismissed',
48
+ };
49
+ // ─── Singleton class ──────────────────────────────────────────────────────────
50
+ class XeboSurveyManagerClass extends SimpleEventEmitter {
51
+ constructor() {
52
+ super(...arguments);
53
+ // Config
54
+ this.apiKey = '';
55
+ this.collectorId = '';
56
+ this.resolvedZone = '';
57
+ this.baseURL = '';
58
+ this.feedbackBaseURL = '';
59
+ this.verifyURL = '';
60
+ this.bearerToken = '';
61
+ // User / eData
62
+ this.userData = null;
63
+ this.deviceModel = '';
64
+ this.osVersion = '';
65
+ // State
66
+ this.survey = null;
67
+ this.currentAnswers = [];
68
+ this.currentQuestionIndex = 0;
69
+ this.surveyStartTime = '';
70
+ this.resolvedCollectorUUID = '';
71
+ this.resolvedCollectorMongoId = '';
72
+ this.surveyVisible = false;
73
+ // Timing / quality
74
+ this.surveyStartEpoch = 0;
75
+ this.questionStartEpoch = 0;
76
+ this.timePerQues = {};
77
+ this.backTrackCount = 0;
78
+ // Network monitoring unsubscribe handle
79
+ this.netInfoUnsubscribe = null;
80
+ }
81
+ // ─── Configure ─────────────────────────────────────────────────────────────
82
+ configure(config) {
83
+ this.apiKey = config.apiKey;
84
+ this.collectorId = config.collectorId;
85
+ this.resolvedZone = config.zone;
86
+ this.baseURL = (0, XeboNetworkService_1.buildBaseURL)(this.resolvedZone);
87
+ this.feedbackBaseURL = (0, XeboNetworkService_1.buildFeedbackBaseURL)(this.resolvedZone);
88
+ this.verifyURL = (0, XeboNetworkService_1.buildVerifyURL)();
89
+ // Capture device info once at configure time
90
+ this.deviceModel = `${react_native_device_info_1.default.getModel()} (${react_native_device_info_1.default.getSystemName()})`;
91
+ this.osVersion = `${react_native_1.Platform.OS} ${react_native_device_info_1.default.getSystemVersion()}`;
92
+ this._startNetworkMonitoring();
93
+ // Pre-fetch survey in background so it's ready instantly when button is tapped
94
+ this._prefetchSurvey();
95
+ }
96
+ configureTheme(config) {
97
+ (0, XeboTheme_1.configureTheme)(config);
98
+ }
99
+ // ─── User identity ─────────────────────────────────────────────────────────
100
+ setUser(data) {
101
+ this.userData = data;
102
+ }
103
+ clearUser() {
104
+ this.userData = null;
105
+ }
106
+ // ─── Network monitoring ────────────────────────────────────────────────────
107
+ _startNetworkMonitoring() {
108
+ if (this.netInfoUnsubscribe) {
109
+ this.netInfoUnsubscribe();
110
+ }
111
+ let wasOffline = false;
112
+ this.netInfoUnsubscribe = netinfo_1.default.addEventListener((state) => {
113
+ var _a;
114
+ const isConnected = (_a = state.isConnected) !== null && _a !== void 0 ? _a : false;
115
+ if (wasOffline && isConnected) {
116
+ console.log('[Xebo] Network restored — flushing offline queue');
117
+ this.flushQueue();
118
+ }
119
+ wasOffline = !isConnected;
120
+ });
121
+ }
122
+ // ─── Step 0: Verify API key → bearer token ────────────────────────────────
123
+ async _verifyAndGetToken() {
124
+ this.bearerToken = await (0, XeboNetworkService_1.verifyApiKey)(this.verifyURL, this.resolvedZone, this.apiKey);
125
+ }
126
+ // ─── Background pre-fetch ──────────────────────────────────────────────────
127
+ async _prefetchSurvey() {
128
+ try {
129
+ console.log('[Xebo] Pre-fetching survey in background...');
130
+ await this._verifyAndGetToken();
131
+ const collector = await (0, XeboNetworkService_1.fetchCollector)(this.baseURL, this.collectorId, this.bearerToken);
132
+ this.resolvedCollectorUUID = collector.uuid;
133
+ this.resolvedCollectorMongoId = collector.mongoId;
134
+ const survey = await (0, XeboNetworkService_1.fetchSurvey)(this.baseURL, collector.surveyId, this.bearerToken);
135
+ this.survey = survey;
136
+ this.emit(exports.XEBO_EVENTS.SURVEY_LOADED, survey);
137
+ console.log('[Xebo] Pre-fetch done —', survey.questions.length, 'questions ready');
138
+ }
139
+ catch (err) {
140
+ console.warn('[Xebo] Pre-fetch failed (will retry on fetchAndPresentSurvey):', err);
141
+ }
142
+ }
143
+ // ─── Main flow ─────────────────────────────────────────────────────────────
144
+ async fetchAndPresentSurvey() {
145
+ try {
146
+ // If already pre-fetched, show instantly
147
+ if (this.survey && this.resolvedCollectorUUID) {
148
+ console.log('[Xebo] Survey already cached — showing instantly');
149
+ this.currentAnswers = [];
150
+ this.currentQuestionIndex = 0;
151
+ this.surveyStartTime = new Date().toISOString();
152
+ this.surveyStartEpoch = Date.now();
153
+ this.questionStartEpoch = Date.now();
154
+ this.timePerQues = {};
155
+ this.backTrackCount = 0;
156
+ this.emit(exports.XEBO_EVENTS.SURVEY_LOADED, this.survey);
157
+ this._setVisible(true);
158
+ return;
159
+ }
160
+ // Not cached yet — verify + fetch now
161
+ console.log('[Xebo] Step 0: verifyApiKey');
162
+ await this._verifyAndGetToken();
163
+ console.log('[Xebo] Step 1: fetchCollector');
164
+ const collector = await (0, XeboNetworkService_1.fetchCollector)(this.baseURL, this.collectorId, this.bearerToken);
165
+ this.resolvedCollectorUUID = collector.uuid;
166
+ this.resolvedCollectorMongoId = collector.mongoId;
167
+ console.log('[Xebo] Step 2: fetchSurvey');
168
+ const survey = await (0, XeboNetworkService_1.fetchSurvey)(this.baseURL, collector.surveyId, this.bearerToken);
169
+ this.survey = survey;
170
+ this.currentAnswers = [];
171
+ this.currentQuestionIndex = 0;
172
+ this.surveyStartTime = new Date().toISOString();
173
+ this.surveyStartEpoch = Date.now();
174
+ this.questionStartEpoch = Date.now();
175
+ this.timePerQues = {};
176
+ this.backTrackCount = 0;
177
+ this.emit(exports.XEBO_EVENTS.SURVEY_LOADED, survey);
178
+ this._setVisible(true);
179
+ }
180
+ catch (err) {
181
+ console.error('[Xebo] fetchAndPresentSurvey failed:', err);
182
+ }
183
+ }
184
+ // ─── Answer recording ──────────────────────────────────────────────────────
185
+ recordAnswer(answer) {
186
+ const idx = this.currentAnswers.findIndex(a => a.questionId === answer.questionId);
187
+ if (idx >= 0) {
188
+ this.currentAnswers[idx] = answer;
189
+ }
190
+ else {
191
+ this.currentAnswers.push(answer);
192
+ }
193
+ }
194
+ // ─── Navigation ────────────────────────────────────────────────────────────
195
+ nextQuestion() {
196
+ if (!this.survey)
197
+ return;
198
+ // Record time spent on the current question before advancing
199
+ const currentQ = this.survey.questions[this.currentQuestionIndex];
200
+ if (currentQ && currentQ.id !== 'thank_you_auto') {
201
+ this.timePerQues[currentQ.id] = (Date.now() - this.questionStartEpoch) / 1000;
202
+ }
203
+ const next = this.currentQuestionIndex + 1;
204
+ if (next < this.survey.questions.length) {
205
+ this.currentQuestionIndex = next;
206
+ this.questionStartEpoch = Date.now();
207
+ this.emit(exports.XEBO_EVENTS.QUESTION_CHANGED, this.currentQuestionIndex);
208
+ // If this is the thank-you question, submit in the background
209
+ const q = this.survey.questions[this.currentQuestionIndex];
210
+ if ((q === null || q === void 0 ? void 0 : q.id) === 'thank_you_auto') {
211
+ this._submitCurrentSession();
212
+ }
213
+ }
214
+ }
215
+ // ─── Submission ────────────────────────────────────────────────────────────
216
+ _buildQualityFlags() {
217
+ const endEpoch = Date.now();
218
+ const totalMinutes = (endEpoch - this.surveyStartEpoch) / 60000;
219
+ const now = new Date();
220
+ const curTime = `${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}`;
221
+ return {
222
+ data: {
223
+ timePerQues: Object.fromEntries(Object.entries(this.timePerQues).map(([qId, secs]) => [qId, { timeOnQues: secs }])),
224
+ survey: {
225
+ totalTimeDuration: totalMinutes,
226
+ netTimeDuration: totalMinutes,
227
+ curTime,
228
+ startTime: this.surveyStartEpoch,
229
+ backTrackCount: this.backTrackCount,
230
+ },
231
+ },
232
+ straightLining: { questionList: [] },
233
+ };
234
+ }
235
+ _buildGeolocation() {
236
+ var _a, _b, _c, _d, _e, _f;
237
+ return {
238
+ type: 'point',
239
+ coordinates: [null, null],
240
+ country: (_b = (_a = this.userData) === null || _a === void 0 ? void 0 : _a.country) !== null && _b !== void 0 ? _b : null,
241
+ city: (_d = (_c = this.userData) === null || _c === void 0 ? void 0 : _c.city) !== null && _d !== void 0 ? _d : null,
242
+ region: (_f = (_e = this.userData) === null || _e === void 0 ? void 0 : _e.region) !== null && _f !== void 0 ? _f : null,
243
+ };
244
+ }
245
+ async _submitCurrentSession() {
246
+ var _a, _b, _c;
247
+ if (!this.survey)
248
+ return;
249
+ const endTime = new Date().toISOString();
250
+ try {
251
+ const result = await (0, XeboNetworkService_1.submitResponse)(this.feedbackBaseURL, this.survey.id, this.resolvedCollectorUUID, this.bearerToken, this.currentAnswers, {
252
+ userData: (_a = this.userData) !== null && _a !== void 0 ? _a : undefined,
253
+ deviceModel: this.deviceModel,
254
+ platform: react_native_1.Platform.OS,
255
+ osVersion: this.osVersion,
256
+ startTime: this.surveyStartTime,
257
+ endTime,
258
+ qualityFlags: this._buildQualityFlags(),
259
+ geolocation: this._buildGeolocation(),
260
+ deviceInfo: {
261
+ type: 'mobile',
262
+ os: react_native_1.Platform.OS === 'ios' ? 'ios' : 'android',
263
+ browser: react_native_1.Platform.OS === 'ios' ? 'safari' : 'chrome',
264
+ },
265
+ });
266
+ if (!result.ok) {
267
+ throw new Error(`HTTP ${result.status}`);
268
+ }
269
+ const respData = result.responseJson;
270
+ console.log('[Xebo] Response data:', {
271
+ responseId: (_b = respData === null || respData === void 0 ? void 0 : respData.data) === null || _b === void 0 ? void 0 : _b.responseId,
272
+ created: (_c = respData === null || respData === void 0 ? void 0 : respData.data) === null || _c === void 0 ? void 0 : _c.created,
273
+ });
274
+ }
275
+ catch (err) {
276
+ console.error('[Xebo] Submission failed — queuing offline:', err);
277
+ await this._enqueueOffline(endTime);
278
+ }
279
+ }
280
+ async _enqueueOffline(endTime) {
281
+ var _a;
282
+ if (!this.survey)
283
+ return;
284
+ const queued = {
285
+ responseId: uuidv4(),
286
+ surveyId: this.survey.id,
287
+ collectorUUID: this.resolvedCollectorUUID,
288
+ mode: 'React Native SDK',
289
+ status: 'complete',
290
+ startTime: this.surveyStartTime,
291
+ endTime,
292
+ answers: [...this.currentAnswers],
293
+ userData: (_a = this.userData) !== null && _a !== void 0 ? _a : undefined,
294
+ deviceModel: this.deviceModel,
295
+ platform: react_native_1.Platform.OS,
296
+ osVersion: this.osVersion,
297
+ qualityFlags: this._buildQualityFlags(),
298
+ geolocation: this._buildGeolocation(),
299
+ deviceInfo: {
300
+ type: 'other',
301
+ os: react_native_1.Platform.OS === 'ios' ? 'ios' : 'android',
302
+ browser: react_native_1.Platform.OS === 'ios' ? 'safari' : 'chrome',
303
+ },
304
+ };
305
+ await XeboOfflineQueue_1.XeboOfflineQueue.enqueue(queued);
306
+ }
307
+ // ─── Flush queue ───────────────────────────────────────────────────────────
308
+ async flushQueue() {
309
+ const all = await XeboOfflineQueue_1.XeboOfflineQueue.getAll();
310
+ if (all.length === 0)
311
+ return;
312
+ console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
313
+ console.log(`[Xebo Offline] Flushing ${all.length} queued response(s)`);
314
+ const failed = [];
315
+ for (const queued of all) {
316
+ try {
317
+ const result = await (0, XeboNetworkService_1.submitResponse)(this.feedbackBaseURL, queued.surveyId, queued.collectorUUID, this.bearerToken, queued.answers, {
318
+ userData: queued.userData,
319
+ deviceModel: queued.deviceModel,
320
+ platform: queued.platform,
321
+ osVersion: queued.osVersion,
322
+ startTime: queued.startTime,
323
+ endTime: queued.endTime,
324
+ qualityFlags: queued.qualityFlags,
325
+ geolocation: queued.geolocation,
326
+ deviceInfo: queued.deviceInfo,
327
+ });
328
+ if (!result.ok)
329
+ throw new Error(`HTTP ${result.status}`);
330
+ console.log('[Xebo Offline] Flushed response:', queued.responseId);
331
+ }
332
+ catch (err) {
333
+ console.error('[Xebo Offline] Retry failed for:', queued.responseId, err);
334
+ failed.push(queued);
335
+ }
336
+ }
337
+ await XeboOfflineQueue_1.XeboOfflineQueue.saveAll(failed);
338
+ console.log(`[Xebo Offline] Flush complete — ${failed.length} still pending`);
339
+ console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
340
+ }
341
+ // ─── Modal visibility ──────────────────────────────────────────────────────
342
+ _setVisible(visible) {
343
+ this.surveyVisible = visible;
344
+ this.emit(exports.XEBO_EVENTS.SURVEY_VISIBLE, visible);
345
+ }
346
+ dismissSurvey() {
347
+ this._setVisible(false);
348
+ this.emit(exports.XEBO_EVENTS.SURVEY_DISMISSED);
349
+ }
350
+ }
351
+ exports.XeboSurveyManager = new XeboSurveyManagerClass();
@@ -0,0 +1,5 @@
1
+ export { XeboSurveyManager, XEBO_EVENTS } from './core/XeboSurveyManager';
2
+ export { XeboSurveyModal } from './components/XeboSurveyModal';
3
+ export type { XeboSurvey, XeboQuestion, XeboAnswer, XeboAnswerValue, XeboQueuedResponse, XeboConfig, XeboThemeConfig, XeboChoice, XeboNPSLabels, XeboConditionalFollowUp, XeboSurveyPage, XeboUserData, } from './models/XeboModels';
4
+ export { XeboQuestionType } from './models/XeboModels';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG1E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,YAAY,EACV,UAAU,EACV,YAAY,EACZ,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,UAAU,EACV,aAAa,EACb,uBAAuB,EACvB,cAAc,EACd,YAAY,GACb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.XeboQuestionType = exports.XeboSurveyModal = exports.XEBO_EVENTS = exports.XeboSurveyManager = void 0;
4
+ // ─── Core ─────────────────────────────────────────────────────────────────────
5
+ var XeboSurveyManager_1 = require("./core/XeboSurveyManager");
6
+ Object.defineProperty(exports, "XeboSurveyManager", { enumerable: true, get: function () { return XeboSurveyManager_1.XeboSurveyManager; } });
7
+ Object.defineProperty(exports, "XEBO_EVENTS", { enumerable: true, get: function () { return XeboSurveyManager_1.XEBO_EVENTS; } });
8
+ // ─── Components ───────────────────────────────────────────────────────────────
9
+ var XeboSurveyModal_1 = require("./components/XeboSurveyModal");
10
+ Object.defineProperty(exports, "XeboSurveyModal", { enumerable: true, get: function () { return XeboSurveyModal_1.XeboSurveyModal; } });
11
+ var XeboModels_1 = require("./models/XeboModels");
12
+ Object.defineProperty(exports, "XeboQuestionType", { enumerable: true, get: function () { return XeboModels_1.XeboQuestionType; } });
@@ -0,0 +1,82 @@
1
+ export interface APICollectorResponse {
2
+ data: {
3
+ _id: string;
4
+ uuid: string;
5
+ surveyId: string;
6
+ [key: string]: unknown;
7
+ };
8
+ }
9
+ export interface APIOptionItem {
10
+ uuid: string;
11
+ text: string;
12
+ }
13
+ export interface APIConfigScale {
14
+ uuid: string;
15
+ scale: {
16
+ min: number;
17
+ max: number;
18
+ };
19
+ enabled: boolean;
20
+ qId: string[];
21
+ }
22
+ export interface APIQuestionSettings {
23
+ nps?: {
24
+ colors?: {
25
+ detractor?: string;
26
+ passive?: string;
27
+ promoter?: string;
28
+ };
29
+ leftLabel?: string;
30
+ rightLabel?: string;
31
+ };
32
+ configScale?: APIConfigScale[];
33
+ rating?: {
34
+ type?: string;
35
+ colLabel?: boolean;
36
+ color?: string;
37
+ };
38
+ }
39
+ export interface APIQuestion {
40
+ uuid: string;
41
+ title: string;
42
+ quesType: string;
43
+ helperText?: {
44
+ text?: string;
45
+ };
46
+ required?: {
47
+ enabled?: boolean;
48
+ };
49
+ options?: {
50
+ row?: APIOptionItem[];
51
+ col?: APIOptionItem[];
52
+ };
53
+ settings?: APIQuestionSettings;
54
+ placeholder?: {
55
+ text?: string;
56
+ };
57
+ }
58
+ export interface APIBlock {
59
+ questions: Array<{
60
+ question: APIQuestion;
61
+ }>;
62
+ }
63
+ export interface APISurveyData {
64
+ uuid: string;
65
+ displayTitle: string;
66
+ projectId?: string;
67
+ blocks: APIBlock[];
68
+ introPage?: {
69
+ enabled?: boolean;
70
+ content?: string;
71
+ buttonText?: string;
72
+ };
73
+ thankYouPage?: {
74
+ enabled?: boolean;
75
+ content?: string;
76
+ links?: string;
77
+ };
78
+ }
79
+ export interface APISurveyResponse {
80
+ data: APISurveyData;
81
+ }
82
+ //# sourceMappingURL=XeboAPIModels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XeboAPIModels.d.ts","sourceRoot":"","sources":["../../src/models/XeboAPIModels.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;CACH;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,EAAE,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,GAAG,CAAC,EAAE;QACJ,MAAM,CAAC,EAAE;YACP,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;SACnB,CAAC;QACF,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EA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AAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,aAAa,CAAC;CACrB"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // ─── Raw API response shapes ──────────────────────────────────────────────────
3
+ // These mirror the exact JSON returned by the Xebo backend.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,141 @@
1
+ export declare enum XeboQuestionType {
2
+ singleChoice = "singleChoice",
3
+ multipleChoice = "multipleChoice",
4
+ dropdown = "dropdown",
5
+ singleTextBox = "singleTextBox",
6
+ multipleTextBox = "multipleTextBox",
7
+ nps = "nps",
8
+ multiNps = "multiNps",
9
+ rating = "rating",
10
+ multiRating = "multiRating",
11
+ thankYou = "thankYou"
12
+ }
13
+ export interface XeboChoice {
14
+ id: string;
15
+ text: string;
16
+ value: string;
17
+ }
18
+ export interface XeboNPSLabels {
19
+ lower?: string;
20
+ upper?: string;
21
+ detractorColor?: string;
22
+ passiveColor?: string;
23
+ promoterColor?: string;
24
+ }
25
+ export interface XeboConditionalFollowUp {
26
+ minRating: number;
27
+ maxRating: number;
28
+ followUpQuestion: string;
29
+ followUpType: string;
30
+ followUpOptions: XeboChoice[];
31
+ questionId: string;
32
+ }
33
+ export interface XeboQuestion {
34
+ id: string;
35
+ type: XeboQuestionType;
36
+ title: string;
37
+ subtitle?: string;
38
+ placeholder?: string;
39
+ isRequired: boolean;
40
+ options?: XeboChoice[];
41
+ columns?: XeboChoice[];
42
+ npsLabels?: XeboNPSLabels;
43
+ followUpQuestion?: string;
44
+ conditionalFollowUps?: XeboConditionalFollowUp[];
45
+ redirectURL?: string;
46
+ ratingStyle?: string;
47
+ showColLabels?: boolean;
48
+ ratingColor?: string;
49
+ }
50
+ export interface XeboSurveyPage {
51
+ enabled: boolean;
52
+ content?: string;
53
+ buttonText?: string;
54
+ links?: string;
55
+ }
56
+ export interface XeboSurvey {
57
+ id: string;
58
+ name: string;
59
+ projectId?: string;
60
+ questions: XeboQuestion[];
61
+ introPage?: XeboSurveyPage;
62
+ thankYouPage?: XeboSurveyPage;
63
+ }
64
+ export interface XeboAnswerValue {
65
+ rowId: string;
66
+ colId?: string;
67
+ text?: string;
68
+ }
69
+ export interface XeboAnswer {
70
+ questionId: string;
71
+ value: XeboAnswerValue[];
72
+ }
73
+ export interface XeboUserData {
74
+ name?: string;
75
+ email?: string;
76
+ phone?: string;
77
+ uniqueId?: string;
78
+ country?: string;
79
+ city?: string;
80
+ region?: string;
81
+ eData?: Record<string, string>;
82
+ }
83
+ export interface XeboQualityFlags {
84
+ data: {
85
+ timePerQues: Record<string, {
86
+ timeOnQues: number;
87
+ }>;
88
+ survey: {
89
+ totalTimeDuration: number;
90
+ netTimeDuration: number;
91
+ curTime: string;
92
+ startTime: number;
93
+ backTrackCount: number;
94
+ };
95
+ };
96
+ straightLining: {
97
+ questionList: string[];
98
+ };
99
+ }
100
+ export interface XeboDeviceInfo {
101
+ type: string;
102
+ os: string;
103
+ browser: string;
104
+ }
105
+ export interface XeboGeolocation {
106
+ type: string;
107
+ coordinates: (number | null)[];
108
+ country: string | null;
109
+ city: string | null;
110
+ region: string | null;
111
+ }
112
+ export interface XeboQueuedResponse {
113
+ responseId: string;
114
+ surveyId: string;
115
+ collectorUUID: string;
116
+ mode: string;
117
+ status: 'complete' | 'incomplete';
118
+ startTime: string;
119
+ endTime: string;
120
+ answers: XeboAnswer[];
121
+ userData?: XeboUserData;
122
+ deviceModel?: string;
123
+ platform?: string;
124
+ osVersion?: string;
125
+ qualityFlags?: XeboQualityFlags;
126
+ geolocation?: XeboGeolocation;
127
+ deviceInfo?: XeboDeviceInfo;
128
+ }
129
+ export interface XeboConfig {
130
+ apiKey: string;
131
+ collectorId: string;
132
+ zone: string;
133
+ }
134
+ export interface XeboThemeConfig {
135
+ primaryColor?: string;
136
+ backgroundColor?: string;
137
+ textColor?: string;
138
+ cornerRadius?: number;
139
+ fontFamily?: string;
140
+ }
141
+ //# sourceMappingURL=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e,CAAC;IAC9B,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B;AAID,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ // ─── Enums ───────────────────────────────────────────────────────────────────
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.XeboQuestionType = void 0;
5
+ var XeboQuestionType;
6
+ (function (XeboQuestionType) {
7
+ XeboQuestionType["singleChoice"] = "singleChoice";
8
+ XeboQuestionType["multipleChoice"] = "multipleChoice";
9
+ XeboQuestionType["dropdown"] = "dropdown";
10
+ XeboQuestionType["singleTextBox"] = "singleTextBox";
11
+ XeboQuestionType["multipleTextBox"] = "multipleTextBox";
12
+ XeboQuestionType["nps"] = "nps";
13
+ XeboQuestionType["multiNps"] = "multiNps";
14
+ XeboQuestionType["rating"] = "rating";
15
+ XeboQuestionType["multiRating"] = "multiRating";
16
+ XeboQuestionType["thankYou"] = "thankYou";
17
+ })(XeboQuestionType || (exports.XeboQuestionType = XeboQuestionType = {}));
@@ -0,0 +1,11 @@
1
+ import { XeboThemeConfig } from '../models/XeboModels';
2
+ export interface XeboTheme {
3
+ primaryColor: string;
4
+ backgroundColor: string;
5
+ textColor: string;
6
+ cornerRadius: number;
7
+ fontFamily: string | undefined;
8
+ }
9
+ export declare function configureTheme(config: XeboThemeConfig): void;
10
+ export declare function getTheme(): XeboTheme;
11
+ //# sourceMappingURL=XeboTheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XeboTheme.d.ts","sourceRoot":"","sources":["../../src/theme/XeboTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAYD,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAQ5D;AAED,wBAAgB,QAAQ,IAAI,SAAS,CAEpC"}