@ozguraltan/strapi-content-input 1.0.11 → 1.0.12
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/README.md +249 -45
- package/dist/admin/AnalyticsHubPage-DNREITPq.js +637 -0
- package/dist/admin/AnalyticsHubPage-Dj4roAe0.mjs +637 -0
- package/dist/admin/{ContentInputField-BGJmgYGQ.js → ContentInputField-2hk9xG8p.js} +5880 -4756
- package/dist/admin/{ContentInputField-BLiKYZ7b.mjs → ContentInputField-Ko-r12jl.mjs} +5743 -4618
- package/dist/admin/SurveyWidgetEditor-B1S83aBE.mjs +7956 -0
- package/dist/admin/SurveyWidgetEditor-B3F4DE5r.js +7957 -0
- package/dist/admin/{en-D7v9nv9J.mjs → en-DnLdDKyq.mjs} +2 -1
- package/dist/admin/{en-DF-a59T_.js → en-bneQpRJa.js} +2 -1
- package/dist/admin/{index-DKVaYg3t.js → index-B4FpXxnK.js} +43 -4
- package/dist/admin/{index-DGBgjAUa.mjs → index-gn-4eO6g.mjs} +43 -4
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/analytics/SurveyAnalyticsView.d.ts +6 -0
- package/dist/admin/src/components/widgets/ContentFormWidgetEditor.d.ts +81 -0
- package/dist/admin/src/components/widgets/EntityCardWidgetEditor.d.ts +46 -0
- package/dist/admin/src/components/widgets/SurveyWidgetEditor.d.ts +91 -0
- package/dist/admin/src/core/useStrapiLocales.d.ts +13 -0
- package/dist/admin/src/pages/AnalyticsHubPage.d.ts +3 -0
- package/dist/admin/{tr-ByHzf64V.mjs → tr-00QqO0E7.mjs} +2 -1
- package/dist/admin/{tr-SNvSmKZQ.js → tr-O0nhB9er.js} +2 -1
- package/dist/server/index.js +4148 -46
- package/dist/server/index.mjs +4148 -46
- package/dist/server/src/bootstrap.d.ts +1 -1
- package/dist/server/src/content-types/ci-form/schema.json.d.ts +77 -0
- package/dist/server/src/content-types/ci-form-submission/schema.json.d.ts +54 -0
- package/dist/server/src/content-types/ci-survey/schema.json.d.ts +111 -0
- package/dist/server/src/content-types/ci-survey-response/schema.json.d.ts +81 -0
- package/dist/server/src/content-types/index.d.ts +315 -0
- package/dist/server/src/controllers/ci-form.d.ts +17 -0
- package/dist/server/src/controllers/ci-survey.d.ts +18 -0
- package/dist/server/src/controllers/index.d.ts +31 -0
- package/dist/server/src/index.d.ts +731 -1
- package/dist/server/src/services/ci-form.d.ts +250 -0
- package/dist/server/src/services/ci-survey.d.ts +296 -0
- package/dist/server/src/services/index.d.ts +384 -0
- package/dist/server/src/utils/formValidator.d.ts +19 -0
- package/dist/server/src/utils/mailer.d.ts +41 -0
- package/dist/server/src/utils/surveyEngine.d.ts +252 -0
- package/dist/server/src/utils/surveySeedData.d.ts +4 -0
- package/package.json +1 -1
|
@@ -47,5 +47,389 @@ declare const _default: {
|
|
|
47
47
|
items: any[];
|
|
48
48
|
}>;
|
|
49
49
|
};
|
|
50
|
+
'ci-form': ({ strapi }: {
|
|
51
|
+
strapi: import('@strapi/types/dist/core/strapi.js').Strapi;
|
|
52
|
+
}) => {
|
|
53
|
+
listStrapiLocales(): Promise<Array<{
|
|
54
|
+
code: string;
|
|
55
|
+
name: string;
|
|
56
|
+
isDefault: boolean;
|
|
57
|
+
}>>;
|
|
58
|
+
ensureSampleSubmissions(force?: boolean): Promise<void>;
|
|
59
|
+
ensureSeeded(): Promise<void>;
|
|
60
|
+
findRawByIdOrSlug(idOrSlug: string | number): Promise<any>;
|
|
61
|
+
findAllAdmin(): Promise<any[]>;
|
|
62
|
+
findAllPublic(): Promise<any[]>;
|
|
63
|
+
findOneAdmin(idOrSlug: string | number): Promise<any>;
|
|
64
|
+
findOnePublic(idOrSlug: string | number): Promise<any>;
|
|
65
|
+
save(payload: {
|
|
66
|
+
id?: string | number;
|
|
67
|
+
title: string;
|
|
68
|
+
slug?: string;
|
|
69
|
+
to?: string;
|
|
70
|
+
subject?: string;
|
|
71
|
+
buttonLabel?: any;
|
|
72
|
+
successMessage?: any;
|
|
73
|
+
redirect?: string;
|
|
74
|
+
hideLabels?: boolean;
|
|
75
|
+
useRecaptcha?: boolean;
|
|
76
|
+
recaptchaSiteKey?: string;
|
|
77
|
+
recaptchaSecretKey?: string;
|
|
78
|
+
mailConfig?: import('../utils/mailer').CIMailConfig;
|
|
79
|
+
fields?: Record<string, import('../utils/formValidator').CIFieldDefinition>;
|
|
80
|
+
form?: any[];
|
|
81
|
+
}): Promise<any>;
|
|
82
|
+
remove(idOrDocId: string | number): Promise<{
|
|
83
|
+
success: boolean;
|
|
84
|
+
}>;
|
|
85
|
+
listSubmissions(formIdOrSlug?: string): Promise<any[]>;
|
|
86
|
+
getPublicRecaptchaConfig(): {
|
|
87
|
+
publicKey: string;
|
|
88
|
+
enabled: boolean;
|
|
89
|
+
};
|
|
90
|
+
submitForm(idOrSlug: string | number, rawBody: Record<string, any>, meta?: {
|
|
91
|
+
ip?: string;
|
|
92
|
+
userAgent?: string;
|
|
93
|
+
locale?: import('../utils/formValidator').ValidationLocale;
|
|
94
|
+
}): Promise<{
|
|
95
|
+
ok: boolean;
|
|
96
|
+
status: number;
|
|
97
|
+
message: string;
|
|
98
|
+
errors?: undefined;
|
|
99
|
+
submissionId?: undefined;
|
|
100
|
+
redirect?: undefined;
|
|
101
|
+
mailSent?: undefined;
|
|
102
|
+
mailDriver?: undefined;
|
|
103
|
+
} | {
|
|
104
|
+
ok: boolean;
|
|
105
|
+
status: number;
|
|
106
|
+
errors: Record<string, string[]>;
|
|
107
|
+
message?: undefined;
|
|
108
|
+
submissionId?: undefined;
|
|
109
|
+
redirect?: undefined;
|
|
110
|
+
mailSent?: undefined;
|
|
111
|
+
mailDriver?: undefined;
|
|
112
|
+
} | {
|
|
113
|
+
ok: boolean;
|
|
114
|
+
status: number;
|
|
115
|
+
submissionId: any;
|
|
116
|
+
message: string;
|
|
117
|
+
redirect: any;
|
|
118
|
+
mailSent: boolean;
|
|
119
|
+
mailDriver: string;
|
|
120
|
+
errors?: undefined;
|
|
121
|
+
}>;
|
|
122
|
+
resolveEntityCard(params: {
|
|
123
|
+
uid?: string;
|
|
124
|
+
documentId?: string;
|
|
125
|
+
id?: string | number;
|
|
126
|
+
slug?: string;
|
|
127
|
+
}): Promise<{
|
|
128
|
+
id: any;
|
|
129
|
+
documentId: string;
|
|
130
|
+
uid: string;
|
|
131
|
+
collectionName: any;
|
|
132
|
+
collectionLabel: any;
|
|
133
|
+
title: string;
|
|
134
|
+
subtitle: string;
|
|
135
|
+
description: string;
|
|
136
|
+
image: any;
|
|
137
|
+
url: string;
|
|
138
|
+
slug: string;
|
|
139
|
+
publishedAt: any;
|
|
140
|
+
}>;
|
|
141
|
+
};
|
|
142
|
+
'ci-survey': ({ strapi }: {
|
|
143
|
+
strapi: import('@strapi/types/dist/core/strapi.js').Strapi;
|
|
144
|
+
}) => {
|
|
145
|
+
ensureSeeded(forceReseedResponses?: boolean): Promise<void>;
|
|
146
|
+
reseedSampleData(): Promise<{
|
|
147
|
+
ok: boolean;
|
|
148
|
+
totalSurveyResponses: number;
|
|
149
|
+
}>;
|
|
150
|
+
findRawByIdOrSlug(idOrSlug: string | number): Promise<any>;
|
|
151
|
+
getResponsesForSurvey(survey: any): Promise<any[]>;
|
|
152
|
+
findAllAdmin(): Promise<any[]>;
|
|
153
|
+
findOneAdmin(idOrSlug: string | number): Promise<any>;
|
|
154
|
+
findAllPublic(): Promise<any[]>;
|
|
155
|
+
findOnePublic(idOrSlug: string | number, meta?: {
|
|
156
|
+
ip?: string;
|
|
157
|
+
userAgent?: string;
|
|
158
|
+
voterToken?: string;
|
|
159
|
+
}): Promise<any>;
|
|
160
|
+
save(payload: Partial<import('../utils/surveyEngine').CISurveyDefinition> & {
|
|
161
|
+
id?: string | number;
|
|
162
|
+
}): Promise<any>;
|
|
163
|
+
remove(idOrSlug: string | number): Promise<{
|
|
164
|
+
success: boolean;
|
|
165
|
+
}>;
|
|
166
|
+
submitSurvey(idOrSlug: string | number, rawBody: Record<string, any>, meta?: {
|
|
167
|
+
ip?: string;
|
|
168
|
+
userAgent?: string;
|
|
169
|
+
locale?: import('../utils/formValidator').ValidationLocale;
|
|
170
|
+
}): Promise<{
|
|
171
|
+
ok: boolean;
|
|
172
|
+
status: number;
|
|
173
|
+
message: string;
|
|
174
|
+
closedReason?: undefined;
|
|
175
|
+
alreadyVoted?: undefined;
|
|
176
|
+
publicResults?: undefined;
|
|
177
|
+
errors?: undefined;
|
|
178
|
+
responseId?: undefined;
|
|
179
|
+
thankYouTitle?: undefined;
|
|
180
|
+
redirectUrl?: undefined;
|
|
181
|
+
} | {
|
|
182
|
+
ok: boolean;
|
|
183
|
+
status: number;
|
|
184
|
+
closedReason: "draft" | "closed" | "not_started" | "expired" | "quota_reached";
|
|
185
|
+
message: string;
|
|
186
|
+
alreadyVoted?: undefined;
|
|
187
|
+
publicResults?: undefined;
|
|
188
|
+
errors?: undefined;
|
|
189
|
+
responseId?: undefined;
|
|
190
|
+
thankYouTitle?: undefined;
|
|
191
|
+
redirectUrl?: undefined;
|
|
192
|
+
} | {
|
|
193
|
+
ok: boolean;
|
|
194
|
+
status: number;
|
|
195
|
+
alreadyVoted: boolean;
|
|
196
|
+
message: string;
|
|
197
|
+
publicResults: {
|
|
198
|
+
totalResponses: number;
|
|
199
|
+
questions: {
|
|
200
|
+
key: any;
|
|
201
|
+
type: any;
|
|
202
|
+
title: any;
|
|
203
|
+
answeredCount: any;
|
|
204
|
+
optionsBreakdown: any;
|
|
205
|
+
average: any;
|
|
206
|
+
distribution: any;
|
|
207
|
+
npsBreakdown: any;
|
|
208
|
+
rankingBreakdown: any;
|
|
209
|
+
}[];
|
|
210
|
+
};
|
|
211
|
+
closedReason?: undefined;
|
|
212
|
+
errors?: undefined;
|
|
213
|
+
responseId?: undefined;
|
|
214
|
+
thankYouTitle?: undefined;
|
|
215
|
+
redirectUrl?: undefined;
|
|
216
|
+
} | {
|
|
217
|
+
ok: boolean;
|
|
218
|
+
status: number;
|
|
219
|
+
alreadyVoted: boolean;
|
|
220
|
+
message: string;
|
|
221
|
+
closedReason?: undefined;
|
|
222
|
+
publicResults?: undefined;
|
|
223
|
+
errors?: undefined;
|
|
224
|
+
responseId?: undefined;
|
|
225
|
+
thankYouTitle?: undefined;
|
|
226
|
+
redirectUrl?: undefined;
|
|
227
|
+
} | {
|
|
228
|
+
ok: boolean;
|
|
229
|
+
status: number;
|
|
230
|
+
errors: Record<string, string[]>;
|
|
231
|
+
message?: undefined;
|
|
232
|
+
closedReason?: undefined;
|
|
233
|
+
alreadyVoted?: undefined;
|
|
234
|
+
publicResults?: undefined;
|
|
235
|
+
responseId?: undefined;
|
|
236
|
+
thankYouTitle?: undefined;
|
|
237
|
+
redirectUrl?: undefined;
|
|
238
|
+
} | {
|
|
239
|
+
ok: boolean;
|
|
240
|
+
status: number;
|
|
241
|
+
responseId: any;
|
|
242
|
+
thankYouTitle: string;
|
|
243
|
+
message: string;
|
|
244
|
+
redirectUrl: any;
|
|
245
|
+
publicResults: {
|
|
246
|
+
totalResponses: number;
|
|
247
|
+
questions: {
|
|
248
|
+
key: any;
|
|
249
|
+
type: any;
|
|
250
|
+
title: any;
|
|
251
|
+
answeredCount: any;
|
|
252
|
+
optionsBreakdown: any;
|
|
253
|
+
average: any;
|
|
254
|
+
distribution: any;
|
|
255
|
+
npsBreakdown: any;
|
|
256
|
+
rankingBreakdown: any;
|
|
257
|
+
}[];
|
|
258
|
+
};
|
|
259
|
+
closedReason?: undefined;
|
|
260
|
+
alreadyVoted?: undefined;
|
|
261
|
+
errors?: undefined;
|
|
262
|
+
}>;
|
|
263
|
+
getPublicResults(idOrSlug: string | number): Promise<{
|
|
264
|
+
ok: boolean;
|
|
265
|
+
status: number;
|
|
266
|
+
message: string;
|
|
267
|
+
data?: undefined;
|
|
268
|
+
} | {
|
|
269
|
+
ok: boolean;
|
|
270
|
+
status: number;
|
|
271
|
+
data: {
|
|
272
|
+
totalResponses: number;
|
|
273
|
+
questions: {
|
|
274
|
+
key: any;
|
|
275
|
+
type: any;
|
|
276
|
+
title: any;
|
|
277
|
+
answeredCount: any;
|
|
278
|
+
optionsBreakdown: any;
|
|
279
|
+
average: any;
|
|
280
|
+
distribution: any;
|
|
281
|
+
npsBreakdown: any;
|
|
282
|
+
rankingBreakdown: any;
|
|
283
|
+
}[];
|
|
284
|
+
};
|
|
285
|
+
message?: undefined;
|
|
286
|
+
}>;
|
|
287
|
+
getAnalytics(idOrSlug: string | number, filter?: import('../utils/surveyEngine').CISurveyAnalyticsFilter): Promise<{
|
|
288
|
+
summary: {
|
|
289
|
+
totalResponses: number;
|
|
290
|
+
unfilteredTotalResponses: number;
|
|
291
|
+
quotaLimit: number;
|
|
292
|
+
quotaPercentage: number;
|
|
293
|
+
avgDurationSeconds: number;
|
|
294
|
+
medianDurationSeconds: number;
|
|
295
|
+
lastSubmittedAt: string;
|
|
296
|
+
localeBreakdown: {
|
|
297
|
+
locale: string;
|
|
298
|
+
count: number;
|
|
299
|
+
percentage: number;
|
|
300
|
+
}[];
|
|
301
|
+
dailyTrend: {
|
|
302
|
+
date: string;
|
|
303
|
+
count: number;
|
|
304
|
+
}[];
|
|
305
|
+
nps: {
|
|
306
|
+
hasNps: boolean;
|
|
307
|
+
score: number;
|
|
308
|
+
promoters: number;
|
|
309
|
+
passives: number;
|
|
310
|
+
detractors: number;
|
|
311
|
+
promotersPct: number;
|
|
312
|
+
passivesPct: number;
|
|
313
|
+
detractorsPct: number;
|
|
314
|
+
totalNpsResponses: number;
|
|
315
|
+
};
|
|
316
|
+
};
|
|
317
|
+
questionStats: ({
|
|
318
|
+
answeredCount: number;
|
|
319
|
+
optionsBreakdown: {
|
|
320
|
+
id: string;
|
|
321
|
+
labels: Record<string, string>;
|
|
322
|
+
image: any;
|
|
323
|
+
count: number;
|
|
324
|
+
percentage: number;
|
|
325
|
+
}[];
|
|
326
|
+
otherSamples: {
|
|
327
|
+
text: string;
|
|
328
|
+
locale: string;
|
|
329
|
+
submittedAt: string;
|
|
330
|
+
}[];
|
|
331
|
+
key: string;
|
|
332
|
+
type: import('../utils/surveyEngine').CISurveyQuestionType;
|
|
333
|
+
title: string | Record<string, string>;
|
|
334
|
+
required: boolean;
|
|
335
|
+
hasConditions: boolean;
|
|
336
|
+
} | {
|
|
337
|
+
answeredCount: number;
|
|
338
|
+
min: number;
|
|
339
|
+
max: number;
|
|
340
|
+
lowLabel: string | Record<string, string>;
|
|
341
|
+
highLabel: string | Record<string, string>;
|
|
342
|
+
average: number;
|
|
343
|
+
distribution: {
|
|
344
|
+
value: number;
|
|
345
|
+
count: number;
|
|
346
|
+
percentage: number;
|
|
347
|
+
}[];
|
|
348
|
+
npsBreakdown: {
|
|
349
|
+
score: number;
|
|
350
|
+
promoters: number;
|
|
351
|
+
passives: number;
|
|
352
|
+
detractors: number;
|
|
353
|
+
promotersPct: number;
|
|
354
|
+
passivesPct: number;
|
|
355
|
+
detractorsPct: number;
|
|
356
|
+
};
|
|
357
|
+
key: string;
|
|
358
|
+
type: import('../utils/surveyEngine').CISurveyQuestionType;
|
|
359
|
+
title: string | Record<string, string>;
|
|
360
|
+
required: boolean;
|
|
361
|
+
hasConditions: boolean;
|
|
362
|
+
} | {
|
|
363
|
+
answeredCount: number;
|
|
364
|
+
rowsBreakdown: {
|
|
365
|
+
rowId: string;
|
|
366
|
+
labels: Record<string, string>;
|
|
367
|
+
total: number;
|
|
368
|
+
columns: {
|
|
369
|
+
colId: string;
|
|
370
|
+
labels: Record<string, string>;
|
|
371
|
+
count: number;
|
|
372
|
+
percentage: number;
|
|
373
|
+
}[];
|
|
374
|
+
}[];
|
|
375
|
+
key: string;
|
|
376
|
+
type: import('../utils/surveyEngine').CISurveyQuestionType;
|
|
377
|
+
title: string | Record<string, string>;
|
|
378
|
+
required: boolean;
|
|
379
|
+
hasConditions: boolean;
|
|
380
|
+
} | {
|
|
381
|
+
answeredCount: number;
|
|
382
|
+
rankingBreakdown: {
|
|
383
|
+
id: string;
|
|
384
|
+
labels: Record<string, string>;
|
|
385
|
+
averageRank: number;
|
|
386
|
+
bordaPoints: number;
|
|
387
|
+
scorePercentage: number;
|
|
388
|
+
firstPlaceCount: number;
|
|
389
|
+
firstPlacePercentage: number;
|
|
390
|
+
}[];
|
|
391
|
+
key: string;
|
|
392
|
+
type: import('../utils/surveyEngine').CISurveyQuestionType;
|
|
393
|
+
title: string | Record<string, string>;
|
|
394
|
+
required: boolean;
|
|
395
|
+
hasConditions: boolean;
|
|
396
|
+
} | {
|
|
397
|
+
answeredCount: number;
|
|
398
|
+
acceptedCount: number;
|
|
399
|
+
acceptedPercentage: number;
|
|
400
|
+
key: string;
|
|
401
|
+
type: import('../utils/surveyEngine').CISurveyQuestionType;
|
|
402
|
+
title: string | Record<string, string>;
|
|
403
|
+
required: boolean;
|
|
404
|
+
hasConditions: boolean;
|
|
405
|
+
} | {
|
|
406
|
+
answeredCount: number;
|
|
407
|
+
textResponses: {
|
|
408
|
+
id: any;
|
|
409
|
+
text: string;
|
|
410
|
+
locale: string;
|
|
411
|
+
submittedAt: string;
|
|
412
|
+
npsValue?: number | null;
|
|
413
|
+
}[];
|
|
414
|
+
key: string;
|
|
415
|
+
type: import('../utils/surveyEngine').CISurveyQuestionType;
|
|
416
|
+
title: string | Record<string, string>;
|
|
417
|
+
required: boolean;
|
|
418
|
+
hasConditions: boolean;
|
|
419
|
+
})[];
|
|
420
|
+
survey: any;
|
|
421
|
+
}>;
|
|
422
|
+
listResponses(idOrSlug: string | number, limit?: number): Promise<any>;
|
|
423
|
+
exportResponses(idOrSlug: string | number, options?: {
|
|
424
|
+
format?: "csv" | "json";
|
|
425
|
+
locale?: import('../utils/formValidator').ValidationLocale;
|
|
426
|
+
from?: string;
|
|
427
|
+
to?: string;
|
|
428
|
+
}): Promise<{
|
|
429
|
+
filename: string;
|
|
430
|
+
contentType: string;
|
|
431
|
+
body: string;
|
|
432
|
+
}>;
|
|
433
|
+
};
|
|
50
434
|
};
|
|
51
435
|
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type ValidationLocale = string;
|
|
2
|
+
export interface CIFieldDefinition {
|
|
3
|
+
name: string;
|
|
4
|
+
field_type: 'input' | 'emailInput' | 'telInput' | 'textArea' | 'numeric' | 'selectGroup' | 'radioGroup' | 'checkboxGroup' | 'switchBox' | string;
|
|
5
|
+
alias?: string | Record<string, string>;
|
|
6
|
+
placeholder?: string | Record<string, string>;
|
|
7
|
+
hint?: string | Record<string, string>;
|
|
8
|
+
validation?: string | Record<string, string>;
|
|
9
|
+
options?: Record<string, any>;
|
|
10
|
+
}
|
|
11
|
+
export declare function splitValidationRules(validationStr?: string | null): string[];
|
|
12
|
+
export declare function resolveLocalizedText(val: any, locale?: ValidationLocale, fallback?: string): string;
|
|
13
|
+
export declare function isEmptyFieldValue(value: any): boolean;
|
|
14
|
+
export declare function validateSingleField(value: any, field: CIFieldDefinition, allData?: Record<string, any>, locale?: ValidationLocale): string[];
|
|
15
|
+
export declare function validateFormSubmission(fieldsMap: Record<string, CIFieldDefinition>, payload: Record<string, any>, locale?: ValidationLocale): {
|
|
16
|
+
valid: boolean;
|
|
17
|
+
errors: Record<string, string[]>;
|
|
18
|
+
};
|
|
19
|
+
export declare function verifyRecaptchaToken(token: string | undefined | null, secretKey: string, remoteIp?: string): Promise<boolean>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { CIFieldDefinition, ValidationLocale } from './formValidator';
|
|
2
|
+
export interface CIMailConfig {
|
|
3
|
+
driver?: 'env' | 'mailtrap' | 'mailgun' | 'smtp' | 'strapi' | string;
|
|
4
|
+
from?: string;
|
|
5
|
+
fromName?: string;
|
|
6
|
+
apiKey?: string;
|
|
7
|
+
inboxId?: string;
|
|
8
|
+
domain?: string;
|
|
9
|
+
apiHost?: string;
|
|
10
|
+
host?: string;
|
|
11
|
+
port?: number | string;
|
|
12
|
+
username?: string;
|
|
13
|
+
password?: string;
|
|
14
|
+
encryption?: 'tls' | 'ssl' | 'none' | string;
|
|
15
|
+
}
|
|
16
|
+
export interface SendFormMailParams {
|
|
17
|
+
strapi?: any;
|
|
18
|
+
form: {
|
|
19
|
+
title: string;
|
|
20
|
+
to?: string;
|
|
21
|
+
subject?: string;
|
|
22
|
+
fields?: Record<string, CIFieldDefinition>;
|
|
23
|
+
mailConfig?: CIMailConfig | null;
|
|
24
|
+
};
|
|
25
|
+
data: Record<string, any>;
|
|
26
|
+
meta?: {
|
|
27
|
+
ip?: string;
|
|
28
|
+
userAgent?: string;
|
|
29
|
+
locale?: ValidationLocale;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export declare function renderContentFormMailHtml(params: SendFormMailParams): {
|
|
33
|
+
html: string;
|
|
34
|
+
text: string;
|
|
35
|
+
};
|
|
36
|
+
export declare function sendDynamicFormMail(params: SendFormMailParams): Promise<{
|
|
37
|
+
sent: boolean;
|
|
38
|
+
driver: string;
|
|
39
|
+
detail?: any;
|
|
40
|
+
error?: string;
|
|
41
|
+
}>;
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { ValidationLocale } from './formValidator';
|
|
2
|
+
export type CISurveyQuestionType = 'single_choice' | 'multiple_choice' | 'dropdown' | 'image_choice' | 'star_rating' | 'nps' | 'likert_scale' | 'matrix_single' | 'ranking' | 'short_text' | 'long_text' | 'statement' | 'consent';
|
|
3
|
+
export interface CISurveyOption {
|
|
4
|
+
id: string;
|
|
5
|
+
labels: Record<string, string>;
|
|
6
|
+
image?: any | null;
|
|
7
|
+
score?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface CISurveyConditionRule {
|
|
10
|
+
questionKey: string;
|
|
11
|
+
operator: 'equals' | 'not_equals' | 'includes' | 'not_includes' | 'gt' | 'gte' | 'lt' | 'lte' | 'is_answered' | 'is_empty';
|
|
12
|
+
value?: any;
|
|
13
|
+
}
|
|
14
|
+
export interface CISurveyConditionGroup {
|
|
15
|
+
match: 'all' | 'any';
|
|
16
|
+
rules: CISurveyConditionRule[];
|
|
17
|
+
}
|
|
18
|
+
export interface CISurveyStep {
|
|
19
|
+
id: string;
|
|
20
|
+
title: Record<string, string> | string;
|
|
21
|
+
description?: Record<string, string> | string;
|
|
22
|
+
conditions?: CISurveyConditionGroup | null;
|
|
23
|
+
}
|
|
24
|
+
export interface CISurveyQuestion {
|
|
25
|
+
key: string;
|
|
26
|
+
stepId?: string;
|
|
27
|
+
type: CISurveyQuestionType;
|
|
28
|
+
title: Record<string, string> | string;
|
|
29
|
+
description?: Record<string, string> | string;
|
|
30
|
+
placeholder?: Record<string, string> | string;
|
|
31
|
+
required?: boolean;
|
|
32
|
+
validation?: string;
|
|
33
|
+
allowOther?: boolean;
|
|
34
|
+
otherLabel?: Record<string, string> | string;
|
|
35
|
+
shuffleOptions?: boolean;
|
|
36
|
+
inline?: boolean;
|
|
37
|
+
minSelections?: number;
|
|
38
|
+
maxSelections?: number;
|
|
39
|
+
maxStars?: number;
|
|
40
|
+
scaleMin?: number;
|
|
41
|
+
scaleMax?: number;
|
|
42
|
+
lowLabel?: Record<string, string> | string;
|
|
43
|
+
highLabel?: Record<string, string> | string;
|
|
44
|
+
options?: CISurveyOption[];
|
|
45
|
+
matrixRows?: CISurveyOption[];
|
|
46
|
+
matrixColumns?: CISurveyOption[];
|
|
47
|
+
conditions?: CISurveyConditionGroup | null;
|
|
48
|
+
}
|
|
49
|
+
export interface CISurveyDefinition {
|
|
50
|
+
id?: number | string;
|
|
51
|
+
documentId?: string;
|
|
52
|
+
_id?: string;
|
|
53
|
+
title: string;
|
|
54
|
+
titleI18n?: Record<string, string>;
|
|
55
|
+
slug: string;
|
|
56
|
+
description?: Record<string, string> | string;
|
|
57
|
+
status?: 'draft' | 'published' | 'closed';
|
|
58
|
+
displayMode?: 'quick_poll' | 'single_page' | 'multi_step';
|
|
59
|
+
startsAt?: string | null;
|
|
60
|
+
endsAt?: string | null;
|
|
61
|
+
quotaLimit?: number | null;
|
|
62
|
+
submissionPolicy?: 'unlimited' | 'one_per_voter' | 'one_per_token';
|
|
63
|
+
anonymizeIp?: boolean;
|
|
64
|
+
showPublicResults?: 'never' | 'after_vote' | 'always';
|
|
65
|
+
allowBackNavigation?: boolean;
|
|
66
|
+
showProgressBar?: boolean;
|
|
67
|
+
useRecaptcha?: boolean;
|
|
68
|
+
recaptchaSiteKey?: string;
|
|
69
|
+
recaptchaSecretKey?: string;
|
|
70
|
+
mailConfig?: any;
|
|
71
|
+
steps?: CISurveyStep[];
|
|
72
|
+
questions: CISurveyQuestion[];
|
|
73
|
+
settings?: {
|
|
74
|
+
submitLabel?: Record<string, string> | string;
|
|
75
|
+
nextLabel?: Record<string, string> | string;
|
|
76
|
+
prevLabel?: Record<string, string> | string;
|
|
77
|
+
thankYouTitle?: Record<string, string> | string;
|
|
78
|
+
thankYouMessage?: Record<string, string> | string;
|
|
79
|
+
alreadyVotedMessage?: Record<string, string> | string;
|
|
80
|
+
closedMessage?: Record<string, string> | string;
|
|
81
|
+
redirectUrl?: string;
|
|
82
|
+
notifyEmails?: string;
|
|
83
|
+
[key: string]: any;
|
|
84
|
+
};
|
|
85
|
+
version?: number;
|
|
86
|
+
}
|
|
87
|
+
export declare function evaluateSurveyConditions(conditions: CISurveyConditionGroup | null | undefined, answers: Record<string, any>): boolean;
|
|
88
|
+
export declare function isQuestionVisible(question: CISurveyQuestion, survey: CISurveyDefinition, answers: Record<string, any>): boolean;
|
|
89
|
+
export declare function validateSurveySubmission(survey: CISurveyDefinition, answers: Record<string, any>, otherTexts?: Record<string, string>, locale?: ValidationLocale): {
|
|
90
|
+
valid: boolean;
|
|
91
|
+
errors: Record<string, string[]>;
|
|
92
|
+
};
|
|
93
|
+
export declare function computeVoterHash(surveySlug: string, ip: string, userAgent: string, voterToken?: string): string;
|
|
94
|
+
export declare function computeResponseMetrics(survey: CISurveyDefinition, answers: Record<string, any>): {
|
|
95
|
+
score: number | null;
|
|
96
|
+
npsValue: number | null;
|
|
97
|
+
npsCategory: 'promoter' | 'passive' | 'detractor' | null;
|
|
98
|
+
};
|
|
99
|
+
export interface CISurveyAnalyticsFilter {
|
|
100
|
+
from?: string;
|
|
101
|
+
to?: string;
|
|
102
|
+
locale?: string;
|
|
103
|
+
}
|
|
104
|
+
export declare function computeSurveyAnalytics(survey: CISurveyDefinition, rawResponses: any[], filter?: CISurveyAnalyticsFilter): {
|
|
105
|
+
summary: {
|
|
106
|
+
totalResponses: number;
|
|
107
|
+
unfilteredTotalResponses: number;
|
|
108
|
+
quotaLimit: number;
|
|
109
|
+
quotaPercentage: number;
|
|
110
|
+
avgDurationSeconds: number;
|
|
111
|
+
medianDurationSeconds: number;
|
|
112
|
+
lastSubmittedAt: string;
|
|
113
|
+
localeBreakdown: {
|
|
114
|
+
locale: string;
|
|
115
|
+
count: number;
|
|
116
|
+
percentage: number;
|
|
117
|
+
}[];
|
|
118
|
+
dailyTrend: {
|
|
119
|
+
date: string;
|
|
120
|
+
count: number;
|
|
121
|
+
}[];
|
|
122
|
+
nps: {
|
|
123
|
+
hasNps: boolean;
|
|
124
|
+
score: number;
|
|
125
|
+
promoters: number;
|
|
126
|
+
passives: number;
|
|
127
|
+
detractors: number;
|
|
128
|
+
promotersPct: number;
|
|
129
|
+
passivesPct: number;
|
|
130
|
+
detractorsPct: number;
|
|
131
|
+
totalNpsResponses: number;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
questionStats: ({
|
|
135
|
+
answeredCount: number;
|
|
136
|
+
optionsBreakdown: {
|
|
137
|
+
id: string;
|
|
138
|
+
labels: Record<string, string>;
|
|
139
|
+
image: any;
|
|
140
|
+
count: number;
|
|
141
|
+
percentage: number;
|
|
142
|
+
}[];
|
|
143
|
+
otherSamples: {
|
|
144
|
+
text: string;
|
|
145
|
+
locale: string;
|
|
146
|
+
submittedAt: string;
|
|
147
|
+
}[];
|
|
148
|
+
key: string;
|
|
149
|
+
type: CISurveyQuestionType;
|
|
150
|
+
title: string | Record<string, string>;
|
|
151
|
+
required: boolean;
|
|
152
|
+
hasConditions: boolean;
|
|
153
|
+
} | {
|
|
154
|
+
answeredCount: number;
|
|
155
|
+
min: number;
|
|
156
|
+
max: number;
|
|
157
|
+
lowLabel: string | Record<string, string>;
|
|
158
|
+
highLabel: string | Record<string, string>;
|
|
159
|
+
average: number;
|
|
160
|
+
distribution: {
|
|
161
|
+
value: number;
|
|
162
|
+
count: number;
|
|
163
|
+
percentage: number;
|
|
164
|
+
}[];
|
|
165
|
+
npsBreakdown: {
|
|
166
|
+
score: number;
|
|
167
|
+
promoters: number;
|
|
168
|
+
passives: number;
|
|
169
|
+
detractors: number;
|
|
170
|
+
promotersPct: number;
|
|
171
|
+
passivesPct: number;
|
|
172
|
+
detractorsPct: number;
|
|
173
|
+
};
|
|
174
|
+
key: string;
|
|
175
|
+
type: CISurveyQuestionType;
|
|
176
|
+
title: string | Record<string, string>;
|
|
177
|
+
required: boolean;
|
|
178
|
+
hasConditions: boolean;
|
|
179
|
+
} | {
|
|
180
|
+
answeredCount: number;
|
|
181
|
+
rowsBreakdown: {
|
|
182
|
+
rowId: string;
|
|
183
|
+
labels: Record<string, string>;
|
|
184
|
+
total: number;
|
|
185
|
+
columns: {
|
|
186
|
+
colId: string;
|
|
187
|
+
labels: Record<string, string>;
|
|
188
|
+
count: number;
|
|
189
|
+
percentage: number;
|
|
190
|
+
}[];
|
|
191
|
+
}[];
|
|
192
|
+
key: string;
|
|
193
|
+
type: CISurveyQuestionType;
|
|
194
|
+
title: string | Record<string, string>;
|
|
195
|
+
required: boolean;
|
|
196
|
+
hasConditions: boolean;
|
|
197
|
+
} | {
|
|
198
|
+
answeredCount: number;
|
|
199
|
+
rankingBreakdown: {
|
|
200
|
+
id: string;
|
|
201
|
+
labels: Record<string, string>;
|
|
202
|
+
averageRank: number;
|
|
203
|
+
bordaPoints: number;
|
|
204
|
+
scorePercentage: number;
|
|
205
|
+
firstPlaceCount: number;
|
|
206
|
+
firstPlacePercentage: number;
|
|
207
|
+
}[];
|
|
208
|
+
key: string;
|
|
209
|
+
type: CISurveyQuestionType;
|
|
210
|
+
title: string | Record<string, string>;
|
|
211
|
+
required: boolean;
|
|
212
|
+
hasConditions: boolean;
|
|
213
|
+
} | {
|
|
214
|
+
answeredCount: number;
|
|
215
|
+
acceptedCount: number;
|
|
216
|
+
acceptedPercentage: number;
|
|
217
|
+
key: string;
|
|
218
|
+
type: CISurveyQuestionType;
|
|
219
|
+
title: string | Record<string, string>;
|
|
220
|
+
required: boolean;
|
|
221
|
+
hasConditions: boolean;
|
|
222
|
+
} | {
|
|
223
|
+
answeredCount: number;
|
|
224
|
+
textResponses: {
|
|
225
|
+
id: any;
|
|
226
|
+
text: string;
|
|
227
|
+
locale: string;
|
|
228
|
+
submittedAt: string;
|
|
229
|
+
npsValue?: number | null;
|
|
230
|
+
}[];
|
|
231
|
+
key: string;
|
|
232
|
+
type: CISurveyQuestionType;
|
|
233
|
+
title: string | Record<string, string>;
|
|
234
|
+
required: boolean;
|
|
235
|
+
hasConditions: boolean;
|
|
236
|
+
})[];
|
|
237
|
+
};
|
|
238
|
+
export declare function computePublicSurveyResults(survey: CISurveyDefinition, rawResponses: any[]): {
|
|
239
|
+
totalResponses: number;
|
|
240
|
+
questions: {
|
|
241
|
+
key: any;
|
|
242
|
+
type: any;
|
|
243
|
+
title: any;
|
|
244
|
+
answeredCount: any;
|
|
245
|
+
optionsBreakdown: any;
|
|
246
|
+
average: any;
|
|
247
|
+
distribution: any;
|
|
248
|
+
npsBreakdown: any;
|
|
249
|
+
rankingBreakdown: any;
|
|
250
|
+
}[];
|
|
251
|
+
};
|
|
252
|
+
export declare function exportSurveyResponsesToCsv(survey: CISurveyDefinition, rawResponses: any[], locale?: ValidationLocale): string;
|