@adoptai/genui-components 0.1.60 → 0.1.62
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/composites/decision-card/resolver.cjs +7 -4
- package/dist/composites/decision-card/resolver.cjs.map +1 -1
- package/dist/composites/decision-card/resolver.d.ts +7 -1
- package/dist/composites/decision-card/resolver.d.ts.map +1 -1
- package/dist/composites/decision-card/resolver.js +7 -5
- package/dist/composites/decision-card/resolver.js.map +1 -1
- package/dist/composites/decision-queue/resolver.d.ts +33 -0
- package/dist/composites/decision-queue/resolver.d.ts.map +1 -0
- package/dist/composites/workflow-stepper/resolver.cjs +2 -1
- package/dist/composites/workflow-stepper/resolver.cjs.map +1 -1
- package/dist/composites/workflow-stepper/resolver.js +2 -1
- package/dist/composites/workflow-stepper/resolver.js.map +1 -1
- package/dist/index.cjs +495 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +495 -10
- package/dist/index.js.map +1 -1
- package/dist/renderer.cjs +495 -10
- package/dist/renderer.cjs.map +1 -1
- package/dist/renderer.js +495 -10
- package/dist/renderer.js.map +1 -1
- package/dist/resolver.cjs +495 -10
- package/dist/resolver.cjs.map +1 -1
- package/dist/resolver.d.ts.map +1 -1
- package/dist/resolver.js +495 -10
- package/dist/resolver.js.map +1 -1
- package/dist/schemas/decision-queue.d.ts +227 -0
- package/dist/schemas/decision-queue.d.ts.map +1 -0
- package/dist/schemas/index.cjs +162 -0
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.ts +227 -0
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +162 -0
- 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 +203 -3
- package/package.json +1 -1
package/dist/renderer.js
CHANGED
|
@@ -5631,6 +5631,167 @@ var decisionCardTool = {
|
|
|
5631
5631
|
required: ["type", "title", "question", "options"]
|
|
5632
5632
|
}
|
|
5633
5633
|
};
|
|
5634
|
+
var decisionQueueItemSchema = z.object({
|
|
5635
|
+
id: z.string().optional(),
|
|
5636
|
+
decision_type: z.string().optional(),
|
|
5637
|
+
title: z.string(),
|
|
5638
|
+
question: z.string(),
|
|
5639
|
+
amount: z.number().optional(),
|
|
5640
|
+
currency: z.string().optional(),
|
|
5641
|
+
amount_label: z.string().optional(),
|
|
5642
|
+
severity: z.enum(["low", "medium", "high"]).optional(),
|
|
5643
|
+
flags: z.array(
|
|
5644
|
+
z.object({
|
|
5645
|
+
field: z.string().optional(),
|
|
5646
|
+
issue: z.string(),
|
|
5647
|
+
severity: z.enum(["low", "medium", "high"]).optional()
|
|
5648
|
+
})
|
|
5649
|
+
).max(6).optional(),
|
|
5650
|
+
options: z.array(
|
|
5651
|
+
z.object({
|
|
5652
|
+
id: z.string().optional(),
|
|
5653
|
+
label: z.string(),
|
|
5654
|
+
recommended: z.boolean().optional(),
|
|
5655
|
+
value: z.number().optional(),
|
|
5656
|
+
adjust: z.object({
|
|
5657
|
+
min: z.number(),
|
|
5658
|
+
max: z.number(),
|
|
5659
|
+
step: z.number().optional(),
|
|
5660
|
+
unit: z.string().optional()
|
|
5661
|
+
}).optional()
|
|
5662
|
+
})
|
|
5663
|
+
).min(1).max(5),
|
|
5664
|
+
source: z.object({
|
|
5665
|
+
label: z.string().optional(),
|
|
5666
|
+
url: z.string().optional()
|
|
5667
|
+
}).optional()
|
|
5668
|
+
});
|
|
5669
|
+
var decisionQueueSchema = z.object({
|
|
5670
|
+
type: z.literal("decision-queue"),
|
|
5671
|
+
id: z.string().optional(),
|
|
5672
|
+
title: z.string().optional(),
|
|
5673
|
+
description: z.string().optional(),
|
|
5674
|
+
submit_label: z.string().optional(),
|
|
5675
|
+
items: z.array(decisionQueueItemSchema).min(2).max(12),
|
|
5676
|
+
resolved: z.object({
|
|
5677
|
+
decisions: z.array(
|
|
5678
|
+
z.object({
|
|
5679
|
+
id: z.string().optional(),
|
|
5680
|
+
title: z.string(),
|
|
5681
|
+
option: z.string(),
|
|
5682
|
+
value: z.number().optional()
|
|
5683
|
+
})
|
|
5684
|
+
)
|
|
5685
|
+
}).optional()
|
|
5686
|
+
});
|
|
5687
|
+
var OPTION_ITEM_JSON = {
|
|
5688
|
+
type: "object",
|
|
5689
|
+
properties: {
|
|
5690
|
+
id: { type: "string" },
|
|
5691
|
+
label: { type: "string" },
|
|
5692
|
+
recommended: { type: "boolean" },
|
|
5693
|
+
value: {
|
|
5694
|
+
type: "number",
|
|
5695
|
+
description: "Suggested numeric figure for this option (starting point of the adjuster)"
|
|
5696
|
+
},
|
|
5697
|
+
adjust: {
|
|
5698
|
+
type: "object",
|
|
5699
|
+
description: "Allow the user to tune `value` within this inclusive range before deciding",
|
|
5700
|
+
properties: {
|
|
5701
|
+
min: { type: "number" },
|
|
5702
|
+
max: { type: "number" },
|
|
5703
|
+
step: { type: "number" },
|
|
5704
|
+
unit: { type: "string", description: "Short unit suffix, e.g. 'units', '%', 'hrs'" }
|
|
5705
|
+
},
|
|
5706
|
+
required: ["min", "max"]
|
|
5707
|
+
}
|
|
5708
|
+
},
|
|
5709
|
+
required: ["label"]
|
|
5710
|
+
};
|
|
5711
|
+
var decisionQueueTool = {
|
|
5712
|
+
name: "render_decision_queue",
|
|
5713
|
+
description: "Render a SEQUENTIAL QUEUE of 2-12 related human-in-the-loop judgments, decided one at a time at full decision-card richness (amount at stake, data-quality flags, adjustable figures, source links) and submitted TOGETHER as one reply. Use whenever MORE THAN ONE decision is pending in the same turn \u2014 never emit multiple loose decision-cards. Give deferrable items an explicit 'leave open'-style option so the user can always complete the queue. For a single judgment use decision-card; for typed field input (names, dates, uploads) use render_builder.",
|
|
5714
|
+
input_schema: {
|
|
5715
|
+
type: "object",
|
|
5716
|
+
properties: {
|
|
5717
|
+
type: { type: "string", enum: ["decision-queue"] },
|
|
5718
|
+
id: { type: "string", description: "Stable id for update-in-place rendering" },
|
|
5719
|
+
title: {
|
|
5720
|
+
type: "string",
|
|
5721
|
+
description: "Batch headline shown in the header, e.g. 'Reconciliation exceptions'"
|
|
5722
|
+
},
|
|
5723
|
+
description: { type: "string", description: "One-line context above the queue" },
|
|
5724
|
+
submit_label: { type: "string", description: "CTA label; defaults to 'Submit N decisions'" },
|
|
5725
|
+
items: {
|
|
5726
|
+
type: "array",
|
|
5727
|
+
minItems: 2,
|
|
5728
|
+
maxItems: 12,
|
|
5729
|
+
description: "The pending judgments, in the order the user should take them. Each is a full decision-card body (no `type`).",
|
|
5730
|
+
items: {
|
|
5731
|
+
type: "object",
|
|
5732
|
+
properties: {
|
|
5733
|
+
id: { type: "string" },
|
|
5734
|
+
decision_type: {
|
|
5735
|
+
type: "string",
|
|
5736
|
+
description: "Short category eyebrow, e.g. 'Duplicate', 'Capitalization'"
|
|
5737
|
+
},
|
|
5738
|
+
title: { type: "string" },
|
|
5739
|
+
question: { type: "string" },
|
|
5740
|
+
amount: { type: "number" },
|
|
5741
|
+
currency: { type: "string" },
|
|
5742
|
+
amount_label: { type: "string" },
|
|
5743
|
+
severity: { type: "string", enum: ["low", "medium", "high"] },
|
|
5744
|
+
flags: {
|
|
5745
|
+
type: "array",
|
|
5746
|
+
maxItems: 6,
|
|
5747
|
+
items: {
|
|
5748
|
+
type: "object",
|
|
5749
|
+
properties: {
|
|
5750
|
+
field: { type: "string" },
|
|
5751
|
+
issue: { type: "string" },
|
|
5752
|
+
severity: { type: "string", enum: ["low", "medium", "high"] }
|
|
5753
|
+
},
|
|
5754
|
+
required: ["issue"]
|
|
5755
|
+
}
|
|
5756
|
+
},
|
|
5757
|
+
options: {
|
|
5758
|
+
type: "array",
|
|
5759
|
+
minItems: 1,
|
|
5760
|
+
maxItems: 5,
|
|
5761
|
+
items: OPTION_ITEM_JSON
|
|
5762
|
+
},
|
|
5763
|
+
source: {
|
|
5764
|
+
type: "object",
|
|
5765
|
+
properties: { label: { type: "string" }, url: { type: "string" } }
|
|
5766
|
+
}
|
|
5767
|
+
},
|
|
5768
|
+
required: ["title", "question", "options"]
|
|
5769
|
+
}
|
|
5770
|
+
},
|
|
5771
|
+
resolved: {
|
|
5772
|
+
type: "object",
|
|
5773
|
+
description: "Pre-resolved state for transcript replay",
|
|
5774
|
+
properties: {
|
|
5775
|
+
decisions: {
|
|
5776
|
+
type: "array",
|
|
5777
|
+
items: {
|
|
5778
|
+
type: "object",
|
|
5779
|
+
properties: {
|
|
5780
|
+
id: { type: "string" },
|
|
5781
|
+
title: { type: "string" },
|
|
5782
|
+
option: { type: "string" },
|
|
5783
|
+
value: { type: "number" }
|
|
5784
|
+
},
|
|
5785
|
+
required: ["title", "option"]
|
|
5786
|
+
}
|
|
5787
|
+
}
|
|
5788
|
+
},
|
|
5789
|
+
required: ["decisions"]
|
|
5790
|
+
}
|
|
5791
|
+
},
|
|
5792
|
+
required: ["type", "items"]
|
|
5793
|
+
}
|
|
5794
|
+
};
|
|
5634
5795
|
var tabbyAuthSchema = z.object({
|
|
5635
5796
|
type: z.literal("tabby-auth"),
|
|
5636
5797
|
app: z.string(),
|
|
@@ -5723,6 +5884,7 @@ var schemaRegistry = {
|
|
|
5723
5884
|
"workflow-stepper": { schema: workflowStepperSchema, tool: workflowStepperTool },
|
|
5724
5885
|
"document-field-extraction": { schema: documentFieldExtractionSchema, tool: documentFieldExtractionTool },
|
|
5725
5886
|
"decision-card": { schema: decisionCardSchema, tool: decisionCardTool },
|
|
5887
|
+
"decision-queue": { schema: decisionQueueSchema, tool: decisionQueueTool },
|
|
5726
5888
|
"tabby-auth": { schema: tabbyAuthSchema, tool: tabbyAuthTool }
|
|
5727
5889
|
};
|
|
5728
5890
|
|
|
@@ -6461,17 +6623,17 @@ function SparklineTableResolver(p) {
|
|
|
6461
6623
|
// src/composites/heatmap-table/resolver.tsx
|
|
6462
6624
|
init_theme();
|
|
6463
6625
|
init_ThemeContext();
|
|
6464
|
-
function heatColor(
|
|
6465
|
-
const clamped = Math.max(-3, Math.min(3,
|
|
6626
|
+
function heatColor(z62) {
|
|
6627
|
+
const clamped = Math.max(-3, Math.min(3, z62));
|
|
6466
6628
|
const abs = Math.abs(clamped);
|
|
6467
6629
|
const lightness = 95 - abs * 8;
|
|
6468
6630
|
const hue = clamped >= 0 ? 142 : 0;
|
|
6469
6631
|
return `hsl(${hue} 60% ${lightness}%)`;
|
|
6470
6632
|
}
|
|
6471
|
-
function heatTextColor(
|
|
6472
|
-
const abs = Math.abs(
|
|
6473
|
-
if (abs > 2) return
|
|
6474
|
-
if (abs > 1) return
|
|
6633
|
+
function heatTextColor(z62) {
|
|
6634
|
+
const abs = Math.abs(z62);
|
|
6635
|
+
if (abs > 2) return z62 >= 0 ? "#14532d" : "#7f1d1d";
|
|
6636
|
+
if (abs > 1) return z62 >= 0 ? "#166534" : "#991b1b";
|
|
6475
6637
|
return "var(--foreground)";
|
|
6476
6638
|
}
|
|
6477
6639
|
var th2 = {
|
|
@@ -17519,7 +17681,8 @@ var DEFAULT_INTERACTION = {
|
|
|
17519
17681
|
onStepSelect: void 0,
|
|
17520
17682
|
resolvedDecisions: void 0,
|
|
17521
17683
|
onDecisionResolve: void 0,
|
|
17522
|
-
onDecisionSource: void 0
|
|
17684
|
+
onDecisionSource: void 0,
|
|
17685
|
+
onDecisionQueueSubmit: void 0
|
|
17523
17686
|
};
|
|
17524
17687
|
var GenUIInteractionContext = createContext(DEFAULT_INTERACTION);
|
|
17525
17688
|
function useGenUIInteraction() {
|
|
@@ -20193,7 +20356,8 @@ function DecisionCardRenderer({
|
|
|
20193
20356
|
data,
|
|
20194
20357
|
resolved = null,
|
|
20195
20358
|
onResolve,
|
|
20196
|
-
onOpenSource
|
|
20359
|
+
onOpenSource,
|
|
20360
|
+
eyebrow
|
|
20197
20361
|
}) {
|
|
20198
20362
|
var _a, _b, _c;
|
|
20199
20363
|
const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
|
|
@@ -20299,7 +20463,7 @@ function DecisionCardRenderer({
|
|
|
20299
20463
|
},
|
|
20300
20464
|
children: [
|
|
20301
20465
|
/* @__PURE__ */ jsxs("div", { style: { minWidth: 0, display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
20302
|
-
/* @__PURE__ */ jsx(
|
|
20466
|
+
eyebrow === null ? null : /* @__PURE__ */ jsx(
|
|
20303
20467
|
"span",
|
|
20304
20468
|
{
|
|
20305
20469
|
style: {
|
|
@@ -20309,7 +20473,7 @@ function DecisionCardRenderer({
|
|
|
20309
20473
|
fontWeight: 700,
|
|
20310
20474
|
color: ACCENT2
|
|
20311
20475
|
},
|
|
20312
|
-
children: data.decision_type ? `Decision needs you \xB7 ${data.decision_type}` : "Decision needs you"
|
|
20476
|
+
children: eyebrow !== void 0 ? eyebrow : data.decision_type ? `Decision needs you \xB7 ${data.decision_type}` : "Decision needs you"
|
|
20313
20477
|
}
|
|
20314
20478
|
),
|
|
20315
20479
|
/* @__PURE__ */ jsx(
|
|
@@ -20529,6 +20693,325 @@ function DecisionCardResolver(p) {
|
|
|
20529
20693
|
) });
|
|
20530
20694
|
}
|
|
20531
20695
|
init_ThemeContext();
|
|
20696
|
+
var GREEN4 = "#15803d";
|
|
20697
|
+
var KEYFRAMES3 = `
|
|
20698
|
+
@keyframes dqSettle{from{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:none}}
|
|
20699
|
+
.dq-settle{animation:dqSettle 0.24s cubic-bezier(0.22,1,0.36,1) both}
|
|
20700
|
+
@keyframes dqFocus{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}
|
|
20701
|
+
.dq-focus{animation:dqFocus 0.28s cubic-bezier(0.22,1,0.36,1) both}
|
|
20702
|
+
@media (prefers-reduced-motion: reduce){
|
|
20703
|
+
.dq-settle,.dq-focus{animation:none !important;opacity:1 !important;transform:none !important}
|
|
20704
|
+
}`;
|
|
20705
|
+
function figureOf(item, decision) {
|
|
20706
|
+
var _a, _b, _c;
|
|
20707
|
+
if (decision.value == null) return decision.option;
|
|
20708
|
+
const unit = (_c = (_b = ((_a = item.options) != null ? _a : []).find((o) => o.label === decision.option)) == null ? void 0 : _b.adjust) == null ? void 0 : _c.unit;
|
|
20709
|
+
return `${decision.option} \xB7 ${formatFigure(decision.value, unit)}`;
|
|
20710
|
+
}
|
|
20711
|
+
function composeQueueMessage(items, decisions) {
|
|
20712
|
+
const lines = items.map((item, i) => {
|
|
20713
|
+
const d = decisions[i];
|
|
20714
|
+
return `${i + 1}. ${item.title} \u2192 ${d ? figureOf(item, d) : "(undecided)"}`;
|
|
20715
|
+
});
|
|
20716
|
+
const done = decisions.filter(Boolean).length;
|
|
20717
|
+
return `Decisions (${done}/${items.length}):
|
|
20718
|
+
${lines.join("\n")}`;
|
|
20719
|
+
}
|
|
20720
|
+
function Check({ size, color }) {
|
|
20721
|
+
return /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M5 13l4 4L19 7", stroke: color, strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
20722
|
+
}
|
|
20723
|
+
function amountChip(item) {
|
|
20724
|
+
if (typeof item.amount !== "number") return null;
|
|
20725
|
+
const abs = Math.abs(item.amount);
|
|
20726
|
+
const sign = item.amount < 0 ? "-" : "";
|
|
20727
|
+
if (abs >= 1e6) return `${sign}$${(abs / 1e6).toFixed(abs >= 1e7 ? 0 : 1)}M`;
|
|
20728
|
+
if (abs >= 1e3) return `${sign}$${(abs / 1e3).toFixed(abs >= 1e4 ? 0 : 1)}K`;
|
|
20729
|
+
return `${sign}$${abs}`;
|
|
20730
|
+
}
|
|
20731
|
+
function DecisionQueueRenderer({
|
|
20732
|
+
data,
|
|
20733
|
+
submitted = null,
|
|
20734
|
+
onSubmit,
|
|
20735
|
+
hideSubmit,
|
|
20736
|
+
submitRef,
|
|
20737
|
+
onReady
|
|
20738
|
+
}) {
|
|
20739
|
+
var _a;
|
|
20740
|
+
const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
|
|
20741
|
+
const items = (_a = data.items) != null ? _a : [];
|
|
20742
|
+
const [decisions, setDecisions] = React45.useState(
|
|
20743
|
+
() => items.map(() => void 0)
|
|
20744
|
+
);
|
|
20745
|
+
const firstUndecided = decisions.findIndex((d) => !d);
|
|
20746
|
+
const [focusIdx, setFocusIdx] = React45.useState(firstUndecided >= 0 ? firstUndecided : null);
|
|
20747
|
+
const isSubmitted = submitted != null;
|
|
20748
|
+
const shown = isSubmitted ? items.map(
|
|
20749
|
+
(item, i) => {
|
|
20750
|
+
var _a2;
|
|
20751
|
+
return (_a2 = submitted.find((d) => d.id && d.id === item.id || d.title === item.title)) != null ? _a2 : submitted[i];
|
|
20752
|
+
}
|
|
20753
|
+
) : decisions;
|
|
20754
|
+
const decidedCount = shown.filter(Boolean).length;
|
|
20755
|
+
const allDecided = decidedCount === items.length;
|
|
20756
|
+
const decide = (idx, option, value) => {
|
|
20757
|
+
const item = items[idx];
|
|
20758
|
+
const next = decisions.slice();
|
|
20759
|
+
next[idx] = { id: item.id, title: item.title, option, value };
|
|
20760
|
+
setDecisions(next);
|
|
20761
|
+
const order = [...Array(items.length).keys()];
|
|
20762
|
+
const after = order.slice(idx + 1).concat(order.slice(0, idx + 1));
|
|
20763
|
+
const target = after.find((j) => j !== idx && !next[j]);
|
|
20764
|
+
setFocusIdx(target != null ? target : null);
|
|
20765
|
+
};
|
|
20766
|
+
const handleSubmit = () => {
|
|
20767
|
+
if (!allDecided || isSubmitted) return;
|
|
20768
|
+
const final = decisions;
|
|
20769
|
+
onSubmit == null ? void 0 : onSubmit(final, composeQueueMessage(items, final));
|
|
20770
|
+
};
|
|
20771
|
+
const onReadyRef = React45.useRef(onReady);
|
|
20772
|
+
React45.useEffect(() => {
|
|
20773
|
+
onReadyRef.current = onReady;
|
|
20774
|
+
});
|
|
20775
|
+
React45.useEffect(() => {
|
|
20776
|
+
if (!onReadyRef.current) return;
|
|
20777
|
+
const msg = allDecided ? composeQueueMessage(items, decisions) : null;
|
|
20778
|
+
onReadyRef.current(allDecided && !isSubmitted, msg, decisions.filter(Boolean));
|
|
20779
|
+
}, [decisions, allDecided, isSubmitted]);
|
|
20780
|
+
React45.useEffect(() => {
|
|
20781
|
+
if (!submitRef) return;
|
|
20782
|
+
submitRef.current = handleSubmit;
|
|
20783
|
+
return () => {
|
|
20784
|
+
submitRef.current = null;
|
|
20785
|
+
};
|
|
20786
|
+
}, [submitRef, allDecided, isSubmitted, decisions]);
|
|
20787
|
+
return /* @__PURE__ */ jsxs(
|
|
20788
|
+
"div",
|
|
20789
|
+
{
|
|
20790
|
+
"data-testid": "decision-queue",
|
|
20791
|
+
"data-submitted": isSubmitted || void 0,
|
|
20792
|
+
style: {
|
|
20793
|
+
position: "relative",
|
|
20794
|
+
width: "100%",
|
|
20795
|
+
minWidth: 0,
|
|
20796
|
+
boxSizing: "border-box",
|
|
20797
|
+
borderRadius: "0.75rem",
|
|
20798
|
+
border: `1px solid ${BORDER4}`,
|
|
20799
|
+
background: "white",
|
|
20800
|
+
boxShadow: "0 1px 2px rgba(0,0,0,0.03), 0 4px 12px rgba(0,0,0,0.04)",
|
|
20801
|
+
padding: "16px 18px",
|
|
20802
|
+
display: "flex",
|
|
20803
|
+
flexDirection: "column",
|
|
20804
|
+
gap: 12,
|
|
20805
|
+
overflow: "hidden"
|
|
20806
|
+
},
|
|
20807
|
+
children: [
|
|
20808
|
+
/* @__PURE__ */ jsx("style", { children: KEYFRAMES3 }),
|
|
20809
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 3 }, children: [
|
|
20810
|
+
/* @__PURE__ */ jsx(
|
|
20811
|
+
"span",
|
|
20812
|
+
{
|
|
20813
|
+
style: {
|
|
20814
|
+
fontSize: 10.5,
|
|
20815
|
+
textTransform: "uppercase",
|
|
20816
|
+
letterSpacing: "0.07em",
|
|
20817
|
+
fontWeight: 700,
|
|
20818
|
+
color: isSubmitted ? GREEN4 : ACCENT2
|
|
20819
|
+
},
|
|
20820
|
+
children: isSubmitted ? "Decisions submitted" : "Decisions need you"
|
|
20821
|
+
}
|
|
20822
|
+
),
|
|
20823
|
+
data.title && /* @__PURE__ */ jsx(
|
|
20824
|
+
"p",
|
|
20825
|
+
{
|
|
20826
|
+
style: {
|
|
20827
|
+
fontFamily: "var(--font-serif)",
|
|
20828
|
+
fontSize: 16,
|
|
20829
|
+
fontWeight: 400,
|
|
20830
|
+
color: "var(--foreground)",
|
|
20831
|
+
letterSpacing: "-0.01em",
|
|
20832
|
+
margin: 0,
|
|
20833
|
+
lineHeight: 1.25
|
|
20834
|
+
},
|
|
20835
|
+
children: data.title
|
|
20836
|
+
}
|
|
20837
|
+
),
|
|
20838
|
+
data.description && /* @__PURE__ */ jsx("p", { style: { fontSize: 12.5, color: MUTED2, margin: 0, lineHeight: 1.45 }, children: data.description })
|
|
20839
|
+
] }),
|
|
20840
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: items.map((item, idx) => {
|
|
20841
|
+
var _a2, _b, _c;
|
|
20842
|
+
const decision = shown[idx];
|
|
20843
|
+
const focused = !isSubmitted && focusIdx === idx;
|
|
20844
|
+
if (focused) {
|
|
20845
|
+
return /* @__PURE__ */ jsx("div", { className: "dq-focus", "data-testid": `decision-queue-focus-${idx}`, children: /* @__PURE__ */ jsx(
|
|
20846
|
+
DecisionCardRenderer,
|
|
20847
|
+
{
|
|
20848
|
+
data: __spreadValues({ type: "decision-card" }, item),
|
|
20849
|
+
resolved: null,
|
|
20850
|
+
onResolve: (option, value) => decide(idx, option, value),
|
|
20851
|
+
eyebrow: `${idx + 1} of ${items.length}${item.decision_type ? ` \xB7 ${item.decision_type}` : ""}`
|
|
20852
|
+
}
|
|
20853
|
+
) }, (_a2 = item.id) != null ? _a2 : `q-${idx}`);
|
|
20854
|
+
}
|
|
20855
|
+
if (decision) {
|
|
20856
|
+
return /* @__PURE__ */ jsxs(
|
|
20857
|
+
"button",
|
|
20858
|
+
{
|
|
20859
|
+
type: "button",
|
|
20860
|
+
className: "dq-settle",
|
|
20861
|
+
onClick: isSubmitted ? void 0 : () => setFocusIdx(idx),
|
|
20862
|
+
disabled: isSubmitted,
|
|
20863
|
+
title: isSubmitted ? void 0 : "Change this decision",
|
|
20864
|
+
"data-testid": `decision-queue-receipt-${idx}`,
|
|
20865
|
+
style: {
|
|
20866
|
+
display: "flex",
|
|
20867
|
+
alignItems: "center",
|
|
20868
|
+
gap: 8,
|
|
20869
|
+
width: "100%",
|
|
20870
|
+
textAlign: "left",
|
|
20871
|
+
border: "1px solid #dcfce7",
|
|
20872
|
+
background: "#f6fef9",
|
|
20873
|
+
borderRadius: 8,
|
|
20874
|
+
padding: "7px 11px",
|
|
20875
|
+
cursor: isSubmitted ? "default" : "pointer",
|
|
20876
|
+
font: "inherit"
|
|
20877
|
+
},
|
|
20878
|
+
children: [
|
|
20879
|
+
/* @__PURE__ */ jsx(Check, { size: 13, color: GREEN4 }),
|
|
20880
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: 12.5, fontWeight: 600, color: "var(--foreground)", minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: item.title }),
|
|
20881
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { color: MUTED2, fontSize: 12 }, children: "\u2192" }),
|
|
20882
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: 12.5, fontWeight: 600, color: GREEN4, fontVariantNumeric: "tabular-nums", whiteSpace: "nowrap" }, children: figureOf(item, decision) }),
|
|
20883
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1 } }),
|
|
20884
|
+
!isSubmitted && /* @__PURE__ */ jsx("span", { style: { fontSize: 11, fontWeight: 600, color: MUTED2 }, children: "Change" })
|
|
20885
|
+
]
|
|
20886
|
+
},
|
|
20887
|
+
(_b = item.id) != null ? _b : `q-${idx}`
|
|
20888
|
+
);
|
|
20889
|
+
}
|
|
20890
|
+
return /* @__PURE__ */ jsxs(
|
|
20891
|
+
"button",
|
|
20892
|
+
{
|
|
20893
|
+
type: "button",
|
|
20894
|
+
onClick: isSubmitted ? void 0 : () => setFocusIdx(idx),
|
|
20895
|
+
disabled: isSubmitted,
|
|
20896
|
+
"data-testid": `decision-queue-upcoming-${idx}`,
|
|
20897
|
+
style: {
|
|
20898
|
+
display: "flex",
|
|
20899
|
+
alignItems: "center",
|
|
20900
|
+
gap: 8,
|
|
20901
|
+
width: "100%",
|
|
20902
|
+
textAlign: "left",
|
|
20903
|
+
border: `1px dashed ${BORDER4}`,
|
|
20904
|
+
background: "white",
|
|
20905
|
+
borderRadius: 8,
|
|
20906
|
+
padding: "7px 11px",
|
|
20907
|
+
cursor: isSubmitted ? "default" : "pointer",
|
|
20908
|
+
font: "inherit",
|
|
20909
|
+
opacity: 0.75
|
|
20910
|
+
},
|
|
20911
|
+
children: [
|
|
20912
|
+
/* @__PURE__ */ jsx(
|
|
20913
|
+
"span",
|
|
20914
|
+
{
|
|
20915
|
+
"aria-hidden": "true",
|
|
20916
|
+
style: { width: 13, height: 13, borderRadius: "50%", border: `1.5px solid ${MUTED2}`, flexShrink: 0, boxSizing: "border-box" }
|
|
20917
|
+
}
|
|
20918
|
+
),
|
|
20919
|
+
/* @__PURE__ */ jsxs("span", { style: { fontSize: 12.5, fontWeight: 600, color: MUTED2, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: [
|
|
20920
|
+
item.decision_type ? `${item.decision_type} \xB7 ` : "",
|
|
20921
|
+
item.title
|
|
20922
|
+
] }),
|
|
20923
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1 } }),
|
|
20924
|
+
amountChip(item) && /* @__PURE__ */ jsx("span", { style: { fontSize: 11.5, fontWeight: 700, color: MUTED2, fontVariantNumeric: "tabular-nums" }, children: amountChip(item) })
|
|
20925
|
+
]
|
|
20926
|
+
},
|
|
20927
|
+
(_c = item.id) != null ? _c : `q-${idx}`
|
|
20928
|
+
);
|
|
20929
|
+
}) }),
|
|
20930
|
+
/* @__PURE__ */ jsxs(
|
|
20931
|
+
"div",
|
|
20932
|
+
{
|
|
20933
|
+
style: {
|
|
20934
|
+
display: "flex",
|
|
20935
|
+
alignItems: "center",
|
|
20936
|
+
gap: 10,
|
|
20937
|
+
paddingTop: 10,
|
|
20938
|
+
borderTop: `1px solid #f0f0f0`
|
|
20939
|
+
},
|
|
20940
|
+
children: [
|
|
20941
|
+
/* @__PURE__ */ jsx("span", { style: { display: "inline-flex", gap: 4 }, "aria-hidden": "true", children: items.map((_, i) => /* @__PURE__ */ jsx(
|
|
20942
|
+
"span",
|
|
20943
|
+
{
|
|
20944
|
+
style: {
|
|
20945
|
+
width: 7,
|
|
20946
|
+
height: 7,
|
|
20947
|
+
borderRadius: "50%",
|
|
20948
|
+
background: shown[i] ? isSubmitted ? GREEN4 : ACCENT2 : "#e8e8e8",
|
|
20949
|
+
transition: "background 0.2s"
|
|
20950
|
+
}
|
|
20951
|
+
},
|
|
20952
|
+
`dot-${i}`
|
|
20953
|
+
)) }),
|
|
20954
|
+
/* @__PURE__ */ jsxs(
|
|
20955
|
+
"span",
|
|
20956
|
+
{
|
|
20957
|
+
style: { fontSize: 11.5, fontWeight: 600, color: MUTED2, fontVariantNumeric: "tabular-nums" },
|
|
20958
|
+
"data-testid": "decision-queue-progress",
|
|
20959
|
+
children: [
|
|
20960
|
+
decidedCount,
|
|
20961
|
+
"/",
|
|
20962
|
+
items.length,
|
|
20963
|
+
" decided"
|
|
20964
|
+
]
|
|
20965
|
+
}
|
|
20966
|
+
),
|
|
20967
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1 } }),
|
|
20968
|
+
isSubmitted ? /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: 6, fontSize: 12.5, fontWeight: 600, color: GREEN4 }, children: [
|
|
20969
|
+
/* @__PURE__ */ jsx(Check, { size: 14, color: GREEN4 }),
|
|
20970
|
+
"Submitted"
|
|
20971
|
+
] }) : hideSubmit ? null : /* @__PURE__ */ jsx(
|
|
20972
|
+
"button",
|
|
20973
|
+
{
|
|
20974
|
+
type: "button",
|
|
20975
|
+
onClick: handleSubmit,
|
|
20976
|
+
disabled: !allDecided,
|
|
20977
|
+
"data-testid": "decision-queue-submit",
|
|
20978
|
+
style: {
|
|
20979
|
+
border: `1px solid ${allDecided ? ACCENT2 : BORDER4}`,
|
|
20980
|
+
background: allDecided ? ACCENT2 : "#f6f6f6",
|
|
20981
|
+
color: allDecided ? "white" : MUTED2,
|
|
20982
|
+
borderRadius: 8,
|
|
20983
|
+
fontSize: 13,
|
|
20984
|
+
fontWeight: 600,
|
|
20985
|
+
padding: "8px 16px",
|
|
20986
|
+
cursor: allDecided ? "pointer" : "default",
|
|
20987
|
+
fontVariantNumeric: "tabular-nums",
|
|
20988
|
+
transition: "background 0.15s, border-color 0.15s, color 0.15s"
|
|
20989
|
+
},
|
|
20990
|
+
children: data.submit_label || `Submit ${items.length} decision${items.length === 1 ? "" : "s"}`
|
|
20991
|
+
}
|
|
20992
|
+
)
|
|
20993
|
+
]
|
|
20994
|
+
}
|
|
20995
|
+
)
|
|
20996
|
+
]
|
|
20997
|
+
}
|
|
20998
|
+
);
|
|
20999
|
+
}
|
|
21000
|
+
function DecisionQueueResolver(p) {
|
|
21001
|
+
var _a, _b, _c, _d, _e, _f;
|
|
21002
|
+
const { resolvedDecisions, onDecisionQueueSubmit } = useGenUIInteraction();
|
|
21003
|
+
const queueId = (_b = (_a = p.id) != null ? _a : p.title) != null ? _b : "decision-queue";
|
|
21004
|
+
const replayed = (_d = (_c = p.resolved) == null ? void 0 : _c.decisions) != null ? _d : null;
|
|
21005
|
+
const [localSubmitted, setLocalSubmitted] = React45.useState(null);
|
|
21006
|
+
const hostLocked = (resolvedDecisions == null ? void 0 : resolvedDecisions[queueId]) != null;
|
|
21007
|
+
const submitted = (_e = replayed != null ? replayed : localSubmitted) != null ? _e : hostLocked ? [] : null;
|
|
21008
|
+
const handleSubmit = (decisions, message) => {
|
|
21009
|
+
setLocalSubmitted(decisions);
|
|
21010
|
+
onDecisionQueueSubmit == null ? void 0 : onDecisionQueueSubmit(queueId, decisions, message);
|
|
21011
|
+
};
|
|
21012
|
+
return /* @__PURE__ */ jsx(ComponentActions, { filename: (_f = p.title) != null ? _f : "decision-queue", children: /* @__PURE__ */ jsx(DecisionQueueRenderer, { data: p, submitted, onSubmit: handleSubmit }) });
|
|
21013
|
+
}
|
|
21014
|
+
init_ThemeContext();
|
|
20532
21015
|
var CONNECTED_GREEN3 = "#15803d";
|
|
20533
21016
|
var CONNECTED_GREEN_BG = "#dcfce7";
|
|
20534
21017
|
var PENDING_AMBER = "#92400e";
|
|
@@ -20960,6 +21443,8 @@ function resolveUI(rawPayload) {
|
|
|
20960
21443
|
return /* @__PURE__ */ jsx(DocumentFieldExtractionResolver, __spreadValues({}, payload));
|
|
20961
21444
|
case "decision-card":
|
|
20962
21445
|
return /* @__PURE__ */ jsx(DecisionCardResolver, __spreadValues({}, payload));
|
|
21446
|
+
case "decision-queue":
|
|
21447
|
+
return /* @__PURE__ */ jsx(DecisionQueueResolver, __spreadValues({}, payload));
|
|
20963
21448
|
case "tabby-auth":
|
|
20964
21449
|
return /* @__PURE__ */ jsx(TabbyAuthResolver, __spreadValues({}, payload));
|
|
20965
21450
|
default: {
|