@ozguraltan/strapi-content-input 1.0.11 → 1.0.21

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 (57) hide show
  1. package/README.md +373 -62
  2. package/dist/admin/AnalyticsHubPage-0p0Mx4AU.js +688 -0
  3. package/dist/admin/AnalyticsHubPage-DsrcGI_Y.mjs +688 -0
  4. package/dist/admin/ContentInputField-7rWLSx_7.js +31864 -0
  5. package/dist/admin/ContentInputField-CHXrzvE-.mjs +31844 -0
  6. package/dist/admin/SurveyWidgetEditor-BVN6X_3G.mjs +10811 -0
  7. package/dist/admin/SurveyWidgetEditor-BmgYQaQS.js +10813 -0
  8. package/dist/admin/{en-DF-a59T_.js → en-BZg845za.js} +2 -1
  9. package/dist/admin/{en-D7v9nv9J.mjs → en-C9LN2PJY.mjs} +2 -1
  10. package/dist/admin/{index-DKVaYg3t.js → index-CZAwXCFH.js} +53 -4
  11. package/dist/admin/{index-DGBgjAUa.mjs → index-hFIuYqu5.mjs} +53 -4
  12. package/dist/admin/index.js +1 -1
  13. package/dist/admin/index.mjs +1 -1
  14. package/dist/admin/src/components/analytics/SurveyAnalyticsView.d.ts +6 -0
  15. package/dist/admin/src/components/color-codes/ColorCodesManager.d.ts +10 -0
  16. package/dist/admin/src/components/common/CIAspectRatioField.d.ts +35 -0
  17. package/dist/admin/src/components/common/CIColorField.d.ts +13 -0
  18. package/dist/admin/src/components/widgets/ContentFormWidgetEditor.d.ts +81 -0
  19. package/dist/admin/src/components/widgets/CustomCardWidgetEditor.d.ts +83 -0
  20. package/dist/admin/src/components/widgets/DataTableWidgetEditor.d.ts +65 -0
  21. package/dist/admin/src/components/widgets/EntityCardWidgetEditor.d.ts +56 -0
  22. package/dist/admin/src/components/widgets/HeroSliderStage.d.ts +153 -0
  23. package/dist/admin/src/components/widgets/HeroSliderWidgetEditor.d.ts +21 -0
  24. package/dist/admin/src/components/widgets/StrapiMediaPicker.d.ts +2 -0
  25. package/dist/admin/src/components/widgets/SurveyWidgetEditor.d.ts +91 -0
  26. package/dist/admin/src/core/colorUtils.d.ts +30 -0
  27. package/dist/admin/src/core/sampleData.d.ts +2 -1
  28. package/dist/admin/src/core/useColorCodes.d.ts +43 -0
  29. package/dist/admin/src/core/useStrapiLocales.d.ts +13 -0
  30. package/dist/admin/src/pages/AnalyticsHubPage.d.ts +3 -0
  31. package/dist/admin/{tr-ByHzf64V.mjs → tr-MtQFY92V.mjs} +2 -1
  32. package/dist/admin/{tr-SNvSmKZQ.js → tr-ZEmzAvKR.js} +2 -1
  33. package/dist/server/index.js +5043 -57
  34. package/dist/server/index.mjs +5043 -57
  35. package/dist/server/src/bootstrap.d.ts +1 -1
  36. package/dist/server/src/content-types/ci-color-palette/schema.json.d.ts +52 -0
  37. package/dist/server/src/content-types/ci-form/schema.json.d.ts +77 -0
  38. package/dist/server/src/content-types/ci-form-submission/schema.json.d.ts +54 -0
  39. package/dist/server/src/content-types/ci-survey/schema.json.d.ts +111 -0
  40. package/dist/server/src/content-types/ci-survey-response/schema.json.d.ts +81 -0
  41. package/dist/server/src/content-types/index.d.ts +365 -0
  42. package/dist/server/src/controllers/ci-color.d.ts +14 -0
  43. package/dist/server/src/controllers/ci-form.d.ts +17 -0
  44. package/dist/server/src/controllers/ci-survey.d.ts +18 -0
  45. package/dist/server/src/controllers/index.d.ts +43 -0
  46. package/dist/server/src/index.d.ts +850 -1
  47. package/dist/server/src/services/ci-color.d.ts +127 -0
  48. package/dist/server/src/services/ci-form.d.ts +250 -0
  49. package/dist/server/src/services/ci-survey.d.ts +296 -0
  50. package/dist/server/src/services/index.d.ts +441 -0
  51. package/dist/server/src/utils/formValidator.d.ts +19 -0
  52. package/dist/server/src/utils/mailer.d.ts +42 -0
  53. package/dist/server/src/utils/surveyEngine.d.ts +252 -0
  54. package/dist/server/src/utils/surveySeedData.d.ts +4 -0
  55. package/package.json +3 -2
  56. package/dist/admin/ContentInputField-BGJmgYGQ.js +0 -19919
  57. package/dist/admin/ContentInputField-BLiKYZ7b.mjs +0 -19916
@@ -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;
@@ -0,0 +1,4 @@
1
+ import { CISurveyDefinition } from './surveyEngine';
2
+ export declare const DEFAULT_SEED_SURVEYS: CISurveyDefinition[];
3
+ export declare function generateSeedSurveyResponses(surveyMapBySlug: Record<string, any>): any[];
4
+ export declare function generateSampleFormSubmissions(formEntry: any): any[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ozguraltan/strapi-content-input",
3
- "version": "1.0.11",
3
+ "version": "1.0.21",
4
4
  "description": "Locomotive CMS ContentInput visual page/content builder ported to Strapi v5 as a native JSONB Custom Field plugin.",
5
5
  "license": "MIT",
6
6
  "author": "Ozgur Altan <ozguraltan05@gmail.com>",
@@ -70,7 +70,8 @@
70
70
  "@strapi/icons": "^2.0.0",
71
71
  "lodash": "^4.17.21",
72
72
  "react-intl": "^6.6.2",
73
- "swiper": "^14.4.0"
73
+ "swiper": "^14.4.0",
74
+ "xlsx": "^0.18.5"
74
75
  },
75
76
  "devDependencies": {
76
77
  "@strapi/sdk-plugin": "^6.1.1",