@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/renderer.cjs
CHANGED
|
@@ -5659,6 +5659,167 @@ var decisionCardTool = {
|
|
|
5659
5659
|
required: ["type", "title", "question", "options"]
|
|
5660
5660
|
}
|
|
5661
5661
|
};
|
|
5662
|
+
var decisionQueueItemSchema = zod.z.object({
|
|
5663
|
+
id: zod.z.string().optional(),
|
|
5664
|
+
decision_type: zod.z.string().optional(),
|
|
5665
|
+
title: zod.z.string(),
|
|
5666
|
+
question: zod.z.string(),
|
|
5667
|
+
amount: zod.z.number().optional(),
|
|
5668
|
+
currency: zod.z.string().optional(),
|
|
5669
|
+
amount_label: zod.z.string().optional(),
|
|
5670
|
+
severity: zod.z.enum(["low", "medium", "high"]).optional(),
|
|
5671
|
+
flags: zod.z.array(
|
|
5672
|
+
zod.z.object({
|
|
5673
|
+
field: zod.z.string().optional(),
|
|
5674
|
+
issue: zod.z.string(),
|
|
5675
|
+
severity: zod.z.enum(["low", "medium", "high"]).optional()
|
|
5676
|
+
})
|
|
5677
|
+
).max(6).optional(),
|
|
5678
|
+
options: zod.z.array(
|
|
5679
|
+
zod.z.object({
|
|
5680
|
+
id: zod.z.string().optional(),
|
|
5681
|
+
label: zod.z.string(),
|
|
5682
|
+
recommended: zod.z.boolean().optional(),
|
|
5683
|
+
value: zod.z.number().optional(),
|
|
5684
|
+
adjust: zod.z.object({
|
|
5685
|
+
min: zod.z.number(),
|
|
5686
|
+
max: zod.z.number(),
|
|
5687
|
+
step: zod.z.number().optional(),
|
|
5688
|
+
unit: zod.z.string().optional()
|
|
5689
|
+
}).optional()
|
|
5690
|
+
})
|
|
5691
|
+
).min(1).max(5),
|
|
5692
|
+
source: zod.z.object({
|
|
5693
|
+
label: zod.z.string().optional(),
|
|
5694
|
+
url: zod.z.string().optional()
|
|
5695
|
+
}).optional()
|
|
5696
|
+
});
|
|
5697
|
+
var decisionQueueSchema = zod.z.object({
|
|
5698
|
+
type: zod.z.literal("decision-queue"),
|
|
5699
|
+
id: zod.z.string().optional(),
|
|
5700
|
+
title: zod.z.string().optional(),
|
|
5701
|
+
description: zod.z.string().optional(),
|
|
5702
|
+
submit_label: zod.z.string().optional(),
|
|
5703
|
+
items: zod.z.array(decisionQueueItemSchema).min(2).max(12),
|
|
5704
|
+
resolved: zod.z.object({
|
|
5705
|
+
decisions: zod.z.array(
|
|
5706
|
+
zod.z.object({
|
|
5707
|
+
id: zod.z.string().optional(),
|
|
5708
|
+
title: zod.z.string(),
|
|
5709
|
+
option: zod.z.string(),
|
|
5710
|
+
value: zod.z.number().optional()
|
|
5711
|
+
})
|
|
5712
|
+
)
|
|
5713
|
+
}).optional()
|
|
5714
|
+
});
|
|
5715
|
+
var OPTION_ITEM_JSON = {
|
|
5716
|
+
type: "object",
|
|
5717
|
+
properties: {
|
|
5718
|
+
id: { type: "string" },
|
|
5719
|
+
label: { type: "string" },
|
|
5720
|
+
recommended: { type: "boolean" },
|
|
5721
|
+
value: {
|
|
5722
|
+
type: "number",
|
|
5723
|
+
description: "Suggested numeric figure for this option (starting point of the adjuster)"
|
|
5724
|
+
},
|
|
5725
|
+
adjust: {
|
|
5726
|
+
type: "object",
|
|
5727
|
+
description: "Allow the user to tune `value` within this inclusive range before deciding",
|
|
5728
|
+
properties: {
|
|
5729
|
+
min: { type: "number" },
|
|
5730
|
+
max: { type: "number" },
|
|
5731
|
+
step: { type: "number" },
|
|
5732
|
+
unit: { type: "string", description: "Short unit suffix, e.g. 'units', '%', 'hrs'" }
|
|
5733
|
+
},
|
|
5734
|
+
required: ["min", "max"]
|
|
5735
|
+
}
|
|
5736
|
+
},
|
|
5737
|
+
required: ["label"]
|
|
5738
|
+
};
|
|
5739
|
+
var decisionQueueTool = {
|
|
5740
|
+
name: "render_decision_queue",
|
|
5741
|
+
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.",
|
|
5742
|
+
input_schema: {
|
|
5743
|
+
type: "object",
|
|
5744
|
+
properties: {
|
|
5745
|
+
type: { type: "string", enum: ["decision-queue"] },
|
|
5746
|
+
id: { type: "string", description: "Stable id for update-in-place rendering" },
|
|
5747
|
+
title: {
|
|
5748
|
+
type: "string",
|
|
5749
|
+
description: "Batch headline shown in the header, e.g. 'Reconciliation exceptions'"
|
|
5750
|
+
},
|
|
5751
|
+
description: { type: "string", description: "One-line context above the queue" },
|
|
5752
|
+
submit_label: { type: "string", description: "CTA label; defaults to 'Submit N decisions'" },
|
|
5753
|
+
items: {
|
|
5754
|
+
type: "array",
|
|
5755
|
+
minItems: 2,
|
|
5756
|
+
maxItems: 12,
|
|
5757
|
+
description: "The pending judgments, in the order the user should take them. Each is a full decision-card body (no `type`).",
|
|
5758
|
+
items: {
|
|
5759
|
+
type: "object",
|
|
5760
|
+
properties: {
|
|
5761
|
+
id: { type: "string" },
|
|
5762
|
+
decision_type: {
|
|
5763
|
+
type: "string",
|
|
5764
|
+
description: "Short category eyebrow, e.g. 'Duplicate', 'Capitalization'"
|
|
5765
|
+
},
|
|
5766
|
+
title: { type: "string" },
|
|
5767
|
+
question: { type: "string" },
|
|
5768
|
+
amount: { type: "number" },
|
|
5769
|
+
currency: { type: "string" },
|
|
5770
|
+
amount_label: { type: "string" },
|
|
5771
|
+
severity: { type: "string", enum: ["low", "medium", "high"] },
|
|
5772
|
+
flags: {
|
|
5773
|
+
type: "array",
|
|
5774
|
+
maxItems: 6,
|
|
5775
|
+
items: {
|
|
5776
|
+
type: "object",
|
|
5777
|
+
properties: {
|
|
5778
|
+
field: { type: "string" },
|
|
5779
|
+
issue: { type: "string" },
|
|
5780
|
+
severity: { type: "string", enum: ["low", "medium", "high"] }
|
|
5781
|
+
},
|
|
5782
|
+
required: ["issue"]
|
|
5783
|
+
}
|
|
5784
|
+
},
|
|
5785
|
+
options: {
|
|
5786
|
+
type: "array",
|
|
5787
|
+
minItems: 1,
|
|
5788
|
+
maxItems: 5,
|
|
5789
|
+
items: OPTION_ITEM_JSON
|
|
5790
|
+
},
|
|
5791
|
+
source: {
|
|
5792
|
+
type: "object",
|
|
5793
|
+
properties: { label: { type: "string" }, url: { type: "string" } }
|
|
5794
|
+
}
|
|
5795
|
+
},
|
|
5796
|
+
required: ["title", "question", "options"]
|
|
5797
|
+
}
|
|
5798
|
+
},
|
|
5799
|
+
resolved: {
|
|
5800
|
+
type: "object",
|
|
5801
|
+
description: "Pre-resolved state for transcript replay",
|
|
5802
|
+
properties: {
|
|
5803
|
+
decisions: {
|
|
5804
|
+
type: "array",
|
|
5805
|
+
items: {
|
|
5806
|
+
type: "object",
|
|
5807
|
+
properties: {
|
|
5808
|
+
id: { type: "string" },
|
|
5809
|
+
title: { type: "string" },
|
|
5810
|
+
option: { type: "string" },
|
|
5811
|
+
value: { type: "number" }
|
|
5812
|
+
},
|
|
5813
|
+
required: ["title", "option"]
|
|
5814
|
+
}
|
|
5815
|
+
}
|
|
5816
|
+
},
|
|
5817
|
+
required: ["decisions"]
|
|
5818
|
+
}
|
|
5819
|
+
},
|
|
5820
|
+
required: ["type", "items"]
|
|
5821
|
+
}
|
|
5822
|
+
};
|
|
5662
5823
|
var tabbyAuthSchema = zod.z.object({
|
|
5663
5824
|
type: zod.z.literal("tabby-auth"),
|
|
5664
5825
|
app: zod.z.string(),
|
|
@@ -5751,6 +5912,7 @@ var schemaRegistry = {
|
|
|
5751
5912
|
"workflow-stepper": { schema: workflowStepperSchema, tool: workflowStepperTool },
|
|
5752
5913
|
"document-field-extraction": { schema: documentFieldExtractionSchema, tool: documentFieldExtractionTool },
|
|
5753
5914
|
"decision-card": { schema: decisionCardSchema, tool: decisionCardTool },
|
|
5915
|
+
"decision-queue": { schema: decisionQueueSchema, tool: decisionQueueTool },
|
|
5754
5916
|
"tabby-auth": { schema: tabbyAuthSchema, tool: tabbyAuthTool }
|
|
5755
5917
|
};
|
|
5756
5918
|
|
|
@@ -6489,17 +6651,17 @@ function SparklineTableResolver(p) {
|
|
|
6489
6651
|
// src/composites/heatmap-table/resolver.tsx
|
|
6490
6652
|
init_theme();
|
|
6491
6653
|
init_ThemeContext();
|
|
6492
|
-
function heatColor(
|
|
6493
|
-
const clamped = Math.max(-3, Math.min(3,
|
|
6654
|
+
function heatColor(z62) {
|
|
6655
|
+
const clamped = Math.max(-3, Math.min(3, z62));
|
|
6494
6656
|
const abs = Math.abs(clamped);
|
|
6495
6657
|
const lightness = 95 - abs * 8;
|
|
6496
6658
|
const hue = clamped >= 0 ? 142 : 0;
|
|
6497
6659
|
return `hsl(${hue} 60% ${lightness}%)`;
|
|
6498
6660
|
}
|
|
6499
|
-
function heatTextColor(
|
|
6500
|
-
const abs = Math.abs(
|
|
6501
|
-
if (abs > 2) return
|
|
6502
|
-
if (abs > 1) return
|
|
6661
|
+
function heatTextColor(z62) {
|
|
6662
|
+
const abs = Math.abs(z62);
|
|
6663
|
+
if (abs > 2) return z62 >= 0 ? "#14532d" : "#7f1d1d";
|
|
6664
|
+
if (abs > 1) return z62 >= 0 ? "#166534" : "#991b1b";
|
|
6503
6665
|
return "var(--foreground)";
|
|
6504
6666
|
}
|
|
6505
6667
|
var th2 = {
|
|
@@ -17547,7 +17709,8 @@ var DEFAULT_INTERACTION = {
|
|
|
17547
17709
|
onStepSelect: void 0,
|
|
17548
17710
|
resolvedDecisions: void 0,
|
|
17549
17711
|
onDecisionResolve: void 0,
|
|
17550
|
-
onDecisionSource: void 0
|
|
17712
|
+
onDecisionSource: void 0,
|
|
17713
|
+
onDecisionQueueSubmit: void 0
|
|
17551
17714
|
};
|
|
17552
17715
|
var GenUIInteractionContext = React45.createContext(DEFAULT_INTERACTION);
|
|
17553
17716
|
function useGenUIInteraction() {
|
|
@@ -20221,7 +20384,8 @@ function DecisionCardRenderer({
|
|
|
20221
20384
|
data,
|
|
20222
20385
|
resolved = null,
|
|
20223
20386
|
onResolve,
|
|
20224
|
-
onOpenSource
|
|
20387
|
+
onOpenSource,
|
|
20388
|
+
eyebrow
|
|
20225
20389
|
}) {
|
|
20226
20390
|
var _a, _b, _c;
|
|
20227
20391
|
const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
|
|
@@ -20327,7 +20491,7 @@ function DecisionCardRenderer({
|
|
|
20327
20491
|
},
|
|
20328
20492
|
children: [
|
|
20329
20493
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { minWidth: 0, display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
20330
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
20494
|
+
eyebrow === null ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
20331
20495
|
"span",
|
|
20332
20496
|
{
|
|
20333
20497
|
style: {
|
|
@@ -20337,7 +20501,7 @@ function DecisionCardRenderer({
|
|
|
20337
20501
|
fontWeight: 700,
|
|
20338
20502
|
color: ACCENT2
|
|
20339
20503
|
},
|
|
20340
|
-
children: data.decision_type ? `Decision needs you \xB7 ${data.decision_type}` : "Decision needs you"
|
|
20504
|
+
children: eyebrow !== void 0 ? eyebrow : data.decision_type ? `Decision needs you \xB7 ${data.decision_type}` : "Decision needs you"
|
|
20341
20505
|
}
|
|
20342
20506
|
),
|
|
20343
20507
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -20557,6 +20721,302 @@ function DecisionCardResolver(p) {
|
|
|
20557
20721
|
) });
|
|
20558
20722
|
}
|
|
20559
20723
|
init_ThemeContext();
|
|
20724
|
+
var GREEN4 = "#15803d";
|
|
20725
|
+
var KEYFRAMES3 = `
|
|
20726
|
+
@keyframes dqSettle{from{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:none}}
|
|
20727
|
+
.dq-settle{animation:dqSettle 0.24s cubic-bezier(0.22,1,0.36,1) both}
|
|
20728
|
+
@keyframes dqFocus{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}
|
|
20729
|
+
.dq-focus{animation:dqFocus 0.28s cubic-bezier(0.22,1,0.36,1) both}
|
|
20730
|
+
@media (prefers-reduced-motion: reduce){
|
|
20731
|
+
.dq-settle,.dq-focus{animation:none !important;opacity:1 !important;transform:none !important}
|
|
20732
|
+
}`;
|
|
20733
|
+
function figureOf(item, decision) {
|
|
20734
|
+
var _a, _b, _c;
|
|
20735
|
+
if (decision.value == null) return decision.option;
|
|
20736
|
+
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;
|
|
20737
|
+
return `${decision.option} \xB7 ${formatFigure(decision.value, unit)}`;
|
|
20738
|
+
}
|
|
20739
|
+
function composeQueueMessage(items, decisions) {
|
|
20740
|
+
const lines = items.map((item, i) => {
|
|
20741
|
+
const d = decisions[i];
|
|
20742
|
+
return `${i + 1}. ${item.title} \u2192 ${d ? figureOf(item, d) : "(undecided)"}`;
|
|
20743
|
+
});
|
|
20744
|
+
const done = decisions.filter(Boolean).length;
|
|
20745
|
+
return `Decisions (${done}/${items.length}):
|
|
20746
|
+
${lines.join("\n")}`;
|
|
20747
|
+
}
|
|
20748
|
+
function Check({ size, color }) {
|
|
20749
|
+
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" }) });
|
|
20750
|
+
}
|
|
20751
|
+
function amountChip(item) {
|
|
20752
|
+
if (typeof item.amount !== "number") return null;
|
|
20753
|
+
const abs = Math.abs(item.amount);
|
|
20754
|
+
const sign = item.amount < 0 ? "-" : "";
|
|
20755
|
+
if (abs >= 1e6) return `${sign}$${(abs / 1e6).toFixed(abs >= 1e7 ? 0 : 1)}M`;
|
|
20756
|
+
if (abs >= 1e3) return `${sign}$${(abs / 1e3).toFixed(abs >= 1e4 ? 0 : 1)}K`;
|
|
20757
|
+
return `${sign}$${abs}`;
|
|
20758
|
+
}
|
|
20759
|
+
function DecisionQueueRenderer({ data, submitted = null, onSubmit }) {
|
|
20760
|
+
var _a;
|
|
20761
|
+
const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
|
|
20762
|
+
const items = (_a = data.items) != null ? _a : [];
|
|
20763
|
+
const [decisions, setDecisions] = React45__default.default.useState(
|
|
20764
|
+
() => items.map(() => void 0)
|
|
20765
|
+
);
|
|
20766
|
+
const firstUndecided = decisions.findIndex((d) => !d);
|
|
20767
|
+
const [focusIdx, setFocusIdx] = React45__default.default.useState(firstUndecided >= 0 ? firstUndecided : null);
|
|
20768
|
+
const isSubmitted = submitted != null;
|
|
20769
|
+
const shown = isSubmitted ? items.map(
|
|
20770
|
+
(item, i) => {
|
|
20771
|
+
var _a2;
|
|
20772
|
+
return (_a2 = submitted.find((d) => d.id && d.id === item.id || d.title === item.title)) != null ? _a2 : submitted[i];
|
|
20773
|
+
}
|
|
20774
|
+
) : decisions;
|
|
20775
|
+
const decidedCount = shown.filter(Boolean).length;
|
|
20776
|
+
const allDecided = decidedCount === items.length;
|
|
20777
|
+
const decide = (idx, option, value) => {
|
|
20778
|
+
const item = items[idx];
|
|
20779
|
+
const next = decisions.slice();
|
|
20780
|
+
next[idx] = { id: item.id, title: item.title, option, value };
|
|
20781
|
+
setDecisions(next);
|
|
20782
|
+
const order = [...Array(items.length).keys()];
|
|
20783
|
+
const after = order.slice(idx + 1).concat(order.slice(0, idx + 1));
|
|
20784
|
+
const target = after.find((j) => j !== idx && !next[j]);
|
|
20785
|
+
setFocusIdx(target != null ? target : null);
|
|
20786
|
+
};
|
|
20787
|
+
const handleSubmit = () => {
|
|
20788
|
+
if (!allDecided || isSubmitted) return;
|
|
20789
|
+
const final = decisions;
|
|
20790
|
+
onSubmit == null ? void 0 : onSubmit(final, composeQueueMessage(items, final));
|
|
20791
|
+
};
|
|
20792
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
20793
|
+
"div",
|
|
20794
|
+
{
|
|
20795
|
+
"data-testid": "decision-queue",
|
|
20796
|
+
"data-submitted": isSubmitted || void 0,
|
|
20797
|
+
style: {
|
|
20798
|
+
position: "relative",
|
|
20799
|
+
width: "100%",
|
|
20800
|
+
minWidth: 0,
|
|
20801
|
+
boxSizing: "border-box",
|
|
20802
|
+
borderRadius: "0.75rem",
|
|
20803
|
+
border: `1px solid ${BORDER4}`,
|
|
20804
|
+
background: "white",
|
|
20805
|
+
boxShadow: "0 1px 2px rgba(0,0,0,0.03), 0 4px 12px rgba(0,0,0,0.04)",
|
|
20806
|
+
padding: "16px 18px",
|
|
20807
|
+
display: "flex",
|
|
20808
|
+
flexDirection: "column",
|
|
20809
|
+
gap: 12,
|
|
20810
|
+
overflow: "hidden"
|
|
20811
|
+
},
|
|
20812
|
+
children: [
|
|
20813
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { children: KEYFRAMES3 }),
|
|
20814
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 3 }, children: [
|
|
20815
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
20816
|
+
"span",
|
|
20817
|
+
{
|
|
20818
|
+
style: {
|
|
20819
|
+
fontSize: 10.5,
|
|
20820
|
+
textTransform: "uppercase",
|
|
20821
|
+
letterSpacing: "0.07em",
|
|
20822
|
+
fontWeight: 700,
|
|
20823
|
+
color: isSubmitted ? GREEN4 : ACCENT2
|
|
20824
|
+
},
|
|
20825
|
+
children: isSubmitted ? "Decisions submitted" : "Decisions need you"
|
|
20826
|
+
}
|
|
20827
|
+
),
|
|
20828
|
+
data.title && /* @__PURE__ */ jsxRuntime.jsx(
|
|
20829
|
+
"p",
|
|
20830
|
+
{
|
|
20831
|
+
style: {
|
|
20832
|
+
fontFamily: "var(--font-serif)",
|
|
20833
|
+
fontSize: 16,
|
|
20834
|
+
fontWeight: 400,
|
|
20835
|
+
color: "var(--foreground)",
|
|
20836
|
+
letterSpacing: "-0.01em",
|
|
20837
|
+
margin: 0,
|
|
20838
|
+
lineHeight: 1.25
|
|
20839
|
+
},
|
|
20840
|
+
children: data.title
|
|
20841
|
+
}
|
|
20842
|
+
),
|
|
20843
|
+
data.description && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { fontSize: 12.5, color: MUTED2, margin: 0, lineHeight: 1.45 }, children: data.description })
|
|
20844
|
+
] }),
|
|
20845
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: items.map((item, idx) => {
|
|
20846
|
+
var _a2, _b, _c;
|
|
20847
|
+
const decision = shown[idx];
|
|
20848
|
+
const focused = !isSubmitted && focusIdx === idx;
|
|
20849
|
+
if (focused) {
|
|
20850
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "dq-focus", "data-testid": `decision-queue-focus-${idx}`, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
20851
|
+
DecisionCardRenderer,
|
|
20852
|
+
{
|
|
20853
|
+
data: __spreadValues({ type: "decision-card" }, item),
|
|
20854
|
+
resolved: null,
|
|
20855
|
+
onResolve: (option, value) => decide(idx, option, value),
|
|
20856
|
+
eyebrow: `${idx + 1} of ${items.length}${item.decision_type ? ` \xB7 ${item.decision_type}` : ""}`
|
|
20857
|
+
}
|
|
20858
|
+
) }, (_a2 = item.id) != null ? _a2 : `q-${idx}`);
|
|
20859
|
+
}
|
|
20860
|
+
if (decision) {
|
|
20861
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
20862
|
+
"button",
|
|
20863
|
+
{
|
|
20864
|
+
type: "button",
|
|
20865
|
+
className: "dq-settle",
|
|
20866
|
+
onClick: isSubmitted ? void 0 : () => setFocusIdx(idx),
|
|
20867
|
+
disabled: isSubmitted,
|
|
20868
|
+
title: isSubmitted ? void 0 : "Change this decision",
|
|
20869
|
+
"data-testid": `decision-queue-receipt-${idx}`,
|
|
20870
|
+
style: {
|
|
20871
|
+
display: "flex",
|
|
20872
|
+
alignItems: "center",
|
|
20873
|
+
gap: 8,
|
|
20874
|
+
width: "100%",
|
|
20875
|
+
textAlign: "left",
|
|
20876
|
+
border: "1px solid #dcfce7",
|
|
20877
|
+
background: "#f6fef9",
|
|
20878
|
+
borderRadius: 8,
|
|
20879
|
+
padding: "7px 11px",
|
|
20880
|
+
cursor: isSubmitted ? "default" : "pointer",
|
|
20881
|
+
font: "inherit"
|
|
20882
|
+
},
|
|
20883
|
+
children: [
|
|
20884
|
+
/* @__PURE__ */ jsxRuntime.jsx(Check, { size: 13, color: GREEN4 }),
|
|
20885
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 12.5, fontWeight: 600, color: "var(--foreground)", minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: item.title }),
|
|
20886
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", style: { color: MUTED2, fontSize: 12 }, children: "\u2192" }),
|
|
20887
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 12.5, fontWeight: 600, color: GREEN4, fontVariantNumeric: "tabular-nums", whiteSpace: "nowrap" }, children: figureOf(item, decision) }),
|
|
20888
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { flex: 1 } }),
|
|
20889
|
+
!isSubmitted && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 11, fontWeight: 600, color: MUTED2 }, children: "Change" })
|
|
20890
|
+
]
|
|
20891
|
+
},
|
|
20892
|
+
(_b = item.id) != null ? _b : `q-${idx}`
|
|
20893
|
+
);
|
|
20894
|
+
}
|
|
20895
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
20896
|
+
"button",
|
|
20897
|
+
{
|
|
20898
|
+
type: "button",
|
|
20899
|
+
onClick: isSubmitted ? void 0 : () => setFocusIdx(idx),
|
|
20900
|
+
disabled: isSubmitted,
|
|
20901
|
+
"data-testid": `decision-queue-upcoming-${idx}`,
|
|
20902
|
+
style: {
|
|
20903
|
+
display: "flex",
|
|
20904
|
+
alignItems: "center",
|
|
20905
|
+
gap: 8,
|
|
20906
|
+
width: "100%",
|
|
20907
|
+
textAlign: "left",
|
|
20908
|
+
border: `1px dashed ${BORDER4}`,
|
|
20909
|
+
background: "white",
|
|
20910
|
+
borderRadius: 8,
|
|
20911
|
+
padding: "7px 11px",
|
|
20912
|
+
cursor: isSubmitted ? "default" : "pointer",
|
|
20913
|
+
font: "inherit",
|
|
20914
|
+
opacity: 0.75
|
|
20915
|
+
},
|
|
20916
|
+
children: [
|
|
20917
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
20918
|
+
"span",
|
|
20919
|
+
{
|
|
20920
|
+
"aria-hidden": "true",
|
|
20921
|
+
style: { width: 13, height: 13, borderRadius: "50%", border: `1.5px solid ${MUTED2}`, flexShrink: 0, boxSizing: "border-box" }
|
|
20922
|
+
}
|
|
20923
|
+
),
|
|
20924
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: 12.5, fontWeight: 600, color: MUTED2, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: [
|
|
20925
|
+
item.decision_type ? `${item.decision_type} \xB7 ` : "",
|
|
20926
|
+
item.title
|
|
20927
|
+
] }),
|
|
20928
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { flex: 1 } }),
|
|
20929
|
+
amountChip(item) && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 11.5, fontWeight: 700, color: MUTED2, fontVariantNumeric: "tabular-nums" }, children: amountChip(item) })
|
|
20930
|
+
]
|
|
20931
|
+
},
|
|
20932
|
+
(_c = item.id) != null ? _c : `q-${idx}`
|
|
20933
|
+
);
|
|
20934
|
+
}) }),
|
|
20935
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
20936
|
+
"div",
|
|
20937
|
+
{
|
|
20938
|
+
style: {
|
|
20939
|
+
display: "flex",
|
|
20940
|
+
alignItems: "center",
|
|
20941
|
+
gap: 10,
|
|
20942
|
+
paddingTop: 10,
|
|
20943
|
+
borderTop: `1px solid #f0f0f0`
|
|
20944
|
+
},
|
|
20945
|
+
children: [
|
|
20946
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "inline-flex", gap: 4 }, "aria-hidden": "true", children: items.map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
20947
|
+
"span",
|
|
20948
|
+
{
|
|
20949
|
+
style: {
|
|
20950
|
+
width: 7,
|
|
20951
|
+
height: 7,
|
|
20952
|
+
borderRadius: "50%",
|
|
20953
|
+
background: shown[i] ? isSubmitted ? GREEN4 : ACCENT2 : "#e8e8e8",
|
|
20954
|
+
transition: "background 0.2s"
|
|
20955
|
+
}
|
|
20956
|
+
},
|
|
20957
|
+
`dot-${i}`
|
|
20958
|
+
)) }),
|
|
20959
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
20960
|
+
"span",
|
|
20961
|
+
{
|
|
20962
|
+
style: { fontSize: 11.5, fontWeight: 600, color: MUTED2, fontVariantNumeric: "tabular-nums" },
|
|
20963
|
+
"data-testid": "decision-queue-progress",
|
|
20964
|
+
children: [
|
|
20965
|
+
decidedCount,
|
|
20966
|
+
"/",
|
|
20967
|
+
items.length,
|
|
20968
|
+
" decided"
|
|
20969
|
+
]
|
|
20970
|
+
}
|
|
20971
|
+
),
|
|
20972
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { flex: 1 } }),
|
|
20973
|
+
isSubmitted ? /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: 6, fontSize: 12.5, fontWeight: 600, color: GREEN4 }, children: [
|
|
20974
|
+
/* @__PURE__ */ jsxRuntime.jsx(Check, { size: 14, color: GREEN4 }),
|
|
20975
|
+
"Submitted"
|
|
20976
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
20977
|
+
"button",
|
|
20978
|
+
{
|
|
20979
|
+
type: "button",
|
|
20980
|
+
onClick: handleSubmit,
|
|
20981
|
+
disabled: !allDecided,
|
|
20982
|
+
"data-testid": "decision-queue-submit",
|
|
20983
|
+
style: {
|
|
20984
|
+
border: `1px solid ${allDecided ? ACCENT2 : BORDER4}`,
|
|
20985
|
+
background: allDecided ? ACCENT2 : "#f6f6f6",
|
|
20986
|
+
color: allDecided ? "white" : MUTED2,
|
|
20987
|
+
borderRadius: 8,
|
|
20988
|
+
fontSize: 13,
|
|
20989
|
+
fontWeight: 600,
|
|
20990
|
+
padding: "8px 16px",
|
|
20991
|
+
cursor: allDecided ? "pointer" : "default",
|
|
20992
|
+
fontVariantNumeric: "tabular-nums",
|
|
20993
|
+
transition: "background 0.15s, border-color 0.15s, color 0.15s"
|
|
20994
|
+
},
|
|
20995
|
+
children: data.submit_label || `Submit ${items.length} decision${items.length === 1 ? "" : "s"}`
|
|
20996
|
+
}
|
|
20997
|
+
)
|
|
20998
|
+
]
|
|
20999
|
+
}
|
|
21000
|
+
)
|
|
21001
|
+
]
|
|
21002
|
+
}
|
|
21003
|
+
);
|
|
21004
|
+
}
|
|
21005
|
+
function DecisionQueueResolver(p) {
|
|
21006
|
+
var _a, _b, _c, _d, _e, _f;
|
|
21007
|
+
const { resolvedDecisions, onDecisionQueueSubmit } = useGenUIInteraction();
|
|
21008
|
+
const queueId = (_b = (_a = p.id) != null ? _a : p.title) != null ? _b : "decision-queue";
|
|
21009
|
+
const replayed = (_d = (_c = p.resolved) == null ? void 0 : _c.decisions) != null ? _d : null;
|
|
21010
|
+
const [localSubmitted, setLocalSubmitted] = React45__default.default.useState(null);
|
|
21011
|
+
const hostLocked = (resolvedDecisions == null ? void 0 : resolvedDecisions[queueId]) != null;
|
|
21012
|
+
const submitted = (_e = replayed != null ? replayed : localSubmitted) != null ? _e : hostLocked ? [] : null;
|
|
21013
|
+
const handleSubmit = (decisions, message) => {
|
|
21014
|
+
setLocalSubmitted(decisions);
|
|
21015
|
+
onDecisionQueueSubmit == null ? void 0 : onDecisionQueueSubmit(queueId, decisions, message);
|
|
21016
|
+
};
|
|
21017
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_f = p.title) != null ? _f : "decision-queue", children: /* @__PURE__ */ jsxRuntime.jsx(DecisionQueueRenderer, { data: p, submitted, onSubmit: handleSubmit }) });
|
|
21018
|
+
}
|
|
21019
|
+
init_ThemeContext();
|
|
20560
21020
|
var CONNECTED_GREEN3 = "#15803d";
|
|
20561
21021
|
var CONNECTED_GREEN_BG = "#dcfce7";
|
|
20562
21022
|
var PENDING_AMBER = "#92400e";
|
|
@@ -20988,6 +21448,8 @@ function resolveUI(rawPayload) {
|
|
|
20988
21448
|
return /* @__PURE__ */ jsxRuntime.jsx(DocumentFieldExtractionResolver, __spreadValues({}, payload));
|
|
20989
21449
|
case "decision-card":
|
|
20990
21450
|
return /* @__PURE__ */ jsxRuntime.jsx(DecisionCardResolver, __spreadValues({}, payload));
|
|
21451
|
+
case "decision-queue":
|
|
21452
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DecisionQueueResolver, __spreadValues({}, payload));
|
|
20991
21453
|
case "tabby-auth":
|
|
20992
21454
|
return /* @__PURE__ */ jsxRuntime.jsx(TabbyAuthResolver, __spreadValues({}, payload));
|
|
20993
21455
|
default: {
|