@ozguraltan/strapi-content-input 1.0.22 → 1.0.24
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 +14 -9
- package/dist/admin/{AnalyticsHubPage-B1_chQkG.js → AnalyticsHubPage-ByOrVZCl.js} +555 -59
- package/dist/admin/{AnalyticsHubPage-DUj3D2kA.mjs → AnalyticsHubPage-O-7pF2E5.mjs} +537 -59
- package/dist/admin/{ContentInputField-BrtpTCDd.mjs → ContentInputField-BoZHf0Ka.mjs} +6 -236
- package/dist/admin/{ContentInputField-CQFQxxgm.js → ContentInputField-DK97AIG0.js} +22 -252
- package/dist/admin/{SurveyWidgetEditor-C5Uvyf_h.js → SurveyWidgetEditor-D3KiAotu.js} +6133 -514
- package/dist/admin/{SurveyWidgetEditor-DGSwgTzR.mjs → SurveyWidgetEditor-Y5BR-NWE.mjs} +6157 -539
- package/dist/admin/{index-Dc7AFLOj.mjs → index-C5Uj5YV9.mjs} +2 -2
- package/dist/admin/{index-i0NfSYto.js → index-CHtB_Fa5.js} +2 -2
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/widgets/SurveyLivePreviewPane.d.ts +9 -0
- package/dist/admin/src/components/widgets/SurveyTransferCleanupModal.d.ts +35 -0
- package/dist/admin/src/components/widgets/SurveyWidgetEditor.d.ts +3 -1
- package/dist/admin/src/components/widgets/surveyStepTreeOps.d.ts +54 -0
- package/dist/server/index.js +796 -32
- package/dist/server/index.mjs +778 -32
- package/dist/server/src/controllers/ci-survey.d.ts +4 -0
- package/dist/server/src/controllers/index.d.ts +4 -0
- package/dist/server/src/index.d.ts +56 -2
- package/dist/server/src/services/ci-form.d.ts +5 -1
- package/dist/server/src/services/ci-survey.d.ts +47 -1
- package/dist/server/src/services/index.d.ts +52 -2
- package/dist/server/src/utils/demoSeedState.d.ts +14 -0
- package/dist/server/src/utils/surveyEngine.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useCallback, useEffect } from "react";
|
|
3
3
|
import { useFetchClient } from "@strapi/strapi/admin";
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
4
|
+
import * as XLSXNs from "xlsx";
|
|
5
|
+
import { M as MaterialIcon } from "./index-C5Uj5YV9.mjs";
|
|
6
|
+
import { h as useStrapiLocales, K as getInitialLocale, L as createBlankSurveyDraft, M as ColorCodesManager, N as pickTextForLocale, O as SurveyAnalyticsView, P as SurveyStudioModal, Q as SurveyExportModal, T as SurveyImportModal, U as SurveyCleanupConfirmModal, V as persistLocale } from "./SurveyWidgetEditor-Y5BR-NWE.mjs";
|
|
7
|
+
const XLSX = XLSXNs?.utils ? XLSXNs : XLSXNs?.default || XLSXNs;
|
|
6
8
|
const AnalyticsHubPage = () => {
|
|
7
9
|
const { get, post } = useFetchClient();
|
|
8
10
|
const { locales: strapiLocales } = useStrapiLocales();
|
|
@@ -22,9 +24,15 @@ const AnalyticsHubPage = () => {
|
|
|
22
24
|
const [analyticsRefreshKey, setAnalyticsRefreshKey] = useState(0);
|
|
23
25
|
const [reseeding, setReseeding] = useState(false);
|
|
24
26
|
const [studioOpen, setStudioOpen] = useState(false);
|
|
27
|
+
const [studioInitialTab, setStudioInitialTab] = useState("builder");
|
|
25
28
|
const [studioTarget, setStudioTarget] = useState(
|
|
26
29
|
() => createBlankSurveyDraft(uiLocale)
|
|
27
30
|
);
|
|
31
|
+
const [exportModalOpen, setExportModalOpen] = useState(false);
|
|
32
|
+
const [exportDefaultScope, setExportDefaultScope] = useState("single");
|
|
33
|
+
const [importModalOpen, setImportModalOpen] = useState(false);
|
|
34
|
+
const [cleanupAction, setCleanupAction] = useState(null);
|
|
35
|
+
const [hubNotice, setHubNotice] = useState("");
|
|
28
36
|
const [forms, setForms] = useState([]);
|
|
29
37
|
const [selectedFormSlug, setSelectedFormSlug] = useState("all");
|
|
30
38
|
const [submissions, setSubmissions] = useState([]);
|
|
@@ -72,6 +80,9 @@ const AnalyticsHubPage = () => {
|
|
|
72
80
|
await loadSurveys();
|
|
73
81
|
if (section === "forms") await loadFormsAndSubmissions();
|
|
74
82
|
setAnalyticsRefreshKey((k) => k + 1);
|
|
83
|
+
setHubNotice(
|
|
84
|
+
tr ? "Örnek anketler ve form verileri başarıyla geri yüklendi." : "Sample surveys and form submissions restored."
|
|
85
|
+
);
|
|
75
86
|
} catch {
|
|
76
87
|
} finally {
|
|
77
88
|
setReseeding(false);
|
|
@@ -114,6 +125,57 @@ const AnalyticsHubPage = () => {
|
|
|
114
125
|
document.body.removeChild(a);
|
|
115
126
|
URL.revokeObjectURL(url);
|
|
116
127
|
};
|
|
128
|
+
const exportFormSubmissionsXlsx = () => {
|
|
129
|
+
if (submissions.length === 0) return;
|
|
130
|
+
const dataKeys = Array.from(
|
|
131
|
+
new Set(
|
|
132
|
+
submissions.flatMap(
|
|
133
|
+
(s) => s.data && typeof s.data === "object" ? Object.keys(s.data) : []
|
|
134
|
+
)
|
|
135
|
+
)
|
|
136
|
+
);
|
|
137
|
+
const headers = ["ID", "Form", "Created At", "Mail Sent", ...dataKeys];
|
|
138
|
+
const formatCell = (v) => {
|
|
139
|
+
if (v === null || v === void 0) return "";
|
|
140
|
+
if (typeof v === "number") return v;
|
|
141
|
+
if (Array.isArray(v)) return v.join("; ");
|
|
142
|
+
if (typeof v === "object") return JSON.stringify(v);
|
|
143
|
+
return String(v);
|
|
144
|
+
};
|
|
145
|
+
const aoa = [headers];
|
|
146
|
+
for (const s of submissions) {
|
|
147
|
+
aoa.push([
|
|
148
|
+
String(s.id || s.documentId || ""),
|
|
149
|
+
String(s.formTitle || s.formSlug || ""),
|
|
150
|
+
String(s.createdAt || ""),
|
|
151
|
+
s.mailSent ? "Yes" : "No",
|
|
152
|
+
...dataKeys.map((k) => formatCell(s.data?.[k]))
|
|
153
|
+
]);
|
|
154
|
+
}
|
|
155
|
+
const ws = XLSX.utils.aoa_to_sheet(aoa);
|
|
156
|
+
ws["!cols"] = headers.map((h, cIdx) => {
|
|
157
|
+
let maxLen = Math.max(12, h.length);
|
|
158
|
+
for (let r = 1; r < Math.min(aoa.length, 250); r++) {
|
|
159
|
+
const len = String(aoa[r]?.[cIdx] ?? "").length;
|
|
160
|
+
if (len > maxLen) maxLen = len;
|
|
161
|
+
}
|
|
162
|
+
return { wch: Math.min(52, maxLen + 3) };
|
|
163
|
+
});
|
|
164
|
+
const wb = XLSX.utils.book_new();
|
|
165
|
+
XLSX.utils.book_append_sheet(wb, ws, tr ? "Form_Basvurulari" : "Submissions");
|
|
166
|
+
const out = XLSX.write(wb, { bookType: "xlsx", type: "array" });
|
|
167
|
+
const blob = new Blob([out], {
|
|
168
|
+
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
169
|
+
});
|
|
170
|
+
const url = URL.createObjectURL(blob);
|
|
171
|
+
const a = document.createElement("a");
|
|
172
|
+
a.href = url;
|
|
173
|
+
a.download = `form-submissions-${selectedFormSlug}.xlsx`;
|
|
174
|
+
document.body.appendChild(a);
|
|
175
|
+
a.click();
|
|
176
|
+
document.body.removeChild(a);
|
|
177
|
+
URL.revokeObjectURL(url);
|
|
178
|
+
};
|
|
117
179
|
const currentSurvey = surveys.find((s) => s.slug === selectedSurveySlug) || surveys[0] || null;
|
|
118
180
|
const totalAllResponses = surveys.reduce((acc, s) => acc + (s.responseCount || 0), 0);
|
|
119
181
|
return /* @__PURE__ */ jsxs(
|
|
@@ -169,6 +231,7 @@ const AnalyticsHubPage = () => {
|
|
|
169
231
|
type: "button",
|
|
170
232
|
onClick: () => {
|
|
171
233
|
setStudioTarget(createBlankSurveyDraft(uiLocale));
|
|
234
|
+
setStudioInitialTab("builder");
|
|
172
235
|
setStudioOpen(true);
|
|
173
236
|
},
|
|
174
237
|
style: {
|
|
@@ -190,6 +253,86 @@ const AnalyticsHubPage = () => {
|
|
|
190
253
|
]
|
|
191
254
|
}
|
|
192
255
|
),
|
|
256
|
+
/* @__PURE__ */ jsxs(
|
|
257
|
+
"button",
|
|
258
|
+
{
|
|
259
|
+
type: "button",
|
|
260
|
+
onClick: () => setImportModalOpen(true),
|
|
261
|
+
style: {
|
|
262
|
+
padding: "8px 12px",
|
|
263
|
+
borderRadius: 8,
|
|
264
|
+
border: "1px solid rgba(56, 189, 248, 0.5)",
|
|
265
|
+
background: "rgba(14, 165, 233, 0.16)",
|
|
266
|
+
color: "#e0f2fe",
|
|
267
|
+
fontSize: 11.5,
|
|
268
|
+
fontWeight: 700,
|
|
269
|
+
cursor: "pointer",
|
|
270
|
+
display: "inline-flex",
|
|
271
|
+
alignItems: "center",
|
|
272
|
+
gap: 6
|
|
273
|
+
},
|
|
274
|
+
title: tr ? "JSON (.ci-survey.json) paketinden anket yapısını ve/veya yanıtlarını canlandırır" : "Import survey structure and/or responses from a .ci-survey.json bundle",
|
|
275
|
+
children: [
|
|
276
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "upload_file", size: 15, color: "#7dd3fc" }),
|
|
277
|
+
/* @__PURE__ */ jsx("span", { children: tr ? "JSON İçe Aktar" : "Import JSON" })
|
|
278
|
+
]
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
/* @__PURE__ */ jsxs(
|
|
282
|
+
"button",
|
|
283
|
+
{
|
|
284
|
+
type: "button",
|
|
285
|
+
disabled: surveys.length === 0,
|
|
286
|
+
onClick: () => {
|
|
287
|
+
setExportDefaultScope("all");
|
|
288
|
+
setExportModalOpen(true);
|
|
289
|
+
},
|
|
290
|
+
style: {
|
|
291
|
+
padding: "8px 12px",
|
|
292
|
+
borderRadius: 8,
|
|
293
|
+
border: "1px solid rgba(52, 211, 153, 0.45)",
|
|
294
|
+
background: "rgba(16, 185, 129, 0.16)",
|
|
295
|
+
color: "#d1fae5",
|
|
296
|
+
fontSize: 11.5,
|
|
297
|
+
fontWeight: 700,
|
|
298
|
+
opacity: surveys.length === 0 ? 0.55 : 1,
|
|
299
|
+
cursor: surveys.length === 0 ? "not-allowed" : "pointer",
|
|
300
|
+
display: "inline-flex",
|
|
301
|
+
alignItems: "center",
|
|
302
|
+
gap: 6
|
|
303
|
+
},
|
|
304
|
+
title: tr ? "Anketleri sadece yapı veya yapı + veri olarak .ci-survey.json paketine aktarır" : "Export surveys as structure-only or structure + data (.ci-survey.json)",
|
|
305
|
+
children: [
|
|
306
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "download", size: 15, color: "#6ee7b7" }),
|
|
307
|
+
/* @__PURE__ */ jsx("span", { children: tr ? "Yedekle / Dışa Aktar" : "Export Bundle" })
|
|
308
|
+
]
|
|
309
|
+
}
|
|
310
|
+
),
|
|
311
|
+
/* @__PURE__ */ jsxs(
|
|
312
|
+
"button",
|
|
313
|
+
{
|
|
314
|
+
type: "button",
|
|
315
|
+
onClick: () => setCleanupAction("purge-demo"),
|
|
316
|
+
style: {
|
|
317
|
+
padding: "8px 12px",
|
|
318
|
+
borderRadius: 8,
|
|
319
|
+
border: "1px solid rgba(251, 146, 60, 0.48)",
|
|
320
|
+
background: "rgba(234, 88, 12, 0.18)",
|
|
321
|
+
color: "#ffedd5",
|
|
322
|
+
fontSize: 11.5,
|
|
323
|
+
fontWeight: 700,
|
|
324
|
+
cursor: "pointer",
|
|
325
|
+
display: "inline-flex",
|
|
326
|
+
alignItems: "center",
|
|
327
|
+
gap: 6
|
|
328
|
+
},
|
|
329
|
+
title: tr ? "Sadece yerleşik örnek (showcase_*) anket/form verilerini siler; kendi anketlerinize dokunmaz" : "Removes built-in showcase_* demo surveys & form submissions without touching your custom surveys",
|
|
330
|
+
children: [
|
|
331
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "delete_sweep", size: 15, color: "#fdba74" }),
|
|
332
|
+
/* @__PURE__ */ jsx("span", { children: tr ? "Dummy Veriyi Temizle" : "Purge Demo Data" })
|
|
333
|
+
]
|
|
334
|
+
}
|
|
335
|
+
),
|
|
193
336
|
/* @__PURE__ */ jsxs(
|
|
194
337
|
"button",
|
|
195
338
|
{
|
|
@@ -209,10 +352,10 @@ const AnalyticsHubPage = () => {
|
|
|
209
352
|
alignItems: "center",
|
|
210
353
|
gap: 6
|
|
211
354
|
},
|
|
212
|
-
title: tr ? "Örnek analiz veri kümesini (525 anket yanıtı + 20 form başvurusu) yeniler" : "
|
|
355
|
+
title: tr ? "Örnek analiz veri kümesini (525 anket yanıtı + 20 form başvurusu) geri yükler / yeniler" : "Restores or refreshes the 525-response correlated analytics dataset",
|
|
213
356
|
children: [
|
|
214
357
|
/* @__PURE__ */ jsx(MaterialIcon, { name: "refresh", size: 15, color: "#38bdf8" }),
|
|
215
|
-
/* @__PURE__ */ jsx("span", { children: reseeding ? "..." : tr ? "Örnek Veriyi
|
|
358
|
+
/* @__PURE__ */ jsx("span", { children: reseeding ? "..." : tr ? "Örnek Veriyi Geri Yükle" : "Restore Sample Data" })
|
|
216
359
|
]
|
|
217
360
|
}
|
|
218
361
|
),
|
|
@@ -356,6 +499,46 @@ const AnalyticsHubPage = () => {
|
|
|
356
499
|
]
|
|
357
500
|
}
|
|
358
501
|
),
|
|
502
|
+
hubNotice && /* @__PURE__ */ jsxs(
|
|
503
|
+
"div",
|
|
504
|
+
{
|
|
505
|
+
style: {
|
|
506
|
+
margin: "14px 28px 0",
|
|
507
|
+
padding: "10px 16px",
|
|
508
|
+
borderRadius: 9,
|
|
509
|
+
background: "#ecfdf5",
|
|
510
|
+
border: "1px solid #6ee7b7",
|
|
511
|
+
color: "#065f46",
|
|
512
|
+
fontSize: 12.5,
|
|
513
|
+
fontWeight: 700,
|
|
514
|
+
display: "flex",
|
|
515
|
+
alignItems: "center",
|
|
516
|
+
justifyContent: "space-between",
|
|
517
|
+
gap: 12
|
|
518
|
+
},
|
|
519
|
+
children: [
|
|
520
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
521
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "check_circle", size: 18, color: "#059669" }),
|
|
522
|
+
/* @__PURE__ */ jsx("span", { children: hubNotice })
|
|
523
|
+
] }),
|
|
524
|
+
/* @__PURE__ */ jsx(
|
|
525
|
+
"button",
|
|
526
|
+
{
|
|
527
|
+
type: "button",
|
|
528
|
+
onClick: () => setHubNotice(""),
|
|
529
|
+
style: {
|
|
530
|
+
border: "none",
|
|
531
|
+
background: "transparent",
|
|
532
|
+
color: "#065f46",
|
|
533
|
+
fontSize: 16,
|
|
534
|
+
cursor: "pointer"
|
|
535
|
+
},
|
|
536
|
+
children: "×"
|
|
537
|
+
}
|
|
538
|
+
)
|
|
539
|
+
]
|
|
540
|
+
}
|
|
541
|
+
),
|
|
359
542
|
section === "colors" ? /* @__PURE__ */ jsx("div", { style: { padding: "22px 28px" }, children: /* @__PURE__ */ jsx(
|
|
360
543
|
"div",
|
|
361
544
|
{
|
|
@@ -368,7 +551,99 @@ const AnalyticsHubPage = () => {
|
|
|
368
551
|
},
|
|
369
552
|
children: /* @__PURE__ */ jsx(ColorCodesManager, { locale: uiLocale })
|
|
370
553
|
}
|
|
371
|
-
) }) : section === "surveys" ? /* @__PURE__ */ jsxs(
|
|
554
|
+
) }) : section === "surveys" ? surveys.length === 0 ? /* @__PURE__ */ jsx("div", { style: { padding: "36px 28px" }, children: /* @__PURE__ */ jsxs(
|
|
555
|
+
"div",
|
|
556
|
+
{
|
|
557
|
+
style: {
|
|
558
|
+
maxWidth: 640,
|
|
559
|
+
margin: "0 auto",
|
|
560
|
+
padding: "38px 32px",
|
|
561
|
+
borderRadius: 14,
|
|
562
|
+
background: "#ffffff",
|
|
563
|
+
border: "1px solid #cbd5e1",
|
|
564
|
+
textAlign: "center",
|
|
565
|
+
boxShadow: "0 6px 20px rgba(15, 23, 42, 0.04)"
|
|
566
|
+
},
|
|
567
|
+
children: [
|
|
568
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "poll", size: 40, color: "#2563eb" }),
|
|
569
|
+
/* @__PURE__ */ jsx("h2", { style: { margin: "12px 0 6px", fontSize: 18, fontWeight: 800, color: "#0f172a" }, children: tr ? "Henüz Kayıtlı Anket Bulunmuyor" : "No Surveys Found Yet" }),
|
|
570
|
+
/* @__PURE__ */ jsx("p", { style: { margin: "0 0 20px", fontSize: 13, color: "#64748b", lineHeight: 1.55 }, children: tr ? "Sıfırdan yeni bir kurumsal anket veya oylama oluşturabilir, daha önce dışa aktardığınız bir .ci-survey.json paketini canlandırabilir ya da yerleşik örnek verileri geri yükleyebilirsiniz." : "Create a brand-new survey from scratch, revive an exported .ci-survey.json package, or restore the sample showcase dataset." }),
|
|
571
|
+
/* @__PURE__ */ jsxs(
|
|
572
|
+
"div",
|
|
573
|
+
{
|
|
574
|
+
style: {
|
|
575
|
+
display: "flex",
|
|
576
|
+
alignItems: "center",
|
|
577
|
+
justifyContent: "center",
|
|
578
|
+
flexWrap: "wrap",
|
|
579
|
+
gap: 10
|
|
580
|
+
},
|
|
581
|
+
children: [
|
|
582
|
+
/* @__PURE__ */ jsx(
|
|
583
|
+
"button",
|
|
584
|
+
{
|
|
585
|
+
type: "button",
|
|
586
|
+
onClick: () => {
|
|
587
|
+
setStudioTarget(createBlankSurveyDraft(uiLocale));
|
|
588
|
+
setStudioInitialTab("builder");
|
|
589
|
+
setStudioOpen(true);
|
|
590
|
+
},
|
|
591
|
+
style: {
|
|
592
|
+
padding: "9px 16px",
|
|
593
|
+
borderRadius: 8,
|
|
594
|
+
border: "none",
|
|
595
|
+
background: "#2563eb",
|
|
596
|
+
color: "#ffffff",
|
|
597
|
+
fontSize: 12.5,
|
|
598
|
+
fontWeight: 700,
|
|
599
|
+
cursor: "pointer"
|
|
600
|
+
},
|
|
601
|
+
children: tr ? "+ Yeni Anket Oluştur" : "+ Create New Survey"
|
|
602
|
+
}
|
|
603
|
+
),
|
|
604
|
+
/* @__PURE__ */ jsx(
|
|
605
|
+
"button",
|
|
606
|
+
{
|
|
607
|
+
type: "button",
|
|
608
|
+
onClick: () => setImportModalOpen(true),
|
|
609
|
+
style: {
|
|
610
|
+
padding: "9px 16px",
|
|
611
|
+
borderRadius: 8,
|
|
612
|
+
border: "1px solid #2563eb",
|
|
613
|
+
background: "#eff6ff",
|
|
614
|
+
color: "#1d4ed8",
|
|
615
|
+
fontSize: 12.5,
|
|
616
|
+
fontWeight: 700,
|
|
617
|
+
cursor: "pointer"
|
|
618
|
+
},
|
|
619
|
+
children: tr ? "JSON Paketinden İçe Aktar" : "Import from JSON Bundle"
|
|
620
|
+
}
|
|
621
|
+
),
|
|
622
|
+
/* @__PURE__ */ jsx(
|
|
623
|
+
"button",
|
|
624
|
+
{
|
|
625
|
+
type: "button",
|
|
626
|
+
disabled: reseeding,
|
|
627
|
+
onClick: handleReseedDemo,
|
|
628
|
+
style: {
|
|
629
|
+
padding: "9px 14px",
|
|
630
|
+
borderRadius: 8,
|
|
631
|
+
border: "1px solid #cbd5e1",
|
|
632
|
+
background: "#f8fafc",
|
|
633
|
+
color: "#334155",
|
|
634
|
+
fontSize: 12,
|
|
635
|
+
fontWeight: 600,
|
|
636
|
+
cursor: "pointer"
|
|
637
|
+
},
|
|
638
|
+
children: tr ? "Örnek Verileri Geri Yükle" : "Restore Sample Data"
|
|
639
|
+
}
|
|
640
|
+
)
|
|
641
|
+
]
|
|
642
|
+
}
|
|
643
|
+
)
|
|
644
|
+
]
|
|
645
|
+
}
|
|
646
|
+
) }) : /* @__PURE__ */ jsxs(
|
|
372
647
|
"div",
|
|
373
648
|
{
|
|
374
649
|
style: {
|
|
@@ -407,7 +682,7 @@ const AnalyticsHubPage = () => {
|
|
|
407
682
|
cursor: "pointer",
|
|
408
683
|
display: "flex",
|
|
409
684
|
flexDirection: "column",
|
|
410
|
-
gap:
|
|
685
|
+
gap: 5
|
|
411
686
|
},
|
|
412
687
|
children: [
|
|
413
688
|
/* @__PURE__ */ jsxs(
|
|
@@ -439,6 +714,7 @@ const AnalyticsHubPage = () => {
|
|
|
439
714
|
}
|
|
440
715
|
),
|
|
441
716
|
/* @__PURE__ */ jsx("div", { style: { fontSize: 13, fontWeight: 700, color: "#0f172a" }, children: pickTextForLocale(srv.titleI18n, uiLocale, srv.title) }),
|
|
717
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: 10.5, color: "#64748b" }, children: /* @__PURE__ */ jsx("code", { children: srv.slug }) }),
|
|
442
718
|
/* @__PURE__ */ jsxs(
|
|
443
719
|
"div",
|
|
444
720
|
{
|
|
@@ -480,35 +756,149 @@ const AnalyticsHubPage = () => {
|
|
|
480
756
|
srv.slug
|
|
481
757
|
);
|
|
482
758
|
}),
|
|
483
|
-
currentSurvey && /* @__PURE__ */ jsxs(
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
759
|
+
currentSurvey && /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 6, marginTop: 4 }, children: [
|
|
760
|
+
/* @__PURE__ */ jsxs(
|
|
761
|
+
"button",
|
|
762
|
+
{
|
|
763
|
+
type: "button",
|
|
764
|
+
onClick: () => {
|
|
765
|
+
setStudioTarget(currentSurvey);
|
|
766
|
+
setStudioInitialTab("builder");
|
|
767
|
+
setStudioOpen(true);
|
|
768
|
+
},
|
|
769
|
+
style: {
|
|
770
|
+
padding: "9px 12px",
|
|
771
|
+
borderRadius: 8,
|
|
772
|
+
border: "1px solid #2563eb",
|
|
773
|
+
background: "#ffffff",
|
|
774
|
+
color: "#1d4ed8",
|
|
775
|
+
fontSize: 12,
|
|
776
|
+
fontWeight: 700,
|
|
777
|
+
cursor: "pointer",
|
|
778
|
+
display: "inline-flex",
|
|
779
|
+
alignItems: "center",
|
|
780
|
+
justifyContent: "center",
|
|
781
|
+
gap: 6
|
|
782
|
+
},
|
|
783
|
+
children: [
|
|
784
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "edit", size: 15, color: "#2563eb" }),
|
|
785
|
+
/* @__PURE__ */ jsx("span", { children: tr ? "Seçili Anketi Düzenle (Studio)" : "Edit Selected Survey (Studio)" })
|
|
786
|
+
]
|
|
787
|
+
}
|
|
788
|
+
),
|
|
789
|
+
/* @__PURE__ */ jsxs(
|
|
790
|
+
"button",
|
|
791
|
+
{
|
|
792
|
+
type: "button",
|
|
793
|
+
onClick: () => {
|
|
794
|
+
setStudioTarget(currentSurvey);
|
|
795
|
+
setStudioInitialTab("preview");
|
|
796
|
+
setStudioOpen(true);
|
|
797
|
+
},
|
|
798
|
+
style: {
|
|
799
|
+
padding: "9px 12px",
|
|
800
|
+
borderRadius: 8,
|
|
801
|
+
border: "1px solid #059669",
|
|
802
|
+
background: "#ecfdf5",
|
|
803
|
+
color: "#065f46",
|
|
804
|
+
fontSize: 12,
|
|
805
|
+
fontWeight: 700,
|
|
806
|
+
cursor: "pointer",
|
|
807
|
+
display: "inline-flex",
|
|
808
|
+
alignItems: "center",
|
|
809
|
+
justifyContent: "center",
|
|
810
|
+
gap: 6
|
|
811
|
+
},
|
|
812
|
+
children: [
|
|
813
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "play_circle", size: 16, color: "#059669" }),
|
|
814
|
+
/* @__PURE__ */ jsx("span", { children: tr ? "Anket Akışını Önizle & Test Et" : "Preview & Test Survey Flow" })
|
|
815
|
+
]
|
|
816
|
+
}
|
|
817
|
+
),
|
|
818
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 5 }, children: [
|
|
819
|
+
/* @__PURE__ */ jsxs(
|
|
820
|
+
"button",
|
|
821
|
+
{
|
|
822
|
+
type: "button",
|
|
823
|
+
onClick: () => {
|
|
824
|
+
setExportDefaultScope("single");
|
|
825
|
+
setExportModalOpen(true);
|
|
826
|
+
},
|
|
827
|
+
title: tr ? "Seçili anketi Yapı veya Yapı + Veri olarak dışa aktar" : "Export selected survey (Structure or Full)",
|
|
828
|
+
style: {
|
|
829
|
+
padding: "7px 6px",
|
|
830
|
+
borderRadius: 7,
|
|
831
|
+
border: "1px solid #cbd5e1",
|
|
832
|
+
background: "#f8fafc",
|
|
833
|
+
color: "#0f172a",
|
|
834
|
+
fontSize: 10.5,
|
|
835
|
+
fontWeight: 700,
|
|
836
|
+
cursor: "pointer",
|
|
837
|
+
display: "inline-flex",
|
|
838
|
+
alignItems: "center",
|
|
839
|
+
justifyContent: "center",
|
|
840
|
+
gap: 4
|
|
841
|
+
},
|
|
842
|
+
children: [
|
|
843
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "download", size: 14, color: "#2563eb" }),
|
|
844
|
+
/* @__PURE__ */ jsx("span", { children: tr ? "Dışa Aktar" : "Export" })
|
|
845
|
+
]
|
|
846
|
+
}
|
|
847
|
+
),
|
|
848
|
+
/* @__PURE__ */ jsxs(
|
|
849
|
+
"button",
|
|
850
|
+
{
|
|
851
|
+
type: "button",
|
|
852
|
+
onClick: () => setCleanupAction("clear-responses"),
|
|
853
|
+
title: tr ? "Anket yapısını koruyarak sadece yanıtları sıfırlar (0 yapar)" : "Clear all responses for this survey while keeping its structure",
|
|
854
|
+
style: {
|
|
855
|
+
padding: "7px 6px",
|
|
856
|
+
borderRadius: 7,
|
|
857
|
+
border: "1px solid #fcd34d",
|
|
858
|
+
background: "#fffbeb",
|
|
859
|
+
color: "#92400e",
|
|
860
|
+
fontSize: 10.5,
|
|
861
|
+
fontWeight: 700,
|
|
862
|
+
cursor: "pointer",
|
|
863
|
+
display: "inline-flex",
|
|
864
|
+
alignItems: "center",
|
|
865
|
+
justifyContent: "center",
|
|
866
|
+
gap: 4
|
|
867
|
+
},
|
|
868
|
+
children: [
|
|
869
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "restart_alt", size: 14, color: "#d97706" }),
|
|
870
|
+
/* @__PURE__ */ jsx("span", { children: tr ? "Yanıt 0'la" : "Reset" })
|
|
871
|
+
]
|
|
872
|
+
}
|
|
873
|
+
),
|
|
874
|
+
/* @__PURE__ */ jsxs(
|
|
875
|
+
"button",
|
|
876
|
+
{
|
|
877
|
+
type: "button",
|
|
878
|
+
onClick: () => setCleanupAction("delete-survey"),
|
|
879
|
+
title: tr ? "Bu anketi ve tüm yanıtlarını kalıcı olarak siler" : "Delete this survey and all its responses",
|
|
880
|
+
style: {
|
|
881
|
+
padding: "7px 6px",
|
|
882
|
+
borderRadius: 7,
|
|
883
|
+
border: "1px solid #fecaca",
|
|
884
|
+
background: "#fef2f2",
|
|
885
|
+
color: "#991b1b",
|
|
886
|
+
fontSize: 10.5,
|
|
887
|
+
fontWeight: 700,
|
|
888
|
+
cursor: "pointer",
|
|
889
|
+
display: "inline-flex",
|
|
890
|
+
alignItems: "center",
|
|
891
|
+
justifyContent: "center",
|
|
892
|
+
gap: 4
|
|
893
|
+
},
|
|
894
|
+
children: [
|
|
895
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "delete", size: 14, color: "#dc2626" }),
|
|
896
|
+
/* @__PURE__ */ jsx("span", { children: tr ? "Sil" : "Delete" })
|
|
897
|
+
]
|
|
898
|
+
}
|
|
899
|
+
)
|
|
900
|
+
] })
|
|
901
|
+
] })
|
|
512
902
|
]
|
|
513
903
|
}
|
|
514
904
|
),
|
|
@@ -581,30 +971,56 @@ const AnalyticsHubPage = () => {
|
|
|
581
971
|
}
|
|
582
972
|
)
|
|
583
973
|
] }),
|
|
584
|
-
/* @__PURE__ */ jsxs(
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
974
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
975
|
+
/* @__PURE__ */ jsxs(
|
|
976
|
+
"button",
|
|
977
|
+
{
|
|
978
|
+
type: "button",
|
|
979
|
+
onClick: exportFormSubmissionsXlsx,
|
|
980
|
+
style: {
|
|
981
|
+
padding: "7px 14px",
|
|
982
|
+
borderRadius: 6,
|
|
983
|
+
border: "none",
|
|
984
|
+
background: "#059669",
|
|
985
|
+
color: "#ffffff",
|
|
986
|
+
fontSize: 12,
|
|
987
|
+
fontWeight: 700,
|
|
988
|
+
cursor: "pointer",
|
|
989
|
+
display: "inline-flex",
|
|
990
|
+
alignItems: "center",
|
|
991
|
+
gap: 6
|
|
992
|
+
},
|
|
993
|
+
children: [
|
|
994
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "table_view", size: 15, color: "#fff" }),
|
|
995
|
+
/* @__PURE__ */ jsx("span", { children: tr ? "Excel İndir (.xlsx)" : "Export Excel (.xlsx)" })
|
|
996
|
+
]
|
|
997
|
+
}
|
|
998
|
+
),
|
|
999
|
+
/* @__PURE__ */ jsxs(
|
|
1000
|
+
"button",
|
|
1001
|
+
{
|
|
1002
|
+
type: "button",
|
|
1003
|
+
onClick: exportFormSubmissionsCsv,
|
|
1004
|
+
style: {
|
|
1005
|
+
padding: "7px 12px",
|
|
1006
|
+
borderRadius: 6,
|
|
1007
|
+
border: "1px solid #10b981",
|
|
1008
|
+
background: "#ecfdf5",
|
|
1009
|
+
color: "#065f46",
|
|
1010
|
+
fontSize: 12,
|
|
1011
|
+
fontWeight: 700,
|
|
1012
|
+
cursor: "pointer",
|
|
1013
|
+
display: "inline-flex",
|
|
1014
|
+
alignItems: "center",
|
|
1015
|
+
gap: 6
|
|
1016
|
+
},
|
|
1017
|
+
children: [
|
|
1018
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "download", size: 15, color: "#059669" }),
|
|
1019
|
+
/* @__PURE__ */ jsx("span", { children: "CSV" })
|
|
1020
|
+
]
|
|
1021
|
+
}
|
|
1022
|
+
)
|
|
1023
|
+
] })
|
|
608
1024
|
]
|
|
609
1025
|
}
|
|
610
1026
|
),
|
|
@@ -670,6 +1086,7 @@ const AnalyticsHubPage = () => {
|
|
|
670
1086
|
{
|
|
671
1087
|
open: studioOpen,
|
|
672
1088
|
initialSurvey: studioTarget,
|
|
1089
|
+
initialTab: studioInitialTab,
|
|
673
1090
|
uiLocale,
|
|
674
1091
|
onClose: () => setStudioOpen(false),
|
|
675
1092
|
onSaved: (saved) => {
|
|
@@ -678,6 +1095,67 @@ const AnalyticsHubPage = () => {
|
|
|
678
1095
|
setAnalyticsRefreshKey((k) => k + 1);
|
|
679
1096
|
}
|
|
680
1097
|
}
|
|
1098
|
+
),
|
|
1099
|
+
/* @__PURE__ */ jsx(
|
|
1100
|
+
SurveyExportModal,
|
|
1101
|
+
{
|
|
1102
|
+
open: exportModalOpen,
|
|
1103
|
+
uiLocale,
|
|
1104
|
+
targetSurvey: currentSurvey,
|
|
1105
|
+
allowAllSurveys: true,
|
|
1106
|
+
defaultScope: exportDefaultScope,
|
|
1107
|
+
totalSurveysCount: surveys.length,
|
|
1108
|
+
onClose: () => setExportModalOpen(false)
|
|
1109
|
+
}
|
|
1110
|
+
),
|
|
1111
|
+
/* @__PURE__ */ jsx(
|
|
1112
|
+
SurveyImportModal,
|
|
1113
|
+
{
|
|
1114
|
+
open: importModalOpen,
|
|
1115
|
+
uiLocale,
|
|
1116
|
+
existingSlugs: surveys.map((s) => s.slug),
|
|
1117
|
+
onClose: () => setImportModalOpen(false),
|
|
1118
|
+
onImported: async (res) => {
|
|
1119
|
+
await loadSurveys();
|
|
1120
|
+
if (res.importedSurveys?.[0]?.slug) {
|
|
1121
|
+
setSelectedSurveySlug(res.importedSurveys[0].slug);
|
|
1122
|
+
}
|
|
1123
|
+
setAnalyticsRefreshKey((k) => k + 1);
|
|
1124
|
+
setHubNotice(
|
|
1125
|
+
tr ? `${res.importedCount} anket ve ${res.importedResponsesCount} yanıt başarıyla içe aktarıldı!` : `Successfully imported ${res.importedCount} survey(s) and ${res.importedResponsesCount} response(s)!`
|
|
1126
|
+
);
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
),
|
|
1130
|
+
/* @__PURE__ */ jsx(
|
|
1131
|
+
SurveyCleanupConfirmModal,
|
|
1132
|
+
{
|
|
1133
|
+
open: Boolean(cleanupAction),
|
|
1134
|
+
action: cleanupAction,
|
|
1135
|
+
uiLocale,
|
|
1136
|
+
targetSurvey: currentSurvey,
|
|
1137
|
+
onClose: () => setCleanupAction(null),
|
|
1138
|
+
onCompleted: async (act, payload) => {
|
|
1139
|
+
await loadSurveys();
|
|
1140
|
+
if (section === "forms" || act === "purge-demo") {
|
|
1141
|
+
await loadFormsAndSubmissions();
|
|
1142
|
+
}
|
|
1143
|
+
setAnalyticsRefreshKey((k) => k + 1);
|
|
1144
|
+
if (act === "purge-demo") {
|
|
1145
|
+
setHubNotice(
|
|
1146
|
+
tr ? `Dummy veriler temizlendi (${payload?.deletedSurveys || 0} örnek anket, ${payload?.deletedSurveyResponses || 0} örnek yanıt, ${payload?.deletedForms || 0} örnek form silindi).` : `Demo data purged (${payload?.deletedSurveys || 0} demo surveys, ${payload?.deletedSurveyResponses || 0} demo responses, ${payload?.deletedForms || 0} demo forms removed).`
|
|
1147
|
+
);
|
|
1148
|
+
} else if (act === "clear-responses") {
|
|
1149
|
+
setHubNotice(
|
|
1150
|
+
tr ? `Seçili anketin ${payload?.deletedCount || 0} yanıtı sıfırlandı.` : `Cleared ${payload?.deletedCount || 0} response(s) from the selected survey.`
|
|
1151
|
+
);
|
|
1152
|
+
} else if (act === "delete-survey") {
|
|
1153
|
+
setHubNotice(
|
|
1154
|
+
tr ? "Anket ve bağlı yanıtları kalıcı olarak silindi." : "Survey and its responses were permanently deleted."
|
|
1155
|
+
);
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
681
1159
|
)
|
|
682
1160
|
]
|
|
683
1161
|
}
|