@ozguraltan/strapi-content-input 1.0.24 → 1.0.26
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 +2 -0
- package/dist/admin/{AnalyticsHubPage-ByOrVZCl.js → AnalyticsHubPage-CHlhvUIU.js} +2 -2
- package/dist/admin/{AnalyticsHubPage-O-7pF2E5.mjs → AnalyticsHubPage-Crz4vv46.mjs} +2 -2
- package/dist/admin/{ContentInputField-BoZHf0Ka.mjs → ContentInputField-BeKDx_bb.mjs} +64 -19
- package/dist/admin/{ContentInputField-DK97AIG0.js → ContentInputField-CNWVLuRt.js} +64 -19
- package/dist/admin/{SurveyWidgetEditor-D3KiAotu.js → SurveyWidgetEditor-BTipBBEU.js} +622 -152
- package/dist/admin/{SurveyWidgetEditor-Y5BR-NWE.mjs → SurveyWidgetEditor-GKRT3eHj.mjs} +622 -152
- package/dist/admin/{index-C5Uj5YV9.mjs → index-DSDcG4QW.mjs} +2 -2
- package/dist/admin/{index-CHtB_Fa5.js → index-DuJM60tO.js} +2 -2
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/widgets/SurveyWidgetEditor.d.ts +2 -0
- package/dist/server/index.js +132 -27
- package/dist/server/index.mjs +132 -27
- package/dist/server/src/index.d.ts +23 -0
- package/dist/server/src/services/ci-survey.d.ts +23 -0
- package/dist/server/src/services/index.d.ts +23 -0
- package/dist/server/src/utils/surveyEngine.d.ts +19 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import React, { 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-DSDcG4QW.mjs";
|
|
6
6
|
import cloneDeep from "lodash/cloneDeep";
|
|
7
7
|
const ROW_PRESETS = [
|
|
8
8
|
{
|
|
@@ -8085,7 +8085,7 @@ const SurveyAnalyticsView = ({
|
|
|
8085
8085
|
style: {
|
|
8086
8086
|
width: `${Math.min(100, opt.percentage)}%`,
|
|
8087
8087
|
height: "100%",
|
|
8088
|
-
background: opt.id === "__other__" ? "#64748b" : "linear-gradient(90deg, #2563eb 0%, #3b82f6 100%)",
|
|
8088
|
+
background: opt.id === "__other__" ? "#64748b" : opt.id === "__na__" ? "#94a3b8" : "linear-gradient(90deg, #2563eb 0%, #3b82f6 100%)",
|
|
8089
8089
|
borderRadius: 5
|
|
8090
8090
|
}
|
|
8091
8091
|
}
|
|
@@ -8213,6 +8213,37 @@ const SurveyAnalyticsView = ({
|
|
|
8213
8213
|
")"
|
|
8214
8214
|
]
|
|
8215
8215
|
}
|
|
8216
|
+
),
|
|
8217
|
+
(qs.noOpinionCount > 0 || qs.allowNoOpinion) && /* @__PURE__ */ jsxs(
|
|
8218
|
+
"div",
|
|
8219
|
+
{
|
|
8220
|
+
style: {
|
|
8221
|
+
padding: "8px 14px",
|
|
8222
|
+
borderRadius: 8,
|
|
8223
|
+
background: "#f1f5f9",
|
|
8224
|
+
border: "1px dashed #94a3b8",
|
|
8225
|
+
fontSize: 11.5,
|
|
8226
|
+
color: "#334155",
|
|
8227
|
+
fontWeight: 700
|
|
8228
|
+
},
|
|
8229
|
+
children: [
|
|
8230
|
+
pickTextForLocale(
|
|
8231
|
+
qs.noOpinionLabels,
|
|
8232
|
+
uiLocale,
|
|
8233
|
+
tr ? "Fikrim yok" : "No idea"
|
|
8234
|
+
),
|
|
8235
|
+
": ",
|
|
8236
|
+
qs.noOpinionCount || 0,
|
|
8237
|
+
" (",
|
|
8238
|
+
qs.noOpinionPercentage || 0,
|
|
8239
|
+
"%)",
|
|
8240
|
+
" ",
|
|
8241
|
+
/* @__PURE__ */ jsxs("span", { style: { fontWeight: 500, color: "#64748b", fontSize: 10.5 }, children: [
|
|
8242
|
+
"• ",
|
|
8243
|
+
tr ? "ortalamaya katılmaz" : "excluded from avg"
|
|
8244
|
+
] })
|
|
8245
|
+
]
|
|
8246
|
+
}
|
|
8216
8247
|
)
|
|
8217
8248
|
]
|
|
8218
8249
|
}
|
|
@@ -8382,102 +8413,131 @@ const SurveyAnalyticsView = ({
|
|
|
8382
8413
|
]
|
|
8383
8414
|
}
|
|
8384
8415
|
) }),
|
|
8385
|
-
qs.type === "ranking" && Array.isArray(qs.rankingBreakdown) && /* @__PURE__ */
|
|
8386
|
-
|
|
8387
|
-
1,
|
|
8388
|
-
...qs.rankingBreakdown.map((x) => x.bordaPoints || 0)
|
|
8389
|
-
);
|
|
8390
|
-
const pct = Math.round((rk.bordaPoints || 0) / maxBorda * 100);
|
|
8391
|
-
return /* @__PURE__ */ jsxs(
|
|
8416
|
+
qs.type === "ranking" && Array.isArray(qs.rankingBreakdown) && /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
8417
|
+
(qs.noOpinionCount > 0 || qs.allowNoOpinion) && /* @__PURE__ */ jsxs(
|
|
8392
8418
|
"div",
|
|
8393
8419
|
{
|
|
8394
8420
|
style: {
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
background:
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
flexWrap: "wrap"
|
|
8421
|
+
alignSelf: "flex-start",
|
|
8422
|
+
padding: "5px 11px",
|
|
8423
|
+
borderRadius: 7,
|
|
8424
|
+
background: "#f1f5f9",
|
|
8425
|
+
border: "1px dashed #94a3b8",
|
|
8426
|
+
fontSize: 11,
|
|
8427
|
+
fontWeight: 700,
|
|
8428
|
+
color: "#334155"
|
|
8404
8429
|
},
|
|
8405
8430
|
children: [
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8412
|
-
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
|
|
8416
|
-
|
|
8417
|
-
|
|
8418
|
-
|
|
8419
|
-
|
|
8420
|
-
|
|
8421
|
-
|
|
8422
|
-
|
|
8423
|
-
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
|
|
8427
|
-
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
|
|
8435
|
-
|
|
8436
|
-
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
8431
|
+
pickTextForLocale(
|
|
8432
|
+
qs.noOpinionLabels,
|
|
8433
|
+
uiLocale,
|
|
8434
|
+
tr ? "Fikrim yok" : "No idea"
|
|
8435
|
+
),
|
|
8436
|
+
": ",
|
|
8437
|
+
qs.noOpinionCount || 0,
|
|
8438
|
+
" (",
|
|
8439
|
+
qs.noOpinionPercentage || 0,
|
|
8440
|
+
"%)"
|
|
8441
|
+
]
|
|
8442
|
+
}
|
|
8443
|
+
),
|
|
8444
|
+
qs.rankingBreakdown.map((rk, idx) => {
|
|
8445
|
+
const maxBorda = Math.max(
|
|
8446
|
+
1,
|
|
8447
|
+
...qs.rankingBreakdown.map((x) => x.bordaPoints || 0)
|
|
8448
|
+
);
|
|
8449
|
+
const pct = Math.round((rk.bordaPoints || 0) / maxBorda * 100);
|
|
8450
|
+
return /* @__PURE__ */ jsxs(
|
|
8451
|
+
"div",
|
|
8452
|
+
{
|
|
8453
|
+
style: {
|
|
8454
|
+
padding: "10px 12px",
|
|
8455
|
+
borderRadius: 8,
|
|
8456
|
+
border: idx === 0 ? "1.5px solid #f59e0b" : "1px solid #e2e8f0",
|
|
8457
|
+
background: idx === 0 ? "#fffbeb" : "#f8fafc",
|
|
8458
|
+
display: "flex",
|
|
8459
|
+
alignItems: "center",
|
|
8460
|
+
justifyContent: "space-between",
|
|
8461
|
+
gap: 12,
|
|
8462
|
+
flexWrap: "wrap"
|
|
8463
|
+
},
|
|
8464
|
+
children: [
|
|
8465
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
|
|
8466
|
+
/* @__PURE__ */ jsxs(
|
|
8467
|
+
"span",
|
|
8468
|
+
{
|
|
8469
|
+
style: {
|
|
8470
|
+
width: 26,
|
|
8471
|
+
height: 26,
|
|
8472
|
+
borderRadius: "50%",
|
|
8473
|
+
background: idx === 0 ? "#f59e0b" : idx === 1 ? "#64748b" : idx === 2 ? "#b45309" : "#cbd5e1",
|
|
8474
|
+
color: "#fff",
|
|
8475
|
+
fontWeight: 800,
|
|
8476
|
+
fontSize: 12,
|
|
8477
|
+
display: "inline-flex",
|
|
8478
|
+
alignItems: "center",
|
|
8479
|
+
justifyContent: "center"
|
|
8480
|
+
},
|
|
8481
|
+
children: [
|
|
8482
|
+
"#",
|
|
8483
|
+
idx + 1
|
|
8484
|
+
]
|
|
8485
|
+
}
|
|
8486
|
+
),
|
|
8487
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
8488
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: 13, fontWeight: 700, color: "#0f172a" }, children: pickTextForLocale(rk.labels, uiLocale, rk.id) }),
|
|
8489
|
+
/* @__PURE__ */ jsxs("div", { style: { fontSize: 11, color: "#64748b" }, children: [
|
|
8490
|
+
tr ? "Ort. Sıra:" : "Avg Rank:",
|
|
8491
|
+
" ",
|
|
8492
|
+
/* @__PURE__ */ jsx("strong", { children: rk.averageRank ?? rk.avgRank ?? "-" }),
|
|
8493
|
+
" •",
|
|
8494
|
+
" ",
|
|
8495
|
+
tr ? "1. Sıra Tercihi:" : "#1 Votes:",
|
|
8496
|
+
" ",
|
|
8497
|
+
/* @__PURE__ */ jsxs("strong", { children: [
|
|
8498
|
+
rk.firstPlaceCount ?? rk.firstPlaceVotes ?? 0,
|
|
8499
|
+
" (",
|
|
8500
|
+
rk.firstPlacePercentage,
|
|
8501
|
+
"%)"
|
|
8502
|
+
] })
|
|
8443
8503
|
] })
|
|
8444
8504
|
] })
|
|
8445
|
-
] })
|
|
8446
|
-
] }),
|
|
8447
|
-
/* @__PURE__ */ jsxs("div", { style: { minWidth: 150, textAlign: "right" }, children: [
|
|
8448
|
-
/* @__PURE__ */ jsxs("div", { style: { fontSize: 11, fontWeight: 700, color: "#1e3a8a" }, children: [
|
|
8449
|
-
rk.bordaPoints,
|
|
8450
|
-
" ",
|
|
8451
|
-
tr ? "Borda Puanı" : "Borda pts"
|
|
8452
8505
|
] }),
|
|
8453
|
-
/* @__PURE__ */
|
|
8454
|
-
"div",
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
|
|
8459
|
-
|
|
8460
|
-
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
|
|
8469
|
-
|
|
8506
|
+
/* @__PURE__ */ jsxs("div", { style: { minWidth: 150, textAlign: "right" }, children: [
|
|
8507
|
+
/* @__PURE__ */ jsxs("div", { style: { fontSize: 11, fontWeight: 700, color: "#1e3a8a" }, children: [
|
|
8508
|
+
rk.bordaPoints,
|
|
8509
|
+
" ",
|
|
8510
|
+
tr ? "Borda Puanı" : "Borda pts"
|
|
8511
|
+
] }),
|
|
8512
|
+
/* @__PURE__ */ jsx(
|
|
8513
|
+
"div",
|
|
8514
|
+
{
|
|
8515
|
+
style: {
|
|
8516
|
+
height: 6,
|
|
8517
|
+
borderRadius: 4,
|
|
8518
|
+
background: "#e2e8f0",
|
|
8519
|
+
marginTop: 4,
|
|
8520
|
+
overflow: "hidden"
|
|
8521
|
+
},
|
|
8522
|
+
children: /* @__PURE__ */ jsx(
|
|
8523
|
+
"div",
|
|
8524
|
+
{
|
|
8525
|
+
style: {
|
|
8526
|
+
width: `${pct}%`,
|
|
8527
|
+
height: "100%",
|
|
8528
|
+
background: "#2563eb"
|
|
8529
|
+
}
|
|
8470
8530
|
}
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
)
|
|
8475
|
-
]
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
)
|
|
8480
|
-
|
|
8531
|
+
)
|
|
8532
|
+
}
|
|
8533
|
+
)
|
|
8534
|
+
] })
|
|
8535
|
+
]
|
|
8536
|
+
},
|
|
8537
|
+
rk.id
|
|
8538
|
+
);
|
|
8539
|
+
})
|
|
8540
|
+
] }),
|
|
8481
8541
|
qs.type === "consent" && /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 12 }, children: [
|
|
8482
8542
|
/* @__PURE__ */ jsx(
|
|
8483
8543
|
"div",
|
|
@@ -8911,6 +8971,18 @@ const SurveyLivePreviewPane = ({
|
|
|
8911
8971
|
}
|
|
8912
8972
|
if (generalError) setGeneralError("");
|
|
8913
8973
|
};
|
|
8974
|
+
const getNoOpinionLabel = (q) => pickTextForLocale(q.noOpinionLabel, testLocale, trTest ? "Fikrim yok" : "No idea");
|
|
8975
|
+
const clearOptionalQuestionAnswer = (q) => {
|
|
8976
|
+
if (q.type === "multiple_choice" || q.type === "image_choice" && (q.maxSelections ?? 1) > 1) {
|
|
8977
|
+
setAnswer(q.key, []);
|
|
8978
|
+
} else if (q.type === "matrix_single") {
|
|
8979
|
+
setAnswer(q.key, {});
|
|
8980
|
+
} else if (q.type === "short_text" || q.type === "long_text") {
|
|
8981
|
+
setAnswer(q.key, "");
|
|
8982
|
+
} else {
|
|
8983
|
+
setAnswer(q.key, null);
|
|
8984
|
+
}
|
|
8985
|
+
};
|
|
8914
8986
|
const validateTargetQuestions = (qs) => {
|
|
8915
8987
|
const nextErrs = {};
|
|
8916
8988
|
for (const q of qs) {
|
|
@@ -8937,11 +9009,12 @@ const SurveyLivePreviewPane = ({
|
|
|
8937
9009
|
}
|
|
8938
9010
|
} else if (q.type === "multiple_choice" || q.type === "image_choice" && (q.maxSelections ?? 1) > 1) {
|
|
8939
9011
|
const arr = Array.isArray(val) ? val : [];
|
|
9012
|
+
const isExclusiveNoOp = Boolean(q.allowNoOpinion && arr.includes("__na__"));
|
|
8940
9013
|
if (q.required && arr.length === 0) {
|
|
8941
9014
|
qErrs.push(
|
|
8942
9015
|
trTest ? "Lütfen en az bir seçenek işaretleyiniz." : "Please select at least one option."
|
|
8943
9016
|
);
|
|
8944
|
-
} else if (arr.length > 0) {
|
|
9017
|
+
} else if (arr.length > 0 && !isExclusiveNoOp) {
|
|
8945
9018
|
if (q.minSelections && arr.length < q.minSelections) {
|
|
8946
9019
|
qErrs.push(
|
|
8947
9020
|
trTest ? `En az ${q.minSelections} seçenek işaretlemelisiniz.` : `Please select at least ${q.minSelections} options.`
|
|
@@ -8953,7 +9026,7 @@ const SurveyLivePreviewPane = ({
|
|
|
8953
9026
|
);
|
|
8954
9027
|
}
|
|
8955
9028
|
}
|
|
8956
|
-
if (q.allowOther && arr.includes("__other__") && !String(otherTexts[q.key] || "").trim()) {
|
|
9029
|
+
if (!isExclusiveNoOp && q.allowOther && arr.includes("__other__") && !String(otherTexts[q.key] || "").trim()) {
|
|
8957
9030
|
qErrs.push(
|
|
8958
9031
|
trTest ? 'Lütfen "Diğer" seçeneği için açıklama giriniz.' : 'Please specify your "Other" choice.'
|
|
8959
9032
|
);
|
|
@@ -9530,7 +9603,7 @@ const SurveyLivePreviewPane = ({
|
|
|
9530
9603
|
) : /* @__PURE__ */ jsxs("div", { style: { fontSize: 12, color: "#334155", marginTop: 4 }, children: [
|
|
9531
9604
|
/* @__PURE__ */ jsx("strong", { children: trTest ? "Yanıtınız:" : "Your answer:" }),
|
|
9532
9605
|
" ",
|
|
9533
|
-
typeof ans === "object" ? JSON.stringify(ans) : String(ans ?? "—")
|
|
9606
|
+
ans === "__na__" || Array.isArray(ans) && ans[0] === "__na__" ? getNoOpinionLabel(q) : typeof ans === "object" ? JSON.stringify(ans) : String(ans ?? "—")
|
|
9534
9607
|
] })
|
|
9535
9608
|
]
|
|
9536
9609
|
},
|
|
@@ -9727,11 +9800,45 @@ const SurveyLivePreviewPane = ({
|
|
|
9727
9800
|
},
|
|
9728
9801
|
children: [
|
|
9729
9802
|
q.type !== "consent" && /* @__PURE__ */ jsxs("div", { style: { marginBottom: 10 }, children: [
|
|
9730
|
-
/* @__PURE__ */ jsxs(
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9803
|
+
/* @__PURE__ */ jsxs(
|
|
9804
|
+
"div",
|
|
9805
|
+
{
|
|
9806
|
+
style: {
|
|
9807
|
+
display: "flex",
|
|
9808
|
+
alignItems: "center",
|
|
9809
|
+
justifyContent: "space-between",
|
|
9810
|
+
gap: 8
|
|
9811
|
+
},
|
|
9812
|
+
children: [
|
|
9813
|
+
/* @__PURE__ */ jsxs("div", { style: { fontSize: 14.5, fontWeight: 700, color: "#0f172a" }, children: [
|
|
9814
|
+
qTitle,
|
|
9815
|
+
" ",
|
|
9816
|
+
q.required && /* @__PURE__ */ jsx("span", { style: { color: "#dc2626" }, children: "*" })
|
|
9817
|
+
] }),
|
|
9818
|
+
!q.required && q.type !== "ranking" && q.type !== "short_text" && q.type !== "long_text" && !isEmptyVal(val) && /* @__PURE__ */ jsxs(
|
|
9819
|
+
"button",
|
|
9820
|
+
{
|
|
9821
|
+
type: "button",
|
|
9822
|
+
onClick: () => clearOptionalQuestionAnswer(q),
|
|
9823
|
+
style: {
|
|
9824
|
+
border: "none",
|
|
9825
|
+
background: "transparent",
|
|
9826
|
+
color: "#64748b",
|
|
9827
|
+
fontSize: 11,
|
|
9828
|
+
fontWeight: 600,
|
|
9829
|
+
cursor: "pointer",
|
|
9830
|
+
padding: "2px 6px",
|
|
9831
|
+
flexShrink: 0
|
|
9832
|
+
},
|
|
9833
|
+
children: [
|
|
9834
|
+
"× ",
|
|
9835
|
+
trTest ? "Seçimi Temizle" : "Clear"
|
|
9836
|
+
]
|
|
9837
|
+
}
|
|
9838
|
+
)
|
|
9839
|
+
]
|
|
9840
|
+
}
|
|
9841
|
+
),
|
|
9735
9842
|
qDesc && /* @__PURE__ */ jsx("div", { style: { fontSize: 12, color: "#64748b", marginTop: 3 }, children: qDesc })
|
|
9736
9843
|
] }),
|
|
9737
9844
|
q.type === "single_choice" && /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
@@ -9812,6 +9919,36 @@ const SurveyLivePreviewPane = ({
|
|
|
9812
9919
|
) })
|
|
9813
9920
|
]
|
|
9814
9921
|
}
|
|
9922
|
+
),
|
|
9923
|
+
q.allowNoOpinion && /* @__PURE__ */ jsxs(
|
|
9924
|
+
"label",
|
|
9925
|
+
{
|
|
9926
|
+
style: {
|
|
9927
|
+
display: "inline-flex",
|
|
9928
|
+
alignItems: "center",
|
|
9929
|
+
gap: 9,
|
|
9930
|
+
padding: "9px 12px",
|
|
9931
|
+
borderRadius: 8,
|
|
9932
|
+
border: val === "__na__" ? "1.5px solid #475569" : "1px dashed #94a3b8",
|
|
9933
|
+
background: val === "__na__" ? "#f1f5f9" : "#ffffff",
|
|
9934
|
+
color: "#334155",
|
|
9935
|
+
fontSize: 13,
|
|
9936
|
+
fontWeight: val === "__na__" ? 700 : 500,
|
|
9937
|
+
cursor: "pointer"
|
|
9938
|
+
},
|
|
9939
|
+
children: [
|
|
9940
|
+
/* @__PURE__ */ jsx(
|
|
9941
|
+
"input",
|
|
9942
|
+
{
|
|
9943
|
+
type: "radio",
|
|
9944
|
+
name: `prev-${q.key}`,
|
|
9945
|
+
checked: val === "__na__",
|
|
9946
|
+
onChange: () => setAnswer(q.key, "__na__")
|
|
9947
|
+
}
|
|
9948
|
+
),
|
|
9949
|
+
/* @__PURE__ */ jsx("span", { children: getNoOpinionLabel(q) })
|
|
9950
|
+
]
|
|
9951
|
+
}
|
|
9815
9952
|
)
|
|
9816
9953
|
]
|
|
9817
9954
|
}
|
|
@@ -9869,7 +10006,8 @@ const SurveyLivePreviewPane = ({
|
|
|
9869
10006
|
type: "checkbox",
|
|
9870
10007
|
checked,
|
|
9871
10008
|
onChange: () => {
|
|
9872
|
-
const
|
|
10009
|
+
const cleaned = arr.filter((x) => x !== "__na__");
|
|
10010
|
+
const next = checked ? cleaned.filter((x) => x !== opt.id) : [...cleaned, opt.id];
|
|
9873
10011
|
setAnswer(q.key, next);
|
|
9874
10012
|
}
|
|
9875
10013
|
}
|
|
@@ -9907,7 +10045,8 @@ const SurveyLivePreviewPane = ({
|
|
|
9907
10045
|
type: "checkbox",
|
|
9908
10046
|
checked,
|
|
9909
10047
|
onChange: () => {
|
|
9910
|
-
const
|
|
10048
|
+
const cleaned = arr.filter((x) => x !== "__na__");
|
|
10049
|
+
const next = checked ? cleaned.filter((x) => x !== "__other__") : [...cleaned, "__other__"];
|
|
9911
10050
|
setAnswer(q.key, next);
|
|
9912
10051
|
}
|
|
9913
10052
|
}
|
|
@@ -9942,6 +10081,39 @@ const SurveyLivePreviewPane = ({
|
|
|
9942
10081
|
}
|
|
9943
10082
|
)
|
|
9944
10083
|
] });
|
|
10084
|
+
})(),
|
|
10085
|
+
q.allowNoOpinion && (() => {
|
|
10086
|
+
const arr = Array.isArray(val) ? val : [];
|
|
10087
|
+
const checked = arr.includes("__na__");
|
|
10088
|
+
return /* @__PURE__ */ jsxs(
|
|
10089
|
+
"label",
|
|
10090
|
+
{
|
|
10091
|
+
style: {
|
|
10092
|
+
display: "flex",
|
|
10093
|
+
alignItems: "center",
|
|
10094
|
+
gap: 9,
|
|
10095
|
+
padding: "9px 12px",
|
|
10096
|
+
borderRadius: 8,
|
|
10097
|
+
border: checked ? "1.5px solid #475569" : "1px dashed #94a3b8",
|
|
10098
|
+
background: checked ? "#f1f5f9" : "#ffffff",
|
|
10099
|
+
color: "#334155",
|
|
10100
|
+
fontSize: 13,
|
|
10101
|
+
fontWeight: checked ? 700 : 500,
|
|
10102
|
+
cursor: "pointer"
|
|
10103
|
+
},
|
|
10104
|
+
children: [
|
|
10105
|
+
/* @__PURE__ */ jsx(
|
|
10106
|
+
"input",
|
|
10107
|
+
{
|
|
10108
|
+
type: "checkbox",
|
|
10109
|
+
checked,
|
|
10110
|
+
onChange: () => setAnswer(q.key, checked ? [] : ["__na__"])
|
|
10111
|
+
}
|
|
10112
|
+
),
|
|
10113
|
+
/* @__PURE__ */ jsx("span", { children: getNoOpinionLabel(q) })
|
|
10114
|
+
]
|
|
10115
|
+
}
|
|
10116
|
+
);
|
|
9945
10117
|
})()
|
|
9946
10118
|
] }),
|
|
9947
10119
|
q.type === "dropdown" && /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
@@ -9966,7 +10138,8 @@ const SurveyLivePreviewPane = ({
|
|
|
9966
10138
|
q.otherLabel,
|
|
9967
10139
|
testLocale,
|
|
9968
10140
|
trTest ? "Diğer" : "Other"
|
|
9969
|
-
) })
|
|
10141
|
+
) }),
|
|
10142
|
+
q.allowNoOpinion && /* @__PURE__ */ jsx("option", { value: "__na__", children: getNoOpinionLabel(q) })
|
|
9970
10143
|
]
|
|
9971
10144
|
}
|
|
9972
10145
|
),
|
|
@@ -10010,7 +10183,7 @@ const SurveyLivePreviewPane = ({
|
|
|
10010
10183
|
{
|
|
10011
10184
|
onClick: () => {
|
|
10012
10185
|
if (isMultiImg) {
|
|
10013
|
-
const arr = Array.isArray(val) ? val : [];
|
|
10186
|
+
const arr = Array.isArray(val) ? val.filter((x) => x !== "__na__") : [];
|
|
10014
10187
|
const next = selected ? arr.filter((x) => x !== opt.id) : [...arr, opt.id];
|
|
10015
10188
|
setAnswer(q.key, next);
|
|
10016
10189
|
} else {
|
|
@@ -10174,7 +10347,7 @@ const SurveyLivePreviewPane = ({
|
|
|
10174
10347
|
starVal
|
|
10175
10348
|
);
|
|
10176
10349
|
}),
|
|
10177
|
-
val ? /* @__PURE__ */ jsxs(
|
|
10350
|
+
typeof val === "number" && val > 0 ? /* @__PURE__ */ jsxs(
|
|
10178
10351
|
"span",
|
|
10179
10352
|
{
|
|
10180
10353
|
style: {
|
|
@@ -10335,7 +10508,18 @@ const SurveyLivePreviewPane = ({
|
|
|
10335
10508
|
})(),
|
|
10336
10509
|
q.type === "matrix_single" && (() => {
|
|
10337
10510
|
const mRows = Array.isArray(q.matrixRows) ? q.matrixRows : [];
|
|
10338
|
-
const
|
|
10511
|
+
const baseCols = Array.isArray(q.matrixColumns) ? q.matrixColumns : [];
|
|
10512
|
+
const mCols = q.allowNoOpinion ? [
|
|
10513
|
+
...baseCols,
|
|
10514
|
+
{
|
|
10515
|
+
id: "__na__",
|
|
10516
|
+
labels: {
|
|
10517
|
+
tr: getNoOpinionLabel(q),
|
|
10518
|
+
en: getNoOpinionLabel(q),
|
|
10519
|
+
[testLocale]: getNoOpinionLabel(q)
|
|
10520
|
+
}
|
|
10521
|
+
}
|
|
10522
|
+
] : baseCols;
|
|
10339
10523
|
const matrixAns = val && typeof val === "object" && !Array.isArray(val) ? val : {};
|
|
10340
10524
|
return /* @__PURE__ */ jsx("div", { style: { overflowX: "auto" }, children: /* @__PURE__ */ jsxs(
|
|
10341
10525
|
"table",
|
|
@@ -10543,6 +10727,51 @@ const SurveyLivePreviewPane = ({
|
|
|
10543
10727
|
})
|
|
10544
10728
|
] });
|
|
10545
10729
|
})(),
|
|
10730
|
+
q.allowNoOpinion && ["nps", "star_rating", "likert_scale", "image_choice", "ranking"].includes(
|
|
10731
|
+
q.type
|
|
10732
|
+
) && (() => {
|
|
10733
|
+
const isMulti = q.type === "ranking" || q.type === "image_choice" && (q.maxSelections ?? 1) > 1;
|
|
10734
|
+
const isNoOpSelected = isMulti ? Array.isArray(val) && val.includes("__na__") : val === "__na__";
|
|
10735
|
+
return /* @__PURE__ */ jsx("div", { style: { marginTop: 10 }, children: /* @__PURE__ */ jsxs(
|
|
10736
|
+
"button",
|
|
10737
|
+
{
|
|
10738
|
+
type: "button",
|
|
10739
|
+
onClick: () => {
|
|
10740
|
+
if (isNoOpSelected) {
|
|
10741
|
+
if (q.type === "ranking") {
|
|
10742
|
+
setAnswer(
|
|
10743
|
+
q.key,
|
|
10744
|
+
(q.options || []).map((o) => o.id)
|
|
10745
|
+
);
|
|
10746
|
+
} else if (isMulti) {
|
|
10747
|
+
setAnswer(q.key, []);
|
|
10748
|
+
} else {
|
|
10749
|
+
setAnswer(q.key, null);
|
|
10750
|
+
}
|
|
10751
|
+
} else {
|
|
10752
|
+
setAnswer(q.key, isMulti ? ["__na__"] : "__na__");
|
|
10753
|
+
}
|
|
10754
|
+
},
|
|
10755
|
+
style: {
|
|
10756
|
+
padding: "6px 13px",
|
|
10757
|
+
borderRadius: 18,
|
|
10758
|
+
border: isNoOpSelected ? "1.5px solid #334155" : "1px dashed #94a3b8",
|
|
10759
|
+
background: isNoOpSelected ? "#334155" : "#f8fafc",
|
|
10760
|
+
color: isNoOpSelected ? "#ffffff" : "#475569",
|
|
10761
|
+
fontSize: 12,
|
|
10762
|
+
fontWeight: 700,
|
|
10763
|
+
cursor: "pointer",
|
|
10764
|
+
display: "inline-flex",
|
|
10765
|
+
alignItems: "center",
|
|
10766
|
+
gap: 6
|
|
10767
|
+
},
|
|
10768
|
+
children: [
|
|
10769
|
+
/* @__PURE__ */ jsx("span", { children: isNoOpSelected ? "✓" : "○" }),
|
|
10770
|
+
/* @__PURE__ */ jsx("span", { children: getNoOpinionLabel(q) })
|
|
10771
|
+
]
|
|
10772
|
+
}
|
|
10773
|
+
) });
|
|
10774
|
+
})(),
|
|
10546
10775
|
q.type === "short_text" && /* @__PURE__ */ jsx(
|
|
10547
10776
|
"input",
|
|
10548
10777
|
{
|
|
@@ -12336,22 +12565,25 @@ const labelStyle = {
|
|
|
12336
12565
|
color: "#475569",
|
|
12337
12566
|
marginBottom: 4
|
|
12338
12567
|
};
|
|
12568
|
+
const TURKISH_CHAR_MAP = {
|
|
12569
|
+
ç: "c",
|
|
12570
|
+
Ç: "c",
|
|
12571
|
+
ğ: "g",
|
|
12572
|
+
Ğ: "g",
|
|
12573
|
+
ı: "i",
|
|
12574
|
+
İ: "i",
|
|
12575
|
+
ö: "o",
|
|
12576
|
+
Ö: "o",
|
|
12577
|
+
ş: "s",
|
|
12578
|
+
Ş: "s",
|
|
12579
|
+
ü: "u",
|
|
12580
|
+
Ü: "u"
|
|
12581
|
+
};
|
|
12582
|
+
function sanitizeSlugInput(input) {
|
|
12583
|
+
return String(input || "").replace(/[çÇğĞıİöÖşŞüÜ]/g, (ch) => TURKISH_CHAR_MAP[ch] || ch).toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9_-]/g, "");
|
|
12584
|
+
}
|
|
12339
12585
|
function slugifyKey(input) {
|
|
12340
|
-
|
|
12341
|
-
ç: "c",
|
|
12342
|
-
Ç: "c",
|
|
12343
|
-
ğ: "g",
|
|
12344
|
-
Ğ: "g",
|
|
12345
|
-
ı: "i",
|
|
12346
|
-
İ: "i",
|
|
12347
|
-
ö: "o",
|
|
12348
|
-
Ö: "o",
|
|
12349
|
-
ş: "s",
|
|
12350
|
-
Ş: "s",
|
|
12351
|
-
ü: "u",
|
|
12352
|
-
Ü: "u"
|
|
12353
|
-
};
|
|
12354
|
-
return String(input || "").replace(/[çÇğĞıİöÖşŞüÜ]/g, (ch) => map[ch] || ch).toLowerCase().replace(/[^a-z0-9_]+/g, "_").replace(/^_+|_+$/g, "");
|
|
12586
|
+
return String(input || "").replace(/[çÇğĞıİöÖşŞüÜ]/g, (ch) => TURKISH_CHAR_MAP[ch] || ch).toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/-{2,}/g, "-").replace(/_{2,}/g, "_").replace(/^[-_]+|[-_]+$/g, "");
|
|
12355
12587
|
}
|
|
12356
12588
|
const LIKERT_SCALE_PRESETS = [
|
|
12357
12589
|
{
|
|
@@ -12457,13 +12689,14 @@ const QUESTION_TYPES_CATALOG = [
|
|
|
12457
12689
|
function createBlankSurveyDraft(locale = "en") {
|
|
12458
12690
|
const tr = locale === "tr";
|
|
12459
12691
|
const ts = Date.now().toString(36).slice(-4);
|
|
12692
|
+
const initialTitle = tr ? "Yeni Müşteri Geri Bildirim Anketi" : "New Customer Feedback Survey";
|
|
12460
12693
|
return {
|
|
12461
|
-
title:
|
|
12694
|
+
title: initialTitle,
|
|
12462
12695
|
titleI18n: {
|
|
12463
12696
|
en: "New Customer Feedback Survey",
|
|
12464
12697
|
tr: "Yeni Müşteri Geri Bildirim Anketi"
|
|
12465
12698
|
},
|
|
12466
|
-
slug:
|
|
12699
|
+
slug: `${slugifyKey(initialTitle)}-${ts}`,
|
|
12467
12700
|
description: {
|
|
12468
12701
|
tr: "Görüşleriniz hizmet kalitemizi geliştirmemize yardımcı olur.",
|
|
12469
12702
|
en: "Your feedback helps us improve our service quality."
|
|
@@ -12600,6 +12833,9 @@ const SurveyStudioModal = ({
|
|
|
12600
12833
|
const [dropIndicator, setDropIndicator] = useState(null);
|
|
12601
12834
|
const [saving, setSaving] = useState(false);
|
|
12602
12835
|
const [statusMsg, setStatusMsg] = useState("");
|
|
12836
|
+
const [slugAutoSync, setSlugAutoSync] = useState(
|
|
12837
|
+
() => !initialSurvey.id && !initialSurvey.documentId && !initialSurvey._id
|
|
12838
|
+
);
|
|
12603
12839
|
const [optDragReadyIdx, setOptDragReadyIdx] = useState(null);
|
|
12604
12840
|
const [studioExportOpen, setStudioExportOpen] = useState(false);
|
|
12605
12841
|
const [studioImportOpen, setStudioImportOpen] = useState(false);
|
|
@@ -12618,6 +12854,7 @@ const SurveyStudioModal = ({
|
|
|
12618
12854
|
const cloned = JSON.parse(JSON.stringify(initialSurvey));
|
|
12619
12855
|
const nextDraft = cloned.displayMode === "multi_step" ? normalizeMultiStepDraft(cloned) : cloned;
|
|
12620
12856
|
setDraft(nextDraft);
|
|
12857
|
+
setSlugAutoSync(!cloned.id && !cloned.documentId && !cloned._id);
|
|
12621
12858
|
setSelectedQuestionIdx(0);
|
|
12622
12859
|
setCollapsedStepIds({});
|
|
12623
12860
|
setOpenStepDescIds({});
|
|
@@ -12689,14 +12926,17 @@ const SurveyStudioModal = ({
|
|
|
12689
12926
|
setSaving(true);
|
|
12690
12927
|
setStatusMsg("");
|
|
12691
12928
|
try {
|
|
12929
|
+
const cleanFinalSlug = slugifyKey(draft.slug) || slugifyKey(draft.title) || `survey-${Date.now().toString(36).slice(-4)}`;
|
|
12692
12930
|
const payload = {
|
|
12693
12931
|
...draft,
|
|
12932
|
+
slug: cleanFinalSlug,
|
|
12694
12933
|
id: draft.documentId || draft._id || draft.id
|
|
12695
12934
|
};
|
|
12696
12935
|
const res = await post("/content-input/surveys", payload);
|
|
12697
12936
|
const saved = res?.data;
|
|
12698
12937
|
if (saved) {
|
|
12699
12938
|
setDraft(JSON.parse(JSON.stringify(saved)));
|
|
12939
|
+
setSlugAutoSync(false);
|
|
12700
12940
|
setStatusMsg(tr ? "Anket kaydedildi!" : "Survey saved!");
|
|
12701
12941
|
if (typeof window !== "undefined") {
|
|
12702
12942
|
window.dispatchEvent(new CustomEvent("ci-survey-updated", { detail: saved }));
|
|
@@ -12777,27 +13017,35 @@ const SurveyStudioModal = ({
|
|
|
12777
13017
|
children: [
|
|
12778
13018
|
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
|
|
12779
13019
|
/* @__PURE__ */ jsx(MaterialIcon, { name: "poll", size: 22, color: "#38bdf8" }),
|
|
12780
|
-
/* @__PURE__ */ jsxs(
|
|
12781
|
-
|
|
12782
|
-
|
|
12783
|
-
|
|
12784
|
-
" ",
|
|
12785
|
-
|
|
12786
|
-
|
|
12787
|
-
|
|
12788
|
-
|
|
12789
|
-
|
|
12790
|
-
|
|
12791
|
-
|
|
12792
|
-
|
|
12793
|
-
|
|
12794
|
-
|
|
12795
|
-
|
|
12796
|
-
|
|
12797
|
-
|
|
12798
|
-
|
|
12799
|
-
|
|
12800
|
-
|
|
13020
|
+
/* @__PURE__ */ jsxs(
|
|
13021
|
+
"div",
|
|
13022
|
+
{
|
|
13023
|
+
onClick: () => setTab("settings"),
|
|
13024
|
+
title: tr ? "Yönetim başlığını ve Survey Slug alanını düzenlemek için tıklayın" : "Click to edit Internal Title & Survey Slug",
|
|
13025
|
+
style: { cursor: "pointer" },
|
|
13026
|
+
children: [
|
|
13027
|
+
/* @__PURE__ */ jsxs("div", { style: { fontSize: 15, fontWeight: 700 }, children: [
|
|
13028
|
+
tr ? "Kurumsal Anket & Oylama Stüdyosu" : "Enterprise Survey & Poll Studio",
|
|
13029
|
+
" —",
|
|
13030
|
+
" ",
|
|
13031
|
+
/* @__PURE__ */ jsx("span", { style: { color: "#93c5fd", textDecoration: "underline dotted" }, children: draft.title })
|
|
13032
|
+
] }),
|
|
13033
|
+
/* @__PURE__ */ jsxs("div", { style: { fontSize: 11, color: "#94a3b8" }, children: [
|
|
13034
|
+
"Slug: ",
|
|
13035
|
+
/* @__PURE__ */ jsx("code", { children: draft.slug }),
|
|
13036
|
+
" • Mode: ",
|
|
13037
|
+
/* @__PURE__ */ jsx("code", { children: draft.displayMode }),
|
|
13038
|
+
" • Submit:",
|
|
13039
|
+
" ",
|
|
13040
|
+
/* @__PURE__ */ jsxs("code", { children: [
|
|
13041
|
+
"/api/content-input/surveys/",
|
|
13042
|
+
draft.slug,
|
|
13043
|
+
"/submit"
|
|
13044
|
+
] })
|
|
13045
|
+
] })
|
|
13046
|
+
]
|
|
13047
|
+
}
|
|
13048
|
+
)
|
|
12801
13049
|
] }),
|
|
12802
13050
|
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
12803
13051
|
statusMsg && /* @__PURE__ */ jsx(
|
|
@@ -14531,7 +14779,10 @@ const SurveyStudioModal = ({
|
|
|
14531
14779
|
type: "text",
|
|
14532
14780
|
value: activeQ.key,
|
|
14533
14781
|
onChange: (e) => updateActiveQuestion({
|
|
14534
|
-
key:
|
|
14782
|
+
key: sanitizeSlugInput(e.target.value)
|
|
14783
|
+
}),
|
|
14784
|
+
onBlur: (e) => updateActiveQuestion({
|
|
14785
|
+
key: slugifyKey(e.target.value) || `q_${activeQ.type}_${selectedQuestionIdx + 1}`
|
|
14535
14786
|
}),
|
|
14536
14787
|
style: { ...inputStyle, fontFamily: "monospace" }
|
|
14537
14788
|
}
|
|
@@ -14644,6 +14895,121 @@ const SurveyStudioModal = ({
|
|
|
14644
14895
|
)
|
|
14645
14896
|
] });
|
|
14646
14897
|
})(),
|
|
14898
|
+
[
|
|
14899
|
+
"single_choice",
|
|
14900
|
+
"multiple_choice",
|
|
14901
|
+
"dropdown",
|
|
14902
|
+
"image_choice",
|
|
14903
|
+
"nps",
|
|
14904
|
+
"star_rating",
|
|
14905
|
+
"likert_scale",
|
|
14906
|
+
"matrix_single",
|
|
14907
|
+
"ranking"
|
|
14908
|
+
].includes(activeQ.type) && (() => {
|
|
14909
|
+
const noOpObj = normalizeLocalizedRecord(
|
|
14910
|
+
activeQ.noOpinionLabel,
|
|
14911
|
+
strapiLocales,
|
|
14912
|
+
{
|
|
14913
|
+
tr: "Fikrim yok",
|
|
14914
|
+
en: "No idea"
|
|
14915
|
+
}
|
|
14916
|
+
);
|
|
14917
|
+
return /* @__PURE__ */ jsxs(
|
|
14918
|
+
"div",
|
|
14919
|
+
{
|
|
14920
|
+
style: {
|
|
14921
|
+
padding: "10px 12px",
|
|
14922
|
+
borderRadius: 8,
|
|
14923
|
+
background: activeQ.allowNoOpinion ? "#f0fdf4" : "#f8fafc",
|
|
14924
|
+
border: activeQ.allowNoOpinion ? "1px solid #86efac" : "1px solid #e2e8f0",
|
|
14925
|
+
display: "flex",
|
|
14926
|
+
flexDirection: "column",
|
|
14927
|
+
gap: 8
|
|
14928
|
+
},
|
|
14929
|
+
children: [
|
|
14930
|
+
/* @__PURE__ */ jsxs(
|
|
14931
|
+
"div",
|
|
14932
|
+
{
|
|
14933
|
+
style: {
|
|
14934
|
+
display: "flex",
|
|
14935
|
+
alignItems: "center",
|
|
14936
|
+
justifyContent: "space-between",
|
|
14937
|
+
flexWrap: "wrap",
|
|
14938
|
+
gap: 8
|
|
14939
|
+
},
|
|
14940
|
+
children: [
|
|
14941
|
+
/* @__PURE__ */ jsxs(
|
|
14942
|
+
"label",
|
|
14943
|
+
{
|
|
14944
|
+
style: {
|
|
14945
|
+
display: "inline-flex",
|
|
14946
|
+
alignItems: "center",
|
|
14947
|
+
gap: 7,
|
|
14948
|
+
fontSize: 11.5,
|
|
14949
|
+
fontWeight: 700,
|
|
14950
|
+
color: "#0f172a",
|
|
14951
|
+
cursor: "pointer"
|
|
14952
|
+
},
|
|
14953
|
+
children: [
|
|
14954
|
+
/* @__PURE__ */ jsx(
|
|
14955
|
+
"input",
|
|
14956
|
+
{
|
|
14957
|
+
type: "checkbox",
|
|
14958
|
+
checked: Boolean(activeQ.allowNoOpinion),
|
|
14959
|
+
onChange: (e) => {
|
|
14960
|
+
const enabled = e.target.checked;
|
|
14961
|
+
updateActiveQuestion({
|
|
14962
|
+
allowNoOpinion: enabled,
|
|
14963
|
+
...enabled && !activeQ.noOpinionLabel ? { noOpinionLabel: noOpObj } : {}
|
|
14964
|
+
});
|
|
14965
|
+
}
|
|
14966
|
+
}
|
|
14967
|
+
),
|
|
14968
|
+
/* @__PURE__ */ jsx("span", { children: tr ? '"Fikrim yok / Bilmiyorum" (No idea / N/A) Seçeneği Sun' : 'Allow "No idea / N/A" (No Opinion) Option' })
|
|
14969
|
+
]
|
|
14970
|
+
}
|
|
14971
|
+
),
|
|
14972
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: 10.5, color: "#64748b" }, children: tr ? "Zorunlu soruyu geçer; ölçek/puan ortalamasını ve NPS skorunu bozmaz" : "Satisfies required rule without skewing score averages or NPS" })
|
|
14973
|
+
]
|
|
14974
|
+
}
|
|
14975
|
+
),
|
|
14976
|
+
activeQ.allowNoOpinion && /* @__PURE__ */ jsx(
|
|
14977
|
+
"div",
|
|
14978
|
+
{
|
|
14979
|
+
style: {
|
|
14980
|
+
display: "grid",
|
|
14981
|
+
gridTemplateColumns: localeGridCols,
|
|
14982
|
+
gap: 8
|
|
14983
|
+
},
|
|
14984
|
+
children: strapiLocales.map((loc) => /* @__PURE__ */ jsxs("div", { children: [
|
|
14985
|
+
/* @__PURE__ */ jsxs("label", { style: labelStyle, children: [
|
|
14986
|
+
tr ? "Boş / Fikrim Yok Etiketi" : "No-Opinion Label",
|
|
14987
|
+
" (",
|
|
14988
|
+
loc.code.toUpperCase(),
|
|
14989
|
+
")"
|
|
14990
|
+
] }),
|
|
14991
|
+
/* @__PURE__ */ jsx(
|
|
14992
|
+
"input",
|
|
14993
|
+
{
|
|
14994
|
+
type: "text",
|
|
14995
|
+
value: noOpObj[loc.code] || "",
|
|
14996
|
+
onChange: (e) => updateActiveQuestion({
|
|
14997
|
+
noOpinionLabel: {
|
|
14998
|
+
...noOpObj,
|
|
14999
|
+
[loc.code]: e.target.value
|
|
15000
|
+
}
|
|
15001
|
+
}),
|
|
15002
|
+
placeholder: loc.code.toLowerCase().startsWith("tr") ? "Fikrim yok" : "No idea",
|
|
15003
|
+
style: inputStyle
|
|
15004
|
+
}
|
|
15005
|
+
)
|
|
15006
|
+
] }, `noop-${loc.code}`))
|
|
15007
|
+
}
|
|
15008
|
+
)
|
|
15009
|
+
]
|
|
15010
|
+
}
|
|
15011
|
+
);
|
|
15012
|
+
})(),
|
|
14647
15013
|
[
|
|
14648
15014
|
"single_choice",
|
|
14649
15015
|
"multiple_choice",
|
|
@@ -14831,7 +15197,16 @@ const SurveyStudioModal = ({
|
|
|
14831
15197
|
value: opt.id,
|
|
14832
15198
|
onChange: (e) => {
|
|
14833
15199
|
const next = opts.map(
|
|
14834
|
-
(x, i) => i === oIdx ? { ...x, id:
|
|
15200
|
+
(x, i) => i === oIdx ? { ...x, id: sanitizeSlugInput(e.target.value) } : x
|
|
15201
|
+
);
|
|
15202
|
+
saveOpts(next);
|
|
15203
|
+
},
|
|
15204
|
+
onBlur: (e) => {
|
|
15205
|
+
const next = opts.map(
|
|
15206
|
+
(x, i) => i === oIdx ? {
|
|
15207
|
+
...x,
|
|
15208
|
+
id: slugifyKey(e.target.value) || `opt_${oIdx + 1}`
|
|
15209
|
+
} : x
|
|
14835
15210
|
);
|
|
14836
15211
|
saveOpts(next);
|
|
14837
15212
|
},
|
|
@@ -14899,7 +15274,7 @@ const SurveyStudioModal = ({
|
|
|
14899
15274
|
) })
|
|
14900
15275
|
]
|
|
14901
15276
|
},
|
|
14902
|
-
|
|
15277
|
+
oIdx
|
|
14903
15278
|
);
|
|
14904
15279
|
}),
|
|
14905
15280
|
/* @__PURE__ */ jsx(
|
|
@@ -15403,7 +15778,16 @@ const SurveyStudioModal = ({
|
|
|
15403
15778
|
value: r.id,
|
|
15404
15779
|
onChange: (e) => {
|
|
15405
15780
|
const next = mRows.map(
|
|
15406
|
-
(x, i) => i === rIdx ? { ...x, id:
|
|
15781
|
+
(x, i) => i === rIdx ? { ...x, id: sanitizeSlugInput(e.target.value) } : x
|
|
15782
|
+
);
|
|
15783
|
+
updateActiveQuestion({ matrixRows: next });
|
|
15784
|
+
},
|
|
15785
|
+
onBlur: (e) => {
|
|
15786
|
+
const next = mRows.map(
|
|
15787
|
+
(x, i) => i === rIdx ? {
|
|
15788
|
+
...x,
|
|
15789
|
+
id: slugifyKey(e.target.value) || `row_${rIdx + 1}`
|
|
15790
|
+
} : x
|
|
15407
15791
|
);
|
|
15408
15792
|
updateActiveQuestion({ matrixRows: next });
|
|
15409
15793
|
},
|
|
@@ -15446,7 +15830,7 @@ const SurveyStudioModal = ({
|
|
|
15446
15830
|
)
|
|
15447
15831
|
]
|
|
15448
15832
|
},
|
|
15449
|
-
|
|
15833
|
+
rIdx
|
|
15450
15834
|
);
|
|
15451
15835
|
})
|
|
15452
15836
|
] }),
|
|
@@ -15514,7 +15898,16 @@ const SurveyStudioModal = ({
|
|
|
15514
15898
|
value: c.id,
|
|
15515
15899
|
onChange: (e) => {
|
|
15516
15900
|
const next = mCols.map(
|
|
15517
|
-
(x, i) => i === cIdx ? { ...x, id:
|
|
15901
|
+
(x, i) => i === cIdx ? { ...x, id: sanitizeSlugInput(e.target.value) } : x
|
|
15902
|
+
);
|
|
15903
|
+
updateActiveQuestion({ matrixColumns: next });
|
|
15904
|
+
},
|
|
15905
|
+
onBlur: (e) => {
|
|
15906
|
+
const next = mCols.map(
|
|
15907
|
+
(x, i) => i === cIdx ? {
|
|
15908
|
+
...x,
|
|
15909
|
+
id: slugifyKey(e.target.value) || `col_${cIdx + 1}`
|
|
15910
|
+
} : x
|
|
15518
15911
|
);
|
|
15519
15912
|
updateActiveQuestion({ matrixColumns: next });
|
|
15520
15913
|
},
|
|
@@ -15557,7 +15950,7 @@ const SurveyStudioModal = ({
|
|
|
15557
15950
|
)
|
|
15558
15951
|
]
|
|
15559
15952
|
},
|
|
15560
|
-
|
|
15953
|
+
cIdx
|
|
15561
15954
|
);
|
|
15562
15955
|
})
|
|
15563
15956
|
] })
|
|
@@ -15781,25 +16174,102 @@ const SurveyStudioModal = ({
|
|
|
15781
16174
|
/* @__PURE__ */ jsx("div", { style: { fontSize: 13, fontWeight: 700, color: "#0f172a" }, children: tr ? "Anket Kimliği & Çok Dilli Başlıklar" : "Survey Identity & Localized Titles" }),
|
|
15782
16175
|
/* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 10 }, children: [
|
|
15783
16176
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
15784
|
-
/* @__PURE__ */ jsx("label", { style: labelStyle, children: tr ? "Yönetim Başlığı" : "Internal Title" }),
|
|
16177
|
+
/* @__PURE__ */ jsx("label", { style: labelStyle, children: tr ? "Yönetim Başlığı (Internal Title)" : "Survey Internal Title" }),
|
|
15785
16178
|
/* @__PURE__ */ jsx(
|
|
15786
16179
|
"input",
|
|
15787
16180
|
{
|
|
15788
16181
|
type: "text",
|
|
15789
16182
|
value: draft.title,
|
|
15790
|
-
onChange: (e) =>
|
|
16183
|
+
onChange: (e) => {
|
|
16184
|
+
const nextTitle = e.target.value;
|
|
16185
|
+
setDraft((prev) => ({
|
|
16186
|
+
...prev,
|
|
16187
|
+
title: nextTitle,
|
|
16188
|
+
...slugAutoSync ? { slug: slugifyKey(nextTitle) } : {}
|
|
16189
|
+
}));
|
|
16190
|
+
},
|
|
16191
|
+
placeholder: tr ? "Örn: 2026 Müşteri Nabzı Anketi" : "e.g. 2026 Customer Pulse Survey",
|
|
15791
16192
|
style: inputStyle
|
|
15792
16193
|
}
|
|
15793
16194
|
)
|
|
15794
16195
|
] }),
|
|
15795
16196
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
15796
|
-
/* @__PURE__ */
|
|
16197
|
+
/* @__PURE__ */ jsxs(
|
|
16198
|
+
"div",
|
|
16199
|
+
{
|
|
16200
|
+
style: {
|
|
16201
|
+
display: "flex",
|
|
16202
|
+
alignItems: "center",
|
|
16203
|
+
justifyContent: "space-between",
|
|
16204
|
+
gap: 6,
|
|
16205
|
+
marginBottom: 4
|
|
16206
|
+
},
|
|
16207
|
+
children: [
|
|
16208
|
+
/* @__PURE__ */ jsxs("label", { style: { ...labelStyle, marginBottom: 0 }, children: [
|
|
16209
|
+
"Survey Slug",
|
|
16210
|
+
" ",
|
|
16211
|
+
/* @__PURE__ */ jsx(
|
|
16212
|
+
"span",
|
|
16213
|
+
{
|
|
16214
|
+
style: {
|
|
16215
|
+
fontSize: 9.5,
|
|
16216
|
+
fontWeight: 700,
|
|
16217
|
+
padding: "1px 6px",
|
|
16218
|
+
borderRadius: 8,
|
|
16219
|
+
marginLeft: 4,
|
|
16220
|
+
background: slugAutoSync ? "#dbeafe" : "#f1f5f9",
|
|
16221
|
+
color: slugAutoSync ? "#1e40af" : "#475569"
|
|
16222
|
+
},
|
|
16223
|
+
children: slugAutoSync ? tr ? "Otomatik" : "Auto" : tr ? "Özel" : "Custom"
|
|
16224
|
+
}
|
|
16225
|
+
)
|
|
16226
|
+
] }),
|
|
16227
|
+
/* @__PURE__ */ jsx(
|
|
16228
|
+
"button",
|
|
16229
|
+
{
|
|
16230
|
+
type: "button",
|
|
16231
|
+
onClick: () => {
|
|
16232
|
+
const generated = slugifyKey(draft.title);
|
|
16233
|
+
setDraft((prev) => ({
|
|
16234
|
+
...prev,
|
|
16235
|
+
slug: generated || prev.slug
|
|
16236
|
+
}));
|
|
16237
|
+
setSlugAutoSync(true);
|
|
16238
|
+
},
|
|
16239
|
+
title: tr ? "Yönetim Başlığından (Internal Title) otomatik slug üret ve senkronla" : "Generate slug from Internal Title and keep synced",
|
|
16240
|
+
style: {
|
|
16241
|
+
padding: "1px 7px",
|
|
16242
|
+
borderRadius: 5,
|
|
16243
|
+
border: "1px solid #93c5fd",
|
|
16244
|
+
background: "#eff6ff",
|
|
16245
|
+
color: "#1d4ed8",
|
|
16246
|
+
fontSize: 10,
|
|
16247
|
+
fontWeight: 700,
|
|
16248
|
+
cursor: "pointer"
|
|
16249
|
+
},
|
|
16250
|
+
children: tr ? "↻ Başlıktan Üret" : "↻ From Title"
|
|
16251
|
+
}
|
|
16252
|
+
)
|
|
16253
|
+
]
|
|
16254
|
+
}
|
|
16255
|
+
),
|
|
15797
16256
|
/* @__PURE__ */ jsx(
|
|
15798
16257
|
"input",
|
|
15799
16258
|
{
|
|
15800
16259
|
type: "text",
|
|
15801
16260
|
value: draft.slug,
|
|
15802
|
-
onChange: (e) =>
|
|
16261
|
+
onChange: (e) => {
|
|
16262
|
+
setSlugAutoSync(false);
|
|
16263
|
+
setDraft((prev) => ({
|
|
16264
|
+
...prev,
|
|
16265
|
+
slug: sanitizeSlugInput(e.target.value)
|
|
16266
|
+
}));
|
|
16267
|
+
},
|
|
16268
|
+
onBlur: (e) => {
|
|
16269
|
+
const cleaned = slugifyKey(e.target.value) || slugifyKey(draft.title) || `survey-${Date.now().toString(36).slice(-4)}`;
|
|
16270
|
+
setDraft((prev) => ({ ...prev, slug: cleaned }));
|
|
16271
|
+
},
|
|
16272
|
+
placeholder: "ornek-anket_2026",
|
|
15803
16273
|
style: { ...inputStyle, fontFamily: "monospace" }
|
|
15804
16274
|
}
|
|
15805
16275
|
)
|