@sensefolks/fastpoll 0.1.0
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/CHANGELOG.md +24 -0
- package/LICENSE +21 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js +8 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js.map +1 -0
- package/dist/cjs/index-CC5IS5t8.js +1437 -0
- package/dist/cjs/index-CC5IS5t8.js.map +1 -0
- package/dist/cjs/index-D8TNlmQq.js +201 -0
- package/dist/cjs/index-D8TNlmQq.js.map +1 -0
- package/dist/cjs/index.cjs.js +11 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +16 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/sf-fastpoll.cjs.entry.js +395 -0
- package/dist/cjs/sf-fastpoll.cjs.entry.js.map +1 -0
- package/dist/cjs/sf-fastpoll.cjs.js +28 -0
- package/dist/cjs/sf-fastpoll.cjs.js.map +1 -0
- package/dist/cjs/sf-fastpoll.entry.cjs.js.map +1 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/sf-fastpoll/sf-fastpoll.css +76 -0
- package/dist/collection/components/sf-fastpoll/sf-fastpoll.js +454 -0
- package/dist/collection/components/sf-fastpoll/sf-fastpoll.js.map +1 -0
- package/dist/collection/index.js +11 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/utils/utils.js +189 -0
- package/dist/collection/utils/utils.js.map +1 -0
- package/dist/components/index.d.ts +33 -0
- package/dist/components/index.js +1427 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/sf-fastpoll.d.ts +11 -0
- package/dist/components/sf-fastpoll.js +425 -0
- package/dist/components/sf-fastpoll.js.map +1 -0
- package/dist/esm/app-globals-DQuL1Twl.js +6 -0
- package/dist/esm/app-globals-DQuL1Twl.js.map +1 -0
- package/dist/esm/index-CfdIRf0W.js +193 -0
- package/dist/esm/index-CfdIRf0W.js.map +1 -0
- package/dist/esm/index-XYfqntZe.js +1428 -0
- package/dist/esm/index-XYfqntZe.js.map +1 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +14 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/sf-fastpoll.entry.js +393 -0
- package/dist/esm/sf-fastpoll.entry.js.map +1 -0
- package/dist/esm/sf-fastpoll.js +24 -0
- package/dist/esm/sf-fastpoll.js.map +1 -0
- package/dist/esm-es5/app-globals-DQuL1Twl.js +2 -0
- package/dist/esm-es5/app-globals-DQuL1Twl.js.map +1 -0
- package/dist/esm-es5/index-CfdIRf0W.js +2 -0
- package/dist/esm-es5/index-CfdIRf0W.js.map +1 -0
- package/dist/esm-es5/index-XYfqntZe.js +3 -0
- package/dist/esm-es5/index-XYfqntZe.js.map +1 -0
- package/dist/esm-es5/index.js +2 -0
- package/dist/esm-es5/index.js.map +1 -0
- package/dist/esm-es5/loader.js +2 -0
- package/dist/esm-es5/loader.js.map +1 -0
- package/dist/esm-es5/sf-fastpoll.entry.js +2 -0
- package/dist/esm-es5/sf-fastpoll.entry.js.map +1 -0
- package/dist/esm-es5/sf-fastpoll.js +2 -0
- package/dist/esm-es5/sf-fastpoll.js.map +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/sf-fastpoll/index.esm.js +2 -0
- package/dist/sf-fastpoll/index.esm.js.map +1 -0
- package/dist/sf-fastpoll/loader.esm.js.map +1 -0
- package/dist/sf-fastpoll/p-1f6dca2a.system.entry.js +2 -0
- package/dist/sf-fastpoll/p-1f6dca2a.system.entry.js.map +1 -0
- package/dist/sf-fastpoll/p-4648bca3.entry.js +2 -0
- package/dist/sf-fastpoll/p-4648bca3.entry.js.map +1 -0
- package/dist/sf-fastpoll/p-BbPAtVJG.system.js +2 -0
- package/dist/sf-fastpoll/p-BbPAtVJG.system.js.map +1 -0
- package/dist/sf-fastpoll/p-C7EMppj8.system.js.map +1 -0
- package/dist/sf-fastpoll/p-C9ESvisV.system.js +3 -0
- package/dist/sf-fastpoll/p-C9ESvisV.system.js.map +1 -0
- package/dist/sf-fastpoll/p-CfdIRf0W.js +2 -0
- package/dist/sf-fastpoll/p-CfdIRf0W.js.map +1 -0
- package/dist/sf-fastpoll/p-CpmSDeqe.system.js +2 -0
- package/dist/sf-fastpoll/p-CpmSDeqe.system.js.map +1 -0
- package/dist/sf-fastpoll/p-DQuL1Twl.js +2 -0
- package/dist/sf-fastpoll/p-DQuL1Twl.js.map +1 -0
- package/dist/sf-fastpoll/p-JC66e5NR.system.js.map +1 -0
- package/dist/sf-fastpoll/p-S-cJYJS7.system.js +2 -0
- package/dist/sf-fastpoll/p-S-cJYJS7.system.js.map +1 -0
- package/dist/sf-fastpoll/p-XYfqntZe.js +3 -0
- package/dist/sf-fastpoll/p-XYfqntZe.js.map +1 -0
- package/dist/sf-fastpoll/p-zRZYYxiz.system.js +2 -0
- package/dist/sf-fastpoll/p-zRZYYxiz.system.js.map +1 -0
- package/dist/sf-fastpoll/sf-fastpoll.entry.esm.js.map +1 -0
- package/dist/sf-fastpoll/sf-fastpoll.esm.js +2 -0
- package/dist/sf-fastpoll/sf-fastpoll.esm.js.map +1 -0
- package/dist/sf-fastpoll/sf-fastpoll.js +127 -0
- package/dist/types/components/sf-fastpoll/sf-fastpoll.d.ts +77 -0
- package/dist/types/components.d.ts +47 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/stencil-public-runtime.d.ts +1709 -0
- package/dist/types/utils/utils.d.ts +86 -0
- package/loader/cdn.js +2 -0
- package/loader/index.cjs.js +2 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +2 -0
- package/loader/index.js +3 -0
- package/package.json +86 -0
- package/readme.md +239 -0
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
import { Host, h, Env } from "@stencil/core";
|
|
2
|
+
import { isValidKey, getFieldConfig, addToCommaSeparatedList, removeFromCommaSeparatedList, sanitizeByType, sanitizeInput } from "../../utils/utils";
|
|
3
|
+
const SURVEY_API_ENDPOINT = Env.SURVEY_API_ENDPOINT;
|
|
4
|
+
const RESPONSE_API_ENDPOINT = Env.RESPONSE_API_ENDPOINT;
|
|
5
|
+
var SurveyStep;
|
|
6
|
+
(function (SurveyStep) {
|
|
7
|
+
SurveyStep[SurveyStep["POLL"] = 0] = "POLL";
|
|
8
|
+
SurveyStep[SurveyStep["FOLLOW_UP"] = 1] = "FOLLOW_UP";
|
|
9
|
+
SurveyStep[SurveyStep["RESPONDENT_DETAILS"] = 2] = "RESPONDENT_DETAILS";
|
|
10
|
+
SurveyStep[SurveyStep["COMPLETION"] = 3] = "COMPLETION";
|
|
11
|
+
})(SurveyStep || (SurveyStep = {}));
|
|
12
|
+
export class SfFastpoll {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.completionMessage = 'Thank you for your response!';
|
|
15
|
+
this.config = null;
|
|
16
|
+
this.respondentDetails = [];
|
|
17
|
+
this.loading = false;
|
|
18
|
+
this.error = null;
|
|
19
|
+
this.currentStep = SurveyStep.POLL;
|
|
20
|
+
this.selectedChoices = [];
|
|
21
|
+
this.selectedFollowUpChoices = [];
|
|
22
|
+
this.userRespondentDetails = {};
|
|
23
|
+
this.submitted = false;
|
|
24
|
+
this.announceMessage = '';
|
|
25
|
+
this.formErrors = {};
|
|
26
|
+
this.surveyStartTime = 0;
|
|
27
|
+
}
|
|
28
|
+
componentWillLoad() {
|
|
29
|
+
if (isValidKey(this.surveyKey)) {
|
|
30
|
+
return this.fetchSurveyData();
|
|
31
|
+
}
|
|
32
|
+
return Promise.resolve();
|
|
33
|
+
}
|
|
34
|
+
async fetchSurveyData() {
|
|
35
|
+
this.loading = true;
|
|
36
|
+
this.error = null;
|
|
37
|
+
this.surveyStartTime = Date.now();
|
|
38
|
+
try {
|
|
39
|
+
const response = await fetch(`${SURVEY_API_ENDPOINT}/${this.surveyKey}`);
|
|
40
|
+
const data = await response.json();
|
|
41
|
+
if (!data.success) {
|
|
42
|
+
throw new Error(data.message);
|
|
43
|
+
}
|
|
44
|
+
this.config = data.payload.config;
|
|
45
|
+
this.respondentDetails = data.payload.respondentDetails || [];
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
this.error = error instanceof Error ? error.message : String(error);
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
this.loading = false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async retryOperation() {
|
|
55
|
+
if (this.config) {
|
|
56
|
+
// If we have config, retry submission
|
|
57
|
+
await this.submitResponse();
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
// Otherwise, retry fetching survey data
|
|
61
|
+
await this.fetchSurveyData();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async submitResponse() {
|
|
65
|
+
if (!this.config || this.submitted) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
this.loading = true;
|
|
69
|
+
this.error = null;
|
|
70
|
+
try {
|
|
71
|
+
const completionTimeSeconds = this.surveyStartTime > 0 ? Math.round((Date.now() - this.surveyStartTime) / 1000) : 0;
|
|
72
|
+
const userAgentInfo = this.getUserAgentInfo();
|
|
73
|
+
const submissionData = {
|
|
74
|
+
surveyPublicKey: this.surveyKey,
|
|
75
|
+
responseData: {
|
|
76
|
+
selectedChoices: this.selectedChoices,
|
|
77
|
+
selectedFollowUpChoices: this.selectedFollowUpChoices,
|
|
78
|
+
},
|
|
79
|
+
respondentDetails: this.userRespondentDetails,
|
|
80
|
+
userAgent: userAgentInfo,
|
|
81
|
+
completionTime: completionTimeSeconds,
|
|
82
|
+
surveyType: 'fastPoll',
|
|
83
|
+
};
|
|
84
|
+
const response = await fetch(`${RESPONSE_API_ENDPOINT}`, {
|
|
85
|
+
method: 'POST',
|
|
86
|
+
headers: {
|
|
87
|
+
'Content-Type': 'application/json',
|
|
88
|
+
},
|
|
89
|
+
body: JSON.stringify(submissionData),
|
|
90
|
+
});
|
|
91
|
+
const result = await response.json();
|
|
92
|
+
if (!result.success) {
|
|
93
|
+
throw new Error(result.message);
|
|
94
|
+
}
|
|
95
|
+
this.submitted = true;
|
|
96
|
+
this.currentStep = SurveyStep.COMPLETION;
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
this.error = error instanceof Error ? error.message : String(error);
|
|
100
|
+
}
|
|
101
|
+
finally {
|
|
102
|
+
this.loading = false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
getUserAgentInfo() {
|
|
106
|
+
// Use modern navigator.userAgentData when available, fallback to userAgent parsing
|
|
107
|
+
const getPlatform = () => {
|
|
108
|
+
var _a;
|
|
109
|
+
if ('userAgentData' in navigator && ((_a = navigator.userAgentData) === null || _a === void 0 ? void 0 : _a.platform)) {
|
|
110
|
+
return navigator.userAgentData.platform;
|
|
111
|
+
}
|
|
112
|
+
// Fallback: extract platform info from userAgent
|
|
113
|
+
const ua = navigator.userAgent;
|
|
114
|
+
if (ua.includes('Win'))
|
|
115
|
+
return 'Windows';
|
|
116
|
+
if (ua.includes('Mac'))
|
|
117
|
+
return 'macOS';
|
|
118
|
+
if (ua.includes('Linux'))
|
|
119
|
+
return 'Linux';
|
|
120
|
+
if (ua.includes('Android'))
|
|
121
|
+
return 'Android';
|
|
122
|
+
if (ua.includes('iOS'))
|
|
123
|
+
return 'iOS';
|
|
124
|
+
return 'Unknown';
|
|
125
|
+
};
|
|
126
|
+
return {
|
|
127
|
+
userAgent: navigator.userAgent,
|
|
128
|
+
language: navigator.language,
|
|
129
|
+
platform: getPlatform(),
|
|
130
|
+
cookieEnabled: navigator.cookieEnabled,
|
|
131
|
+
onLine: navigator.onLine,
|
|
132
|
+
screenResolution: `${screen.width}x${screen.height}`,
|
|
133
|
+
colorDepth: screen.colorDepth,
|
|
134
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
135
|
+
timestamp: new Date().toISOString(),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
nextStep() {
|
|
139
|
+
if (!this.validateForm()) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (this.currentStep === SurveyStep.POLL) {
|
|
143
|
+
if (this.hasFollowUpStep()) {
|
|
144
|
+
this.currentStep = SurveyStep.FOLLOW_UP;
|
|
145
|
+
this.announceToScreenReader('Moving to follow-up question');
|
|
146
|
+
}
|
|
147
|
+
else if (this.hasRespondentDetailsStep()) {
|
|
148
|
+
this.currentStep = SurveyStep.RESPONDENT_DETAILS;
|
|
149
|
+
this.announceToScreenReader('Moving to respondent details');
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
this.announceToScreenReader('Submitting poll...');
|
|
153
|
+
this.submitResponse();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
else if (this.currentStep === SurveyStep.FOLLOW_UP) {
|
|
157
|
+
if (this.hasRespondentDetailsStep()) {
|
|
158
|
+
this.currentStep = SurveyStep.RESPONDENT_DETAILS;
|
|
159
|
+
this.announceToScreenReader('Moving to respondent details');
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
this.announceToScreenReader('Submitting poll...');
|
|
163
|
+
this.submitResponse();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
else if (this.currentStep === SurveyStep.RESPONDENT_DETAILS) {
|
|
167
|
+
this.announceToScreenReader('Submitting poll...');
|
|
168
|
+
this.submitResponse();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
prevStep() {
|
|
172
|
+
if (this.currentStep === SurveyStep.FOLLOW_UP) {
|
|
173
|
+
this.currentStep = SurveyStep.POLL;
|
|
174
|
+
}
|
|
175
|
+
else if (this.currentStep === SurveyStep.RESPONDENT_DETAILS) {
|
|
176
|
+
if (this.hasFollowUpStep()) {
|
|
177
|
+
this.currentStep = SurveyStep.FOLLOW_UP;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
this.currentStep = SurveyStep.POLL;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
hasFollowUpStep() {
|
|
185
|
+
var _a, _b, _c;
|
|
186
|
+
return !!(((_a = this.config) === null || _a === void 0 ? void 0 : _a.followUpQuestion) && ((_c = (_b = this.config) === null || _b === void 0 ? void 0 : _b.followUpChoices) === null || _c === void 0 ? void 0 : _c.length));
|
|
187
|
+
}
|
|
188
|
+
hasRespondentDetailsStep() {
|
|
189
|
+
return this.respondentDetails.length > 0;
|
|
190
|
+
}
|
|
191
|
+
announceToScreenReader(message) {
|
|
192
|
+
this.announceMessage = message;
|
|
193
|
+
setTimeout(() => {
|
|
194
|
+
this.announceMessage = '';
|
|
195
|
+
}, 1000);
|
|
196
|
+
}
|
|
197
|
+
isValidEmail(email) {
|
|
198
|
+
// Basic email validation regex
|
|
199
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
200
|
+
return emailRegex.test(email.trim());
|
|
201
|
+
}
|
|
202
|
+
validateRespondentField(detail, value) {
|
|
203
|
+
if (detail.required !== false && (!value || value.trim().length === 0)) {
|
|
204
|
+
return 'This field is required';
|
|
205
|
+
}
|
|
206
|
+
if (value && value.trim().length > 0) {
|
|
207
|
+
const config = getFieldConfig(detail, value);
|
|
208
|
+
if (config.inputType === 'email') {
|
|
209
|
+
if (!this.isValidEmail(value)) {
|
|
210
|
+
return 'Please enter a valid email address';
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
validateForm() {
|
|
217
|
+
const errors = {};
|
|
218
|
+
if (this.currentStep === SurveyStep.POLL && this.selectedChoices.length === 0) {
|
|
219
|
+
errors['poll'] = 'Please select at least one option';
|
|
220
|
+
}
|
|
221
|
+
if (this.currentStep === SurveyStep.FOLLOW_UP && this.selectedFollowUpChoices.length === 0) {
|
|
222
|
+
errors['followup'] = 'Please select at least one option';
|
|
223
|
+
}
|
|
224
|
+
this.formErrors = errors;
|
|
225
|
+
return Object.keys(errors).length === 0;
|
|
226
|
+
}
|
|
227
|
+
handleChoiceSelect(choice) {
|
|
228
|
+
var _a;
|
|
229
|
+
const choiceValue = choice.value;
|
|
230
|
+
const isMultipleChoice = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.choiceType) === 'multiChoice';
|
|
231
|
+
if (isMultipleChoice) {
|
|
232
|
+
if (this.selectedChoices.includes(choiceValue)) {
|
|
233
|
+
this.selectedChoices = this.selectedChoices.filter(c => c !== choiceValue);
|
|
234
|
+
this.announceToScreenReader(`Deselected: ${choice.label}`);
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
this.selectedChoices = [...this.selectedChoices, choiceValue];
|
|
238
|
+
this.announceToScreenReader(`Selected: ${choice.label}`);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
this.selectedChoices = [choiceValue];
|
|
243
|
+
this.announceToScreenReader(`Selected: ${choice.label}`);
|
|
244
|
+
}
|
|
245
|
+
// Clear any validation errors when user makes a selection
|
|
246
|
+
if (this.formErrors['poll']) {
|
|
247
|
+
const errors = Object.assign({}, this.formErrors);
|
|
248
|
+
delete errors['poll'];
|
|
249
|
+
this.formErrors = errors;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
handleFollowUpChoiceSelect(choice) {
|
|
253
|
+
const choiceValue = choice.value;
|
|
254
|
+
if (this.selectedFollowUpChoices.includes(choiceValue)) {
|
|
255
|
+
this.selectedFollowUpChoices = this.selectedFollowUpChoices.filter(c => c !== choiceValue);
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
this.selectedFollowUpChoices = [...this.selectedFollowUpChoices, choiceValue];
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
handleRespondentDetailChange(key, event) {
|
|
262
|
+
const target = event.target;
|
|
263
|
+
const detail = this.respondentDetails.find(d => d.value === key);
|
|
264
|
+
const inputType = (detail === null || detail === void 0 ? void 0 : detail.inputType) || 'text';
|
|
265
|
+
let value;
|
|
266
|
+
if (target.type === 'checkbox') {
|
|
267
|
+
// Handle checkbox inputs - maintain comma-separated list using browser-compatible helpers
|
|
268
|
+
const currentValue = this.userRespondentDetails[key] || '';
|
|
269
|
+
const sanitizedCheckboxValue = sanitizeInput(target.value, 100);
|
|
270
|
+
if (target.checked) {
|
|
271
|
+
value = addToCommaSeparatedList(currentValue, sanitizedCheckboxValue);
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
value = removeFromCommaSeparatedList(currentValue, sanitizedCheckboxValue);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
// Handle all other input types (text, email, number, radio, select)
|
|
279
|
+
// Sanitize based on field type
|
|
280
|
+
value = sanitizeByType(target.value, inputType);
|
|
281
|
+
}
|
|
282
|
+
this.userRespondentDetails = Object.assign(Object.assign({}, this.userRespondentDetails), { [key]: value });
|
|
283
|
+
}
|
|
284
|
+
createInputHandler(fieldValue) {
|
|
285
|
+
const self = this;
|
|
286
|
+
return function (e) {
|
|
287
|
+
self.handleRespondentDetailChange(fieldValue, e);
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
isValueInArray(array, value) {
|
|
291
|
+
for (let i = 0; i < array.length; i++) {
|
|
292
|
+
if (array[i] === value) {
|
|
293
|
+
return true;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return false;
|
|
297
|
+
}
|
|
298
|
+
renderField(detail) {
|
|
299
|
+
const config = getFieldConfig(detail, this.userRespondentDetails[detail.value] || '');
|
|
300
|
+
const inputHandler = this.createInputHandler(detail.value);
|
|
301
|
+
switch (config.inputType) {
|
|
302
|
+
case 'text':
|
|
303
|
+
case 'email':
|
|
304
|
+
case 'number':
|
|
305
|
+
return (h("input", { part: "input form-input", type: config.inputType, value: config.currentValue, onInput: inputHandler, placeholder: config.placeholder, required: config.required }));
|
|
306
|
+
case 'dropdown':
|
|
307
|
+
if (!config.hasOptions) {
|
|
308
|
+
return h("input", { part: "input form-input", type: "text", value: config.currentValue, onInput: inputHandler, placeholder: config.placeholder, required: config.required });
|
|
309
|
+
}
|
|
310
|
+
return (h("select", { part: "select form-select", onChange: inputHandler, required: config.required }, !config.defaultValue && (h("option", { value: "", disabled: true }, config.placeholder)), config.options.map(function (option) {
|
|
311
|
+
return (h("option", { key: option.value, value: option.value, selected: config.currentValue === option.value || (!config.currentValue && config.defaultValue === option.value) }, option.label));
|
|
312
|
+
})));
|
|
313
|
+
case 'radio':
|
|
314
|
+
if (!config.hasOptions) {
|
|
315
|
+
return h("input", { part: "input form-input", type: "text", value: config.currentValue, onInput: inputHandler, placeholder: config.placeholder, required: config.required });
|
|
316
|
+
}
|
|
317
|
+
return (h("div", { part: "radio-group" }, config.options.map(function (option) {
|
|
318
|
+
return (h("div", { key: option.value, part: "radio-option" }, h("input", { part: "radio-input", type: "radio", id: config.fieldValue + '-' + option.value, name: config.fieldValue, value: option.value, checked: config.currentValue === option.value || (!config.currentValue && config.defaultValue === option.value), onChange: inputHandler, required: config.required }), h("label", { part: "radio-label", htmlFor: config.fieldValue + '-' + option.value }, option.label)));
|
|
319
|
+
})));
|
|
320
|
+
case 'checkbox':
|
|
321
|
+
if (!config.hasOptions) {
|
|
322
|
+
return h("input", { part: "input form-input", type: "text", value: config.currentValue, onInput: inputHandler, placeholder: config.placeholder, required: config.required });
|
|
323
|
+
}
|
|
324
|
+
const self = this;
|
|
325
|
+
return (h("div", { part: "checkbox-group" }, config.options.map(function (option) {
|
|
326
|
+
return (h("div", { key: option.value, part: "checkbox-option" }, h("input", { part: "checkbox-input", type: "checkbox", id: config.fieldValue + '-' + option.value, name: config.fieldValue, value: option.value, checked: self.isValueInArray(config.selectedValues, option.value), onChange: inputHandler }), h("label", { part: "checkbox-label", htmlFor: config.fieldValue + '-' + option.value }, option.label)));
|
|
327
|
+
})));
|
|
328
|
+
default:
|
|
329
|
+
return h("input", { part: "input form-input", type: "text", value: config.currentValue, onInput: inputHandler, placeholder: config.placeholder, required: config.required });
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
isRespondentDetailsValid() {
|
|
333
|
+
return this.respondentDetails.every(detail => {
|
|
334
|
+
const value = this.userRespondentDetails[detail.value] || '';
|
|
335
|
+
const error = this.validateRespondentField(detail, value);
|
|
336
|
+
return error === null;
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
renderPollStep() {
|
|
340
|
+
var _a, _b, _c, _d;
|
|
341
|
+
const isFinalStep = !this.hasFollowUpStep() && !this.hasRespondentDetailsStep();
|
|
342
|
+
const isMultiple = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.choiceType) === 'multiChoice';
|
|
343
|
+
const hasError = !!this.formErrors['poll'];
|
|
344
|
+
return (h("div", { part: "step poll-step" }, h("h2", { part: "heading poll-heading", id: "poll-heading" }, ((_b = this.config) === null || _b === void 0 ? void 0 : _b.question) || 'What is your choice?'), h("div", { part: "choices-container", role: isMultiple ? 'group' : 'radiogroup', "aria-labelledby": "poll-heading", "aria-invalid": hasError, "aria-describedby": hasError ? 'poll-error' : undefined }, (_d = (_c = this.config) === null || _c === void 0 ? void 0 : _c.choices) === null || _d === void 0 ? void 0 : _d.map((choice, index) => (h("label", { part: "choice-option", key: choice.value }, h("input", { part: isMultiple ? 'checkbox-input' : 'radio-input', type: isMultiple ? 'checkbox' : 'radio', id: `poll-choice-${index}`, name: "poll-choice", value: choice.value, checked: this.selectedChoices.includes(choice.value), onChange: () => this.handleChoiceSelect(choice), "aria-describedby": `poll-choice-${index}-label` }), h("span", { part: "choice-label", id: `poll-choice-${index}-label` }, choice.label))))), hasError && (h("div", { part: "error-message", id: "poll-error", role: "alert", "aria-live": "polite" }, this.formErrors['poll'])), h("div", { part: "button-container" }, h("button", { part: "button next-button", onClick: () => this.nextStep(), disabled: this.selectedChoices.length === 0 }, isFinalStep ? 'Submit' : 'Next'))));
|
|
345
|
+
}
|
|
346
|
+
renderFollowUpStep() {
|
|
347
|
+
var _a, _b, _c;
|
|
348
|
+
const isFinalStep = !this.hasRespondentDetailsStep();
|
|
349
|
+
return (h("div", { part: "step follow-up-step" }, h("h2", { part: "heading follow-up-heading" }, ((_a = this.config) === null || _a === void 0 ? void 0 : _a.followUpQuestion) || 'Follow-up question'), h("div", { part: "choices-container" }, (_c = (_b = this.config) === null || _b === void 0 ? void 0 : _b.followUpChoices) === null || _c === void 0 ? void 0 : _c.map(choice => (h("label", { part: "choice-option", key: choice.value }, h("input", { part: "checkbox-input", type: "checkbox", name: "follow-up-choice", value: choice.value, checked: this.selectedFollowUpChoices.includes(choice.value), onChange: () => this.handleFollowUpChoiceSelect(choice) }), h("span", { part: "choice-label" }, choice.label))))), h("div", { part: "button-container" }, h("button", { part: "button back-button", onClick: () => this.prevStep() }, "Back"), h("button", { part: "button next-button", onClick: () => this.nextStep() }, isFinalStep ? 'Submit' : 'Next'))));
|
|
350
|
+
}
|
|
351
|
+
renderRespondentDetailsStep() {
|
|
352
|
+
return (h("div", { part: "step respondent-details-step" }, h("h2", { part: "heading respondent-details-heading" }, "Tell us about yourself"), h("div", { part: "form-container" }, this.respondentDetails.map(detail => (h("div", { part: "form-field" }, h("label", { part: "form-label" }, detail.label, detail.required && h("span", { part: "required-indicator" }, " *")), this.renderField(detail))))), h("div", { part: "button-container" }, h("button", { part: "button back-button", onClick: () => this.prevStep() }, "Back"), h("button", { part: "button submit-button", onClick: () => this.submitResponse(), disabled: !this.isRespondentDetailsValid() }, "Submit"))));
|
|
353
|
+
}
|
|
354
|
+
renderCompletionStep() {
|
|
355
|
+
return (h("div", { part: "step completion-step" }, h("h2", { part: "heading completion-heading" }, this.completionMessage)));
|
|
356
|
+
}
|
|
357
|
+
renderCurrentStep() {
|
|
358
|
+
const stepRenderers = {
|
|
359
|
+
[SurveyStep.POLL]: this.renderPollStep.bind(this),
|
|
360
|
+
[SurveyStep.FOLLOW_UP]: this.renderFollowUpStep.bind(this),
|
|
361
|
+
[SurveyStep.RESPONDENT_DETAILS]: this.renderRespondentDetailsStep.bind(this),
|
|
362
|
+
[SurveyStep.COMPLETION]: this.renderCompletionStep.bind(this),
|
|
363
|
+
};
|
|
364
|
+
const renderer = stepRenderers[this.currentStep] || stepRenderers[SurveyStep.POLL];
|
|
365
|
+
return renderer();
|
|
366
|
+
}
|
|
367
|
+
render() {
|
|
368
|
+
if (!isValidKey(this.surveyKey)) {
|
|
369
|
+
return (h(Host, null, h("p", { part: "message error-message" }, "Unable to render survey due to invalid public key")));
|
|
370
|
+
}
|
|
371
|
+
if (this.loading) {
|
|
372
|
+
return (h(Host, null, h("p", { part: "message loading-message" }, "Loading survey...")));
|
|
373
|
+
}
|
|
374
|
+
if (this.error) {
|
|
375
|
+
return (h(Host, null, h("div", { part: "error-container" }, h("p", { part: "message error-message" }, this.error), h("button", { part: "button retry-button", onClick: () => this.retryOperation() }, "Try again"))));
|
|
376
|
+
}
|
|
377
|
+
if (!this.config) {
|
|
378
|
+
return (h(Host, null, h("div", { part: "error-container" }, h("p", { part: "message error-message" }, "No survey configuration found"), h("button", { part: "button retry-button", onClick: () => this.retryOperation() }, "Try again"))));
|
|
379
|
+
}
|
|
380
|
+
return (h(Host, null, h("div", { part: "survey-container", role: "main", "aria-label": "Poll Survey" }, this.renderCurrentStep(), h("div", { "aria-live": "polite", "aria-atomic": "true", class: "sr-only", part: "announcements" }, this.announceMessage))));
|
|
381
|
+
}
|
|
382
|
+
static get is() { return "sf-fastpoll"; }
|
|
383
|
+
static get encapsulation() { return "shadow"; }
|
|
384
|
+
static get originalStyleUrls() {
|
|
385
|
+
return {
|
|
386
|
+
"$": ["sf-fastpoll.css"]
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
static get styleUrls() {
|
|
390
|
+
return {
|
|
391
|
+
"$": ["sf-fastpoll.css"]
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
static get properties() {
|
|
395
|
+
return {
|
|
396
|
+
"surveyKey": {
|
|
397
|
+
"type": "string",
|
|
398
|
+
"attribute": "survey-key",
|
|
399
|
+
"mutable": false,
|
|
400
|
+
"complexType": {
|
|
401
|
+
"original": "string",
|
|
402
|
+
"resolved": "string",
|
|
403
|
+
"references": {}
|
|
404
|
+
},
|
|
405
|
+
"required": false,
|
|
406
|
+
"optional": false,
|
|
407
|
+
"docs": {
|
|
408
|
+
"tags": [],
|
|
409
|
+
"text": ""
|
|
410
|
+
},
|
|
411
|
+
"getter": false,
|
|
412
|
+
"setter": false,
|
|
413
|
+
"reflect": false
|
|
414
|
+
},
|
|
415
|
+
"completionMessage": {
|
|
416
|
+
"type": "string",
|
|
417
|
+
"attribute": "completion-message",
|
|
418
|
+
"mutable": false,
|
|
419
|
+
"complexType": {
|
|
420
|
+
"original": "string",
|
|
421
|
+
"resolved": "string",
|
|
422
|
+
"references": {}
|
|
423
|
+
},
|
|
424
|
+
"required": false,
|
|
425
|
+
"optional": false,
|
|
426
|
+
"docs": {
|
|
427
|
+
"tags": [],
|
|
428
|
+
"text": ""
|
|
429
|
+
},
|
|
430
|
+
"getter": false,
|
|
431
|
+
"setter": false,
|
|
432
|
+
"reflect": false,
|
|
433
|
+
"defaultValue": "'Thank you for your response!'"
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
static get states() {
|
|
438
|
+
return {
|
|
439
|
+
"config": {},
|
|
440
|
+
"respondentDetails": {},
|
|
441
|
+
"loading": {},
|
|
442
|
+
"error": {},
|
|
443
|
+
"currentStep": {},
|
|
444
|
+
"selectedChoices": {},
|
|
445
|
+
"selectedFollowUpChoices": {},
|
|
446
|
+
"userRespondentDetails": {},
|
|
447
|
+
"submitted": {},
|
|
448
|
+
"announceMessage": {},
|
|
449
|
+
"formErrors": {}
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
static get elementRef() { return "el"; }
|
|
453
|
+
}
|
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C;QAED,OAAO,CACL,EAAC,IAAI;YACH,WAAK,IAAI,EAAC,kBAAkB,EAAC,IAAI,EAAC,MAAM,gBAAY,aAAa;gBAC9D,IAAI,CAAC,iBAAiB,EAAE;gBAEzB,wBAAe,QAAQ,iBAAa,MAAM,EAAC,KAAK,EAAC,SAAS,EAAC,IAAI,EAAC,eAAe,IAC5E,IAAI,CAAC,eAAe,CACjB,CACF,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, h, Prop, State, Element, Env } from '@stencil/core';\nimport { isValidKey, getFieldConfig, addToCommaSeparatedList, removeFromCommaSeparatedList, sanitizeByType, sanitizeInput } from '../../utils/utils';\n\nconst SURVEY_API_ENDPOINT = Env.SURVEY_API_ENDPOINT;\nconst RESPONSE_API_ENDPOINT = Env.RESPONSE_API_ENDPOINT;\n\nenum SurveyStep {\n POLL = 0,\n FOLLOW_UP = 1,\n RESPONDENT_DETAILS = 2,\n COMPLETION = 3,\n}\n\ninterface RespondentDetail {\n label: string;\n value: string;\n inputType: string; // 'text', 'email', 'dropdown', 'radio', 'checkbox', 'number'\n required?: boolean;\n placeholder?: string;\n options?: Array<{\n value: string;\n label: string;\n }>;\n defaultValue?: any;\n}\n\ninterface Choice {\n label: string;\n value: string;\n}\n\ninterface SurveyConfig {\n question: string;\n choiceType: string; // 'single' or 'multiple'\n choices: Choice[];\n followUpChoices?: Choice[];\n followUpQuestion?: string;\n}\n\ninterface SurveyPayload {\n config: SurveyConfig;\n respondentDetails?: RespondentDetail[];\n}\n\ninterface ApiResponse {\n success: boolean;\n message: string;\n payload: SurveyPayload;\n}\n\n@Component({\n tag: 'sf-fastpoll',\n styleUrl: 'sf-fastpoll.css',\n shadow: true,\n})\nexport class SfFastpoll {\n @Element() el: HTMLElement;\n\n @Prop() surveyKey: string;\n\n @Prop() completionMessage: string = 'Thank you for your response!';\n\n @State() config: SurveyConfig | null = null;\n\n @State() respondentDetails: RespondentDetail[] = [];\n\n @State() loading: boolean = false;\n\n @State() error: string | null = null;\n\n @State() currentStep: SurveyStep = SurveyStep.POLL;\n\n @State() selectedChoices: string[] = [];\n\n @State() selectedFollowUpChoices: string[] = [];\n\n @State() userRespondentDetails: { [key: string]: string } = {};\n\n @State() submitted: boolean = false;\n\n @State() announceMessage: string = '';\n\n @State() formErrors: { [key: string]: string } = {};\n\n private surveyStartTime: number = 0;\n\n componentWillLoad() {\n if (isValidKey(this.surveyKey)) {\n return this.fetchSurveyData();\n }\n return Promise.resolve();\n }\n\n private async fetchSurveyData() {\n this.loading = true;\n this.error = null;\n this.surveyStartTime = Date.now();\n\n try {\n const response = await fetch(`${SURVEY_API_ENDPOINT}/${this.surveyKey}`);\n const data: ApiResponse = await response.json();\n\n if (!data.success) {\n throw new Error(data.message);\n }\n\n this.config = data.payload.config;\n this.respondentDetails = data.payload.respondentDetails || [];\n } catch (error) {\n this.error = error instanceof Error ? error.message : String(error);\n } finally {\n this.loading = false;\n }\n }\n\n private async retryOperation() {\n if (this.config) {\n // If we have config, retry submission\n await this.submitResponse();\n } else {\n // Otherwise, retry fetching survey data\n await this.fetchSurveyData();\n }\n }\n\n private async submitResponse() {\n if (!this.config || this.submitted) {\n return;\n }\n\n this.loading = true;\n this.error = null;\n\n try {\n const completionTimeSeconds = this.surveyStartTime > 0 ? Math.round((Date.now() - this.surveyStartTime) / 1000) : 0;\n const userAgentInfo = this.getUserAgentInfo();\n\n const submissionData = {\n surveyPublicKey: this.surveyKey,\n responseData: {\n selectedChoices: this.selectedChoices,\n selectedFollowUpChoices: this.selectedFollowUpChoices,\n },\n respondentDetails: this.userRespondentDetails,\n userAgent: userAgentInfo,\n completionTime: completionTimeSeconds,\n surveyType: 'fastPoll',\n };\n\n const response = await fetch(`${RESPONSE_API_ENDPOINT}`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(submissionData),\n });\n\n const result = await response.json();\n\n if (!result.success) {\n throw new Error(result.message);\n }\n\n this.submitted = true;\n this.currentStep = SurveyStep.COMPLETION;\n } catch (error) {\n this.error = error instanceof Error ? error.message : String(error);\n } finally {\n this.loading = false;\n }\n }\n\n private getUserAgentInfo() {\n // Use modern navigator.userAgentData when available, fallback to userAgent parsing\n const getPlatform = () => {\n if ('userAgentData' in navigator && (navigator as any).userAgentData?.platform) {\n return (navigator as any).userAgentData.platform;\n }\n // Fallback: extract platform info from userAgent\n const ua = navigator.userAgent;\n if (ua.includes('Win')) return 'Windows';\n if (ua.includes('Mac')) return 'macOS';\n if (ua.includes('Linux')) return 'Linux';\n if (ua.includes('Android')) return 'Android';\n if (ua.includes('iOS')) return 'iOS';\n return 'Unknown';\n };\n\n return {\n userAgent: navigator.userAgent,\n language: navigator.language,\n platform: getPlatform(),\n cookieEnabled: navigator.cookieEnabled,\n onLine: navigator.onLine,\n screenResolution: `${screen.width}x${screen.height}`,\n colorDepth: screen.colorDepth,\n timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,\n timestamp: new Date().toISOString(),\n };\n }\n\n private nextStep() {\n if (!this.validateForm()) {\n return;\n }\n\n if (this.currentStep === SurveyStep.POLL) {\n if (this.hasFollowUpStep()) {\n this.currentStep = SurveyStep.FOLLOW_UP;\n this.announceToScreenReader('Moving to follow-up question');\n } else if (this.hasRespondentDetailsStep()) {\n this.currentStep = SurveyStep.RESPONDENT_DETAILS;\n this.announceToScreenReader('Moving to respondent details');\n } else {\n this.announceToScreenReader('Submitting poll...');\n this.submitResponse();\n }\n } else if (this.currentStep === SurveyStep.FOLLOW_UP) {\n if (this.hasRespondentDetailsStep()) {\n this.currentStep = SurveyStep.RESPONDENT_DETAILS;\n this.announceToScreenReader('Moving to respondent details');\n } else {\n this.announceToScreenReader('Submitting poll...');\n this.submitResponse();\n }\n } else if (this.currentStep === SurveyStep.RESPONDENT_DETAILS) {\n this.announceToScreenReader('Submitting poll...');\n this.submitResponse();\n }\n }\n\n private prevStep() {\n if (this.currentStep === SurveyStep.FOLLOW_UP) {\n this.currentStep = SurveyStep.POLL;\n } else if (this.currentStep === SurveyStep.RESPONDENT_DETAILS) {\n if (this.hasFollowUpStep()) {\n this.currentStep = SurveyStep.FOLLOW_UP;\n } else {\n this.currentStep = SurveyStep.POLL;\n }\n }\n }\n\n private hasFollowUpStep(): boolean {\n return !!(this.config?.followUpQuestion && this.config?.followUpChoices?.length);\n }\n\n private hasRespondentDetailsStep(): boolean {\n return this.respondentDetails.length > 0;\n }\n\n private announceToScreenReader(message: string) {\n this.announceMessage = message;\n setTimeout(() => {\n this.announceMessage = '';\n }, 1000);\n }\n\n private isValidEmail(email: string): boolean {\n // Basic email validation regex\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n return emailRegex.test(email.trim());\n }\n\n private validateRespondentField(detail: RespondentDetail, value: string): string | null {\n if (detail.required !== false && (!value || value.trim().length === 0)) {\n return 'This field is required';\n }\n\n if (value && value.trim().length > 0) {\n const config = getFieldConfig(detail, value);\n if (config.inputType === 'email') {\n if (!this.isValidEmail(value)) {\n return 'Please enter a valid email address';\n }\n }\n }\n\n return null;\n }\n\n private validateForm(): boolean {\n const errors: { [key: string]: string } = {};\n\n if (this.currentStep === SurveyStep.POLL && this.selectedChoices.length === 0) {\n errors['poll'] = 'Please select at least one option';\n }\n\n if (this.currentStep === SurveyStep.FOLLOW_UP && this.selectedFollowUpChoices.length === 0) {\n errors['followup'] = 'Please select at least one option';\n }\n\n this.formErrors = errors;\n return Object.keys(errors).length === 0;\n }\n\n private handleChoiceSelect(choice: Choice) {\n const choiceValue = choice.value;\n const isMultipleChoice = this.config?.choiceType === 'multiChoice';\n\n if (isMultipleChoice) {\n if (this.selectedChoices.includes(choiceValue)) {\n this.selectedChoices = this.selectedChoices.filter(c => c !== choiceValue);\n this.announceToScreenReader(`Deselected: ${choice.label}`);\n } else {\n this.selectedChoices = [...this.selectedChoices, choiceValue];\n this.announceToScreenReader(`Selected: ${choice.label}`);\n }\n } else {\n this.selectedChoices = [choiceValue];\n this.announceToScreenReader(`Selected: ${choice.label}`);\n }\n\n // Clear any validation errors when user makes a selection\n if (this.formErrors['poll']) {\n const errors = { ...this.formErrors };\n delete errors['poll'];\n this.formErrors = errors;\n }\n }\n\n private handleFollowUpChoiceSelect(choice: Choice) {\n const choiceValue = choice.value;\n if (this.selectedFollowUpChoices.includes(choiceValue)) {\n this.selectedFollowUpChoices = this.selectedFollowUpChoices.filter(c => c !== choiceValue);\n } else {\n this.selectedFollowUpChoices = [...this.selectedFollowUpChoices, choiceValue];\n }\n }\n\n private handleRespondentDetailChange(key: string, event: Event) {\n const target = event.target as HTMLInputElement | HTMLSelectElement;\n const detail = this.respondentDetails.find(d => d.value === key);\n const inputType = detail?.inputType || 'text';\n let value: string;\n\n if (target.type === 'checkbox') {\n // Handle checkbox inputs - maintain comma-separated list using browser-compatible helpers\n const currentValue = this.userRespondentDetails[key] || '';\n const sanitizedCheckboxValue = sanitizeInput(target.value, 100);\n if (target.checked) {\n value = addToCommaSeparatedList(currentValue, sanitizedCheckboxValue);\n } else {\n value = removeFromCommaSeparatedList(currentValue, sanitizedCheckboxValue);\n }\n } else {\n // Handle all other input types (text, email, number, radio, select)\n // Sanitize based on field type\n value = sanitizeByType(target.value, inputType);\n }\n\n this.userRespondentDetails = {\n ...this.userRespondentDetails,\n [key]: value,\n };\n }\n\n private createInputHandler(fieldValue: string) {\n const self = this;\n return function (e: Event) {\n self.handleRespondentDetailChange(fieldValue, e);\n };\n }\n\n private isValueInArray(array: string[], value: string): boolean {\n for (let i = 0; i < array.length; i++) {\n if (array[i] === value) {\n return true;\n }\n }\n return false;\n }\n\n private renderField(detail: RespondentDetail) {\n const config = getFieldConfig(detail, this.userRespondentDetails[detail.value] || '');\n const inputHandler = this.createInputHandler(detail.value);\n\n switch (config.inputType) {\n case 'text':\n case 'email':\n case 'number':\n return (\n <input part=\"input form-input\" type={config.inputType} value={config.currentValue} onInput={inputHandler} placeholder={config.placeholder} required={config.required} />\n );\n\n case 'dropdown':\n if (!config.hasOptions) {\n return <input part=\"input form-input\" type=\"text\" value={config.currentValue} onInput={inputHandler} placeholder={config.placeholder} required={config.required} />;\n }\n return (\n <select part=\"select form-select\" onChange={inputHandler} required={config.required}>\n {!config.defaultValue && (\n <option value=\"\" disabled>\n {config.placeholder}\n </option>\n )}\n {config.options.map(function (option) {\n return (\n <option key={option.value} value={option.value} selected={config.currentValue === option.value || (!config.currentValue && config.defaultValue === option.value)}>\n {option.label}\n </option>\n );\n })}\n </select>\n );\n\n case 'radio':\n if (!config.hasOptions) {\n return <input part=\"input form-input\" type=\"text\" value={config.currentValue} onInput={inputHandler} placeholder={config.placeholder} required={config.required} />;\n }\n return (\n <div part=\"radio-group\">\n {config.options.map(function (option) {\n return (\n <div key={option.value} part=\"radio-option\">\n <input\n part=\"radio-input\"\n type=\"radio\"\n id={config.fieldValue + '-' + option.value}\n name={config.fieldValue}\n value={option.value}\n checked={config.currentValue === option.value || (!config.currentValue && config.defaultValue === option.value)}\n onChange={inputHandler}\n required={config.required}\n />\n <label part=\"radio-label\" htmlFor={config.fieldValue + '-' + option.value}>\n {option.label}\n </label>\n </div>\n );\n })}\n </div>\n );\n\n case 'checkbox':\n if (!config.hasOptions) {\n return <input part=\"input form-input\" type=\"text\" value={config.currentValue} onInput={inputHandler} placeholder={config.placeholder} required={config.required} />;\n }\n const self = this;\n return (\n <div part=\"checkbox-group\">\n {config.options.map(function (option) {\n return (\n <div key={option.value} part=\"checkbox-option\">\n <input\n part=\"checkbox-input\"\n type=\"checkbox\"\n id={config.fieldValue + '-' + option.value}\n name={config.fieldValue}\n value={option.value}\n checked={self.isValueInArray(config.selectedValues, option.value)}\n onChange={inputHandler}\n />\n <label part=\"checkbox-label\" htmlFor={config.fieldValue + '-' + option.value}>\n {option.label}\n </label>\n </div>\n );\n })}\n </div>\n );\n\n default:\n return <input part=\"input form-input\" type=\"text\" value={config.currentValue} onInput={inputHandler} placeholder={config.placeholder} required={config.required} />;\n }\n }\n\n private isRespondentDetailsValid(): boolean {\n return this.respondentDetails.every(detail => {\n const value = this.userRespondentDetails[detail.value] || '';\n const error = this.validateRespondentField(detail, value);\n return error === null;\n });\n }\n\n private renderPollStep() {\n const isFinalStep = !this.hasFollowUpStep() && !this.hasRespondentDetailsStep();\n const isMultiple = this.config?.choiceType === 'multiChoice';\n const hasError = !!this.formErrors['poll'];\n\n return (\n <div part=\"step poll-step\">\n <h2 part=\"heading poll-heading\" id=\"poll-heading\">\n {this.config?.question || 'What is your choice?'}\n </h2>\n <div\n part=\"choices-container\"\n role={isMultiple ? 'group' : 'radiogroup'}\n aria-labelledby=\"poll-heading\"\n aria-invalid={hasError}\n aria-describedby={hasError ? 'poll-error' : undefined}\n >\n {this.config?.choices?.map((choice, index) => (\n <label part=\"choice-option\" key={choice.value}>\n <input\n part={isMultiple ? 'checkbox-input' : 'radio-input'}\n type={isMultiple ? 'checkbox' : 'radio'}\n id={`poll-choice-${index}`}\n name=\"poll-choice\"\n value={choice.value}\n checked={this.selectedChoices.includes(choice.value)}\n onChange={() => this.handleChoiceSelect(choice)}\n aria-describedby={`poll-choice-${index}-label`}\n />\n <span part=\"choice-label\" id={`poll-choice-${index}-label`}>\n {choice.label}\n </span>\n </label>\n ))}\n </div>\n {hasError && (\n <div part=\"error-message\" id=\"poll-error\" role=\"alert\" aria-live=\"polite\">\n {this.formErrors['poll']}\n </div>\n )}\n <div part=\"button-container\">\n <button part=\"button next-button\" onClick={() => this.nextStep()} disabled={this.selectedChoices.length === 0}>\n {isFinalStep ? 'Submit' : 'Next'}\n </button>\n </div>\n </div>\n );\n }\n\n private renderFollowUpStep() {\n const isFinalStep = !this.hasRespondentDetailsStep();\n\n return (\n <div part=\"step follow-up-step\">\n <h2 part=\"heading follow-up-heading\">{this.config?.followUpQuestion || 'Follow-up question'}</h2>\n <div part=\"choices-container\">\n {this.config?.followUpChoices?.map(choice => (\n <label part=\"choice-option\" key={choice.value}>\n <input\n part=\"checkbox-input\"\n type=\"checkbox\"\n name=\"follow-up-choice\"\n value={choice.value}\n checked={this.selectedFollowUpChoices.includes(choice.value)}\n onChange={() => this.handleFollowUpChoiceSelect(choice)}\n />\n <span part=\"choice-label\">{choice.label}</span>\n </label>\n ))}\n </div>\n <div part=\"button-container\">\n <button part=\"button back-button\" onClick={() => this.prevStep()}>\n Back\n </button>\n <button part=\"button next-button\" onClick={() => this.nextStep()}>\n {isFinalStep ? 'Submit' : 'Next'}\n </button>\n </div>\n </div>\n );\n }\n\n private renderRespondentDetailsStep() {\n return (\n <div part=\"step respondent-details-step\">\n <h2 part=\"heading respondent-details-heading\">Tell us about yourself</h2>\n <div part=\"form-container\">\n {this.respondentDetails.map(detail => (\n <div part=\"form-field\">\n <label part=\"form-label\">\n {detail.label}\n {detail.required && <span part=\"required-indicator\"> *</span>}\n </label>\n {this.renderField(detail)}\n </div>\n ))}\n </div>\n <div part=\"button-container\">\n <button part=\"button back-button\" onClick={() => this.prevStep()}>\n Back\n </button>\n <button part=\"button submit-button\" onClick={() => this.submitResponse()} disabled={!this.isRespondentDetailsValid()}>\n Submit\n </button>\n </div>\n </div>\n );\n }\n\n private renderCompletionStep() {\n return (\n <div part=\"step completion-step\">\n <h2 part=\"heading completion-heading\">{this.completionMessage}</h2>\n </div>\n );\n }\n\n private renderCurrentStep() {\n const stepRenderers = {\n [SurveyStep.POLL]: this.renderPollStep.bind(this),\n [SurveyStep.FOLLOW_UP]: this.renderFollowUpStep.bind(this),\n [SurveyStep.RESPONDENT_DETAILS]: this.renderRespondentDetailsStep.bind(this),\n [SurveyStep.COMPLETION]: this.renderCompletionStep.bind(this),\n };\n\n const renderer = stepRenderers[this.currentStep] || stepRenderers[SurveyStep.POLL];\n\n return renderer();\n }\n\n render() {\n if (!isValidKey(this.surveyKey)) {\n return (\n <Host>\n <p part=\"message error-message\">Unable to render survey due to invalid public key</p>\n </Host>\n );\n }\n\n if (this.loading) {\n return (\n <Host>\n <p part=\"message loading-message\">Loading survey...</p>\n </Host>\n );\n }\n\n if (this.error) {\n return (\n <Host>\n <div part=\"error-container\">\n <p part=\"message error-message\">{this.error}</p>\n <button part=\"button retry-button\" onClick={() => this.retryOperation()}>\n Try again\n </button>\n </div>\n </Host>\n );\n }\n\n if (!this.config) {\n return (\n <Host>\n <div part=\"error-container\">\n <p part=\"message error-message\">No survey configuration found</p>\n <button part=\"button retry-button\" onClick={() => this.retryOperation()}>\n Try again\n </button>\n </div>\n </Host>\n );\n }\n\n return (\n <Host>\n <div part=\"survey-container\" role=\"main\" aria-label=\"Poll Survey\">\n {this.renderCurrentStep()}\n {/* ARIA live region for screen reader announcements */}\n <div aria-live=\"polite\" aria-atomic=\"true\" class=\"sr-only\" part=\"announcements\">\n {this.announceMessage}\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview entry point for your component library
|
|
3
|
+
*
|
|
4
|
+
* This is the entry point for your component library. Use this file to export utilities,
|
|
5
|
+
* constants or data structure that accompany your components.
|
|
6
|
+
*
|
|
7
|
+
* DO NOT use this file to export your components. Instead, use the recommended approaches
|
|
8
|
+
* to consume components of this package as outlined in the `README.md`.
|
|
9
|
+
*/
|
|
10
|
+
export { isValidKey, formatErrorMessage } from './utils/utils';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC","sourcesContent":["/**\n * @fileoverview entry point for your component library\n *\n * This is the entry point for your component library. Use this file to export utilities,\n * constants or data structure that accompany your components.\n *\n * DO NOT use this file to export your components. Instead, use the recommended approaches\n * to consume components of this package as outlined in the `README.md`.\n */\n\nexport { isValidKey, formatErrorMessage } from './utils/utils';\nexport type * from './components.d.ts';\n"]}
|