@adoptai/genui-components 0.1.60 → 0.1.61
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 +22 -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 +472 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +472 -10
- package/dist/index.js.map +1 -1
- package/dist/renderer.cjs +472 -10
- package/dist/renderer.cjs.map +1 -1
- package/dist/renderer.js +472 -10
- package/dist/renderer.js.map +1 -1
- package/dist/resolver.cjs +472 -10
- package/dist/resolver.cjs.map +1 -1
- package/dist/resolver.d.ts.map +1 -1
- package/dist/resolver.js +472 -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/index.js
CHANGED
|
@@ -5641,6 +5641,167 @@ var decisionCardTool = {
|
|
|
5641
5641
|
required: ["type", "title", "question", "options"]
|
|
5642
5642
|
}
|
|
5643
5643
|
};
|
|
5644
|
+
var decisionQueueItemSchema = z.object({
|
|
5645
|
+
id: z.string().optional(),
|
|
5646
|
+
decision_type: z.string().optional(),
|
|
5647
|
+
title: z.string(),
|
|
5648
|
+
question: z.string(),
|
|
5649
|
+
amount: z.number().optional(),
|
|
5650
|
+
currency: z.string().optional(),
|
|
5651
|
+
amount_label: z.string().optional(),
|
|
5652
|
+
severity: z.enum(["low", "medium", "high"]).optional(),
|
|
5653
|
+
flags: z.array(
|
|
5654
|
+
z.object({
|
|
5655
|
+
field: z.string().optional(),
|
|
5656
|
+
issue: z.string(),
|
|
5657
|
+
severity: z.enum(["low", "medium", "high"]).optional()
|
|
5658
|
+
})
|
|
5659
|
+
).max(6).optional(),
|
|
5660
|
+
options: z.array(
|
|
5661
|
+
z.object({
|
|
5662
|
+
id: z.string().optional(),
|
|
5663
|
+
label: z.string(),
|
|
5664
|
+
recommended: z.boolean().optional(),
|
|
5665
|
+
value: z.number().optional(),
|
|
5666
|
+
adjust: z.object({
|
|
5667
|
+
min: z.number(),
|
|
5668
|
+
max: z.number(),
|
|
5669
|
+
step: z.number().optional(),
|
|
5670
|
+
unit: z.string().optional()
|
|
5671
|
+
}).optional()
|
|
5672
|
+
})
|
|
5673
|
+
).min(1).max(5),
|
|
5674
|
+
source: z.object({
|
|
5675
|
+
label: z.string().optional(),
|
|
5676
|
+
url: z.string().optional()
|
|
5677
|
+
}).optional()
|
|
5678
|
+
});
|
|
5679
|
+
var decisionQueueSchema = z.object({
|
|
5680
|
+
type: z.literal("decision-queue"),
|
|
5681
|
+
id: z.string().optional(),
|
|
5682
|
+
title: z.string().optional(),
|
|
5683
|
+
description: z.string().optional(),
|
|
5684
|
+
submit_label: z.string().optional(),
|
|
5685
|
+
items: z.array(decisionQueueItemSchema).min(2).max(12),
|
|
5686
|
+
resolved: z.object({
|
|
5687
|
+
decisions: z.array(
|
|
5688
|
+
z.object({
|
|
5689
|
+
id: z.string().optional(),
|
|
5690
|
+
title: z.string(),
|
|
5691
|
+
option: z.string(),
|
|
5692
|
+
value: z.number().optional()
|
|
5693
|
+
})
|
|
5694
|
+
)
|
|
5695
|
+
}).optional()
|
|
5696
|
+
});
|
|
5697
|
+
var OPTION_ITEM_JSON = {
|
|
5698
|
+
type: "object",
|
|
5699
|
+
properties: {
|
|
5700
|
+
id: { type: "string" },
|
|
5701
|
+
label: { type: "string" },
|
|
5702
|
+
recommended: { type: "boolean" },
|
|
5703
|
+
value: {
|
|
5704
|
+
type: "number",
|
|
5705
|
+
description: "Suggested numeric figure for this option (starting point of the adjuster)"
|
|
5706
|
+
},
|
|
5707
|
+
adjust: {
|
|
5708
|
+
type: "object",
|
|
5709
|
+
description: "Allow the user to tune `value` within this inclusive range before deciding",
|
|
5710
|
+
properties: {
|
|
5711
|
+
min: { type: "number" },
|
|
5712
|
+
max: { type: "number" },
|
|
5713
|
+
step: { type: "number" },
|
|
5714
|
+
unit: { type: "string", description: "Short unit suffix, e.g. 'units', '%', 'hrs'" }
|
|
5715
|
+
},
|
|
5716
|
+
required: ["min", "max"]
|
|
5717
|
+
}
|
|
5718
|
+
},
|
|
5719
|
+
required: ["label"]
|
|
5720
|
+
};
|
|
5721
|
+
var decisionQueueTool = {
|
|
5722
|
+
name: "render_decision_queue",
|
|
5723
|
+
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.",
|
|
5724
|
+
input_schema: {
|
|
5725
|
+
type: "object",
|
|
5726
|
+
properties: {
|
|
5727
|
+
type: { type: "string", enum: ["decision-queue"] },
|
|
5728
|
+
id: { type: "string", description: "Stable id for update-in-place rendering" },
|
|
5729
|
+
title: {
|
|
5730
|
+
type: "string",
|
|
5731
|
+
description: "Batch headline shown in the header, e.g. 'Reconciliation exceptions'"
|
|
5732
|
+
},
|
|
5733
|
+
description: { type: "string", description: "One-line context above the queue" },
|
|
5734
|
+
submit_label: { type: "string", description: "CTA label; defaults to 'Submit N decisions'" },
|
|
5735
|
+
items: {
|
|
5736
|
+
type: "array",
|
|
5737
|
+
minItems: 2,
|
|
5738
|
+
maxItems: 12,
|
|
5739
|
+
description: "The pending judgments, in the order the user should take them. Each is a full decision-card body (no `type`).",
|
|
5740
|
+
items: {
|
|
5741
|
+
type: "object",
|
|
5742
|
+
properties: {
|
|
5743
|
+
id: { type: "string" },
|
|
5744
|
+
decision_type: {
|
|
5745
|
+
type: "string",
|
|
5746
|
+
description: "Short category eyebrow, e.g. 'Duplicate', 'Capitalization'"
|
|
5747
|
+
},
|
|
5748
|
+
title: { type: "string" },
|
|
5749
|
+
question: { type: "string" },
|
|
5750
|
+
amount: { type: "number" },
|
|
5751
|
+
currency: { type: "string" },
|
|
5752
|
+
amount_label: { type: "string" },
|
|
5753
|
+
severity: { type: "string", enum: ["low", "medium", "high"] },
|
|
5754
|
+
flags: {
|
|
5755
|
+
type: "array",
|
|
5756
|
+
maxItems: 6,
|
|
5757
|
+
items: {
|
|
5758
|
+
type: "object",
|
|
5759
|
+
properties: {
|
|
5760
|
+
field: { type: "string" },
|
|
5761
|
+
issue: { type: "string" },
|
|
5762
|
+
severity: { type: "string", enum: ["low", "medium", "high"] }
|
|
5763
|
+
},
|
|
5764
|
+
required: ["issue"]
|
|
5765
|
+
}
|
|
5766
|
+
},
|
|
5767
|
+
options: {
|
|
5768
|
+
type: "array",
|
|
5769
|
+
minItems: 1,
|
|
5770
|
+
maxItems: 5,
|
|
5771
|
+
items: OPTION_ITEM_JSON
|
|
5772
|
+
},
|
|
5773
|
+
source: {
|
|
5774
|
+
type: "object",
|
|
5775
|
+
properties: { label: { type: "string" }, url: { type: "string" } }
|
|
5776
|
+
}
|
|
5777
|
+
},
|
|
5778
|
+
required: ["title", "question", "options"]
|
|
5779
|
+
}
|
|
5780
|
+
},
|
|
5781
|
+
resolved: {
|
|
5782
|
+
type: "object",
|
|
5783
|
+
description: "Pre-resolved state for transcript replay",
|
|
5784
|
+
properties: {
|
|
5785
|
+
decisions: {
|
|
5786
|
+
type: "array",
|
|
5787
|
+
items: {
|
|
5788
|
+
type: "object",
|
|
5789
|
+
properties: {
|
|
5790
|
+
id: { type: "string" },
|
|
5791
|
+
title: { type: "string" },
|
|
5792
|
+
option: { type: "string" },
|
|
5793
|
+
value: { type: "number" }
|
|
5794
|
+
},
|
|
5795
|
+
required: ["title", "option"]
|
|
5796
|
+
}
|
|
5797
|
+
}
|
|
5798
|
+
},
|
|
5799
|
+
required: ["decisions"]
|
|
5800
|
+
}
|
|
5801
|
+
},
|
|
5802
|
+
required: ["type", "items"]
|
|
5803
|
+
}
|
|
5804
|
+
};
|
|
5644
5805
|
var tabbyAuthSchema = z.object({
|
|
5645
5806
|
type: z.literal("tabby-auth"),
|
|
5646
5807
|
app: z.string(),
|
|
@@ -5792,6 +5953,7 @@ var schemaRegistry = {
|
|
|
5792
5953
|
"workflow-stepper": { schema: workflowStepperSchema, tool: workflowStepperTool },
|
|
5793
5954
|
"document-field-extraction": { schema: documentFieldExtractionSchema, tool: documentFieldExtractionTool },
|
|
5794
5955
|
"decision-card": { schema: decisionCardSchema, tool: decisionCardTool },
|
|
5956
|
+
"decision-queue": { schema: decisionQueueSchema, tool: decisionQueueTool },
|
|
5795
5957
|
"tabby-auth": { schema: tabbyAuthSchema, tool: tabbyAuthTool }
|
|
5796
5958
|
};
|
|
5797
5959
|
|
|
@@ -6505,17 +6667,17 @@ function SparklineTableResolver(p) {
|
|
|
6505
6667
|
// src/composites/heatmap-table/resolver.tsx
|
|
6506
6668
|
init_theme();
|
|
6507
6669
|
init_ThemeContext();
|
|
6508
|
-
function heatColor(
|
|
6509
|
-
const clamped = Math.max(-3, Math.min(3,
|
|
6670
|
+
function heatColor(z63) {
|
|
6671
|
+
const clamped = Math.max(-3, Math.min(3, z63));
|
|
6510
6672
|
const abs = Math.abs(clamped);
|
|
6511
6673
|
const lightness = 95 - abs * 8;
|
|
6512
6674
|
const hue = clamped >= 0 ? 142 : 0;
|
|
6513
6675
|
return `hsl(${hue} 60% ${lightness}%)`;
|
|
6514
6676
|
}
|
|
6515
|
-
function heatTextColor(
|
|
6516
|
-
const abs = Math.abs(
|
|
6517
|
-
if (abs > 2) return
|
|
6518
|
-
if (abs > 1) return
|
|
6677
|
+
function heatTextColor(z63) {
|
|
6678
|
+
const abs = Math.abs(z63);
|
|
6679
|
+
if (abs > 2) return z63 >= 0 ? "#14532d" : "#7f1d1d";
|
|
6680
|
+
if (abs > 1) return z63 >= 0 ? "#166534" : "#991b1b";
|
|
6519
6681
|
return "var(--foreground)";
|
|
6520
6682
|
}
|
|
6521
6683
|
var th2 = {
|
|
@@ -17566,7 +17728,8 @@ var DEFAULT_INTERACTION = {
|
|
|
17566
17728
|
onStepSelect: void 0,
|
|
17567
17729
|
resolvedDecisions: void 0,
|
|
17568
17730
|
onDecisionResolve: void 0,
|
|
17569
|
-
onDecisionSource: void 0
|
|
17731
|
+
onDecisionSource: void 0,
|
|
17732
|
+
onDecisionQueueSubmit: void 0
|
|
17570
17733
|
};
|
|
17571
17734
|
var GenUIInteractionContext = createContext(DEFAULT_INTERACTION);
|
|
17572
17735
|
function GenUIInteractionProvider({ value, children }) {
|
|
@@ -20354,7 +20517,8 @@ function DecisionCardRenderer({
|
|
|
20354
20517
|
data,
|
|
20355
20518
|
resolved = null,
|
|
20356
20519
|
onResolve,
|
|
20357
|
-
onOpenSource
|
|
20520
|
+
onOpenSource,
|
|
20521
|
+
eyebrow
|
|
20358
20522
|
}) {
|
|
20359
20523
|
var _a2, _b, _c;
|
|
20360
20524
|
const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
|
|
@@ -20460,7 +20624,7 @@ function DecisionCardRenderer({
|
|
|
20460
20624
|
},
|
|
20461
20625
|
children: [
|
|
20462
20626
|
/* @__PURE__ */ jsxs("div", { style: { minWidth: 0, display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
20463
|
-
/* @__PURE__ */ jsx(
|
|
20627
|
+
eyebrow === null ? null : /* @__PURE__ */ jsx(
|
|
20464
20628
|
"span",
|
|
20465
20629
|
{
|
|
20466
20630
|
style: {
|
|
@@ -20470,7 +20634,7 @@ function DecisionCardRenderer({
|
|
|
20470
20634
|
fontWeight: 700,
|
|
20471
20635
|
color: ACCENT2
|
|
20472
20636
|
},
|
|
20473
|
-
children: data.decision_type ? `Decision needs you \xB7 ${data.decision_type}` : "Decision needs you"
|
|
20637
|
+
children: eyebrow !== void 0 ? eyebrow : data.decision_type ? `Decision needs you \xB7 ${data.decision_type}` : "Decision needs you"
|
|
20474
20638
|
}
|
|
20475
20639
|
),
|
|
20476
20640
|
/* @__PURE__ */ jsx(
|
|
@@ -20690,6 +20854,302 @@ function DecisionCardResolver(p) {
|
|
|
20690
20854
|
) });
|
|
20691
20855
|
}
|
|
20692
20856
|
init_ThemeContext();
|
|
20857
|
+
var GREEN4 = "#15803d";
|
|
20858
|
+
var KEYFRAMES3 = `
|
|
20859
|
+
@keyframes dqSettle{from{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:none}}
|
|
20860
|
+
.dq-settle{animation:dqSettle 0.24s cubic-bezier(0.22,1,0.36,1) both}
|
|
20861
|
+
@keyframes dqFocus{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}
|
|
20862
|
+
.dq-focus{animation:dqFocus 0.28s cubic-bezier(0.22,1,0.36,1) both}
|
|
20863
|
+
@media (prefers-reduced-motion: reduce){
|
|
20864
|
+
.dq-settle,.dq-focus{animation:none !important;opacity:1 !important;transform:none !important}
|
|
20865
|
+
}`;
|
|
20866
|
+
function figureOf(item, decision) {
|
|
20867
|
+
var _a2, _b, _c;
|
|
20868
|
+
if (decision.value == null) return decision.option;
|
|
20869
|
+
const unit = (_c = (_b = ((_a2 = item.options) != null ? _a2 : []).find((o) => o.label === decision.option)) == null ? void 0 : _b.adjust) == null ? void 0 : _c.unit;
|
|
20870
|
+
return `${decision.option} \xB7 ${formatFigure(decision.value, unit)}`;
|
|
20871
|
+
}
|
|
20872
|
+
function composeQueueMessage(items, decisions) {
|
|
20873
|
+
const lines = items.map((item, i) => {
|
|
20874
|
+
const d = decisions[i];
|
|
20875
|
+
return `${i + 1}. ${item.title} \u2192 ${d ? figureOf(item, d) : "(undecided)"}`;
|
|
20876
|
+
});
|
|
20877
|
+
const done = decisions.filter(Boolean).length;
|
|
20878
|
+
return `Decisions (${done}/${items.length}):
|
|
20879
|
+
${lines.join("\n")}`;
|
|
20880
|
+
}
|
|
20881
|
+
function Check({ size, color }) {
|
|
20882
|
+
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" }) });
|
|
20883
|
+
}
|
|
20884
|
+
function amountChip(item) {
|
|
20885
|
+
if (typeof item.amount !== "number") return null;
|
|
20886
|
+
const abs = Math.abs(item.amount);
|
|
20887
|
+
const sign = item.amount < 0 ? "-" : "";
|
|
20888
|
+
if (abs >= 1e6) return `${sign}$${(abs / 1e6).toFixed(abs >= 1e7 ? 0 : 1)}M`;
|
|
20889
|
+
if (abs >= 1e3) return `${sign}$${(abs / 1e3).toFixed(abs >= 1e4 ? 0 : 1)}K`;
|
|
20890
|
+
return `${sign}$${abs}`;
|
|
20891
|
+
}
|
|
20892
|
+
function DecisionQueueRenderer({ data, submitted = null, onSubmit }) {
|
|
20893
|
+
var _a2;
|
|
20894
|
+
const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
|
|
20895
|
+
const items = (_a2 = data.items) != null ? _a2 : [];
|
|
20896
|
+
const [decisions, setDecisions] = React45.useState(
|
|
20897
|
+
() => items.map(() => void 0)
|
|
20898
|
+
);
|
|
20899
|
+
const firstUndecided = decisions.findIndex((d) => !d);
|
|
20900
|
+
const [focusIdx, setFocusIdx] = React45.useState(firstUndecided >= 0 ? firstUndecided : null);
|
|
20901
|
+
const isSubmitted = submitted != null;
|
|
20902
|
+
const shown = isSubmitted ? items.map(
|
|
20903
|
+
(item, i) => {
|
|
20904
|
+
var _a3;
|
|
20905
|
+
return (_a3 = submitted.find((d) => d.id && d.id === item.id || d.title === item.title)) != null ? _a3 : submitted[i];
|
|
20906
|
+
}
|
|
20907
|
+
) : decisions;
|
|
20908
|
+
const decidedCount = shown.filter(Boolean).length;
|
|
20909
|
+
const allDecided = decidedCount === items.length;
|
|
20910
|
+
const decide = (idx, option, value) => {
|
|
20911
|
+
const item = items[idx];
|
|
20912
|
+
const next = decisions.slice();
|
|
20913
|
+
next[idx] = { id: item.id, title: item.title, option, value };
|
|
20914
|
+
setDecisions(next);
|
|
20915
|
+
const order = [...Array(items.length).keys()];
|
|
20916
|
+
const after = order.slice(idx + 1).concat(order.slice(0, idx + 1));
|
|
20917
|
+
const target = after.find((j) => j !== idx && !next[j]);
|
|
20918
|
+
setFocusIdx(target != null ? target : null);
|
|
20919
|
+
};
|
|
20920
|
+
const handleSubmit = () => {
|
|
20921
|
+
if (!allDecided || isSubmitted) return;
|
|
20922
|
+
const final = decisions;
|
|
20923
|
+
onSubmit == null ? void 0 : onSubmit(final, composeQueueMessage(items, final));
|
|
20924
|
+
};
|
|
20925
|
+
return /* @__PURE__ */ jsxs(
|
|
20926
|
+
"div",
|
|
20927
|
+
{
|
|
20928
|
+
"data-testid": "decision-queue",
|
|
20929
|
+
"data-submitted": isSubmitted || void 0,
|
|
20930
|
+
style: {
|
|
20931
|
+
position: "relative",
|
|
20932
|
+
width: "100%",
|
|
20933
|
+
minWidth: 0,
|
|
20934
|
+
boxSizing: "border-box",
|
|
20935
|
+
borderRadius: "0.75rem",
|
|
20936
|
+
border: `1px solid ${BORDER4}`,
|
|
20937
|
+
background: "white",
|
|
20938
|
+
boxShadow: "0 1px 2px rgba(0,0,0,0.03), 0 4px 12px rgba(0,0,0,0.04)",
|
|
20939
|
+
padding: "16px 18px",
|
|
20940
|
+
display: "flex",
|
|
20941
|
+
flexDirection: "column",
|
|
20942
|
+
gap: 12,
|
|
20943
|
+
overflow: "hidden"
|
|
20944
|
+
},
|
|
20945
|
+
children: [
|
|
20946
|
+
/* @__PURE__ */ jsx("style", { children: KEYFRAMES3 }),
|
|
20947
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 3 }, children: [
|
|
20948
|
+
/* @__PURE__ */ jsx(
|
|
20949
|
+
"span",
|
|
20950
|
+
{
|
|
20951
|
+
style: {
|
|
20952
|
+
fontSize: 10.5,
|
|
20953
|
+
textTransform: "uppercase",
|
|
20954
|
+
letterSpacing: "0.07em",
|
|
20955
|
+
fontWeight: 700,
|
|
20956
|
+
color: isSubmitted ? GREEN4 : ACCENT2
|
|
20957
|
+
},
|
|
20958
|
+
children: isSubmitted ? "Decisions submitted" : "Decisions need you"
|
|
20959
|
+
}
|
|
20960
|
+
),
|
|
20961
|
+
data.title && /* @__PURE__ */ jsx(
|
|
20962
|
+
"p",
|
|
20963
|
+
{
|
|
20964
|
+
style: {
|
|
20965
|
+
fontFamily: "var(--font-serif)",
|
|
20966
|
+
fontSize: 16,
|
|
20967
|
+
fontWeight: 400,
|
|
20968
|
+
color: "var(--foreground)",
|
|
20969
|
+
letterSpacing: "-0.01em",
|
|
20970
|
+
margin: 0,
|
|
20971
|
+
lineHeight: 1.25
|
|
20972
|
+
},
|
|
20973
|
+
children: data.title
|
|
20974
|
+
}
|
|
20975
|
+
),
|
|
20976
|
+
data.description && /* @__PURE__ */ jsx("p", { style: { fontSize: 12.5, color: MUTED2, margin: 0, lineHeight: 1.45 }, children: data.description })
|
|
20977
|
+
] }),
|
|
20978
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: items.map((item, idx) => {
|
|
20979
|
+
var _a3, _b, _c;
|
|
20980
|
+
const decision = shown[idx];
|
|
20981
|
+
const focused = !isSubmitted && focusIdx === idx;
|
|
20982
|
+
if (focused) {
|
|
20983
|
+
return /* @__PURE__ */ jsx("div", { className: "dq-focus", "data-testid": `decision-queue-focus-${idx}`, children: /* @__PURE__ */ jsx(
|
|
20984
|
+
DecisionCardRenderer,
|
|
20985
|
+
{
|
|
20986
|
+
data: __spreadValues({ type: "decision-card" }, item),
|
|
20987
|
+
resolved: null,
|
|
20988
|
+
onResolve: (option, value) => decide(idx, option, value),
|
|
20989
|
+
eyebrow: `${idx + 1} of ${items.length}${item.decision_type ? ` \xB7 ${item.decision_type}` : ""}`
|
|
20990
|
+
}
|
|
20991
|
+
) }, (_a3 = item.id) != null ? _a3 : `q-${idx}`);
|
|
20992
|
+
}
|
|
20993
|
+
if (decision) {
|
|
20994
|
+
return /* @__PURE__ */ jsxs(
|
|
20995
|
+
"button",
|
|
20996
|
+
{
|
|
20997
|
+
type: "button",
|
|
20998
|
+
className: "dq-settle",
|
|
20999
|
+
onClick: isSubmitted ? void 0 : () => setFocusIdx(idx),
|
|
21000
|
+
disabled: isSubmitted,
|
|
21001
|
+
title: isSubmitted ? void 0 : "Change this decision",
|
|
21002
|
+
"data-testid": `decision-queue-receipt-${idx}`,
|
|
21003
|
+
style: {
|
|
21004
|
+
display: "flex",
|
|
21005
|
+
alignItems: "center",
|
|
21006
|
+
gap: 8,
|
|
21007
|
+
width: "100%",
|
|
21008
|
+
textAlign: "left",
|
|
21009
|
+
border: "1px solid #dcfce7",
|
|
21010
|
+
background: "#f6fef9",
|
|
21011
|
+
borderRadius: 8,
|
|
21012
|
+
padding: "7px 11px",
|
|
21013
|
+
cursor: isSubmitted ? "default" : "pointer",
|
|
21014
|
+
font: "inherit"
|
|
21015
|
+
},
|
|
21016
|
+
children: [
|
|
21017
|
+
/* @__PURE__ */ jsx(Check, { size: 13, color: GREEN4 }),
|
|
21018
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: 12.5, fontWeight: 600, color: "var(--foreground)", minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: item.title }),
|
|
21019
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { color: MUTED2, fontSize: 12 }, children: "\u2192" }),
|
|
21020
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: 12.5, fontWeight: 600, color: GREEN4, fontVariantNumeric: "tabular-nums", whiteSpace: "nowrap" }, children: figureOf(item, decision) }),
|
|
21021
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1 } }),
|
|
21022
|
+
!isSubmitted && /* @__PURE__ */ jsx("span", { style: { fontSize: 11, fontWeight: 600, color: MUTED2 }, children: "Change" })
|
|
21023
|
+
]
|
|
21024
|
+
},
|
|
21025
|
+
(_b = item.id) != null ? _b : `q-${idx}`
|
|
21026
|
+
);
|
|
21027
|
+
}
|
|
21028
|
+
return /* @__PURE__ */ jsxs(
|
|
21029
|
+
"button",
|
|
21030
|
+
{
|
|
21031
|
+
type: "button",
|
|
21032
|
+
onClick: isSubmitted ? void 0 : () => setFocusIdx(idx),
|
|
21033
|
+
disabled: isSubmitted,
|
|
21034
|
+
"data-testid": `decision-queue-upcoming-${idx}`,
|
|
21035
|
+
style: {
|
|
21036
|
+
display: "flex",
|
|
21037
|
+
alignItems: "center",
|
|
21038
|
+
gap: 8,
|
|
21039
|
+
width: "100%",
|
|
21040
|
+
textAlign: "left",
|
|
21041
|
+
border: `1px dashed ${BORDER4}`,
|
|
21042
|
+
background: "white",
|
|
21043
|
+
borderRadius: 8,
|
|
21044
|
+
padding: "7px 11px",
|
|
21045
|
+
cursor: isSubmitted ? "default" : "pointer",
|
|
21046
|
+
font: "inherit",
|
|
21047
|
+
opacity: 0.75
|
|
21048
|
+
},
|
|
21049
|
+
children: [
|
|
21050
|
+
/* @__PURE__ */ jsx(
|
|
21051
|
+
"span",
|
|
21052
|
+
{
|
|
21053
|
+
"aria-hidden": "true",
|
|
21054
|
+
style: { width: 13, height: 13, borderRadius: "50%", border: `1.5px solid ${MUTED2}`, flexShrink: 0, boxSizing: "border-box" }
|
|
21055
|
+
}
|
|
21056
|
+
),
|
|
21057
|
+
/* @__PURE__ */ jsxs("span", { style: { fontSize: 12.5, fontWeight: 600, color: MUTED2, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: [
|
|
21058
|
+
item.decision_type ? `${item.decision_type} \xB7 ` : "",
|
|
21059
|
+
item.title
|
|
21060
|
+
] }),
|
|
21061
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1 } }),
|
|
21062
|
+
amountChip(item) && /* @__PURE__ */ jsx("span", { style: { fontSize: 11.5, fontWeight: 700, color: MUTED2, fontVariantNumeric: "tabular-nums" }, children: amountChip(item) })
|
|
21063
|
+
]
|
|
21064
|
+
},
|
|
21065
|
+
(_c = item.id) != null ? _c : `q-${idx}`
|
|
21066
|
+
);
|
|
21067
|
+
}) }),
|
|
21068
|
+
/* @__PURE__ */ jsxs(
|
|
21069
|
+
"div",
|
|
21070
|
+
{
|
|
21071
|
+
style: {
|
|
21072
|
+
display: "flex",
|
|
21073
|
+
alignItems: "center",
|
|
21074
|
+
gap: 10,
|
|
21075
|
+
paddingTop: 10,
|
|
21076
|
+
borderTop: `1px solid #f0f0f0`
|
|
21077
|
+
},
|
|
21078
|
+
children: [
|
|
21079
|
+
/* @__PURE__ */ jsx("span", { style: { display: "inline-flex", gap: 4 }, "aria-hidden": "true", children: items.map((_, i) => /* @__PURE__ */ jsx(
|
|
21080
|
+
"span",
|
|
21081
|
+
{
|
|
21082
|
+
style: {
|
|
21083
|
+
width: 7,
|
|
21084
|
+
height: 7,
|
|
21085
|
+
borderRadius: "50%",
|
|
21086
|
+
background: shown[i] ? isSubmitted ? GREEN4 : ACCENT2 : "#e8e8e8",
|
|
21087
|
+
transition: "background 0.2s"
|
|
21088
|
+
}
|
|
21089
|
+
},
|
|
21090
|
+
`dot-${i}`
|
|
21091
|
+
)) }),
|
|
21092
|
+
/* @__PURE__ */ jsxs(
|
|
21093
|
+
"span",
|
|
21094
|
+
{
|
|
21095
|
+
style: { fontSize: 11.5, fontWeight: 600, color: MUTED2, fontVariantNumeric: "tabular-nums" },
|
|
21096
|
+
"data-testid": "decision-queue-progress",
|
|
21097
|
+
children: [
|
|
21098
|
+
decidedCount,
|
|
21099
|
+
"/",
|
|
21100
|
+
items.length,
|
|
21101
|
+
" decided"
|
|
21102
|
+
]
|
|
21103
|
+
}
|
|
21104
|
+
),
|
|
21105
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1 } }),
|
|
21106
|
+
isSubmitted ? /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: 6, fontSize: 12.5, fontWeight: 600, color: GREEN4 }, children: [
|
|
21107
|
+
/* @__PURE__ */ jsx(Check, { size: 14, color: GREEN4 }),
|
|
21108
|
+
"Submitted"
|
|
21109
|
+
] }) : /* @__PURE__ */ jsx(
|
|
21110
|
+
"button",
|
|
21111
|
+
{
|
|
21112
|
+
type: "button",
|
|
21113
|
+
onClick: handleSubmit,
|
|
21114
|
+
disabled: !allDecided,
|
|
21115
|
+
"data-testid": "decision-queue-submit",
|
|
21116
|
+
style: {
|
|
21117
|
+
border: `1px solid ${allDecided ? ACCENT2 : BORDER4}`,
|
|
21118
|
+
background: allDecided ? ACCENT2 : "#f6f6f6",
|
|
21119
|
+
color: allDecided ? "white" : MUTED2,
|
|
21120
|
+
borderRadius: 8,
|
|
21121
|
+
fontSize: 13,
|
|
21122
|
+
fontWeight: 600,
|
|
21123
|
+
padding: "8px 16px",
|
|
21124
|
+
cursor: allDecided ? "pointer" : "default",
|
|
21125
|
+
fontVariantNumeric: "tabular-nums",
|
|
21126
|
+
transition: "background 0.15s, border-color 0.15s, color 0.15s"
|
|
21127
|
+
},
|
|
21128
|
+
children: data.submit_label || `Submit ${items.length} decision${items.length === 1 ? "" : "s"}`
|
|
21129
|
+
}
|
|
21130
|
+
)
|
|
21131
|
+
]
|
|
21132
|
+
}
|
|
21133
|
+
)
|
|
21134
|
+
]
|
|
21135
|
+
}
|
|
21136
|
+
);
|
|
21137
|
+
}
|
|
21138
|
+
function DecisionQueueResolver(p) {
|
|
21139
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
21140
|
+
const { resolvedDecisions, onDecisionQueueSubmit } = useGenUIInteraction();
|
|
21141
|
+
const queueId = (_b = (_a2 = p.id) != null ? _a2 : p.title) != null ? _b : "decision-queue";
|
|
21142
|
+
const replayed = (_d = (_c = p.resolved) == null ? void 0 : _c.decisions) != null ? _d : null;
|
|
21143
|
+
const [localSubmitted, setLocalSubmitted] = React45.useState(null);
|
|
21144
|
+
const hostLocked = (resolvedDecisions == null ? void 0 : resolvedDecisions[queueId]) != null;
|
|
21145
|
+
const submitted = (_e = replayed != null ? replayed : localSubmitted) != null ? _e : hostLocked ? [] : null;
|
|
21146
|
+
const handleSubmit = (decisions, message) => {
|
|
21147
|
+
setLocalSubmitted(decisions);
|
|
21148
|
+
onDecisionQueueSubmit == null ? void 0 : onDecisionQueueSubmit(queueId, decisions, message);
|
|
21149
|
+
};
|
|
21150
|
+
return /* @__PURE__ */ jsx(ComponentActions, { filename: (_f = p.title) != null ? _f : "decision-queue", children: /* @__PURE__ */ jsx(DecisionQueueRenderer, { data: p, submitted, onSubmit: handleSubmit }) });
|
|
21151
|
+
}
|
|
21152
|
+
init_ThemeContext();
|
|
20693
21153
|
var CONNECTED_GREEN3 = "#15803d";
|
|
20694
21154
|
var CONNECTED_GREEN_BG = "#dcfce7";
|
|
20695
21155
|
var PENDING_AMBER = "#92400e";
|
|
@@ -21121,6 +21581,8 @@ function resolveUI(rawPayload) {
|
|
|
21121
21581
|
return /* @__PURE__ */ jsx(DocumentFieldExtractionResolver, __spreadValues({}, payload));
|
|
21122
21582
|
case "decision-card":
|
|
21123
21583
|
return /* @__PURE__ */ jsx(DecisionCardResolver, __spreadValues({}, payload));
|
|
21584
|
+
case "decision-queue":
|
|
21585
|
+
return /* @__PURE__ */ jsx(DecisionQueueResolver, __spreadValues({}, payload));
|
|
21124
21586
|
case "tabby-auth":
|
|
21125
21587
|
return /* @__PURE__ */ jsx(TabbyAuthResolver, __spreadValues({}, payload));
|
|
21126
21588
|
default: {
|