@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.
Files changed (26) hide show
  1. package/README.md +14 -9
  2. package/dist/admin/{AnalyticsHubPage-B1_chQkG.js → AnalyticsHubPage-ByOrVZCl.js} +555 -59
  3. package/dist/admin/{AnalyticsHubPage-DUj3D2kA.mjs → AnalyticsHubPage-O-7pF2E5.mjs} +537 -59
  4. package/dist/admin/{ContentInputField-BrtpTCDd.mjs → ContentInputField-BoZHf0Ka.mjs} +6 -236
  5. package/dist/admin/{ContentInputField-CQFQxxgm.js → ContentInputField-DK97AIG0.js} +22 -252
  6. package/dist/admin/{SurveyWidgetEditor-C5Uvyf_h.js → SurveyWidgetEditor-D3KiAotu.js} +6133 -514
  7. package/dist/admin/{SurveyWidgetEditor-DGSwgTzR.mjs → SurveyWidgetEditor-Y5BR-NWE.mjs} +6157 -539
  8. package/dist/admin/{index-Dc7AFLOj.mjs → index-C5Uj5YV9.mjs} +2 -2
  9. package/dist/admin/{index-i0NfSYto.js → index-CHtB_Fa5.js} +2 -2
  10. package/dist/admin/index.js +1 -1
  11. package/dist/admin/index.mjs +1 -1
  12. package/dist/admin/src/components/widgets/SurveyLivePreviewPane.d.ts +9 -0
  13. package/dist/admin/src/components/widgets/SurveyTransferCleanupModal.d.ts +35 -0
  14. package/dist/admin/src/components/widgets/SurveyWidgetEditor.d.ts +3 -1
  15. package/dist/admin/src/components/widgets/surveyStepTreeOps.d.ts +54 -0
  16. package/dist/server/index.js +796 -32
  17. package/dist/server/index.mjs +778 -32
  18. package/dist/server/src/controllers/ci-survey.d.ts +4 -0
  19. package/dist/server/src/controllers/index.d.ts +4 -0
  20. package/dist/server/src/index.d.ts +56 -2
  21. package/dist/server/src/services/ci-form.d.ts +5 -1
  22. package/dist/server/src/services/ci-survey.d.ts +47 -1
  23. package/dist/server/src/services/index.d.ts +52 -2
  24. package/dist/server/src/utils/demoSeedState.d.ts +14 -0
  25. package/dist/server/src/utils/surveyEngine.d.ts +5 -0
  26. package/package.json +1 -1
@@ -3,8 +3,28 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const admin = require("@strapi/strapi/admin");
6
- const index = require("./index-i0NfSYto.js");
7
- const SurveyWidgetEditor = require("./SurveyWidgetEditor-C5Uvyf_h.js");
6
+ const XLSXNs = require("xlsx");
7
+ const index = require("./index-CHtB_Fa5.js");
8
+ const SurveyWidgetEditor = require("./SurveyWidgetEditor-D3KiAotu.js");
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
12
+ if (e) {
13
+ for (const k in e) {
14
+ if (k !== "default") {
15
+ const d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: () => e[k]
19
+ });
20
+ }
21
+ }
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+ const XLSXNs__namespace = /* @__PURE__ */ _interopNamespace(XLSXNs);
27
+ const XLSX = XLSXNs__namespace?.utils ? XLSXNs__namespace : XLSXNs__namespace?.default || XLSXNs__namespace;
8
28
  const AnalyticsHubPage = () => {
9
29
  const { get, post } = admin.useFetchClient();
10
30
  const { locales: strapiLocales } = SurveyWidgetEditor.useStrapiLocales();
@@ -24,9 +44,15 @@ const AnalyticsHubPage = () => {
24
44
  const [analyticsRefreshKey, setAnalyticsRefreshKey] = React.useState(0);
25
45
  const [reseeding, setReseeding] = React.useState(false);
26
46
  const [studioOpen, setStudioOpen] = React.useState(false);
47
+ const [studioInitialTab, setStudioInitialTab] = React.useState("builder");
27
48
  const [studioTarget, setStudioTarget] = React.useState(
28
49
  () => SurveyWidgetEditor.createBlankSurveyDraft(uiLocale)
29
50
  );
51
+ const [exportModalOpen, setExportModalOpen] = React.useState(false);
52
+ const [exportDefaultScope, setExportDefaultScope] = React.useState("single");
53
+ const [importModalOpen, setImportModalOpen] = React.useState(false);
54
+ const [cleanupAction, setCleanupAction] = React.useState(null);
55
+ const [hubNotice, setHubNotice] = React.useState("");
30
56
  const [forms, setForms] = React.useState([]);
31
57
  const [selectedFormSlug, setSelectedFormSlug] = React.useState("all");
32
58
  const [submissions, setSubmissions] = React.useState([]);
@@ -74,6 +100,9 @@ const AnalyticsHubPage = () => {
74
100
  await loadSurveys();
75
101
  if (section === "forms") await loadFormsAndSubmissions();
76
102
  setAnalyticsRefreshKey((k) => k + 1);
103
+ setHubNotice(
104
+ tr ? "Örnek anketler ve form verileri başarıyla geri yüklendi." : "Sample surveys and form submissions restored."
105
+ );
77
106
  } catch {
78
107
  } finally {
79
108
  setReseeding(false);
@@ -116,6 +145,57 @@ const AnalyticsHubPage = () => {
116
145
  document.body.removeChild(a);
117
146
  URL.revokeObjectURL(url);
118
147
  };
148
+ const exportFormSubmissionsXlsx = () => {
149
+ if (submissions.length === 0) return;
150
+ const dataKeys = Array.from(
151
+ new Set(
152
+ submissions.flatMap(
153
+ (s) => s.data && typeof s.data === "object" ? Object.keys(s.data) : []
154
+ )
155
+ )
156
+ );
157
+ const headers = ["ID", "Form", "Created At", "Mail Sent", ...dataKeys];
158
+ const formatCell = (v) => {
159
+ if (v === null || v === void 0) return "";
160
+ if (typeof v === "number") return v;
161
+ if (Array.isArray(v)) return v.join("; ");
162
+ if (typeof v === "object") return JSON.stringify(v);
163
+ return String(v);
164
+ };
165
+ const aoa = [headers];
166
+ for (const s of submissions) {
167
+ aoa.push([
168
+ String(s.id || s.documentId || ""),
169
+ String(s.formTitle || s.formSlug || ""),
170
+ String(s.createdAt || ""),
171
+ s.mailSent ? "Yes" : "No",
172
+ ...dataKeys.map((k) => formatCell(s.data?.[k]))
173
+ ]);
174
+ }
175
+ const ws = XLSX.utils.aoa_to_sheet(aoa);
176
+ ws["!cols"] = headers.map((h, cIdx) => {
177
+ let maxLen = Math.max(12, h.length);
178
+ for (let r = 1; r < Math.min(aoa.length, 250); r++) {
179
+ const len = String(aoa[r]?.[cIdx] ?? "").length;
180
+ if (len > maxLen) maxLen = len;
181
+ }
182
+ return { wch: Math.min(52, maxLen + 3) };
183
+ });
184
+ const wb = XLSX.utils.book_new();
185
+ XLSX.utils.book_append_sheet(wb, ws, tr ? "Form_Basvurulari" : "Submissions");
186
+ const out = XLSX.write(wb, { bookType: "xlsx", type: "array" });
187
+ const blob = new Blob([out], {
188
+ type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
189
+ });
190
+ const url = URL.createObjectURL(blob);
191
+ const a = document.createElement("a");
192
+ a.href = url;
193
+ a.download = `form-submissions-${selectedFormSlug}.xlsx`;
194
+ document.body.appendChild(a);
195
+ a.click();
196
+ document.body.removeChild(a);
197
+ URL.revokeObjectURL(url);
198
+ };
119
199
  const currentSurvey = surveys.find((s) => s.slug === selectedSurveySlug) || surveys[0] || null;
120
200
  const totalAllResponses = surveys.reduce((acc, s) => acc + (s.responseCount || 0), 0);
121
201
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -171,6 +251,7 @@ const AnalyticsHubPage = () => {
171
251
  type: "button",
172
252
  onClick: () => {
173
253
  setStudioTarget(SurveyWidgetEditor.createBlankSurveyDraft(uiLocale));
254
+ setStudioInitialTab("builder");
174
255
  setStudioOpen(true);
175
256
  },
176
257
  style: {
@@ -192,6 +273,86 @@ const AnalyticsHubPage = () => {
192
273
  ]
193
274
  }
194
275
  ),
276
+ /* @__PURE__ */ jsxRuntime.jsxs(
277
+ "button",
278
+ {
279
+ type: "button",
280
+ onClick: () => setImportModalOpen(true),
281
+ style: {
282
+ padding: "8px 12px",
283
+ borderRadius: 8,
284
+ border: "1px solid rgba(56, 189, 248, 0.5)",
285
+ background: "rgba(14, 165, 233, 0.16)",
286
+ color: "#e0f2fe",
287
+ fontSize: 11.5,
288
+ fontWeight: 700,
289
+ cursor: "pointer",
290
+ display: "inline-flex",
291
+ alignItems: "center",
292
+ gap: 6
293
+ },
294
+ 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",
295
+ children: [
296
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "upload_file", size: 15, color: "#7dd3fc" }),
297
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "JSON İçe Aktar" : "Import JSON" })
298
+ ]
299
+ }
300
+ ),
301
+ /* @__PURE__ */ jsxRuntime.jsxs(
302
+ "button",
303
+ {
304
+ type: "button",
305
+ disabled: surveys.length === 0,
306
+ onClick: () => {
307
+ setExportDefaultScope("all");
308
+ setExportModalOpen(true);
309
+ },
310
+ style: {
311
+ padding: "8px 12px",
312
+ borderRadius: 8,
313
+ border: "1px solid rgba(52, 211, 153, 0.45)",
314
+ background: "rgba(16, 185, 129, 0.16)",
315
+ color: "#d1fae5",
316
+ fontSize: 11.5,
317
+ fontWeight: 700,
318
+ opacity: surveys.length === 0 ? 0.55 : 1,
319
+ cursor: surveys.length === 0 ? "not-allowed" : "pointer",
320
+ display: "inline-flex",
321
+ alignItems: "center",
322
+ gap: 6
323
+ },
324
+ 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)",
325
+ children: [
326
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "download", size: 15, color: "#6ee7b7" }),
327
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Yedekle / Dışa Aktar" : "Export Bundle" })
328
+ ]
329
+ }
330
+ ),
331
+ /* @__PURE__ */ jsxRuntime.jsxs(
332
+ "button",
333
+ {
334
+ type: "button",
335
+ onClick: () => setCleanupAction("purge-demo"),
336
+ style: {
337
+ padding: "8px 12px",
338
+ borderRadius: 8,
339
+ border: "1px solid rgba(251, 146, 60, 0.48)",
340
+ background: "rgba(234, 88, 12, 0.18)",
341
+ color: "#ffedd5",
342
+ fontSize: 11.5,
343
+ fontWeight: 700,
344
+ cursor: "pointer",
345
+ display: "inline-flex",
346
+ alignItems: "center",
347
+ gap: 6
348
+ },
349
+ 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",
350
+ children: [
351
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "delete_sweep", size: 15, color: "#fdba74" }),
352
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Dummy Veriyi Temizle" : "Purge Demo Data" })
353
+ ]
354
+ }
355
+ ),
195
356
  /* @__PURE__ */ jsxRuntime.jsxs(
196
357
  "button",
197
358
  {
@@ -211,10 +372,10 @@ const AnalyticsHubPage = () => {
211
372
  alignItems: "center",
212
373
  gap: 6
213
374
  },
214
- title: tr ? "Örnek analiz veri kümesini (525 anket yanıtı + 20 form başvurusu) yeniler" : "Refreshes the 525-response correlated analytics dataset",
375
+ 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",
215
376
  children: [
216
377
  /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "refresh", size: 15, color: "#38bdf8" }),
217
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: reseeding ? "..." : tr ? "Örnek Veriyi Yenile" : "Refresh Sample Data" })
378
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: reseeding ? "..." : tr ? "Örnek Veriyi Geri Yükle" : "Restore Sample Data" })
218
379
  ]
219
380
  }
220
381
  ),
@@ -358,6 +519,46 @@ const AnalyticsHubPage = () => {
358
519
  ]
359
520
  }
360
521
  ),
522
+ hubNotice && /* @__PURE__ */ jsxRuntime.jsxs(
523
+ "div",
524
+ {
525
+ style: {
526
+ margin: "14px 28px 0",
527
+ padding: "10px 16px",
528
+ borderRadius: 9,
529
+ background: "#ecfdf5",
530
+ border: "1px solid #6ee7b7",
531
+ color: "#065f46",
532
+ fontSize: 12.5,
533
+ fontWeight: 700,
534
+ display: "flex",
535
+ alignItems: "center",
536
+ justifyContent: "space-between",
537
+ gap: 12
538
+ },
539
+ children: [
540
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
541
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "check_circle", size: 18, color: "#059669" }),
542
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: hubNotice })
543
+ ] }),
544
+ /* @__PURE__ */ jsxRuntime.jsx(
545
+ "button",
546
+ {
547
+ type: "button",
548
+ onClick: () => setHubNotice(""),
549
+ style: {
550
+ border: "none",
551
+ background: "transparent",
552
+ color: "#065f46",
553
+ fontSize: 16,
554
+ cursor: "pointer"
555
+ },
556
+ children: "×"
557
+ }
558
+ )
559
+ ]
560
+ }
561
+ ),
361
562
  section === "colors" ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "22px 28px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
362
563
  "div",
363
564
  {
@@ -370,7 +571,99 @@ const AnalyticsHubPage = () => {
370
571
  },
371
572
  children: /* @__PURE__ */ jsxRuntime.jsx(SurveyWidgetEditor.ColorCodesManager, { locale: uiLocale })
372
573
  }
373
- ) }) : section === "surveys" ? /* @__PURE__ */ jsxRuntime.jsxs(
574
+ ) }) : section === "surveys" ? surveys.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "36px 28px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
575
+ "div",
576
+ {
577
+ style: {
578
+ maxWidth: 640,
579
+ margin: "0 auto",
580
+ padding: "38px 32px",
581
+ borderRadius: 14,
582
+ background: "#ffffff",
583
+ border: "1px solid #cbd5e1",
584
+ textAlign: "center",
585
+ boxShadow: "0 6px 20px rgba(15, 23, 42, 0.04)"
586
+ },
587
+ children: [
588
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "poll", size: 40, color: "#2563eb" }),
589
+ /* @__PURE__ */ jsxRuntime.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" }),
590
+ /* @__PURE__ */ jsxRuntime.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." }),
591
+ /* @__PURE__ */ jsxRuntime.jsxs(
592
+ "div",
593
+ {
594
+ style: {
595
+ display: "flex",
596
+ alignItems: "center",
597
+ justifyContent: "center",
598
+ flexWrap: "wrap",
599
+ gap: 10
600
+ },
601
+ children: [
602
+ /* @__PURE__ */ jsxRuntime.jsx(
603
+ "button",
604
+ {
605
+ type: "button",
606
+ onClick: () => {
607
+ setStudioTarget(SurveyWidgetEditor.createBlankSurveyDraft(uiLocale));
608
+ setStudioInitialTab("builder");
609
+ setStudioOpen(true);
610
+ },
611
+ style: {
612
+ padding: "9px 16px",
613
+ borderRadius: 8,
614
+ border: "none",
615
+ background: "#2563eb",
616
+ color: "#ffffff",
617
+ fontSize: 12.5,
618
+ fontWeight: 700,
619
+ cursor: "pointer"
620
+ },
621
+ children: tr ? "+ Yeni Anket Oluştur" : "+ Create New Survey"
622
+ }
623
+ ),
624
+ /* @__PURE__ */ jsxRuntime.jsx(
625
+ "button",
626
+ {
627
+ type: "button",
628
+ onClick: () => setImportModalOpen(true),
629
+ style: {
630
+ padding: "9px 16px",
631
+ borderRadius: 8,
632
+ border: "1px solid #2563eb",
633
+ background: "#eff6ff",
634
+ color: "#1d4ed8",
635
+ fontSize: 12.5,
636
+ fontWeight: 700,
637
+ cursor: "pointer"
638
+ },
639
+ children: tr ? "JSON Paketinden İçe Aktar" : "Import from JSON Bundle"
640
+ }
641
+ ),
642
+ /* @__PURE__ */ jsxRuntime.jsx(
643
+ "button",
644
+ {
645
+ type: "button",
646
+ disabled: reseeding,
647
+ onClick: handleReseedDemo,
648
+ style: {
649
+ padding: "9px 14px",
650
+ borderRadius: 8,
651
+ border: "1px solid #cbd5e1",
652
+ background: "#f8fafc",
653
+ color: "#334155",
654
+ fontSize: 12,
655
+ fontWeight: 600,
656
+ cursor: "pointer"
657
+ },
658
+ children: tr ? "Örnek Verileri Geri Yükle" : "Restore Sample Data"
659
+ }
660
+ )
661
+ ]
662
+ }
663
+ )
664
+ ]
665
+ }
666
+ ) }) : /* @__PURE__ */ jsxRuntime.jsxs(
374
667
  "div",
375
668
  {
376
669
  style: {
@@ -409,7 +702,7 @@ const AnalyticsHubPage = () => {
409
702
  cursor: "pointer",
410
703
  display: "flex",
411
704
  flexDirection: "column",
412
- gap: 6
705
+ gap: 5
413
706
  },
414
707
  children: [
415
708
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -441,6 +734,7 @@ const AnalyticsHubPage = () => {
441
734
  }
442
735
  ),
443
736
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 13, fontWeight: 700, color: "#0f172a" }, children: SurveyWidgetEditor.pickTextForLocale(srv.titleI18n, uiLocale, srv.title) }),
737
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 10.5, color: "#64748b" }, children: /* @__PURE__ */ jsxRuntime.jsx("code", { children: srv.slug }) }),
444
738
  /* @__PURE__ */ jsxRuntime.jsxs(
445
739
  "div",
446
740
  {
@@ -482,35 +776,149 @@ const AnalyticsHubPage = () => {
482
776
  srv.slug
483
777
  );
484
778
  }),
485
- currentSurvey && /* @__PURE__ */ jsxRuntime.jsxs(
486
- "button",
487
- {
488
- type: "button",
489
- onClick: () => {
490
- setStudioTarget(currentSurvey);
491
- setStudioOpen(true);
492
- },
493
- style: {
494
- marginTop: 4,
495
- padding: "9px 12px",
496
- borderRadius: 8,
497
- border: "1px solid #2563eb",
498
- background: "#ffffff",
499
- color: "#1d4ed8",
500
- fontSize: 12,
501
- fontWeight: 700,
502
- cursor: "pointer",
503
- display: "inline-flex",
504
- alignItems: "center",
505
- justifyContent: "center",
506
- gap: 6
507
- },
508
- children: [
509
- /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "edit", size: 15, color: "#2563eb" }),
510
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Seçili Anketi Düzenle (Studio)" : "Edit Selected Survey (Studio)" })
511
- ]
512
- }
513
- )
779
+ currentSurvey && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 6, marginTop: 4 }, children: [
780
+ /* @__PURE__ */ jsxRuntime.jsxs(
781
+ "button",
782
+ {
783
+ type: "button",
784
+ onClick: () => {
785
+ setStudioTarget(currentSurvey);
786
+ setStudioInitialTab("builder");
787
+ setStudioOpen(true);
788
+ },
789
+ style: {
790
+ padding: "9px 12px",
791
+ borderRadius: 8,
792
+ border: "1px solid #2563eb",
793
+ background: "#ffffff",
794
+ color: "#1d4ed8",
795
+ fontSize: 12,
796
+ fontWeight: 700,
797
+ cursor: "pointer",
798
+ display: "inline-flex",
799
+ alignItems: "center",
800
+ justifyContent: "center",
801
+ gap: 6
802
+ },
803
+ children: [
804
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "edit", size: 15, color: "#2563eb" }),
805
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Seçili Anketi Düzenle (Studio)" : "Edit Selected Survey (Studio)" })
806
+ ]
807
+ }
808
+ ),
809
+ /* @__PURE__ */ jsxRuntime.jsxs(
810
+ "button",
811
+ {
812
+ type: "button",
813
+ onClick: () => {
814
+ setStudioTarget(currentSurvey);
815
+ setStudioInitialTab("preview");
816
+ setStudioOpen(true);
817
+ },
818
+ style: {
819
+ padding: "9px 12px",
820
+ borderRadius: 8,
821
+ border: "1px solid #059669",
822
+ background: "#ecfdf5",
823
+ color: "#065f46",
824
+ fontSize: 12,
825
+ fontWeight: 700,
826
+ cursor: "pointer",
827
+ display: "inline-flex",
828
+ alignItems: "center",
829
+ justifyContent: "center",
830
+ gap: 6
831
+ },
832
+ children: [
833
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "play_circle", size: 16, color: "#059669" }),
834
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Anket Akışını Önizle & Test Et" : "Preview & Test Survey Flow" })
835
+ ]
836
+ }
837
+ ),
838
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 5 }, children: [
839
+ /* @__PURE__ */ jsxRuntime.jsxs(
840
+ "button",
841
+ {
842
+ type: "button",
843
+ onClick: () => {
844
+ setExportDefaultScope("single");
845
+ setExportModalOpen(true);
846
+ },
847
+ title: tr ? "Seçili anketi Yapı veya Yapı + Veri olarak dışa aktar" : "Export selected survey (Structure or Full)",
848
+ style: {
849
+ padding: "7px 6px",
850
+ borderRadius: 7,
851
+ border: "1px solid #cbd5e1",
852
+ background: "#f8fafc",
853
+ color: "#0f172a",
854
+ fontSize: 10.5,
855
+ fontWeight: 700,
856
+ cursor: "pointer",
857
+ display: "inline-flex",
858
+ alignItems: "center",
859
+ justifyContent: "center",
860
+ gap: 4
861
+ },
862
+ children: [
863
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "download", size: 14, color: "#2563eb" }),
864
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Dışa Aktar" : "Export" })
865
+ ]
866
+ }
867
+ ),
868
+ /* @__PURE__ */ jsxRuntime.jsxs(
869
+ "button",
870
+ {
871
+ type: "button",
872
+ onClick: () => setCleanupAction("clear-responses"),
873
+ 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",
874
+ style: {
875
+ padding: "7px 6px",
876
+ borderRadius: 7,
877
+ border: "1px solid #fcd34d",
878
+ background: "#fffbeb",
879
+ color: "#92400e",
880
+ fontSize: 10.5,
881
+ fontWeight: 700,
882
+ cursor: "pointer",
883
+ display: "inline-flex",
884
+ alignItems: "center",
885
+ justifyContent: "center",
886
+ gap: 4
887
+ },
888
+ children: [
889
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "restart_alt", size: 14, color: "#d97706" }),
890
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Yanıt 0'la" : "Reset" })
891
+ ]
892
+ }
893
+ ),
894
+ /* @__PURE__ */ jsxRuntime.jsxs(
895
+ "button",
896
+ {
897
+ type: "button",
898
+ onClick: () => setCleanupAction("delete-survey"),
899
+ title: tr ? "Bu anketi ve tüm yanıtlarını kalıcı olarak siler" : "Delete this survey and all its responses",
900
+ style: {
901
+ padding: "7px 6px",
902
+ borderRadius: 7,
903
+ border: "1px solid #fecaca",
904
+ background: "#fef2f2",
905
+ color: "#991b1b",
906
+ fontSize: 10.5,
907
+ fontWeight: 700,
908
+ cursor: "pointer",
909
+ display: "inline-flex",
910
+ alignItems: "center",
911
+ justifyContent: "center",
912
+ gap: 4
913
+ },
914
+ children: [
915
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "delete", size: 14, color: "#dc2626" }),
916
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Sil" : "Delete" })
917
+ ]
918
+ }
919
+ )
920
+ ] })
921
+ ] })
514
922
  ]
515
923
  }
516
924
  ),
@@ -583,30 +991,56 @@ const AnalyticsHubPage = () => {
583
991
  }
584
992
  )
585
993
  ] }),
586
- /* @__PURE__ */ jsxRuntime.jsxs(
587
- "button",
588
- {
589
- type: "button",
590
- onClick: exportFormSubmissionsCsv,
591
- style: {
592
- padding: "7px 14px",
593
- borderRadius: 6,
594
- border: "none",
595
- background: "#059669",
596
- color: "#ffffff",
597
- fontSize: 12,
598
- fontWeight: 700,
599
- cursor: "pointer",
600
- display: "inline-flex",
601
- alignItems: "center",
602
- gap: 6
603
- },
604
- children: [
605
- /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "download", size: 15, color: "#fff" }),
606
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Başvuruları CSV İndir" : "Export Submissions CSV" })
607
- ]
608
- }
609
- )
994
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
995
+ /* @__PURE__ */ jsxRuntime.jsxs(
996
+ "button",
997
+ {
998
+ type: "button",
999
+ onClick: exportFormSubmissionsXlsx,
1000
+ style: {
1001
+ padding: "7px 14px",
1002
+ borderRadius: 6,
1003
+ border: "none",
1004
+ background: "#059669",
1005
+ color: "#ffffff",
1006
+ fontSize: 12,
1007
+ fontWeight: 700,
1008
+ cursor: "pointer",
1009
+ display: "inline-flex",
1010
+ alignItems: "center",
1011
+ gap: 6
1012
+ },
1013
+ children: [
1014
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "table_view", size: 15, color: "#fff" }),
1015
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Excel İndir (.xlsx)" : "Export Excel (.xlsx)" })
1016
+ ]
1017
+ }
1018
+ ),
1019
+ /* @__PURE__ */ jsxRuntime.jsxs(
1020
+ "button",
1021
+ {
1022
+ type: "button",
1023
+ onClick: exportFormSubmissionsCsv,
1024
+ style: {
1025
+ padding: "7px 12px",
1026
+ borderRadius: 6,
1027
+ border: "1px solid #10b981",
1028
+ background: "#ecfdf5",
1029
+ color: "#065f46",
1030
+ fontSize: 12,
1031
+ fontWeight: 700,
1032
+ cursor: "pointer",
1033
+ display: "inline-flex",
1034
+ alignItems: "center",
1035
+ gap: 6
1036
+ },
1037
+ children: [
1038
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "download", size: 15, color: "#059669" }),
1039
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "CSV" })
1040
+ ]
1041
+ }
1042
+ )
1043
+ ] })
610
1044
  ]
611
1045
  }
612
1046
  ),
@@ -672,6 +1106,7 @@ const AnalyticsHubPage = () => {
672
1106
  {
673
1107
  open: studioOpen,
674
1108
  initialSurvey: studioTarget,
1109
+ initialTab: studioInitialTab,
675
1110
  uiLocale,
676
1111
  onClose: () => setStudioOpen(false),
677
1112
  onSaved: (saved) => {
@@ -680,6 +1115,67 @@ const AnalyticsHubPage = () => {
680
1115
  setAnalyticsRefreshKey((k) => k + 1);
681
1116
  }
682
1117
  }
1118
+ ),
1119
+ /* @__PURE__ */ jsxRuntime.jsx(
1120
+ SurveyWidgetEditor.SurveyExportModal,
1121
+ {
1122
+ open: exportModalOpen,
1123
+ uiLocale,
1124
+ targetSurvey: currentSurvey,
1125
+ allowAllSurveys: true,
1126
+ defaultScope: exportDefaultScope,
1127
+ totalSurveysCount: surveys.length,
1128
+ onClose: () => setExportModalOpen(false)
1129
+ }
1130
+ ),
1131
+ /* @__PURE__ */ jsxRuntime.jsx(
1132
+ SurveyWidgetEditor.SurveyImportModal,
1133
+ {
1134
+ open: importModalOpen,
1135
+ uiLocale,
1136
+ existingSlugs: surveys.map((s) => s.slug),
1137
+ onClose: () => setImportModalOpen(false),
1138
+ onImported: async (res) => {
1139
+ await loadSurveys();
1140
+ if (res.importedSurveys?.[0]?.slug) {
1141
+ setSelectedSurveySlug(res.importedSurveys[0].slug);
1142
+ }
1143
+ setAnalyticsRefreshKey((k) => k + 1);
1144
+ setHubNotice(
1145
+ 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)!`
1146
+ );
1147
+ }
1148
+ }
1149
+ ),
1150
+ /* @__PURE__ */ jsxRuntime.jsx(
1151
+ SurveyWidgetEditor.SurveyCleanupConfirmModal,
1152
+ {
1153
+ open: Boolean(cleanupAction),
1154
+ action: cleanupAction,
1155
+ uiLocale,
1156
+ targetSurvey: currentSurvey,
1157
+ onClose: () => setCleanupAction(null),
1158
+ onCompleted: async (act, payload) => {
1159
+ await loadSurveys();
1160
+ if (section === "forms" || act === "purge-demo") {
1161
+ await loadFormsAndSubmissions();
1162
+ }
1163
+ setAnalyticsRefreshKey((k) => k + 1);
1164
+ if (act === "purge-demo") {
1165
+ setHubNotice(
1166
+ 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).`
1167
+ );
1168
+ } else if (act === "clear-responses") {
1169
+ setHubNotice(
1170
+ tr ? `Seçili anketin ${payload?.deletedCount || 0} yanıtı sıfırlandı.` : `Cleared ${payload?.deletedCount || 0} response(s) from the selected survey.`
1171
+ );
1172
+ } else if (act === "delete-survey") {
1173
+ setHubNotice(
1174
+ tr ? "Anket ve bağlı yanıtları kalıcı olarak silindi." : "Survey and its responses were permanently deleted."
1175
+ );
1176
+ }
1177
+ }
1178
+ }
683
1179
  )
684
1180
  ]
685
1181
  }