@ozguraltan/strapi-content-input 1.0.21 → 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.
Files changed (29) hide show
  1. package/README.md +42 -13
  2. package/dist/admin/{AnalyticsHubPage-DsrcGI_Y.mjs → AnalyticsHubPage-Dvpx3KsP.mjs} +168 -55
  3. package/dist/admin/{AnalyticsHubPage-0p0Mx4AU.js → AnalyticsHubPage-K_trli5i.js} +186 -55
  4. package/dist/admin/{ContentInputField-CHXrzvE-.mjs → ContentInputField-C2kmtUwD.mjs} +328 -366
  5. package/dist/admin/{ContentInputField-7rWLSx_7.js → ContentInputField-CjxYYEps.js} +343 -381
  6. package/dist/admin/{SurveyWidgetEditor-BVN6X_3G.mjs → SurveyWidgetEditor-DMWOkHUt.mjs} +3271 -227
  7. package/dist/admin/{SurveyWidgetEditor-BmgYQaQS.js → SurveyWidgetEditor-DOYxWop9.js} +3247 -203
  8. package/dist/admin/{index-hFIuYqu5.mjs → index-AePRA0IB.mjs} +2 -2
  9. package/dist/admin/{index-CZAwXCFH.js → index-B9C8Qrfd.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/common/CIImageSettingsControl.d.ts +17 -0
  13. package/dist/admin/src/components/widgets/CustomCardWidgetEditor.d.ts +1 -0
  14. package/dist/admin/src/components/widgets/HeroSliderStage.d.ts +3 -0
  15. package/dist/admin/src/components/widgets/SurveyLivePreviewPane.d.ts +9 -0
  16. package/dist/admin/src/components/widgets/SurveyWidgetEditor.d.ts +3 -1
  17. package/dist/admin/src/core/canvasClasses.d.ts +1 -0
  18. package/dist/admin/src/core/types.d.ts +12 -0
  19. package/dist/server/index.js +1359 -196
  20. package/dist/server/index.mjs +1341 -196
  21. package/dist/server/src/config/index.d.ts +4 -0
  22. package/dist/server/src/controllers/ci-image.d.ts +11 -2
  23. package/dist/server/src/controllers/index.d.ts +1 -0
  24. package/dist/server/src/index.d.ts +15 -1
  25. package/dist/server/src/services/ci-survey.d.ts +10 -1
  26. package/dist/server/src/services/index.d.ts +10 -1
  27. package/dist/server/src/utils/image-variants.d.ts +74 -0
  28. package/dist/server/src/utils/surveyEngine.d.ts +5 -0
  29. 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-CZAwXCFH.js");
7
- const SurveyWidgetEditor = require("./SurveyWidgetEditor-BmgYQaQS.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) => {