@adoptai/genui-components 0.1.56 → 0.1.57
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/builders/BuilderForm.d.ts.map +1 -1
- package/dist/composites/decision-card/resolver.cjs +634 -0
- package/dist/composites/decision-card/resolver.cjs.map +1 -0
- package/dist/composites/decision-card/resolver.d.ts +13 -0
- package/dist/composites/decision-card/resolver.d.ts.map +1 -0
- package/dist/composites/decision-card/resolver.js +627 -0
- package/dist/composites/decision-card/resolver.js.map +1 -0
- package/dist/composites/workflow-stepper/resolver.cjs +4 -1
- package/dist/composites/workflow-stepper/resolver.cjs.map +1 -1
- package/dist/composites/workflow-stepper/resolver.js +4 -1
- package/dist/composites/workflow-stepper/resolver.js.map +1 -1
- package/dist/index.cjs +513 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +512 -12
- package/dist/index.js.map +1 -1
- package/dist/renderer.cjs +504 -8
- package/dist/renderer.cjs.map +1 -1
- package/dist/renderer.js +504 -8
- package/dist/renderer.js.map +1 -1
- package/dist/resolver.cjs +504 -8
- package/dist/resolver.cjs.map +1 -1
- package/dist/resolver.d.ts.map +1 -1
- package/dist/resolver.js +504 -8
- package/dist/resolver.js.map +1 -1
- package/dist/schemas/decision-card.d.ts +149 -0
- package/dist/schemas/decision-card.d.ts.map +1 -0
- package/dist/schemas/index.cjs +105 -1
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.ts +149 -0
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +105 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/shared/InteractionContext.d.ts +10 -0
- package/dist/shared/InteractionContext.d.ts.map +1 -1
- package/dist/tool-definitions.json +135 -3
- package/package.json +1 -1
package/dist/resolver.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AA8D3D,KAAK,UAAU,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;AAE9C,wBAAgB,SAAS,CAAC,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC,YAAY,CAqFpE"}
|
package/dist/resolver.js
CHANGED
|
@@ -5277,6 +5277,109 @@ var workflowStepperTool = {
|
|
|
5277
5277
|
required: ["type", "title", "steps"]
|
|
5278
5278
|
}
|
|
5279
5279
|
};
|
|
5280
|
+
var decisionCardSchema = z.object({
|
|
5281
|
+
type: z.literal("decision-card"),
|
|
5282
|
+
id: z.string().optional(),
|
|
5283
|
+
decision_type: z.string().optional(),
|
|
5284
|
+
title: z.string(),
|
|
5285
|
+
question: z.string(),
|
|
5286
|
+
amount: z.number().optional(),
|
|
5287
|
+
currency: z.string().optional(),
|
|
5288
|
+
amount_label: z.string().optional(),
|
|
5289
|
+
severity: z.enum(["low", "medium", "high"]).optional(),
|
|
5290
|
+
flags: z.array(
|
|
5291
|
+
z.object({
|
|
5292
|
+
field: z.string().optional(),
|
|
5293
|
+
issue: z.string(),
|
|
5294
|
+
severity: z.enum(["low", "medium", "high"]).optional()
|
|
5295
|
+
})
|
|
5296
|
+
).max(6).optional(),
|
|
5297
|
+
options: z.array(
|
|
5298
|
+
z.object({
|
|
5299
|
+
id: z.string().optional(),
|
|
5300
|
+
label: z.string(),
|
|
5301
|
+
recommended: z.boolean().optional()
|
|
5302
|
+
})
|
|
5303
|
+
).min(1).max(5),
|
|
5304
|
+
source: z.object({
|
|
5305
|
+
label: z.string().optional(),
|
|
5306
|
+
url: z.string().optional()
|
|
5307
|
+
}).optional(),
|
|
5308
|
+
resolved: z.object({
|
|
5309
|
+
option: z.string()
|
|
5310
|
+
}).optional()
|
|
5311
|
+
});
|
|
5312
|
+
var decisionCardTool = {
|
|
5313
|
+
name: "render_decision_card",
|
|
5314
|
+
description: "Render an inline human-in-the-loop (HITL) decision card \u2014 a single judgment the agent needs from the user, resolved in-thread. Shows a titled question with an optional dollar amount at stake, optional data-quality flags, and 2-5 mutually-exclusive resolution options (the first or `recommended` one renders as the primary action), plus an optional 'view source' link. Use for inline approve/choose decisions the user resolves directly in the conversation. NOT for handing off to an external review portal (use escalation-card) and NOT for collecting multiple typed fields (use render_builder).",
|
|
5315
|
+
input_schema: {
|
|
5316
|
+
type: "object",
|
|
5317
|
+
properties: {
|
|
5318
|
+
type: { type: "string", enum: ["decision-card"] },
|
|
5319
|
+
id: { type: "string", description: "Stable id for update-in-place rendering" },
|
|
5320
|
+
decision_type: {
|
|
5321
|
+
type: "string",
|
|
5322
|
+
description: "Short category shown in the eyebrow, e.g. 'Cross-check', 'Allocation', 'Reserve'"
|
|
5323
|
+
},
|
|
5324
|
+
title: { type: "string", description: "The decision headline, e.g. 'AR reserve adequacy'" },
|
|
5325
|
+
question: { type: "string", description: "The full question / context the user must judge" },
|
|
5326
|
+
amount: { type: "number", description: "Dollar value at stake, e.g. 27100" },
|
|
5327
|
+
currency: { type: "string", description: "ISO currency code; defaults to USD" },
|
|
5328
|
+
amount_label: { type: "string", description: "Caption above the amount, e.g. 'At stake'" },
|
|
5329
|
+
severity: {
|
|
5330
|
+
type: "string",
|
|
5331
|
+
enum: ["low", "medium", "high"],
|
|
5332
|
+
description: "Severity of the decision; tints the accent rail"
|
|
5333
|
+
},
|
|
5334
|
+
flags: {
|
|
5335
|
+
type: "array",
|
|
5336
|
+
maxItems: 6,
|
|
5337
|
+
description: "Optional data-quality flags surfaced on the card",
|
|
5338
|
+
items: {
|
|
5339
|
+
type: "object",
|
|
5340
|
+
properties: {
|
|
5341
|
+
field: { type: "string" },
|
|
5342
|
+
issue: { type: "string" },
|
|
5343
|
+
severity: { type: "string", enum: ["low", "medium", "high"] }
|
|
5344
|
+
},
|
|
5345
|
+
required: ["issue"]
|
|
5346
|
+
}
|
|
5347
|
+
},
|
|
5348
|
+
options: {
|
|
5349
|
+
type: "array",
|
|
5350
|
+
minItems: 1,
|
|
5351
|
+
maxItems: 5,
|
|
5352
|
+
description: "Mutually-exclusive resolution choices; mark one `recommended` to make it primary",
|
|
5353
|
+
items: {
|
|
5354
|
+
type: "object",
|
|
5355
|
+
properties: {
|
|
5356
|
+
id: { type: "string" },
|
|
5357
|
+
label: { type: "string" },
|
|
5358
|
+
recommended: { type: "boolean" }
|
|
5359
|
+
},
|
|
5360
|
+
required: ["label"]
|
|
5361
|
+
}
|
|
5362
|
+
},
|
|
5363
|
+
source: {
|
|
5364
|
+
type: "object",
|
|
5365
|
+
description: "Optional provenance link for the figure",
|
|
5366
|
+
properties: {
|
|
5367
|
+
label: { type: "string" },
|
|
5368
|
+
url: { type: "string" }
|
|
5369
|
+
}
|
|
5370
|
+
},
|
|
5371
|
+
resolved: {
|
|
5372
|
+
type: "object",
|
|
5373
|
+
description: "Pre-resolved state for transcript replay",
|
|
5374
|
+
properties: {
|
|
5375
|
+
option: { type: "string" }
|
|
5376
|
+
},
|
|
5377
|
+
required: ["option"]
|
|
5378
|
+
}
|
|
5379
|
+
},
|
|
5380
|
+
required: ["type", "title", "question", "options"]
|
|
5381
|
+
}
|
|
5382
|
+
};
|
|
5280
5383
|
|
|
5281
5384
|
// src/schemas/index.ts
|
|
5282
5385
|
var schemaRegistry = {
|
|
@@ -5336,7 +5439,8 @@ var schemaRegistry = {
|
|
|
5336
5439
|
"connect-integration": { schema: connectIntegrationSchema, tool: connectIntegrationTool },
|
|
5337
5440
|
"integrations-list": { schema: integrationsListSchema, tool: integrationsListTool },
|
|
5338
5441
|
"pipeline-preview": { schema: pipelinePreviewSchema, tool: pipelinePreviewTool },
|
|
5339
|
-
"workflow-stepper": { schema: workflowStepperSchema, tool: workflowStepperTool }
|
|
5442
|
+
"workflow-stepper": { schema: workflowStepperSchema, tool: workflowStepperTool },
|
|
5443
|
+
"decision-card": { schema: decisionCardSchema, tool: decisionCardTool }
|
|
5340
5444
|
};
|
|
5341
5445
|
|
|
5342
5446
|
// src/schemas/coercePayload.ts
|
|
@@ -6074,17 +6178,17 @@ function SparklineTableResolver(p) {
|
|
|
6074
6178
|
// src/composites/heatmap-table/resolver.tsx
|
|
6075
6179
|
init_theme();
|
|
6076
6180
|
init_ThemeContext();
|
|
6077
|
-
function heatColor(
|
|
6078
|
-
const clamped = Math.max(-3, Math.min(3,
|
|
6181
|
+
function heatColor(z59) {
|
|
6182
|
+
const clamped = Math.max(-3, Math.min(3, z59));
|
|
6079
6183
|
const abs = Math.abs(clamped);
|
|
6080
6184
|
const lightness = 95 - abs * 8;
|
|
6081
6185
|
const hue = clamped >= 0 ? 142 : 0;
|
|
6082
6186
|
return `hsl(${hue} 60% ${lightness}%)`;
|
|
6083
6187
|
}
|
|
6084
|
-
function heatTextColor(
|
|
6085
|
-
const abs = Math.abs(
|
|
6086
|
-
if (abs > 2) return
|
|
6087
|
-
if (abs > 1) return
|
|
6188
|
+
function heatTextColor(z59) {
|
|
6189
|
+
const abs = Math.abs(z59);
|
|
6190
|
+
if (abs > 2) return z59 >= 0 ? "#14532d" : "#7f1d1d";
|
|
6191
|
+
if (abs > 1) return z59 >= 0 ? "#166534" : "#991b1b";
|
|
6088
6192
|
return "var(--foreground)";
|
|
6089
6193
|
}
|
|
6090
6194
|
var th2 = {
|
|
@@ -17129,7 +17233,10 @@ function PipelinePreviewResolver(p) {
|
|
|
17129
17233
|
init_ThemeContext();
|
|
17130
17234
|
var DEFAULT_INTERACTION = {
|
|
17131
17235
|
selectedStepId: null,
|
|
17132
|
-
onStepSelect: void 0
|
|
17236
|
+
onStepSelect: void 0,
|
|
17237
|
+
resolvedDecisions: void 0,
|
|
17238
|
+
onDecisionResolve: void 0,
|
|
17239
|
+
onDecisionSource: void 0
|
|
17133
17240
|
};
|
|
17134
17241
|
var GenUIInteractionContext = createContext(DEFAULT_INTERACTION);
|
|
17135
17242
|
function useGenUIInteraction() {
|
|
@@ -17848,6 +17955,393 @@ function WorkflowStepperResolver(p) {
|
|
|
17848
17955
|
)
|
|
17849
17956
|
] }) });
|
|
17850
17957
|
}
|
|
17958
|
+
init_ThemeContext();
|
|
17959
|
+
var SEVERITY_COLORS = {
|
|
17960
|
+
high: { color: "#dc2626", bg: "#fef2f2" },
|
|
17961
|
+
medium: { color: "#f59e0b", bg: "#fff7ed" },
|
|
17962
|
+
low: { color: "#777777", bg: "#f2f2f2" }
|
|
17963
|
+
};
|
|
17964
|
+
var GREEN3 = "#15803d";
|
|
17965
|
+
var GREEN_SOFT = "#dcfce7";
|
|
17966
|
+
var STACK_BELOW = 380;
|
|
17967
|
+
function formatAmount2(amount, currency = "USD") {
|
|
17968
|
+
var _a, _b;
|
|
17969
|
+
const abs = Math.abs(amount);
|
|
17970
|
+
const sign = amount < 0 ? "-" : "";
|
|
17971
|
+
let body;
|
|
17972
|
+
if (abs >= 1e6) body = `${(abs / 1e6).toFixed(abs >= 1e7 ? 0 : 1)}M`;
|
|
17973
|
+
else if (abs >= 1e3) body = `${(abs / 1e3).toFixed(abs >= 1e4 ? 0 : 1)}K`;
|
|
17974
|
+
else body = `${abs}`;
|
|
17975
|
+
let symbol = "$";
|
|
17976
|
+
try {
|
|
17977
|
+
const parts = new Intl.NumberFormat("en-US", {
|
|
17978
|
+
style: "currency",
|
|
17979
|
+
currency,
|
|
17980
|
+
maximumFractionDigits: 0
|
|
17981
|
+
}).formatToParts(0);
|
|
17982
|
+
symbol = (_b = (_a = parts.find((p) => p.type === "currency")) == null ? void 0 : _a.value) != null ? _b : "$";
|
|
17983
|
+
} catch (e) {
|
|
17984
|
+
symbol = "$";
|
|
17985
|
+
}
|
|
17986
|
+
return `${sign}${symbol}${body}`;
|
|
17987
|
+
}
|
|
17988
|
+
function useContainerWidth2(ref) {
|
|
17989
|
+
const [w, setW] = React41.useState(0);
|
|
17990
|
+
React41.useLayoutEffect(() => {
|
|
17991
|
+
const el = ref.current;
|
|
17992
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
17993
|
+
const ro = new ResizeObserver((entries) => {
|
|
17994
|
+
var _a;
|
|
17995
|
+
const cr = (_a = entries[0]) == null ? void 0 : _a.contentRect;
|
|
17996
|
+
if (cr) setW(cr.width);
|
|
17997
|
+
});
|
|
17998
|
+
ro.observe(el);
|
|
17999
|
+
setW(el.getBoundingClientRect().width);
|
|
18000
|
+
return () => ro.disconnect();
|
|
18001
|
+
}, [ref]);
|
|
18002
|
+
return w;
|
|
18003
|
+
}
|
|
18004
|
+
var KEYFRAMES2 = `
|
|
18005
|
+
@keyframes dcRise{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
|
|
18006
|
+
.dc-rise{animation:dcRise 0.28s cubic-bezier(0.22,1,0.36,1) both}
|
|
18007
|
+
@media (prefers-reduced-motion: reduce){
|
|
18008
|
+
.dc-rise{animation:none !important;opacity:1 !important;transform:none !important}
|
|
18009
|
+
}`;
|
|
18010
|
+
function SparkCheck({ size, color }) {
|
|
18011
|
+
return /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
18012
|
+
"path",
|
|
18013
|
+
{
|
|
18014
|
+
d: "M5 13l4 4L19 7",
|
|
18015
|
+
stroke: color,
|
|
18016
|
+
strokeWidth: 2.5,
|
|
18017
|
+
strokeLinecap: "round",
|
|
18018
|
+
strokeLinejoin: "round"
|
|
18019
|
+
}
|
|
18020
|
+
) });
|
|
18021
|
+
}
|
|
18022
|
+
function FlagPill({ flag }) {
|
|
18023
|
+
var _a;
|
|
18024
|
+
const sev = (_a = flag.severity) != null ? _a : "medium";
|
|
18025
|
+
const { color, bg } = SEVERITY_COLORS[sev];
|
|
18026
|
+
return /* @__PURE__ */ jsxs(
|
|
18027
|
+
"span",
|
|
18028
|
+
{
|
|
18029
|
+
style: {
|
|
18030
|
+
display: "inline-flex",
|
|
18031
|
+
alignItems: "center",
|
|
18032
|
+
gap: 5,
|
|
18033
|
+
fontSize: 11,
|
|
18034
|
+
fontWeight: 600,
|
|
18035
|
+
padding: "3px 9px",
|
|
18036
|
+
borderRadius: 9999,
|
|
18037
|
+
background: bg,
|
|
18038
|
+
color,
|
|
18039
|
+
lineHeight: 1.2
|
|
18040
|
+
},
|
|
18041
|
+
children: [
|
|
18042
|
+
/* @__PURE__ */ jsx(
|
|
18043
|
+
"span",
|
|
18044
|
+
{
|
|
18045
|
+
"aria-hidden": "true",
|
|
18046
|
+
style: { width: 6, height: 6, borderRadius: "50%", background: color, flexShrink: 0 }
|
|
18047
|
+
}
|
|
18048
|
+
),
|
|
18049
|
+
flag.field ? `${flag.field}: ${flag.issue}` : flag.issue
|
|
18050
|
+
]
|
|
18051
|
+
}
|
|
18052
|
+
);
|
|
18053
|
+
}
|
|
18054
|
+
function DecisionCardRenderer({
|
|
18055
|
+
data,
|
|
18056
|
+
resolved = null,
|
|
18057
|
+
onResolve,
|
|
18058
|
+
onOpenSource
|
|
18059
|
+
}) {
|
|
18060
|
+
var _a, _b;
|
|
18061
|
+
const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
|
|
18062
|
+
const rootRef = React41.useRef(null);
|
|
18063
|
+
const width = useContainerWidth2(rootRef);
|
|
18064
|
+
const stacked = width > 0 && width < STACK_BELOW;
|
|
18065
|
+
const options = (_a = data.options) != null ? _a : [];
|
|
18066
|
+
const recommendedIdx = Math.max(
|
|
18067
|
+
0,
|
|
18068
|
+
options.findIndex((o) => o.recommended)
|
|
18069
|
+
);
|
|
18070
|
+
const railColor = data.severity ? SEVERITY_COLORS[data.severity].color : ACCENT2;
|
|
18071
|
+
const isResolved = Boolean(resolved);
|
|
18072
|
+
const amountNode = typeof data.amount === "number" ? /* @__PURE__ */ jsxs(
|
|
18073
|
+
"div",
|
|
18074
|
+
{
|
|
18075
|
+
style: {
|
|
18076
|
+
display: "flex",
|
|
18077
|
+
flexDirection: "column",
|
|
18078
|
+
alignItems: stacked ? "flex-start" : "flex-end",
|
|
18079
|
+
gap: 1,
|
|
18080
|
+
flexShrink: 0
|
|
18081
|
+
},
|
|
18082
|
+
children: [
|
|
18083
|
+
data.amount_label && /* @__PURE__ */ jsx(
|
|
18084
|
+
"span",
|
|
18085
|
+
{
|
|
18086
|
+
style: {
|
|
18087
|
+
fontSize: 10,
|
|
18088
|
+
textTransform: "uppercase",
|
|
18089
|
+
letterSpacing: "0.07em",
|
|
18090
|
+
fontWeight: 700,
|
|
18091
|
+
color: MUTED2
|
|
18092
|
+
},
|
|
18093
|
+
children: data.amount_label
|
|
18094
|
+
}
|
|
18095
|
+
),
|
|
18096
|
+
/* @__PURE__ */ jsx(
|
|
18097
|
+
"span",
|
|
18098
|
+
{
|
|
18099
|
+
style: {
|
|
18100
|
+
fontSize: 18,
|
|
18101
|
+
fontWeight: 700,
|
|
18102
|
+
color: "var(--foreground)",
|
|
18103
|
+
fontVariantNumeric: "tabular-nums",
|
|
18104
|
+
letterSpacing: "-0.01em",
|
|
18105
|
+
lineHeight: 1.1
|
|
18106
|
+
},
|
|
18107
|
+
children: formatAmount2(data.amount, data.currency)
|
|
18108
|
+
}
|
|
18109
|
+
)
|
|
18110
|
+
]
|
|
18111
|
+
}
|
|
18112
|
+
) : null;
|
|
18113
|
+
return /* @__PURE__ */ jsxs(
|
|
18114
|
+
"div",
|
|
18115
|
+
{
|
|
18116
|
+
ref: rootRef,
|
|
18117
|
+
className: "dc-rise",
|
|
18118
|
+
"data-testid": "decision-card",
|
|
18119
|
+
"data-resolved": isResolved || void 0,
|
|
18120
|
+
style: {
|
|
18121
|
+
position: "relative",
|
|
18122
|
+
width: "100%",
|
|
18123
|
+
minWidth: 0,
|
|
18124
|
+
boxSizing: "border-box",
|
|
18125
|
+
borderRadius: "0.75rem",
|
|
18126
|
+
border: `1px solid ${isResolved ? GREEN_SOFT : BORDER4}`,
|
|
18127
|
+
background: isResolved ? "#f6fef9" : "white",
|
|
18128
|
+
boxShadow: "0 1px 2px rgba(0,0,0,0.03), 0 4px 12px rgba(0,0,0,0.04)",
|
|
18129
|
+
padding: "16px 18px 16px 20px",
|
|
18130
|
+
display: "flex",
|
|
18131
|
+
flexDirection: "column",
|
|
18132
|
+
gap: 12,
|
|
18133
|
+
overflow: "hidden"
|
|
18134
|
+
},
|
|
18135
|
+
children: [
|
|
18136
|
+
/* @__PURE__ */ jsx("style", { children: KEYFRAMES2 }),
|
|
18137
|
+
/* @__PURE__ */ jsx(
|
|
18138
|
+
"div",
|
|
18139
|
+
{
|
|
18140
|
+
"aria-hidden": "true",
|
|
18141
|
+
style: {
|
|
18142
|
+
position: "absolute",
|
|
18143
|
+
top: 0,
|
|
18144
|
+
left: 0,
|
|
18145
|
+
bottom: 0,
|
|
18146
|
+
width: 4,
|
|
18147
|
+
background: isResolved ? GREEN3 : railColor
|
|
18148
|
+
}
|
|
18149
|
+
}
|
|
18150
|
+
),
|
|
18151
|
+
/* @__PURE__ */ jsxs(
|
|
18152
|
+
"div",
|
|
18153
|
+
{
|
|
18154
|
+
style: {
|
|
18155
|
+
display: "flex",
|
|
18156
|
+
flexDirection: stacked ? "column" : "row",
|
|
18157
|
+
alignItems: stacked ? "flex-start" : "flex-start",
|
|
18158
|
+
justifyContent: "space-between",
|
|
18159
|
+
gap: stacked ? 6 : 12
|
|
18160
|
+
},
|
|
18161
|
+
children: [
|
|
18162
|
+
/* @__PURE__ */ jsxs("div", { style: { minWidth: 0, display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
18163
|
+
/* @__PURE__ */ jsx(
|
|
18164
|
+
"span",
|
|
18165
|
+
{
|
|
18166
|
+
style: {
|
|
18167
|
+
fontSize: 10.5,
|
|
18168
|
+
textTransform: "uppercase",
|
|
18169
|
+
letterSpacing: "0.07em",
|
|
18170
|
+
fontWeight: 700,
|
|
18171
|
+
color: ACCENT2
|
|
18172
|
+
},
|
|
18173
|
+
children: data.decision_type ? `Decision needs you \xB7 ${data.decision_type}` : "Decision needs you"
|
|
18174
|
+
}
|
|
18175
|
+
),
|
|
18176
|
+
/* @__PURE__ */ jsx(
|
|
18177
|
+
"p",
|
|
18178
|
+
{
|
|
18179
|
+
style: {
|
|
18180
|
+
fontFamily: "var(--font-serif)",
|
|
18181
|
+
fontSize: 17,
|
|
18182
|
+
fontWeight: 400,
|
|
18183
|
+
color: "var(--foreground)",
|
|
18184
|
+
letterSpacing: "-0.01em",
|
|
18185
|
+
margin: 0,
|
|
18186
|
+
lineHeight: 1.2
|
|
18187
|
+
},
|
|
18188
|
+
children: data.title
|
|
18189
|
+
}
|
|
18190
|
+
)
|
|
18191
|
+
] }),
|
|
18192
|
+
amountNode
|
|
18193
|
+
]
|
|
18194
|
+
}
|
|
18195
|
+
),
|
|
18196
|
+
/* @__PURE__ */ jsx("p", { style: { fontSize: 13, lineHeight: 1.5, color: MUTED2, margin: 0 }, children: data.question }),
|
|
18197
|
+
data.flags && data.flags.length > 0 && /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: data.flags.map((flag, i) => {
|
|
18198
|
+
var _a2;
|
|
18199
|
+
return /* @__PURE__ */ jsx(FlagPill, { flag }, `${(_a2 = flag.field) != null ? _a2 : "flag"}-${i}`);
|
|
18200
|
+
}) }),
|
|
18201
|
+
isResolved ? /* @__PURE__ */ jsxs(
|
|
18202
|
+
"div",
|
|
18203
|
+
{
|
|
18204
|
+
style: {
|
|
18205
|
+
display: "inline-flex",
|
|
18206
|
+
alignItems: "center",
|
|
18207
|
+
gap: 7,
|
|
18208
|
+
fontSize: 13,
|
|
18209
|
+
fontWeight: 600,
|
|
18210
|
+
color: GREEN3
|
|
18211
|
+
},
|
|
18212
|
+
children: [
|
|
18213
|
+
/* @__PURE__ */ jsx(SparkCheck, { size: 16, color: GREEN3 }),
|
|
18214
|
+
"Resolved \xB7 ",
|
|
18215
|
+
resolved
|
|
18216
|
+
]
|
|
18217
|
+
}
|
|
18218
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
18219
|
+
/* @__PURE__ */ jsx(
|
|
18220
|
+
"div",
|
|
18221
|
+
{
|
|
18222
|
+
style: {
|
|
18223
|
+
display: "flex",
|
|
18224
|
+
flexDirection: stacked ? "column" : "row",
|
|
18225
|
+
flexWrap: stacked ? "nowrap" : "wrap",
|
|
18226
|
+
gap: 8
|
|
18227
|
+
},
|
|
18228
|
+
children: options.map((opt, idx) => {
|
|
18229
|
+
var _a2;
|
|
18230
|
+
const primary = idx === recommendedIdx;
|
|
18231
|
+
return /* @__PURE__ */ jsx(
|
|
18232
|
+
"button",
|
|
18233
|
+
{
|
|
18234
|
+
type: "button",
|
|
18235
|
+
onClick: () => onResolve == null ? void 0 : onResolve(opt.label),
|
|
18236
|
+
style: {
|
|
18237
|
+
width: stacked ? "100%" : "auto",
|
|
18238
|
+
textAlign: stacked ? "left" : "center",
|
|
18239
|
+
border: `1px solid ${primary ? ACCENT2 : BORDER4}`,
|
|
18240
|
+
background: primary ? ACCENT2 : "white",
|
|
18241
|
+
color: primary ? "white" : "var(--foreground)",
|
|
18242
|
+
borderRadius: 8,
|
|
18243
|
+
fontSize: 13,
|
|
18244
|
+
fontWeight: 600,
|
|
18245
|
+
padding: "9px 14px",
|
|
18246
|
+
cursor: "pointer",
|
|
18247
|
+
transition: "background 0.15s, border-color 0.15s, color 0.15s"
|
|
18248
|
+
},
|
|
18249
|
+
onMouseEnter: (e) => {
|
|
18250
|
+
if (primary) {
|
|
18251
|
+
e.currentTarget.style.background = ACCENT_SOFT2;
|
|
18252
|
+
} else {
|
|
18253
|
+
e.currentTarget.style.borderColor = ACCENT2;
|
|
18254
|
+
e.currentTarget.style.background = "#fafafa";
|
|
18255
|
+
}
|
|
18256
|
+
},
|
|
18257
|
+
onMouseLeave: (e) => {
|
|
18258
|
+
if (primary) {
|
|
18259
|
+
e.currentTarget.style.background = ACCENT2;
|
|
18260
|
+
} else {
|
|
18261
|
+
e.currentTarget.style.borderColor = BORDER4;
|
|
18262
|
+
e.currentTarget.style.background = "white";
|
|
18263
|
+
}
|
|
18264
|
+
},
|
|
18265
|
+
children: opt.label
|
|
18266
|
+
},
|
|
18267
|
+
(_a2 = opt.id) != null ? _a2 : opt.label
|
|
18268
|
+
);
|
|
18269
|
+
})
|
|
18270
|
+
}
|
|
18271
|
+
),
|
|
18272
|
+
data.source && /* @__PURE__ */ jsxs(
|
|
18273
|
+
"button",
|
|
18274
|
+
{
|
|
18275
|
+
type: "button",
|
|
18276
|
+
onClick: onOpenSource,
|
|
18277
|
+
style: {
|
|
18278
|
+
alignSelf: "flex-start",
|
|
18279
|
+
display: "inline-flex",
|
|
18280
|
+
alignItems: "center",
|
|
18281
|
+
gap: 5,
|
|
18282
|
+
border: "none",
|
|
18283
|
+
background: "none",
|
|
18284
|
+
padding: 0,
|
|
18285
|
+
cursor: "pointer",
|
|
18286
|
+
fontSize: 12,
|
|
18287
|
+
fontWeight: 600,
|
|
18288
|
+
color: MUTED2,
|
|
18289
|
+
transition: "color 0.15s"
|
|
18290
|
+
},
|
|
18291
|
+
onMouseEnter: (e) => e.currentTarget.style.color = ACCENT2,
|
|
18292
|
+
onMouseLeave: (e) => e.currentTarget.style.color = MUTED2,
|
|
18293
|
+
children: [
|
|
18294
|
+
/* @__PURE__ */ jsx("svg", { width: 13, height: 13, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
18295
|
+
"path",
|
|
18296
|
+
{
|
|
18297
|
+
d: "M14 3v4a1 1 0 001 1h4M5 4a1 1 0 011-1h8l5 5v11a1 1 0 01-1 1H6a1 1 0 01-1-1V4z",
|
|
18298
|
+
stroke: "currentColor",
|
|
18299
|
+
strokeWidth: 1.8,
|
|
18300
|
+
strokeLinecap: "round",
|
|
18301
|
+
strokeLinejoin: "round"
|
|
18302
|
+
}
|
|
18303
|
+
) }),
|
|
18304
|
+
(_b = data.source.label) != null ? _b : "View source for this figure"
|
|
18305
|
+
]
|
|
18306
|
+
}
|
|
18307
|
+
)
|
|
18308
|
+
] })
|
|
18309
|
+
]
|
|
18310
|
+
}
|
|
18311
|
+
);
|
|
18312
|
+
}
|
|
18313
|
+
function DecisionCardResolver(p) {
|
|
18314
|
+
var _a, _b, _c, _d;
|
|
18315
|
+
const { resolvedDecisions, onDecisionResolve, onDecisionSource } = useGenUIInteraction();
|
|
18316
|
+
const decisionId = (_a = p.id) != null ? _a : p.title;
|
|
18317
|
+
const hostResolved = resolvedDecisions == null ? void 0 : resolvedDecisions[decisionId];
|
|
18318
|
+
const initial = (_c = hostResolved != null ? hostResolved : (_b = p.resolved) == null ? void 0 : _b.option) != null ? _c : null;
|
|
18319
|
+
const [localResolved, setLocalResolved] = React41.useState(initial);
|
|
18320
|
+
React41.useEffect(() => {
|
|
18321
|
+
if (hostResolved !== void 0) setLocalResolved(hostResolved);
|
|
18322
|
+
}, [hostResolved]);
|
|
18323
|
+
const resolved = hostResolved != null ? hostResolved : localResolved;
|
|
18324
|
+
const handleResolve = (option) => {
|
|
18325
|
+
setLocalResolved(option);
|
|
18326
|
+
onDecisionResolve == null ? void 0 : onDecisionResolve(decisionId, option);
|
|
18327
|
+
};
|
|
18328
|
+
const handleSource = () => {
|
|
18329
|
+
var _a2;
|
|
18330
|
+
onDecisionSource == null ? void 0 : onDecisionSource(decisionId, p.source);
|
|
18331
|
+
if (!onDecisionSource && ((_a2 = p.source) == null ? void 0 : _a2.url) && typeof window !== "undefined") {
|
|
18332
|
+
window.open(p.source.url, "_blank", "noopener,noreferrer");
|
|
18333
|
+
}
|
|
18334
|
+
};
|
|
18335
|
+
return /* @__PURE__ */ jsx(ComponentActions, { filename: (_d = p.title) != null ? _d : "decision-card", children: /* @__PURE__ */ jsx(
|
|
18336
|
+
DecisionCardRenderer,
|
|
18337
|
+
{
|
|
18338
|
+
data: p,
|
|
18339
|
+
resolved,
|
|
18340
|
+
onResolve: handleResolve,
|
|
18341
|
+
onOpenSource: handleSource
|
|
18342
|
+
}
|
|
18343
|
+
) });
|
|
18344
|
+
}
|
|
17851
18345
|
function resolveUI(rawPayload) {
|
|
17852
18346
|
const payload = coercePayload(rawPayload);
|
|
17853
18347
|
switch (payload.type) {
|
|
@@ -17965,6 +18459,8 @@ function resolveUI(rawPayload) {
|
|
|
17965
18459
|
return /* @__PURE__ */ jsx(PipelinePreviewResolver, __spreadValues({}, payload));
|
|
17966
18460
|
case "workflow-stepper":
|
|
17967
18461
|
return /* @__PURE__ */ jsx(WorkflowStepperResolver, __spreadValues({}, payload));
|
|
18462
|
+
case "decision-card":
|
|
18463
|
+
return /* @__PURE__ */ jsx(DecisionCardResolver, __spreadValues({}, payload));
|
|
17968
18464
|
default: {
|
|
17969
18465
|
return /* @__PURE__ */ jsx(
|
|
17970
18466
|
"div",
|