@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.cjs
CHANGED
|
@@ -5669,6 +5669,167 @@ var decisionCardTool = {
|
|
|
5669
5669
|
required: ["type", "title", "question", "options"]
|
|
5670
5670
|
}
|
|
5671
5671
|
};
|
|
5672
|
+
var decisionQueueItemSchema = zod.z.object({
|
|
5673
|
+
id: zod.z.string().optional(),
|
|
5674
|
+
decision_type: zod.z.string().optional(),
|
|
5675
|
+
title: zod.z.string(),
|
|
5676
|
+
question: zod.z.string(),
|
|
5677
|
+
amount: zod.z.number().optional(),
|
|
5678
|
+
currency: zod.z.string().optional(),
|
|
5679
|
+
amount_label: zod.z.string().optional(),
|
|
5680
|
+
severity: zod.z.enum(["low", "medium", "high"]).optional(),
|
|
5681
|
+
flags: zod.z.array(
|
|
5682
|
+
zod.z.object({
|
|
5683
|
+
field: zod.z.string().optional(),
|
|
5684
|
+
issue: zod.z.string(),
|
|
5685
|
+
severity: zod.z.enum(["low", "medium", "high"]).optional()
|
|
5686
|
+
})
|
|
5687
|
+
).max(6).optional(),
|
|
5688
|
+
options: zod.z.array(
|
|
5689
|
+
zod.z.object({
|
|
5690
|
+
id: zod.z.string().optional(),
|
|
5691
|
+
label: zod.z.string(),
|
|
5692
|
+
recommended: zod.z.boolean().optional(),
|
|
5693
|
+
value: zod.z.number().optional(),
|
|
5694
|
+
adjust: zod.z.object({
|
|
5695
|
+
min: zod.z.number(),
|
|
5696
|
+
max: zod.z.number(),
|
|
5697
|
+
step: zod.z.number().optional(),
|
|
5698
|
+
unit: zod.z.string().optional()
|
|
5699
|
+
}).optional()
|
|
5700
|
+
})
|
|
5701
|
+
).min(1).max(5),
|
|
5702
|
+
source: zod.z.object({
|
|
5703
|
+
label: zod.z.string().optional(),
|
|
5704
|
+
url: zod.z.string().optional()
|
|
5705
|
+
}).optional()
|
|
5706
|
+
});
|
|
5707
|
+
var decisionQueueSchema = zod.z.object({
|
|
5708
|
+
type: zod.z.literal("decision-queue"),
|
|
5709
|
+
id: zod.z.string().optional(),
|
|
5710
|
+
title: zod.z.string().optional(),
|
|
5711
|
+
description: zod.z.string().optional(),
|
|
5712
|
+
submit_label: zod.z.string().optional(),
|
|
5713
|
+
items: zod.z.array(decisionQueueItemSchema).min(2).max(12),
|
|
5714
|
+
resolved: zod.z.object({
|
|
5715
|
+
decisions: zod.z.array(
|
|
5716
|
+
zod.z.object({
|
|
5717
|
+
id: zod.z.string().optional(),
|
|
5718
|
+
title: zod.z.string(),
|
|
5719
|
+
option: zod.z.string(),
|
|
5720
|
+
value: zod.z.number().optional()
|
|
5721
|
+
})
|
|
5722
|
+
)
|
|
5723
|
+
}).optional()
|
|
5724
|
+
});
|
|
5725
|
+
var OPTION_ITEM_JSON = {
|
|
5726
|
+
type: "object",
|
|
5727
|
+
properties: {
|
|
5728
|
+
id: { type: "string" },
|
|
5729
|
+
label: { type: "string" },
|
|
5730
|
+
recommended: { type: "boolean" },
|
|
5731
|
+
value: {
|
|
5732
|
+
type: "number",
|
|
5733
|
+
description: "Suggested numeric figure for this option (starting point of the adjuster)"
|
|
5734
|
+
},
|
|
5735
|
+
adjust: {
|
|
5736
|
+
type: "object",
|
|
5737
|
+
description: "Allow the user to tune `value` within this inclusive range before deciding",
|
|
5738
|
+
properties: {
|
|
5739
|
+
min: { type: "number" },
|
|
5740
|
+
max: { type: "number" },
|
|
5741
|
+
step: { type: "number" },
|
|
5742
|
+
unit: { type: "string", description: "Short unit suffix, e.g. 'units', '%', 'hrs'" }
|
|
5743
|
+
},
|
|
5744
|
+
required: ["min", "max"]
|
|
5745
|
+
}
|
|
5746
|
+
},
|
|
5747
|
+
required: ["label"]
|
|
5748
|
+
};
|
|
5749
|
+
var decisionQueueTool = {
|
|
5750
|
+
name: "render_decision_queue",
|
|
5751
|
+
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.",
|
|
5752
|
+
input_schema: {
|
|
5753
|
+
type: "object",
|
|
5754
|
+
properties: {
|
|
5755
|
+
type: { type: "string", enum: ["decision-queue"] },
|
|
5756
|
+
id: { type: "string", description: "Stable id for update-in-place rendering" },
|
|
5757
|
+
title: {
|
|
5758
|
+
type: "string",
|
|
5759
|
+
description: "Batch headline shown in the header, e.g. 'Reconciliation exceptions'"
|
|
5760
|
+
},
|
|
5761
|
+
description: { type: "string", description: "One-line context above the queue" },
|
|
5762
|
+
submit_label: { type: "string", description: "CTA label; defaults to 'Submit N decisions'" },
|
|
5763
|
+
items: {
|
|
5764
|
+
type: "array",
|
|
5765
|
+
minItems: 2,
|
|
5766
|
+
maxItems: 12,
|
|
5767
|
+
description: "The pending judgments, in the order the user should take them. Each is a full decision-card body (no `type`).",
|
|
5768
|
+
items: {
|
|
5769
|
+
type: "object",
|
|
5770
|
+
properties: {
|
|
5771
|
+
id: { type: "string" },
|
|
5772
|
+
decision_type: {
|
|
5773
|
+
type: "string",
|
|
5774
|
+
description: "Short category eyebrow, e.g. 'Duplicate', 'Capitalization'"
|
|
5775
|
+
},
|
|
5776
|
+
title: { type: "string" },
|
|
5777
|
+
question: { type: "string" },
|
|
5778
|
+
amount: { type: "number" },
|
|
5779
|
+
currency: { type: "string" },
|
|
5780
|
+
amount_label: { type: "string" },
|
|
5781
|
+
severity: { type: "string", enum: ["low", "medium", "high"] },
|
|
5782
|
+
flags: {
|
|
5783
|
+
type: "array",
|
|
5784
|
+
maxItems: 6,
|
|
5785
|
+
items: {
|
|
5786
|
+
type: "object",
|
|
5787
|
+
properties: {
|
|
5788
|
+
field: { type: "string" },
|
|
5789
|
+
issue: { type: "string" },
|
|
5790
|
+
severity: { type: "string", enum: ["low", "medium", "high"] }
|
|
5791
|
+
},
|
|
5792
|
+
required: ["issue"]
|
|
5793
|
+
}
|
|
5794
|
+
},
|
|
5795
|
+
options: {
|
|
5796
|
+
type: "array",
|
|
5797
|
+
minItems: 1,
|
|
5798
|
+
maxItems: 5,
|
|
5799
|
+
items: OPTION_ITEM_JSON
|
|
5800
|
+
},
|
|
5801
|
+
source: {
|
|
5802
|
+
type: "object",
|
|
5803
|
+
properties: { label: { type: "string" }, url: { type: "string" } }
|
|
5804
|
+
}
|
|
5805
|
+
},
|
|
5806
|
+
required: ["title", "question", "options"]
|
|
5807
|
+
}
|
|
5808
|
+
},
|
|
5809
|
+
resolved: {
|
|
5810
|
+
type: "object",
|
|
5811
|
+
description: "Pre-resolved state for transcript replay",
|
|
5812
|
+
properties: {
|
|
5813
|
+
decisions: {
|
|
5814
|
+
type: "array",
|
|
5815
|
+
items: {
|
|
5816
|
+
type: "object",
|
|
5817
|
+
properties: {
|
|
5818
|
+
id: { type: "string" },
|
|
5819
|
+
title: { type: "string" },
|
|
5820
|
+
option: { type: "string" },
|
|
5821
|
+
value: { type: "number" }
|
|
5822
|
+
},
|
|
5823
|
+
required: ["title", "option"]
|
|
5824
|
+
}
|
|
5825
|
+
}
|
|
5826
|
+
},
|
|
5827
|
+
required: ["decisions"]
|
|
5828
|
+
}
|
|
5829
|
+
},
|
|
5830
|
+
required: ["type", "items"]
|
|
5831
|
+
}
|
|
5832
|
+
};
|
|
5672
5833
|
var tabbyAuthSchema = zod.z.object({
|
|
5673
5834
|
type: zod.z.literal("tabby-auth"),
|
|
5674
5835
|
app: zod.z.string(),
|
|
@@ -5820,6 +5981,7 @@ var schemaRegistry = {
|
|
|
5820
5981
|
"workflow-stepper": { schema: workflowStepperSchema, tool: workflowStepperTool },
|
|
5821
5982
|
"document-field-extraction": { schema: documentFieldExtractionSchema, tool: documentFieldExtractionTool },
|
|
5822
5983
|
"decision-card": { schema: decisionCardSchema, tool: decisionCardTool },
|
|
5984
|
+
"decision-queue": { schema: decisionQueueSchema, tool: decisionQueueTool },
|
|
5823
5985
|
"tabby-auth": { schema: tabbyAuthSchema, tool: tabbyAuthTool }
|
|
5824
5986
|
};
|
|
5825
5987
|
|
|
@@ -6533,17 +6695,17 @@ function SparklineTableResolver(p) {
|
|
|
6533
6695
|
// src/composites/heatmap-table/resolver.tsx
|
|
6534
6696
|
init_theme();
|
|
6535
6697
|
init_ThemeContext();
|
|
6536
|
-
function heatColor(
|
|
6537
|
-
const clamped = Math.max(-3, Math.min(3,
|
|
6698
|
+
function heatColor(z63) {
|
|
6699
|
+
const clamped = Math.max(-3, Math.min(3, z63));
|
|
6538
6700
|
const abs = Math.abs(clamped);
|
|
6539
6701
|
const lightness = 95 - abs * 8;
|
|
6540
6702
|
const hue = clamped >= 0 ? 142 : 0;
|
|
6541
6703
|
return `hsl(${hue} 60% ${lightness}%)`;
|
|
6542
6704
|
}
|
|
6543
|
-
function heatTextColor(
|
|
6544
|
-
const abs = Math.abs(
|
|
6545
|
-
if (abs > 2) return
|
|
6546
|
-
if (abs > 1) return
|
|
6705
|
+
function heatTextColor(z63) {
|
|
6706
|
+
const abs = Math.abs(z63);
|
|
6707
|
+
if (abs > 2) return z63 >= 0 ? "#14532d" : "#7f1d1d";
|
|
6708
|
+
if (abs > 1) return z63 >= 0 ? "#166534" : "#991b1b";
|
|
6547
6709
|
return "var(--foreground)";
|
|
6548
6710
|
}
|
|
6549
6711
|
var th2 = {
|
|
@@ -17594,7 +17756,8 @@ var DEFAULT_INTERACTION = {
|
|
|
17594
17756
|
onStepSelect: void 0,
|
|
17595
17757
|
resolvedDecisions: void 0,
|
|
17596
17758
|
onDecisionResolve: void 0,
|
|
17597
|
-
onDecisionSource: void 0
|
|
17759
|
+
onDecisionSource: void 0,
|
|
17760
|
+
onDecisionQueueSubmit: void 0
|
|
17598
17761
|
};
|
|
17599
17762
|
var GenUIInteractionContext = React45.createContext(DEFAULT_INTERACTION);
|
|
17600
17763
|
function GenUIInteractionProvider({ value, children }) {
|
|
@@ -20382,7 +20545,8 @@ function DecisionCardRenderer({
|
|
|
20382
20545
|
data,
|
|
20383
20546
|
resolved = null,
|
|
20384
20547
|
onResolve,
|
|
20385
|
-
onOpenSource
|
|
20548
|
+
onOpenSource,
|
|
20549
|
+
eyebrow
|
|
20386
20550
|
}) {
|
|
20387
20551
|
var _a2, _b, _c;
|
|
20388
20552
|
const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
|
|
@@ -20488,7 +20652,7 @@ function DecisionCardRenderer({
|
|
|
20488
20652
|
},
|
|
20489
20653
|
children: [
|
|
20490
20654
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { minWidth: 0, display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
20491
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
20655
|
+
eyebrow === null ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
20492
20656
|
"span",
|
|
20493
20657
|
{
|
|
20494
20658
|
style: {
|
|
@@ -20498,7 +20662,7 @@ function DecisionCardRenderer({
|
|
|
20498
20662
|
fontWeight: 700,
|
|
20499
20663
|
color: ACCENT2
|
|
20500
20664
|
},
|
|
20501
|
-
children: data.decision_type ? `Decision needs you \xB7 ${data.decision_type}` : "Decision needs you"
|
|
20665
|
+
children: eyebrow !== void 0 ? eyebrow : data.decision_type ? `Decision needs you \xB7 ${data.decision_type}` : "Decision needs you"
|
|
20502
20666
|
}
|
|
20503
20667
|
),
|
|
20504
20668
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -20718,6 +20882,302 @@ function DecisionCardResolver(p) {
|
|
|
20718
20882
|
) });
|
|
20719
20883
|
}
|
|
20720
20884
|
init_ThemeContext();
|
|
20885
|
+
var GREEN4 = "#15803d";
|
|
20886
|
+
var KEYFRAMES3 = `
|
|
20887
|
+
@keyframes dqSettle{from{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:none}}
|
|
20888
|
+
.dq-settle{animation:dqSettle 0.24s cubic-bezier(0.22,1,0.36,1) both}
|
|
20889
|
+
@keyframes dqFocus{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}
|
|
20890
|
+
.dq-focus{animation:dqFocus 0.28s cubic-bezier(0.22,1,0.36,1) both}
|
|
20891
|
+
@media (prefers-reduced-motion: reduce){
|
|
20892
|
+
.dq-settle,.dq-focus{animation:none !important;opacity:1 !important;transform:none !important}
|
|
20893
|
+
}`;
|
|
20894
|
+
function figureOf(item, decision) {
|
|
20895
|
+
var _a2, _b, _c;
|
|
20896
|
+
if (decision.value == null) return decision.option;
|
|
20897
|
+
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;
|
|
20898
|
+
return `${decision.option} \xB7 ${formatFigure(decision.value, unit)}`;
|
|
20899
|
+
}
|
|
20900
|
+
function composeQueueMessage(items, decisions) {
|
|
20901
|
+
const lines = items.map((item, i) => {
|
|
20902
|
+
const d = decisions[i];
|
|
20903
|
+
return `${i + 1}. ${item.title} \u2192 ${d ? figureOf(item, d) : "(undecided)"}`;
|
|
20904
|
+
});
|
|
20905
|
+
const done = decisions.filter(Boolean).length;
|
|
20906
|
+
return `Decisions (${done}/${items.length}):
|
|
20907
|
+
${lines.join("\n")}`;
|
|
20908
|
+
}
|
|
20909
|
+
function Check({ size, color }) {
|
|
20910
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 13l4 4L19 7", stroke: color, strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
20911
|
+
}
|
|
20912
|
+
function amountChip(item) {
|
|
20913
|
+
if (typeof item.amount !== "number") return null;
|
|
20914
|
+
const abs = Math.abs(item.amount);
|
|
20915
|
+
const sign = item.amount < 0 ? "-" : "";
|
|
20916
|
+
if (abs >= 1e6) return `${sign}$${(abs / 1e6).toFixed(abs >= 1e7 ? 0 : 1)}M`;
|
|
20917
|
+
if (abs >= 1e3) return `${sign}$${(abs / 1e3).toFixed(abs >= 1e4 ? 0 : 1)}K`;
|
|
20918
|
+
return `${sign}$${abs}`;
|
|
20919
|
+
}
|
|
20920
|
+
function DecisionQueueRenderer({ data, submitted = null, onSubmit }) {
|
|
20921
|
+
var _a2;
|
|
20922
|
+
const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
|
|
20923
|
+
const items = (_a2 = data.items) != null ? _a2 : [];
|
|
20924
|
+
const [decisions, setDecisions] = React45__default.default.useState(
|
|
20925
|
+
() => items.map(() => void 0)
|
|
20926
|
+
);
|
|
20927
|
+
const firstUndecided = decisions.findIndex((d) => !d);
|
|
20928
|
+
const [focusIdx, setFocusIdx] = React45__default.default.useState(firstUndecided >= 0 ? firstUndecided : null);
|
|
20929
|
+
const isSubmitted = submitted != null;
|
|
20930
|
+
const shown = isSubmitted ? items.map(
|
|
20931
|
+
(item, i) => {
|
|
20932
|
+
var _a3;
|
|
20933
|
+
return (_a3 = submitted.find((d) => d.id && d.id === item.id || d.title === item.title)) != null ? _a3 : submitted[i];
|
|
20934
|
+
}
|
|
20935
|
+
) : decisions;
|
|
20936
|
+
const decidedCount = shown.filter(Boolean).length;
|
|
20937
|
+
const allDecided = decidedCount === items.length;
|
|
20938
|
+
const decide = (idx, option, value) => {
|
|
20939
|
+
const item = items[idx];
|
|
20940
|
+
const next = decisions.slice();
|
|
20941
|
+
next[idx] = { id: item.id, title: item.title, option, value };
|
|
20942
|
+
setDecisions(next);
|
|
20943
|
+
const order = [...Array(items.length).keys()];
|
|
20944
|
+
const after = order.slice(idx + 1).concat(order.slice(0, idx + 1));
|
|
20945
|
+
const target = after.find((j) => j !== idx && !next[j]);
|
|
20946
|
+
setFocusIdx(target != null ? target : null);
|
|
20947
|
+
};
|
|
20948
|
+
const handleSubmit = () => {
|
|
20949
|
+
if (!allDecided || isSubmitted) return;
|
|
20950
|
+
const final = decisions;
|
|
20951
|
+
onSubmit == null ? void 0 : onSubmit(final, composeQueueMessage(items, final));
|
|
20952
|
+
};
|
|
20953
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
20954
|
+
"div",
|
|
20955
|
+
{
|
|
20956
|
+
"data-testid": "decision-queue",
|
|
20957
|
+
"data-submitted": isSubmitted || void 0,
|
|
20958
|
+
style: {
|
|
20959
|
+
position: "relative",
|
|
20960
|
+
width: "100%",
|
|
20961
|
+
minWidth: 0,
|
|
20962
|
+
boxSizing: "border-box",
|
|
20963
|
+
borderRadius: "0.75rem",
|
|
20964
|
+
border: `1px solid ${BORDER4}`,
|
|
20965
|
+
background: "white",
|
|
20966
|
+
boxShadow: "0 1px 2px rgba(0,0,0,0.03), 0 4px 12px rgba(0,0,0,0.04)",
|
|
20967
|
+
padding: "16px 18px",
|
|
20968
|
+
display: "flex",
|
|
20969
|
+
flexDirection: "column",
|
|
20970
|
+
gap: 12,
|
|
20971
|
+
overflow: "hidden"
|
|
20972
|
+
},
|
|
20973
|
+
children: [
|
|
20974
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { children: KEYFRAMES3 }),
|
|
20975
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 3 }, children: [
|
|
20976
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
20977
|
+
"span",
|
|
20978
|
+
{
|
|
20979
|
+
style: {
|
|
20980
|
+
fontSize: 10.5,
|
|
20981
|
+
textTransform: "uppercase",
|
|
20982
|
+
letterSpacing: "0.07em",
|
|
20983
|
+
fontWeight: 700,
|
|
20984
|
+
color: isSubmitted ? GREEN4 : ACCENT2
|
|
20985
|
+
},
|
|
20986
|
+
children: isSubmitted ? "Decisions submitted" : "Decisions need you"
|
|
20987
|
+
}
|
|
20988
|
+
),
|
|
20989
|
+
data.title && /* @__PURE__ */ jsxRuntime.jsx(
|
|
20990
|
+
"p",
|
|
20991
|
+
{
|
|
20992
|
+
style: {
|
|
20993
|
+
fontFamily: "var(--font-serif)",
|
|
20994
|
+
fontSize: 16,
|
|
20995
|
+
fontWeight: 400,
|
|
20996
|
+
color: "var(--foreground)",
|
|
20997
|
+
letterSpacing: "-0.01em",
|
|
20998
|
+
margin: 0,
|
|
20999
|
+
lineHeight: 1.25
|
|
21000
|
+
},
|
|
21001
|
+
children: data.title
|
|
21002
|
+
}
|
|
21003
|
+
),
|
|
21004
|
+
data.description && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontSize: 12.5, color: MUTED2, margin: 0, lineHeight: 1.45 }, children: data.description })
|
|
21005
|
+
] }),
|
|
21006
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: items.map((item, idx) => {
|
|
21007
|
+
var _a3, _b, _c;
|
|
21008
|
+
const decision = shown[idx];
|
|
21009
|
+
const focused = !isSubmitted && focusIdx === idx;
|
|
21010
|
+
if (focused) {
|
|
21011
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "dq-focus", "data-testid": `decision-queue-focus-${idx}`, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
21012
|
+
DecisionCardRenderer,
|
|
21013
|
+
{
|
|
21014
|
+
data: __spreadValues({ type: "decision-card" }, item),
|
|
21015
|
+
resolved: null,
|
|
21016
|
+
onResolve: (option, value) => decide(idx, option, value),
|
|
21017
|
+
eyebrow: `${idx + 1} of ${items.length}${item.decision_type ? ` \xB7 ${item.decision_type}` : ""}`
|
|
21018
|
+
}
|
|
21019
|
+
) }, (_a3 = item.id) != null ? _a3 : `q-${idx}`);
|
|
21020
|
+
}
|
|
21021
|
+
if (decision) {
|
|
21022
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21023
|
+
"button",
|
|
21024
|
+
{
|
|
21025
|
+
type: "button",
|
|
21026
|
+
className: "dq-settle",
|
|
21027
|
+
onClick: isSubmitted ? void 0 : () => setFocusIdx(idx),
|
|
21028
|
+
disabled: isSubmitted,
|
|
21029
|
+
title: isSubmitted ? void 0 : "Change this decision",
|
|
21030
|
+
"data-testid": `decision-queue-receipt-${idx}`,
|
|
21031
|
+
style: {
|
|
21032
|
+
display: "flex",
|
|
21033
|
+
alignItems: "center",
|
|
21034
|
+
gap: 8,
|
|
21035
|
+
width: "100%",
|
|
21036
|
+
textAlign: "left",
|
|
21037
|
+
border: "1px solid #dcfce7",
|
|
21038
|
+
background: "#f6fef9",
|
|
21039
|
+
borderRadius: 8,
|
|
21040
|
+
padding: "7px 11px",
|
|
21041
|
+
cursor: isSubmitted ? "default" : "pointer",
|
|
21042
|
+
font: "inherit"
|
|
21043
|
+
},
|
|
21044
|
+
children: [
|
|
21045
|
+
/* @__PURE__ */ jsxRuntime.jsx(Check, { size: 13, color: GREEN4 }),
|
|
21046
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 12.5, fontWeight: 600, color: "var(--foreground)", minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: item.title }),
|
|
21047
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", style: { color: MUTED2, fontSize: 12 }, children: "\u2192" }),
|
|
21048
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 12.5, fontWeight: 600, color: GREEN4, fontVariantNumeric: "tabular-nums", whiteSpace: "nowrap" }, children: figureOf(item, decision) }),
|
|
21049
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { flex: 1 } }),
|
|
21050
|
+
!isSubmitted && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 11, fontWeight: 600, color: MUTED2 }, children: "Change" })
|
|
21051
|
+
]
|
|
21052
|
+
},
|
|
21053
|
+
(_b = item.id) != null ? _b : `q-${idx}`
|
|
21054
|
+
);
|
|
21055
|
+
}
|
|
21056
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21057
|
+
"button",
|
|
21058
|
+
{
|
|
21059
|
+
type: "button",
|
|
21060
|
+
onClick: isSubmitted ? void 0 : () => setFocusIdx(idx),
|
|
21061
|
+
disabled: isSubmitted,
|
|
21062
|
+
"data-testid": `decision-queue-upcoming-${idx}`,
|
|
21063
|
+
style: {
|
|
21064
|
+
display: "flex",
|
|
21065
|
+
alignItems: "center",
|
|
21066
|
+
gap: 8,
|
|
21067
|
+
width: "100%",
|
|
21068
|
+
textAlign: "left",
|
|
21069
|
+
border: `1px dashed ${BORDER4}`,
|
|
21070
|
+
background: "white",
|
|
21071
|
+
borderRadius: 8,
|
|
21072
|
+
padding: "7px 11px",
|
|
21073
|
+
cursor: isSubmitted ? "default" : "pointer",
|
|
21074
|
+
font: "inherit",
|
|
21075
|
+
opacity: 0.75
|
|
21076
|
+
},
|
|
21077
|
+
children: [
|
|
21078
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21079
|
+
"span",
|
|
21080
|
+
{
|
|
21081
|
+
"aria-hidden": "true",
|
|
21082
|
+
style: { width: 13, height: 13, borderRadius: "50%", border: `1.5px solid ${MUTED2}`, flexShrink: 0, boxSizing: "border-box" }
|
|
21083
|
+
}
|
|
21084
|
+
),
|
|
21085
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: 12.5, fontWeight: 600, color: MUTED2, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: [
|
|
21086
|
+
item.decision_type ? `${item.decision_type} \xB7 ` : "",
|
|
21087
|
+
item.title
|
|
21088
|
+
] }),
|
|
21089
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { flex: 1 } }),
|
|
21090
|
+
amountChip(item) && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 11.5, fontWeight: 700, color: MUTED2, fontVariantNumeric: "tabular-nums" }, children: amountChip(item) })
|
|
21091
|
+
]
|
|
21092
|
+
},
|
|
21093
|
+
(_c = item.id) != null ? _c : `q-${idx}`
|
|
21094
|
+
);
|
|
21095
|
+
}) }),
|
|
21096
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
21097
|
+
"div",
|
|
21098
|
+
{
|
|
21099
|
+
style: {
|
|
21100
|
+
display: "flex",
|
|
21101
|
+
alignItems: "center",
|
|
21102
|
+
gap: 10,
|
|
21103
|
+
paddingTop: 10,
|
|
21104
|
+
borderTop: `1px solid #f0f0f0`
|
|
21105
|
+
},
|
|
21106
|
+
children: [
|
|
21107
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "inline-flex", gap: 4 }, "aria-hidden": "true", children: items.map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
21108
|
+
"span",
|
|
21109
|
+
{
|
|
21110
|
+
style: {
|
|
21111
|
+
width: 7,
|
|
21112
|
+
height: 7,
|
|
21113
|
+
borderRadius: "50%",
|
|
21114
|
+
background: shown[i] ? isSubmitted ? GREEN4 : ACCENT2 : "#e8e8e8",
|
|
21115
|
+
transition: "background 0.2s"
|
|
21116
|
+
}
|
|
21117
|
+
},
|
|
21118
|
+
`dot-${i}`
|
|
21119
|
+
)) }),
|
|
21120
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
21121
|
+
"span",
|
|
21122
|
+
{
|
|
21123
|
+
style: { fontSize: 11.5, fontWeight: 600, color: MUTED2, fontVariantNumeric: "tabular-nums" },
|
|
21124
|
+
"data-testid": "decision-queue-progress",
|
|
21125
|
+
children: [
|
|
21126
|
+
decidedCount,
|
|
21127
|
+
"/",
|
|
21128
|
+
items.length,
|
|
21129
|
+
" decided"
|
|
21130
|
+
]
|
|
21131
|
+
}
|
|
21132
|
+
),
|
|
21133
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { flex: 1 } }),
|
|
21134
|
+
isSubmitted ? /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: 6, fontSize: 12.5, fontWeight: 600, color: GREEN4 }, children: [
|
|
21135
|
+
/* @__PURE__ */ jsxRuntime.jsx(Check, { size: 14, color: GREEN4 }),
|
|
21136
|
+
"Submitted"
|
|
21137
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
21138
|
+
"button",
|
|
21139
|
+
{
|
|
21140
|
+
type: "button",
|
|
21141
|
+
onClick: handleSubmit,
|
|
21142
|
+
disabled: !allDecided,
|
|
21143
|
+
"data-testid": "decision-queue-submit",
|
|
21144
|
+
style: {
|
|
21145
|
+
border: `1px solid ${allDecided ? ACCENT2 : BORDER4}`,
|
|
21146
|
+
background: allDecided ? ACCENT2 : "#f6f6f6",
|
|
21147
|
+
color: allDecided ? "white" : MUTED2,
|
|
21148
|
+
borderRadius: 8,
|
|
21149
|
+
fontSize: 13,
|
|
21150
|
+
fontWeight: 600,
|
|
21151
|
+
padding: "8px 16px",
|
|
21152
|
+
cursor: allDecided ? "pointer" : "default",
|
|
21153
|
+
fontVariantNumeric: "tabular-nums",
|
|
21154
|
+
transition: "background 0.15s, border-color 0.15s, color 0.15s"
|
|
21155
|
+
},
|
|
21156
|
+
children: data.submit_label || `Submit ${items.length} decision${items.length === 1 ? "" : "s"}`
|
|
21157
|
+
}
|
|
21158
|
+
)
|
|
21159
|
+
]
|
|
21160
|
+
}
|
|
21161
|
+
)
|
|
21162
|
+
]
|
|
21163
|
+
}
|
|
21164
|
+
);
|
|
21165
|
+
}
|
|
21166
|
+
function DecisionQueueResolver(p) {
|
|
21167
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
21168
|
+
const { resolvedDecisions, onDecisionQueueSubmit } = useGenUIInteraction();
|
|
21169
|
+
const queueId = (_b = (_a2 = p.id) != null ? _a2 : p.title) != null ? _b : "decision-queue";
|
|
21170
|
+
const replayed = (_d = (_c = p.resolved) == null ? void 0 : _c.decisions) != null ? _d : null;
|
|
21171
|
+
const [localSubmitted, setLocalSubmitted] = React45__default.default.useState(null);
|
|
21172
|
+
const hostLocked = (resolvedDecisions == null ? void 0 : resolvedDecisions[queueId]) != null;
|
|
21173
|
+
const submitted = (_e = replayed != null ? replayed : localSubmitted) != null ? _e : hostLocked ? [] : null;
|
|
21174
|
+
const handleSubmit = (decisions, message) => {
|
|
21175
|
+
setLocalSubmitted(decisions);
|
|
21176
|
+
onDecisionQueueSubmit == null ? void 0 : onDecisionQueueSubmit(queueId, decisions, message);
|
|
21177
|
+
};
|
|
21178
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_f = p.title) != null ? _f : "decision-queue", children: /* @__PURE__ */ jsxRuntime.jsx(DecisionQueueRenderer, { data: p, submitted, onSubmit: handleSubmit }) });
|
|
21179
|
+
}
|
|
21180
|
+
init_ThemeContext();
|
|
20721
21181
|
var CONNECTED_GREEN3 = "#15803d";
|
|
20722
21182
|
var CONNECTED_GREEN_BG = "#dcfce7";
|
|
20723
21183
|
var PENDING_AMBER = "#92400e";
|
|
@@ -21149,6 +21609,8 @@ function resolveUI(rawPayload) {
|
|
|
21149
21609
|
return /* @__PURE__ */ jsxRuntime.jsx(DocumentFieldExtractionResolver, __spreadValues({}, payload));
|
|
21150
21610
|
case "decision-card":
|
|
21151
21611
|
return /* @__PURE__ */ jsxRuntime.jsx(DecisionCardResolver, __spreadValues({}, payload));
|
|
21612
|
+
case "decision-queue":
|
|
21613
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DecisionQueueResolver, __spreadValues({}, payload));
|
|
21152
21614
|
case "tabby-auth":
|
|
21153
21615
|
return /* @__PURE__ */ jsxRuntime.jsx(TabbyAuthResolver, __spreadValues({}, payload));
|
|
21154
21616
|
default: {
|