@ozguraltan/strapi-content-input 1.0.25 → 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-0fb7chuv.js → AnalyticsHubPage-CHlhvUIU.js} +2 -2
- package/dist/admin/{AnalyticsHubPage-BO6Lg1qh.mjs → AnalyticsHubPage-Crz4vv46.mjs} +2 -2
- package/dist/admin/{ContentInputField-C-fh5qGC.mjs → ContentInputField-BeKDx_bb.mjs} +2 -2
- package/dist/admin/{ContentInputField-CnVzTBNf.js → ContentInputField-CNWVLuRt.js} +2 -2
- package/dist/admin/{SurveyWidgetEditor-DNDtKbmo.js → SurveyWidgetEditor-BTipBBEU.js} +447 -103
- package/dist/admin/{SurveyWidgetEditor-DdZBpfbS.mjs → SurveyWidgetEditor-GKRT3eHj.mjs} +447 -103
- package/dist/admin/{index-BdrFmPg5.mjs → index-DSDcG4QW.mjs} +2 -2
- package/dist/admin/{index--fSIDKkt.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 +129 -22
- package/dist/server/index.mjs +129 -22
- 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
|
{
|
|
@@ -14666,6 +14895,121 @@ const SurveyStudioModal = ({
|
|
|
14666
14895
|
)
|
|
14667
14896
|
] });
|
|
14668
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
|
+
})(),
|
|
14669
15013
|
[
|
|
14670
15014
|
"single_choice",
|
|
14671
15015
|
"multiple_choice",
|