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.d.cts CHANGED
@@ -3568,6 +3568,10 @@ interface MCQCardProps {
3568
3568
  * A molecule for Multiple Choice Questions.
3569
3569
  * Self-contained: when `sessionId` + `sendMessage` are provided,
3570
3570
  * it manages its own persistence and agent communication.
3571
+ *
3572
+ * Honors an optional `theme` (WidgetTheme): when provided, the card adopts the
3573
+ * organization's brand colors via inline styles that override the default
3574
+ * Tailwind palette. With no theme it renders exactly as before.
3571
3575
  */
3572
3576
  declare const MCQCard: React__default.NamedExoticComponent<MCQCardProps & {
3573
3577
  disableContinueInDiscovery?: boolean;
package/dist/index.d.ts CHANGED
@@ -3568,6 +3568,10 @@ interface MCQCardProps {
3568
3568
  * A molecule for Multiple Choice Questions.
3569
3569
  * Self-contained: when `sessionId` + `sendMessage` are provided,
3570
3570
  * it manages its own persistence and agent communication.
3571
+ *
3572
+ * Honors an optional `theme` (WidgetTheme): when provided, the card adopts the
3573
+ * organization's brand colors via inline styles that override the default
3574
+ * Tailwind palette. With no theme it renders exactly as before.
3571
3575
  */
3572
3576
  declare const MCQCard: React__default.NamedExoticComponent<MCQCardProps & {
3573
3577
  disableContinueInDiscovery?: boolean;
package/dist/index.mjs CHANGED
@@ -41097,6 +41097,7 @@ var MCQCard = React111.memo(
41097
41097
  onAction,
41098
41098
  disabled = false,
41099
41099
  disableContinueInDiscovery,
41100
+ theme,
41100
41101
  // Self-contained props
41101
41102
  sessionId,
41102
41103
  sendMessage,
@@ -41106,8 +41107,7 @@ var MCQCard = React111.memo(
41106
41107
  }) => {
41107
41108
  const resolvedQuestion = question || allProps.Question || allProps.q || "";
41108
41109
  const resolvedOptions = options || allProps.Options || allProps.opts || {};
41109
- const resolvedRecommended = recommended || allProps.Recommended || allProps.rec;
41110
- console.log("[MCQCard] FULL PROPS:", { allProps, resolvedQuestion, resolvedOptions: Object.keys(resolvedOptions || {}), resolvedRecommended });
41110
+ const t = th(theme);
41111
41111
  const [selectedOption, setSelectedOption] = React111.useState(propsSelectedOption);
41112
41112
  const [isProceeded, setIsProceeded] = React111.useState(false);
41113
41113
  const fetchedSessionRef = React111.useRef("");
@@ -41132,24 +41132,20 @@ var MCQCard = React111.memo(
41132
41132
  if (propsSelectedOption) return;
41133
41133
  fetchedSessionRef.current = fetchKey;
41134
41134
  const questionKey = buildQuestionKey(sessionId, resolvedQuestion);
41135
- console.log("[MCQCard] Fetching with key:", questionKey, "(question:", resolvedQuestion, ")");
41136
41135
  fetchSelections(sessionId).then((selections) => {
41137
- console.log("[MCQCard] Got selections:", selections);
41138
41136
  const stored = selections[questionKey] || selections[resolvedQuestion] || selections[`mcq_${sessionId}`];
41139
41137
  if (stored) {
41140
- console.log("[MCQCard] Setting selected:", stored);
41141
41138
  setSelectedOption(stored);
41142
41139
  setIsProceeded(true);
41143
41140
  }
41144
- }).catch((err) => console.error("[MCQCard] Fetch error:", err));
41141
+ }).catch(() => {
41142
+ });
41145
41143
  }, [sessionId, propsSelectedOption, resolvedQuestion, buildQuestionKey]);
41146
41144
  const isDiscovery = disableContinueInDiscovery !== void 0 ? disableContinueInDiscovery : typeof window !== "undefined" && window.location.pathname.includes("creator-discovery");
41147
41145
  const handleOptionClick = (key, e) => {
41148
41146
  e.preventDefault();
41149
41147
  e.stopPropagation();
41150
- console.log("[MCQCard] Option clicked:", key, "Can select:", isLatestMessage && !isLoading && !disabled && !isProceeded);
41151
41148
  if (isLatestMessage && !isLoading && !disabled && !isProceeded) {
41152
- console.log("[MCQCard] Setting selected to:", key);
41153
41149
  setSelectedOption(key);
41154
41150
  onSelect?.(key);
41155
41151
  }
@@ -41167,7 +41163,6 @@ var MCQCard = React111.memo(
41167
41163
  setIsProceeded(true);
41168
41164
  if (sessionId && resolvedQuestion) {
41169
41165
  const questionKey = buildQuestionKey(sessionId, resolvedQuestion);
41170
- console.log("[MCQCard] Persisting:", questionKey, result);
41171
41166
  await persistSelection(sessionId, questionKey, result);
41172
41167
  }
41173
41168
  if (sendMessage) {
@@ -41195,8 +41190,9 @@ A: ${label}`);
41195
41190
  "p-4 rounded-lg border border-gray400 bg-cardSurface w-full",
41196
41191
  className
41197
41192
  ),
41193
+ style: t.root,
41198
41194
  children: [
41199
- /* @__PURE__ */ jsx153("div", { className: "mb-4", children: /* @__PURE__ */ jsx153("p", { className: "text-sm text-cardText", children: resolvedQuestion || "Select an option:" }) }),
41195
+ /* @__PURE__ */ jsx153("div", { className: "mb-4", children: /* @__PURE__ */ jsx153("p", { className: "text-sm text-cardText", style: t.text, children: resolvedQuestion || "Select an option:" }) }),
41200
41196
  /* @__PURE__ */ jsx153("div", { className: "space-y-2.5 mb-4", children: optionsEntries.map(([key, label]) => {
41201
41197
  const isSelected = selectedOption === key;
41202
41198
  const isRecommended = key === recommended;
@@ -41211,6 +41207,7 @@ A: ${label}`);
41211
41207
  !selectedOption && !isOptionsDisabled && "hover:border-gray500",
41212
41208
  (isLoading || isOptionsDisabled) && "opacity-50 cursor-not-allowed"
41213
41209
  ),
41210
+ style: isSelected ? { ...t.surface, ...t.accentBorder } : t.surface,
41214
41211
  children: /* @__PURE__ */ jsxs114("div", { className: "flex items-start gap-3", children: [
41215
41212
  /* @__PURE__ */ jsx153("div", { className: "mt-0.5 flex-shrink-0", children: /* @__PURE__ */ jsx153(
41216
41213
  "div",
@@ -41222,12 +41219,13 @@ A: ${label}`);
41222
41219
  !selectedOption && !isOptionsDisabled && "hover:border-gold"
41223
41220
  )
41224
41221
  ),
41225
- children: isSelected && /* @__PURE__ */ jsx153("div", { className: "w-2 h-2 rounded-full bg-gold" })
41222
+ style: isSelected ? t.accentBorder : void 0,
41223
+ children: isSelected && /* @__PURE__ */ jsx153("div", { className: "w-2 h-2 rounded-full bg-gold", style: t.accentBg })
41226
41224
  }
41227
41225
  ) }),
41228
41226
  /* @__PURE__ */ jsxs114("div", { className: "flex-1 min-w-0", children: [
41229
- isRecommended && /* @__PURE__ */ jsx153("p", { className: "text-xs font-semibold text-gold mb-1", children: "Recommended" }),
41230
- /* @__PURE__ */ jsx153("p", { className: "text-sm text-cardText", children: label })
41227
+ isRecommended && /* @__PURE__ */ jsx153("p", { className: "text-xs font-semibold text-gold mb-1", style: t.accent, children: "Recommended" }),
41228
+ /* @__PURE__ */ jsx153("p", { className: "text-sm text-cardText", style: t.text, children: label })
41231
41229
  ] })
41232
41230
  ] })
41233
41231
  },
@@ -41244,6 +41242,7 @@ A: ${label}`);
41244
41242
  "disabled:opacity-50 disabled:cursor-not-allowed",
41245
41243
  "bg-cardSurface hover:bg-cardSurface/80 text-gold border-cardBorder"
41246
41244
  ),
41245
+ style: { ...t.surface, ...t.accent },
41247
41246
  children: isLoading ? "Sending..." : "Continue"
41248
41247
  }
41249
41248
  ) })