@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.
Files changed (41) hide show
  1. package/README.md +249 -45
  2. package/dist/admin/AnalyticsHubPage-DNREITPq.js +637 -0
  3. package/dist/admin/AnalyticsHubPage-Dj4roAe0.mjs +637 -0
  4. package/dist/admin/{ContentInputField-BGJmgYGQ.js → ContentInputField-2hk9xG8p.js} +5880 -4756
  5. package/dist/admin/{ContentInputField-BLiKYZ7b.mjs → ContentInputField-Ko-r12jl.mjs} +5743 -4618
  6. package/dist/admin/SurveyWidgetEditor-B1S83aBE.mjs +7956 -0
  7. package/dist/admin/SurveyWidgetEditor-B3F4DE5r.js +7957 -0
  8. package/dist/admin/{en-D7v9nv9J.mjs → en-DnLdDKyq.mjs} +2 -1
  9. package/dist/admin/{en-DF-a59T_.js → en-bneQpRJa.js} +2 -1
  10. package/dist/admin/{index-DKVaYg3t.js → index-B4FpXxnK.js} +43 -4
  11. package/dist/admin/{index-DGBgjAUa.mjs → index-gn-4eO6g.mjs} +43 -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/widgets/ContentFormWidgetEditor.d.ts +81 -0
  16. package/dist/admin/src/components/widgets/EntityCardWidgetEditor.d.ts +46 -0
  17. package/dist/admin/src/components/widgets/SurveyWidgetEditor.d.ts +91 -0
  18. package/dist/admin/src/core/useStrapiLocales.d.ts +13 -0
  19. package/dist/admin/src/pages/AnalyticsHubPage.d.ts +3 -0
  20. package/dist/admin/{tr-ByHzf64V.mjs → tr-00QqO0E7.mjs} +2 -1
  21. package/dist/admin/{tr-SNvSmKZQ.js → tr-O0nhB9er.js} +2 -1
  22. package/dist/server/index.js +4148 -46
  23. package/dist/server/index.mjs +4148 -46
  24. package/dist/server/src/bootstrap.d.ts +1 -1
  25. package/dist/server/src/content-types/ci-form/schema.json.d.ts +77 -0
  26. package/dist/server/src/content-types/ci-form-submission/schema.json.d.ts +54 -0
  27. package/dist/server/src/content-types/ci-survey/schema.json.d.ts +111 -0
  28. package/dist/server/src/content-types/ci-survey-response/schema.json.d.ts +81 -0
  29. package/dist/server/src/content-types/index.d.ts +315 -0
  30. package/dist/server/src/controllers/ci-form.d.ts +17 -0
  31. package/dist/server/src/controllers/ci-survey.d.ts +18 -0
  32. package/dist/server/src/controllers/index.d.ts +31 -0
  33. package/dist/server/src/index.d.ts +731 -1
  34. package/dist/server/src/services/ci-form.d.ts +250 -0
  35. package/dist/server/src/services/ci-survey.d.ts +296 -0
  36. package/dist/server/src/services/index.d.ts +384 -0
  37. package/dist/server/src/utils/formValidator.d.ts +19 -0
  38. package/dist/server/src/utils/mailer.d.ts +41 -0
  39. package/dist/server/src/utils/surveyEngine.d.ts +252 -0
  40. package/dist/server/src/utils/surveySeedData.d.ts +4 -0
  41. package/package.json +1 -1
@@ -0,0 +1,637 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useState, useCallback, useEffect } from "react";
3
+ import { useFetchClient } from "@strapi/strapi/admin";
4
+ import { M as MaterialIcon } from "./index-gn-4eO6g.mjs";
5
+ import { p as useStrapiLocales, y as getInitialLocale, z as createBlankSurveyDraft, A as SurveyAnalyticsView, B as SurveyStudioModal, C as persistLocale } from "./SurveyWidgetEditor-B1S83aBE.mjs";
6
+ const AnalyticsHubPage = () => {
7
+ const { get, post } = useFetchClient();
8
+ const { locales: strapiLocales } = useStrapiLocales();
9
+ const [uiLocale, setUiLocale] = useState(() => getInitialLocale());
10
+ const tr = uiLocale === "tr";
11
+ const [section, setSection] = useState("surveys");
12
+ const [surveys, setSurveys] = useState([]);
13
+ const [selectedSurveySlug, setSelectedSurveySlug] = useState("showcase_dx_survey");
14
+ const [analyticsRefreshKey, setAnalyticsRefreshKey] = useState(0);
15
+ const [reseeding, setReseeding] = useState(false);
16
+ const [studioOpen, setStudioOpen] = useState(false);
17
+ const [studioTarget, setStudioTarget] = useState(
18
+ () => createBlankSurveyDraft()
19
+ );
20
+ const [forms, setForms] = useState([]);
21
+ const [selectedFormSlug, setSelectedFormSlug] = useState("all");
22
+ const [submissions, setSubmissions] = useState([]);
23
+ const [subSearch, setSubSearch] = useState("");
24
+ const loadSurveys = useCallback(async () => {
25
+ try {
26
+ const { data } = await get("/content-input/surveys");
27
+ const list = Array.isArray(data) ? data : [];
28
+ setSurveys(list);
29
+ if (list.length > 0 && !list.some((s) => s.slug === selectedSurveySlug)) {
30
+ setSelectedSurveySlug(list[0].slug);
31
+ }
32
+ } catch {
33
+ }
34
+ }, [get, selectedSurveySlug]);
35
+ const loadFormsAndSubmissions = useCallback(async () => {
36
+ try {
37
+ const [formsRes, subsRes] = await Promise.all([
38
+ get("/content-input/forms"),
39
+ get(
40
+ selectedFormSlug === "all" ? "/content-input/forms/submissions" : `/content-input/forms/${encodeURIComponent(selectedFormSlug)}/submissions`
41
+ )
42
+ ]);
43
+ setForms(Array.isArray(formsRes?.data) ? formsRes.data : []);
44
+ setSubmissions(Array.isArray(subsRes?.data) ? subsRes.data : []);
45
+ } catch {
46
+ }
47
+ }, [get, selectedFormSlug]);
48
+ useEffect(() => {
49
+ loadSurveys();
50
+ }, [loadSurveys]);
51
+ useEffect(() => {
52
+ if (section === "forms") {
53
+ loadFormsAndSubmissions();
54
+ }
55
+ }, [section, loadFormsAndSubmissions]);
56
+ const handleToggleLocale = (nextLoc) => {
57
+ setUiLocale(nextLoc);
58
+ persistLocale(nextLoc);
59
+ };
60
+ const handleReseedDemo = async () => {
61
+ setReseeding(true);
62
+ try {
63
+ await post("/content-input/surveys/reseed-demo", {});
64
+ await loadSurveys();
65
+ if (section === "forms") await loadFormsAndSubmissions();
66
+ setAnalyticsRefreshKey((k) => k + 1);
67
+ } catch {
68
+ } finally {
69
+ setReseeding(false);
70
+ }
71
+ };
72
+ const exportFormSubmissionsCsv = () => {
73
+ if (submissions.length === 0) return;
74
+ const dataKeys = Array.from(
75
+ new Set(
76
+ submissions.flatMap(
77
+ (s) => s.data && typeof s.data === "object" ? Object.keys(s.data) : []
78
+ )
79
+ )
80
+ );
81
+ const headers = ["ID", "Form", "Created At", "Mail Sent", ...dataKeys];
82
+ const esc = (v) => {
83
+ const str = v === null || v === void 0 ? "" : Array.isArray(v) ? v.join("; ") : typeof v === "object" ? JSON.stringify(v) : String(v);
84
+ return /[",\r\n]/.test(str) ? `"${str.replace(/"/g, '""')}"` : str;
85
+ };
86
+ const lines = [headers.map(esc).join(",")];
87
+ for (const s of submissions) {
88
+ const row = [
89
+ s.id || s.documentId || "",
90
+ s.formTitle || s.formSlug || "",
91
+ s.createdAt || "",
92
+ s.mailSent ? "Yes" : "No",
93
+ ...dataKeys.map((k) => s.data?.[k])
94
+ ];
95
+ lines.push(row.map(esc).join(","));
96
+ }
97
+ const blob = new Blob([`\uFEFF${lines.join("\r\n")}`], {
98
+ type: "text/csv;charset=utf-8;"
99
+ });
100
+ const url = URL.createObjectURL(blob);
101
+ const a = document.createElement("a");
102
+ a.href = url;
103
+ a.download = `form-submissions-${selectedFormSlug}.csv`;
104
+ document.body.appendChild(a);
105
+ a.click();
106
+ document.body.removeChild(a);
107
+ URL.revokeObjectURL(url);
108
+ };
109
+ const currentSurvey = surveys.find((s) => s.slug === selectedSurveySlug) || surveys[0] || null;
110
+ const totalAllResponses = surveys.reduce((acc, s) => acc + (s.responseCount || 0), 0);
111
+ return /* @__PURE__ */ jsxs(
112
+ "div",
113
+ {
114
+ style: {
115
+ minHeight: "100vh",
116
+ background: "#f1f5f9",
117
+ color: "#0f172a",
118
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif"
119
+ },
120
+ children: [
121
+ /* @__PURE__ */ jsxs(
122
+ "div",
123
+ {
124
+ style: {
125
+ background: "linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%)",
126
+ color: "#ffffff",
127
+ padding: "22px 28px",
128
+ display: "flex",
129
+ alignItems: "center",
130
+ justifyContent: "space-between",
131
+ flexWrap: "wrap",
132
+ gap: 16
133
+ },
134
+ children: [
135
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 14 }, children: [
136
+ /* @__PURE__ */ jsx(
137
+ "div",
138
+ {
139
+ style: {
140
+ width: 44,
141
+ height: 44,
142
+ borderRadius: 10,
143
+ background: "rgba(56, 189, 248, 0.18)",
144
+ border: "1px solid rgba(56, 189, 248, 0.4)",
145
+ display: "flex",
146
+ alignItems: "center",
147
+ justifyContent: "center"
148
+ },
149
+ children: /* @__PURE__ */ jsx(MaterialIcon, { name: "bar_chart", size: 24, color: "#38bdf8" })
150
+ }
151
+ ),
152
+ /* @__PURE__ */ jsxs("div", { children: [
153
+ /* @__PURE__ */ jsx("h1", { style: { margin: 0, fontSize: 20, fontWeight: 800, letterSpacing: "-0.01em" }, children: tr ? "ContentInput — Anket & Form Analitik Merkezi" : "ContentInput — Surveys & Forms Analytics Hub" }),
154
+ /* @__PURE__ */ jsx("div", { style: { fontSize: 12, color: "#cbd5e1", marginTop: 3 }, children: tr ? `${surveys.length} Aktif Anket • ${totalAllResponses} Toplam Anket Yanıtı • Strapi i18n Dilleri: ${strapiLocales.map((l) => l.code.toUpperCase()).join(", ")}` : `${surveys.length} Active Surveys • ${totalAllResponses} Total Survey Responses • Strapi i18n Locales: ${strapiLocales.map((l) => l.code.toUpperCase()).join(", ")}` })
155
+ ] })
156
+ ] }),
157
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 10, flexWrap: "wrap" }, children: [
158
+ /* @__PURE__ */ jsxs(
159
+ "button",
160
+ {
161
+ type: "button",
162
+ onClick: () => {
163
+ setStudioTarget(createBlankSurveyDraft());
164
+ setStudioOpen(true);
165
+ },
166
+ style: {
167
+ padding: "8px 14px",
168
+ borderRadius: 8,
169
+ border: "none",
170
+ background: "#3b82f6",
171
+ color: "#ffffff",
172
+ fontSize: 12,
173
+ fontWeight: 700,
174
+ cursor: "pointer",
175
+ display: "inline-flex",
176
+ alignItems: "center",
177
+ gap: 6
178
+ },
179
+ children: [
180
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "add", size: 16, color: "#fff" }),
181
+ /* @__PURE__ */ jsx("span", { children: tr ? "Yeni Anket Oluştur" : "Create New Survey" })
182
+ ]
183
+ }
184
+ ),
185
+ /* @__PURE__ */ jsxs(
186
+ "button",
187
+ {
188
+ type: "button",
189
+ disabled: reseeding,
190
+ onClick: handleReseedDemo,
191
+ style: {
192
+ padding: "8px 12px",
193
+ borderRadius: 8,
194
+ border: "1px solid rgba(255,255,255,0.28)",
195
+ background: "rgba(255,255,255,0.08)",
196
+ color: "#e2e8f0",
197
+ fontSize: 11.5,
198
+ fontWeight: 600,
199
+ cursor: "pointer",
200
+ display: "inline-flex",
201
+ alignItems: "center",
202
+ gap: 6
203
+ },
204
+ title: tr ? "Örnek analiz veri kümesini (525 anket yanıtı + 20 form başvurusu) yeniler" : "Refreshes the 525-response correlated analytics dataset",
205
+ children: [
206
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "refresh", size: 15, color: "#38bdf8" }),
207
+ /* @__PURE__ */ jsx("span", { children: reseeding ? "..." : tr ? "Örnek Veriyi Yenile" : "Refresh Sample Data" })
208
+ ]
209
+ }
210
+ ),
211
+ /* @__PURE__ */ jsx(
212
+ "div",
213
+ {
214
+ style: {
215
+ display: "inline-flex",
216
+ borderRadius: 7,
217
+ overflow: "hidden",
218
+ border: "1px solid rgba(255,255,255,0.25)"
219
+ },
220
+ children: ["tr", "en"].map((loc) => /* @__PURE__ */ jsx(
221
+ "button",
222
+ {
223
+ type: "button",
224
+ onClick: () => handleToggleLocale(loc),
225
+ style: {
226
+ padding: "6px 10px",
227
+ border: "none",
228
+ background: uiLocale === loc ? "#ffffff" : "transparent",
229
+ color: uiLocale === loc ? "#0f172a" : "#cbd5e1",
230
+ fontSize: 11,
231
+ fontWeight: 800,
232
+ cursor: "pointer"
233
+ },
234
+ children: loc.toUpperCase()
235
+ },
236
+ loc
237
+ ))
238
+ }
239
+ )
240
+ ] })
241
+ ]
242
+ }
243
+ ),
244
+ /* @__PURE__ */ jsxs(
245
+ "div",
246
+ {
247
+ style: {
248
+ background: "#ffffff",
249
+ borderBottom: "1px solid #cbd5e1",
250
+ padding: "0 28px",
251
+ display: "flex",
252
+ gap: 8
253
+ },
254
+ children: [
255
+ /* @__PURE__ */ jsxs(
256
+ "button",
257
+ {
258
+ type: "button",
259
+ onClick: () => setSection("surveys"),
260
+ style: {
261
+ padding: "13px 18px",
262
+ border: "none",
263
+ borderBottom: section === "surveys" ? "3px solid #2563eb" : "3px solid transparent",
264
+ background: "transparent",
265
+ color: section === "surveys" ? "#1d4ed8" : "#475569",
266
+ fontSize: 13,
267
+ fontWeight: 700,
268
+ cursor: "pointer",
269
+ display: "inline-flex",
270
+ alignItems: "center",
271
+ gap: 7
272
+ },
273
+ children: [
274
+ /* @__PURE__ */ jsx(
275
+ MaterialIcon,
276
+ {
277
+ name: "poll",
278
+ size: 17,
279
+ color: section === "surveys" ? "#2563eb" : "#64748b"
280
+ }
281
+ ),
282
+ /* @__PURE__ */ jsx("span", { children: tr ? `Anket & Oylama Raporları (${surveys.length})` : `Surveys & Polls Analytics (${surveys.length})` })
283
+ ]
284
+ }
285
+ ),
286
+ /* @__PURE__ */ jsxs(
287
+ "button",
288
+ {
289
+ type: "button",
290
+ onClick: () => setSection("forms"),
291
+ style: {
292
+ padding: "13px 18px",
293
+ border: "none",
294
+ borderBottom: section === "forms" ? "3px solid #2563eb" : "3px solid transparent",
295
+ background: "transparent",
296
+ color: section === "forms" ? "#1d4ed8" : "#475569",
297
+ fontSize: 13,
298
+ fontWeight: 700,
299
+ cursor: "pointer",
300
+ display: "inline-flex",
301
+ alignItems: "center",
302
+ gap: 7
303
+ },
304
+ children: [
305
+ /* @__PURE__ */ jsx(
306
+ MaterialIcon,
307
+ {
308
+ name: "inbox",
309
+ size: 17,
310
+ color: section === "forms" ? "#2563eb" : "#64748b"
311
+ }
312
+ ),
313
+ /* @__PURE__ */ jsx("span", { children: tr ? "Dinamik Form Başvuruları" : "Dynamic Form Submissions" })
314
+ ]
315
+ }
316
+ )
317
+ ]
318
+ }
319
+ ),
320
+ section === "surveys" ? /* @__PURE__ */ jsxs(
321
+ "div",
322
+ {
323
+ style: {
324
+ padding: "22px 28px",
325
+ display: "grid",
326
+ gridTemplateColumns: "310px minmax(0, 1fr)",
327
+ gap: 20,
328
+ alignItems: "start"
329
+ },
330
+ children: [
331
+ /* @__PURE__ */ jsxs(
332
+ "div",
333
+ {
334
+ style: {
335
+ background: "#ffffff",
336
+ borderRadius: 12,
337
+ border: "1px solid #cbd5e1",
338
+ padding: 14,
339
+ display: "flex",
340
+ flexDirection: "column",
341
+ gap: 10
342
+ },
343
+ children: [
344
+ /* @__PURE__ */ jsx("div", { style: { fontSize: 12, fontWeight: 800, color: "#334155", padding: "2px 4px" }, children: tr ? "ANKET LİSTESİ" : "SURVEYS" }),
345
+ surveys.map((srv) => {
346
+ const active = srv.slug === (currentSurvey?.slug || "");
347
+ return /* @__PURE__ */ jsxs(
348
+ "div",
349
+ {
350
+ onClick: () => setSelectedSurveySlug(srv.slug),
351
+ style: {
352
+ padding: 12,
353
+ borderRadius: 10,
354
+ border: active ? "2px solid #2563eb" : "1px solid #e2e8f0",
355
+ background: active ? "#eff6ff" : "#f8fafc",
356
+ cursor: "pointer",
357
+ display: "flex",
358
+ flexDirection: "column",
359
+ gap: 6
360
+ },
361
+ children: [
362
+ /* @__PURE__ */ jsxs(
363
+ "div",
364
+ {
365
+ style: {
366
+ display: "flex",
367
+ alignItems: "center",
368
+ justifyContent: "space-between",
369
+ gap: 6
370
+ },
371
+ children: [
372
+ /* @__PURE__ */ jsx(
373
+ "span",
374
+ {
375
+ style: {
376
+ fontSize: 10,
377
+ fontWeight: 800,
378
+ padding: "2px 7px",
379
+ borderRadius: 10,
380
+ background: srv.status === "published" ? "#dcfce7" : srv.status === "closed" ? "#fee2e2" : "#fef3c7",
381
+ color: srv.status === "published" ? "#166534" : srv.status === "closed" ? "#991b1b" : "#92400e"
382
+ },
383
+ children: String(srv.status || "published").toUpperCase()
384
+ }
385
+ ),
386
+ /* @__PURE__ */ jsx("code", { style: { fontSize: 10, color: "#64748b" }, children: srv.displayMode })
387
+ ]
388
+ }
389
+ ),
390
+ /* @__PURE__ */ jsx("div", { style: { fontSize: 13, fontWeight: 700, color: "#0f172a" }, children: srv.title }),
391
+ /* @__PURE__ */ jsxs(
392
+ "div",
393
+ {
394
+ style: {
395
+ display: "flex",
396
+ alignItems: "center",
397
+ justifyContent: "space-between",
398
+ fontSize: 11,
399
+ color: "#475569"
400
+ },
401
+ children: [
402
+ /* @__PURE__ */ jsxs("span", { children: [
403
+ /* @__PURE__ */ jsx("strong", { children: srv.responseCount ?? 0 }),
404
+ " ",
405
+ tr ? "yanıt" : "responses"
406
+ ] }),
407
+ srv.npsScore !== null && srv.npsScore !== void 0 && /* @__PURE__ */ jsxs(
408
+ "span",
409
+ {
410
+ style: {
411
+ padding: "1px 7px",
412
+ borderRadius: 10,
413
+ background: "#ecfdf5",
414
+ color: "#047857",
415
+ fontWeight: 700,
416
+ fontSize: 10.5
417
+ },
418
+ children: [
419
+ "NPS: ",
420
+ srv.npsScore > 0 ? `+${srv.npsScore}` : srv.npsScore
421
+ ]
422
+ }
423
+ )
424
+ ]
425
+ }
426
+ )
427
+ ]
428
+ },
429
+ srv.slug
430
+ );
431
+ }),
432
+ currentSurvey && /* @__PURE__ */ jsxs(
433
+ "button",
434
+ {
435
+ type: "button",
436
+ onClick: () => {
437
+ setStudioTarget(currentSurvey);
438
+ setStudioOpen(true);
439
+ },
440
+ style: {
441
+ marginTop: 4,
442
+ padding: "9px 12px",
443
+ borderRadius: 8,
444
+ border: "1px solid #2563eb",
445
+ background: "#ffffff",
446
+ color: "#1d4ed8",
447
+ fontSize: 12,
448
+ fontWeight: 700,
449
+ cursor: "pointer",
450
+ display: "inline-flex",
451
+ alignItems: "center",
452
+ justifyContent: "center",
453
+ gap: 6
454
+ },
455
+ children: [
456
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "edit", size: 15, color: "#2563eb" }),
457
+ /* @__PURE__ */ jsx("span", { children: tr ? "Seçili Anketi Düzenle (Studio)" : "Edit Selected Survey (Studio)" })
458
+ ]
459
+ }
460
+ )
461
+ ]
462
+ }
463
+ ),
464
+ /* @__PURE__ */ jsx("div", { children: currentSurvey ? /* @__PURE__ */ jsx(
465
+ SurveyAnalyticsView,
466
+ {
467
+ surveySlugOrId: currentSurvey.slug,
468
+ uiLocale
469
+ },
470
+ `${currentSurvey.slug}-${analyticsRefreshKey}`
471
+ ) : /* @__PURE__ */ jsx("div", { style: { padding: 40, textAlign: "center", color: "#64748b" }, children: tr ? "Görüntülenecek anket seçin." : "Select a survey to view analytics." }) })
472
+ ]
473
+ }
474
+ ) : (
475
+ /* Dynamic Forms Submissions Explorer */
476
+ /* @__PURE__ */ jsxs("div", { style: { padding: "22px 28px", display: "flex", flexDirection: "column", gap: 16 }, children: [
477
+ /* @__PURE__ */ jsxs(
478
+ "div",
479
+ {
480
+ style: {
481
+ padding: "14px 18px",
482
+ borderRadius: 10,
483
+ background: "#ffffff",
484
+ border: "1px solid #cbd5e1",
485
+ display: "flex",
486
+ alignItems: "center",
487
+ justifyContent: "space-between",
488
+ flexWrap: "wrap",
489
+ gap: 12
490
+ },
491
+ children: [
492
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 12, flexWrap: "wrap" }, children: [
493
+ /* @__PURE__ */ jsxs(
494
+ "select",
495
+ {
496
+ value: selectedFormSlug,
497
+ onChange: (e) => setSelectedFormSlug(e.target.value),
498
+ style: {
499
+ padding: "7px 12px",
500
+ fontSize: 12,
501
+ borderRadius: 6,
502
+ border: "1px solid #cbd5e1",
503
+ background: "#fff"
504
+ },
505
+ children: [
506
+ /* @__PURE__ */ jsx("option", { value: "all", children: tr ? "Tüm Formlar" : "All Forms" }),
507
+ forms.map((f) => /* @__PURE__ */ jsxs("option", { value: f.slug, children: [
508
+ f.title,
509
+ " (",
510
+ f.slug,
511
+ ")"
512
+ ] }, f.slug))
513
+ ]
514
+ }
515
+ ),
516
+ /* @__PURE__ */ jsx(
517
+ "input",
518
+ {
519
+ type: "text",
520
+ value: subSearch,
521
+ onChange: (e) => setSubSearch(e.target.value),
522
+ placeholder: tr ? "Başvurularda ara (isim, e-posta, mesaj)..." : "Search submissions...",
523
+ style: {
524
+ width: 280,
525
+ padding: "7px 12px",
526
+ fontSize: 12,
527
+ borderRadius: 6,
528
+ border: "1px solid #cbd5e1"
529
+ }
530
+ }
531
+ )
532
+ ] }),
533
+ /* @__PURE__ */ jsxs(
534
+ "button",
535
+ {
536
+ type: "button",
537
+ onClick: exportFormSubmissionsCsv,
538
+ style: {
539
+ padding: "7px 14px",
540
+ borderRadius: 6,
541
+ border: "none",
542
+ background: "#059669",
543
+ color: "#ffffff",
544
+ fontSize: 12,
545
+ fontWeight: 700,
546
+ cursor: "pointer",
547
+ display: "inline-flex",
548
+ alignItems: "center",
549
+ gap: 6
550
+ },
551
+ children: [
552
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "download", size: 15, color: "#fff" }),
553
+ /* @__PURE__ */ jsx("span", { children: tr ? "Başvuruları CSV İndir" : "Export Submissions CSV" })
554
+ ]
555
+ }
556
+ )
557
+ ]
558
+ }
559
+ ),
560
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: submissions.filter((sub) => {
561
+ const kw = subSearch.trim().toLowerCase();
562
+ if (!kw) return true;
563
+ return JSON.stringify(sub.data || {}).toLowerCase().includes(kw);
564
+ }).map((sub, idx) => /* @__PURE__ */ jsxs(
565
+ "div",
566
+ {
567
+ style: {
568
+ padding: 16,
569
+ borderRadius: 10,
570
+ background: "#ffffff",
571
+ border: "1px solid #e2e8f0"
572
+ },
573
+ children: [
574
+ /* @__PURE__ */ jsxs(
575
+ "div",
576
+ {
577
+ style: {
578
+ display: "flex",
579
+ justifyContent: "space-between",
580
+ marginBottom: 10,
581
+ paddingBottom: 8,
582
+ borderBottom: "1px solid #f1f5f9",
583
+ fontSize: 12
584
+ },
585
+ children: [
586
+ /* @__PURE__ */ jsxs("strong", { children: [
587
+ "#",
588
+ sub.id,
589
+ " — ",
590
+ sub.formTitle || sub.formSlug
591
+ ] }),
592
+ /* @__PURE__ */ jsx("span", { style: { color: "#64748b" }, children: sub.createdAt ? new Date(sub.createdAt).toLocaleString(tr ? "tr-TR" : "en-US") : "" })
593
+ ]
594
+ }
595
+ ),
596
+ /* @__PURE__ */ jsx(
597
+ "div",
598
+ {
599
+ style: {
600
+ display: "grid",
601
+ gridTemplateColumns: "repeat(auto-fit, minmax(220px, 1fr))",
602
+ gap: 10,
603
+ fontSize: 12
604
+ },
605
+ children: Object.entries(sub.data || {}).map(([k, v]) => /* @__PURE__ */ jsxs("div", { children: [
606
+ /* @__PURE__ */ jsx("div", { style: { fontSize: 10.5, fontWeight: 700, color: "#64748b" }, children: k }),
607
+ /* @__PURE__ */ jsx("div", { style: { color: "#0f172a", marginTop: 2 }, children: Array.isArray(v) ? v.join(", ") : String(v ?? "-") })
608
+ ] }, k))
609
+ }
610
+ )
611
+ ]
612
+ },
613
+ sub.id || idx
614
+ )) })
615
+ ] })
616
+ ),
617
+ /* @__PURE__ */ jsx(
618
+ SurveyStudioModal,
619
+ {
620
+ open: studioOpen,
621
+ initialSurvey: studioTarget,
622
+ uiLocale,
623
+ onClose: () => setStudioOpen(false),
624
+ onSaved: (saved) => {
625
+ loadSurveys();
626
+ setSelectedSurveySlug(saved.slug);
627
+ setAnalyticsRefreshKey((k) => k + 1);
628
+ }
629
+ }
630
+ )
631
+ ]
632
+ }
633
+ );
634
+ };
635
+ export {
636
+ AnalyticsHubPage
637
+ };