pxengine 0.1.90 → 0.1.91
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/dist/index.cjs +12 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.mjs +12 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -41424,6 +41424,7 @@ var MCQCard = import_react82.default.memo(
|
|
|
41424
41424
|
onAction,
|
|
41425
41425
|
disabled = false,
|
|
41426
41426
|
disableContinueInDiscovery,
|
|
41427
|
+
theme,
|
|
41427
41428
|
// Self-contained props
|
|
41428
41429
|
sessionId,
|
|
41429
41430
|
sendMessage,
|
|
@@ -41433,8 +41434,7 @@ var MCQCard = import_react82.default.memo(
|
|
|
41433
41434
|
}) => {
|
|
41434
41435
|
const resolvedQuestion = question || allProps.Question || allProps.q || "";
|
|
41435
41436
|
const resolvedOptions = options || allProps.Options || allProps.opts || {};
|
|
41436
|
-
const
|
|
41437
|
-
console.log("[MCQCard] FULL PROPS:", { allProps, resolvedQuestion, resolvedOptions: Object.keys(resolvedOptions || {}), resolvedRecommended });
|
|
41437
|
+
const t = th(theme);
|
|
41438
41438
|
const [selectedOption, setSelectedOption] = import_react82.default.useState(propsSelectedOption);
|
|
41439
41439
|
const [isProceeded, setIsProceeded] = import_react82.default.useState(false);
|
|
41440
41440
|
const fetchedSessionRef = import_react82.default.useRef("");
|
|
@@ -41459,24 +41459,20 @@ var MCQCard = import_react82.default.memo(
|
|
|
41459
41459
|
if (propsSelectedOption) return;
|
|
41460
41460
|
fetchedSessionRef.current = fetchKey;
|
|
41461
41461
|
const questionKey = buildQuestionKey(sessionId, resolvedQuestion);
|
|
41462
|
-
console.log("[MCQCard] Fetching with key:", questionKey, "(question:", resolvedQuestion, ")");
|
|
41463
41462
|
fetchSelections(sessionId).then((selections) => {
|
|
41464
|
-
console.log("[MCQCard] Got selections:", selections);
|
|
41465
41463
|
const stored = selections[questionKey] || selections[resolvedQuestion] || selections[`mcq_${sessionId}`];
|
|
41466
41464
|
if (stored) {
|
|
41467
|
-
console.log("[MCQCard] Setting selected:", stored);
|
|
41468
41465
|
setSelectedOption(stored);
|
|
41469
41466
|
setIsProceeded(true);
|
|
41470
41467
|
}
|
|
41471
|
-
}).catch((
|
|
41468
|
+
}).catch(() => {
|
|
41469
|
+
});
|
|
41472
41470
|
}, [sessionId, propsSelectedOption, resolvedQuestion, buildQuestionKey]);
|
|
41473
41471
|
const isDiscovery = disableContinueInDiscovery !== void 0 ? disableContinueInDiscovery : typeof window !== "undefined" && window.location.pathname.includes("creator-discovery");
|
|
41474
41472
|
const handleOptionClick = (key, e) => {
|
|
41475
41473
|
e.preventDefault();
|
|
41476
41474
|
e.stopPropagation();
|
|
41477
|
-
console.log("[MCQCard] Option clicked:", key, "Can select:", isLatestMessage && !isLoading && !disabled && !isProceeded);
|
|
41478
41475
|
if (isLatestMessage && !isLoading && !disabled && !isProceeded) {
|
|
41479
|
-
console.log("[MCQCard] Setting selected to:", key);
|
|
41480
41476
|
setSelectedOption(key);
|
|
41481
41477
|
onSelect?.(key);
|
|
41482
41478
|
}
|
|
@@ -41494,7 +41490,6 @@ var MCQCard = import_react82.default.memo(
|
|
|
41494
41490
|
setIsProceeded(true);
|
|
41495
41491
|
if (sessionId && resolvedQuestion) {
|
|
41496
41492
|
const questionKey = buildQuestionKey(sessionId, resolvedQuestion);
|
|
41497
|
-
console.log("[MCQCard] Persisting:", questionKey, result);
|
|
41498
41493
|
await persistSelection(sessionId, questionKey, result);
|
|
41499
41494
|
}
|
|
41500
41495
|
if (sendMessage) {
|
|
@@ -41522,8 +41517,9 @@ A: ${label}`);
|
|
|
41522
41517
|
"p-4 rounded-lg border border-gray400 bg-cardSurface w-full",
|
|
41523
41518
|
className
|
|
41524
41519
|
),
|
|
41520
|
+
style: t.root,
|
|
41525
41521
|
children: [
|
|
41526
|
-
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { className: "mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("p", { className: "text-sm text-cardText", children: resolvedQuestion || "Select an option:" }) }),
|
|
41522
|
+
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { className: "mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("p", { className: "text-sm text-cardText", style: t.text, children: resolvedQuestion || "Select an option:" }) }),
|
|
41527
41523
|
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { className: "space-y-2.5 mb-4", children: optionsEntries.map(([key, label]) => {
|
|
41528
41524
|
const isSelected = selectedOption === key;
|
|
41529
41525
|
const isRecommended = key === recommended;
|
|
@@ -41538,6 +41534,7 @@ A: ${label}`);
|
|
|
41538
41534
|
!selectedOption && !isOptionsDisabled && "hover:border-gray500",
|
|
41539
41535
|
(isLoading || isOptionsDisabled) && "opacity-50 cursor-not-allowed"
|
|
41540
41536
|
),
|
|
41537
|
+
style: isSelected ? { ...t.surface, ...t.accentBorder } : t.surface,
|
|
41541
41538
|
children: /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "flex items-start gap-3", children: [
|
|
41542
41539
|
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { className: "mt-0.5 flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
|
|
41543
41540
|
"div",
|
|
@@ -41549,12 +41546,13 @@ A: ${label}`);
|
|
|
41549
41546
|
!selectedOption && !isOptionsDisabled && "hover:border-gold"
|
|
41550
41547
|
)
|
|
41551
41548
|
),
|
|
41552
|
-
|
|
41549
|
+
style: isSelected ? t.accentBorder : void 0,
|
|
41550
|
+
children: isSelected && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { className: "w-2 h-2 rounded-full bg-gold", style: t.accentBg })
|
|
41553
41551
|
}
|
|
41554
41552
|
) }),
|
|
41555
41553
|
/* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
41556
|
-
isRecommended && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("p", { className: "text-xs font-semibold text-gold mb-1", children: "Recommended" }),
|
|
41557
|
-
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)("p", { className: "text-sm text-cardText", children: label })
|
|
41554
|
+
isRecommended && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("p", { className: "text-xs font-semibold text-gold mb-1", style: t.accent, children: "Recommended" }),
|
|
41555
|
+
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)("p", { className: "text-sm text-cardText", style: t.text, children: label })
|
|
41558
41556
|
] })
|
|
41559
41557
|
] })
|
|
41560
41558
|
},
|
|
@@ -41571,6 +41569,7 @@ A: ${label}`);
|
|
|
41571
41569
|
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
41572
41570
|
"bg-cardSurface hover:bg-cardSurface/80 text-gold border-cardBorder"
|
|
41573
41571
|
),
|
|
41572
|
+
style: { ...t.surface, ...t.accent },
|
|
41574
41573
|
children: isLoading ? "Sending..." : "Continue"
|
|
41575
41574
|
}
|
|
41576
41575
|
) })
|