react-native-my-survey-sdk 3.0.0 → 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,188 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.XeboMultipleChoiceView = void 0;
37
+ const react_1 = __importStar(require("react"));
38
+ const react_native_1 = require("react-native");
39
+ const XeboTheme_1 = require("../theme/XeboTheme");
40
+ const XeboMultipleChoiceView = ({ question, isLastQuestion, onAnswer }) => {
41
+ var _a;
42
+ const theme = (0, XeboTheme_1.getTheme)();
43
+ const [selectedIds, setSelectedIds] = (0, react_1.useState)(new Set());
44
+ const [error, setError] = (0, react_1.useState)('');
45
+ const shakeAnim = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
46
+ const shake = () => {
47
+ react_native_1.Animated.sequence([
48
+ react_native_1.Animated.timing(shakeAnim, { toValue: 8, duration: 60, useNativeDriver: true }),
49
+ react_native_1.Animated.timing(shakeAnim, { toValue: -8, duration: 60, useNativeDriver: true }),
50
+ react_native_1.Animated.timing(shakeAnim, { toValue: 6, duration: 60, useNativeDriver: true }),
51
+ react_native_1.Animated.timing(shakeAnim, { toValue: 0, duration: 60, useNativeDriver: true }),
52
+ ]).start();
53
+ };
54
+ const toggleChoice = (choice) => {
55
+ setSelectedIds(prev => {
56
+ const next = new Set(prev);
57
+ if (next.has(choice.id)) {
58
+ next.delete(choice.id);
59
+ }
60
+ else {
61
+ next.add(choice.id);
62
+ }
63
+ return next;
64
+ });
65
+ setError('');
66
+ };
67
+ const handleNext = () => {
68
+ if (question.isRequired && selectedIds.size === 0) {
69
+ setError('Please select at least one option.');
70
+ shake();
71
+ return;
72
+ }
73
+ onAnswer({
74
+ questionId: question.id,
75
+ value: Array.from(selectedIds).map(id => {
76
+ var _a, _b;
77
+ return ({
78
+ rowId: id,
79
+ text: (_b = (_a = question.options) === null || _a === void 0 ? void 0 : _a.find((o) => o.id === id)) === null || _b === void 0 ? void 0 : _b.text,
80
+ });
81
+ }),
82
+ });
83
+ };
84
+ return (<react_native_1.View style={styles.container}>
85
+ <react_native_1.Text style={[styles.title, { color: theme.textColor, fontFamily: theme.fontFamily }]}>
86
+ {question.title}
87
+ </react_native_1.Text>
88
+ {!!question.subtitle && (<react_native_1.Text style={[styles.subtitle, { color: theme.textColor, fontFamily: theme.fontFamily }]}>
89
+ {question.subtitle}
90
+ </react_native_1.Text>)}
91
+
92
+ <react_native_1.ScrollView style={styles.optionsList} showsVerticalScrollIndicator={false}>
93
+ {((_a = question.options) !== null && _a !== void 0 ? _a : []).map((choice) => {
94
+ const selected = selectedIds.has(choice.id);
95
+ return (<react_native_1.TouchableOpacity key={choice.id} style={[
96
+ styles.optionRow,
97
+ { borderColor: selected ? theme.primaryColor : '#E5E7EB' },
98
+ ]} onPress={() => toggleChoice(choice)} activeOpacity={0.7}>
99
+ <react_native_1.View style={[
100
+ styles.checkbox,
101
+ {
102
+ borderColor: selected ? theme.primaryColor : '#9CA3AF',
103
+ backgroundColor: selected ? theme.primaryColor : 'transparent',
104
+ },
105
+ ]}>
106
+ {selected && <react_native_1.Text style={styles.checkmark}>✓</react_native_1.Text>}
107
+ </react_native_1.View>
108
+ <react_native_1.Text style={[styles.optionText, { color: theme.textColor, fontFamily: theme.fontFamily }]}>
109
+ {choice.text}
110
+ </react_native_1.Text>
111
+ </react_native_1.TouchableOpacity>);
112
+ })}
113
+ </react_native_1.ScrollView>
114
+
115
+ {!!error && <react_native_1.Text style={styles.errorText}>{error}</react_native_1.Text>}
116
+
117
+ <react_native_1.Animated.View style={{ transform: [{ translateX: shakeAnim }] }}>
118
+ <react_native_1.TouchableOpacity style={[styles.button, { backgroundColor: theme.primaryColor, borderRadius: theme.cornerRadius }]} onPress={handleNext} activeOpacity={0.8}>
119
+ <react_native_1.Text style={[styles.buttonText, { fontFamily: theme.fontFamily }]}>
120
+ {isLastQuestion ? 'Submit' : 'Next'}
121
+ </react_native_1.Text>
122
+ </react_native_1.TouchableOpacity>
123
+ </react_native_1.Animated.View>
124
+ </react_native_1.View>);
125
+ };
126
+ exports.XeboMultipleChoiceView = XeboMultipleChoiceView;
127
+ const styles = react_native_1.StyleSheet.create({
128
+ container: {
129
+ paddingHorizontal: 20,
130
+ paddingTop: 16,
131
+ paddingBottom: 24,
132
+ },
133
+ title: {
134
+ fontSize: 18,
135
+ fontWeight: '700',
136
+ marginBottom: 16,
137
+ },
138
+ subtitle: {
139
+ fontSize: 14,
140
+ opacity: 0.6,
141
+ marginBottom: 16,
142
+ },
143
+ optionsList: {
144
+ maxHeight: 280,
145
+ marginBottom: 12,
146
+ },
147
+ optionRow: {
148
+ flexDirection: 'row',
149
+ alignItems: 'center',
150
+ borderWidth: 1.5,
151
+ borderRadius: 10,
152
+ padding: 14,
153
+ marginBottom: 10,
154
+ },
155
+ checkbox: {
156
+ width: 20,
157
+ height: 20,
158
+ borderRadius: 4,
159
+ borderWidth: 2,
160
+ alignItems: 'center',
161
+ justifyContent: 'center',
162
+ marginRight: 12,
163
+ },
164
+ checkmark: {
165
+ color: '#FFFFFF',
166
+ fontSize: 13,
167
+ fontWeight: '700',
168
+ },
169
+ optionText: {
170
+ fontSize: 15,
171
+ flex: 1,
172
+ },
173
+ errorText: {
174
+ color: '#EF4444',
175
+ fontSize: 13,
176
+ marginBottom: 8,
177
+ },
178
+ button: {
179
+ paddingVertical: 14,
180
+ alignItems: 'center',
181
+ marginTop: 4,
182
+ },
183
+ buttonText: {
184
+ color: '#FFFFFF',
185
+ fontSize: 16,
186
+ fontWeight: '600',
187
+ },
188
+ });
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { XeboQuestion, XeboAnswer } from '../models/XeboModels';
3
+ interface Props {
4
+ question: XeboQuestion;
5
+ isLastQuestion: boolean;
6
+ onAnswer: (answer: XeboAnswer | XeboAnswer[]) => void;
7
+ }
8
+ export declare const XeboNPSView: React.FC<Props>;
9
+ export {};
10
+ //# sourceMappingURL=XeboNPSView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XeboNPSView.d.ts","sourceRoot":"","sources":["../../src/components/XeboNPSView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAWhD,OAAO,EAAE,YAAY,EAAE,UAAU,EAA6C,MAAM,sBAAsB,CAAC;AAG3G,UAAU,KAAK;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,EAAE,KAAK,IAAI,CAAC;CACvD;AAuBD,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAsNvC,CAAC"}
@@ -0,0 +1,269 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.XeboNPSView = void 0;
37
+ const react_1 = __importStar(require("react"));
38
+ const react_native_1 = require("react-native");
39
+ const XeboModels_1 = require("../models/XeboModels");
40
+ const XeboTheme_1 = require("../theme/XeboTheme");
41
+ // NPS zone colors — matches iOS SDK defaults
42
+ const DETRACTOR_COLOR = '#F24236';
43
+ const PASSIVE_COLOR = '#FFC208';
44
+ const PROMOTER_COLOR = '#2ECC70';
45
+ function npsColor(score, npsLabels) {
46
+ var _a, _b, _c;
47
+ if (score <= 6)
48
+ return (_a = npsLabels === null || npsLabels === void 0 ? void 0 : npsLabels.detractorColor) !== null && _a !== void 0 ? _a : DETRACTOR_COLOR;
49
+ if (score <= 8)
50
+ return (_b = npsLabels === null || npsLabels === void 0 ? void 0 : npsLabels.passiveColor) !== null && _b !== void 0 ? _b : PASSIVE_COLOR;
51
+ return (_c = npsLabels === null || npsLabels === void 0 ? void 0 : npsLabels.promoterColor) !== null && _c !== void 0 ? _c : PROMOTER_COLOR;
52
+ }
53
+ /** Returns true if the hex color is perceived as dark (use white text on top) */
54
+ function isColorDark(hex) {
55
+ const m = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
56
+ if (!m)
57
+ return false;
58
+ const r = parseInt(m[1], 16) / 255;
59
+ const g = parseInt(m[2], 16) / 255;
60
+ const b = parseInt(m[3], 16) / 255;
61
+ return 0.299 * r + 0.587 * g + 0.114 * b < 0.5;
62
+ }
63
+ const XeboNPSView = ({ question, isLastQuestion, onAnswer }) => {
64
+ var _a, _b, _c, _d, _e, _f, _g;
65
+ const theme = (0, XeboTheme_1.getTheme)();
66
+ const [selectedScore, setSelectedScore] = (0, react_1.useState)(null);
67
+ const [followUpText, setFollowUpText] = (0, react_1.useState)('');
68
+ const [followUpChoice, setFollowUpChoice] = (0, react_1.useState)(null);
69
+ const [error, setError] = (0, react_1.useState)('');
70
+ const shakeAnim = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
71
+ const scaleAnim = (0, react_1.useRef)(Array.from({ length: 11 }, () => new react_native_1.Animated.Value(1))).current;
72
+ const shake = () => {
73
+ react_native_1.Animated.sequence([
74
+ react_native_1.Animated.timing(shakeAnim, { toValue: 8, duration: 60, useNativeDriver: true }),
75
+ react_native_1.Animated.timing(shakeAnim, { toValue: -8, duration: 60, useNativeDriver: true }),
76
+ react_native_1.Animated.timing(shakeAnim, { toValue: 6, duration: 60, useNativeDriver: true }),
77
+ react_native_1.Animated.timing(shakeAnim, { toValue: 0, duration: 60, useNativeDriver: true }),
78
+ ]).start();
79
+ };
80
+ const handleScorePress = (score) => {
81
+ setSelectedScore(score);
82
+ setError('');
83
+ setFollowUpText('');
84
+ setFollowUpChoice(null);
85
+ react_native_1.Animated.spring(scaleAnim[score], { toValue: 1.15, useNativeDriver: true }).start(() => {
86
+ react_native_1.Animated.spring(scaleAnim[score], { toValue: 1, useNativeDriver: true }).start();
87
+ });
88
+ };
89
+ // Find applicable conditional follow-up
90
+ const activeFollowUp = selectedScore !== null
91
+ ? ((_a = question.conditionalFollowUps) !== null && _a !== void 0 ? _a : []).find(f => selectedScore >= f.minRating && selectedScore <= f.maxRating)
92
+ : undefined;
93
+ const hasTextFollowUp = !!question.followUpQuestion && !activeFollowUp;
94
+ const handleNext = () => {
95
+ var _a, _b, _c, _d, _e, _f, _g;
96
+ if (question.isRequired && selectedScore === null) {
97
+ setError('Please select a score.');
98
+ shake();
99
+ return;
100
+ }
101
+ react_native_1.Keyboard.dismiss();
102
+ const score = selectedScore !== null && selectedScore !== void 0 ? selectedScore : 0;
103
+ const colId = (_c = (_b = (_a = question.columns) === null || _a === void 0 ? void 0 : _a[score]) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : score.toString();
104
+ const rowId = (_f = (_e = (_d = question.options) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.id) !== null && _f !== void 0 ? _f : score.toString();
105
+ // NPS Pro: conditional follow-up has its own questionId — submit as a separate answer entry
106
+ if (activeFollowUp) {
107
+ const answers = [
108
+ { questionId: question.id, value: [{ rowId, colId }] },
109
+ ];
110
+ if (followUpChoice) {
111
+ const selectedOption = activeFollowUp.followUpOptions.find(o => o.id === followUpChoice);
112
+ answers.push({
113
+ questionId: activeFollowUp.questionId,
114
+ value: [{ rowId: followUpChoice, text: (_g = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.text) !== null && _g !== void 0 ? _g : '' }],
115
+ });
116
+ }
117
+ else if (followUpText.trim()) {
118
+ answers.push({
119
+ questionId: activeFollowUp.questionId,
120
+ value: [{ rowId: activeFollowUp.questionId, text: followUpText }],
121
+ });
122
+ }
123
+ onAnswer(answers);
124
+ return;
125
+ }
126
+ // Simple text follow-up
127
+ onAnswer({
128
+ questionId: question.id,
129
+ value: [{ rowId, colId, text: hasTextFollowUp ? followUpText : undefined }],
130
+ });
131
+ };
132
+ return (
133
+ // Outer view fills modal content area; button pinned at bottom outside ScrollView
134
+ <react_native_1.View style={styles.outer}>
135
+ <react_native_1.ScrollView style={styles.scroll} contentContainerStyle={styles.scrollContent} showsVerticalScrollIndicator={false} keyboardShouldPersistTaps="handled">
136
+ <react_native_1.Text style={[styles.title, { color: theme.textColor, fontFamily: theme.fontFamily }]}>
137
+ {question.title}
138
+ </react_native_1.Text>
139
+ {!!question.subtitle && (<react_native_1.Text style={[styles.subtitle, { color: theme.textColor, fontFamily: theme.fontFamily }]}>
140
+ {question.subtitle}
141
+ </react_native_1.Text>)}
142
+
143
+ {/* NPS Scale — single row, always-visible category colors */}
144
+ <react_native_1.View style={styles.scaleRow}>
145
+ {Array.from({ length: 11 }, (_, i) => {
146
+ const selected = selectedScore === i;
147
+ const color = npsColor(i, question.npsLabels);
148
+ return (<react_native_1.Animated.View key={i} style={[styles.scoreCell, { transform: [{ scale: scaleAnim[i] }] }]}>
149
+ <react_native_1.TouchableOpacity style={[
150
+ styles.scoreButton,
151
+ {
152
+ backgroundColor: color,
153
+ borderColor: selected ? '#000000' : color,
154
+ borderWidth: selected ? 2.5 : 1.5,
155
+ },
156
+ ]} onPress={() => handleScorePress(i)} activeOpacity={0.8}>
157
+ <react_native_1.Text style={[
158
+ styles.scoreText,
159
+ { color: isColorDark(color) ? '#FFFFFF' : selected ? '#111111' : '#444444' },
160
+ ]}>
161
+ {i}
162
+ </react_native_1.Text>
163
+ </react_native_1.TouchableOpacity>
164
+ </react_native_1.Animated.View>);
165
+ })}
166
+ </react_native_1.View>
167
+
168
+ {/* Lower / Upper labels */}
169
+ {(((_b = question.npsLabels) === null || _b === void 0 ? void 0 : _b.lower) || ((_c = question.npsLabels) === null || _c === void 0 ? void 0 : _c.upper)) && (<react_native_1.View style={styles.labelsRow}>
170
+ <react_native_1.Text style={[styles.label, { color: theme.textColor, fontFamily: theme.fontFamily }]}>
171
+ {(_e = (_d = question.npsLabels) === null || _d === void 0 ? void 0 : _d.lower) !== null && _e !== void 0 ? _e : ''}
172
+ </react_native_1.Text>
173
+ <react_native_1.Text style={[styles.label, { color: theme.textColor, fontFamily: theme.fontFamily }]}>
174
+ {(_g = (_f = question.npsLabels) === null || _f === void 0 ? void 0 : _f.upper) !== null && _g !== void 0 ? _g : ''}
175
+ </react_native_1.Text>
176
+ </react_native_1.View>)}
177
+
178
+ {/* Conditional follow-up (NPS Pro) */}
179
+ {selectedScore !== null && activeFollowUp && (<react_native_1.View style={[styles.followUpCard, { borderColor: '#E5E7EB', borderRadius: theme.cornerRadius }]}>
180
+ <react_native_1.Text style={[styles.followUpTitle, { color: theme.textColor, fontFamily: theme.fontFamily }]}>
181
+ {activeFollowUp.followUpQuestion}
182
+ </react_native_1.Text>
183
+ {activeFollowUp.followUpType === XeboModels_1.XeboQuestionType.singleChoice && activeFollowUp.followUpOptions.length > 0 ? (activeFollowUp.followUpOptions.map(opt => (<react_native_1.TouchableOpacity key={opt.id} style={[
184
+ styles.followUpOption,
185
+ followUpChoice === opt.id && { borderColor: theme.primaryColor },
186
+ ]} onPress={() => setFollowUpChoice(opt.id)} activeOpacity={0.7}>
187
+ <react_native_1.Text style={[styles.followUpOptionText, { color: theme.textColor }]}>{opt.text}</react_native_1.Text>
188
+ </react_native_1.TouchableOpacity>))) : (<react_native_1.TextInput style={[styles.followUpInput, { borderColor: '#E5E7EB', color: theme.textColor, borderRadius: theme.cornerRadius }]} placeholder="Your comment..." placeholderTextColor="#9CA3AF" value={followUpText} onChangeText={setFollowUpText} multiline numberOfLines={3} textAlignVertical="top"/>)}
189
+ </react_native_1.View>)}
190
+
191
+ {/* Simple text follow-up */}
192
+ {selectedScore !== null && hasTextFollowUp && (<react_native_1.View style={[styles.followUpCard, { borderColor: '#E5E7EB', borderRadius: theme.cornerRadius }]}>
193
+ <react_native_1.Text style={[styles.followUpTitle, { color: theme.textColor, fontFamily: theme.fontFamily }]}>
194
+ {question.followUpQuestion}
195
+ </react_native_1.Text>
196
+ <react_native_1.TextInput style={[styles.followUpInput, { borderColor: '#E5E7EB', color: theme.textColor, borderRadius: theme.cornerRadius }]} placeholder="Your comment..." placeholderTextColor="#9CA3AF" value={followUpText} onChangeText={setFollowUpText} multiline numberOfLines={3} textAlignVertical="top"/>
197
+ </react_native_1.View>)}
198
+ </react_native_1.ScrollView>
199
+
200
+ {/* Error + button always visible at bottom, outside scroll */}
201
+ {!!error && <react_native_1.Text style={styles.errorText}>{error}</react_native_1.Text>}
202
+ <react_native_1.Animated.View style={{ transform: [{ translateX: shakeAnim }] }}>
203
+ <react_native_1.TouchableOpacity style={[styles.button, { backgroundColor: theme.primaryColor, borderRadius: theme.cornerRadius, opacity: selectedScore === null ? 0.4 : 1 }]} onPress={handleNext} disabled={selectedScore === null} activeOpacity={0.8}>
204
+ <react_native_1.Text style={[styles.buttonText, { fontFamily: theme.fontFamily }]}>
205
+ {isLastQuestion ? 'Submit' : 'Next'}
206
+ </react_native_1.Text>
207
+ </react_native_1.TouchableOpacity>
208
+ </react_native_1.Animated.View>
209
+ </react_native_1.View>);
210
+ };
211
+ exports.XeboNPSView = XeboNPSView;
212
+ const styles = react_native_1.StyleSheet.create({
213
+ outer: {
214
+ flex: 1,
215
+ paddingHorizontal: 20,
216
+ paddingBottom: 16,
217
+ },
218
+ scroll: { flex: 1, minHeight: 0 },
219
+ scrollContent: {
220
+ paddingTop: 16,
221
+ paddingBottom: 8,
222
+ },
223
+ title: { fontSize: 18, fontWeight: '700', marginBottom: 6 },
224
+ subtitle: { fontSize: 14, opacity: 0.6, marginBottom: 16 },
225
+ scaleRow: {
226
+ flexDirection: 'row',
227
+ gap: 3,
228
+ marginBottom: 8,
229
+ },
230
+ scoreCell: {
231
+ flex: 1,
232
+ },
233
+ scoreButton: {
234
+ height: 44,
235
+ borderRadius: 6,
236
+ alignItems: 'center',
237
+ justifyContent: 'center',
238
+ },
239
+ scoreText: { fontSize: 13, fontWeight: '700' },
240
+ labelsRow: {
241
+ flexDirection: 'row',
242
+ justifyContent: 'space-between',
243
+ marginBottom: 16,
244
+ },
245
+ label: { fontSize: 12, opacity: 0.6 },
246
+ followUpCard: {
247
+ borderWidth: 1.5,
248
+ padding: 14,
249
+ marginBottom: 16,
250
+ },
251
+ followUpTitle: { fontSize: 15, fontWeight: '600', marginBottom: 12 },
252
+ followUpOption: {
253
+ borderWidth: 1.5,
254
+ borderColor: '#E5E7EB',
255
+ borderRadius: 8,
256
+ padding: 10,
257
+ marginBottom: 8,
258
+ },
259
+ followUpOptionText: { fontSize: 14 },
260
+ followUpInput: {
261
+ borderWidth: 1.5,
262
+ padding: 10,
263
+ fontSize: 14,
264
+ minHeight: 80,
265
+ },
266
+ errorText: { color: '#EF4444', fontSize: 13, marginBottom: 8 },
267
+ button: { paddingVertical: 14, alignItems: 'center', marginTop: 8 },
268
+ buttonText: { color: '#FFFFFF', fontSize: 16, fontWeight: '600' },
269
+ });
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { XeboQuestion, XeboAnswer } from '../models/XeboModels';
3
+ interface Props {
4
+ question: XeboQuestion;
5
+ isLastQuestion: boolean;
6
+ onAnswer: (answer: XeboAnswer) => void;
7
+ }
8
+ export declare const XeboRatingView: React.FC<Props>;
9
+ export {};
10
+ //# sourceMappingURL=XeboRatingView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XeboRatingView.d.ts","sourceRoot":"","sources":["../../src/components/XeboRatingView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAWhD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGhE,UAAU,KAAK;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;CACxC;AA6HD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA0I1C,CAAC"}