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