@ozguraltan/strapi-content-input 1.0.22 → 1.0.23

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 CHANGED
@@ -300,7 +300,7 @@ The **`survey`** widget provides a full-featured survey, NPS, and quick-poll pla
300
300
  | `image_choice` | Visual cards backed by Strapi Media Library (`option.image`) | Visual option `%` distribution bars |
301
301
  | `nps` | `0–10` Net Promoter Score scale with localized endpoint labels | **NPS Score Gauge (`-100..+100`)** + Promoters (`9–10`), Passives (`7–8`), Detractors (`0–6`) + `0..10` histogram |
302
302
  | `star_rating` | `1–5` or `1–10` interactive star rating | Weighted average score (`★`) + per-score vertical histogram |
303
- | `likert_scale` | `1–5` or `1–7` agreement scale with `lowLabel` / `highLabel` | Weighted average + distribution histogram |
303
+ | `likert_scale` | `1–5` or `1–7` scale with `lowLabel`/`highLabel` **or** per-score Strapi `i18n` `scaleLabels` + 1-click presets | Weighted average + labeled distribution histogram |
304
304
  | `matrix_single` | Evaluation table (`rows[] × columns[]`, 1 choice per row) | **Color-coded Matrix Heatmap Table** (`%` & count per cell) |
305
305
  | `ranking` | Drag-and-drop + ↑/↓ priority ordering of items | **Borda Count Leaderboard** (Average Rank, `#1` votes, Borda score `%`) |
306
306
  | `short_text` | Single-line open-ended input with `vee-validate` rules (`email`, `min`, `max`, etc.) | Searchable Open-Ended Response Feed with locale & timestamp |
@@ -341,8 +341,10 @@ Reporting is available in **two places** inside Strapi Admin:
341
341
  - Global dashboard for all surveys, polls, and dynamic form submissions.
342
342
  - **4 KPI Cards:** Total Responses & Quota progress, Average & Median Completion Time (`durationMs`), Net Promoter Score (`-100..+100`) stacked bar, and Locale breakdown.
343
343
  - **30-Day Daily Participation Trend** bar chart + Date Range (`from`/`to`) & `Locale` filters.
344
- - **1-Click Export:** UTF-8 BOM `.csv` (opens directly in Microsoft Excel with Turkish/Unicode characters intact) and structured `.json` export (`GET /content-input/surveys/:id/export?format=csv|json`).
345
- 2. **Inline `Survey Studio Modal` -> `Tab 4: Analytics & Reports`:** View live charts for the selected survey directly inside the Content Manager page editor.
344
+ - **1-Click Export (`.xlsx`, `.csv`, `.json`):** Multi-sheet native Microsoft Excel **`.xlsx`** workbook (`Responses` + `Summary` sheets with auto-fitted columns), UTF-8 BOM `.csv`, and structured `.json` export (`GET /content-input/surveys/:id/export?format=xlsx|csv|json`), plus `.xlsx` & `.csv` export for Dynamic Form submissions.
345
+ 2. **Inline `Survey Studio Modal` -> `Tab 2: Live Flow Preview & Simulator` & `Tab 4: Analytics & Reports`:**
346
+ - **`Tab 2: Live Flow Preview & Simulator` (`SurveyLivePreviewPane`):** Interactive sandbox inside the Survey Studio modal (works directly against unsaved `draft` state without polluting live analytics DB) with **Desktop / Tablet / Mobile** viewport switcher, **Strapi `i18n` test locale** switcher, full multi-step wizard & validation testing across all 13 question types, **Reset Flow**, and a real-time **Skip Logic Visibility & JSON Payload Inspector**.
347
+ - **`Tab 4: Analytics & Reports`:** View live charts for the selected survey directly inside the Content Manager page editor.
346
348
  3. **Rich Seed Dataset Included in Playground (`525` Responses):** Boots automatically with 3 realistic showcase surveys (`showcase_dx_survey` with `185` correlated 30-day responses, `showcase_roadmap_poll` with `245` votes, and `showcase_visual_theme_poll` with `95` votes) plus `20` sample corporate form submissions.
347
349
 
348
350
  ---
@@ -574,7 +576,7 @@ export default () => ({
574
576
  - `multi_step`: Adım çubuklu, ilerleme yüzdeli, her adımda validasyon yapan **Çok Adımlı Sihirbaz (Wizard)** modu.
575
577
  2. **13 Soru ve Öğe Tipi:**
576
578
  - Seçimli tipler: `single_choice` (Tekli Seçim + `"Diğer"` açık uçlu seçenek + şık karıştırma), `multiple_choice` (Çoklu Seçim + `minSelections`/`maxSelections`), `dropdown` (Açılır Liste), `image_choice` (Strapi Medya Kütüphanesi görselli kart seçimi).
577
- - Ölçek, Matris ve Sıralama: `nps` (`0–10` Net Promoter Score), `star_rating` (`1–5` / `1–10` Yıldız), `likert_scale` (`1–5` / `1–7` Katılım Ölçeği), `matrix_single` (Satır × Sütun değerlendirme tablosu), `ranking` (Sürükle-bırak öncelik sıralama ve **Borda Puanlama**).
579
+ - Ölçek, Matris ve Sıralama: `nps` (`0–10` Net Promoter Score), `star_rating` (`1–5` / `1–10` Yıldız), `likert_scale` (`1–5` / `1–7` Katılım Ölçeği — sadece uç etiketler veya Strapi `i18n` dilleri kadar her puana özel `scaleLabels` + tek tık hazır şablonlar), `matrix_single` (Satır × Sütun değerlendirme tablosu), `ranking` (Sürükle-bırak öncelik sıralama ve **Borda Puanlama**).
578
580
  - Metin, Onay ve Bilgi: `short_text`, `long_text` (`vee-validate` kurallı), `consent` (KVKK/GDPR onayı) ve `statement` (bilgi/bölüm açıklaması).
579
581
  3. **Sabit Seçenek Kimliği (`option.id`) + Dinamik Strapi `i18n` Etiketleri:**
580
582
  - Seçenekler sabit bir `id` (`"opt_ai"`) ve Strapi `i18n` dillerine göre dinamik `labels` (`{ tr: "...", en: "...", de: "..." }`) sözlüğü ile saklanır. Böylece farklı dillerde verilen tüm oylar raporlama ekranında tek bir grafik çubuğunda birleşir.
@@ -584,8 +586,9 @@ export default () => ({
584
586
  - `status` (`draft` / `published` / `closed`), başlangıç/bitiş tarihi (`startsAt`/`endsAt`), maksimum yanıt kotası (`quotaLimit`).
585
587
  - `submissionPolicy`: `'one_per_voter'` (`localStorage` + sunucuda tuzlanmış **`HMAC-SHA256(IP + User-Agent + voterToken)`** kontrolü ile mükerrer oyda `HTTP 409`), `'one_per_token'` veya `'unlimited'`.
586
588
  - `anonymizeIp: true` ile ham IP kaydetmeden anonim parmak izi üretimi, `_hp` honeypot, isteğe bağlı Google reCAPTCHA v2 ve katılımcılara canlı sonuç gösterimi (`showPublicResults`: `'never' | 'after_vote' | 'always'`).
587
- 6. **Strapi Sol Menü "Surveys & Forms" Raporlama Merkezi (`/admin/plugins/content-input`):**
588
- - Hem Strapi sol menüsündeki bağımsız **Surveys & Forms** sayfasından hem de **Anket Stüdyosu -> Raporlama & Analiz** sekmesinden erişilebilir.
589
+ 6. **Canlı Önizleme & Akış Testi Sekmesi (`Tab 2`) + Strapi Sol Menü Raporlama Merkezi (`/admin/plugins/content-input`):**
590
+ - **Anket Stüdyosu -> `2. Önizleme & Canlı Akış Testi` Sekmesi:** Henüz veritabanına kaydetmeden taslak (`draft`) üzerinde tüm 13 soru tipini, çok adımlı sihirbaz (`multi_step`) geçişlerini, alan validasyonlarını, **Masaüstü / Tablet / Mobil** görünüm çerçevelerini, çok dilli (`i18n`) metinleri ve **Koşul & Yanıt Müfettişi** (hangi sorunun hangi koşulla gizlendiği + canlı JSON payload) panelini gerçek istatistikleri kirletmeden uçtan uca test etme imkanı sunar.
591
+ - Raporlama ekranına hem Strapi sol menüsündeki bağımsız **Surveys & Forms** sayfasından hem de **Anket Stüdyosu -> `4. Raporlama & Analiz`** sekmesinden erişilebilir.
589
592
  - Toplam yanıt & kota doluluk oranı, ortalama/medyan tamamlama süresi, **NPS Skoru (`-100..+100` — Destekçiler / Pasifler / Eleştirenler)**, **30 Günlük Katılım Trendi**, Matris **Isı Haritası (Heatmap)**, Borda Sıralama Liderlik Tablosu, aranabilir açık uçlu yanıt listesi, Tarih & Dil filtreleri ve tek tıkla **Excel uyumlu UTF-8 BOM `.csv` / `.json`** indirme özelliklerini içerir.
590
593
  - Playground ortamı **525 korelasyonlu örnek anket yanıtı** (`showcase_dx_survey`: `185`, `showcase_roadmap_poll`: `245`, `showcase_visual_theme_poll`: `95`) ve **20 örnek kurumsal form başvurusu** ile hazır gelir.
591
594
 
@@ -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 { M as MaterialIcon } from "./index-Dc7AFLOj.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-DGSwgTzR.mjs";
4
+ import * as XLSXNs from "xlsx";
5
+ import { M as MaterialIcon } from "./index-AePRA0IB.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 persistLocale } from "./SurveyWidgetEditor-DMWOkHUt.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,6 +24,7 @@ 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
  );
@@ -114,6 +117,57 @@ const AnalyticsHubPage = () => {
114
117
  document.body.removeChild(a);
115
118
  URL.revokeObjectURL(url);
116
119
  };
120
+ const exportFormSubmissionsXlsx = () => {
121
+ if (submissions.length === 0) return;
122
+ const dataKeys = Array.from(
123
+ new Set(
124
+ submissions.flatMap(
125
+ (s) => s.data && typeof s.data === "object" ? Object.keys(s.data) : []
126
+ )
127
+ )
128
+ );
129
+ const headers = ["ID", "Form", "Created At", "Mail Sent", ...dataKeys];
130
+ const formatCell = (v) => {
131
+ if (v === null || v === void 0) return "";
132
+ if (typeof v === "number") return v;
133
+ if (Array.isArray(v)) return v.join("; ");
134
+ if (typeof v === "object") return JSON.stringify(v);
135
+ return String(v);
136
+ };
137
+ const aoa = [headers];
138
+ for (const s of submissions) {
139
+ aoa.push([
140
+ String(s.id || s.documentId || ""),
141
+ String(s.formTitle || s.formSlug || ""),
142
+ String(s.createdAt || ""),
143
+ s.mailSent ? "Yes" : "No",
144
+ ...dataKeys.map((k) => formatCell(s.data?.[k]))
145
+ ]);
146
+ }
147
+ const ws = XLSX.utils.aoa_to_sheet(aoa);
148
+ ws["!cols"] = headers.map((h, cIdx) => {
149
+ let maxLen = Math.max(12, h.length);
150
+ for (let r = 1; r < Math.min(aoa.length, 250); r++) {
151
+ const len = String(aoa[r]?.[cIdx] ?? "").length;
152
+ if (len > maxLen) maxLen = len;
153
+ }
154
+ return { wch: Math.min(52, maxLen + 3) };
155
+ });
156
+ const wb = XLSX.utils.book_new();
157
+ XLSX.utils.book_append_sheet(wb, ws, tr ? "Form_Basvurulari" : "Submissions");
158
+ const out = XLSX.write(wb, { bookType: "xlsx", type: "array" });
159
+ const blob = new Blob([out], {
160
+ type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
161
+ });
162
+ const url = URL.createObjectURL(blob);
163
+ const a = document.createElement("a");
164
+ a.href = url;
165
+ a.download = `form-submissions-${selectedFormSlug}.xlsx`;
166
+ document.body.appendChild(a);
167
+ a.click();
168
+ document.body.removeChild(a);
169
+ URL.revokeObjectURL(url);
170
+ };
117
171
  const currentSurvey = surveys.find((s) => s.slug === selectedSurveySlug) || surveys[0] || null;
118
172
  const totalAllResponses = surveys.reduce((acc, s) => acc + (s.responseCount || 0), 0);
119
173
  return /* @__PURE__ */ jsxs(
@@ -169,6 +223,7 @@ const AnalyticsHubPage = () => {
169
223
  type: "button",
170
224
  onClick: () => {
171
225
  setStudioTarget(createBlankSurveyDraft(uiLocale));
226
+ setStudioInitialTab("builder");
172
227
  setStudioOpen(true);
173
228
  },
174
229
  style: {
@@ -480,35 +535,66 @@ const AnalyticsHubPage = () => {
480
535
  srv.slug
481
536
  );
482
537
  }),
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
- )
538
+ currentSurvey && /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 6, marginTop: 4 }, children: [
539
+ /* @__PURE__ */ jsxs(
540
+ "button",
541
+ {
542
+ type: "button",
543
+ onClick: () => {
544
+ setStudioTarget(currentSurvey);
545
+ setStudioInitialTab("builder");
546
+ setStudioOpen(true);
547
+ },
548
+ style: {
549
+ padding: "9px 12px",
550
+ borderRadius: 8,
551
+ border: "1px solid #2563eb",
552
+ background: "#ffffff",
553
+ color: "#1d4ed8",
554
+ fontSize: 12,
555
+ fontWeight: 700,
556
+ cursor: "pointer",
557
+ display: "inline-flex",
558
+ alignItems: "center",
559
+ justifyContent: "center",
560
+ gap: 6
561
+ },
562
+ children: [
563
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "edit", size: 15, color: "#2563eb" }),
564
+ /* @__PURE__ */ jsx("span", { children: tr ? "Seçili Anketi Düzenle (Studio)" : "Edit Selected Survey (Studio)" })
565
+ ]
566
+ }
567
+ ),
568
+ /* @__PURE__ */ jsxs(
569
+ "button",
570
+ {
571
+ type: "button",
572
+ onClick: () => {
573
+ setStudioTarget(currentSurvey);
574
+ setStudioInitialTab("preview");
575
+ setStudioOpen(true);
576
+ },
577
+ style: {
578
+ padding: "9px 12px",
579
+ borderRadius: 8,
580
+ border: "1px solid #059669",
581
+ background: "#ecfdf5",
582
+ color: "#065f46",
583
+ fontSize: 12,
584
+ fontWeight: 700,
585
+ cursor: "pointer",
586
+ display: "inline-flex",
587
+ alignItems: "center",
588
+ justifyContent: "center",
589
+ gap: 6
590
+ },
591
+ children: [
592
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "play_circle", size: 16, color: "#059669" }),
593
+ /* @__PURE__ */ jsx("span", { children: tr ? "Anket Akışını Önizle & Test Et" : "Preview & Test Survey Flow" })
594
+ ]
595
+ }
596
+ )
597
+ ] })
512
598
  ]
513
599
  }
514
600
  ),
@@ -581,30 +667,56 @@ const AnalyticsHubPage = () => {
581
667
  }
582
668
  )
583
669
  ] }),
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
- )
670
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
671
+ /* @__PURE__ */ jsxs(
672
+ "button",
673
+ {
674
+ type: "button",
675
+ onClick: exportFormSubmissionsXlsx,
676
+ style: {
677
+ padding: "7px 14px",
678
+ borderRadius: 6,
679
+ border: "none",
680
+ background: "#059669",
681
+ color: "#ffffff",
682
+ fontSize: 12,
683
+ fontWeight: 700,
684
+ cursor: "pointer",
685
+ display: "inline-flex",
686
+ alignItems: "center",
687
+ gap: 6
688
+ },
689
+ children: [
690
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "table_view", size: 15, color: "#fff" }),
691
+ /* @__PURE__ */ jsx("span", { children: tr ? "Excel İndir (.xlsx)" : "Export Excel (.xlsx)" })
692
+ ]
693
+ }
694
+ ),
695
+ /* @__PURE__ */ jsxs(
696
+ "button",
697
+ {
698
+ type: "button",
699
+ onClick: exportFormSubmissionsCsv,
700
+ style: {
701
+ padding: "7px 12px",
702
+ borderRadius: 6,
703
+ border: "1px solid #10b981",
704
+ background: "#ecfdf5",
705
+ color: "#065f46",
706
+ fontSize: 12,
707
+ fontWeight: 700,
708
+ cursor: "pointer",
709
+ display: "inline-flex",
710
+ alignItems: "center",
711
+ gap: 6
712
+ },
713
+ children: [
714
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "download", size: 15, color: "#059669" }),
715
+ /* @__PURE__ */ jsx("span", { children: "CSV" })
716
+ ]
717
+ }
718
+ )
719
+ ] })
608
720
  ]
609
721
  }
610
722
  ),
@@ -670,6 +782,7 @@ const AnalyticsHubPage = () => {
670
782
  {
671
783
  open: studioOpen,
672
784
  initialSurvey: studioTarget,
785
+ initialTab: studioInitialTab,
673
786
  uiLocale,
674
787
  onClose: () => setStudioOpen(false),
675
788
  onSaved: (saved) => {
@@ -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-B9C8Qrfd.js");
8
+ const SurveyWidgetEditor = require("./SurveyWidgetEditor-DOYxWop9.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,6 +44,7 @@ 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
  );
@@ -116,6 +137,57 @@ const AnalyticsHubPage = () => {
116
137
  document.body.removeChild(a);
117
138
  URL.revokeObjectURL(url);
118
139
  };
140
+ const exportFormSubmissionsXlsx = () => {
141
+ if (submissions.length === 0) return;
142
+ const dataKeys = Array.from(
143
+ new Set(
144
+ submissions.flatMap(
145
+ (s) => s.data && typeof s.data === "object" ? Object.keys(s.data) : []
146
+ )
147
+ )
148
+ );
149
+ const headers = ["ID", "Form", "Created At", "Mail Sent", ...dataKeys];
150
+ const formatCell = (v) => {
151
+ if (v === null || v === void 0) return "";
152
+ if (typeof v === "number") return v;
153
+ if (Array.isArray(v)) return v.join("; ");
154
+ if (typeof v === "object") return JSON.stringify(v);
155
+ return String(v);
156
+ };
157
+ const aoa = [headers];
158
+ for (const s of submissions) {
159
+ aoa.push([
160
+ String(s.id || s.documentId || ""),
161
+ String(s.formTitle || s.formSlug || ""),
162
+ String(s.createdAt || ""),
163
+ s.mailSent ? "Yes" : "No",
164
+ ...dataKeys.map((k) => formatCell(s.data?.[k]))
165
+ ]);
166
+ }
167
+ const ws = XLSX.utils.aoa_to_sheet(aoa);
168
+ ws["!cols"] = headers.map((h, cIdx) => {
169
+ let maxLen = Math.max(12, h.length);
170
+ for (let r = 1; r < Math.min(aoa.length, 250); r++) {
171
+ const len = String(aoa[r]?.[cIdx] ?? "").length;
172
+ if (len > maxLen) maxLen = len;
173
+ }
174
+ return { wch: Math.min(52, maxLen + 3) };
175
+ });
176
+ const wb = XLSX.utils.book_new();
177
+ XLSX.utils.book_append_sheet(wb, ws, tr ? "Form_Basvurulari" : "Submissions");
178
+ const out = XLSX.write(wb, { bookType: "xlsx", type: "array" });
179
+ const blob = new Blob([out], {
180
+ type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
181
+ });
182
+ const url = URL.createObjectURL(blob);
183
+ const a = document.createElement("a");
184
+ a.href = url;
185
+ a.download = `form-submissions-${selectedFormSlug}.xlsx`;
186
+ document.body.appendChild(a);
187
+ a.click();
188
+ document.body.removeChild(a);
189
+ URL.revokeObjectURL(url);
190
+ };
119
191
  const currentSurvey = surveys.find((s) => s.slug === selectedSurveySlug) || surveys[0] || null;
120
192
  const totalAllResponses = surveys.reduce((acc, s) => acc + (s.responseCount || 0), 0);
121
193
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -171,6 +243,7 @@ const AnalyticsHubPage = () => {
171
243
  type: "button",
172
244
  onClick: () => {
173
245
  setStudioTarget(SurveyWidgetEditor.createBlankSurveyDraft(uiLocale));
246
+ setStudioInitialTab("builder");
174
247
  setStudioOpen(true);
175
248
  },
176
249
  style: {
@@ -482,35 +555,66 @@ const AnalyticsHubPage = () => {
482
555
  srv.slug
483
556
  );
484
557
  }),
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
- )
558
+ currentSurvey && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 6, marginTop: 4 }, children: [
559
+ /* @__PURE__ */ jsxRuntime.jsxs(
560
+ "button",
561
+ {
562
+ type: "button",
563
+ onClick: () => {
564
+ setStudioTarget(currentSurvey);
565
+ setStudioInitialTab("builder");
566
+ setStudioOpen(true);
567
+ },
568
+ style: {
569
+ padding: "9px 12px",
570
+ borderRadius: 8,
571
+ border: "1px solid #2563eb",
572
+ background: "#ffffff",
573
+ color: "#1d4ed8",
574
+ fontSize: 12,
575
+ fontWeight: 700,
576
+ cursor: "pointer",
577
+ display: "inline-flex",
578
+ alignItems: "center",
579
+ justifyContent: "center",
580
+ gap: 6
581
+ },
582
+ children: [
583
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "edit", size: 15, color: "#2563eb" }),
584
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Seçili Anketi Düzenle (Studio)" : "Edit Selected Survey (Studio)" })
585
+ ]
586
+ }
587
+ ),
588
+ /* @__PURE__ */ jsxRuntime.jsxs(
589
+ "button",
590
+ {
591
+ type: "button",
592
+ onClick: () => {
593
+ setStudioTarget(currentSurvey);
594
+ setStudioInitialTab("preview");
595
+ setStudioOpen(true);
596
+ },
597
+ style: {
598
+ padding: "9px 12px",
599
+ borderRadius: 8,
600
+ border: "1px solid #059669",
601
+ background: "#ecfdf5",
602
+ color: "#065f46",
603
+ fontSize: 12,
604
+ fontWeight: 700,
605
+ cursor: "pointer",
606
+ display: "inline-flex",
607
+ alignItems: "center",
608
+ justifyContent: "center",
609
+ gap: 6
610
+ },
611
+ children: [
612
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "play_circle", size: 16, color: "#059669" }),
613
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Anket Akışını Önizle & Test Et" : "Preview & Test Survey Flow" })
614
+ ]
615
+ }
616
+ )
617
+ ] })
514
618
  ]
515
619
  }
516
620
  ),
@@ -583,30 +687,56 @@ const AnalyticsHubPage = () => {
583
687
  }
584
688
  )
585
689
  ] }),
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
- )
690
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
691
+ /* @__PURE__ */ jsxRuntime.jsxs(
692
+ "button",
693
+ {
694
+ type: "button",
695
+ onClick: exportFormSubmissionsXlsx,
696
+ style: {
697
+ padding: "7px 14px",
698
+ borderRadius: 6,
699
+ border: "none",
700
+ background: "#059669",
701
+ color: "#ffffff",
702
+ fontSize: 12,
703
+ fontWeight: 700,
704
+ cursor: "pointer",
705
+ display: "inline-flex",
706
+ alignItems: "center",
707
+ gap: 6
708
+ },
709
+ children: [
710
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "table_view", size: 15, color: "#fff" }),
711
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Excel İndir (.xlsx)" : "Export Excel (.xlsx)" })
712
+ ]
713
+ }
714
+ ),
715
+ /* @__PURE__ */ jsxRuntime.jsxs(
716
+ "button",
717
+ {
718
+ type: "button",
719
+ onClick: exportFormSubmissionsCsv,
720
+ style: {
721
+ padding: "7px 12px",
722
+ borderRadius: 6,
723
+ border: "1px solid #10b981",
724
+ background: "#ecfdf5",
725
+ color: "#065f46",
726
+ fontSize: 12,
727
+ fontWeight: 700,
728
+ cursor: "pointer",
729
+ display: "inline-flex",
730
+ alignItems: "center",
731
+ gap: 6
732
+ },
733
+ children: [
734
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "download", size: 15, color: "#059669" }),
735
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "CSV" })
736
+ ]
737
+ }
738
+ )
739
+ ] })
610
740
  ]
611
741
  }
612
742
  ),
@@ -672,6 +802,7 @@ const AnalyticsHubPage = () => {
672
802
  {
673
803
  open: studioOpen,
674
804
  initialSurvey: studioTarget,
805
+ initialTab: studioInitialTab,
675
806
  uiLocale,
676
807
  onClose: () => setStudioOpen(false),
677
808
  onSaved: (saved) => {