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