@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 +9 -6
- package/dist/admin/{AnalyticsHubPage-DUj3D2kA.mjs → AnalyticsHubPage-Dvpx3KsP.mjs} +168 -55
- package/dist/admin/{AnalyticsHubPage-B1_chQkG.js → AnalyticsHubPage-K_trli5i.js} +186 -55
- package/dist/admin/{ContentInputField-BrtpTCDd.mjs → ContentInputField-C2kmtUwD.mjs} +6 -236
- package/dist/admin/{ContentInputField-CQFQxxgm.js → ContentInputField-CjxYYEps.js} +22 -252
- package/dist/admin/{SurveyWidgetEditor-DGSwgTzR.mjs → SurveyWidgetEditor-DMWOkHUt.mjs} +3222 -228
- package/dist/admin/{SurveyWidgetEditor-C5Uvyf_h.js → SurveyWidgetEditor-DOYxWop9.js} +3198 -204
- package/dist/admin/{index-Dc7AFLOj.mjs → index-AePRA0IB.mjs} +2 -2
- package/dist/admin/{index-i0NfSYto.js → index-B9C8Qrfd.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/SurveyWidgetEditor.d.ts +3 -1
- package/dist/server/index.js +183 -12
- package/dist/server/index.mjs +165 -12
- package/dist/server/src/index.d.ts +10 -1
- package/dist/server/src/services/ci-survey.d.ts +10 -1
- package/dist/server/src/services/index.d.ts +10 -1
- package/dist/server/src/utils/surveyEngine.d.ts +5 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, useMemo, useRef, createContext, useContext, useEffect, useCallback } from "react";
|
|
3
3
|
import ReactDOM, { createPortal } from "react-dom";
|
|
4
4
|
import { useFetchClient, useStrapiApp } from "@strapi/strapi/admin";
|
|
5
|
-
import { M as MaterialIcon } from "./index-
|
|
5
|
+
import { M as MaterialIcon } from "./index-AePRA0IB.mjs";
|
|
6
6
|
import cloneDeep from "lodash/cloneDeep";
|
|
7
7
|
const ROW_PRESETS = [
|
|
8
8
|
{
|
|
@@ -2527,6 +2527,236 @@ function useEditorTranslator() {
|
|
|
2527
2527
|
t: fallbackT
|
|
2528
2528
|
};
|
|
2529
2529
|
}
|
|
2530
|
+
const BP_INFIXES = ["", "-sm", "-md", "-lg", "-xl"];
|
|
2531
|
+
function extractResponsiveProp(lp, baseKey, camelKey) {
|
|
2532
|
+
if (!lp) return [null, null, null, null, null];
|
|
2533
|
+
const rawArr = lp[baseKey] ?? (camelKey ? lp[camelKey] : void 0);
|
|
2534
|
+
if (Array.isArray(rawArr)) {
|
|
2535
|
+
return BP_INFIXES.map((infix, idx) => {
|
|
2536
|
+
const explicitKey = `${baseKey}${infix}`;
|
|
2537
|
+
if (typeof lp[explicitKey] === "string" && lp[explicitKey]) {
|
|
2538
|
+
return lp[explicitKey];
|
|
2539
|
+
}
|
|
2540
|
+
const v = rawArr[idx];
|
|
2541
|
+
return typeof v === "string" && v ? v : null;
|
|
2542
|
+
});
|
|
2543
|
+
}
|
|
2544
|
+
return BP_INFIXES.map((infix, idx) => {
|
|
2545
|
+
const k = `${baseKey}${infix}`;
|
|
2546
|
+
if (typeof lp[k] === "string" && lp[k]) return lp[k];
|
|
2547
|
+
if (idx === 0 && camelKey && typeof lp[camelKey] === "string" && lp[camelKey]) {
|
|
2548
|
+
return lp[camelKey];
|
|
2549
|
+
}
|
|
2550
|
+
return null;
|
|
2551
|
+
});
|
|
2552
|
+
}
|
|
2553
|
+
function setResponsiveProp(lp, baseKey, bpIndex, value, camelKey) {
|
|
2554
|
+
const nextLp = { ...lp || {} };
|
|
2555
|
+
const arr = extractResponsiveProp(nextLp, baseKey, camelKey);
|
|
2556
|
+
const cleanVal = value && value.trim() ? value.trim() : null;
|
|
2557
|
+
arr[bpIndex] = cleanVal;
|
|
2558
|
+
const hasOtherValues = arr.some((v, i) => i !== bpIndex && v !== null);
|
|
2559
|
+
if (bpIndex !== 0 && !hasOtherValues && cleanVal !== null) {
|
|
2560
|
+
arr[0] = cleanVal;
|
|
2561
|
+
}
|
|
2562
|
+
nextLp[baseKey] = arr;
|
|
2563
|
+
if (camelKey) {
|
|
2564
|
+
nextLp[camelKey] = arr;
|
|
2565
|
+
}
|
|
2566
|
+
BP_INFIXES.forEach((infix, idx) => {
|
|
2567
|
+
if (idx === 0) return;
|
|
2568
|
+
const flatKey = `${baseKey}${infix}`;
|
|
2569
|
+
if (arr[idx]) {
|
|
2570
|
+
nextLp[flatKey] = arr[idx];
|
|
2571
|
+
} else {
|
|
2572
|
+
delete nextLp[flatKey];
|
|
2573
|
+
}
|
|
2574
|
+
});
|
|
2575
|
+
return nextLp;
|
|
2576
|
+
}
|
|
2577
|
+
function rowCanvasClasses(row = {}) {
|
|
2578
|
+
const classes = ["ci-grid"];
|
|
2579
|
+
const lp = row.layoutProps || {};
|
|
2580
|
+
if (lp.noGutters || lp["no-gutters"]) classes.push("ci-no-gutters");
|
|
2581
|
+
if (lp.fillHeight || lp["fill-height"]) classes.push("ci-fill-height");
|
|
2582
|
+
if (lp.reverse) classes.push("flex-row-reverse");
|
|
2583
|
+
if (lp.flexDirection === "column") classes.push("flex-column");
|
|
2584
|
+
const alignArr = extractResponsiveProp(lp, "align");
|
|
2585
|
+
const firstAlign = alignArr.find((v) => Boolean(v)) || null;
|
|
2586
|
+
if (!alignArr[0] && firstAlign) {
|
|
2587
|
+
classes.push(`ci-align-${firstAlign}`);
|
|
2588
|
+
}
|
|
2589
|
+
alignArr.forEach((val, idx) => {
|
|
2590
|
+
if (val && BP_INFIXES[idx] !== void 0) {
|
|
2591
|
+
classes.push(`ci-align${BP_INFIXES[idx]}-${val}`);
|
|
2592
|
+
}
|
|
2593
|
+
});
|
|
2594
|
+
const justifyArr = extractResponsiveProp(lp, "justify");
|
|
2595
|
+
const firstJustify = justifyArr.find((v) => Boolean(v)) || null;
|
|
2596
|
+
if (!justifyArr[0] && firstJustify) {
|
|
2597
|
+
classes.push(`ci-justify-${firstJustify}`);
|
|
2598
|
+
}
|
|
2599
|
+
justifyArr.forEach((val, idx) => {
|
|
2600
|
+
if (val && BP_INFIXES[idx] !== void 0) {
|
|
2601
|
+
classes.push(`ci-justify${BP_INFIXES[idx]}-${val}`);
|
|
2602
|
+
}
|
|
2603
|
+
});
|
|
2604
|
+
const textArr = extractResponsiveProp(lp, "text", "textAlign");
|
|
2605
|
+
if (row.textAlign && !textArr[0]) {
|
|
2606
|
+
textArr[0] = row.textAlign;
|
|
2607
|
+
}
|
|
2608
|
+
const firstText = textArr.find((v) => Boolean(v)) || null;
|
|
2609
|
+
if (!textArr[0] && firstText) {
|
|
2610
|
+
classes.push(`ci-text-${firstText}`);
|
|
2611
|
+
}
|
|
2612
|
+
textArr.forEach((val, idx) => {
|
|
2613
|
+
if (val && BP_INFIXES[idx] !== void 0) {
|
|
2614
|
+
classes.push(`ci-text${BP_INFIXES[idx]}-${val}`);
|
|
2615
|
+
}
|
|
2616
|
+
});
|
|
2617
|
+
if (Array.isArray(row.extraClasses)) {
|
|
2618
|
+
row.extraClasses.forEach((c) => {
|
|
2619
|
+
if (c && typeof c === "string") classes.push(c);
|
|
2620
|
+
});
|
|
2621
|
+
}
|
|
2622
|
+
return classes;
|
|
2623
|
+
}
|
|
2624
|
+
function blockCanvasClasses(block = {}) {
|
|
2625
|
+
const classes = ["ci-col"];
|
|
2626
|
+
const cols = Array.isArray(block.cols) && block.cols.length > 0 ? block.cols : [12, 12, 12, 12, 12];
|
|
2627
|
+
BP_INFIXES.forEach((infix, idx) => {
|
|
2628
|
+
const c = Math.max(1, Math.min(12, Number(cols[idx] ?? cols[0] ?? 12)));
|
|
2629
|
+
classes.push(`ci-col${infix}-${c}`);
|
|
2630
|
+
});
|
|
2631
|
+
if (Array.isArray(block.offset)) {
|
|
2632
|
+
BP_INFIXES.forEach((infix, idx) => {
|
|
2633
|
+
const off = Number(block.offset?.[idx] || 0);
|
|
2634
|
+
if (off > 0 && off <= 11) {
|
|
2635
|
+
classes.push(`ci-offset${infix}-${off}`);
|
|
2636
|
+
}
|
|
2637
|
+
});
|
|
2638
|
+
}
|
|
2639
|
+
const lp = block.layoutProps || {};
|
|
2640
|
+
const alignSelfArr = extractResponsiveProp(lp, "align-self", "alignSelf");
|
|
2641
|
+
const firstAlignSelf = alignSelfArr.find((v) => Boolean(v)) || null;
|
|
2642
|
+
if (!alignSelfArr[0] && firstAlignSelf) {
|
|
2643
|
+
classes.push(`ci-align-self-${firstAlignSelf}`);
|
|
2644
|
+
}
|
|
2645
|
+
alignSelfArr.forEach((val, idx) => {
|
|
2646
|
+
if (val && BP_INFIXES[idx] !== void 0) {
|
|
2647
|
+
classes.push(`ci-align-self${BP_INFIXES[idx]}-${val}`);
|
|
2648
|
+
}
|
|
2649
|
+
});
|
|
2650
|
+
const justifySelfArr = extractResponsiveProp(lp, "justify-self", "justifySelf");
|
|
2651
|
+
const firstJustifySelf = justifySelfArr.find((v) => Boolean(v)) || null;
|
|
2652
|
+
if (!justifySelfArr[0] && firstJustifySelf) {
|
|
2653
|
+
classes.push(`ci-justify-self-${firstJustifySelf}`);
|
|
2654
|
+
}
|
|
2655
|
+
justifySelfArr.forEach((val, idx) => {
|
|
2656
|
+
if (val && BP_INFIXES[idx] !== void 0) {
|
|
2657
|
+
classes.push(`ci-justify-self${BP_INFIXES[idx]}-${val}`);
|
|
2658
|
+
}
|
|
2659
|
+
});
|
|
2660
|
+
const textArr = extractResponsiveProp(lp, "text", "textAlign");
|
|
2661
|
+
const firstText = textArr.find((v) => Boolean(v)) || null;
|
|
2662
|
+
if (!textArr[0] && firstText) {
|
|
2663
|
+
classes.push(`ci-text-${firstText}`);
|
|
2664
|
+
}
|
|
2665
|
+
textArr.forEach((val, idx) => {
|
|
2666
|
+
if (val && BP_INFIXES[idx] !== void 0) {
|
|
2667
|
+
classes.push(`ci-text${BP_INFIXES[idx]}-${val}`);
|
|
2668
|
+
}
|
|
2669
|
+
});
|
|
2670
|
+
if (Array.isArray(block.extraClasses)) {
|
|
2671
|
+
block.extraClasses.forEach((c) => {
|
|
2672
|
+
if (c && typeof c === "string") classes.push(c);
|
|
2673
|
+
});
|
|
2674
|
+
}
|
|
2675
|
+
return classes;
|
|
2676
|
+
}
|
|
2677
|
+
function resolveCanvasMediaUrl(assetOrUrl, imageSettings) {
|
|
2678
|
+
if (!assetOrUrl) return "";
|
|
2679
|
+
const asset = typeof assetOrUrl === "object" ? assetOrUrl : null;
|
|
2680
|
+
const preferredUrl = typeof assetOrUrl === "string" ? assetOrUrl : asset?.optimized_url || asset?.target_url || asset?.url || asset?.src || "";
|
|
2681
|
+
const origUrl = typeof assetOrUrl === "string" ? assetOrUrl : asset?.original_url || asset?.url || asset?.target_url || preferredUrl;
|
|
2682
|
+
if (!preferredUrl && !origUrl) return "";
|
|
2683
|
+
const proc = String(imageSettings?.process || "").trim().toLowerCase();
|
|
2684
|
+
if (proc === "none" || proc === "no-process") {
|
|
2685
|
+
return origUrl || preferredUrl;
|
|
2686
|
+
}
|
|
2687
|
+
if (!proc || proc === "auto") {
|
|
2688
|
+
return preferredUrl || origUrl;
|
|
2689
|
+
}
|
|
2690
|
+
if (proc !== "fit" && proc !== "widen") {
|
|
2691
|
+
return preferredUrl || origUrl;
|
|
2692
|
+
}
|
|
2693
|
+
const w = Number(imageSettings?.cWidth) || 0;
|
|
2694
|
+
const h = proc === "fit" ? Number(imageSettings?.cHeight) || 0 : 0;
|
|
2695
|
+
const rotate = Number(imageSettings?.rotate) || 0;
|
|
2696
|
+
if (w <= 0 && h <= 0) {
|
|
2697
|
+
return preferredUrl || origUrl;
|
|
2698
|
+
}
|
|
2699
|
+
const formatKey = `ci_${proc}_${w}x${h}${rotate ? `_r${rotate}` : ""}`;
|
|
2700
|
+
const directVariantUrl = asset?.formats?.[formatKey]?.url;
|
|
2701
|
+
if (directVariantUrl) {
|
|
2702
|
+
return directVariantUrl;
|
|
2703
|
+
}
|
|
2704
|
+
const baseSrc = origUrl || preferredUrl;
|
|
2705
|
+
if (baseSrc.startsWith("data:") || baseSrc.startsWith("blob:") || /\.(svg|gif|mp4|webm|mov|pdf)(\?|#|$)/i.test(baseSrc) || baseSrc.includes("/api/content-input/image") || baseSrc.includes("/content-input/image")) {
|
|
2706
|
+
return baseSrc;
|
|
2707
|
+
}
|
|
2708
|
+
const params = new URLSearchParams();
|
|
2709
|
+
params.set("src", baseSrc);
|
|
2710
|
+
params.set("process", proc);
|
|
2711
|
+
if (w > 0) params.set("w", String(w));
|
|
2712
|
+
if (proc === "fit" && h > 0) params.set("h", String(h));
|
|
2713
|
+
if (rotate) params.set("rotate", String(rotate));
|
|
2714
|
+
return `/api/content-input/image?${params.toString()}`;
|
|
2715
|
+
}
|
|
2716
|
+
function nodeCanvasStyles(node) {
|
|
2717
|
+
const so = node?.styleOptions || {};
|
|
2718
|
+
const style = {};
|
|
2719
|
+
if (so.padding) style.padding = so.padding;
|
|
2720
|
+
if (so.margin) style.margin = so.margin;
|
|
2721
|
+
if (so.height) style.height = so.height;
|
|
2722
|
+
if (so.minHeight || so["min-height"]) {
|
|
2723
|
+
style.minHeight = so.minHeight || so["min-height"];
|
|
2724
|
+
}
|
|
2725
|
+
if (so.maxHeight || so["max-height"]) {
|
|
2726
|
+
style.maxHeight = so.maxHeight || so["max-height"];
|
|
2727
|
+
}
|
|
2728
|
+
if (so.fontSize || so["font-size"]) {
|
|
2729
|
+
style.fontSize = so.fontSize || so["font-size"];
|
|
2730
|
+
}
|
|
2731
|
+
if (so.backgroundColor || so["background-color"]) {
|
|
2732
|
+
style.backgroundColor = so.backgroundColor || so["background-color"];
|
|
2733
|
+
}
|
|
2734
|
+
if (so.color) style.color = so.color;
|
|
2735
|
+
if (so.border) style.border = so.border;
|
|
2736
|
+
if (so.borderTop || so["border-top"]) style.borderTop = so.borderTop || so["border-top"];
|
|
2737
|
+
if (so.borderRight || so["border-right"])
|
|
2738
|
+
style.borderRight = so.borderRight || so["border-right"];
|
|
2739
|
+
if (so.borderBottom || so["border-bottom"])
|
|
2740
|
+
style.borderBottom = so.borderBottom || so["border-bottom"];
|
|
2741
|
+
if (so.borderLeft || so["border-left"]) style.borderLeft = so.borderLeft || so["border-left"];
|
|
2742
|
+
if (so.outline) style.outline = so.outline;
|
|
2743
|
+
if (so.borderRadius || so["border-radius"]) {
|
|
2744
|
+
style.borderRadius = so.borderRadius || so["border-radius"];
|
|
2745
|
+
}
|
|
2746
|
+
const bgOpts = node?.bgOptions || {};
|
|
2747
|
+
const bgAsset = node?.bgImage || bgOpts?.bgImage;
|
|
2748
|
+
const bgUrl = resolveCanvasMediaUrl(bgAsset, bgOpts?.imageSettings);
|
|
2749
|
+
if (bgUrl) {
|
|
2750
|
+
style.backgroundImage = `url("${bgUrl}")`;
|
|
2751
|
+
style.backgroundSize = bgOpts["background-size"] || bgOpts.size || "cover";
|
|
2752
|
+
style.backgroundPosition = bgOpts["background-position"] || bgOpts.position || "center center";
|
|
2753
|
+
style.backgroundRepeat = bgOpts["background-repeat"] || bgOpts.repeat || "no-repeat";
|
|
2754
|
+
if (bgOpts["background-attachment"] || bgOpts.attachment) {
|
|
2755
|
+
style.backgroundAttachment = bgOpts["background-attachment"] || bgOpts.attachment;
|
|
2756
|
+
}
|
|
2757
|
+
}
|
|
2758
|
+
return style;
|
|
2759
|
+
}
|
|
2530
2760
|
function clampNum(n, min, max) {
|
|
2531
2761
|
if (Number.isNaN(n)) return min;
|
|
2532
2762
|
return Math.max(min, Math.min(max, n));
|
|
@@ -7097,20 +7327,38 @@ const SurveyAnalyticsView = ({
|
|
|
7097
7327
|
const qs = new URLSearchParams();
|
|
7098
7328
|
qs.set("format", format);
|
|
7099
7329
|
qs.set("locale", uiLocale);
|
|
7330
|
+
if (format === "xlsx") {
|
|
7331
|
+
qs.set("encoding", "base64");
|
|
7332
|
+
}
|
|
7100
7333
|
if (dateFrom) qs.set("from", dateFrom);
|
|
7101
7334
|
if (dateTo) qs.set("to", dateTo);
|
|
7102
7335
|
const url = `/content-input/surveys/${encodeURIComponent(
|
|
7103
7336
|
surveySlugOrId
|
|
7104
7337
|
)}/export?${qs.toString()}`;
|
|
7105
7338
|
const res = await get(url);
|
|
7106
|
-
const
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7339
|
+
const payload = res?.data;
|
|
7340
|
+
let blob;
|
|
7341
|
+
let downloadName = `${surveySlugOrId}-responses.${format}`;
|
|
7342
|
+
if (format === "xlsx" && payload?.base64) {
|
|
7343
|
+
const binStr = window.atob(String(payload.base64));
|
|
7344
|
+
const bytes = new Uint8Array(binStr.length);
|
|
7345
|
+
for (let i = 0; i < binStr.length; i++) {
|
|
7346
|
+
bytes[i] = binStr.charCodeAt(i);
|
|
7347
|
+
}
|
|
7348
|
+
if (payload.filename) downloadName = String(payload.filename);
|
|
7349
|
+
blob = new Blob([bytes], {
|
|
7350
|
+
type: payload.contentType || "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
7351
|
+
});
|
|
7352
|
+
} else {
|
|
7353
|
+
const rawData = typeof payload === "string" ? payload : JSON.stringify(payload || {}, null, 2);
|
|
7354
|
+
blob = new Blob([rawData], {
|
|
7355
|
+
type: format === "csv" ? "text/csv;charset=utf-8;" : "application/json;charset=utf-8;"
|
|
7356
|
+
});
|
|
7357
|
+
}
|
|
7110
7358
|
const dlUrl = URL.createObjectURL(blob);
|
|
7111
7359
|
const a = document.createElement("a");
|
|
7112
7360
|
a.href = dlUrl;
|
|
7113
|
-
a.download =
|
|
7361
|
+
a.download = downloadName;
|
|
7114
7362
|
document.body.appendChild(a);
|
|
7115
7363
|
a.click();
|
|
7116
7364
|
document.body.removeChild(a);
|
|
@@ -7261,9 +7509,9 @@ const SurveyAnalyticsView = ({
|
|
|
7261
7509
|
{
|
|
7262
7510
|
type: "button",
|
|
7263
7511
|
disabled: exporting !== null,
|
|
7264
|
-
onClick: () => handleExport("
|
|
7512
|
+
onClick: () => handleExport("xlsx"),
|
|
7265
7513
|
style: {
|
|
7266
|
-
padding: "6px
|
|
7514
|
+
padding: "6px 13px",
|
|
7267
7515
|
fontSize: 11,
|
|
7268
7516
|
fontWeight: 700,
|
|
7269
7517
|
borderRadius: 6,
|
|
@@ -7276,8 +7524,33 @@ const SurveyAnalyticsView = ({
|
|
|
7276
7524
|
gap: 5
|
|
7277
7525
|
},
|
|
7278
7526
|
children: [
|
|
7279
|
-
/* @__PURE__ */ jsx(MaterialIcon, { name: "
|
|
7280
|
-
/* @__PURE__ */ jsx("span", { children: exporting === "
|
|
7527
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "table_view", size: 14, color: "#fff" }),
|
|
7528
|
+
/* @__PURE__ */ jsx("span", { children: exporting === "xlsx" ? "..." : tr ? "Excel İndir (.xlsx)" : "Export Excel (.xlsx)" })
|
|
7529
|
+
]
|
|
7530
|
+
}
|
|
7531
|
+
),
|
|
7532
|
+
/* @__PURE__ */ jsxs(
|
|
7533
|
+
"button",
|
|
7534
|
+
{
|
|
7535
|
+
type: "button",
|
|
7536
|
+
disabled: exporting !== null,
|
|
7537
|
+
onClick: () => handleExport("csv"),
|
|
7538
|
+
style: {
|
|
7539
|
+
padding: "6px 11px",
|
|
7540
|
+
fontSize: 11,
|
|
7541
|
+
fontWeight: 700,
|
|
7542
|
+
borderRadius: 6,
|
|
7543
|
+
border: "1px solid #10b981",
|
|
7544
|
+
background: "#ecfdf5",
|
|
7545
|
+
color: "#065f46",
|
|
7546
|
+
cursor: "pointer",
|
|
7547
|
+
display: "inline-flex",
|
|
7548
|
+
alignItems: "center",
|
|
7549
|
+
gap: 5
|
|
7550
|
+
},
|
|
7551
|
+
children: [
|
|
7552
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "download", size: 14, color: "#059669" }),
|
|
7553
|
+
/* @__PURE__ */ jsx("span", { children: exporting === "csv" ? "..." : "CSV" })
|
|
7281
7554
|
]
|
|
7282
7555
|
}
|
|
7283
7556
|
),
|
|
@@ -7957,6 +8230,11 @@ const SurveyAnalyticsView = ({
|
|
|
7957
8230
|
},
|
|
7958
8231
|
children: qs.distribution.map((bucket, bIdx) => {
|
|
7959
8232
|
const scoreVal = bucket.value ?? bucket.score ?? bIdx;
|
|
8233
|
+
const pointLabel = pickTextForLocale(
|
|
8234
|
+
bucket.labels ?? qs.scaleLabels?.[String(scoreVal)],
|
|
8235
|
+
uiLocale,
|
|
8236
|
+
""
|
|
8237
|
+
);
|
|
7960
8238
|
const barColor = qs.type === "nps" ? scoreVal >= 9 ? "#10b981" : scoreVal >= 7 ? "#f59e0b" : "#ef4444" : "#f59e0b";
|
|
7961
8239
|
return /* @__PURE__ */ jsxs(
|
|
7962
8240
|
"div",
|
|
@@ -7984,7 +8262,7 @@ const SurveyAnalyticsView = ({
|
|
|
7984
8262
|
background: barColor,
|
|
7985
8263
|
borderRadius: "5px 5px 0 0"
|
|
7986
8264
|
},
|
|
7987
|
-
title: `${scoreVal}: ${bucket.count} (${bucket.percentage}%)`
|
|
8265
|
+
title: `${scoreVal}${pointLabel ? ` (${pointLabel})` : ""}: ${bucket.count} (${bucket.percentage}%)`
|
|
7988
8266
|
}
|
|
7989
8267
|
),
|
|
7990
8268
|
/* @__PURE__ */ jsx(
|
|
@@ -7997,6 +8275,23 @@ const SurveyAnalyticsView = ({
|
|
|
7997
8275
|
},
|
|
7998
8276
|
children: qs.type === "star_rating" ? `${scoreVal}★` : scoreVal
|
|
7999
8277
|
}
|
|
8278
|
+
),
|
|
8279
|
+
pointLabel && /* @__PURE__ */ jsx(
|
|
8280
|
+
"span",
|
|
8281
|
+
{
|
|
8282
|
+
title: pointLabel,
|
|
8283
|
+
style: {
|
|
8284
|
+
fontSize: 9.5,
|
|
8285
|
+
fontWeight: 600,
|
|
8286
|
+
color: "#475569",
|
|
8287
|
+
maxWidth: "100%",
|
|
8288
|
+
overflow: "hidden",
|
|
8289
|
+
textOverflow: "ellipsis",
|
|
8290
|
+
whiteSpace: "nowrap",
|
|
8291
|
+
textAlign: "center"
|
|
8292
|
+
},
|
|
8293
|
+
children: pointLabel
|
|
8294
|
+
}
|
|
8000
8295
|
)
|
|
8001
8296
|
]
|
|
8002
8297
|
},
|
|
@@ -8334,171 +8629,2514 @@ const SurveyAnalyticsView = ({
|
|
|
8334
8629
|
}) })
|
|
8335
8630
|
] });
|
|
8336
8631
|
};
|
|
8337
|
-
|
|
8338
|
-
|
|
8339
|
-
|
|
8340
|
-
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
background: "#fff",
|
|
8344
|
-
color: "#1e293b"
|
|
8345
|
-
};
|
|
8346
|
-
const labelStyle = {
|
|
8347
|
-
display: "block",
|
|
8348
|
-
fontSize: 11,
|
|
8349
|
-
fontWeight: 600,
|
|
8350
|
-
color: "#475569",
|
|
8351
|
-
marginBottom: 4
|
|
8352
|
-
};
|
|
8353
|
-
function slugifyKey(input) {
|
|
8354
|
-
const map = {
|
|
8355
|
-
ç: "c",
|
|
8356
|
-
Ç: "c",
|
|
8357
|
-
ğ: "g",
|
|
8358
|
-
Ğ: "g",
|
|
8359
|
-
ı: "i",
|
|
8360
|
-
İ: "i",
|
|
8361
|
-
ö: "o",
|
|
8362
|
-
Ö: "o",
|
|
8363
|
-
ş: "s",
|
|
8364
|
-
Ş: "s",
|
|
8365
|
-
ü: "u",
|
|
8366
|
-
Ü: "u"
|
|
8367
|
-
};
|
|
8368
|
-
return String(input || "").replace(/[çÇğĞıİöÖşŞüÜ]/g, (ch) => map[ch] || ch).toLowerCase().replace(/[^a-z0-9_]+/g, "_").replace(/^_+|_+$/g, "");
|
|
8369
|
-
}
|
|
8370
|
-
const QUESTION_TYPES_CATALOG = [
|
|
8371
|
-
{ type: "single_choice", labelTr: "Tekli Seçim (Radio)", labelEn: "Single Choice", hasOptions: true },
|
|
8372
|
-
{ type: "multiple_choice", labelTr: "Çoklu Seçim (Checkbox)", labelEn: "Multiple Choice", hasOptions: true },
|
|
8373
|
-
{ type: "dropdown", labelTr: "Açılır Liste (Dropdown)", labelEn: "Dropdown", hasOptions: true },
|
|
8374
|
-
{ type: "image_choice", labelTr: "Görsel Kart Seçimi", labelEn: "Image Choice", hasOptions: true },
|
|
8375
|
-
{ type: "nps", labelTr: "NPS Ölçeği (0–10)", labelEn: "NPS Score (0–10)" },
|
|
8376
|
-
{ type: "star_rating", labelTr: "Yıldız Derece (1–5)", labelEn: "Star Rating" },
|
|
8377
|
-
{ type: "likert_scale", labelTr: "Likert Ölçeği (1–5 / 1–7)", labelEn: "Likert Scale" },
|
|
8378
|
-
{ type: "matrix_single", labelTr: "Matris Değerlendirme Tablosu", labelEn: "Matrix Grid" },
|
|
8379
|
-
{ type: "ranking", labelTr: "Sürükle-Bırak Öncelik Sıralama", labelEn: "Drag Ranking", hasOptions: true },
|
|
8380
|
-
{ type: "short_text", labelTr: "Kısa Metin Yanıtı", labelEn: "Short Text" },
|
|
8381
|
-
{ type: "long_text", labelTr: "Açık Uçlu Uzun Yorum", labelEn: "Open-Ended Long Text" },
|
|
8382
|
-
{ type: "consent", labelTr: "KVKK / Gizlilik Onayı", labelEn: "Consent Switch" },
|
|
8383
|
-
{ type: "statement", labelTr: "Bilgi / Açıklama Metni", labelEn: "Info Statement" }
|
|
8384
|
-
];
|
|
8385
|
-
function createBlankSurveyDraft(locale = "en") {
|
|
8386
|
-
const tr = locale === "tr";
|
|
8387
|
-
const ts = Date.now().toString(36).slice(-4);
|
|
8388
|
-
return {
|
|
8389
|
-
title: tr ? "Yeni Müşteri Geri Bildirim Anketi" : "New Customer Feedback Survey",
|
|
8390
|
-
titleI18n: {
|
|
8391
|
-
en: "New Customer Feedback Survey",
|
|
8392
|
-
tr: "Yeni Müşteri Geri Bildirim Anketi"
|
|
8393
|
-
},
|
|
8394
|
-
slug: `survey_${ts}`,
|
|
8395
|
-
description: {
|
|
8396
|
-
tr: "Görüşleriniz hizmet kalitemizi geliştirmemize yardımcı olur.",
|
|
8397
|
-
en: "Your feedback helps us improve our service quality."
|
|
8398
|
-
},
|
|
8399
|
-
status: "published",
|
|
8400
|
-
displayMode: "single_page",
|
|
8401
|
-
submissionPolicy: "one_per_voter",
|
|
8402
|
-
anonymizeIp: true,
|
|
8403
|
-
showPublicResults: "after_vote",
|
|
8404
|
-
allowBackNavigation: true,
|
|
8405
|
-
showProgressBar: true,
|
|
8406
|
-
useRecaptcha: false,
|
|
8407
|
-
steps: [
|
|
8408
|
-
{
|
|
8409
|
-
id: "step_1",
|
|
8410
|
-
title: { tr: "1. Bölüm", en: "Step 1" }
|
|
8411
|
-
}
|
|
8412
|
-
],
|
|
8413
|
-
questions: [
|
|
8414
|
-
{
|
|
8415
|
-
key: "nps_score",
|
|
8416
|
-
stepId: "step_1",
|
|
8417
|
-
type: "nps",
|
|
8418
|
-
required: true,
|
|
8419
|
-
title: {
|
|
8420
|
-
tr: "Bizi çevrenize önerme olasılığınız nedir?",
|
|
8421
|
-
en: "How likely are you to recommend us?"
|
|
8422
|
-
},
|
|
8423
|
-
lowLabel: { tr: "0 — Hiç Olası Değil", en: "0 — Not likely" },
|
|
8424
|
-
highLabel: { tr: "10 — Kesinlikle Öneririm", en: "10 — Extremely likely" }
|
|
8425
|
-
},
|
|
8426
|
-
{
|
|
8427
|
-
key: "favorite_aspect",
|
|
8428
|
-
stepId: "step_1",
|
|
8429
|
-
type: "single_choice",
|
|
8430
|
-
required: true,
|
|
8431
|
-
allowOther: true,
|
|
8432
|
-
title: {
|
|
8433
|
-
tr: "En beğendiğiniz yönümüz hangisi?",
|
|
8434
|
-
en: "Which aspect do you value the most?"
|
|
8435
|
-
},
|
|
8436
|
-
options: [
|
|
8437
|
-
{ id: "speed", labels: { tr: "Hız ve Performans", en: "Speed & Performance" } },
|
|
8438
|
-
{ id: "ease_of_use", labels: { tr: "Kullanım Kolaylığı", en: "Ease of Use" } },
|
|
8439
|
-
{ id: "support", labels: { tr: "Teknik Destek", en: "Technical Support" } }
|
|
8440
|
-
]
|
|
8441
|
-
}
|
|
8442
|
-
],
|
|
8443
|
-
settings: {
|
|
8444
|
-
submitLabel: { tr: "Anketi Gönder", en: "Submit Survey" },
|
|
8445
|
-
thankYouTitle: { tr: "Teşekkür Ederiz!", en: "Thank You!" },
|
|
8446
|
-
thankYouMessage: {
|
|
8447
|
-
tr: "Yanıtlarınız başarıyla kaydedildi.",
|
|
8448
|
-
en: "Your response has been recorded."
|
|
8449
|
-
}
|
|
8450
|
-
}
|
|
8451
|
-
};
|
|
8632
|
+
function isEmptyVal(val) {
|
|
8633
|
+
if (val === null || val === void 0) return true;
|
|
8634
|
+
if (typeof val === "string") return val.trim() === "";
|
|
8635
|
+
if (Array.isArray(val)) return val.length === 0;
|
|
8636
|
+
if (typeof val === "object") return Object.keys(val).length === 0;
|
|
8637
|
+
return false;
|
|
8452
8638
|
}
|
|
8453
|
-
function
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
|
|
8639
|
+
function evalSingleRule(rule, answers) {
|
|
8640
|
+
const targetVal = answers ? answers[rule.questionKey] : void 0;
|
|
8641
|
+
const op = String(rule.operator || "equals");
|
|
8642
|
+
if (op === "is_answered") return !isEmptyVal(targetVal);
|
|
8643
|
+
if (op === "is_empty") return isEmptyVal(targetVal);
|
|
8644
|
+
const cmp = rule.value;
|
|
8645
|
+
if (op === "equals") {
|
|
8646
|
+
if (Array.isArray(targetVal)) return targetVal.map(String).includes(String(cmp));
|
|
8647
|
+
return String(targetVal ?? "") === String(cmp ?? "");
|
|
8459
8648
|
}
|
|
8460
|
-
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
-
|
|
8649
|
+
if (op === "not_equals") {
|
|
8650
|
+
if (Array.isArray(targetVal)) return !targetVal.map(String).includes(String(cmp));
|
|
8651
|
+
return String(targetVal ?? "") !== String(cmp ?? "");
|
|
8652
|
+
}
|
|
8653
|
+
if (op === "includes" || op === "contains" || op === "in") {
|
|
8654
|
+
if (op === "in") {
|
|
8655
|
+
const allowed = String(cmp ?? "").split(",").map((s) => s.trim()).filter(Boolean);
|
|
8656
|
+
return allowed.includes(String(targetVal ?? ""));
|
|
8468
8657
|
}
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
base.options = [
|
|
8472
|
-
{ id: "opt_1", labels: { tr: "Seçenek 1", en: "Option 1" } },
|
|
8473
|
-
{ id: "opt_2", labels: { tr: "Seçenek 2", en: "Option 2" } },
|
|
8474
|
-
{ id: "opt_3", labels: { tr: "Seçenek 3", en: "Option 3" } }
|
|
8475
|
-
];
|
|
8658
|
+
if (Array.isArray(targetVal)) return targetVal.map(String).includes(String(cmp));
|
|
8659
|
+
return String(targetVal ?? "").includes(String(cmp ?? ""));
|
|
8476
8660
|
}
|
|
8477
|
-
if (
|
|
8478
|
-
|
|
8661
|
+
if (op === "not_includes") {
|
|
8662
|
+
if (Array.isArray(targetVal)) return !targetVal.map(String).includes(String(cmp));
|
|
8663
|
+
return !String(targetVal ?? "").includes(String(cmp ?? ""));
|
|
8479
8664
|
}
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
base.highLabel = { tr: "Kesinlikle Katılıyorum", en: "Strongly Agree" };
|
|
8665
|
+
const numTarget = Number(targetVal);
|
|
8666
|
+
const numCmp = Number(cmp);
|
|
8667
|
+
if (isEmptyVal(targetVal) || Number.isNaN(numTarget) || Number.isNaN(numCmp)) {
|
|
8668
|
+
return false;
|
|
8485
8669
|
}
|
|
8486
|
-
if (
|
|
8487
|
-
|
|
8488
|
-
|
|
8670
|
+
if (op === "gt") return numTarget > numCmp;
|
|
8671
|
+
if (op === "gte") return numTarget >= numCmp;
|
|
8672
|
+
if (op === "lt") return numTarget < numCmp;
|
|
8673
|
+
if (op === "lte") return numTarget <= numCmp;
|
|
8674
|
+
return true;
|
|
8675
|
+
}
|
|
8676
|
+
function evaluateConditions(conditions, answers) {
|
|
8677
|
+
if (!conditions || !Array.isArray(conditions.rules) || conditions.rules.length === 0) {
|
|
8678
|
+
return true;
|
|
8489
8679
|
}
|
|
8490
|
-
if (
|
|
8491
|
-
|
|
8492
|
-
{ id: "row_1", labels: { tr: "Hız & Performans", en: "Speed & Performance" } },
|
|
8493
|
-
{ id: "row_2", labels: { tr: "Tasarım Kalitesi", en: "Design Quality" } }
|
|
8494
|
-
];
|
|
8495
|
-
base.matrixColumns = [
|
|
8496
|
-
{ id: "excellent", labels: { tr: "Çok İyi", en: "Excellent" } },
|
|
8497
|
-
{ id: "good", labels: { tr: "İyi", en: "Good" } },
|
|
8498
|
-
{ id: "fair", labels: { tr: "Orta", en: "Fair" } }
|
|
8499
|
-
];
|
|
8680
|
+
if (conditions.match === "any") {
|
|
8681
|
+
return conditions.rules.some((r) => evalSingleRule(r, answers));
|
|
8500
8682
|
}
|
|
8501
|
-
return
|
|
8683
|
+
return conditions.rules.every((r) => evalSingleRule(r, answers));
|
|
8684
|
+
}
|
|
8685
|
+
function isQuestionVisibleInDraft(q, draft, answers) {
|
|
8686
|
+
if (draft.displayMode === "multi_step" && q.stepId && Array.isArray(draft.steps)) {
|
|
8687
|
+
const parentStep = draft.steps.find((s) => s.id === q.stepId);
|
|
8688
|
+
if (parentStep?.conditions && !evaluateConditions(parentStep.conditions, answers)) {
|
|
8689
|
+
return false;
|
|
8690
|
+
}
|
|
8691
|
+
}
|
|
8692
|
+
return evaluateConditions(q.conditions, answers);
|
|
8693
|
+
}
|
|
8694
|
+
function validateTextRules(val, validationStr, label, tr) {
|
|
8695
|
+
const errs = [];
|
|
8696
|
+
const str = String(val ?? "");
|
|
8697
|
+
const trimmed = str.trim();
|
|
8698
|
+
const rules = validationStr.split("|").map((r) => r.trim()).filter(Boolean);
|
|
8699
|
+
for (const rawRule of rules) {
|
|
8700
|
+
const colonIdx = rawRule.indexOf(":");
|
|
8701
|
+
const ruleName = (colonIdx >= 0 ? rawRule.slice(0, colonIdx) : rawRule).toLowerCase();
|
|
8702
|
+
const param = colonIdx >= 0 ? rawRule.slice(colonIdx + 1) : "";
|
|
8703
|
+
if (ruleName === "required") {
|
|
8704
|
+
if (!trimmed) {
|
|
8705
|
+
errs.push(tr ? `${label} alanı zorunludur.` : `${label} is required.`);
|
|
8706
|
+
}
|
|
8707
|
+
continue;
|
|
8708
|
+
}
|
|
8709
|
+
if (!trimmed) continue;
|
|
8710
|
+
if (ruleName === "email") {
|
|
8711
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(trimmed)) {
|
|
8712
|
+
errs.push(tr ? "Geçerli bir e-posta adresi giriniz." : "Please enter a valid email address.");
|
|
8713
|
+
}
|
|
8714
|
+
} else if (ruleName === "phone") {
|
|
8715
|
+
const digits = trimmed.replace(/\D/g, "");
|
|
8716
|
+
if (digits.length < 7 || !/^[+\d\s().-]+$/.test(trimmed)) {
|
|
8717
|
+
errs.push(tr ? "Geçerli bir telefon numarası giriniz." : "Please enter a valid phone number.");
|
|
8718
|
+
}
|
|
8719
|
+
} else if (ruleName === "url") {
|
|
8720
|
+
if (!/^https?:\/\/.+/i.test(trimmed)) {
|
|
8721
|
+
errs.push(tr ? "Geçerli bir URL (http/https) giriniz." : "Please enter a valid http/https URL.");
|
|
8722
|
+
}
|
|
8723
|
+
} else if (ruleName === "numeric") {
|
|
8724
|
+
if (Number.isNaN(Number(trimmed))) {
|
|
8725
|
+
errs.push(tr ? "Sayısal bir değer giriniz." : "Please enter a numeric value.");
|
|
8726
|
+
}
|
|
8727
|
+
} else if (ruleName === "integer") {
|
|
8728
|
+
if (!/^-?\d+$/.test(trimmed)) {
|
|
8729
|
+
errs.push(tr ? "Tam sayı giriniz." : "Please enter a whole integer.");
|
|
8730
|
+
}
|
|
8731
|
+
} else if (ruleName === "min") {
|
|
8732
|
+
const n = Number(param);
|
|
8733
|
+
if (!Number.isNaN(n) && trimmed.length < n) {
|
|
8734
|
+
errs.push(
|
|
8735
|
+
tr ? `En az ${n} karakter girmelisiniz.` : `Must be at least ${n} characters.`
|
|
8736
|
+
);
|
|
8737
|
+
}
|
|
8738
|
+
} else if (ruleName === "max") {
|
|
8739
|
+
const n = Number(param);
|
|
8740
|
+
if (!Number.isNaN(n) && trimmed.length > n) {
|
|
8741
|
+
errs.push(
|
|
8742
|
+
tr ? `En fazla ${n} karakter girebilirsiniz.` : `May not exceed ${n} characters.`
|
|
8743
|
+
);
|
|
8744
|
+
}
|
|
8745
|
+
} else if (ruleName === "min_value") {
|
|
8746
|
+
const n = Number(param);
|
|
8747
|
+
if (!Number.isNaN(n) && Number(trimmed) < n) {
|
|
8748
|
+
errs.push(tr ? `Değer en az ${n} olmalıdır.` : `Minimum value is ${n}.`);
|
|
8749
|
+
}
|
|
8750
|
+
} else if (ruleName === "max_value") {
|
|
8751
|
+
const n = Number(param);
|
|
8752
|
+
if (!Number.isNaN(n) && Number(trimmed) > n) {
|
|
8753
|
+
errs.push(tr ? `Değer en fazla ${n} olabilir.` : `Maximum value is ${n}.`);
|
|
8754
|
+
}
|
|
8755
|
+
} else if (ruleName === "between") {
|
|
8756
|
+
const [minS, maxS] = param.split(",");
|
|
8757
|
+
const minN = Number(minS);
|
|
8758
|
+
const maxN = Number(maxS);
|
|
8759
|
+
const numV = Number(trimmed);
|
|
8760
|
+
if (!Number.isNaN(minN) && !Number.isNaN(maxN)) {
|
|
8761
|
+
if (!Number.isNaN(numV)) {
|
|
8762
|
+
if (numV < minN || numV > maxN) {
|
|
8763
|
+
errs.push(
|
|
8764
|
+
tr ? `Değer ${minN} ile ${maxN} arasında olmalıdır.` : `Value must be between ${minN} and ${maxN}.`
|
|
8765
|
+
);
|
|
8766
|
+
}
|
|
8767
|
+
} else if (trimmed.length < minN || trimmed.length > maxN) {
|
|
8768
|
+
errs.push(
|
|
8769
|
+
tr ? `Uzunluk ${minN} ile ${maxN} karakter arasında olmalıdır.` : `Length must be between ${minN} and ${maxN} characters.`
|
|
8770
|
+
);
|
|
8771
|
+
}
|
|
8772
|
+
}
|
|
8773
|
+
} else if (ruleName === "regex" && param) {
|
|
8774
|
+
try {
|
|
8775
|
+
const re = new RegExp(param);
|
|
8776
|
+
if (!re.test(trimmed)) {
|
|
8777
|
+
errs.push(tr ? `${label} formatı geçersiz.` : `${label} format is invalid.`);
|
|
8778
|
+
}
|
|
8779
|
+
} catch {
|
|
8780
|
+
}
|
|
8781
|
+
}
|
|
8782
|
+
}
|
|
8783
|
+
return errs;
|
|
8784
|
+
}
|
|
8785
|
+
function buildInitialAnswers(draft) {
|
|
8786
|
+
const init = {};
|
|
8787
|
+
for (const q of draft.questions || []) {
|
|
8788
|
+
if (!q || !q.key || q.type === "statement") continue;
|
|
8789
|
+
if (q.type === "multiple_choice" || q.type === "image_choice" && (q.maxSelections ?? 1) > 1) {
|
|
8790
|
+
init[q.key] = [];
|
|
8791
|
+
} else if (q.type === "ranking") {
|
|
8792
|
+
init[q.key] = Array.isArray(q.options) ? q.options.map((o) => o.id) : [];
|
|
8793
|
+
} else if (q.type === "matrix_single") {
|
|
8794
|
+
init[q.key] = {};
|
|
8795
|
+
} else if (q.type === "consent") {
|
|
8796
|
+
init[q.key] = false;
|
|
8797
|
+
} else if (q.type === "short_text" || q.type === "long_text") {
|
|
8798
|
+
init[q.key] = "";
|
|
8799
|
+
} else {
|
|
8800
|
+
init[q.key] = null;
|
|
8801
|
+
}
|
|
8802
|
+
}
|
|
8803
|
+
return init;
|
|
8804
|
+
}
|
|
8805
|
+
function shuffleCopy(items, seed) {
|
|
8806
|
+
const arr = [...items];
|
|
8807
|
+
let s = seed + 1;
|
|
8808
|
+
for (let i = arr.length - 1; i > 0; i--) {
|
|
8809
|
+
s = s * 16807 % 2147483647;
|
|
8810
|
+
const j = s % (i + 1);
|
|
8811
|
+
[arr[i], arr[j]] = [arr[j], arr[i]];
|
|
8812
|
+
}
|
|
8813
|
+
return arr;
|
|
8814
|
+
}
|
|
8815
|
+
const SurveyLivePreviewPane = ({
|
|
8816
|
+
draft,
|
|
8817
|
+
uiLocale,
|
|
8818
|
+
strapiLocales
|
|
8819
|
+
}) => {
|
|
8820
|
+
const [testLocale, setTestLocale] = useState(uiLocale || "en");
|
|
8821
|
+
const [device, setDevice] = useState("desktop");
|
|
8822
|
+
const [showInspector, setShowInspector] = useState(true);
|
|
8823
|
+
const [shuffleSeed, setShuffleSeed] = useState(1);
|
|
8824
|
+
const [answers, setAnswers] = useState(() => buildInitialAnswers(draft));
|
|
8825
|
+
const [otherTexts, setOtherTexts] = useState({});
|
|
8826
|
+
const [errors, setErrors] = useState({});
|
|
8827
|
+
const [generalError, setGeneralError] = useState("");
|
|
8828
|
+
const [currentStepIdx, setCurrentStepIdx] = useState(0);
|
|
8829
|
+
const [submitted, setSubmitted] = useState(false);
|
|
8830
|
+
const [peekResults, setPeekResults] = useState(false);
|
|
8831
|
+
const [mockCaptchaChecked, setMockCaptchaChecked] = useState(false);
|
|
8832
|
+
const [hoverStar, setHoverStar] = useState({});
|
|
8833
|
+
const [elapsedMs, setElapsedMs] = useState(0);
|
|
8834
|
+
const startTimeRef = useRef(Date.now());
|
|
8835
|
+
const rankDragRef = useRef(null);
|
|
8836
|
+
const trUi = String(uiLocale || "en").toLowerCase().startsWith("tr");
|
|
8837
|
+
const trTest = String(testLocale || "en").toLowerCase().startsWith("tr");
|
|
8838
|
+
useEffect(() => {
|
|
8839
|
+
setAnswers((prev) => {
|
|
8840
|
+
const defaults = buildInitialAnswers(draft);
|
|
8841
|
+
const merged = { ...defaults };
|
|
8842
|
+
for (const [k, v] of Object.entries(prev)) {
|
|
8843
|
+
if (k in defaults) {
|
|
8844
|
+
if (Array.isArray(defaults[k]) && Array.isArray(v)) {
|
|
8845
|
+
const qDef = (draft.questions || []).find((q) => q.key === k);
|
|
8846
|
+
if (qDef?.type === "ranking" && Array.isArray(qDef.options)) {
|
|
8847
|
+
const validIds = new Set(qDef.options.map((o) => o.id));
|
|
8848
|
+
const kept = v.filter((id) => validIds.has(id));
|
|
8849
|
+
const added = qDef.options.map((o) => o.id).filter((id) => !kept.includes(id));
|
|
8850
|
+
merged[k] = [...kept, ...added];
|
|
8851
|
+
} else {
|
|
8852
|
+
merged[k] = v;
|
|
8853
|
+
}
|
|
8854
|
+
} else {
|
|
8855
|
+
merged[k] = v;
|
|
8856
|
+
}
|
|
8857
|
+
}
|
|
8858
|
+
}
|
|
8859
|
+
return merged;
|
|
8860
|
+
});
|
|
8861
|
+
}, [draft]);
|
|
8862
|
+
const resetFlow = () => {
|
|
8863
|
+
setAnswers(buildInitialAnswers(draft));
|
|
8864
|
+
setOtherTexts({});
|
|
8865
|
+
setErrors({});
|
|
8866
|
+
setGeneralError("");
|
|
8867
|
+
setCurrentStepIdx(0);
|
|
8868
|
+
setSubmitted(false);
|
|
8869
|
+
setPeekResults(false);
|
|
8870
|
+
setMockCaptchaChecked(false);
|
|
8871
|
+
setShuffleSeed((s) => s + 1);
|
|
8872
|
+
startTimeRef.current = Date.now();
|
|
8873
|
+
setElapsedMs(0);
|
|
8874
|
+
};
|
|
8875
|
+
const isQuickPoll = draft.displayMode === "quick_poll";
|
|
8876
|
+
const isMultiStep = draft.displayMode === "multi_step";
|
|
8877
|
+
const visibleSteps = useMemo(() => {
|
|
8878
|
+
const rawSteps = Array.isArray(draft.steps) ? draft.steps : [];
|
|
8879
|
+
if (!isMultiStep || rawSteps.length === 0) {
|
|
8880
|
+
return [{ id: "__default__", title: draft.titleI18n || draft.title || "" }];
|
|
8881
|
+
}
|
|
8882
|
+
const filtered = rawSteps.filter((s) => evaluateConditions(s.conditions, answers));
|
|
8883
|
+
return filtered.length > 0 ? filtered : [rawSteps[0]];
|
|
8884
|
+
}, [draft.steps, draft.titleI18n, draft.title, isMultiStep, answers]);
|
|
8885
|
+
const safeStepIdx = Math.min(currentStepIdx, Math.max(0, visibleSteps.length - 1));
|
|
8886
|
+
const activeStep = visibleSteps[safeStepIdx];
|
|
8887
|
+
const activeQuestions = useMemo(() => {
|
|
8888
|
+
const all = Array.isArray(draft.questions) ? draft.questions : [];
|
|
8889
|
+
if (!isMultiStep || !activeStep || activeStep.id === "__default__") {
|
|
8890
|
+
return all.filter((q) => isQuestionVisibleInDraft(q, draft, answers));
|
|
8891
|
+
}
|
|
8892
|
+
const knownStepIds = new Set((draft.steps || []).map((s) => s.id));
|
|
8893
|
+
const isFirst = safeStepIdx === 0;
|
|
8894
|
+
return all.filter((q) => {
|
|
8895
|
+
const belongs = q.stepId === activeStep.id || isFirst && (!q.stepId || !knownStepIds.has(q.stepId));
|
|
8896
|
+
return belongs && isQuestionVisibleInDraft(q, draft, answers);
|
|
8897
|
+
});
|
|
8898
|
+
}, [draft, isMultiStep, activeStep, safeStepIdx, answers]);
|
|
8899
|
+
const stepProgressPct = useMemo(() => {
|
|
8900
|
+
if (visibleSteps.length <= 1) return 100;
|
|
8901
|
+
return Math.round((safeStepIdx + 1) / visibleSteps.length * 100);
|
|
8902
|
+
}, [safeStepIdx, visibleSteps.length]);
|
|
8903
|
+
const setAnswer = (key, value) => {
|
|
8904
|
+
setAnswers((prev) => ({ ...prev, [key]: value }));
|
|
8905
|
+
if (errors[key]) {
|
|
8906
|
+
setErrors((prev) => {
|
|
8907
|
+
const next = { ...prev };
|
|
8908
|
+
delete next[key];
|
|
8909
|
+
return next;
|
|
8910
|
+
});
|
|
8911
|
+
}
|
|
8912
|
+
if (generalError) setGeneralError("");
|
|
8913
|
+
};
|
|
8914
|
+
const validateTargetQuestions = (qs) => {
|
|
8915
|
+
const nextErrs = {};
|
|
8916
|
+
for (const q of qs) {
|
|
8917
|
+
if (!q || !q.key || q.type === "statement") continue;
|
|
8918
|
+
if (!isQuestionVisibleInDraft(q, draft, answers)) continue;
|
|
8919
|
+
const val = answers[q.key];
|
|
8920
|
+
const empty = isEmptyVal(val);
|
|
8921
|
+
const qLabel = pickTextForLocale(q.title, testLocale, q.key);
|
|
8922
|
+
const qErrs = [];
|
|
8923
|
+
if (q.type === "consent") {
|
|
8924
|
+
if (q.required !== false && val !== true) {
|
|
8925
|
+
qErrs.push(trTest ? `${qLabel} onaylanmalıdır.` : `${qLabel} must be accepted.`);
|
|
8926
|
+
}
|
|
8927
|
+
} else if (q.type === "matrix_single") {
|
|
8928
|
+
const mRows = Array.isArray(q.matrixRows) ? q.matrixRows : [];
|
|
8929
|
+
if (q.required) {
|
|
8930
|
+
const objVal = val && typeof val === "object" && !Array.isArray(val) ? val : {};
|
|
8931
|
+
const missing = mRows.some((r) => isEmptyVal(objVal[r.id]));
|
|
8932
|
+
if (missing) {
|
|
8933
|
+
qErrs.push(
|
|
8934
|
+
trTest ? `Lütfen "${qLabel}" tablosundaki tüm satırları yanıtlayınız.` : `Please answer all rows in "${qLabel}".`
|
|
8935
|
+
);
|
|
8936
|
+
}
|
|
8937
|
+
}
|
|
8938
|
+
} else if (q.type === "multiple_choice" || q.type === "image_choice" && (q.maxSelections ?? 1) > 1) {
|
|
8939
|
+
const arr = Array.isArray(val) ? val : [];
|
|
8940
|
+
if (q.required && arr.length === 0) {
|
|
8941
|
+
qErrs.push(
|
|
8942
|
+
trTest ? "Lütfen en az bir seçenek işaretleyiniz." : "Please select at least one option."
|
|
8943
|
+
);
|
|
8944
|
+
} else if (arr.length > 0) {
|
|
8945
|
+
if (q.minSelections && arr.length < q.minSelections) {
|
|
8946
|
+
qErrs.push(
|
|
8947
|
+
trTest ? `En az ${q.minSelections} seçenek işaretlemelisiniz.` : `Please select at least ${q.minSelections} options.`
|
|
8948
|
+
);
|
|
8949
|
+
}
|
|
8950
|
+
if (q.maxSelections && arr.length > q.maxSelections) {
|
|
8951
|
+
qErrs.push(
|
|
8952
|
+
trTest ? `En fazla ${q.maxSelections} seçenek işaretleyebilirsiniz.` : `You may select at most ${q.maxSelections} options.`
|
|
8953
|
+
);
|
|
8954
|
+
}
|
|
8955
|
+
}
|
|
8956
|
+
if (q.allowOther && arr.includes("__other__") && !String(otherTexts[q.key] || "").trim()) {
|
|
8957
|
+
qErrs.push(
|
|
8958
|
+
trTest ? 'Lütfen "Diğer" seçeneği için açıklama giriniz.' : 'Please specify your "Other" choice.'
|
|
8959
|
+
);
|
|
8960
|
+
}
|
|
8961
|
+
} else if (q.type === "single_choice" || q.type === "dropdown" || q.type === "image_choice") {
|
|
8962
|
+
if (q.required && empty) {
|
|
8963
|
+
qErrs.push(trTest ? "Lütfen bir seçim yapınız." : "Please choose an option.");
|
|
8964
|
+
}
|
|
8965
|
+
if (q.allowOther && val === "__other__" && !String(otherTexts[q.key] || "").trim()) {
|
|
8966
|
+
qErrs.push(
|
|
8967
|
+
trTest ? 'Lütfen "Diğer" seçeneği için açıklama giriniz.' : 'Please specify your "Other" choice.'
|
|
8968
|
+
);
|
|
8969
|
+
}
|
|
8970
|
+
} else if (q.type === "nps") {
|
|
8971
|
+
if (q.required && empty) {
|
|
8972
|
+
qErrs.push(
|
|
8973
|
+
trTest ? "Lütfen 0 ile 10 arasında bir puan seçiniz." : "Please choose a score from 0 to 10."
|
|
8974
|
+
);
|
|
8975
|
+
}
|
|
8976
|
+
} else if (q.type === "star_rating") {
|
|
8977
|
+
if (q.required && empty) {
|
|
8978
|
+
qErrs.push(trTest ? "Lütfen derecelendirme yapınız." : "Please provide a rating.");
|
|
8979
|
+
}
|
|
8980
|
+
} else if (q.type === "likert_scale") {
|
|
8981
|
+
if (q.required && empty) {
|
|
8982
|
+
qErrs.push(
|
|
8983
|
+
trTest ? "Lütfen ölçekten bir değer seçiniz." : "Please select a value on the scale."
|
|
8984
|
+
);
|
|
8985
|
+
}
|
|
8986
|
+
} else if (q.type === "ranking") {
|
|
8987
|
+
if (q.required && (!Array.isArray(val) || val.length === 0)) {
|
|
8988
|
+
qErrs.push(trTest ? "Lütfen sıralamayı tamamlayınız." : "Please rank the options.");
|
|
8989
|
+
}
|
|
8990
|
+
} else if (q.type === "short_text" || q.type === "long_text") {
|
|
8991
|
+
const parts = [];
|
|
8992
|
+
if (q.required) parts.push("required");
|
|
8993
|
+
if (q.validation) parts.push(q.validation);
|
|
8994
|
+
if (parts.length > 0) {
|
|
8995
|
+
qErrs.push(...validateTextRules(val, parts.join("|"), qLabel, trTest));
|
|
8996
|
+
}
|
|
8997
|
+
}
|
|
8998
|
+
if (qErrs.length > 0) {
|
|
8999
|
+
nextErrs[q.key] = qErrs;
|
|
9000
|
+
}
|
|
9001
|
+
}
|
|
9002
|
+
setErrors(nextErrs);
|
|
9003
|
+
if (Object.keys(nextErrs).length > 0) {
|
|
9004
|
+
setGeneralError(
|
|
9005
|
+
trTest ? "Lütfen devam etmeden önce işaretli alanları kontrol ediniz." : "Please check the highlighted fields before continuing."
|
|
9006
|
+
);
|
|
9007
|
+
return false;
|
|
9008
|
+
}
|
|
9009
|
+
setGeneralError("");
|
|
9010
|
+
return true;
|
|
9011
|
+
};
|
|
9012
|
+
const isLastStep = !isMultiStep || safeStepIdx >= visibleSteps.length - 1;
|
|
9013
|
+
const handleNextOrSubmit = (e) => {
|
|
9014
|
+
e.preventDefault();
|
|
9015
|
+
if (!validateTargetQuestions(activeQuestions)) return;
|
|
9016
|
+
if (!isLastStep) {
|
|
9017
|
+
setCurrentStepIdx(safeStepIdx + 1);
|
|
9018
|
+
return;
|
|
9019
|
+
}
|
|
9020
|
+
const allVisible = (draft.questions || []).filter(
|
|
9021
|
+
(q) => isQuestionVisibleInDraft(q, draft, answers)
|
|
9022
|
+
);
|
|
9023
|
+
if (!validateTargetQuestions(allVisible)) return;
|
|
9024
|
+
if (draft.useRecaptcha && !mockCaptchaChecked) {
|
|
9025
|
+
setGeneralError(
|
|
9026
|
+
trTest ? "Lütfen reCAPTCHA doğrulama kutusunu işaretleyiniz." : "Please check the reCAPTCHA verification box."
|
|
9027
|
+
);
|
|
9028
|
+
return;
|
|
9029
|
+
}
|
|
9030
|
+
setElapsedMs(Date.now() - startTimeRef.current);
|
|
9031
|
+
setSubmitted(true);
|
|
9032
|
+
};
|
|
9033
|
+
const getRenderedOptions = (q) => {
|
|
9034
|
+
const opts = Array.isArray(q.options) ? q.options : [];
|
|
9035
|
+
if (!q.shuffleOptions) return opts;
|
|
9036
|
+
const keyNum = q.key.split("").reduce((acc, ch) => acc + ch.charCodeAt(0), 0);
|
|
9037
|
+
return shuffleCopy(opts, shuffleSeed + keyNum);
|
|
9038
|
+
};
|
|
9039
|
+
const moveRankOption = (qKey, fromIdx, toIdx) => {
|
|
9040
|
+
const cur = Array.isArray(answers[qKey]) ? [...answers[qKey]] : [];
|
|
9041
|
+
if (toIdx < 0 || toIdx >= cur.length || fromIdx === toIdx) return;
|
|
9042
|
+
const [moved] = cur.splice(fromIdx, 1);
|
|
9043
|
+
cur.splice(toIdx, 0, moved);
|
|
9044
|
+
setAnswer(qKey, cur);
|
|
9045
|
+
};
|
|
9046
|
+
const frameMaxWidth = device === "mobile" ? 390 : device === "tablet" ? 720 : 900;
|
|
9047
|
+
const resolvedSurveyTitle = pickTextForLocale(draft.titleI18n, testLocale, draft.title || "");
|
|
9048
|
+
const resolvedSurveyDesc = pickTextForLocale(draft.description, testLocale, "");
|
|
9049
|
+
const submitBtnText = pickTextForLocale(
|
|
9050
|
+
draft.settings?.submitLabel,
|
|
9051
|
+
testLocale,
|
|
9052
|
+
trTest ? "Anketi Gönder" : "Submit Survey"
|
|
9053
|
+
);
|
|
9054
|
+
const thankYouTitle = pickTextForLocale(
|
|
9055
|
+
draft.settings?.thankYouTitle,
|
|
9056
|
+
testLocale,
|
|
9057
|
+
trTest ? "Teşekkür Ederiz!" : "Thank You!"
|
|
9058
|
+
);
|
|
9059
|
+
const thankYouMessage = pickTextForLocale(
|
|
9060
|
+
draft.settings?.thankYouMessage,
|
|
9061
|
+
testLocale,
|
|
9062
|
+
trTest ? "Yanıtlarınız başarıyla kaydedildi." : "Your response has been recorded."
|
|
9063
|
+
);
|
|
9064
|
+
const visibleCount = (draft.questions || []).filter(
|
|
9065
|
+
(q) => isQuestionVisibleInDraft(q, draft, answers)
|
|
9066
|
+
).length;
|
|
9067
|
+
const hiddenCount = Math.max(0, (draft.questions || []).length - visibleCount);
|
|
9068
|
+
return /* @__PURE__ */ jsxs(
|
|
9069
|
+
"div",
|
|
9070
|
+
{
|
|
9071
|
+
style: {
|
|
9072
|
+
flex: 1,
|
|
9073
|
+
display: "flex",
|
|
9074
|
+
flexDirection: "column",
|
|
9075
|
+
overflow: "hidden",
|
|
9076
|
+
background: "#e2e8f0"
|
|
9077
|
+
},
|
|
9078
|
+
children: [
|
|
9079
|
+
/* @__PURE__ */ jsxs(
|
|
9080
|
+
"div",
|
|
9081
|
+
{
|
|
9082
|
+
style: {
|
|
9083
|
+
background: "#ffffff",
|
|
9084
|
+
borderBottom: "1px solid #cbd5e1",
|
|
9085
|
+
padding: "10px 18px",
|
|
9086
|
+
display: "flex",
|
|
9087
|
+
alignItems: "center",
|
|
9088
|
+
justifyContent: "space-between",
|
|
9089
|
+
flexWrap: "wrap",
|
|
9090
|
+
gap: 10
|
|
9091
|
+
},
|
|
9092
|
+
children: [
|
|
9093
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 10, flexWrap: "wrap" }, children: [
|
|
9094
|
+
/* @__PURE__ */ jsxs(
|
|
9095
|
+
"span",
|
|
9096
|
+
{
|
|
9097
|
+
style: {
|
|
9098
|
+
display: "inline-flex",
|
|
9099
|
+
alignItems: "center",
|
|
9100
|
+
gap: 6,
|
|
9101
|
+
padding: "4px 10px",
|
|
9102
|
+
borderRadius: 20,
|
|
9103
|
+
background: "#ecfdf5",
|
|
9104
|
+
border: "1px solid #a7f3d0",
|
|
9105
|
+
color: "#065f46",
|
|
9106
|
+
fontSize: 11,
|
|
9107
|
+
fontWeight: 700
|
|
9108
|
+
},
|
|
9109
|
+
children: [
|
|
9110
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "science", size: 14, color: "#059669" }),
|
|
9111
|
+
/* @__PURE__ */ jsx("span", { children: trUi ? "Canlı Akış Simülatörü (Gerçek DB verisini etkilemez)" : "Live Flow Simulator (Does not write to live DB)" })
|
|
9112
|
+
]
|
|
9113
|
+
}
|
|
9114
|
+
),
|
|
9115
|
+
/* @__PURE__ */ jsx(
|
|
9116
|
+
"div",
|
|
9117
|
+
{
|
|
9118
|
+
style: {
|
|
9119
|
+
display: "inline-flex",
|
|
9120
|
+
borderRadius: 7,
|
|
9121
|
+
overflow: "hidden",
|
|
9122
|
+
border: "1px solid #cbd5e1",
|
|
9123
|
+
background: "#f8fafc"
|
|
9124
|
+
},
|
|
9125
|
+
children: [
|
|
9126
|
+
{ id: "desktop", icon: "desktop_windows", label: trUi ? "Masaüstü" : "Desktop" },
|
|
9127
|
+
{ id: "tablet", icon: "tablet_mac", label: "Tablet" },
|
|
9128
|
+
{ id: "mobile", icon: "smartphone", label: trUi ? "Mobil" : "Mobile" }
|
|
9129
|
+
].map((vp) => {
|
|
9130
|
+
const active = device === vp.id;
|
|
9131
|
+
return /* @__PURE__ */ jsxs(
|
|
9132
|
+
"button",
|
|
9133
|
+
{
|
|
9134
|
+
type: "button",
|
|
9135
|
+
onClick: () => setDevice(vp.id),
|
|
9136
|
+
style: {
|
|
9137
|
+
padding: "5px 10px",
|
|
9138
|
+
border: "none",
|
|
9139
|
+
background: active ? "#1e3a8a" : "transparent",
|
|
9140
|
+
color: active ? "#ffffff" : "#475569",
|
|
9141
|
+
fontSize: 11,
|
|
9142
|
+
fontWeight: 700,
|
|
9143
|
+
cursor: "pointer",
|
|
9144
|
+
display: "inline-flex",
|
|
9145
|
+
alignItems: "center",
|
|
9146
|
+
gap: 5
|
|
9147
|
+
},
|
|
9148
|
+
children: [
|
|
9149
|
+
/* @__PURE__ */ jsx(
|
|
9150
|
+
MaterialIcon,
|
|
9151
|
+
{
|
|
9152
|
+
name: vp.icon,
|
|
9153
|
+
size: 14,
|
|
9154
|
+
color: active ? "#ffffff" : "#64748b"
|
|
9155
|
+
}
|
|
9156
|
+
),
|
|
9157
|
+
/* @__PURE__ */ jsx("span", { children: vp.label })
|
|
9158
|
+
]
|
|
9159
|
+
},
|
|
9160
|
+
vp.id
|
|
9161
|
+
);
|
|
9162
|
+
})
|
|
9163
|
+
}
|
|
9164
|
+
),
|
|
9165
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "inline-flex", alignItems: "center", gap: 5 }, children: [
|
|
9166
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: 11, fontWeight: 700, color: "#475569" }, children: trUi ? "Test Dili:" : "Test Locale:" }),
|
|
9167
|
+
/* @__PURE__ */ jsx(
|
|
9168
|
+
"div",
|
|
9169
|
+
{
|
|
9170
|
+
style: {
|
|
9171
|
+
display: "inline-flex",
|
|
9172
|
+
borderRadius: 6,
|
|
9173
|
+
overflow: "hidden",
|
|
9174
|
+
border: "1px solid #cbd5e1"
|
|
9175
|
+
},
|
|
9176
|
+
children: strapiLocales.map((loc) => {
|
|
9177
|
+
const active = testLocale === loc.code;
|
|
9178
|
+
return /* @__PURE__ */ jsx(
|
|
9179
|
+
"button",
|
|
9180
|
+
{
|
|
9181
|
+
type: "button",
|
|
9182
|
+
onClick: () => setTestLocale(loc.code),
|
|
9183
|
+
style: {
|
|
9184
|
+
padding: "4px 9px",
|
|
9185
|
+
border: "none",
|
|
9186
|
+
background: active ? "#2563eb" : "#ffffff",
|
|
9187
|
+
color: active ? "#ffffff" : "#334155",
|
|
9188
|
+
fontSize: 10.5,
|
|
9189
|
+
fontWeight: 800,
|
|
9190
|
+
cursor: "pointer"
|
|
9191
|
+
},
|
|
9192
|
+
children: loc.code.toUpperCase()
|
|
9193
|
+
},
|
|
9194
|
+
loc.code
|
|
9195
|
+
);
|
|
9196
|
+
})
|
|
9197
|
+
}
|
|
9198
|
+
)
|
|
9199
|
+
] })
|
|
9200
|
+
] }),
|
|
9201
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
9202
|
+
/* @__PURE__ */ jsxs(
|
|
9203
|
+
"button",
|
|
9204
|
+
{
|
|
9205
|
+
type: "button",
|
|
9206
|
+
onClick: resetFlow,
|
|
9207
|
+
style: {
|
|
9208
|
+
padding: "6px 12px",
|
|
9209
|
+
borderRadius: 6,
|
|
9210
|
+
border: "1px solid #cbd5e1",
|
|
9211
|
+
background: "#ffffff",
|
|
9212
|
+
color: "#0f172a",
|
|
9213
|
+
fontSize: 11.5,
|
|
9214
|
+
fontWeight: 700,
|
|
9215
|
+
cursor: "pointer",
|
|
9216
|
+
display: "inline-flex",
|
|
9217
|
+
alignItems: "center",
|
|
9218
|
+
gap: 5
|
|
9219
|
+
},
|
|
9220
|
+
children: [
|
|
9221
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "refresh", size: 15, color: "#2563eb" }),
|
|
9222
|
+
/* @__PURE__ */ jsx("span", { children: trUi ? "Akışı Baştan Başlat" : "Reset Flow" })
|
|
9223
|
+
]
|
|
9224
|
+
}
|
|
9225
|
+
),
|
|
9226
|
+
/* @__PURE__ */ jsxs(
|
|
9227
|
+
"button",
|
|
9228
|
+
{
|
|
9229
|
+
type: "button",
|
|
9230
|
+
onClick: () => setShowInspector((v) => !v),
|
|
9231
|
+
style: {
|
|
9232
|
+
padding: "6px 12px",
|
|
9233
|
+
borderRadius: 6,
|
|
9234
|
+
border: showInspector ? "1px solid #2563eb" : "1px solid #cbd5e1",
|
|
9235
|
+
background: showInspector ? "#eff6ff" : "#ffffff",
|
|
9236
|
+
color: showInspector ? "#1d4ed8" : "#475569",
|
|
9237
|
+
fontSize: 11.5,
|
|
9238
|
+
fontWeight: 700,
|
|
9239
|
+
cursor: "pointer",
|
|
9240
|
+
display: "inline-flex",
|
|
9241
|
+
alignItems: "center",
|
|
9242
|
+
gap: 5
|
|
9243
|
+
},
|
|
9244
|
+
children: [
|
|
9245
|
+
/* @__PURE__ */ jsx(
|
|
9246
|
+
MaterialIcon,
|
|
9247
|
+
{
|
|
9248
|
+
name: "account_tree",
|
|
9249
|
+
size: 15,
|
|
9250
|
+
color: showInspector ? "#2563eb" : "#64748b"
|
|
9251
|
+
}
|
|
9252
|
+
),
|
|
9253
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
9254
|
+
trUi ? "Koşul & Yanıt Müfettişi" : "Logic & Payload Inspector",
|
|
9255
|
+
hiddenCount > 0 ? ` (${hiddenCount} ${trUi ? "gizli" : "hidden"})` : ""
|
|
9256
|
+
] })
|
|
9257
|
+
]
|
|
9258
|
+
}
|
|
9259
|
+
)
|
|
9260
|
+
] })
|
|
9261
|
+
]
|
|
9262
|
+
}
|
|
9263
|
+
),
|
|
9264
|
+
/* @__PURE__ */ jsxs(
|
|
9265
|
+
"div",
|
|
9266
|
+
{
|
|
9267
|
+
style: {
|
|
9268
|
+
flex: 1,
|
|
9269
|
+
display: "grid",
|
|
9270
|
+
gridTemplateColumns: showInspector ? "minmax(0, 1fr) 330px" : "minmax(0, 1fr)",
|
|
9271
|
+
overflow: "hidden"
|
|
9272
|
+
},
|
|
9273
|
+
children: [
|
|
9274
|
+
/* @__PURE__ */ jsxs(
|
|
9275
|
+
"div",
|
|
9276
|
+
{
|
|
9277
|
+
style: {
|
|
9278
|
+
overflowY: "auto",
|
|
9279
|
+
padding: device === "mobile" ? "20px 12px 40px" : "28px 24px 48px",
|
|
9280
|
+
display: "flex",
|
|
9281
|
+
flexDirection: "column",
|
|
9282
|
+
alignItems: "center"
|
|
9283
|
+
},
|
|
9284
|
+
children: [
|
|
9285
|
+
draft.status && draft.status !== "published" && /* @__PURE__ */ jsxs(
|
|
9286
|
+
"div",
|
|
9287
|
+
{
|
|
9288
|
+
style: {
|
|
9289
|
+
width: "100%",
|
|
9290
|
+
maxWidth: frameMaxWidth,
|
|
9291
|
+
marginBottom: 12,
|
|
9292
|
+
padding: "8px 14px",
|
|
9293
|
+
borderRadius: 10,
|
|
9294
|
+
background: "#fef3c7",
|
|
9295
|
+
border: "1px solid #fcd34d",
|
|
9296
|
+
color: "#92400e",
|
|
9297
|
+
fontSize: 11.5,
|
|
9298
|
+
fontWeight: 600,
|
|
9299
|
+
display: "flex",
|
|
9300
|
+
alignItems: "center",
|
|
9301
|
+
gap: 8
|
|
9302
|
+
},
|
|
9303
|
+
children: [
|
|
9304
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "info", size: 16, color: "#d97706" }),
|
|
9305
|
+
/* @__PURE__ */ jsx("span", { children: trUi ? `Bilgi: Anket durumu şu an "${draft.status.toUpperCase()}" olarak seçili (vitrinde kapalı görünür), ancak önizleme modunda tüm soru akışını test edebilirsiniz.` : `Note: Survey status is currently "${draft.status.toUpperCase()}" (closed on storefront), but full interactive testing is unlocked here.` })
|
|
9306
|
+
]
|
|
9307
|
+
}
|
|
9308
|
+
),
|
|
9309
|
+
/* @__PURE__ */ jsxs(
|
|
9310
|
+
"div",
|
|
9311
|
+
{
|
|
9312
|
+
style: {
|
|
9313
|
+
width: "100%",
|
|
9314
|
+
maxWidth: frameMaxWidth,
|
|
9315
|
+
transition: "max-width 0.22s ease",
|
|
9316
|
+
background: "#ffffff",
|
|
9317
|
+
color: "#0f172a",
|
|
9318
|
+
borderRadius: device === "mobile" ? 22 : 16,
|
|
9319
|
+
border: device === "mobile" ? "6px solid #1e293b" : "1px solid #cbd5e1",
|
|
9320
|
+
boxShadow: "0 14px 36px rgba(15, 23, 42, 0.12)",
|
|
9321
|
+
padding: isQuickPoll || device === "mobile" ? 20 : 28
|
|
9322
|
+
},
|
|
9323
|
+
children: [
|
|
9324
|
+
/* @__PURE__ */ jsxs("div", { style: { marginBottom: 18 }, children: [
|
|
9325
|
+
/* @__PURE__ */ jsxs(
|
|
9326
|
+
"div",
|
|
9327
|
+
{
|
|
9328
|
+
style: {
|
|
9329
|
+
display: "flex",
|
|
9330
|
+
alignItems: "center",
|
|
9331
|
+
justifyContent: "space-between",
|
|
9332
|
+
flexWrap: "wrap",
|
|
9333
|
+
gap: 8,
|
|
9334
|
+
marginBottom: 8
|
|
9335
|
+
},
|
|
9336
|
+
children: [
|
|
9337
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6, flexWrap: "wrap" }, children: [
|
|
9338
|
+
/* @__PURE__ */ jsx(
|
|
9339
|
+
"span",
|
|
9340
|
+
{
|
|
9341
|
+
style: {
|
|
9342
|
+
fontSize: 10,
|
|
9343
|
+
fontWeight: 800,
|
|
9344
|
+
textTransform: "uppercase",
|
|
9345
|
+
letterSpacing: "0.04em",
|
|
9346
|
+
padding: "3px 9px",
|
|
9347
|
+
borderRadius: 12,
|
|
9348
|
+
background: isQuickPoll ? "#f3e8ff" : isMultiStep ? "#e0e7ff" : "#dbeafe",
|
|
9349
|
+
color: isQuickPoll ? "#6b21a8" : isMultiStep ? "#3730a3" : "#1e40af"
|
|
9350
|
+
},
|
|
9351
|
+
children: isQuickPoll ? trTest ? "Hızlı Oylama" : "Quick Poll" : isMultiStep ? trTest ? "Çok Adımlı Anket" : "Multi-Step Survey" : trTest ? "Anket" : "Survey"
|
|
9352
|
+
}
|
|
9353
|
+
),
|
|
9354
|
+
/* @__PURE__ */ jsxs(
|
|
9355
|
+
"span",
|
|
9356
|
+
{
|
|
9357
|
+
style: {
|
|
9358
|
+
fontSize: 10.5,
|
|
9359
|
+
fontWeight: 600,
|
|
9360
|
+
padding: "3px 9px",
|
|
9361
|
+
borderRadius: 12,
|
|
9362
|
+
background: "#f1f5f9",
|
|
9363
|
+
color: "#475569"
|
|
9364
|
+
},
|
|
9365
|
+
children: [
|
|
9366
|
+
visibleCount,
|
|
9367
|
+
" ",
|
|
9368
|
+
trTest ? "Aktif Soru" : visibleCount === 1 ? "Question" : "Questions"
|
|
9369
|
+
]
|
|
9370
|
+
}
|
|
9371
|
+
)
|
|
9372
|
+
] }),
|
|
9373
|
+
draft.showPublicResults === "always" && !submitted && /* @__PURE__ */ jsx(
|
|
9374
|
+
"button",
|
|
9375
|
+
{
|
|
9376
|
+
type: "button",
|
|
9377
|
+
onClick: () => setPeekResults((p) => !p),
|
|
9378
|
+
style: {
|
|
9379
|
+
border: "none",
|
|
9380
|
+
background: "transparent",
|
|
9381
|
+
color: "#2563eb",
|
|
9382
|
+
fontSize: 12,
|
|
9383
|
+
fontWeight: 700,
|
|
9384
|
+
cursor: "pointer"
|
|
9385
|
+
},
|
|
9386
|
+
children: peekResults ? trTest ? "← Oy Kullanma Ekranına Dön" : "← Back to Voting" : trTest ? "Canlı Sonuçları Gör 📊" : "View Live Results 📊"
|
|
9387
|
+
}
|
|
9388
|
+
)
|
|
9389
|
+
]
|
|
9390
|
+
}
|
|
9391
|
+
),
|
|
9392
|
+
resolvedSurveyTitle && /* @__PURE__ */ jsx("h2", { style: { margin: 0, fontSize: 20, fontWeight: 800, color: "#0f172a" }, children: resolvedSurveyTitle }),
|
|
9393
|
+
resolvedSurveyDesc && /* @__PURE__ */ jsx(
|
|
9394
|
+
"p",
|
|
9395
|
+
{
|
|
9396
|
+
style: {
|
|
9397
|
+
margin: "6px 0 0",
|
|
9398
|
+
fontSize: 13.5,
|
|
9399
|
+
lineHeight: 1.5,
|
|
9400
|
+
color: "#475569"
|
|
9401
|
+
},
|
|
9402
|
+
children: resolvedSurveyDesc
|
|
9403
|
+
}
|
|
9404
|
+
)
|
|
9405
|
+
] }),
|
|
9406
|
+
submitted ? /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 16 }, children: [
|
|
9407
|
+
/* @__PURE__ */ jsxs(
|
|
9408
|
+
"div",
|
|
9409
|
+
{
|
|
9410
|
+
style: {
|
|
9411
|
+
padding: 18,
|
|
9412
|
+
borderRadius: 12,
|
|
9413
|
+
background: "#ecfdf5",
|
|
9414
|
+
border: "1px solid #6ee7b7",
|
|
9415
|
+
color: "#065f46"
|
|
9416
|
+
},
|
|
9417
|
+
children: [
|
|
9418
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 6 }, children: [
|
|
9419
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "check_circle", size: 22, color: "#059669" }),
|
|
9420
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: 16, fontWeight: 800 }, children: thankYouTitle })
|
|
9421
|
+
] }),
|
|
9422
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: 13.5, lineHeight: 1.5 }, children: thankYouMessage }),
|
|
9423
|
+
/* @__PURE__ */ jsx(
|
|
9424
|
+
"div",
|
|
9425
|
+
{
|
|
9426
|
+
style: {
|
|
9427
|
+
marginTop: 10,
|
|
9428
|
+
fontSize: 11.5,
|
|
9429
|
+
color: "#047857",
|
|
9430
|
+
fontWeight: 600
|
|
9431
|
+
},
|
|
9432
|
+
children: trTest ? `Tamamlama süresi: ${(elapsedMs / 1e3).toFixed(1)} sn • Dil: ${testLocale.toUpperCase()}` : `Completion time: ${(elapsedMs / 1e3).toFixed(1)}s • Locale: ${testLocale.toUpperCase()}`
|
|
9433
|
+
}
|
|
9434
|
+
)
|
|
9435
|
+
]
|
|
9436
|
+
}
|
|
9437
|
+
),
|
|
9438
|
+
draft.showPublicResults !== "never" && /* @__PURE__ */ jsxs(
|
|
9439
|
+
"div",
|
|
9440
|
+
{
|
|
9441
|
+
style: {
|
|
9442
|
+
padding: 16,
|
|
9443
|
+
borderRadius: 12,
|
|
9444
|
+
border: "1px solid #e2e8f0",
|
|
9445
|
+
background: "#f8fafc",
|
|
9446
|
+
display: "flex",
|
|
9447
|
+
flexDirection: "column",
|
|
9448
|
+
gap: 14
|
|
9449
|
+
},
|
|
9450
|
+
children: [
|
|
9451
|
+
/* @__PURE__ */ jsxs("div", { style: { fontSize: 12.5, fontWeight: 800, color: "#1e293b" }, children: [
|
|
9452
|
+
"📊",
|
|
9453
|
+
" ",
|
|
9454
|
+
trTest ? "Oy Sonrası Katılımcıya Gösterilen Sonuç Ekranı (Simülasyon)" : "Post-Vote Public Results View (Simulated)"
|
|
9455
|
+
] }),
|
|
9456
|
+
(draft.questions || []).filter(
|
|
9457
|
+
(q) => q.type !== "statement" && q.type !== "consent" && isQuestionVisibleInDraft(q, draft, answers)
|
|
9458
|
+
).map((q) => {
|
|
9459
|
+
const qT = pickTextForLocale(q.title, testLocale, q.key);
|
|
9460
|
+
const ans = answers[q.key];
|
|
9461
|
+
return /* @__PURE__ */ jsxs(
|
|
9462
|
+
"div",
|
|
9463
|
+
{
|
|
9464
|
+
style: {
|
|
9465
|
+
padding: 12,
|
|
9466
|
+
borderRadius: 8,
|
|
9467
|
+
background: "#ffffff",
|
|
9468
|
+
border: "1px solid #e2e8f0"
|
|
9469
|
+
},
|
|
9470
|
+
children: [
|
|
9471
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: 12.5, fontWeight: 700, color: "#0f172a" }, children: qT }),
|
|
9472
|
+
Array.isArray(q.options) && q.options.length > 0 && q.type !== "ranking" ? /* @__PURE__ */ jsx(
|
|
9473
|
+
"div",
|
|
9474
|
+
{
|
|
9475
|
+
style: {
|
|
9476
|
+
display: "flex",
|
|
9477
|
+
flexDirection: "column",
|
|
9478
|
+
gap: 6,
|
|
9479
|
+
marginTop: 8
|
|
9480
|
+
},
|
|
9481
|
+
children: q.options.map((opt, idx) => {
|
|
9482
|
+
const selected = Array.isArray(ans) ? ans.includes(opt.id) : ans === opt.id;
|
|
9483
|
+
const demoPct = selected ? Math.min(82, 48 + idx * 13 % 30) : Math.max(8, 28 - idx * 9 % 20);
|
|
9484
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
9485
|
+
/* @__PURE__ */ jsxs(
|
|
9486
|
+
"div",
|
|
9487
|
+
{
|
|
9488
|
+
style: {
|
|
9489
|
+
display: "flex",
|
|
9490
|
+
justifyContent: "space-between",
|
|
9491
|
+
fontSize: 11.5,
|
|
9492
|
+
marginBottom: 3
|
|
9493
|
+
},
|
|
9494
|
+
children: [
|
|
9495
|
+
/* @__PURE__ */ jsxs("span", { style: { fontWeight: selected ? 700 : 500 }, children: [
|
|
9496
|
+
pickTextForLocale(opt.labels, testLocale, opt.id),
|
|
9497
|
+
selected ? trTest ? " (Seçiminiz)" : " (Your pick)" : ""
|
|
9498
|
+
] }),
|
|
9499
|
+
/* @__PURE__ */ jsxs("span", { style: { fontWeight: 700, color: "#2563eb" }, children: [
|
|
9500
|
+
demoPct,
|
|
9501
|
+
"%"
|
|
9502
|
+
] })
|
|
9503
|
+
]
|
|
9504
|
+
}
|
|
9505
|
+
),
|
|
9506
|
+
/* @__PURE__ */ jsx(
|
|
9507
|
+
"div",
|
|
9508
|
+
{
|
|
9509
|
+
style: {
|
|
9510
|
+
height: 7,
|
|
9511
|
+
borderRadius: 4,
|
|
9512
|
+
background: "#e2e8f0",
|
|
9513
|
+
overflow: "hidden"
|
|
9514
|
+
},
|
|
9515
|
+
children: /* @__PURE__ */ jsx(
|
|
9516
|
+
"div",
|
|
9517
|
+
{
|
|
9518
|
+
style: {
|
|
9519
|
+
width: `${demoPct}%`,
|
|
9520
|
+
height: "100%",
|
|
9521
|
+
background: selected ? "#2563eb" : "#94a3b8"
|
|
9522
|
+
}
|
|
9523
|
+
}
|
|
9524
|
+
)
|
|
9525
|
+
}
|
|
9526
|
+
)
|
|
9527
|
+
] }, opt.id);
|
|
9528
|
+
})
|
|
9529
|
+
}
|
|
9530
|
+
) : /* @__PURE__ */ jsxs("div", { style: { fontSize: 12, color: "#334155", marginTop: 4 }, children: [
|
|
9531
|
+
/* @__PURE__ */ jsx("strong", { children: trTest ? "Yanıtınız:" : "Your answer:" }),
|
|
9532
|
+
" ",
|
|
9533
|
+
typeof ans === "object" ? JSON.stringify(ans) : String(ans ?? "—")
|
|
9534
|
+
] })
|
|
9535
|
+
]
|
|
9536
|
+
},
|
|
9537
|
+
`res-${q.key}`
|
|
9538
|
+
);
|
|
9539
|
+
})
|
|
9540
|
+
]
|
|
9541
|
+
}
|
|
9542
|
+
),
|
|
9543
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ jsxs(
|
|
9544
|
+
"button",
|
|
9545
|
+
{
|
|
9546
|
+
type: "button",
|
|
9547
|
+
onClick: resetFlow,
|
|
9548
|
+
style: {
|
|
9549
|
+
padding: "9px 18px",
|
|
9550
|
+
borderRadius: 8,
|
|
9551
|
+
border: "none",
|
|
9552
|
+
background: "#2563eb",
|
|
9553
|
+
color: "#ffffff",
|
|
9554
|
+
fontSize: 12.5,
|
|
9555
|
+
fontWeight: 700,
|
|
9556
|
+
cursor: "pointer",
|
|
9557
|
+
display: "inline-flex",
|
|
9558
|
+
alignItems: "center",
|
|
9559
|
+
gap: 6
|
|
9560
|
+
},
|
|
9561
|
+
children: [
|
|
9562
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "replay", size: 16, color: "#fff" }),
|
|
9563
|
+
/* @__PURE__ */ jsx("span", { children: trTest ? "Akışı Tekrar Test Et" : "Test Flow Again" })
|
|
9564
|
+
]
|
|
9565
|
+
}
|
|
9566
|
+
) })
|
|
9567
|
+
] }) : peekResults ? /* @__PURE__ */ jsx(
|
|
9568
|
+
"div",
|
|
9569
|
+
{
|
|
9570
|
+
style: {
|
|
9571
|
+
padding: 16,
|
|
9572
|
+
borderRadius: 10,
|
|
9573
|
+
background: "#f8fafc",
|
|
9574
|
+
border: "1px solid #e2e8f0",
|
|
9575
|
+
fontSize: 13,
|
|
9576
|
+
color: "#334155"
|
|
9577
|
+
},
|
|
9578
|
+
children: trTest ? "Canlı sonuç önizlemesi açık (`showPublicResults = always`). Oy kullanma ekranına dönmek için sağ üstteki bağlantıya tıklayın." : "Public results preview is active (`showPublicResults = always`). Click the top-right link to return to the form."
|
|
9579
|
+
}
|
|
9580
|
+
) : (
|
|
9581
|
+
/* Interactive Form Flow */
|
|
9582
|
+
/* @__PURE__ */ jsxs("form", { onSubmit: handleNextOrSubmit, children: [
|
|
9583
|
+
isMultiStep && visibleSteps.length > 1 && /* @__PURE__ */ jsxs("div", { style: { marginBottom: 22 }, children: [
|
|
9584
|
+
/* @__PURE__ */ jsxs(
|
|
9585
|
+
"div",
|
|
9586
|
+
{
|
|
9587
|
+
style: {
|
|
9588
|
+
display: "flex",
|
|
9589
|
+
alignItems: "center",
|
|
9590
|
+
justifyContent: "space-between",
|
|
9591
|
+
flexWrap: "wrap",
|
|
9592
|
+
gap: 8,
|
|
9593
|
+
marginBottom: 8
|
|
9594
|
+
},
|
|
9595
|
+
children: [
|
|
9596
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: visibleSteps.map((st, sIdx) => {
|
|
9597
|
+
const isCurrent = sIdx === safeStepIdx;
|
|
9598
|
+
const isCompleted = sIdx < safeStepIdx;
|
|
9599
|
+
const canJumpBack = isCompleted && draft.allowBackNavigation !== false;
|
|
9600
|
+
const stLabel = pickTextForLocale(
|
|
9601
|
+
st.title,
|
|
9602
|
+
testLocale,
|
|
9603
|
+
`${sIdx + 1}. ${trTest ? "Adım" : "Step"}`
|
|
9604
|
+
);
|
|
9605
|
+
return /* @__PURE__ */ jsxs(
|
|
9606
|
+
"button",
|
|
9607
|
+
{
|
|
9608
|
+
type: "button",
|
|
9609
|
+
onClick: () => canJumpBack ? setCurrentStepIdx(sIdx) : void 0,
|
|
9610
|
+
style: {
|
|
9611
|
+
padding: "5px 11px",
|
|
9612
|
+
borderRadius: 16,
|
|
9613
|
+
border: isCurrent ? "1.5px solid #2563eb" : isCompleted ? "1px solid #86efac" : "1px solid #cbd5e1",
|
|
9614
|
+
background: isCurrent ? "#2563eb" : isCompleted ? "#dcfce7" : "#f8fafc",
|
|
9615
|
+
color: isCurrent ? "#ffffff" : isCompleted ? "#166534" : "#64748b",
|
|
9616
|
+
fontSize: 11.5,
|
|
9617
|
+
fontWeight: 700,
|
|
9618
|
+
cursor: canJumpBack ? "pointer" : "default"
|
|
9619
|
+
},
|
|
9620
|
+
children: [
|
|
9621
|
+
isCompleted ? "✓ " : `${sIdx + 1}. `,
|
|
9622
|
+
stLabel
|
|
9623
|
+
]
|
|
9624
|
+
},
|
|
9625
|
+
st.id
|
|
9626
|
+
);
|
|
9627
|
+
}) }),
|
|
9628
|
+
/* @__PURE__ */ jsxs("span", { style: { fontSize: 11.5, fontWeight: 700, color: "#475569" }, children: [
|
|
9629
|
+
safeStepIdx + 1,
|
|
9630
|
+
" / ",
|
|
9631
|
+
visibleSteps.length,
|
|
9632
|
+
" (",
|
|
9633
|
+
stepProgressPct,
|
|
9634
|
+
"%)"
|
|
9635
|
+
] })
|
|
9636
|
+
]
|
|
9637
|
+
}
|
|
9638
|
+
),
|
|
9639
|
+
draft.showProgressBar !== false && /* @__PURE__ */ jsx(
|
|
9640
|
+
"div",
|
|
9641
|
+
{
|
|
9642
|
+
style: {
|
|
9643
|
+
height: 8,
|
|
9644
|
+
borderRadius: 6,
|
|
9645
|
+
background: "#e2e8f0",
|
|
9646
|
+
overflow: "hidden"
|
|
9647
|
+
},
|
|
9648
|
+
children: /* @__PURE__ */ jsx(
|
|
9649
|
+
"div",
|
|
9650
|
+
{
|
|
9651
|
+
style: {
|
|
9652
|
+
width: `${stepProgressPct}%`,
|
|
9653
|
+
height: "100%",
|
|
9654
|
+
background: "linear-gradient(90deg, #2563eb, #3b82f6)",
|
|
9655
|
+
transition: "width 0.25s ease"
|
|
9656
|
+
}
|
|
9657
|
+
}
|
|
9658
|
+
)
|
|
9659
|
+
}
|
|
9660
|
+
),
|
|
9661
|
+
activeStep && pickTextForLocale(activeStep.description, testLocale, "") && /* @__PURE__ */ jsx("div", { style: { fontSize: 12, color: "#64748b", marginTop: 6 }, children: pickTextForLocale(activeStep.description, testLocale, "") })
|
|
9662
|
+
] }),
|
|
9663
|
+
generalError && /* @__PURE__ */ jsx(
|
|
9664
|
+
"div",
|
|
9665
|
+
{
|
|
9666
|
+
style: {
|
|
9667
|
+
marginBottom: 16,
|
|
9668
|
+
padding: "10px 14px",
|
|
9669
|
+
borderRadius: 8,
|
|
9670
|
+
background: "#fef2f2",
|
|
9671
|
+
border: "1px solid #fecaca",
|
|
9672
|
+
color: "#991b1b",
|
|
9673
|
+
fontSize: 12.5,
|
|
9674
|
+
fontWeight: 600
|
|
9675
|
+
},
|
|
9676
|
+
children: generalError
|
|
9677
|
+
}
|
|
9678
|
+
),
|
|
9679
|
+
activeQuestions.length === 0 ? /* @__PURE__ */ jsx(
|
|
9680
|
+
"div",
|
|
9681
|
+
{
|
|
9682
|
+
style: {
|
|
9683
|
+
padding: 24,
|
|
9684
|
+
borderRadius: 10,
|
|
9685
|
+
border: "1px dashed #cbd5e1",
|
|
9686
|
+
textAlign: "center",
|
|
9687
|
+
color: "#64748b",
|
|
9688
|
+
fontSize: 13,
|
|
9689
|
+
marginBottom: 18
|
|
9690
|
+
},
|
|
9691
|
+
children: trTest ? "Bu adımda (veya mevcut koşullara göre) görüntülenecek soru bulunmuyor." : "No visible questions in this step under current conditions."
|
|
9692
|
+
}
|
|
9693
|
+
) : /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: 20 }, children: activeQuestions.map((q) => {
|
|
9694
|
+
const qTitle = pickTextForLocale(q.title, testLocale, q.key);
|
|
9695
|
+
const qDesc = pickTextForLocale(q.description, testLocale, "");
|
|
9696
|
+
const qPlaceholder = pickTextForLocale(q.placeholder, testLocale, "");
|
|
9697
|
+
const qErrs = errors[q.key] || [];
|
|
9698
|
+
const hasErr = qErrs.length > 0;
|
|
9699
|
+
const val = answers[q.key];
|
|
9700
|
+
if (q.type === "statement") {
|
|
9701
|
+
return /* @__PURE__ */ jsxs(
|
|
9702
|
+
"div",
|
|
9703
|
+
{
|
|
9704
|
+
style: {
|
|
9705
|
+
padding: "14px 16px",
|
|
9706
|
+
borderRadius: 10,
|
|
9707
|
+
background: "#eff6ff",
|
|
9708
|
+
borderLeft: "4px solid #2563eb",
|
|
9709
|
+
color: "#1e3a8a"
|
|
9710
|
+
},
|
|
9711
|
+
children: [
|
|
9712
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: 14, fontWeight: 700 }, children: qTitle }),
|
|
9713
|
+
qDesc && /* @__PURE__ */ jsx("div", { style: { fontSize: 12.5, marginTop: 4, color: "#1e40af" }, children: qDesc })
|
|
9714
|
+
]
|
|
9715
|
+
},
|
|
9716
|
+
q.key
|
|
9717
|
+
);
|
|
9718
|
+
}
|
|
9719
|
+
return /* @__PURE__ */ jsxs(
|
|
9720
|
+
"div",
|
|
9721
|
+
{
|
|
9722
|
+
style: {
|
|
9723
|
+
padding: 16,
|
|
9724
|
+
borderRadius: 12,
|
|
9725
|
+
border: hasErr ? "1.5px solid #ef4444" : "1px solid #e2e8f0",
|
|
9726
|
+
background: hasErr ? "#fffafa" : "#ffffff"
|
|
9727
|
+
},
|
|
9728
|
+
children: [
|
|
9729
|
+
q.type !== "consent" && /* @__PURE__ */ jsxs("div", { style: { marginBottom: 10 }, children: [
|
|
9730
|
+
/* @__PURE__ */ jsxs("div", { style: { fontSize: 14.5, fontWeight: 700, color: "#0f172a" }, children: [
|
|
9731
|
+
qTitle,
|
|
9732
|
+
" ",
|
|
9733
|
+
q.required && /* @__PURE__ */ jsx("span", { style: { color: "#dc2626" }, children: "*" })
|
|
9734
|
+
] }),
|
|
9735
|
+
qDesc && /* @__PURE__ */ jsx("div", { style: { fontSize: 12, color: "#64748b", marginTop: 3 }, children: qDesc })
|
|
9736
|
+
] }),
|
|
9737
|
+
q.type === "single_choice" && /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
9738
|
+
/* @__PURE__ */ jsxs(
|
|
9739
|
+
"div",
|
|
9740
|
+
{
|
|
9741
|
+
style: {
|
|
9742
|
+
display: "flex",
|
|
9743
|
+
flexDirection: q.inline ? "row" : "column",
|
|
9744
|
+
flexWrap: "wrap",
|
|
9745
|
+
gap: 8
|
|
9746
|
+
},
|
|
9747
|
+
children: [
|
|
9748
|
+
getRenderedOptions(q).map((opt) => {
|
|
9749
|
+
const checked = val === opt.id;
|
|
9750
|
+
return /* @__PURE__ */ jsxs(
|
|
9751
|
+
"label",
|
|
9752
|
+
{
|
|
9753
|
+
style: {
|
|
9754
|
+
display: "inline-flex",
|
|
9755
|
+
alignItems: "center",
|
|
9756
|
+
gap: 9,
|
|
9757
|
+
padding: "9px 12px",
|
|
9758
|
+
borderRadius: 8,
|
|
9759
|
+
border: checked ? "1.5px solid #2563eb" : "1px solid #cbd5e1",
|
|
9760
|
+
background: checked ? "#eff6ff" : "#f8fafc",
|
|
9761
|
+
color: "#0f172a",
|
|
9762
|
+
fontSize: 13,
|
|
9763
|
+
fontWeight: checked ? 700 : 500,
|
|
9764
|
+
cursor: "pointer"
|
|
9765
|
+
},
|
|
9766
|
+
children: [
|
|
9767
|
+
/* @__PURE__ */ jsx(
|
|
9768
|
+
"input",
|
|
9769
|
+
{
|
|
9770
|
+
type: "radio",
|
|
9771
|
+
name: `prev-${q.key}`,
|
|
9772
|
+
checked,
|
|
9773
|
+
onChange: () => setAnswer(q.key, opt.id)
|
|
9774
|
+
}
|
|
9775
|
+
),
|
|
9776
|
+
/* @__PURE__ */ jsx("span", { children: pickTextForLocale(opt.labels, testLocale, opt.id) })
|
|
9777
|
+
]
|
|
9778
|
+
},
|
|
9779
|
+
opt.id
|
|
9780
|
+
);
|
|
9781
|
+
}),
|
|
9782
|
+
q.allowOther && /* @__PURE__ */ jsxs(
|
|
9783
|
+
"label",
|
|
9784
|
+
{
|
|
9785
|
+
style: {
|
|
9786
|
+
display: "inline-flex",
|
|
9787
|
+
alignItems: "center",
|
|
9788
|
+
gap: 9,
|
|
9789
|
+
padding: "9px 12px",
|
|
9790
|
+
borderRadius: 8,
|
|
9791
|
+
border: val === "__other__" ? "1.5px solid #2563eb" : "1px solid #cbd5e1",
|
|
9792
|
+
background: val === "__other__" ? "#eff6ff" : "#f8fafc",
|
|
9793
|
+
color: "#0f172a",
|
|
9794
|
+
fontSize: 13,
|
|
9795
|
+
fontWeight: val === "__other__" ? 700 : 500,
|
|
9796
|
+
cursor: "pointer"
|
|
9797
|
+
},
|
|
9798
|
+
children: [
|
|
9799
|
+
/* @__PURE__ */ jsx(
|
|
9800
|
+
"input",
|
|
9801
|
+
{
|
|
9802
|
+
type: "radio",
|
|
9803
|
+
name: `prev-${q.key}`,
|
|
9804
|
+
checked: val === "__other__",
|
|
9805
|
+
onChange: () => setAnswer(q.key, "__other__")
|
|
9806
|
+
}
|
|
9807
|
+
),
|
|
9808
|
+
/* @__PURE__ */ jsx("span", { children: pickTextForLocale(
|
|
9809
|
+
q.otherLabel,
|
|
9810
|
+
testLocale,
|
|
9811
|
+
trTest ? "Diğer (Belirtiniz)" : "Other (Please specify)"
|
|
9812
|
+
) })
|
|
9813
|
+
]
|
|
9814
|
+
}
|
|
9815
|
+
)
|
|
9816
|
+
]
|
|
9817
|
+
}
|
|
9818
|
+
),
|
|
9819
|
+
q.allowOther && val === "__other__" && /* @__PURE__ */ jsx(
|
|
9820
|
+
"input",
|
|
9821
|
+
{
|
|
9822
|
+
type: "text",
|
|
9823
|
+
value: otherTexts[q.key] || "",
|
|
9824
|
+
onChange: (e) => setOtherTexts((prev) => ({
|
|
9825
|
+
...prev,
|
|
9826
|
+
[q.key]: e.target.value
|
|
9827
|
+
})),
|
|
9828
|
+
placeholder: trTest ? "Lütfen açıklayınız..." : "Please specify...",
|
|
9829
|
+
style: {
|
|
9830
|
+
width: "100%",
|
|
9831
|
+
padding: "8px 11px",
|
|
9832
|
+
borderRadius: 7,
|
|
9833
|
+
border: "1px solid #cbd5e1",
|
|
9834
|
+
background: "#ffffff",
|
|
9835
|
+
color: "#0f172a",
|
|
9836
|
+
fontSize: 13
|
|
9837
|
+
}
|
|
9838
|
+
}
|
|
9839
|
+
)
|
|
9840
|
+
] }),
|
|
9841
|
+
q.type === "multiple_choice" && /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
9842
|
+
(q.minSelections || q.maxSelections) && /* @__PURE__ */ jsxs("div", { style: { fontSize: 11, color: "#64748b" }, children: [
|
|
9843
|
+
q.minSelections ? `${trTest ? "Min:" : "Min:"} ${q.minSelections} ` : "",
|
|
9844
|
+
q.maxSelections ? `${trTest ? "Maks:" : "Max:"} ${q.maxSelections}` : ""
|
|
9845
|
+
] }),
|
|
9846
|
+
getRenderedOptions(q).map((opt) => {
|
|
9847
|
+
const arr = Array.isArray(val) ? val : [];
|
|
9848
|
+
const checked = arr.includes(opt.id);
|
|
9849
|
+
return /* @__PURE__ */ jsxs(
|
|
9850
|
+
"label",
|
|
9851
|
+
{
|
|
9852
|
+
style: {
|
|
9853
|
+
display: "flex",
|
|
9854
|
+
alignItems: "center",
|
|
9855
|
+
gap: 9,
|
|
9856
|
+
padding: "9px 12px",
|
|
9857
|
+
borderRadius: 8,
|
|
9858
|
+
border: checked ? "1.5px solid #2563eb" : "1px solid #cbd5e1",
|
|
9859
|
+
background: checked ? "#eff6ff" : "#f8fafc",
|
|
9860
|
+
color: "#0f172a",
|
|
9861
|
+
fontSize: 13,
|
|
9862
|
+
fontWeight: checked ? 700 : 500,
|
|
9863
|
+
cursor: "pointer"
|
|
9864
|
+
},
|
|
9865
|
+
children: [
|
|
9866
|
+
/* @__PURE__ */ jsx(
|
|
9867
|
+
"input",
|
|
9868
|
+
{
|
|
9869
|
+
type: "checkbox",
|
|
9870
|
+
checked,
|
|
9871
|
+
onChange: () => {
|
|
9872
|
+
const next = checked ? arr.filter((x) => x !== opt.id) : [...arr, opt.id];
|
|
9873
|
+
setAnswer(q.key, next);
|
|
9874
|
+
}
|
|
9875
|
+
}
|
|
9876
|
+
),
|
|
9877
|
+
/* @__PURE__ */ jsx("span", { children: pickTextForLocale(opt.labels, testLocale, opt.id) })
|
|
9878
|
+
]
|
|
9879
|
+
},
|
|
9880
|
+
opt.id
|
|
9881
|
+
);
|
|
9882
|
+
}),
|
|
9883
|
+
q.allowOther && (() => {
|
|
9884
|
+
const arr = Array.isArray(val) ? val : [];
|
|
9885
|
+
const checked = arr.includes("__other__");
|
|
9886
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9887
|
+
/* @__PURE__ */ jsxs(
|
|
9888
|
+
"label",
|
|
9889
|
+
{
|
|
9890
|
+
style: {
|
|
9891
|
+
display: "flex",
|
|
9892
|
+
alignItems: "center",
|
|
9893
|
+
gap: 9,
|
|
9894
|
+
padding: "9px 12px",
|
|
9895
|
+
borderRadius: 8,
|
|
9896
|
+
border: checked ? "1.5px solid #2563eb" : "1px solid #cbd5e1",
|
|
9897
|
+
background: checked ? "#eff6ff" : "#f8fafc",
|
|
9898
|
+
color: "#0f172a",
|
|
9899
|
+
fontSize: 13,
|
|
9900
|
+
fontWeight: checked ? 700 : 500,
|
|
9901
|
+
cursor: "pointer"
|
|
9902
|
+
},
|
|
9903
|
+
children: [
|
|
9904
|
+
/* @__PURE__ */ jsx(
|
|
9905
|
+
"input",
|
|
9906
|
+
{
|
|
9907
|
+
type: "checkbox",
|
|
9908
|
+
checked,
|
|
9909
|
+
onChange: () => {
|
|
9910
|
+
const next = checked ? arr.filter((x) => x !== "__other__") : [...arr, "__other__"];
|
|
9911
|
+
setAnswer(q.key, next);
|
|
9912
|
+
}
|
|
9913
|
+
}
|
|
9914
|
+
),
|
|
9915
|
+
/* @__PURE__ */ jsx("span", { children: pickTextForLocale(
|
|
9916
|
+
q.otherLabel,
|
|
9917
|
+
testLocale,
|
|
9918
|
+
trTest ? "Diğer (Belirtiniz)" : "Other (Please specify)"
|
|
9919
|
+
) })
|
|
9920
|
+
]
|
|
9921
|
+
}
|
|
9922
|
+
),
|
|
9923
|
+
checked && /* @__PURE__ */ jsx(
|
|
9924
|
+
"input",
|
|
9925
|
+
{
|
|
9926
|
+
type: "text",
|
|
9927
|
+
value: otherTexts[q.key] || "",
|
|
9928
|
+
onChange: (e) => setOtherTexts((prev) => ({
|
|
9929
|
+
...prev,
|
|
9930
|
+
[q.key]: e.target.value
|
|
9931
|
+
})),
|
|
9932
|
+
placeholder: trTest ? "Lütfen açıklayınız..." : "Please specify...",
|
|
9933
|
+
style: {
|
|
9934
|
+
width: "100%",
|
|
9935
|
+
padding: "8px 11px",
|
|
9936
|
+
borderRadius: 7,
|
|
9937
|
+
border: "1px solid #cbd5e1",
|
|
9938
|
+
background: "#ffffff",
|
|
9939
|
+
color: "#0f172a",
|
|
9940
|
+
fontSize: 13
|
|
9941
|
+
}
|
|
9942
|
+
}
|
|
9943
|
+
)
|
|
9944
|
+
] });
|
|
9945
|
+
})()
|
|
9946
|
+
] }),
|
|
9947
|
+
q.type === "dropdown" && /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
9948
|
+
/* @__PURE__ */ jsxs(
|
|
9949
|
+
"select",
|
|
9950
|
+
{
|
|
9951
|
+
value: val ?? "",
|
|
9952
|
+
onChange: (e) => setAnswer(q.key, e.target.value || null),
|
|
9953
|
+
style: {
|
|
9954
|
+
width: "100%",
|
|
9955
|
+
padding: "9px 12px",
|
|
9956
|
+
borderRadius: 8,
|
|
9957
|
+
border: "1px solid #cbd5e1",
|
|
9958
|
+
background: "#ffffff",
|
|
9959
|
+
color: "#0f172a",
|
|
9960
|
+
fontSize: 13
|
|
9961
|
+
},
|
|
9962
|
+
children: [
|
|
9963
|
+
/* @__PURE__ */ jsx("option", { value: "", children: qPlaceholder || (trTest ? "Seçiniz..." : "Select an option...") }),
|
|
9964
|
+
getRenderedOptions(q).map((opt) => /* @__PURE__ */ jsx("option", { value: opt.id, children: pickTextForLocale(opt.labels, testLocale, opt.id) }, opt.id)),
|
|
9965
|
+
q.allowOther && /* @__PURE__ */ jsx("option", { value: "__other__", children: pickTextForLocale(
|
|
9966
|
+
q.otherLabel,
|
|
9967
|
+
testLocale,
|
|
9968
|
+
trTest ? "Diğer" : "Other"
|
|
9969
|
+
) })
|
|
9970
|
+
]
|
|
9971
|
+
}
|
|
9972
|
+
),
|
|
9973
|
+
q.allowOther && val === "__other__" && /* @__PURE__ */ jsx(
|
|
9974
|
+
"input",
|
|
9975
|
+
{
|
|
9976
|
+
type: "text",
|
|
9977
|
+
value: otherTexts[q.key] || "",
|
|
9978
|
+
onChange: (e) => setOtherTexts((prev) => ({
|
|
9979
|
+
...prev,
|
|
9980
|
+
[q.key]: e.target.value
|
|
9981
|
+
})),
|
|
9982
|
+
placeholder: trTest ? "Lütfen açıklayınız..." : "Please specify...",
|
|
9983
|
+
style: {
|
|
9984
|
+
width: "100%",
|
|
9985
|
+
padding: "8px 11px",
|
|
9986
|
+
borderRadius: 7,
|
|
9987
|
+
border: "1px solid #cbd5e1",
|
|
9988
|
+
background: "#ffffff",
|
|
9989
|
+
color: "#0f172a",
|
|
9990
|
+
fontSize: 13
|
|
9991
|
+
}
|
|
9992
|
+
}
|
|
9993
|
+
)
|
|
9994
|
+
] }),
|
|
9995
|
+
q.type === "image_choice" && (() => {
|
|
9996
|
+
const isMultiImg = (q.maxSelections ?? 1) > 1;
|
|
9997
|
+
return /* @__PURE__ */ jsx(
|
|
9998
|
+
"div",
|
|
9999
|
+
{
|
|
10000
|
+
style: {
|
|
10001
|
+
display: "grid",
|
|
10002
|
+
gridTemplateColumns: device === "mobile" ? "1fr" : "repeat(auto-fill, minmax(180px, 1fr))",
|
|
10003
|
+
gap: 10
|
|
10004
|
+
},
|
|
10005
|
+
children: getRenderedOptions(q).map((opt) => {
|
|
10006
|
+
const selected = isMultiImg ? Array.isArray(val) && val.includes(opt.id) : val === opt.id;
|
|
10007
|
+
const imgUrl = opt.image ? resolveCanvasMediaUrl(opt.image) : "";
|
|
10008
|
+
return /* @__PURE__ */ jsxs(
|
|
10009
|
+
"div",
|
|
10010
|
+
{
|
|
10011
|
+
onClick: () => {
|
|
10012
|
+
if (isMultiImg) {
|
|
10013
|
+
const arr = Array.isArray(val) ? val : [];
|
|
10014
|
+
const next = selected ? arr.filter((x) => x !== opt.id) : [...arr, opt.id];
|
|
10015
|
+
setAnswer(q.key, next);
|
|
10016
|
+
} else {
|
|
10017
|
+
setAnswer(q.key, opt.id);
|
|
10018
|
+
}
|
|
10019
|
+
},
|
|
10020
|
+
style: {
|
|
10021
|
+
borderRadius: 10,
|
|
10022
|
+
overflow: "hidden",
|
|
10023
|
+
border: selected ? "2px solid #2563eb" : "1px solid #cbd5e1",
|
|
10024
|
+
background: selected ? "#eff6ff" : "#f8fafc",
|
|
10025
|
+
cursor: "pointer",
|
|
10026
|
+
transition: "all 0.15s ease"
|
|
10027
|
+
},
|
|
10028
|
+
children: [
|
|
10029
|
+
imgUrl ? /* @__PURE__ */ jsx(
|
|
10030
|
+
"img",
|
|
10031
|
+
{
|
|
10032
|
+
src: imgUrl,
|
|
10033
|
+
alt: pickTextForLocale(opt.labels, testLocale, opt.id),
|
|
10034
|
+
style: {
|
|
10035
|
+
width: "100%",
|
|
10036
|
+
height: 120,
|
|
10037
|
+
objectFit: "cover",
|
|
10038
|
+
display: "block"
|
|
10039
|
+
}
|
|
10040
|
+
}
|
|
10041
|
+
) : /* @__PURE__ */ jsx(
|
|
10042
|
+
"div",
|
|
10043
|
+
{
|
|
10044
|
+
style: {
|
|
10045
|
+
height: 100,
|
|
10046
|
+
display: "flex",
|
|
10047
|
+
alignItems: "center",
|
|
10048
|
+
justifyContent: "center",
|
|
10049
|
+
background: "#e2e8f0",
|
|
10050
|
+
color: "#64748b",
|
|
10051
|
+
fontSize: 11
|
|
10052
|
+
},
|
|
10053
|
+
children: /* @__PURE__ */ jsx(MaterialIcon, { name: "image", size: 24, color: "#94a3b8" })
|
|
10054
|
+
}
|
|
10055
|
+
),
|
|
10056
|
+
/* @__PURE__ */ jsxs(
|
|
10057
|
+
"div",
|
|
10058
|
+
{
|
|
10059
|
+
style: {
|
|
10060
|
+
padding: "9px 10px",
|
|
10061
|
+
fontSize: 12.5,
|
|
10062
|
+
fontWeight: selected ? 700 : 600,
|
|
10063
|
+
color: "#0f172a",
|
|
10064
|
+
display: "flex",
|
|
10065
|
+
alignItems: "center",
|
|
10066
|
+
justifyContent: "space-between",
|
|
10067
|
+
gap: 6
|
|
10068
|
+
},
|
|
10069
|
+
children: [
|
|
10070
|
+
/* @__PURE__ */ jsx("span", { children: pickTextForLocale(opt.labels, testLocale, opt.id) }),
|
|
10071
|
+
selected && /* @__PURE__ */ jsx(
|
|
10072
|
+
MaterialIcon,
|
|
10073
|
+
{
|
|
10074
|
+
name: "check_circle",
|
|
10075
|
+
size: 16,
|
|
10076
|
+
color: "#2563eb"
|
|
10077
|
+
}
|
|
10078
|
+
)
|
|
10079
|
+
]
|
|
10080
|
+
}
|
|
10081
|
+
)
|
|
10082
|
+
]
|
|
10083
|
+
},
|
|
10084
|
+
opt.id
|
|
10085
|
+
);
|
|
10086
|
+
})
|
|
10087
|
+
}
|
|
10088
|
+
);
|
|
10089
|
+
})(),
|
|
10090
|
+
q.type === "nps" && /* @__PURE__ */ jsxs("div", { children: [
|
|
10091
|
+
/* @__PURE__ */ jsx(
|
|
10092
|
+
"div",
|
|
10093
|
+
{
|
|
10094
|
+
style: {
|
|
10095
|
+
display: "grid",
|
|
10096
|
+
gridTemplateColumns: device === "mobile" ? "repeat(6, 1fr)" : "repeat(11, minmax(0, 1fr))",
|
|
10097
|
+
gap: 5
|
|
10098
|
+
},
|
|
10099
|
+
children: Array.from({ length: 11 }, (_, score) => {
|
|
10100
|
+
const selected = val === score;
|
|
10101
|
+
const accent = score <= 6 ? "#dc2626" : score <= 8 ? "#d97706" : "#059669";
|
|
10102
|
+
return /* @__PURE__ */ jsx(
|
|
10103
|
+
"button",
|
|
10104
|
+
{
|
|
10105
|
+
type: "button",
|
|
10106
|
+
onClick: () => setAnswer(q.key, score),
|
|
10107
|
+
style: {
|
|
10108
|
+
padding: "10px 0",
|
|
10109
|
+
borderRadius: 8,
|
|
10110
|
+
border: selected ? `2px solid ${accent}` : "1px solid #cbd5e1",
|
|
10111
|
+
background: selected ? accent : "#f8fafc",
|
|
10112
|
+
color: selected ? "#ffffff" : "#0f172a",
|
|
10113
|
+
fontSize: 13,
|
|
10114
|
+
fontWeight: 800,
|
|
10115
|
+
cursor: "pointer"
|
|
10116
|
+
},
|
|
10117
|
+
children: score
|
|
10118
|
+
},
|
|
10119
|
+
score
|
|
10120
|
+
);
|
|
10121
|
+
})
|
|
10122
|
+
}
|
|
10123
|
+
),
|
|
10124
|
+
/* @__PURE__ */ jsxs(
|
|
10125
|
+
"div",
|
|
10126
|
+
{
|
|
10127
|
+
style: {
|
|
10128
|
+
display: "flex",
|
|
10129
|
+
justifyContent: "space-between",
|
|
10130
|
+
fontSize: 11,
|
|
10131
|
+
color: "#64748b",
|
|
10132
|
+
marginTop: 6
|
|
10133
|
+
},
|
|
10134
|
+
children: [
|
|
10135
|
+
/* @__PURE__ */ jsx("span", { children: pickTextForLocale(
|
|
10136
|
+
q.lowLabel,
|
|
10137
|
+
testLocale,
|
|
10138
|
+
trTest ? "0 — Hiç Olası Değil" : "0 — Not likely"
|
|
10139
|
+
) }),
|
|
10140
|
+
/* @__PURE__ */ jsx("span", { children: pickTextForLocale(
|
|
10141
|
+
q.highLabel,
|
|
10142
|
+
testLocale,
|
|
10143
|
+
trTest ? "10 — Kesinlikle Öneririm" : "10 — Extremely likely"
|
|
10144
|
+
) })
|
|
10145
|
+
]
|
|
10146
|
+
}
|
|
10147
|
+
)
|
|
10148
|
+
] }),
|
|
10149
|
+
q.type === "star_rating" && (() => {
|
|
10150
|
+
const maxStars = Math.min(10, Math.max(3, Number(q.maxStars) || 5));
|
|
10151
|
+
const activeRating = hoverStar[q.key] || Number(val) || 0;
|
|
10152
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6, flexWrap: "wrap" }, children: [
|
|
10153
|
+
Array.from({ length: maxStars }, (_, idx) => {
|
|
10154
|
+
const starVal = idx + 1;
|
|
10155
|
+
const lit = starVal <= activeRating;
|
|
10156
|
+
return /* @__PURE__ */ jsx(
|
|
10157
|
+
"button",
|
|
10158
|
+
{
|
|
10159
|
+
type: "button",
|
|
10160
|
+
onMouseEnter: () => setHoverStar((p) => ({ ...p, [q.key]: starVal })),
|
|
10161
|
+
onMouseLeave: () => setHoverStar((p) => ({ ...p, [q.key]: 0 })),
|
|
10162
|
+
onClick: () => setAnswer(q.key, starVal),
|
|
10163
|
+
style: {
|
|
10164
|
+
border: "none",
|
|
10165
|
+
background: "transparent",
|
|
10166
|
+
fontSize: 28,
|
|
10167
|
+
lineHeight: 1,
|
|
10168
|
+
color: lit ? "#f59e0b" : "#cbd5e1",
|
|
10169
|
+
cursor: "pointer",
|
|
10170
|
+
padding: "2px 4px"
|
|
10171
|
+
},
|
|
10172
|
+
children: "★"
|
|
10173
|
+
},
|
|
10174
|
+
starVal
|
|
10175
|
+
);
|
|
10176
|
+
}),
|
|
10177
|
+
val ? /* @__PURE__ */ jsxs(
|
|
10178
|
+
"span",
|
|
10179
|
+
{
|
|
10180
|
+
style: {
|
|
10181
|
+
marginLeft: 6,
|
|
10182
|
+
fontSize: 12,
|
|
10183
|
+
fontWeight: 700,
|
|
10184
|
+
padding: "2px 8px",
|
|
10185
|
+
borderRadius: 10,
|
|
10186
|
+
background: "#fef3c7",
|
|
10187
|
+
color: "#92400e"
|
|
10188
|
+
},
|
|
10189
|
+
children: [
|
|
10190
|
+
val,
|
|
10191
|
+
" / ",
|
|
10192
|
+
maxStars
|
|
10193
|
+
]
|
|
10194
|
+
}
|
|
10195
|
+
) : null
|
|
10196
|
+
] });
|
|
10197
|
+
})(),
|
|
10198
|
+
q.type === "likert_scale" && (() => {
|
|
10199
|
+
const minS = Number(q.scaleMin) || 1;
|
|
10200
|
+
const maxS = Math.max(minS + 1, Number(q.scaleMax) || 5);
|
|
10201
|
+
const points = [];
|
|
10202
|
+
for (let s = minS; s <= maxS; s++) points.push(s);
|
|
10203
|
+
const hasCustomScaleLabels = Boolean(q.scaleLabels) && points.some(
|
|
10204
|
+
(pt) => pickTextForLocale(
|
|
10205
|
+
q.scaleLabels?.[String(pt)],
|
|
10206
|
+
testLocale,
|
|
10207
|
+
""
|
|
10208
|
+
).trim() !== ""
|
|
10209
|
+
);
|
|
10210
|
+
if (hasCustomScaleLabels) {
|
|
10211
|
+
return /* @__PURE__ */ jsx(
|
|
10212
|
+
"div",
|
|
10213
|
+
{
|
|
10214
|
+
style: {
|
|
10215
|
+
display: "grid",
|
|
10216
|
+
gridTemplateColumns: device === "mobile" ? "1fr" : `repeat(${points.length}, minmax(0, 1fr))`,
|
|
10217
|
+
gap: 8
|
|
10218
|
+
},
|
|
10219
|
+
children: points.map((pt) => {
|
|
10220
|
+
const selected = val === pt;
|
|
10221
|
+
const ptLabel = pickTextForLocale(
|
|
10222
|
+
q.scaleLabels?.[String(pt)],
|
|
10223
|
+
testLocale,
|
|
10224
|
+
""
|
|
10225
|
+
);
|
|
10226
|
+
return /* @__PURE__ */ jsxs(
|
|
10227
|
+
"button",
|
|
10228
|
+
{
|
|
10229
|
+
type: "button",
|
|
10230
|
+
onClick: () => setAnswer(q.key, pt),
|
|
10231
|
+
style: {
|
|
10232
|
+
padding: device === "mobile" ? "10px 12px" : "11px 8px",
|
|
10233
|
+
borderRadius: 10,
|
|
10234
|
+
border: selected ? "2px solid #2563eb" : "1px solid #cbd5e1",
|
|
10235
|
+
background: selected ? "#eff6ff" : "#f8fafc",
|
|
10236
|
+
color: "#0f172a",
|
|
10237
|
+
cursor: "pointer",
|
|
10238
|
+
display: "flex",
|
|
10239
|
+
flexDirection: device === "mobile" ? "row" : "column",
|
|
10240
|
+
alignItems: "center",
|
|
10241
|
+
justifyContent: device === "mobile" ? "flex-start" : "center",
|
|
10242
|
+
gap: device === "mobile" ? 10 : 6,
|
|
10243
|
+
textAlign: device === "mobile" ? "left" : "center"
|
|
10244
|
+
},
|
|
10245
|
+
children: [
|
|
10246
|
+
/* @__PURE__ */ jsx(
|
|
10247
|
+
"span",
|
|
10248
|
+
{
|
|
10249
|
+
style: {
|
|
10250
|
+
width: 26,
|
|
10251
|
+
height: 26,
|
|
10252
|
+
borderRadius: "50%",
|
|
10253
|
+
background: selected ? "#2563eb" : "#e2e8f0",
|
|
10254
|
+
color: selected ? "#ffffff" : "#1e293b",
|
|
10255
|
+
fontSize: 12.5,
|
|
10256
|
+
fontWeight: 800,
|
|
10257
|
+
display: "inline-flex",
|
|
10258
|
+
alignItems: "center",
|
|
10259
|
+
justifyContent: "center",
|
|
10260
|
+
flexShrink: 0
|
|
10261
|
+
},
|
|
10262
|
+
children: pt
|
|
10263
|
+
}
|
|
10264
|
+
),
|
|
10265
|
+
ptLabel && /* @__PURE__ */ jsx(
|
|
10266
|
+
"span",
|
|
10267
|
+
{
|
|
10268
|
+
style: {
|
|
10269
|
+
fontSize: 11.5,
|
|
10270
|
+
fontWeight: selected ? 700 : 600,
|
|
10271
|
+
lineHeight: 1.3,
|
|
10272
|
+
color: selected ? "#1e3a8a" : "#334155"
|
|
10273
|
+
},
|
|
10274
|
+
children: ptLabel
|
|
10275
|
+
}
|
|
10276
|
+
)
|
|
10277
|
+
]
|
|
10278
|
+
},
|
|
10279
|
+
pt
|
|
10280
|
+
);
|
|
10281
|
+
})
|
|
10282
|
+
}
|
|
10283
|
+
);
|
|
10284
|
+
}
|
|
10285
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
10286
|
+
/* @__PURE__ */ jsx(
|
|
10287
|
+
"div",
|
|
10288
|
+
{
|
|
10289
|
+
style: {
|
|
10290
|
+
display: "grid",
|
|
10291
|
+
gridTemplateColumns: `repeat(${points.length}, minmax(0, 1fr))`,
|
|
10292
|
+
gap: 6
|
|
10293
|
+
},
|
|
10294
|
+
children: points.map((pt) => {
|
|
10295
|
+
const selected = val === pt;
|
|
10296
|
+
return /* @__PURE__ */ jsx(
|
|
10297
|
+
"button",
|
|
10298
|
+
{
|
|
10299
|
+
type: "button",
|
|
10300
|
+
onClick: () => setAnswer(q.key, pt),
|
|
10301
|
+
style: {
|
|
10302
|
+
padding: "10px 0",
|
|
10303
|
+
borderRadius: 8,
|
|
10304
|
+
border: selected ? "2px solid #2563eb" : "1px solid #cbd5e1",
|
|
10305
|
+
background: selected ? "#2563eb" : "#f8fafc",
|
|
10306
|
+
color: selected ? "#ffffff" : "#0f172a",
|
|
10307
|
+
fontSize: 13,
|
|
10308
|
+
fontWeight: 700,
|
|
10309
|
+
cursor: "pointer"
|
|
10310
|
+
},
|
|
10311
|
+
children: pt
|
|
10312
|
+
},
|
|
10313
|
+
pt
|
|
10314
|
+
);
|
|
10315
|
+
})
|
|
10316
|
+
}
|
|
10317
|
+
),
|
|
10318
|
+
/* @__PURE__ */ jsxs(
|
|
10319
|
+
"div",
|
|
10320
|
+
{
|
|
10321
|
+
style: {
|
|
10322
|
+
display: "flex",
|
|
10323
|
+
justifyContent: "space-between",
|
|
10324
|
+
fontSize: 11,
|
|
10325
|
+
color: "#64748b",
|
|
10326
|
+
marginTop: 6
|
|
10327
|
+
},
|
|
10328
|
+
children: [
|
|
10329
|
+
/* @__PURE__ */ jsx("span", { children: pickTextForLocale(q.lowLabel, testLocale, "") }),
|
|
10330
|
+
/* @__PURE__ */ jsx("span", { children: pickTextForLocale(q.highLabel, testLocale, "") })
|
|
10331
|
+
]
|
|
10332
|
+
}
|
|
10333
|
+
)
|
|
10334
|
+
] });
|
|
10335
|
+
})(),
|
|
10336
|
+
q.type === "matrix_single" && (() => {
|
|
10337
|
+
const mRows = Array.isArray(q.matrixRows) ? q.matrixRows : [];
|
|
10338
|
+
const mCols = Array.isArray(q.matrixColumns) ? q.matrixColumns : [];
|
|
10339
|
+
const matrixAns = val && typeof val === "object" && !Array.isArray(val) ? val : {};
|
|
10340
|
+
return /* @__PURE__ */ jsx("div", { style: { overflowX: "auto" }, children: /* @__PURE__ */ jsxs(
|
|
10341
|
+
"table",
|
|
10342
|
+
{
|
|
10343
|
+
style: {
|
|
10344
|
+
width: "100%",
|
|
10345
|
+
borderCollapse: "collapse",
|
|
10346
|
+
fontSize: 12.5
|
|
10347
|
+
},
|
|
10348
|
+
children: [
|
|
10349
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
10350
|
+
/* @__PURE__ */ jsx(
|
|
10351
|
+
"th",
|
|
10352
|
+
{
|
|
10353
|
+
style: {
|
|
10354
|
+
textAlign: "left",
|
|
10355
|
+
padding: "8px 10px",
|
|
10356
|
+
borderBottom: "1px solid #cbd5e1",
|
|
10357
|
+
color: "#475569"
|
|
10358
|
+
}
|
|
10359
|
+
}
|
|
10360
|
+
),
|
|
10361
|
+
mCols.map((col) => /* @__PURE__ */ jsx(
|
|
10362
|
+
"th",
|
|
10363
|
+
{
|
|
10364
|
+
style: {
|
|
10365
|
+
textAlign: "center",
|
|
10366
|
+
padding: "8px 10px",
|
|
10367
|
+
borderBottom: "1px solid #cbd5e1",
|
|
10368
|
+
color: "#334155",
|
|
10369
|
+
fontWeight: 700
|
|
10370
|
+
},
|
|
10371
|
+
children: pickTextForLocale(col.labels, testLocale, col.id)
|
|
10372
|
+
},
|
|
10373
|
+
col.id
|
|
10374
|
+
))
|
|
10375
|
+
] }) }),
|
|
10376
|
+
/* @__PURE__ */ jsx("tbody", { children: mRows.map((row, rIdx) => /* @__PURE__ */ jsxs(
|
|
10377
|
+
"tr",
|
|
10378
|
+
{
|
|
10379
|
+
style: {
|
|
10380
|
+
background: rIdx % 2 === 0 ? "#f8fafc" : "#ffffff"
|
|
10381
|
+
},
|
|
10382
|
+
children: [
|
|
10383
|
+
/* @__PURE__ */ jsx(
|
|
10384
|
+
"td",
|
|
10385
|
+
{
|
|
10386
|
+
style: {
|
|
10387
|
+
padding: "9px 10px",
|
|
10388
|
+
fontWeight: 600,
|
|
10389
|
+
color: "#0f172a",
|
|
10390
|
+
borderBottom: "1px solid #f1f5f9"
|
|
10391
|
+
},
|
|
10392
|
+
children: pickTextForLocale(row.labels, testLocale, row.id)
|
|
10393
|
+
}
|
|
10394
|
+
),
|
|
10395
|
+
mCols.map((col) => /* @__PURE__ */ jsx(
|
|
10396
|
+
"td",
|
|
10397
|
+
{
|
|
10398
|
+
style: {
|
|
10399
|
+
textAlign: "center",
|
|
10400
|
+
padding: "9px 10px",
|
|
10401
|
+
borderBottom: "1px solid #f1f5f9"
|
|
10402
|
+
},
|
|
10403
|
+
children: /* @__PURE__ */ jsx(
|
|
10404
|
+
"input",
|
|
10405
|
+
{
|
|
10406
|
+
type: "radio",
|
|
10407
|
+
name: `mtx-${q.key}-${row.id}`,
|
|
10408
|
+
checked: matrixAns[row.id] === col.id,
|
|
10409
|
+
onChange: () => setAnswer(q.key, {
|
|
10410
|
+
...matrixAns,
|
|
10411
|
+
[row.id]: col.id
|
|
10412
|
+
}),
|
|
10413
|
+
style: { cursor: "pointer" }
|
|
10414
|
+
}
|
|
10415
|
+
)
|
|
10416
|
+
},
|
|
10417
|
+
col.id
|
|
10418
|
+
))
|
|
10419
|
+
]
|
|
10420
|
+
},
|
|
10421
|
+
row.id
|
|
10422
|
+
)) })
|
|
10423
|
+
]
|
|
10424
|
+
}
|
|
10425
|
+
) });
|
|
10426
|
+
})(),
|
|
10427
|
+
q.type === "ranking" && (() => {
|
|
10428
|
+
const optsMap = new Map(
|
|
10429
|
+
(q.options || []).map((o) => [o.id, o])
|
|
10430
|
+
);
|
|
10431
|
+
const orderedIds = Array.isArray(val) && val.length > 0 ? val.filter((id) => optsMap.has(id)) : (q.options || []).map((o) => o.id);
|
|
10432
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
10433
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: 11, color: "#64748b" }, children: trTest ? "Öncelik sırasını değiştirmek için sürükleyin veya ↑/↓ oklarını kullanın:" : "Drag items or use ↑/↓ buttons to set priority order:" }),
|
|
10434
|
+
orderedIds.map((optId, idx) => {
|
|
10435
|
+
const opt = optsMap.get(optId);
|
|
10436
|
+
if (!opt) return null;
|
|
10437
|
+
return /* @__PURE__ */ jsxs(
|
|
10438
|
+
"div",
|
|
10439
|
+
{
|
|
10440
|
+
draggable: true,
|
|
10441
|
+
onDragStart: () => {
|
|
10442
|
+
rankDragRef.current = { qKey: q.key, index: idx };
|
|
10443
|
+
},
|
|
10444
|
+
onDragOver: (e) => {
|
|
10445
|
+
if (rankDragRef.current?.qKey === q.key) {
|
|
10446
|
+
e.preventDefault();
|
|
10447
|
+
}
|
|
10448
|
+
},
|
|
10449
|
+
onDrop: (e) => {
|
|
10450
|
+
e.preventDefault();
|
|
10451
|
+
if (rankDragRef.current?.qKey === q.key) {
|
|
10452
|
+
moveRankOption(q.key, rankDragRef.current.index, idx);
|
|
10453
|
+
rankDragRef.current = null;
|
|
10454
|
+
}
|
|
10455
|
+
},
|
|
10456
|
+
style: {
|
|
10457
|
+
display: "flex",
|
|
10458
|
+
alignItems: "center",
|
|
10459
|
+
justifyContent: "space-between",
|
|
10460
|
+
padding: "8px 12px",
|
|
10461
|
+
borderRadius: 8,
|
|
10462
|
+
border: "1px solid #cbd5e1",
|
|
10463
|
+
background: "#f8fafc",
|
|
10464
|
+
cursor: "grab"
|
|
10465
|
+
},
|
|
10466
|
+
children: [
|
|
10467
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
|
|
10468
|
+
/* @__PURE__ */ jsxs(
|
|
10469
|
+
"span",
|
|
10470
|
+
{
|
|
10471
|
+
style: {
|
|
10472
|
+
width: 24,
|
|
10473
|
+
height: 24,
|
|
10474
|
+
borderRadius: "50%",
|
|
10475
|
+
background: idx === 0 ? "#2563eb" : "#e2e8f0",
|
|
10476
|
+
color: idx === 0 ? "#ffffff" : "#334155",
|
|
10477
|
+
fontSize: 11.5,
|
|
10478
|
+
fontWeight: 800,
|
|
10479
|
+
display: "inline-flex",
|
|
10480
|
+
alignItems: "center",
|
|
10481
|
+
justifyContent: "center"
|
|
10482
|
+
},
|
|
10483
|
+
children: [
|
|
10484
|
+
"#",
|
|
10485
|
+
idx + 1
|
|
10486
|
+
]
|
|
10487
|
+
}
|
|
10488
|
+
),
|
|
10489
|
+
/* @__PURE__ */ jsx(
|
|
10490
|
+
"span",
|
|
10491
|
+
{
|
|
10492
|
+
style: {
|
|
10493
|
+
fontSize: 13,
|
|
10494
|
+
fontWeight: 600,
|
|
10495
|
+
color: "#0f172a"
|
|
10496
|
+
},
|
|
10497
|
+
children: pickTextForLocale(opt.labels, testLocale, opt.id)
|
|
10498
|
+
}
|
|
10499
|
+
)
|
|
10500
|
+
] }),
|
|
10501
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 4 }, children: [
|
|
10502
|
+
/* @__PURE__ */ jsx(
|
|
10503
|
+
"button",
|
|
10504
|
+
{
|
|
10505
|
+
type: "button",
|
|
10506
|
+
disabled: idx === 0,
|
|
10507
|
+
onClick: () => moveRankOption(q.key, idx, idx - 1),
|
|
10508
|
+
style: {
|
|
10509
|
+
padding: "3px 7px",
|
|
10510
|
+
borderRadius: 5,
|
|
10511
|
+
border: "1px solid #cbd5e1",
|
|
10512
|
+
background: "#ffffff",
|
|
10513
|
+
color: idx === 0 ? "#cbd5e1" : "#334155",
|
|
10514
|
+
cursor: idx === 0 ? "default" : "pointer",
|
|
10515
|
+
fontSize: 12
|
|
10516
|
+
},
|
|
10517
|
+
children: "↑"
|
|
10518
|
+
}
|
|
10519
|
+
),
|
|
10520
|
+
/* @__PURE__ */ jsx(
|
|
10521
|
+
"button",
|
|
10522
|
+
{
|
|
10523
|
+
type: "button",
|
|
10524
|
+
disabled: idx === orderedIds.length - 1,
|
|
10525
|
+
onClick: () => moveRankOption(q.key, idx, idx + 1),
|
|
10526
|
+
style: {
|
|
10527
|
+
padding: "3px 7px",
|
|
10528
|
+
borderRadius: 5,
|
|
10529
|
+
border: "1px solid #cbd5e1",
|
|
10530
|
+
background: "#ffffff",
|
|
10531
|
+
color: idx === orderedIds.length - 1 ? "#cbd5e1" : "#334155",
|
|
10532
|
+
cursor: idx === orderedIds.length - 1 ? "default" : "pointer",
|
|
10533
|
+
fontSize: 12
|
|
10534
|
+
},
|
|
10535
|
+
children: "↓"
|
|
10536
|
+
}
|
|
10537
|
+
)
|
|
10538
|
+
] })
|
|
10539
|
+
]
|
|
10540
|
+
},
|
|
10541
|
+
optId
|
|
10542
|
+
);
|
|
10543
|
+
})
|
|
10544
|
+
] });
|
|
10545
|
+
})(),
|
|
10546
|
+
q.type === "short_text" && /* @__PURE__ */ jsx(
|
|
10547
|
+
"input",
|
|
10548
|
+
{
|
|
10549
|
+
type: "text",
|
|
10550
|
+
value: val ?? "",
|
|
10551
|
+
onChange: (e) => setAnswer(q.key, e.target.value),
|
|
10552
|
+
placeholder: qPlaceholder || (trTest ? "Yanıtınızı yazınız..." : "Type your answer..."),
|
|
10553
|
+
style: {
|
|
10554
|
+
width: "100%",
|
|
10555
|
+
padding: "9px 12px",
|
|
10556
|
+
borderRadius: 8,
|
|
10557
|
+
border: "1px solid #cbd5e1",
|
|
10558
|
+
background: "#ffffff",
|
|
10559
|
+
color: "#0f172a",
|
|
10560
|
+
fontSize: 13
|
|
10561
|
+
}
|
|
10562
|
+
}
|
|
10563
|
+
),
|
|
10564
|
+
q.type === "long_text" && /* @__PURE__ */ jsx(
|
|
10565
|
+
"textarea",
|
|
10566
|
+
{
|
|
10567
|
+
rows: 3,
|
|
10568
|
+
value: val ?? "",
|
|
10569
|
+
onChange: (e) => setAnswer(q.key, e.target.value),
|
|
10570
|
+
placeholder: qPlaceholder || (trTest ? "Detaylı görüşlerinizi yazınız..." : "Share your detailed feedback..."),
|
|
10571
|
+
style: {
|
|
10572
|
+
width: "100%",
|
|
10573
|
+
padding: "9px 12px",
|
|
10574
|
+
borderRadius: 8,
|
|
10575
|
+
border: "1px solid #cbd5e1",
|
|
10576
|
+
background: "#ffffff",
|
|
10577
|
+
color: "#0f172a",
|
|
10578
|
+
fontSize: 13,
|
|
10579
|
+
resize: "vertical"
|
|
10580
|
+
}
|
|
10581
|
+
}
|
|
10582
|
+
),
|
|
10583
|
+
q.type === "consent" && /* @__PURE__ */ jsxs(
|
|
10584
|
+
"label",
|
|
10585
|
+
{
|
|
10586
|
+
style: {
|
|
10587
|
+
display: "flex",
|
|
10588
|
+
alignItems: "flex-start",
|
|
10589
|
+
gap: 10,
|
|
10590
|
+
cursor: "pointer",
|
|
10591
|
+
fontSize: 13,
|
|
10592
|
+
color: "#0f172a"
|
|
10593
|
+
},
|
|
10594
|
+
children: [
|
|
10595
|
+
/* @__PURE__ */ jsx(
|
|
10596
|
+
"input",
|
|
10597
|
+
{
|
|
10598
|
+
type: "checkbox",
|
|
10599
|
+
checked: Boolean(val),
|
|
10600
|
+
onChange: (e) => setAnswer(q.key, e.target.checked),
|
|
10601
|
+
style: { marginTop: 3 }
|
|
10602
|
+
}
|
|
10603
|
+
),
|
|
10604
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
10605
|
+
/* @__PURE__ */ jsxs("div", { style: { fontWeight: 700 }, children: [
|
|
10606
|
+
qTitle,
|
|
10607
|
+
" ",
|
|
10608
|
+
q.required !== false && /* @__PURE__ */ jsx("span", { style: { color: "#dc2626" }, children: "*" })
|
|
10609
|
+
] }),
|
|
10610
|
+
qDesc && /* @__PURE__ */ jsx("div", { style: { fontSize: 12, color: "#64748b", marginTop: 2 }, children: qDesc })
|
|
10611
|
+
] })
|
|
10612
|
+
]
|
|
10613
|
+
}
|
|
10614
|
+
),
|
|
10615
|
+
hasErr && /* @__PURE__ */ jsx(
|
|
10616
|
+
"div",
|
|
10617
|
+
{
|
|
10618
|
+
style: {
|
|
10619
|
+
marginTop: 8,
|
|
10620
|
+
display: "flex",
|
|
10621
|
+
flexDirection: "column",
|
|
10622
|
+
gap: 2
|
|
10623
|
+
},
|
|
10624
|
+
children: qErrs.map((errText, eIdx) => /* @__PURE__ */ jsxs(
|
|
10625
|
+
"span",
|
|
10626
|
+
{
|
|
10627
|
+
style: { fontSize: 11.5, fontWeight: 600, color: "#dc2626" },
|
|
10628
|
+
children: [
|
|
10629
|
+
"• ",
|
|
10630
|
+
errText
|
|
10631
|
+
]
|
|
10632
|
+
},
|
|
10633
|
+
eIdx
|
|
10634
|
+
))
|
|
10635
|
+
}
|
|
10636
|
+
)
|
|
10637
|
+
]
|
|
10638
|
+
},
|
|
10639
|
+
q.key
|
|
10640
|
+
);
|
|
10641
|
+
}) }),
|
|
10642
|
+
isLastStep && draft.useRecaptcha && /* @__PURE__ */ jsx("div", { style: { marginTop: 18 }, children: /* @__PURE__ */ jsxs(
|
|
10643
|
+
"label",
|
|
10644
|
+
{
|
|
10645
|
+
style: {
|
|
10646
|
+
display: "inline-flex",
|
|
10647
|
+
alignItems: "center",
|
|
10648
|
+
gap: 10,
|
|
10649
|
+
padding: "10px 14px",
|
|
10650
|
+
borderRadius: 6,
|
|
10651
|
+
border: "1px solid #cbd5e1",
|
|
10652
|
+
background: "#f8fafc",
|
|
10653
|
+
cursor: "pointer",
|
|
10654
|
+
fontSize: 12.5,
|
|
10655
|
+
fontWeight: 600,
|
|
10656
|
+
color: "#0f172a"
|
|
10657
|
+
},
|
|
10658
|
+
children: [
|
|
10659
|
+
/* @__PURE__ */ jsx(
|
|
10660
|
+
"input",
|
|
10661
|
+
{
|
|
10662
|
+
type: "checkbox",
|
|
10663
|
+
checked: mockCaptchaChecked,
|
|
10664
|
+
onChange: (e) => {
|
|
10665
|
+
setMockCaptchaChecked(e.target.checked);
|
|
10666
|
+
if (generalError) setGeneralError("");
|
|
10667
|
+
}
|
|
10668
|
+
}
|
|
10669
|
+
),
|
|
10670
|
+
/* @__PURE__ */ jsx("span", { children: trTest ? "Ben robot değilim (reCAPTCHA v2 Simülasyonu)" : "I'm not a robot (reCAPTCHA v2 Simulation)" })
|
|
10671
|
+
]
|
|
10672
|
+
}
|
|
10673
|
+
) }),
|
|
10674
|
+
/* @__PURE__ */ jsxs(
|
|
10675
|
+
"div",
|
|
10676
|
+
{
|
|
10677
|
+
style: {
|
|
10678
|
+
marginTop: 22,
|
|
10679
|
+
paddingTop: 16,
|
|
10680
|
+
borderTop: "1px solid #e2e8f0",
|
|
10681
|
+
display: "flex",
|
|
10682
|
+
alignItems: "center",
|
|
10683
|
+
justifyContent: "space-between",
|
|
10684
|
+
gap: 10
|
|
10685
|
+
},
|
|
10686
|
+
children: [
|
|
10687
|
+
/* @__PURE__ */ jsx("div", { children: isMultiStep && safeStepIdx > 0 && draft.allowBackNavigation !== false && /* @__PURE__ */ jsxs(
|
|
10688
|
+
"button",
|
|
10689
|
+
{
|
|
10690
|
+
type: "button",
|
|
10691
|
+
onClick: () => {
|
|
10692
|
+
setErrors({});
|
|
10693
|
+
setGeneralError("");
|
|
10694
|
+
setCurrentStepIdx(Math.max(0, safeStepIdx - 1));
|
|
10695
|
+
},
|
|
10696
|
+
style: {
|
|
10697
|
+
padding: "9px 16px",
|
|
10698
|
+
borderRadius: 8,
|
|
10699
|
+
border: "1px solid #cbd5e1",
|
|
10700
|
+
background: "#ffffff",
|
|
10701
|
+
color: "#334155",
|
|
10702
|
+
fontSize: 13,
|
|
10703
|
+
fontWeight: 700,
|
|
10704
|
+
cursor: "pointer"
|
|
10705
|
+
},
|
|
10706
|
+
children: [
|
|
10707
|
+
"← ",
|
|
10708
|
+
trTest ? "Önceki Adım" : "Previous"
|
|
10709
|
+
]
|
|
10710
|
+
}
|
|
10711
|
+
) }),
|
|
10712
|
+
/* @__PURE__ */ jsx(
|
|
10713
|
+
"button",
|
|
10714
|
+
{
|
|
10715
|
+
type: "submit",
|
|
10716
|
+
style: {
|
|
10717
|
+
padding: "10px 22px",
|
|
10718
|
+
borderRadius: 8,
|
|
10719
|
+
border: "none",
|
|
10720
|
+
background: "#2563eb",
|
|
10721
|
+
color: "#ffffff",
|
|
10722
|
+
fontSize: 13.5,
|
|
10723
|
+
fontWeight: 700,
|
|
10724
|
+
cursor: "pointer",
|
|
10725
|
+
boxShadow: "0 4px 12px rgba(37, 99, 235, 0.25)"
|
|
10726
|
+
},
|
|
10727
|
+
children: isLastStep ? submitBtnText : `${trTest ? "Sonraki Adım" : "Next Step"} →`
|
|
10728
|
+
}
|
|
10729
|
+
)
|
|
10730
|
+
]
|
|
10731
|
+
}
|
|
10732
|
+
)
|
|
10733
|
+
] })
|
|
10734
|
+
)
|
|
10735
|
+
]
|
|
10736
|
+
}
|
|
10737
|
+
)
|
|
10738
|
+
]
|
|
10739
|
+
}
|
|
10740
|
+
),
|
|
10741
|
+
showInspector && /* @__PURE__ */ jsxs(
|
|
10742
|
+
"div",
|
|
10743
|
+
{
|
|
10744
|
+
style: {
|
|
10745
|
+
background: "#ffffff",
|
|
10746
|
+
borderLeft: "1px solid #cbd5e1",
|
|
10747
|
+
overflowY: "auto",
|
|
10748
|
+
padding: 16,
|
|
10749
|
+
display: "flex",
|
|
10750
|
+
flexDirection: "column",
|
|
10751
|
+
gap: 16
|
|
10752
|
+
},
|
|
10753
|
+
children: [
|
|
10754
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
10755
|
+
/* @__PURE__ */ jsxs(
|
|
10756
|
+
"div",
|
|
10757
|
+
{
|
|
10758
|
+
style: {
|
|
10759
|
+
fontSize: 12,
|
|
10760
|
+
fontWeight: 800,
|
|
10761
|
+
color: "#0f172a",
|
|
10762
|
+
marginBottom: 8,
|
|
10763
|
+
display: "flex",
|
|
10764
|
+
alignItems: "center",
|
|
10765
|
+
gap: 6
|
|
10766
|
+
},
|
|
10767
|
+
children: [
|
|
10768
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "call_split", size: 16, color: "#2563eb" }),
|
|
10769
|
+
/* @__PURE__ */ jsx("span", { children: trUi ? "Koşullu Akış & Görünürlük Durumu" : "Skip Logic & Question Visibility" })
|
|
10770
|
+
]
|
|
10771
|
+
}
|
|
10772
|
+
),
|
|
10773
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: (draft.questions || []).map((q, idx) => {
|
|
10774
|
+
const vis = isQuestionVisibleInDraft(q, draft, answers);
|
|
10775
|
+
const hasRules = q.conditions && Array.isArray(q.conditions.rules) && q.conditions.rules.length > 0;
|
|
10776
|
+
return /* @__PURE__ */ jsxs(
|
|
10777
|
+
"div",
|
|
10778
|
+
{
|
|
10779
|
+
style: {
|
|
10780
|
+
padding: "8px 10px",
|
|
10781
|
+
borderRadius: 8,
|
|
10782
|
+
border: vis ? "1px solid #bbf7d0" : "1px solid #fde68a",
|
|
10783
|
+
background: vis ? "#f0fdf4" : "#fffbeb",
|
|
10784
|
+
fontSize: 11
|
|
10785
|
+
},
|
|
10786
|
+
children: [
|
|
10787
|
+
/* @__PURE__ */ jsxs(
|
|
10788
|
+
"div",
|
|
10789
|
+
{
|
|
10790
|
+
style: {
|
|
10791
|
+
display: "flex",
|
|
10792
|
+
alignItems: "center",
|
|
10793
|
+
justifyContent: "space-between",
|
|
10794
|
+
gap: 6
|
|
10795
|
+
},
|
|
10796
|
+
children: [
|
|
10797
|
+
/* @__PURE__ */ jsxs("code", { style: { fontWeight: 700, color: "#0f172a" }, children: [
|
|
10798
|
+
idx + 1,
|
|
10799
|
+
". ",
|
|
10800
|
+
q.key
|
|
10801
|
+
] }),
|
|
10802
|
+
/* @__PURE__ */ jsx(
|
|
10803
|
+
"span",
|
|
10804
|
+
{
|
|
10805
|
+
style: {
|
|
10806
|
+
fontSize: 10,
|
|
10807
|
+
fontWeight: 800,
|
|
10808
|
+
padding: "1px 6px",
|
|
10809
|
+
borderRadius: 8,
|
|
10810
|
+
background: vis ? "#dcfce7" : "#fef3c7",
|
|
10811
|
+
color: vis ? "#166534" : "#92400e"
|
|
10812
|
+
},
|
|
10813
|
+
children: vis ? trUi ? "Görünür" : "Visible" : trUi ? "Gizli (Koşul)" : "Hidden"
|
|
10814
|
+
}
|
|
10815
|
+
)
|
|
10816
|
+
]
|
|
10817
|
+
}
|
|
10818
|
+
),
|
|
10819
|
+
hasRules && /* @__PURE__ */ jsx("div", { style: { marginTop: 4, color: "#64748b", fontSize: 10.5 }, children: q.conditions.rules.map((r, rI) => /* @__PURE__ */ jsxs("div", { children: [
|
|
10820
|
+
"↳ ",
|
|
10821
|
+
/* @__PURE__ */ jsx("code", { children: r.questionKey }),
|
|
10822
|
+
" ",
|
|
10823
|
+
r.operator,
|
|
10824
|
+
" ",
|
|
10825
|
+
r.value !== void 0 && r.value !== "" ? /* @__PURE__ */ jsx("code", { children: String(r.value) }) : null
|
|
10826
|
+
] }, rI)) })
|
|
10827
|
+
]
|
|
10828
|
+
},
|
|
10829
|
+
`insp-${q.key || idx}`
|
|
10830
|
+
);
|
|
10831
|
+
}) })
|
|
10832
|
+
] }),
|
|
10833
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
10834
|
+
/* @__PURE__ */ jsxs(
|
|
10835
|
+
"div",
|
|
10836
|
+
{
|
|
10837
|
+
style: {
|
|
10838
|
+
fontSize: 12,
|
|
10839
|
+
fontWeight: 800,
|
|
10840
|
+
color: "#0f172a",
|
|
10841
|
+
marginBottom: 8,
|
|
10842
|
+
display: "flex",
|
|
10843
|
+
alignItems: "center",
|
|
10844
|
+
gap: 6
|
|
10845
|
+
},
|
|
10846
|
+
children: [
|
|
10847
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "data_object", size: 16, color: "#059669" }),
|
|
10848
|
+
/* @__PURE__ */ jsx("span", { children: trUi ? "Canlı Yanıt Paketi (JSON)" : "Live Submission Payload" })
|
|
10849
|
+
]
|
|
10850
|
+
}
|
|
10851
|
+
),
|
|
10852
|
+
/* @__PURE__ */ jsx(
|
|
10853
|
+
"pre",
|
|
10854
|
+
{
|
|
10855
|
+
style: {
|
|
10856
|
+
margin: 0,
|
|
10857
|
+
padding: 10,
|
|
10858
|
+
borderRadius: 8,
|
|
10859
|
+
background: "#0f172a",
|
|
10860
|
+
color: "#e2e8f0",
|
|
10861
|
+
fontSize: 10.5,
|
|
10862
|
+
lineHeight: 1.45,
|
|
10863
|
+
overflowX: "auto",
|
|
10864
|
+
maxHeight: 280
|
|
10865
|
+
},
|
|
10866
|
+
children: JSON.stringify(
|
|
10867
|
+
{
|
|
10868
|
+
locale: testLocale,
|
|
10869
|
+
displayMode: draft.displayMode || "single_page",
|
|
10870
|
+
answers,
|
|
10871
|
+
...Object.keys(otherTexts).length > 0 ? { otherTexts } : {}
|
|
10872
|
+
},
|
|
10873
|
+
null,
|
|
10874
|
+
2
|
|
10875
|
+
)
|
|
10876
|
+
}
|
|
10877
|
+
)
|
|
10878
|
+
] })
|
|
10879
|
+
]
|
|
10880
|
+
}
|
|
10881
|
+
)
|
|
10882
|
+
]
|
|
10883
|
+
}
|
|
10884
|
+
)
|
|
10885
|
+
]
|
|
10886
|
+
}
|
|
10887
|
+
);
|
|
10888
|
+
};
|
|
10889
|
+
const inputStyle = {
|
|
10890
|
+
width: "100%",
|
|
10891
|
+
padding: "6px 9px",
|
|
10892
|
+
fontSize: 12,
|
|
10893
|
+
border: "1px solid #cbd5e1",
|
|
10894
|
+
borderRadius: 5,
|
|
10895
|
+
background: "#fff",
|
|
10896
|
+
color: "#1e293b"
|
|
10897
|
+
};
|
|
10898
|
+
const labelStyle = {
|
|
10899
|
+
display: "block",
|
|
10900
|
+
fontSize: 11,
|
|
10901
|
+
fontWeight: 600,
|
|
10902
|
+
color: "#475569",
|
|
10903
|
+
marginBottom: 4
|
|
10904
|
+
};
|
|
10905
|
+
function slugifyKey(input) {
|
|
10906
|
+
const map = {
|
|
10907
|
+
ç: "c",
|
|
10908
|
+
Ç: "c",
|
|
10909
|
+
ğ: "g",
|
|
10910
|
+
Ğ: "g",
|
|
10911
|
+
ı: "i",
|
|
10912
|
+
İ: "i",
|
|
10913
|
+
ö: "o",
|
|
10914
|
+
Ö: "o",
|
|
10915
|
+
ş: "s",
|
|
10916
|
+
Ş: "s",
|
|
10917
|
+
ü: "u",
|
|
10918
|
+
Ü: "u"
|
|
10919
|
+
};
|
|
10920
|
+
return String(input || "").replace(/[çÇğĞıİöÖşŞüÜ]/g, (ch) => map[ch] || ch).toLowerCase().replace(/[^a-z0-9_]+/g, "_").replace(/^_+|_+$/g, "");
|
|
10921
|
+
}
|
|
10922
|
+
const LIKERT_SCALE_PRESETS = [
|
|
10923
|
+
{
|
|
10924
|
+
id: "agreement",
|
|
10925
|
+
labelTr: "Katılım (Katılmıyorum–Katılıyorum)",
|
|
10926
|
+
labelEn: "Agreement (Disagree–Agree)",
|
|
10927
|
+
scale5: {
|
|
10928
|
+
"1": { tr: "Kesinlikle Katılmıyorum", en: "Strongly Disagree" },
|
|
10929
|
+
"2": { tr: "Katılmıyorum", en: "Disagree" },
|
|
10930
|
+
"3": { tr: "Kararsızım", en: "Neutral" },
|
|
10931
|
+
"4": { tr: "Katılıyorum", en: "Agree" },
|
|
10932
|
+
"5": { tr: "Kesinlikle Katılıyorum", en: "Strongly Agree" }
|
|
10933
|
+
},
|
|
10934
|
+
scale7: {
|
|
10935
|
+
"1": { tr: "Kesinlikle Katılmıyorum", en: "Strongly Disagree" },
|
|
10936
|
+
"2": { tr: "Katılmıyorum", en: "Disagree" },
|
|
10937
|
+
"3": { tr: "Kısmen Katılmıyorum", en: "Somewhat Disagree" },
|
|
10938
|
+
"4": { tr: "Kararsızım", en: "Neutral" },
|
|
10939
|
+
"5": { tr: "Kısmen Katılıyorum", en: "Somewhat Agree" },
|
|
10940
|
+
"6": { tr: "Katılıyorum", en: "Agree" },
|
|
10941
|
+
"7": { tr: "Kesinlikle Katılıyorum", en: "Strongly Agree" }
|
|
10942
|
+
}
|
|
10943
|
+
},
|
|
10944
|
+
{
|
|
10945
|
+
id: "satisfaction",
|
|
10946
|
+
labelTr: "Memnuniyet",
|
|
10947
|
+
labelEn: "Satisfaction",
|
|
10948
|
+
scale5: {
|
|
10949
|
+
"1": { tr: "Hiç Memnun Değilim", en: "Very Dissatisfied" },
|
|
10950
|
+
"2": { tr: "Memnun Değilim", en: "Dissatisfied" },
|
|
10951
|
+
"3": { tr: "Kararsızım", en: "Neutral" },
|
|
10952
|
+
"4": { tr: "Memnunum", en: "Satisfied" },
|
|
10953
|
+
"5": { tr: "Çok Memnunum", en: "Very Satisfied" }
|
|
10954
|
+
},
|
|
10955
|
+
scale7: {
|
|
10956
|
+
"1": { tr: "Hiç Memnun Değilim", en: "Very Dissatisfied" },
|
|
10957
|
+
"2": { tr: "Memnun Değilim", en: "Dissatisfied" },
|
|
10958
|
+
"3": { tr: "Kısmen Memnun Değilim", en: "Somewhat Dissatisfied" },
|
|
10959
|
+
"4": { tr: "Kararsızım", en: "Neutral" },
|
|
10960
|
+
"5": { tr: "Kısmen Memnunum", en: "Somewhat Satisfied" },
|
|
10961
|
+
"6": { tr: "Memnunum", en: "Satisfied" },
|
|
10962
|
+
"7": { tr: "Çok Memnunum", en: "Very Satisfied" }
|
|
10963
|
+
}
|
|
10964
|
+
},
|
|
10965
|
+
{
|
|
10966
|
+
id: "quality",
|
|
10967
|
+
labelTr: "Kalite (Çok Kötü–Mükemmel)",
|
|
10968
|
+
labelEn: "Quality (Poor–Excellent)",
|
|
10969
|
+
scale5: {
|
|
10970
|
+
"1": { tr: "Çok Kötü", en: "Poor" },
|
|
10971
|
+
"2": { tr: "Zayıf", en: "Fair" },
|
|
10972
|
+
"3": { tr: "Orta", en: "Good" },
|
|
10973
|
+
"4": { tr: "İyi", en: "Very Good" },
|
|
10974
|
+
"5": { tr: "Mükemmel", en: "Excellent" }
|
|
10975
|
+
},
|
|
10976
|
+
scale7: {
|
|
10977
|
+
"1": { tr: "Çok Kötü", en: "Terrible" },
|
|
10978
|
+
"2": { tr: "Kötü", en: "Poor" },
|
|
10979
|
+
"3": { tr: "Zayıf", en: "Below Average" },
|
|
10980
|
+
"4": { tr: "Orta", en: "Average" },
|
|
10981
|
+
"5": { tr: "İyi", en: "Good" },
|
|
10982
|
+
"6": { tr: "Çok İyi", en: "Very Good" },
|
|
10983
|
+
"7": { tr: "Mükemmel", en: "Excellent" }
|
|
10984
|
+
}
|
|
10985
|
+
},
|
|
10986
|
+
{
|
|
10987
|
+
id: "frequency",
|
|
10988
|
+
labelTr: "Sıklık (Hiç–Her Zaman)",
|
|
10989
|
+
labelEn: "Frequency (Never–Always)",
|
|
10990
|
+
scale5: {
|
|
10991
|
+
"1": { tr: "Hiçbir Zaman", en: "Never" },
|
|
10992
|
+
"2": { tr: "Nadiren", en: "Rarely" },
|
|
10993
|
+
"3": { tr: "Bazen", en: "Sometimes" },
|
|
10994
|
+
"4": { tr: "Sık Sık", en: "Often" },
|
|
10995
|
+
"5": { tr: "Her Zaman", en: "Always" }
|
|
10996
|
+
},
|
|
10997
|
+
scale7: {
|
|
10998
|
+
"1": { tr: "Hiçbir Zaman", en: "Never" },
|
|
10999
|
+
"2": { tr: "Çok Nadir", en: "Very Rarely" },
|
|
11000
|
+
"3": { tr: "Nadiren", en: "Rarely" },
|
|
11001
|
+
"4": { tr: "Bazen", en: "Sometimes" },
|
|
11002
|
+
"5": { tr: "Sıkça", en: "Frequently" },
|
|
11003
|
+
"6": { tr: "Çoğu Zaman", en: "Very Frequently" },
|
|
11004
|
+
"7": { tr: "Her Zaman", en: "Always" }
|
|
11005
|
+
}
|
|
11006
|
+
}
|
|
11007
|
+
];
|
|
11008
|
+
const QUESTION_TYPES_CATALOG = [
|
|
11009
|
+
{ type: "single_choice", labelTr: "Tekli Seçim (Radio)", labelEn: "Single Choice", hasOptions: true },
|
|
11010
|
+
{ type: "multiple_choice", labelTr: "Çoklu Seçim (Checkbox)", labelEn: "Multiple Choice", hasOptions: true },
|
|
11011
|
+
{ type: "dropdown", labelTr: "Açılır Liste (Dropdown)", labelEn: "Dropdown", hasOptions: true },
|
|
11012
|
+
{ type: "image_choice", labelTr: "Görsel Kart Seçimi", labelEn: "Image Choice", hasOptions: true },
|
|
11013
|
+
{ type: "nps", labelTr: "NPS Ölçeği (0–10)", labelEn: "NPS Score (0–10)" },
|
|
11014
|
+
{ type: "star_rating", labelTr: "Yıldız Derece (1–5)", labelEn: "Star Rating" },
|
|
11015
|
+
{ type: "likert_scale", labelTr: "Likert Ölçeği (1–5 / 1–7)", labelEn: "Likert Scale" },
|
|
11016
|
+
{ type: "matrix_single", labelTr: "Matris Değerlendirme Tablosu", labelEn: "Matrix Grid" },
|
|
11017
|
+
{ type: "ranking", labelTr: "Sürükle-Bırak Öncelik Sıralama", labelEn: "Drag Ranking", hasOptions: true },
|
|
11018
|
+
{ type: "short_text", labelTr: "Kısa Metin Yanıtı", labelEn: "Short Text" },
|
|
11019
|
+
{ type: "long_text", labelTr: "Açık Uçlu Uzun Yorum", labelEn: "Open-Ended Long Text" },
|
|
11020
|
+
{ type: "consent", labelTr: "KVKK / Gizlilik Onayı", labelEn: "Consent Switch" },
|
|
11021
|
+
{ type: "statement", labelTr: "Bilgi / Açıklama Metni", labelEn: "Info Statement" }
|
|
11022
|
+
];
|
|
11023
|
+
function createBlankSurveyDraft(locale = "en") {
|
|
11024
|
+
const tr = locale === "tr";
|
|
11025
|
+
const ts = Date.now().toString(36).slice(-4);
|
|
11026
|
+
return {
|
|
11027
|
+
title: tr ? "Yeni Müşteri Geri Bildirim Anketi" : "New Customer Feedback Survey",
|
|
11028
|
+
titleI18n: {
|
|
11029
|
+
en: "New Customer Feedback Survey",
|
|
11030
|
+
tr: "Yeni Müşteri Geri Bildirim Anketi"
|
|
11031
|
+
},
|
|
11032
|
+
slug: `survey_${ts}`,
|
|
11033
|
+
description: {
|
|
11034
|
+
tr: "Görüşleriniz hizmet kalitemizi geliştirmemize yardımcı olur.",
|
|
11035
|
+
en: "Your feedback helps us improve our service quality."
|
|
11036
|
+
},
|
|
11037
|
+
status: "published",
|
|
11038
|
+
displayMode: "single_page",
|
|
11039
|
+
submissionPolicy: "one_per_voter",
|
|
11040
|
+
anonymizeIp: true,
|
|
11041
|
+
showPublicResults: "after_vote",
|
|
11042
|
+
allowBackNavigation: true,
|
|
11043
|
+
showProgressBar: true,
|
|
11044
|
+
useRecaptcha: false,
|
|
11045
|
+
steps: [
|
|
11046
|
+
{
|
|
11047
|
+
id: "step_1",
|
|
11048
|
+
title: { tr: "1. Bölüm", en: "Step 1" }
|
|
11049
|
+
}
|
|
11050
|
+
],
|
|
11051
|
+
questions: [
|
|
11052
|
+
{
|
|
11053
|
+
key: "nps_score",
|
|
11054
|
+
stepId: "step_1",
|
|
11055
|
+
type: "nps",
|
|
11056
|
+
required: true,
|
|
11057
|
+
title: {
|
|
11058
|
+
tr: "Bizi çevrenize önerme olasılığınız nedir?",
|
|
11059
|
+
en: "How likely are you to recommend us?"
|
|
11060
|
+
},
|
|
11061
|
+
lowLabel: { tr: "0 — Hiç Olası Değil", en: "0 — Not likely" },
|
|
11062
|
+
highLabel: { tr: "10 — Kesinlikle Öneririm", en: "10 — Extremely likely" }
|
|
11063
|
+
},
|
|
11064
|
+
{
|
|
11065
|
+
key: "favorite_aspect",
|
|
11066
|
+
stepId: "step_1",
|
|
11067
|
+
type: "single_choice",
|
|
11068
|
+
required: true,
|
|
11069
|
+
allowOther: true,
|
|
11070
|
+
title: {
|
|
11071
|
+
tr: "En beğendiğiniz yönümüz hangisi?",
|
|
11072
|
+
en: "Which aspect do you value the most?"
|
|
11073
|
+
},
|
|
11074
|
+
options: [
|
|
11075
|
+
{ id: "speed", labels: { tr: "Hız ve Performans", en: "Speed & Performance" } },
|
|
11076
|
+
{ id: "ease_of_use", labels: { tr: "Kullanım Kolaylığı", en: "Ease of Use" } },
|
|
11077
|
+
{ id: "support", labels: { tr: "Teknik Destek", en: "Technical Support" } }
|
|
11078
|
+
]
|
|
11079
|
+
}
|
|
11080
|
+
],
|
|
11081
|
+
settings: {
|
|
11082
|
+
submitLabel: { tr: "Anketi Gönder", en: "Submit Survey" },
|
|
11083
|
+
thankYouTitle: { tr: "Teşekkür Ederiz!", en: "Thank You!" },
|
|
11084
|
+
thankYouMessage: {
|
|
11085
|
+
tr: "Yanıtlarınız başarıyla kaydedildi.",
|
|
11086
|
+
en: "Your response has been recorded."
|
|
11087
|
+
}
|
|
11088
|
+
}
|
|
11089
|
+
};
|
|
11090
|
+
}
|
|
11091
|
+
function buildQuestionFromType(type, stepId, existingKeys = []) {
|
|
11092
|
+
let idx = existingKeys.length + 1;
|
|
11093
|
+
let key = `q_${type}_${idx}`;
|
|
11094
|
+
while (existingKeys.includes(key)) {
|
|
11095
|
+
idx += 1;
|
|
11096
|
+
key = `q_${type}_${idx}`;
|
|
11097
|
+
}
|
|
11098
|
+
const base = {
|
|
11099
|
+
key,
|
|
11100
|
+
stepId,
|
|
11101
|
+
type,
|
|
11102
|
+
required: type !== "statement" && type !== "long_text",
|
|
11103
|
+
title: {
|
|
11104
|
+
tr: `Yeni Soru (${type})`,
|
|
11105
|
+
en: `New Question (${type})`
|
|
11106
|
+
}
|
|
11107
|
+
};
|
|
11108
|
+
if (["single_choice", "multiple_choice", "dropdown", "image_choice", "ranking"].includes(type)) {
|
|
11109
|
+
base.options = [
|
|
11110
|
+
{ id: "opt_1", labels: { tr: "Seçenek 1", en: "Option 1" } },
|
|
11111
|
+
{ id: "opt_2", labels: { tr: "Seçenek 2", en: "Option 2" } },
|
|
11112
|
+
{ id: "opt_3", labels: { tr: "Seçenek 3", en: "Option 3" } }
|
|
11113
|
+
];
|
|
11114
|
+
}
|
|
11115
|
+
if (type === "star_rating") {
|
|
11116
|
+
base.maxStars = 5;
|
|
11117
|
+
}
|
|
11118
|
+
if (type === "likert_scale") {
|
|
11119
|
+
base.scaleMin = 1;
|
|
11120
|
+
base.scaleMax = 5;
|
|
11121
|
+
base.lowLabel = { tr: "Kesinlikle Katılmıyorum", en: "Strongly Disagree" };
|
|
11122
|
+
base.highLabel = { tr: "Kesinlikle Katılıyorum", en: "Strongly Agree" };
|
|
11123
|
+
}
|
|
11124
|
+
if (type === "nps") {
|
|
11125
|
+
base.lowLabel = { tr: "0 — Hiç Olası Değil", en: "0 — Not at all likely" };
|
|
11126
|
+
base.highLabel = { tr: "10 — Kesinlikle Öneririm", en: "10 — Extremely likely" };
|
|
11127
|
+
}
|
|
11128
|
+
if (type === "matrix_single") {
|
|
11129
|
+
base.matrixRows = [
|
|
11130
|
+
{ id: "row_1", labels: { tr: "Hız & Performans", en: "Speed & Performance" } },
|
|
11131
|
+
{ id: "row_2", labels: { tr: "Tasarım Kalitesi", en: "Design Quality" } }
|
|
11132
|
+
];
|
|
11133
|
+
base.matrixColumns = [
|
|
11134
|
+
{ id: "excellent", labels: { tr: "Çok İyi", en: "Excellent" } },
|
|
11135
|
+
{ id: "good", labels: { tr: "İyi", en: "Good" } },
|
|
11136
|
+
{ id: "fair", labels: { tr: "Orta", en: "Fair" } }
|
|
11137
|
+
];
|
|
11138
|
+
}
|
|
11139
|
+
return base;
|
|
8502
11140
|
}
|
|
8503
11141
|
const SurveyStudioModal = ({
|
|
8504
11142
|
open,
|
|
@@ -8692,6 +11330,37 @@ const SurveyStudioModal = ({
|
|
|
8692
11330
|
children: statusMsg
|
|
8693
11331
|
}
|
|
8694
11332
|
),
|
|
11333
|
+
/* @__PURE__ */ jsxs(
|
|
11334
|
+
"button",
|
|
11335
|
+
{
|
|
11336
|
+
type: "button",
|
|
11337
|
+
onClick: () => setTab(tab === "preview" ? "builder" : "preview"),
|
|
11338
|
+
style: {
|
|
11339
|
+
padding: "8px 14px",
|
|
11340
|
+
borderRadius: 6,
|
|
11341
|
+
border: tab === "preview" ? "1px solid #34d399" : "1px solid rgba(255,255,255,0.32)",
|
|
11342
|
+
background: tab === "preview" ? "#059669" : "rgba(255,255,255,0.12)",
|
|
11343
|
+
color: "#ffffff",
|
|
11344
|
+
fontSize: 12,
|
|
11345
|
+
fontWeight: 700,
|
|
11346
|
+
cursor: "pointer",
|
|
11347
|
+
display: "inline-flex",
|
|
11348
|
+
alignItems: "center",
|
|
11349
|
+
gap: 6
|
|
11350
|
+
},
|
|
11351
|
+
children: [
|
|
11352
|
+
/* @__PURE__ */ jsx(
|
|
11353
|
+
MaterialIcon,
|
|
11354
|
+
{
|
|
11355
|
+
name: tab === "preview" ? "edit_note" : "play_circle",
|
|
11356
|
+
size: 16,
|
|
11357
|
+
color: "#fff"
|
|
11358
|
+
}
|
|
11359
|
+
),
|
|
11360
|
+
/* @__PURE__ */ jsx("span", { children: tab === "preview" ? tr ? "Tasarıma Dön" : "Back to Builder" : tr ? "Akışı Önizle & Test Et" : "Preview & Test Flow" })
|
|
11361
|
+
]
|
|
11362
|
+
}
|
|
11363
|
+
),
|
|
8695
11364
|
/* @__PURE__ */ jsxs(
|
|
8696
11365
|
"button",
|
|
8697
11366
|
{
|
|
@@ -8754,17 +11423,22 @@ const SurveyStudioModal = ({
|
|
|
8754
11423
|
{
|
|
8755
11424
|
id: "builder",
|
|
8756
11425
|
icon: "view_quilt",
|
|
8757
|
-
label: tr ? "1. Adımlar, Sorular & Koşullu Mantık
|
|
11426
|
+
label: tr ? "1. Adımlar, Sorular & Koşullu Mantık" : "1. Steps, Questions & Skip Logic"
|
|
11427
|
+
},
|
|
11428
|
+
{
|
|
11429
|
+
id: "preview",
|
|
11430
|
+
icon: "play_circle",
|
|
11431
|
+
label: tr ? "2. Önizleme & Canlı Akış Testi" : "2. Live Flow Preview & Simulator"
|
|
8758
11432
|
},
|
|
8759
11433
|
{
|
|
8760
11434
|
id: "settings",
|
|
8761
11435
|
icon: "tune",
|
|
8762
|
-
label: tr ? "
|
|
11436
|
+
label: tr ? "3. Yayın, Kota, Tekil Oy & Sonuç Ayarları" : "3. Lifecycle, Quota, Duplicate Guard & Results"
|
|
8763
11437
|
},
|
|
8764
11438
|
{
|
|
8765
11439
|
id: "analytics",
|
|
8766
11440
|
icon: "bar_chart",
|
|
8767
|
-
label: tr ? "
|
|
11441
|
+
label: tr ? "4. Canlı Raporlama, Grafikler & Excel (.xlsx)" : "4. Live Analytics, Charts & Excel (.xlsx)"
|
|
8768
11442
|
}
|
|
8769
11443
|
].map((tItem) => {
|
|
8770
11444
|
const active = tab === tItem.id;
|
|
@@ -9734,25 +12408,302 @@ const SurveyStudioModal = ({
|
|
|
9734
12408
|
}
|
|
9735
12409
|
)
|
|
9736
12410
|
] }),
|
|
9737
|
-
activeQ.type === "likert_scale" &&
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
"
|
|
9741
|
-
|
|
9742
|
-
|
|
9743
|
-
|
|
9744
|
-
|
|
9745
|
-
|
|
9746
|
-
|
|
9747
|
-
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
|
|
9751
|
-
|
|
12411
|
+
activeQ.type === "likert_scale" && (() => {
|
|
12412
|
+
const maxPt = Number(activeQ.scaleMax) === 7 ? 7 : 5;
|
|
12413
|
+
const hasPerPointLabels = Boolean(
|
|
12414
|
+
activeQ.scaleLabels && typeof activeQ.scaleLabels === "object" && Object.keys(activeQ.scaleLabels).length > 0
|
|
12415
|
+
);
|
|
12416
|
+
const applyLikertPreset = (presetId, targetMax = maxPt) => {
|
|
12417
|
+
const preset = LIKERT_SCALE_PRESETS.find((p) => p.id === presetId) || LIKERT_SCALE_PRESETS[0];
|
|
12418
|
+
const srcMap = targetMax === 7 ? preset.scale7 : preset.scale5;
|
|
12419
|
+
const nextScaleLabels = {};
|
|
12420
|
+
for (let pt = 1; pt <= targetMax; pt++) {
|
|
12421
|
+
const keyStr = String(pt);
|
|
12422
|
+
const pair = srcMap[keyStr] || { tr: keyStr, en: keyStr };
|
|
12423
|
+
const locRecord = {};
|
|
12424
|
+
for (const loc of strapiLocales) {
|
|
12425
|
+
const short = loc.code.toLowerCase().split(/[-_]/)[0];
|
|
12426
|
+
locRecord[loc.code] = short === "tr" ? pair.tr : pair.en;
|
|
12427
|
+
}
|
|
12428
|
+
nextScaleLabels[keyStr] = locRecord;
|
|
9752
12429
|
}
|
|
9753
|
-
|
|
9754
|
-
|
|
9755
|
-
|
|
12430
|
+
updateActiveQuestion({
|
|
12431
|
+
scaleMin: 1,
|
|
12432
|
+
scaleMax: targetMax,
|
|
12433
|
+
scaleLabels: nextScaleLabels,
|
|
12434
|
+
lowLabel: nextScaleLabels["1"],
|
|
12435
|
+
highLabel: nextScaleLabels[String(targetMax)]
|
|
12436
|
+
});
|
|
12437
|
+
};
|
|
12438
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
|
|
12439
|
+
/* @__PURE__ */ jsxs(
|
|
12440
|
+
"div",
|
|
12441
|
+
{
|
|
12442
|
+
style: {
|
|
12443
|
+
display: "flex",
|
|
12444
|
+
flexWrap: "wrap",
|
|
12445
|
+
alignItems: "flex-end",
|
|
12446
|
+
justifyContent: "space-between",
|
|
12447
|
+
gap: 10
|
|
12448
|
+
},
|
|
12449
|
+
children: [
|
|
12450
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
12451
|
+
/* @__PURE__ */ jsx("label", { style: labelStyle, children: tr ? "Likert Aralığı" : "Likert Range" }),
|
|
12452
|
+
/* @__PURE__ */ jsxs(
|
|
12453
|
+
"select",
|
|
12454
|
+
{
|
|
12455
|
+
value: maxPt,
|
|
12456
|
+
onChange: (e) => {
|
|
12457
|
+
const nextMax = Number(e.target.value) === 7 ? 7 : 5;
|
|
12458
|
+
if (hasPerPointLabels) {
|
|
12459
|
+
const curMap = activeQ.scaleLabels || {};
|
|
12460
|
+
const resized = {};
|
|
12461
|
+
const fallbackPreset = nextMax === 7 ? LIKERT_SCALE_PRESETS[0].scale7 : LIKERT_SCALE_PRESETS[0].scale5;
|
|
12462
|
+
for (let pt = 1; pt <= nextMax; pt++) {
|
|
12463
|
+
const k = String(pt);
|
|
12464
|
+
if (curMap[k]) {
|
|
12465
|
+
resized[k] = normalizeLocalizedRecord(
|
|
12466
|
+
curMap[k],
|
|
12467
|
+
strapiLocales
|
|
12468
|
+
);
|
|
12469
|
+
} else {
|
|
12470
|
+
const pair = fallbackPreset[k];
|
|
12471
|
+
const locRec = {};
|
|
12472
|
+
for (const loc of strapiLocales) {
|
|
12473
|
+
locRec[loc.code] = loc.code.toLowerCase().startsWith("tr") ? pair.tr : pair.en;
|
|
12474
|
+
}
|
|
12475
|
+
resized[k] = locRec;
|
|
12476
|
+
}
|
|
12477
|
+
}
|
|
12478
|
+
updateActiveQuestion({
|
|
12479
|
+
scaleMin: 1,
|
|
12480
|
+
scaleMax: nextMax,
|
|
12481
|
+
scaleLabels: resized,
|
|
12482
|
+
lowLabel: resized["1"],
|
|
12483
|
+
highLabel: resized[String(nextMax)]
|
|
12484
|
+
});
|
|
12485
|
+
} else {
|
|
12486
|
+
updateActiveQuestion({
|
|
12487
|
+
scaleMin: 1,
|
|
12488
|
+
scaleMax: nextMax
|
|
12489
|
+
});
|
|
12490
|
+
}
|
|
12491
|
+
},
|
|
12492
|
+
style: { ...inputStyle, width: 150 },
|
|
12493
|
+
children: [
|
|
12494
|
+
/* @__PURE__ */ jsx("option", { value: 5, children: "1 – 5" }),
|
|
12495
|
+
/* @__PURE__ */ jsx("option", { value: 7, children: "1 – 7" })
|
|
12496
|
+
]
|
|
12497
|
+
}
|
|
12498
|
+
)
|
|
12499
|
+
] }),
|
|
12500
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
12501
|
+
/* @__PURE__ */ jsx("label", { style: labelStyle, children: tr ? "Etiketleme Modu" : "Labeling Mode" }),
|
|
12502
|
+
/* @__PURE__ */ jsxs(
|
|
12503
|
+
"div",
|
|
12504
|
+
{
|
|
12505
|
+
style: {
|
|
12506
|
+
display: "inline-flex",
|
|
12507
|
+
borderRadius: 6,
|
|
12508
|
+
overflow: "hidden",
|
|
12509
|
+
border: "1px solid #cbd5e1"
|
|
12510
|
+
},
|
|
12511
|
+
children: [
|
|
12512
|
+
/* @__PURE__ */ jsx(
|
|
12513
|
+
"button",
|
|
12514
|
+
{
|
|
12515
|
+
type: "button",
|
|
12516
|
+
onClick: () => updateActiveQuestion({ scaleLabels: void 0 }),
|
|
12517
|
+
style: {
|
|
12518
|
+
padding: "6px 10px",
|
|
12519
|
+
border: "none",
|
|
12520
|
+
background: !hasPerPointLabels ? "#2563eb" : "#ffffff",
|
|
12521
|
+
color: !hasPerPointLabels ? "#ffffff" : "#475569",
|
|
12522
|
+
fontSize: 11,
|
|
12523
|
+
fontWeight: 700,
|
|
12524
|
+
cursor: "pointer"
|
|
12525
|
+
},
|
|
12526
|
+
children: tr ? `Sadece Uç Etiketler (1 & ${maxPt})` : `Endpoints Only (1 & ${maxPt})`
|
|
12527
|
+
}
|
|
12528
|
+
),
|
|
12529
|
+
/* @__PURE__ */ jsx(
|
|
12530
|
+
"button",
|
|
12531
|
+
{
|
|
12532
|
+
type: "button",
|
|
12533
|
+
onClick: () => {
|
|
12534
|
+
if (!hasPerPointLabels) {
|
|
12535
|
+
applyLikertPreset("agreement", maxPt);
|
|
12536
|
+
}
|
|
12537
|
+
},
|
|
12538
|
+
style: {
|
|
12539
|
+
padding: "6px 10px",
|
|
12540
|
+
border: "none",
|
|
12541
|
+
background: hasPerPointLabels ? "#2563eb" : "#ffffff",
|
|
12542
|
+
color: hasPerPointLabels ? "#ffffff" : "#475569",
|
|
12543
|
+
fontSize: 11,
|
|
12544
|
+
fontWeight: 700,
|
|
12545
|
+
cursor: "pointer"
|
|
12546
|
+
},
|
|
12547
|
+
children: tr ? `Her Puana Özel Etiket (1–${maxPt})` : `Per-Score Labels (1–${maxPt})`
|
|
12548
|
+
}
|
|
12549
|
+
)
|
|
12550
|
+
]
|
|
12551
|
+
}
|
|
12552
|
+
)
|
|
12553
|
+
] })
|
|
12554
|
+
]
|
|
12555
|
+
}
|
|
12556
|
+
),
|
|
12557
|
+
hasPerPointLabels && /* @__PURE__ */ jsxs(
|
|
12558
|
+
"div",
|
|
12559
|
+
{
|
|
12560
|
+
style: {
|
|
12561
|
+
padding: 10,
|
|
12562
|
+
borderRadius: 8,
|
|
12563
|
+
background: "#ffffff",
|
|
12564
|
+
border: "1px solid #cbd5e1",
|
|
12565
|
+
display: "flex",
|
|
12566
|
+
flexDirection: "column",
|
|
12567
|
+
gap: 8
|
|
12568
|
+
},
|
|
12569
|
+
children: [
|
|
12570
|
+
/* @__PURE__ */ jsxs(
|
|
12571
|
+
"div",
|
|
12572
|
+
{
|
|
12573
|
+
style: {
|
|
12574
|
+
display: "flex",
|
|
12575
|
+
alignItems: "center",
|
|
12576
|
+
justifyContent: "space-between",
|
|
12577
|
+
flexWrap: "wrap",
|
|
12578
|
+
gap: 6
|
|
12579
|
+
},
|
|
12580
|
+
children: [
|
|
12581
|
+
/* @__PURE__ */ jsx(
|
|
12582
|
+
"span",
|
|
12583
|
+
{
|
|
12584
|
+
style: {
|
|
12585
|
+
fontSize: 11,
|
|
12586
|
+
fontWeight: 700,
|
|
12587
|
+
color: "#1e3a8a"
|
|
12588
|
+
},
|
|
12589
|
+
children: tr ? `Hazır 1–${maxPt} Şablonları (Tek Tık Doldur):` : `Quick 1–${maxPt} Presets:`
|
|
12590
|
+
}
|
|
12591
|
+
),
|
|
12592
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 5 }, children: LIKERT_SCALE_PRESETS.map((pr) => /* @__PURE__ */ jsx(
|
|
12593
|
+
"button",
|
|
12594
|
+
{
|
|
12595
|
+
type: "button",
|
|
12596
|
+
onClick: () => applyLikertPreset(pr.id, maxPt),
|
|
12597
|
+
style: {
|
|
12598
|
+
padding: "3px 8px",
|
|
12599
|
+
borderRadius: 5,
|
|
12600
|
+
border: "1px solid #bfdbfe",
|
|
12601
|
+
background: "#eff6ff",
|
|
12602
|
+
color: "#1d4ed8",
|
|
12603
|
+
fontSize: 10.5,
|
|
12604
|
+
fontWeight: 700,
|
|
12605
|
+
cursor: "pointer"
|
|
12606
|
+
},
|
|
12607
|
+
children: tr ? pr.labelTr : pr.labelEn
|
|
12608
|
+
},
|
|
12609
|
+
pr.id
|
|
12610
|
+
)) })
|
|
12611
|
+
]
|
|
12612
|
+
}
|
|
12613
|
+
),
|
|
12614
|
+
/* @__PURE__ */ jsxs(
|
|
12615
|
+
"div",
|
|
12616
|
+
{
|
|
12617
|
+
style: {
|
|
12618
|
+
display: "grid",
|
|
12619
|
+
gridTemplateColumns: `46px repeat(${strapiLocales.length}, minmax(0, 1fr))`,
|
|
12620
|
+
gap: 6,
|
|
12621
|
+
fontSize: 10.5,
|
|
12622
|
+
fontWeight: 700,
|
|
12623
|
+
color: "#64748b",
|
|
12624
|
+
padding: "0 2px"
|
|
12625
|
+
},
|
|
12626
|
+
children: [
|
|
12627
|
+
/* @__PURE__ */ jsx("span", { children: tr ? "Puan" : "Score" }),
|
|
12628
|
+
strapiLocales.map((loc) => /* @__PURE__ */ jsxs("span", { children: [
|
|
12629
|
+
loc.code.toUpperCase(),
|
|
12630
|
+
" ",
|
|
12631
|
+
tr ? "Etiketi" : "Label"
|
|
12632
|
+
] }, `lh-${loc.code}`))
|
|
12633
|
+
]
|
|
12634
|
+
}
|
|
12635
|
+
),
|
|
12636
|
+
Array.from({ length: maxPt }, (_, idx) => {
|
|
12637
|
+
const pt = idx + 1;
|
|
12638
|
+
const ptKey = String(pt);
|
|
12639
|
+
const ptObj = normalizeLocalizedRecord(
|
|
12640
|
+
activeQ.scaleLabels?.[ptKey],
|
|
12641
|
+
strapiLocales
|
|
12642
|
+
);
|
|
12643
|
+
return /* @__PURE__ */ jsxs(
|
|
12644
|
+
"div",
|
|
12645
|
+
{
|
|
12646
|
+
style: {
|
|
12647
|
+
display: "grid",
|
|
12648
|
+
gridTemplateColumns: `46px repeat(${strapiLocales.length}, minmax(0, 1fr))`,
|
|
12649
|
+
gap: 6,
|
|
12650
|
+
alignItems: "center"
|
|
12651
|
+
},
|
|
12652
|
+
children: [
|
|
12653
|
+
/* @__PURE__ */ jsx(
|
|
12654
|
+
"span",
|
|
12655
|
+
{
|
|
12656
|
+
style: {
|
|
12657
|
+
display: "inline-flex",
|
|
12658
|
+
alignItems: "center",
|
|
12659
|
+
justifyContent: "center",
|
|
12660
|
+
height: 28,
|
|
12661
|
+
borderRadius: 6,
|
|
12662
|
+
background: "#eff6ff",
|
|
12663
|
+
border: "1px solid #bfdbfe",
|
|
12664
|
+
color: "#1d4ed8",
|
|
12665
|
+
fontSize: 12,
|
|
12666
|
+
fontWeight: 800
|
|
12667
|
+
},
|
|
12668
|
+
children: pt
|
|
12669
|
+
}
|
|
12670
|
+
),
|
|
12671
|
+
strapiLocales.map((loc) => /* @__PURE__ */ jsx(
|
|
12672
|
+
"input",
|
|
12673
|
+
{
|
|
12674
|
+
type: "text",
|
|
12675
|
+
value: ptObj[loc.code] || "",
|
|
12676
|
+
onChange: (e) => {
|
|
12677
|
+
const nextPtObj = {
|
|
12678
|
+
...ptObj,
|
|
12679
|
+
[loc.code]: e.target.value
|
|
12680
|
+
};
|
|
12681
|
+
const nextScaleMap = {
|
|
12682
|
+
...activeQ.scaleLabels || {},
|
|
12683
|
+
[ptKey]: nextPtObj
|
|
12684
|
+
};
|
|
12685
|
+
updateActiveQuestion({
|
|
12686
|
+
scaleLabels: nextScaleMap,
|
|
12687
|
+
...pt === 1 ? { lowLabel: nextPtObj } : {},
|
|
12688
|
+
...pt === maxPt ? { highLabel: nextPtObj } : {}
|
|
12689
|
+
});
|
|
12690
|
+
},
|
|
12691
|
+
placeholder: `${pt} (${loc.code.toUpperCase()})`,
|
|
12692
|
+
style: inputStyle
|
|
12693
|
+
},
|
|
12694
|
+
`linp-${ptKey}-${loc.code}`
|
|
12695
|
+
))
|
|
12696
|
+
]
|
|
12697
|
+
},
|
|
12698
|
+
`lrow-${ptKey}`
|
|
12699
|
+
);
|
|
12700
|
+
})
|
|
12701
|
+
]
|
|
12702
|
+
}
|
|
12703
|
+
)
|
|
12704
|
+
] });
|
|
12705
|
+
})(),
|
|
12706
|
+
(activeQ.type === "nps" || activeQ.type === "likert_scale" && !(activeQ.scaleLabels && Object.keys(activeQ.scaleLabels).length > 0)) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9756
12707
|
/* @__PURE__ */ jsx(
|
|
9757
12708
|
"div",
|
|
9758
12709
|
{
|
|
@@ -10581,6 +13532,14 @@ const SurveyStudioModal = ({
|
|
|
10581
13532
|
]
|
|
10582
13533
|
}
|
|
10583
13534
|
),
|
|
13535
|
+
tab === "preview" && /* @__PURE__ */ jsx(
|
|
13536
|
+
SurveyLivePreviewPane,
|
|
13537
|
+
{
|
|
13538
|
+
draft,
|
|
13539
|
+
uiLocale,
|
|
13540
|
+
strapiLocales
|
|
13541
|
+
}
|
|
13542
|
+
),
|
|
10584
13543
|
tab === "analytics" && /* @__PURE__ */ jsx("div", { style: { flex: 1, padding: 20, overflowY: "auto", background: "#f8fafc" }, children: /* @__PURE__ */ jsx(SurveyAnalyticsView, { surveySlugOrId: draft.slug, uiLocale }) })
|
|
10585
13544
|
]
|
|
10586
13545
|
}
|
|
@@ -10753,15 +13712,15 @@ const SurveyWidgetEditor = ({ widget, onChange }) => {
|
|
|
10753
13712
|
type: "button",
|
|
10754
13713
|
onClick: () => {
|
|
10755
13714
|
setStudioTarget(matchedSurvey || createBlankSurveyDraft(locale));
|
|
10756
|
-
setStudioInitialTab("
|
|
13715
|
+
setStudioInitialTab("preview");
|
|
10757
13716
|
setStudioOpen(true);
|
|
10758
13717
|
},
|
|
10759
13718
|
style: {
|
|
10760
13719
|
padding: "7px 10px",
|
|
10761
13720
|
borderRadius: 6,
|
|
10762
|
-
border: "1px solid #
|
|
10763
|
-
background: "#
|
|
10764
|
-
color: "#
|
|
13721
|
+
border: "1px solid #2563eb",
|
|
13722
|
+
background: "#eff6ff",
|
|
13723
|
+
color: "#1d4ed8",
|
|
10765
13724
|
fontSize: 11,
|
|
10766
13725
|
fontWeight: 700,
|
|
10767
13726
|
cursor: "pointer",
|
|
@@ -10771,34 +13730,63 @@ const SurveyWidgetEditor = ({ widget, onChange }) => {
|
|
|
10771
13730
|
gap: 5
|
|
10772
13731
|
},
|
|
10773
13732
|
children: [
|
|
10774
|
-
/* @__PURE__ */ jsx(MaterialIcon, { name: "
|
|
10775
|
-
/* @__PURE__ */ jsx("span", { children: tr ? "
|
|
13733
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "play_circle", size: 15, color: "#2563eb" }),
|
|
13734
|
+
/* @__PURE__ */ jsx("span", { children: tr ? "Akışı Önizle" : "Preview Flow" })
|
|
10776
13735
|
]
|
|
10777
13736
|
}
|
|
10778
13737
|
),
|
|
10779
|
-
/* @__PURE__ */
|
|
13738
|
+
/* @__PURE__ */ jsxs(
|
|
10780
13739
|
"button",
|
|
10781
13740
|
{
|
|
10782
13741
|
type: "button",
|
|
10783
13742
|
onClick: () => {
|
|
10784
|
-
setStudioTarget(createBlankSurveyDraft(locale));
|
|
10785
|
-
setStudioInitialTab("
|
|
13743
|
+
setStudioTarget(matchedSurvey || createBlankSurveyDraft(locale));
|
|
13744
|
+
setStudioInitialTab("analytics");
|
|
10786
13745
|
setStudioOpen(true);
|
|
10787
13746
|
},
|
|
10788
13747
|
style: {
|
|
10789
13748
|
padding: "7px 10px",
|
|
10790
13749
|
borderRadius: 6,
|
|
10791
|
-
border: "1px solid #
|
|
10792
|
-
background: "#
|
|
10793
|
-
color: "#
|
|
13750
|
+
border: "1px solid #059669",
|
|
13751
|
+
background: "#ecfdf5",
|
|
13752
|
+
color: "#065f46",
|
|
10794
13753
|
fontSize: 11,
|
|
10795
13754
|
fontWeight: 700,
|
|
10796
|
-
cursor: "pointer"
|
|
13755
|
+
cursor: "pointer",
|
|
13756
|
+
display: "inline-flex",
|
|
13757
|
+
alignItems: "center",
|
|
13758
|
+
justifyContent: "center",
|
|
13759
|
+
gap: 5
|
|
10797
13760
|
},
|
|
10798
|
-
children:
|
|
13761
|
+
children: [
|
|
13762
|
+
/* @__PURE__ */ jsx(MaterialIcon, { name: "bar_chart", size: 15, color: "#059669" }),
|
|
13763
|
+
/* @__PURE__ */ jsx("span", { children: tr ? "Raporları Gör" : "View Reports" })
|
|
13764
|
+
]
|
|
10799
13765
|
}
|
|
10800
13766
|
)
|
|
10801
|
-
] })
|
|
13767
|
+
] }),
|
|
13768
|
+
/* @__PURE__ */ jsx(
|
|
13769
|
+
"button",
|
|
13770
|
+
{
|
|
13771
|
+
type: "button",
|
|
13772
|
+
onClick: () => {
|
|
13773
|
+
setStudioTarget(createBlankSurveyDraft(locale));
|
|
13774
|
+
setStudioInitialTab("builder");
|
|
13775
|
+
setStudioOpen(true);
|
|
13776
|
+
},
|
|
13777
|
+
style: {
|
|
13778
|
+
padding: "7px 10px",
|
|
13779
|
+
borderRadius: 6,
|
|
13780
|
+
border: "1px solid #cbd5e1",
|
|
13781
|
+
background: "#ffffff",
|
|
13782
|
+
color: "#334155",
|
|
13783
|
+
fontSize: 11,
|
|
13784
|
+
fontWeight: 700,
|
|
13785
|
+
cursor: "pointer"
|
|
13786
|
+
},
|
|
13787
|
+
children: tr ? "+ Yeni Anket Yarat" : "+ New Survey"
|
|
13788
|
+
}
|
|
13789
|
+
)
|
|
10802
13790
|
] }),
|
|
10803
13791
|
/* @__PURE__ */ jsx(
|
|
10804
13792
|
SurveyStudioModal,
|
|
@@ -10817,17 +13805,23 @@ const SurveyWidgetEditor = ({ widget, onChange }) => {
|
|
|
10817
13805
|
] });
|
|
10818
13806
|
};
|
|
10819
13807
|
export {
|
|
10820
|
-
|
|
10821
|
-
|
|
13808
|
+
normalizeOptionListByLocales as A,
|
|
13809
|
+
getDeviceTooltip as B,
|
|
10822
13810
|
CIColorField as C,
|
|
10823
13811
|
DEVICES as D,
|
|
10824
|
-
|
|
10825
|
-
|
|
10826
|
-
|
|
10827
|
-
|
|
10828
|
-
|
|
10829
|
-
|
|
10830
|
-
|
|
13812
|
+
SurveyWidgetEditor as E,
|
|
13813
|
+
setResponsiveProp as F,
|
|
13814
|
+
getClipboard as G,
|
|
13815
|
+
copyToClipboard as H,
|
|
13816
|
+
EditorProvider as I,
|
|
13817
|
+
ensureIds as J,
|
|
13818
|
+
getInitialLocale as K,
|
|
13819
|
+
createBlankSurveyDraft as L,
|
|
13820
|
+
ColorCodesManager as M,
|
|
13821
|
+
pickTextForLocale as N,
|
|
13822
|
+
SurveyAnalyticsView as O,
|
|
13823
|
+
SurveyStudioModal as P,
|
|
13824
|
+
persistLocale as Q,
|
|
10831
13825
|
ROW_PRESETS as R,
|
|
10832
13826
|
StrapiMediaPicker as S,
|
|
10833
13827
|
WIDGET_DEFINITIONS as W,
|
|
@@ -10841,21 +13835,21 @@ export {
|
|
|
10841
13835
|
getRowPresetLabel as g,
|
|
10842
13836
|
useStrapiLocales as h,
|
|
10843
13837
|
useOptionalEditorContext as i,
|
|
10844
|
-
|
|
10845
|
-
|
|
10846
|
-
|
|
10847
|
-
|
|
10848
|
-
|
|
10849
|
-
|
|
10850
|
-
|
|
10851
|
-
|
|
13838
|
+
resolveCanvasMediaUrl as j,
|
|
13839
|
+
DEVICE_INDEX_MAP as k,
|
|
13840
|
+
useEditorContext as l,
|
|
13841
|
+
getDevice as m,
|
|
13842
|
+
rowCanvasClasses as n,
|
|
13843
|
+
nodeCanvasStyles as o,
|
|
13844
|
+
extractResponsiveProp as p,
|
|
13845
|
+
blockCanvasClasses as q,
|
|
10852
13846
|
resolveAdminMediaUrl as r,
|
|
10853
|
-
|
|
10854
|
-
|
|
13847
|
+
useColorCodes as s,
|
|
13848
|
+
getDeviceLabel as t,
|
|
10855
13849
|
uid as u,
|
|
10856
|
-
|
|
10857
|
-
|
|
10858
|
-
|
|
10859
|
-
|
|
10860
|
-
|
|
13850
|
+
WIDTH_PRESETS as v,
|
|
13851
|
+
ColorCodesModal as w,
|
|
13852
|
+
getWidgetDescription as x,
|
|
13853
|
+
WIDGET_CATEGORIES as y,
|
|
13854
|
+
normalizeLocalizedRecord as z
|
|
10861
13855
|
};
|