@octaviaflow/core 3.1.0-beta.101 → 3.1.0-beta.103
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/components/ExpressionField/ExpressionField.d.ts +55 -0
- package/dist/components/ExpressionField/ExpressionField.d.ts.map +1 -0
- package/dist/components/ExpressionField/index.d.ts +3 -0
- package/dist/components/ExpressionField/index.d.ts.map +1 -0
- package/dist/components/ExpressionField/parseExpression.d.ts +35 -0
- package/dist/components/ExpressionField/parseExpression.d.ts.map +1 -0
- package/dist/index.cjs +1476 -847
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1252 -620
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -34420,8 +34420,637 @@ var ToolCard = forwardRef96(
|
|
|
34420
34420
|
);
|
|
34421
34421
|
ToolCard.displayName = "ToolCard";
|
|
34422
34422
|
|
|
34423
|
-
// src/components/
|
|
34423
|
+
// src/components/ExpressionField/ExpressionField.tsx
|
|
34424
|
+
import {
|
|
34425
|
+
useCallback as useCallback50,
|
|
34426
|
+
useEffect as useEffect56,
|
|
34427
|
+
useId as useId61,
|
|
34428
|
+
useRef as useRef50,
|
|
34429
|
+
useState as useState71
|
|
34430
|
+
} from "react";
|
|
34431
|
+
|
|
34432
|
+
// src/components/ExpressionField/parseExpression.ts
|
|
34433
|
+
var CALL_NAME_SOURCE = "(?:[A-Z_][A-Z0-9_]*|user\\.[A-Za-z_][A-Za-z0-9_]*)";
|
|
34434
|
+
var CALL_HEAD = new RegExp(`^(${CALL_NAME_SOURCE})\\s*\\(`);
|
|
34435
|
+
function wrappedRegions(value) {
|
|
34436
|
+
const out = [];
|
|
34437
|
+
let i = 0;
|
|
34438
|
+
while (i < value.length) {
|
|
34439
|
+
const open = value.indexOf("{{", i);
|
|
34440
|
+
if (open === -1) break;
|
|
34441
|
+
let depth = 0;
|
|
34442
|
+
let quote = null;
|
|
34443
|
+
let close = -1;
|
|
34444
|
+
for (let j = open; j < value.length; j++) {
|
|
34445
|
+
const ch = value[j];
|
|
34446
|
+
if (quote) {
|
|
34447
|
+
if (ch === quote) quote = null;
|
|
34448
|
+
continue;
|
|
34449
|
+
}
|
|
34450
|
+
if (ch === '"' || ch === "'") {
|
|
34451
|
+
quote = ch;
|
|
34452
|
+
continue;
|
|
34453
|
+
}
|
|
34454
|
+
if (ch === "{" && value[j + 1] === "{") {
|
|
34455
|
+
depth++;
|
|
34456
|
+
j++;
|
|
34457
|
+
continue;
|
|
34458
|
+
}
|
|
34459
|
+
if (ch === "}" && value[j + 1] === "}") {
|
|
34460
|
+
depth--;
|
|
34461
|
+
j++;
|
|
34462
|
+
if (depth === 0) {
|
|
34463
|
+
close = j;
|
|
34464
|
+
break;
|
|
34465
|
+
}
|
|
34466
|
+
}
|
|
34467
|
+
}
|
|
34468
|
+
if (close === -1) break;
|
|
34469
|
+
out.push({ start: open, end: close });
|
|
34470
|
+
i = close + 1;
|
|
34471
|
+
}
|
|
34472
|
+
return out;
|
|
34473
|
+
}
|
|
34474
|
+
function splitArguments(argsText) {
|
|
34475
|
+
const trimmed = argsText.trim();
|
|
34476
|
+
if (!trimmed) return [];
|
|
34477
|
+
const args = [];
|
|
34478
|
+
let current = "";
|
|
34479
|
+
let depth = 0;
|
|
34480
|
+
let braces = 0;
|
|
34481
|
+
let quote = null;
|
|
34482
|
+
for (let i = 0; i < trimmed.length; i++) {
|
|
34483
|
+
const ch = trimmed[i];
|
|
34484
|
+
if (quote) {
|
|
34485
|
+
current += ch;
|
|
34486
|
+
if (ch === quote) quote = null;
|
|
34487
|
+
continue;
|
|
34488
|
+
}
|
|
34489
|
+
if (ch === '"' || ch === "'") {
|
|
34490
|
+
quote = ch;
|
|
34491
|
+
current += ch;
|
|
34492
|
+
continue;
|
|
34493
|
+
}
|
|
34494
|
+
if (ch === "{" && trimmed[i + 1] === "{") {
|
|
34495
|
+
braces++;
|
|
34496
|
+
current += "{{";
|
|
34497
|
+
i++;
|
|
34498
|
+
continue;
|
|
34499
|
+
}
|
|
34500
|
+
if (ch === "}" && trimmed[i + 1] === "}") {
|
|
34501
|
+
braces--;
|
|
34502
|
+
current += "}}";
|
|
34503
|
+
i++;
|
|
34504
|
+
continue;
|
|
34505
|
+
}
|
|
34506
|
+
if (ch === "(") depth++;
|
|
34507
|
+
if (ch === ")") depth--;
|
|
34508
|
+
if (ch === "," && depth === 0 && braces === 0) {
|
|
34509
|
+
args.push(current.trim());
|
|
34510
|
+
current = "";
|
|
34511
|
+
continue;
|
|
34512
|
+
}
|
|
34513
|
+
current += ch;
|
|
34514
|
+
}
|
|
34515
|
+
if (current.trim()) args.push(current.trim());
|
|
34516
|
+
return args;
|
|
34517
|
+
}
|
|
34518
|
+
function parseCall(raw) {
|
|
34519
|
+
const inner = raw.startsWith("{{") && raw.endsWith("}}") ? raw.slice(2, -2).trim() : raw.trim();
|
|
34520
|
+
const head = CALL_HEAD.exec(inner);
|
|
34521
|
+
if (!head) return void 0;
|
|
34522
|
+
const open = inner.indexOf("(");
|
|
34523
|
+
const close = inner.lastIndexOf(")");
|
|
34524
|
+
if (open === -1 || close < open) return void 0;
|
|
34525
|
+
return { name: head[1], args: splitArguments(inner.slice(open + 1, close)) };
|
|
34526
|
+
}
|
|
34527
|
+
function formatCall(name, args) {
|
|
34528
|
+
return `{{${name}(${args.filter((a) => a.trim() !== "").join(", ")})}}`;
|
|
34529
|
+
}
|
|
34530
|
+
function parseExpression(value, pillEveryToken = false) {
|
|
34531
|
+
const segments = [];
|
|
34532
|
+
let cursor = 0;
|
|
34533
|
+
const pushText = (raw) => {
|
|
34534
|
+
if (raw) segments.push({ kind: "text", raw });
|
|
34535
|
+
};
|
|
34536
|
+
for (const { start, end } of wrappedRegions(value)) {
|
|
34537
|
+
pushText(value.slice(cursor, start));
|
|
34538
|
+
const raw = value.slice(start, end + 1);
|
|
34539
|
+
const call = parseCall(raw);
|
|
34540
|
+
if (call) {
|
|
34541
|
+
segments.push({ kind: "call", raw, name: call.name, args: call.args });
|
|
34542
|
+
} else if (raw.startsWith("{{ods://") || pillEveryToken) {
|
|
34543
|
+
segments.push({ kind: "ref", raw });
|
|
34544
|
+
} else {
|
|
34545
|
+
pushText(raw);
|
|
34546
|
+
}
|
|
34547
|
+
cursor = end + 1;
|
|
34548
|
+
}
|
|
34549
|
+
const tail = value.slice(cursor);
|
|
34550
|
+
let last = 0;
|
|
34551
|
+
for (const m of tail.matchAll(/\$\{[^}]+\}/g)) {
|
|
34552
|
+
pushText(tail.slice(last, m.index));
|
|
34553
|
+
segments.push({ kind: "ref", raw: m[0] });
|
|
34554
|
+
last = (m.index ?? 0) + m[0].length;
|
|
34555
|
+
}
|
|
34556
|
+
pushText(tail.slice(last));
|
|
34557
|
+
return segments;
|
|
34558
|
+
}
|
|
34559
|
+
|
|
34560
|
+
// src/components/ExpressionField/ExpressionField.tsx
|
|
34424
34561
|
import { jsx as jsx147, jsxs as jsxs141 } from "react/jsx-runtime";
|
|
34562
|
+
var ZERO_WIDTH = "\u200B";
|
|
34563
|
+
var PILL = "ods-expression-field__pill";
|
|
34564
|
+
var CHIP = "ods-expression-field__chip";
|
|
34565
|
+
function shortReferenceLabel(token) {
|
|
34566
|
+
if (token.startsWith("{{ods://")) {
|
|
34567
|
+
const path = token.slice(8, -2);
|
|
34568
|
+
const parts = path.split("/");
|
|
34569
|
+
if (parts[0] === "steps" && parts.length >= 4) return parts.slice(3).join(".");
|
|
34570
|
+
if (parts[0] === "flow") return `flow.${parts.slice(1).join(".")}`;
|
|
34571
|
+
return parts.join(".");
|
|
34572
|
+
}
|
|
34573
|
+
if (token.startsWith("${")) return token.slice(2, -1);
|
|
34574
|
+
if (token.startsWith("{{")) return token.slice(2, -2).trim();
|
|
34575
|
+
return token;
|
|
34576
|
+
}
|
|
34577
|
+
function serialize(el) {
|
|
34578
|
+
let out = "";
|
|
34579
|
+
el.childNodes.forEach((node) => {
|
|
34580
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
34581
|
+
out += (node.textContent || "").replace(//g, "");
|
|
34582
|
+
return;
|
|
34583
|
+
}
|
|
34584
|
+
if (node.nodeType !== Node.ELEMENT_NODE) return;
|
|
34585
|
+
const elem = node;
|
|
34586
|
+
if (elem.classList.contains(PILL) || elem.classList.contains(CHIP)) {
|
|
34587
|
+
out += elem.getAttribute("data-value") || "";
|
|
34588
|
+
} else if (elem.tagName === "BR") {
|
|
34589
|
+
out += "\n";
|
|
34590
|
+
} else if (elem.tagName === "DIV" || elem.tagName === "P") {
|
|
34591
|
+
out += `
|
|
34592
|
+
${serialize(elem)}`;
|
|
34593
|
+
} else {
|
|
34594
|
+
out += (elem.textContent || "").replace(//g, "");
|
|
34595
|
+
}
|
|
34596
|
+
});
|
|
34597
|
+
return out;
|
|
34598
|
+
}
|
|
34599
|
+
function insideCallArguments(textBeforeCaret) {
|
|
34600
|
+
let depth = 0;
|
|
34601
|
+
let quote = null;
|
|
34602
|
+
for (let i = 0; i < textBeforeCaret.length; i++) {
|
|
34603
|
+
const ch = textBeforeCaret[i];
|
|
34604
|
+
if (quote) {
|
|
34605
|
+
if (ch === quote) quote = null;
|
|
34606
|
+
continue;
|
|
34607
|
+
}
|
|
34608
|
+
if (ch === '"' || ch === "'") {
|
|
34609
|
+
quote = ch;
|
|
34610
|
+
continue;
|
|
34611
|
+
}
|
|
34612
|
+
if (ch === "(") depth++;
|
|
34613
|
+
else if (ch === ")") depth = Math.max(0, depth - 1);
|
|
34614
|
+
}
|
|
34615
|
+
return depth > 0;
|
|
34616
|
+
}
|
|
34617
|
+
function argSummary(arg) {
|
|
34618
|
+
const trimmed = arg.trim();
|
|
34619
|
+
if (trimmed.startsWith("{{") || trimmed.startsWith("ods://") || trimmed.startsWith("${")) {
|
|
34620
|
+
return shortReferenceLabel(trimmed.startsWith("ods://") ? `{{${trimmed}}}` : trimmed);
|
|
34621
|
+
}
|
|
34622
|
+
return trimmed;
|
|
34623
|
+
}
|
|
34624
|
+
function ExpressionField({
|
|
34625
|
+
value,
|
|
34626
|
+
onChange,
|
|
34627
|
+
label,
|
|
34628
|
+
placeholder,
|
|
34629
|
+
helperText,
|
|
34630
|
+
disabled = false,
|
|
34631
|
+
rows = 4,
|
|
34632
|
+
id,
|
|
34633
|
+
className,
|
|
34634
|
+
style,
|
|
34635
|
+
resolveLabel,
|
|
34636
|
+
resolveCall,
|
|
34637
|
+
pillEveryToken = false,
|
|
34638
|
+
"aria-label": ariaLabel
|
|
34639
|
+
}) {
|
|
34640
|
+
const fieldRef = useRef50(null);
|
|
34641
|
+
const fromSelf = useRef50(false);
|
|
34642
|
+
const generatedId = useId61();
|
|
34643
|
+
const fieldId = id ?? generatedId;
|
|
34644
|
+
const helperId = `${fieldId}-helper`;
|
|
34645
|
+
const [editing, setEditing] = useState71(null);
|
|
34646
|
+
const labelFor = useCallback50(
|
|
34647
|
+
(token) => resolveLabel?.(token) ?? shortReferenceLabel(token),
|
|
34648
|
+
[resolveLabel]
|
|
34649
|
+
);
|
|
34650
|
+
const callLabel = useCallback50(
|
|
34651
|
+
(name) => resolveCall?.(name)?.label ?? (name.startsWith("user.") ? name.slice(5) : name),
|
|
34652
|
+
[resolveCall]
|
|
34653
|
+
);
|
|
34654
|
+
const chipText = useCallback50(
|
|
34655
|
+
(name, args) => {
|
|
34656
|
+
const summary = args.map(argSummary).filter(Boolean).join(", ");
|
|
34657
|
+
return `${callLabel(name)}(${summary})`;
|
|
34658
|
+
},
|
|
34659
|
+
[callLabel]
|
|
34660
|
+
);
|
|
34661
|
+
const makeToken = useCallback50(
|
|
34662
|
+
(segment) => {
|
|
34663
|
+
if (segment.kind === "text") return null;
|
|
34664
|
+
const el = document.createElement("span");
|
|
34665
|
+
el.contentEditable = "false";
|
|
34666
|
+
el.setAttribute("data-value", segment.raw);
|
|
34667
|
+
el.tabIndex = -1;
|
|
34668
|
+
if (segment.kind === "ref") {
|
|
34669
|
+
el.className = PILL;
|
|
34670
|
+
el.textContent = labelFor(segment.raw);
|
|
34671
|
+
el.title = segment.raw;
|
|
34672
|
+
} else {
|
|
34673
|
+
el.className = CHIP;
|
|
34674
|
+
el.setAttribute("data-call", segment.name);
|
|
34675
|
+
el.textContent = chipText(segment.name, segment.args);
|
|
34676
|
+
el.title = segment.raw;
|
|
34677
|
+
}
|
|
34678
|
+
return el;
|
|
34679
|
+
},
|
|
34680
|
+
[labelFor, chipText]
|
|
34681
|
+
);
|
|
34682
|
+
const render = useCallback50(
|
|
34683
|
+
(raw) => {
|
|
34684
|
+
const el = fieldRef.current;
|
|
34685
|
+
if (!el) return;
|
|
34686
|
+
el.innerHTML = "";
|
|
34687
|
+
if (!raw) return;
|
|
34688
|
+
for (const segment of parseExpression(raw, pillEveryToken)) {
|
|
34689
|
+
if (segment.kind === "text") {
|
|
34690
|
+
el.appendChild(document.createTextNode(segment.raw));
|
|
34691
|
+
continue;
|
|
34692
|
+
}
|
|
34693
|
+
const token = makeToken(segment);
|
|
34694
|
+
if (token) {
|
|
34695
|
+
el.appendChild(token);
|
|
34696
|
+
el.appendChild(document.createTextNode(ZERO_WIDTH));
|
|
34697
|
+
}
|
|
34698
|
+
}
|
|
34699
|
+
},
|
|
34700
|
+
[pillEveryToken, makeToken]
|
|
34701
|
+
);
|
|
34702
|
+
useEffect56(() => {
|
|
34703
|
+
if (fromSelf.current) {
|
|
34704
|
+
fromSelf.current = false;
|
|
34705
|
+
return;
|
|
34706
|
+
}
|
|
34707
|
+
render(value);
|
|
34708
|
+
}, [value, render]);
|
|
34709
|
+
const commit = useCallback50(() => {
|
|
34710
|
+
const el = fieldRef.current;
|
|
34711
|
+
if (!el) return;
|
|
34712
|
+
fromSelf.current = true;
|
|
34713
|
+
onChange(serialize(el));
|
|
34714
|
+
}, [onChange]);
|
|
34715
|
+
const textBeforeCaret = useCallback50(() => {
|
|
34716
|
+
const el = fieldRef.current;
|
|
34717
|
+
const sel = typeof window !== "undefined" ? window.getSelection() : null;
|
|
34718
|
+
if (!el || !sel || sel.rangeCount === 0 || !el.contains(sel.anchorNode)) return "";
|
|
34719
|
+
const range = sel.getRangeAt(0).cloneRange();
|
|
34720
|
+
range.setStart(el, 0);
|
|
34721
|
+
const holder = document.createElement("div");
|
|
34722
|
+
holder.appendChild(range.cloneContents());
|
|
34723
|
+
return serialize(holder);
|
|
34724
|
+
}, []);
|
|
34725
|
+
const insert = useCallback50(
|
|
34726
|
+
({ value: raw, kind }) => {
|
|
34727
|
+
const el = fieldRef.current;
|
|
34728
|
+
if (!el || disabled) return;
|
|
34729
|
+
const sel = window.getSelection();
|
|
34730
|
+
const hasCaret = !!sel && sel.rangeCount > 0 && el.contains(sel.anchorNode);
|
|
34731
|
+
const asArgument = hasCaret && insideCallArguments(textBeforeCaret());
|
|
34732
|
+
const call = parseCall(raw);
|
|
34733
|
+
const isCall = kind === "function" || !!call;
|
|
34734
|
+
const text = isCall || asArgument ? raw : raw.startsWith("ods://") ? `{{${raw}}}` : raw;
|
|
34735
|
+
let node;
|
|
34736
|
+
if (asArgument) {
|
|
34737
|
+
node = document.createTextNode(text);
|
|
34738
|
+
} else if (isCall && call) {
|
|
34739
|
+
node = makeToken({ kind: "call", raw: text, name: call.name, args: call.args });
|
|
34740
|
+
} else if (text.startsWith("{{") || text.startsWith("${")) {
|
|
34741
|
+
node = makeToken({ kind: "ref", raw: text });
|
|
34742
|
+
} else {
|
|
34743
|
+
node = document.createTextNode(text);
|
|
34744
|
+
}
|
|
34745
|
+
const range = hasCaret && sel ? sel.getRangeAt(0) : (() => {
|
|
34746
|
+
const r = document.createRange();
|
|
34747
|
+
r.selectNodeContents(el);
|
|
34748
|
+
r.collapse(false);
|
|
34749
|
+
return r;
|
|
34750
|
+
})();
|
|
34751
|
+
range.deleteContents();
|
|
34752
|
+
range.insertNode(node);
|
|
34753
|
+
const after = document.createTextNode(ZERO_WIDTH);
|
|
34754
|
+
range.setStartAfter(node);
|
|
34755
|
+
range.insertNode(after);
|
|
34756
|
+
range.setStartAfter(after);
|
|
34757
|
+
range.collapse(true);
|
|
34758
|
+
el.focus();
|
|
34759
|
+
const selection = window.getSelection();
|
|
34760
|
+
selection?.removeAllRanges();
|
|
34761
|
+
selection?.addRange(range);
|
|
34762
|
+
commit();
|
|
34763
|
+
if (isCall && call && node instanceof HTMLElement && call.args.length === 0) {
|
|
34764
|
+
openEditor(node);
|
|
34765
|
+
}
|
|
34766
|
+
},
|
|
34767
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34768
|
+
[commit, disabled, makeToken, textBeforeCaret]
|
|
34769
|
+
);
|
|
34770
|
+
const selected = useRef50(null);
|
|
34771
|
+
const selectToken = useCallback50((token) => {
|
|
34772
|
+
selected.current = token;
|
|
34773
|
+
const range = document.createRange();
|
|
34774
|
+
range.selectNode(token);
|
|
34775
|
+
const sel = window.getSelection();
|
|
34776
|
+
sel?.removeAllRanges();
|
|
34777
|
+
sel?.addRange(range);
|
|
34778
|
+
fieldRef.current?.focus();
|
|
34779
|
+
}, []);
|
|
34780
|
+
const openEditor = useCallback50((chip) => {
|
|
34781
|
+
const raw = chip.getAttribute("data-value") ?? "";
|
|
34782
|
+
const parsed = parseCall(raw);
|
|
34783
|
+
if (!parsed) return;
|
|
34784
|
+
const box = chip.getBoundingClientRect();
|
|
34785
|
+
const host = fieldRef.current?.getBoundingClientRect();
|
|
34786
|
+
setEditing({
|
|
34787
|
+
el: chip,
|
|
34788
|
+
name: parsed.name,
|
|
34789
|
+
args: parsed.args.length ? parsed.args : [""],
|
|
34790
|
+
rect: {
|
|
34791
|
+
top: box.bottom - (host?.top ?? 0) + 4,
|
|
34792
|
+
left: Math.max(0, box.left - (host?.left ?? 0)),
|
|
34793
|
+
width: Math.max(260, box.width)
|
|
34794
|
+
}
|
|
34795
|
+
});
|
|
34796
|
+
}, []);
|
|
34797
|
+
const applyEditor = useCallback50(
|
|
34798
|
+
(args) => {
|
|
34799
|
+
if (!editing) return;
|
|
34800
|
+
const raw = formatCall(editing.name, args);
|
|
34801
|
+
editing.el.setAttribute("data-value", raw);
|
|
34802
|
+
editing.el.textContent = chipText(editing.name, args);
|
|
34803
|
+
editing.el.title = raw;
|
|
34804
|
+
setEditing(null);
|
|
34805
|
+
commit();
|
|
34806
|
+
fieldRef.current?.focus();
|
|
34807
|
+
},
|
|
34808
|
+
[editing, chipText, commit]
|
|
34809
|
+
);
|
|
34810
|
+
const handleClick = useCallback50(
|
|
34811
|
+
(e) => {
|
|
34812
|
+
const target = e.target.closest(`.${PILL}, .${CHIP}`);
|
|
34813
|
+
if (!target) return;
|
|
34814
|
+
selectToken(target);
|
|
34815
|
+
if (!disabled && target.classList.contains(CHIP) && e.detail >= 2) {
|
|
34816
|
+
openEditor(target);
|
|
34817
|
+
}
|
|
34818
|
+
},
|
|
34819
|
+
[disabled, openEditor, selectToken]
|
|
34820
|
+
);
|
|
34821
|
+
const handleCopy = useCallback50(
|
|
34822
|
+
(e, cut = false) => {
|
|
34823
|
+
const sel = window.getSelection();
|
|
34824
|
+
if (!sel || sel.rangeCount === 0) return;
|
|
34825
|
+
const holder = document.createElement("div");
|
|
34826
|
+
holder.appendChild(sel.getRangeAt(0).cloneContents());
|
|
34827
|
+
const token = selected.current;
|
|
34828
|
+
const text = serialize(holder) || (token && fieldRef.current?.contains(token) && sel.containsNode(token, true) ? token.getAttribute("data-value") ?? "" : "");
|
|
34829
|
+
if (!text) return;
|
|
34830
|
+
e.preventDefault();
|
|
34831
|
+
e.clipboardData.setData("text/plain", text);
|
|
34832
|
+
if (cut && !disabled) {
|
|
34833
|
+
if (serialize(holder)) sel.getRangeAt(0).deleteContents();
|
|
34834
|
+
else token?.remove();
|
|
34835
|
+
commit();
|
|
34836
|
+
}
|
|
34837
|
+
},
|
|
34838
|
+
[commit, disabled]
|
|
34839
|
+
);
|
|
34840
|
+
const handlePaste = useCallback50(
|
|
34841
|
+
(e) => {
|
|
34842
|
+
e.preventDefault();
|
|
34843
|
+
const text = e.clipboardData.getData("text/plain");
|
|
34844
|
+
if (!text) return;
|
|
34845
|
+
document.execCommand("insertText", false, text);
|
|
34846
|
+
const next = serialize(fieldRef.current);
|
|
34847
|
+
fromSelf.current = false;
|
|
34848
|
+
onChange(next);
|
|
34849
|
+
},
|
|
34850
|
+
[onChange]
|
|
34851
|
+
);
|
|
34852
|
+
const handleKeyDown = useCallback50(
|
|
34853
|
+
(e) => {
|
|
34854
|
+
if (e.key !== "Enter" || !e.metaKey) return;
|
|
34855
|
+
const sel = window.getSelection();
|
|
34856
|
+
const node = sel?.anchorNode;
|
|
34857
|
+
const chip = node instanceof HTMLElement ? node.closest(`.${CHIP}`) : node?.parentElement?.closest(`.${CHIP}`) ?? null;
|
|
34858
|
+
if (chip) {
|
|
34859
|
+
e.preventDefault();
|
|
34860
|
+
openEditor(chip);
|
|
34861
|
+
}
|
|
34862
|
+
},
|
|
34863
|
+
[openEditor]
|
|
34864
|
+
);
|
|
34865
|
+
const handleDragOver = useCallback50(
|
|
34866
|
+
(e) => {
|
|
34867
|
+
if (disabled) return;
|
|
34868
|
+
if (e.dataTransfer.types.includes("application/x-fx-insert")) {
|
|
34869
|
+
e.preventDefault();
|
|
34870
|
+
e.dataTransfer.dropEffect = "copy";
|
|
34871
|
+
fieldRef.current?.classList.add("ods-expression-field__input--dragover");
|
|
34872
|
+
}
|
|
34873
|
+
},
|
|
34874
|
+
[disabled]
|
|
34875
|
+
);
|
|
34876
|
+
const handleDragLeave = useCallback50(() => {
|
|
34877
|
+
fieldRef.current?.classList.remove("ods-expression-field__input--dragover");
|
|
34878
|
+
}, []);
|
|
34879
|
+
const handleDrop = useCallback50(
|
|
34880
|
+
(e) => {
|
|
34881
|
+
const raw = e.dataTransfer.getData("application/x-fx-insert");
|
|
34882
|
+
if (!raw || disabled) return;
|
|
34883
|
+
e.preventDefault();
|
|
34884
|
+
fieldRef.current?.classList.remove("ods-expression-field__input--dragover");
|
|
34885
|
+
const kind = e.dataTransfer.getData("application/x-fx-type");
|
|
34886
|
+
insert({ value: raw, kind: kind === "function" ? "function" : "variable" });
|
|
34887
|
+
},
|
|
34888
|
+
[disabled, insert]
|
|
34889
|
+
);
|
|
34890
|
+
const handleBlur = useCallback50(() => {
|
|
34891
|
+
const el = fieldRef.current;
|
|
34892
|
+
if (!el) return;
|
|
34893
|
+
const next = serialize(el);
|
|
34894
|
+
if (next !== value) {
|
|
34895
|
+
fromSelf.current = true;
|
|
34896
|
+
onChange(next);
|
|
34897
|
+
}
|
|
34898
|
+
if (!editing) render(next);
|
|
34899
|
+
}, [editing, onChange, render, value]);
|
|
34900
|
+
return /* @__PURE__ */ jsxs141("div", { className: cn("ods-expression-field", className), style, children: [
|
|
34901
|
+
label && /* @__PURE__ */ jsx147("label", { className: "ods-expression-field__label", htmlFor: fieldId, children: label }),
|
|
34902
|
+
/* @__PURE__ */ jsxs141("div", { className: "ods-expression-field__body", children: [
|
|
34903
|
+
/* @__PURE__ */ jsx147(
|
|
34904
|
+
"div",
|
|
34905
|
+
{
|
|
34906
|
+
id: fieldId,
|
|
34907
|
+
ref: fieldRef,
|
|
34908
|
+
role: "textbox",
|
|
34909
|
+
"aria-multiline": "true",
|
|
34910
|
+
"aria-label": ariaLabel ?? (typeof label === "string" ? label : void 0),
|
|
34911
|
+
"aria-describedby": helperText ? helperId : void 0,
|
|
34912
|
+
"aria-disabled": disabled || void 0,
|
|
34913
|
+
contentEditable: !disabled,
|
|
34914
|
+
suppressContentEditableWarning: true,
|
|
34915
|
+
"data-placeholder": placeholder,
|
|
34916
|
+
className: cn(
|
|
34917
|
+
"ods-expression-field__input",
|
|
34918
|
+
disabled && "ods-expression-field__input--disabled"
|
|
34919
|
+
),
|
|
34920
|
+
style: { minHeight: `${Math.max(1, rows) * 1.5 + 1}rem` },
|
|
34921
|
+
onInput: commit,
|
|
34922
|
+
onBlur: handleBlur,
|
|
34923
|
+
onClick: handleClick,
|
|
34924
|
+
onKeyDown: handleKeyDown,
|
|
34925
|
+
onCopy: handleCopy,
|
|
34926
|
+
onCut: (e) => handleCopy(e, true),
|
|
34927
|
+
onPaste: handlePaste,
|
|
34928
|
+
onDragOver: handleDragOver,
|
|
34929
|
+
onDragLeave: handleDragLeave,
|
|
34930
|
+
onDrop: handleDrop
|
|
34931
|
+
}
|
|
34932
|
+
),
|
|
34933
|
+
editing && /* @__PURE__ */ jsx147(
|
|
34934
|
+
CallEditor,
|
|
34935
|
+
{
|
|
34936
|
+
name: editing.name,
|
|
34937
|
+
label: callLabel(editing.name),
|
|
34938
|
+
initialArgs: editing.args,
|
|
34939
|
+
signature: resolveCall?.(editing.name),
|
|
34940
|
+
rect: editing.rect,
|
|
34941
|
+
onCancel: () => setEditing(null),
|
|
34942
|
+
onApply: applyEditor
|
|
34943
|
+
}
|
|
34944
|
+
)
|
|
34945
|
+
] }),
|
|
34946
|
+
helperText && /* @__PURE__ */ jsx147("span", { id: helperId, className: "ods-expression-field__helper", children: helperText })
|
|
34947
|
+
] });
|
|
34948
|
+
}
|
|
34949
|
+
function CallEditor({
|
|
34950
|
+
name,
|
|
34951
|
+
label,
|
|
34952
|
+
initialArgs,
|
|
34953
|
+
signature,
|
|
34954
|
+
rect,
|
|
34955
|
+
onApply,
|
|
34956
|
+
onCancel
|
|
34957
|
+
}) {
|
|
34958
|
+
const names = signature?.args ?? [];
|
|
34959
|
+
const [args, setArgs] = useState71(() => {
|
|
34960
|
+
const seeded = [...initialArgs];
|
|
34961
|
+
while (seeded.length < names.length) seeded.push("");
|
|
34962
|
+
return seeded.length ? seeded : [""];
|
|
34963
|
+
});
|
|
34964
|
+
const [raw, setRaw] = useState71(null);
|
|
34965
|
+
const panelRef = useRef50(null);
|
|
34966
|
+
useEffect56(() => {
|
|
34967
|
+
panelRef.current?.querySelector("input")?.focus();
|
|
34968
|
+
const onKey = (e) => {
|
|
34969
|
+
if (e.key === "Escape") onCancel();
|
|
34970
|
+
};
|
|
34971
|
+
document.addEventListener("keydown", onKey);
|
|
34972
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
34973
|
+
}, [onCancel]);
|
|
34974
|
+
const setArg = (idx, next) => setArgs((prev) => prev.map((a, i) => i === idx ? next : a));
|
|
34975
|
+
const dropInto = (idx) => (e) => {
|
|
34976
|
+
const ref = e.dataTransfer.getData("application/x-fx-insert");
|
|
34977
|
+
if (!ref) return;
|
|
34978
|
+
e.preventDefault();
|
|
34979
|
+
setArg(idx, ref);
|
|
34980
|
+
};
|
|
34981
|
+
return /* @__PURE__ */ jsxs141(
|
|
34982
|
+
"div",
|
|
34983
|
+
{
|
|
34984
|
+
ref: panelRef,
|
|
34985
|
+
className: "ods-expression-field__editor",
|
|
34986
|
+
style: { top: rect.top, left: rect.left, width: rect.width },
|
|
34987
|
+
role: "dialog",
|
|
34988
|
+
"aria-label": `Edit ${label}`,
|
|
34989
|
+
children: [
|
|
34990
|
+
/* @__PURE__ */ jsxs141("div", { className: "ods-expression-field__editor-head", children: [
|
|
34991
|
+
/* @__PURE__ */ jsx147("code", { children: label }),
|
|
34992
|
+
/* @__PURE__ */ jsx147("button", { type: "button", className: "ods-expression-field__editor-link", onClick: () => setRaw(raw === null ? formatCall(name, args) : null), children: raw === null ? "Edit as text" : "Back to fields" })
|
|
34993
|
+
] }),
|
|
34994
|
+
raw === null ? /* @__PURE__ */ jsxs141("div", { className: "ods-expression-field__editor-rows", children: [
|
|
34995
|
+
args.map((arg, idx) => (
|
|
34996
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
34997
|
+
/* @__PURE__ */ jsxs141("label", { className: "ods-expression-field__editor-row", children: [
|
|
34998
|
+
/* @__PURE__ */ jsx147("span", { children: names[idx] ?? `argument ${idx + 1}` }),
|
|
34999
|
+
/* @__PURE__ */ jsx147(
|
|
35000
|
+
"input",
|
|
35001
|
+
{
|
|
35002
|
+
value: arg,
|
|
35003
|
+
placeholder: "value, or drag one in",
|
|
35004
|
+
onChange: (e) => setArg(idx, e.target.value),
|
|
35005
|
+
onDragOver: (e) => {
|
|
35006
|
+
if (e.dataTransfer.types.includes("application/x-fx-insert")) e.preventDefault();
|
|
35007
|
+
},
|
|
35008
|
+
onDrop: dropInto(idx)
|
|
35009
|
+
}
|
|
35010
|
+
)
|
|
35011
|
+
] }, idx)
|
|
35012
|
+
)),
|
|
35013
|
+
/* @__PURE__ */ jsx147(
|
|
35014
|
+
"button",
|
|
35015
|
+
{
|
|
35016
|
+
type: "button",
|
|
35017
|
+
className: "ods-expression-field__editor-link",
|
|
35018
|
+
onClick: () => setArgs((prev) => [...prev, ""]),
|
|
35019
|
+
children: "+ argument"
|
|
35020
|
+
}
|
|
35021
|
+
)
|
|
35022
|
+
] }) : /* @__PURE__ */ jsx147(
|
|
35023
|
+
"textarea",
|
|
35024
|
+
{
|
|
35025
|
+
className: "ods-expression-field__editor-raw",
|
|
35026
|
+
value: raw,
|
|
35027
|
+
rows: 3,
|
|
35028
|
+
onChange: (e) => setRaw(e.target.value)
|
|
35029
|
+
}
|
|
35030
|
+
),
|
|
35031
|
+
/* @__PURE__ */ jsxs141("div", { className: "ods-expression-field__editor-foot", children: [
|
|
35032
|
+
/* @__PURE__ */ jsx147("button", { type: "button", onClick: onCancel, children: "Cancel" }),
|
|
35033
|
+
/* @__PURE__ */ jsx147(
|
|
35034
|
+
"button",
|
|
35035
|
+
{
|
|
35036
|
+
type: "button",
|
|
35037
|
+
className: "ods-expression-field__editor-primary",
|
|
35038
|
+
onClick: () => {
|
|
35039
|
+
if (raw === null) return onApply(args);
|
|
35040
|
+
const parsed = parseCall(raw);
|
|
35041
|
+
onApply(parsed ? parsed.args : splitArguments(raw));
|
|
35042
|
+
},
|
|
35043
|
+
children: "Apply"
|
|
35044
|
+
}
|
|
35045
|
+
)
|
|
35046
|
+
] })
|
|
35047
|
+
]
|
|
35048
|
+
}
|
|
35049
|
+
);
|
|
35050
|
+
}
|
|
35051
|
+
|
|
35052
|
+
// src/components/TopBar/TopBar.tsx
|
|
35053
|
+
import { jsx as jsx148, jsxs as jsxs142 } from "react/jsx-runtime";
|
|
34425
35054
|
function TopBar({
|
|
34426
35055
|
brand,
|
|
34427
35056
|
workspaceSwitcher,
|
|
@@ -34441,32 +35070,32 @@ function TopBar({
|
|
|
34441
35070
|
const showDividerAfterBrand = hasBrandBlock && (hasWorkspace || hasCrumbs || hasTitle);
|
|
34442
35071
|
const showDividerAfterWorkspace = hasWorkspace && (hasCrumbs || hasTitle);
|
|
34443
35072
|
const BrandRoot = brand?.href ? "a" : "div";
|
|
34444
|
-
return /* @__PURE__ */
|
|
34445
|
-
/* @__PURE__ */
|
|
34446
|
-
brand && /* @__PURE__ */
|
|
35073
|
+
return /* @__PURE__ */ jsxs142("header", { ...props, className: cn("ods-topbar", className), children: [
|
|
35074
|
+
/* @__PURE__ */ jsxs142("div", { className: "ods-topbar__left", children: [
|
|
35075
|
+
brand && /* @__PURE__ */ jsxs142(
|
|
34447
35076
|
BrandRoot,
|
|
34448
35077
|
{
|
|
34449
35078
|
href: brand.href,
|
|
34450
35079
|
className: cn("ods-topbar__brand", brand.href && "ods-topbar__brand--link"),
|
|
34451
35080
|
children: [
|
|
34452
|
-
brand.logo && /* @__PURE__ */
|
|
34453
|
-
/* @__PURE__ */
|
|
35081
|
+
brand.logo && /* @__PURE__ */ jsx148("span", { className: "ods-topbar__brand-mark", children: brand.logo }),
|
|
35082
|
+
/* @__PURE__ */ jsx148("span", { className: "ods-topbar__brand-name", children: brand.name })
|
|
34454
35083
|
]
|
|
34455
35084
|
}
|
|
34456
35085
|
),
|
|
34457
|
-
showDividerAfterBrand && /* @__PURE__ */
|
|
34458
|
-
workspaceSwitcher && /* @__PURE__ */
|
|
34459
|
-
showDividerAfterWorkspace && /* @__PURE__ */
|
|
34460
|
-
hasCrumbs && /* @__PURE__ */
|
|
34461
|
-
idx > 0 && /* @__PURE__ */
|
|
34462
|
-
crumb.href ? /* @__PURE__ */
|
|
35086
|
+
showDividerAfterBrand && /* @__PURE__ */ jsx148("span", { className: "ods-topbar__divider", "aria-hidden": "true" }),
|
|
35087
|
+
workspaceSwitcher && /* @__PURE__ */ jsx148("div", { className: "ods-topbar__workspace", children: workspaceSwitcher }),
|
|
35088
|
+
showDividerAfterWorkspace && /* @__PURE__ */ jsx148("span", { className: "ods-topbar__divider", "aria-hidden": "true" }),
|
|
35089
|
+
hasCrumbs && /* @__PURE__ */ jsx148("nav", { className: "ods-topbar__breadcrumbs", "aria-label": "Breadcrumb", children: /* @__PURE__ */ jsx148("ol", { children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs142("li", { className: "ods-topbar__crumb", children: [
|
|
35090
|
+
idx > 0 && /* @__PURE__ */ jsx148("span", { className: "ods-topbar__separator", "aria-hidden": "true", children: "/" }),
|
|
35091
|
+
crumb.href ? /* @__PURE__ */ jsx148("a", { href: crumb.href, children: crumb.label }) : /* @__PURE__ */ jsx148("span", { "aria-current": idx === breadcrumbs.length - 1 ? "page" : void 0, children: crumb.label })
|
|
34463
35092
|
] }, idx)) }) }),
|
|
34464
|
-
hasTitle && /* @__PURE__ */
|
|
35093
|
+
hasTitle && /* @__PURE__ */ jsx148("h1", { className: "ods-topbar__title", children: title })
|
|
34465
35094
|
] }),
|
|
34466
|
-
children && /* @__PURE__ */
|
|
34467
|
-
/* @__PURE__ */
|
|
34468
|
-
onSearch && /* @__PURE__ */
|
|
34469
|
-
/* @__PURE__ */
|
|
35095
|
+
children && /* @__PURE__ */ jsx148("div", { className: "ods-topbar__center", children }),
|
|
35096
|
+
/* @__PURE__ */ jsxs142("div", { className: "ods-topbar__right", children: [
|
|
35097
|
+
onSearch && /* @__PURE__ */ jsxs142("div", { className: "ods-topbar__search", children: [
|
|
35098
|
+
/* @__PURE__ */ jsx148(
|
|
34470
35099
|
"svg",
|
|
34471
35100
|
{
|
|
34472
35101
|
className: "ods-topbar__search-icon",
|
|
@@ -34475,7 +35104,7 @@ function TopBar({
|
|
|
34475
35104
|
viewBox: "0 0 20 20",
|
|
34476
35105
|
fill: "currentColor",
|
|
34477
35106
|
"aria-hidden": "true",
|
|
34478
|
-
children: /* @__PURE__ */
|
|
35107
|
+
children: /* @__PURE__ */ jsx148(
|
|
34479
35108
|
"path",
|
|
34480
35109
|
{
|
|
34481
35110
|
fillRule: "evenodd",
|
|
@@ -34485,7 +35114,7 @@ function TopBar({
|
|
|
34485
35114
|
)
|
|
34486
35115
|
}
|
|
34487
35116
|
),
|
|
34488
|
-
/* @__PURE__ */
|
|
35117
|
+
/* @__PURE__ */ jsx148(
|
|
34489
35118
|
"input",
|
|
34490
35119
|
{
|
|
34491
35120
|
type: "search",
|
|
@@ -34496,7 +35125,7 @@ function TopBar({
|
|
|
34496
35125
|
}
|
|
34497
35126
|
)
|
|
34498
35127
|
] }),
|
|
34499
|
-
actions && /* @__PURE__ */
|
|
35128
|
+
actions && /* @__PURE__ */ jsx148("div", { className: "ods-topbar__actions", children: actions })
|
|
34500
35129
|
] })
|
|
34501
35130
|
] });
|
|
34502
35131
|
}
|
|
@@ -34505,9 +35134,9 @@ function TopBar({
|
|
|
34505
35134
|
import { AnimatePresence as AnimatePresence19, motion as motion29 } from "framer-motion";
|
|
34506
35135
|
import {
|
|
34507
35136
|
forwardRef as forwardRef97,
|
|
34508
|
-
useCallback as
|
|
34509
|
-
useId as
|
|
34510
|
-
useState as
|
|
35137
|
+
useCallback as useCallback51,
|
|
35138
|
+
useId as useId62,
|
|
35139
|
+
useState as useState72
|
|
34511
35140
|
} from "react";
|
|
34512
35141
|
import {
|
|
34513
35142
|
BuildToolIcon,
|
|
@@ -34518,13 +35147,13 @@ import {
|
|
|
34518
35147
|
IdeaIcon,
|
|
34519
35148
|
WarningAltIcon as WarningAltIcon2
|
|
34520
35149
|
} from "@octaviaflow/icons";
|
|
34521
|
-
import { jsx as
|
|
35150
|
+
import { jsx as jsx149, jsxs as jsxs143 } from "react/jsx-runtime";
|
|
34522
35151
|
var DEFAULT_KIND_GLYPH = {
|
|
34523
|
-
thought: /* @__PURE__ */
|
|
34524
|
-
tool: /* @__PURE__ */
|
|
34525
|
-
input: /* @__PURE__ */
|
|
34526
|
-
output: /* @__PURE__ */
|
|
34527
|
-
error: /* @__PURE__ */
|
|
35152
|
+
thought: /* @__PURE__ */ jsx149(IdeaIcon, { size: "xs" }),
|
|
35153
|
+
tool: /* @__PURE__ */ jsx149(BuildToolIcon, { size: "xs" }),
|
|
35154
|
+
input: /* @__PURE__ */ jsx149(ConnectionReceiveIcon, { size: "xs" }),
|
|
35155
|
+
output: /* @__PURE__ */ jsx149(ConnectionSendIcon, { size: "xs" }),
|
|
35156
|
+
error: /* @__PURE__ */ jsx149(WarningAltIcon2, { size: "xs" })
|
|
34528
35157
|
};
|
|
34529
35158
|
var FALLBACK_GLYPH = DEFAULT_KIND_GLYPH.thought;
|
|
34530
35159
|
var TraceStep = forwardRef97(
|
|
@@ -34549,22 +35178,22 @@ var TraceStep = forwardRef97(
|
|
|
34549
35178
|
className,
|
|
34550
35179
|
...rest
|
|
34551
35180
|
}, ref) {
|
|
34552
|
-
const reactId =
|
|
35181
|
+
const reactId = useId62();
|
|
34553
35182
|
const baseId = providedId ?? `ods-trace-step-${reactId}`;
|
|
34554
35183
|
const headId = `${baseId}-head`;
|
|
34555
35184
|
const contentId = `${baseId}-content`;
|
|
34556
|
-
const [uncontrolledOpen, setUncontrolledOpen] =
|
|
35185
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState72(defaultOpen);
|
|
34557
35186
|
const isControlled = controlledOpen !== void 0;
|
|
34558
35187
|
const open = isControlled ? controlledOpen : uncontrolledOpen;
|
|
34559
35188
|
const canExpand = !!children;
|
|
34560
|
-
const toggle =
|
|
35189
|
+
const toggle = useCallback51(() => {
|
|
34561
35190
|
if (!canExpand) return;
|
|
34562
35191
|
const next = !open;
|
|
34563
35192
|
if (!isControlled) setUncontrolledOpen(next);
|
|
34564
35193
|
onOpenChange?.(next);
|
|
34565
35194
|
}, [canExpand, open, isControlled, onOpenChange]);
|
|
34566
35195
|
const resolvedGlyph = icon ?? kindIcons?.[kind] ?? DEFAULT_KIND_GLYPH[kind] ?? FALLBACK_GLYPH;
|
|
34567
|
-
return /* @__PURE__ */
|
|
35196
|
+
return /* @__PURE__ */ jsxs143(
|
|
34568
35197
|
"div",
|
|
34569
35198
|
{
|
|
34570
35199
|
...rest,
|
|
@@ -34580,18 +35209,18 @@ var TraceStep = forwardRef97(
|
|
|
34580
35209
|
className
|
|
34581
35210
|
),
|
|
34582
35211
|
children: [
|
|
34583
|
-
/* @__PURE__ */
|
|
34584
|
-
/* @__PURE__ */
|
|
35212
|
+
/* @__PURE__ */ jsxs143("div", { className: "ods-trace-step__rail", "aria-hidden": "true", children: [
|
|
35213
|
+
/* @__PURE__ */ jsx149(
|
|
34585
35214
|
motion29.span,
|
|
34586
35215
|
{
|
|
34587
35216
|
className: "ods-trace-step__icon",
|
|
34588
35217
|
initial: disableAnimation ? false : { scale: 0.6, opacity: 0 },
|
|
34589
35218
|
animate: { scale: 1, opacity: 1 },
|
|
34590
35219
|
transition: { duration: 0.2, ease: [0.16, 1, 0.3, 1] },
|
|
34591
|
-
children: status === "running" ? /* @__PURE__ */
|
|
35220
|
+
children: status === "running" ? /* @__PURE__ */ jsx149("span", { className: "ods-trace-step__spin", children: /* @__PURE__ */ jsx149(CircleDashIcon, { size: "xs" }) }) : resolvedGlyph
|
|
34592
35221
|
}
|
|
34593
35222
|
),
|
|
34594
|
-
!isLast && /* @__PURE__ */
|
|
35223
|
+
!isLast && /* @__PURE__ */ jsx149(
|
|
34595
35224
|
motion29.span,
|
|
34596
35225
|
{
|
|
34597
35226
|
className: "ods-trace-step__line",
|
|
@@ -34601,8 +35230,8 @@ var TraceStep = forwardRef97(
|
|
|
34601
35230
|
}
|
|
34602
35231
|
)
|
|
34603
35232
|
] }),
|
|
34604
|
-
/* @__PURE__ */
|
|
34605
|
-
/* @__PURE__ */
|
|
35233
|
+
/* @__PURE__ */ jsxs143("div", { className: "ods-trace-step__body", children: [
|
|
35234
|
+
/* @__PURE__ */ jsxs143(
|
|
34606
35235
|
"button",
|
|
34607
35236
|
{
|
|
34608
35237
|
id: headId,
|
|
@@ -34613,7 +35242,7 @@ var TraceStep = forwardRef97(
|
|
|
34613
35242
|
"aria-controls": canExpand ? contentId : void 0,
|
|
34614
35243
|
disabled: !canExpand,
|
|
34615
35244
|
children: [
|
|
34616
|
-
index != null && /* @__PURE__ */
|
|
35245
|
+
index != null && /* @__PURE__ */ jsx149(
|
|
34617
35246
|
"span",
|
|
34618
35247
|
{
|
|
34619
35248
|
className: cn(
|
|
@@ -34623,32 +35252,32 @@ var TraceStep = forwardRef97(
|
|
|
34623
35252
|
children: index
|
|
34624
35253
|
}
|
|
34625
35254
|
),
|
|
34626
|
-
/* @__PURE__ */
|
|
34627
|
-
tool && /* @__PURE__ */
|
|
35255
|
+
/* @__PURE__ */ jsx149("span", { className: "ods-trace-step__title", children: title }),
|
|
35256
|
+
tool && /* @__PURE__ */ jsxs143(
|
|
34628
35257
|
"span",
|
|
34629
35258
|
{
|
|
34630
35259
|
className: "ods-trace-step__tool",
|
|
34631
35260
|
title: tool,
|
|
34632
35261
|
"aria-label": `Tool: ${tool}`,
|
|
34633
35262
|
children: [
|
|
34634
|
-
/* @__PURE__ */
|
|
35263
|
+
/* @__PURE__ */ jsx149("span", { className: "ods-trace-step__tool-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx149(BuildToolIcon, { size: "xs" }) }),
|
|
34635
35264
|
tool
|
|
34636
35265
|
]
|
|
34637
35266
|
}
|
|
34638
35267
|
),
|
|
34639
|
-
/* @__PURE__ */
|
|
34640
|
-
tokens != null && /* @__PURE__ */
|
|
35268
|
+
/* @__PURE__ */ jsxs143("span", { className: "ods-trace-step__meta", children: [
|
|
35269
|
+
tokens != null && /* @__PURE__ */ jsxs143(
|
|
34641
35270
|
"span",
|
|
34642
35271
|
{
|
|
34643
35272
|
className: "ods-trace-step__tokens",
|
|
34644
35273
|
"aria-label": `${tokens} tokens`,
|
|
34645
35274
|
children: [
|
|
34646
|
-
/* @__PURE__ */
|
|
35275
|
+
/* @__PURE__ */ jsx149("span", { children: tokens.toLocaleString() }),
|
|
34647
35276
|
" tok"
|
|
34648
35277
|
]
|
|
34649
35278
|
}
|
|
34650
35279
|
),
|
|
34651
|
-
duration && /* @__PURE__ */
|
|
35280
|
+
duration && /* @__PURE__ */ jsx149(
|
|
34652
35281
|
"span",
|
|
34653
35282
|
{
|
|
34654
35283
|
className: "ods-trace-step__duration",
|
|
@@ -34657,20 +35286,20 @@ var TraceStep = forwardRef97(
|
|
|
34657
35286
|
}
|
|
34658
35287
|
)
|
|
34659
35288
|
] }),
|
|
34660
|
-
canExpand && /* @__PURE__ */
|
|
35289
|
+
canExpand && /* @__PURE__ */ jsx149(
|
|
34661
35290
|
motion29.span,
|
|
34662
35291
|
{
|
|
34663
35292
|
className: "ods-trace-step__chev",
|
|
34664
35293
|
"aria-hidden": "true",
|
|
34665
35294
|
animate: { rotate: open ? 180 : 0 },
|
|
34666
35295
|
transition: { duration: 0.18, ease: [0.16, 1, 0.3, 1] },
|
|
34667
|
-
children: /* @__PURE__ */
|
|
35296
|
+
children: /* @__PURE__ */ jsx149(CaretDownIcon5, { size: "xs" })
|
|
34668
35297
|
}
|
|
34669
35298
|
)
|
|
34670
35299
|
]
|
|
34671
35300
|
}
|
|
34672
35301
|
),
|
|
34673
|
-
/* @__PURE__ */
|
|
35302
|
+
/* @__PURE__ */ jsx149(AnimatePresence19, { initial: false, children: canExpand && open && /* @__PURE__ */ jsx149(
|
|
34674
35303
|
motion29.div,
|
|
34675
35304
|
{
|
|
34676
35305
|
id: contentId,
|
|
@@ -34682,7 +35311,7 @@ var TraceStep = forwardRef97(
|
|
|
34682
35311
|
exit: disableAnimation ? void 0 : { height: 0, opacity: 0 },
|
|
34683
35312
|
transition: { duration: 0.2, ease: [0.16, 1, 0.3, 1] },
|
|
34684
35313
|
style: { overflow: "hidden" },
|
|
34685
|
-
children: /* @__PURE__ */
|
|
35314
|
+
children: /* @__PURE__ */ jsx149("div", { className: "ods-trace-step__content-inner", children })
|
|
34686
35315
|
},
|
|
34687
35316
|
"content"
|
|
34688
35317
|
) })
|
|
@@ -34697,9 +35326,9 @@ TraceStep.displayName = "TraceStep";
|
|
|
34697
35326
|
// src/components/UsageMeter/UsageMeter.tsx
|
|
34698
35327
|
import {
|
|
34699
35328
|
forwardRef as forwardRef98,
|
|
34700
|
-
useId as
|
|
35329
|
+
useId as useId63
|
|
34701
35330
|
} from "react";
|
|
34702
|
-
import { jsx as
|
|
35331
|
+
import { jsx as jsx150, jsxs as jsxs144 } from "react/jsx-runtime";
|
|
34703
35332
|
var defaultFormat8 = (n) => n.toLocaleString();
|
|
34704
35333
|
var UsageMeter = forwardRef98(
|
|
34705
35334
|
function UsageMeter2({
|
|
@@ -34718,7 +35347,7 @@ var UsageMeter = forwardRef98(
|
|
|
34718
35347
|
"aria-label": ariaLabel,
|
|
34719
35348
|
...rest
|
|
34720
35349
|
}, ref) {
|
|
34721
|
-
const reactId =
|
|
35350
|
+
const reactId = useId63();
|
|
34722
35351
|
const baseId = providedId ?? `ods-usage-meter-${reactId}`;
|
|
34723
35352
|
const labelId = label ? `${baseId}-label` : void 0;
|
|
34724
35353
|
const captionId = caption ? `${baseId}-caption` : void 0;
|
|
@@ -34735,7 +35364,7 @@ var UsageMeter = forwardRef98(
|
|
|
34735
35364
|
const tone = exhausted ? "danger" : warned ? "warning" : "default";
|
|
34736
35365
|
const resolvedValueLabel = valueLabel ?? `${formatValue(clamped)} / ${formatValue(safeAllowance)}${safeBonus > 0 ? ` + ${formatValue(safeBonus)}` : ""}`;
|
|
34737
35366
|
const valueText = `${formatValue(clamped)} of ${formatValue(safeAllowance)} used` + (safeBonus > 0 ? `, plus ${formatValue(Math.max(0, safeBonus - inBonus))} add-on available` : "");
|
|
34738
|
-
return /* @__PURE__ */
|
|
35367
|
+
return /* @__PURE__ */ jsxs144(
|
|
34739
35368
|
"div",
|
|
34740
35369
|
{
|
|
34741
35370
|
...rest,
|
|
@@ -34748,9 +35377,9 @@ var UsageMeter = forwardRef98(
|
|
|
34748
35377
|
className
|
|
34749
35378
|
),
|
|
34750
35379
|
children: [
|
|
34751
|
-
(label || !hideValueLabel) && /* @__PURE__ */
|
|
34752
|
-
label && /* @__PURE__ */
|
|
34753
|
-
!hideValueLabel && /* @__PURE__ */
|
|
35380
|
+
(label || !hideValueLabel) && /* @__PURE__ */ jsxs144("div", { className: "ods-usage-meter__header", children: [
|
|
35381
|
+
label && /* @__PURE__ */ jsx150("span", { id: labelId, className: "ods-usage-meter__label", children: label }),
|
|
35382
|
+
!hideValueLabel && /* @__PURE__ */ jsx150(
|
|
34754
35383
|
"span",
|
|
34755
35384
|
{
|
|
34756
35385
|
className: "ods-usage-meter__value-label",
|
|
@@ -34759,7 +35388,7 @@ var UsageMeter = forwardRef98(
|
|
|
34759
35388
|
}
|
|
34760
35389
|
)
|
|
34761
35390
|
] }),
|
|
34762
|
-
/* @__PURE__ */
|
|
35391
|
+
/* @__PURE__ */ jsxs144(
|
|
34763
35392
|
"div",
|
|
34764
35393
|
{
|
|
34765
35394
|
className: "ods-usage-meter__track",
|
|
@@ -34772,12 +35401,12 @@ var UsageMeter = forwardRef98(
|
|
|
34772
35401
|
"aria-labelledby": labelId,
|
|
34773
35402
|
"aria-describedby": captionId,
|
|
34774
35403
|
children: [
|
|
34775
|
-
/* @__PURE__ */
|
|
35404
|
+
/* @__PURE__ */ jsx150(
|
|
34776
35405
|
"div",
|
|
34777
35406
|
{
|
|
34778
35407
|
className: "ods-usage-meter__segment ods-usage-meter__segment--allowance",
|
|
34779
35408
|
style: { flexGrow: safeAllowance || 1 },
|
|
34780
|
-
children: /* @__PURE__ */
|
|
35409
|
+
children: /* @__PURE__ */ jsx150(
|
|
34781
35410
|
"div",
|
|
34782
35411
|
{
|
|
34783
35412
|
className: "ods-usage-meter__fill",
|
|
@@ -34786,12 +35415,12 @@ var UsageMeter = forwardRef98(
|
|
|
34786
35415
|
)
|
|
34787
35416
|
}
|
|
34788
35417
|
),
|
|
34789
|
-
safeBonus > 0 && /* @__PURE__ */
|
|
35418
|
+
safeBonus > 0 && /* @__PURE__ */ jsx150(
|
|
34790
35419
|
"div",
|
|
34791
35420
|
{
|
|
34792
35421
|
className: "ods-usage-meter__segment ods-usage-meter__segment--bonus",
|
|
34793
35422
|
style: { flexGrow: safeBonus },
|
|
34794
|
-
children: /* @__PURE__ */
|
|
35423
|
+
children: /* @__PURE__ */ jsx150(
|
|
34795
35424
|
"div",
|
|
34796
35425
|
{
|
|
34797
35426
|
className: "ods-usage-meter__fill ods-usage-meter__fill--bonus",
|
|
@@ -34803,7 +35432,7 @@ var UsageMeter = forwardRef98(
|
|
|
34803
35432
|
]
|
|
34804
35433
|
}
|
|
34805
35434
|
),
|
|
34806
|
-
caption && /* @__PURE__ */
|
|
35435
|
+
caption && /* @__PURE__ */ jsx150("span", { id: captionId, className: "ods-usage-meter__caption", children: caption })
|
|
34807
35436
|
]
|
|
34808
35437
|
}
|
|
34809
35438
|
);
|
|
@@ -34814,9 +35443,9 @@ UsageMeter.displayName = "UsageMeter";
|
|
|
34814
35443
|
// src/components/UserCard/UserCard.tsx
|
|
34815
35444
|
import {
|
|
34816
35445
|
forwardRef as forwardRef99,
|
|
34817
|
-
useId as
|
|
35446
|
+
useId as useId64
|
|
34818
35447
|
} from "react";
|
|
34819
|
-
import { Fragment as Fragment62, jsx as
|
|
35448
|
+
import { Fragment as Fragment62, jsx as jsx151, jsxs as jsxs145 } from "react/jsx-runtime";
|
|
34820
35449
|
var UserCard = forwardRef99(function UserCard2({
|
|
34821
35450
|
name,
|
|
34822
35451
|
nameAs = "h3",
|
|
@@ -34837,16 +35466,16 @@ var UserCard = forwardRef99(function UserCard2({
|
|
|
34837
35466
|
className,
|
|
34838
35467
|
...rest
|
|
34839
35468
|
}, ref) {
|
|
34840
|
-
const reactId =
|
|
35469
|
+
const reactId = useId64();
|
|
34841
35470
|
const baseId = providedId ?? `ods-user-card-${reactId}`;
|
|
34842
35471
|
const nameId = `${baseId}-name`;
|
|
34843
35472
|
const isInteractive = Boolean(href || onClick) && !disabled;
|
|
34844
35473
|
const renderAvatar = () => {
|
|
34845
35474
|
if (avatarNode) {
|
|
34846
|
-
return /* @__PURE__ */
|
|
35475
|
+
return /* @__PURE__ */ jsx151("span", { className: "ods-user-card__avatar ods-user-card__avatar--legacy", "aria-hidden": "true", children: avatarNode });
|
|
34847
35476
|
}
|
|
34848
35477
|
const derivedInitials = avatar?.initials ?? (typeof initial === "string" ? initial : typeof name === "string" ? name.charAt(0).toUpperCase() : void 0);
|
|
34849
|
-
return /* @__PURE__ */
|
|
35478
|
+
return /* @__PURE__ */ jsx151(
|
|
34850
35479
|
Avatar,
|
|
34851
35480
|
{
|
|
34852
35481
|
size: orientation === "horizontal" ? "md" : "lg",
|
|
@@ -34860,18 +35489,18 @@ var UserCard = forwardRef99(function UserCard2({
|
|
|
34860
35489
|
}
|
|
34861
35490
|
);
|
|
34862
35491
|
};
|
|
34863
|
-
const body = /* @__PURE__ */
|
|
35492
|
+
const body = /* @__PURE__ */ jsxs145(Fragment62, { children: [
|
|
34864
35493
|
renderAvatar(),
|
|
34865
|
-
/* @__PURE__ */
|
|
34866
|
-
/* @__PURE__ */
|
|
34867
|
-
role && /* @__PURE__ */
|
|
34868
|
-
meta2 && /* @__PURE__ */
|
|
35494
|
+
/* @__PURE__ */ jsxs145("div", { className: "ods-user-card__body", children: [
|
|
35495
|
+
/* @__PURE__ */ jsx151(Card.Title, { as: nameAs, id: nameId, className: "ods-user-card__name", children: name }),
|
|
35496
|
+
role && /* @__PURE__ */ jsx151("div", { className: "ods-user-card__role", children: role }),
|
|
35497
|
+
meta2 && /* @__PURE__ */ jsx151("div", { className: "ods-user-card__meta", children: meta2 })
|
|
34869
35498
|
] }),
|
|
34870
|
-
stats && stats.length > 0 && /* @__PURE__ */
|
|
34871
|
-
/* @__PURE__ */
|
|
34872
|
-
/* @__PURE__ */
|
|
35499
|
+
stats && stats.length > 0 && /* @__PURE__ */ jsx151("div", { className: "ods-user-card__stats", children: stats.map((s, i) => /* @__PURE__ */ jsxs145("div", { className: "ods-user-card__stat", children: [
|
|
35500
|
+
/* @__PURE__ */ jsx151("div", { className: "ods-user-card__stat-value", children: s.value }),
|
|
35501
|
+
/* @__PURE__ */ jsx151("div", { className: "ods-user-card__stat-label", children: s.label })
|
|
34873
35502
|
] }, i)) }),
|
|
34874
|
-
action && /* @__PURE__ */
|
|
35503
|
+
action && /* @__PURE__ */ jsx151("div", { className: "ods-user-card__action", children: action })
|
|
34875
35504
|
] });
|
|
34876
35505
|
const sharedClass = cn(
|
|
34877
35506
|
"ods-user-card",
|
|
@@ -34881,7 +35510,7 @@ var UserCard = forwardRef99(function UserCard2({
|
|
|
34881
35510
|
className
|
|
34882
35511
|
);
|
|
34883
35512
|
if (href && !disabled) {
|
|
34884
|
-
return /* @__PURE__ */
|
|
35513
|
+
return /* @__PURE__ */ jsx151(Card, { asChild: true, radius, padding: "none", className: sharedClass, "aria-labelledby": nameId, children: /* @__PURE__ */ jsx151(
|
|
34885
35514
|
"a",
|
|
34886
35515
|
{
|
|
34887
35516
|
...rest,
|
|
@@ -34893,7 +35522,7 @@ var UserCard = forwardRef99(function UserCard2({
|
|
|
34893
35522
|
}
|
|
34894
35523
|
) });
|
|
34895
35524
|
}
|
|
34896
|
-
return /* @__PURE__ */
|
|
35525
|
+
return /* @__PURE__ */ jsx151(
|
|
34897
35526
|
Card,
|
|
34898
35527
|
{
|
|
34899
35528
|
...rest,
|
|
@@ -34912,10 +35541,10 @@ var UserCard = forwardRef99(function UserCard2({
|
|
|
34912
35541
|
UserCard.displayName = "UserCard";
|
|
34913
35542
|
|
|
34914
35543
|
// src/components/WorkflowEditor/WorkflowEditor.tsx
|
|
34915
|
-
import { useCallback as
|
|
35544
|
+
import { useCallback as useCallback53, useMemo as useMemo39, useState as useState73 } from "react";
|
|
34916
35545
|
|
|
34917
35546
|
// src/hooks/useWorkflow.ts
|
|
34918
|
-
import { useCallback as
|
|
35547
|
+
import { useCallback as useCallback52, useMemo as useMemo38, useReducer } from "react";
|
|
34919
35548
|
|
|
34920
35549
|
// src/workflow/types.ts
|
|
34921
35550
|
var types_exports = {};
|
|
@@ -35429,11 +36058,11 @@ function useWorkflow(options2 = {}) {
|
|
|
35429
36058
|
[]
|
|
35430
36059
|
);
|
|
35431
36060
|
const [workflow, dispatch] = useReducer(reducer, initial);
|
|
35432
|
-
const addNode =
|
|
36061
|
+
const addNode = useCallback52(
|
|
35433
36062
|
(node) => dispatch({ type: "ADD_NODE", payload: node }),
|
|
35434
36063
|
[]
|
|
35435
36064
|
);
|
|
35436
|
-
const createNode =
|
|
36065
|
+
const createNode = useCallback52(
|
|
35437
36066
|
(partial) => {
|
|
35438
36067
|
const id = partial.id ?? genId("node");
|
|
35439
36068
|
const ports = partial.ports ?? {
|
|
@@ -35482,27 +36111,27 @@ function useWorkflow(options2 = {}) {
|
|
|
35482
36111
|
},
|
|
35483
36112
|
[]
|
|
35484
36113
|
);
|
|
35485
|
-
const updateNode =
|
|
36114
|
+
const updateNode = useCallback52(
|
|
35486
36115
|
(id, updates) => dispatch({ type: "UPDATE_NODE", payload: { id, updates } }),
|
|
35487
36116
|
[]
|
|
35488
36117
|
);
|
|
35489
|
-
const deleteNode =
|
|
36118
|
+
const deleteNode = useCallback52(
|
|
35490
36119
|
(id) => dispatch({ type: "DELETE_NODE", payload: id }),
|
|
35491
36120
|
[]
|
|
35492
36121
|
);
|
|
35493
|
-
const deleteNodes =
|
|
36122
|
+
const deleteNodes = useCallback52(
|
|
35494
36123
|
(ids) => dispatch({ type: "DELETE_NODES", payload: ids }),
|
|
35495
36124
|
[]
|
|
35496
36125
|
);
|
|
35497
|
-
const replaceNodes =
|
|
36126
|
+
const replaceNodes = useCallback52(
|
|
35498
36127
|
(nodes) => dispatch({ type: "REPLACE_NODES", payload: nodes }),
|
|
35499
36128
|
[]
|
|
35500
36129
|
);
|
|
35501
|
-
const addEdge =
|
|
36130
|
+
const addEdge = useCallback52(
|
|
35502
36131
|
(edge) => dispatch({ type: "ADD_EDGE", payload: edge }),
|
|
35503
36132
|
[]
|
|
35504
36133
|
);
|
|
35505
|
-
const createEdge =
|
|
36134
|
+
const createEdge = useCallback52(
|
|
35506
36135
|
(source, sourcePort, target, targetPort) => {
|
|
35507
36136
|
const edge = {
|
|
35508
36137
|
id: genId("edge"),
|
|
@@ -35520,20 +36149,20 @@ function useWorkflow(options2 = {}) {
|
|
|
35520
36149
|
},
|
|
35521
36150
|
[]
|
|
35522
36151
|
);
|
|
35523
|
-
const deleteEdge =
|
|
36152
|
+
const deleteEdge = useCallback52(
|
|
35524
36153
|
(id) => dispatch({ type: "DELETE_EDGE", payload: id }),
|
|
35525
36154
|
[]
|
|
35526
36155
|
);
|
|
35527
|
-
const replaceEdges =
|
|
36156
|
+
const replaceEdges = useCallback52(
|
|
35528
36157
|
(edges) => dispatch({ type: "REPLACE_EDGES", payload: edges }),
|
|
35529
36158
|
[]
|
|
35530
36159
|
);
|
|
35531
|
-
const startConnecting =
|
|
36160
|
+
const startConnecting = useCallback52(
|
|
35532
36161
|
(nodeId, portId, portType) => dispatch({ type: "START_CONNECTING", payload: { nodeId, portId, portType } }),
|
|
35533
36162
|
[]
|
|
35534
36163
|
);
|
|
35535
|
-
const endConnecting =
|
|
35536
|
-
const selectNode =
|
|
36164
|
+
const endConnecting = useCallback52(() => dispatch({ type: "END_CONNECTING" }), []);
|
|
36165
|
+
const selectNode = useCallback52(
|
|
35537
36166
|
(id, multi = false) => {
|
|
35538
36167
|
if (multi) {
|
|
35539
36168
|
const current = workflow.canvas.selectedNodes;
|
|
@@ -35545,36 +36174,36 @@ function useWorkflow(options2 = {}) {
|
|
|
35545
36174
|
},
|
|
35546
36175
|
[workflow.canvas.selectedNodes]
|
|
35547
36176
|
);
|
|
35548
|
-
const selectNodes =
|
|
36177
|
+
const selectNodes = useCallback52(
|
|
35549
36178
|
(ids) => dispatch({ type: "SELECT_NODES", payload: ids }),
|
|
35550
36179
|
[]
|
|
35551
36180
|
);
|
|
35552
|
-
const selectEdge =
|
|
36181
|
+
const selectEdge = useCallback52(
|
|
35553
36182
|
(id) => dispatch({ type: "SELECT_EDGE", payload: id }),
|
|
35554
36183
|
[]
|
|
35555
36184
|
);
|
|
35556
|
-
const deselectAll =
|
|
35557
|
-
const zoomIn =
|
|
36185
|
+
const deselectAll = useCallback52(() => dispatch({ type: "DESELECT_ALL" }), []);
|
|
36186
|
+
const zoomIn = useCallback52(() => {
|
|
35558
36187
|
const z = Math.min(workflow.canvas.viewport.zoom * 1.2, 2);
|
|
35559
36188
|
dispatch({ type: "UPDATE_VIEWPORT", payload: { zoom: z } });
|
|
35560
36189
|
}, [workflow.canvas.viewport.zoom]);
|
|
35561
|
-
const zoomOut =
|
|
36190
|
+
const zoomOut = useCallback52(() => {
|
|
35562
36191
|
const z = Math.max(workflow.canvas.viewport.zoom / 1.2, 0.25);
|
|
35563
36192
|
dispatch({ type: "UPDATE_VIEWPORT", payload: { zoom: z } });
|
|
35564
36193
|
}, [workflow.canvas.viewport.zoom]);
|
|
35565
|
-
const resetViewport =
|
|
36194
|
+
const resetViewport = useCallback52(
|
|
35566
36195
|
() => dispatch({ type: "UPDATE_VIEWPORT", payload: { x: 0, y: 0, zoom: 1 } }),
|
|
35567
36196
|
[]
|
|
35568
36197
|
);
|
|
35569
|
-
const setViewport =
|
|
36198
|
+
const setViewport = useCallback52(
|
|
35570
36199
|
(viewport) => dispatch({ type: "UPDATE_VIEWPORT", payload: viewport }),
|
|
35571
36200
|
[]
|
|
35572
36201
|
);
|
|
35573
|
-
const undo =
|
|
35574
|
-
const redo =
|
|
36202
|
+
const undo = useCallback52(() => dispatch({ type: "UNDO" }), []);
|
|
36203
|
+
const redo = useCallback52(() => dispatch({ type: "REDO" }), []);
|
|
35575
36204
|
const canUndo = workflow.canvas.history.past.length > 0;
|
|
35576
36205
|
const canRedo = workflow.canvas.history.future.length > 0;
|
|
35577
|
-
const validate =
|
|
36206
|
+
const validate = useCallback52(() => workflow.validation, [workflow.validation]);
|
|
35578
36207
|
return {
|
|
35579
36208
|
workflow,
|
|
35580
36209
|
dispatch,
|
|
@@ -35607,7 +36236,7 @@ function useWorkflow(options2 = {}) {
|
|
|
35607
36236
|
}
|
|
35608
36237
|
|
|
35609
36238
|
// src/components/WorkflowEditor/WorkflowEditor.tsx
|
|
35610
|
-
import { jsx as
|
|
36239
|
+
import { jsx as jsx152, jsxs as jsxs146 } from "react/jsx-runtime";
|
|
35611
36240
|
var NODE_KIND_MAP = {
|
|
35612
36241
|
trigger: "trigger",
|
|
35613
36242
|
action: "action",
|
|
@@ -35652,7 +36281,7 @@ function WorkflowEditor({
|
|
|
35652
36281
|
drawer,
|
|
35653
36282
|
console: consoleSlot,
|
|
35654
36283
|
minimap,
|
|
35655
|
-
emptyState = /* @__PURE__ */
|
|
36284
|
+
emptyState = /* @__PURE__ */ jsx152(DefaultEmptyState, {}),
|
|
35656
36285
|
children,
|
|
35657
36286
|
background = "dots",
|
|
35658
36287
|
snapToGrid = true,
|
|
@@ -35680,35 +36309,35 @@ function WorkflowEditor({
|
|
|
35680
36309
|
}) {
|
|
35681
36310
|
const wf = useWorkflow(options2);
|
|
35682
36311
|
const { workflow, dispatch, canUndo, canRedo, undo, redo } = wf;
|
|
35683
|
-
const [uncontrolledLock, setUncontrolledLock] =
|
|
35684
|
-
const [uncontrolledDrawer, setUncontrolledDrawer] =
|
|
35685
|
-
const [uncontrolledHistory, setUncontrolledHistory] =
|
|
35686
|
-
const [uncontrolledDebug, setUncontrolledDebug] =
|
|
36312
|
+
const [uncontrolledLock, setUncontrolledLock] = useState73(false);
|
|
36313
|
+
const [uncontrolledDrawer, setUncontrolledDrawer] = useState73(!!drawer);
|
|
36314
|
+
const [uncontrolledHistory, setUncontrolledHistory] = useState73(false);
|
|
36315
|
+
const [uncontrolledDebug, setUncontrolledDebug] = useState73(false);
|
|
35687
36316
|
const isLockMode = controlledLockMode ?? uncontrolledLock;
|
|
35688
36317
|
const isDrawerOpen = controlledDrawerOpen ?? uncontrolledDrawer;
|
|
35689
36318
|
const isHistoryOpen = controlledHistoryOpen ?? uncontrolledHistory;
|
|
35690
36319
|
const isDebugOpen = controlledDebugOpen ?? uncontrolledDebug;
|
|
35691
|
-
const toggleLock =
|
|
36320
|
+
const toggleLock = useCallback53(() => {
|
|
35692
36321
|
const next = !isLockMode;
|
|
35693
36322
|
if (controlledLockMode === void 0) setUncontrolledLock(next);
|
|
35694
36323
|
onToggleLockMode?.(next);
|
|
35695
36324
|
}, [isLockMode, controlledLockMode, onToggleLockMode]);
|
|
35696
|
-
const toggleDrawer =
|
|
36325
|
+
const toggleDrawer = useCallback53(() => {
|
|
35697
36326
|
const next = !isDrawerOpen;
|
|
35698
36327
|
if (controlledDrawerOpen === void 0) setUncontrolledDrawer(next);
|
|
35699
36328
|
onToggleDrawer?.(next);
|
|
35700
36329
|
}, [isDrawerOpen, controlledDrawerOpen, onToggleDrawer]);
|
|
35701
|
-
const toggleHistory =
|
|
36330
|
+
const toggleHistory = useCallback53(() => {
|
|
35702
36331
|
const next = !isHistoryOpen;
|
|
35703
36332
|
if (controlledHistoryOpen === void 0) setUncontrolledHistory(next);
|
|
35704
36333
|
onToggleHistory?.(next);
|
|
35705
36334
|
}, [isHistoryOpen, controlledHistoryOpen, onToggleHistory]);
|
|
35706
|
-
const toggleDebug =
|
|
36335
|
+
const toggleDebug = useCallback53(() => {
|
|
35707
36336
|
const next = !isDebugOpen;
|
|
35708
36337
|
if (controlledDebugOpen === void 0) setUncontrolledDebug(next);
|
|
35709
36338
|
onToggleDebug?.(next);
|
|
35710
36339
|
}, [isDebugOpen, controlledDebugOpen, onToggleDebug]);
|
|
35711
|
-
const handleReset =
|
|
36340
|
+
const handleReset = useCallback53(() => {
|
|
35712
36341
|
if (onReset) onReset();
|
|
35713
36342
|
else dispatch({ type: "RESET" });
|
|
35714
36343
|
}, [onReset, dispatch]);
|
|
@@ -35717,7 +36346,7 @@ function WorkflowEditor({
|
|
|
35717
36346
|
[workflow.canvas.nodes]
|
|
35718
36347
|
);
|
|
35719
36348
|
const nextEdges = useMemo39(() => workflow.canvas.edges.map(toNextEdge), [workflow.canvas.edges]);
|
|
35720
|
-
const onNodesChange =
|
|
36349
|
+
const onNodesChange = useCallback53(
|
|
35721
36350
|
(changes) => {
|
|
35722
36351
|
const reduced = applyNodeChanges(
|
|
35723
36352
|
nextNodes,
|
|
@@ -35758,7 +36387,7 @@ function WorkflowEditor({
|
|
|
35758
36387
|
},
|
|
35759
36388
|
[nextNodes, workflow.canvas.nodes, wf, onNodeSelect]
|
|
35760
36389
|
);
|
|
35761
|
-
const onEdgesChange =
|
|
36390
|
+
const onEdgesChange = useCallback53(
|
|
35762
36391
|
(changes) => {
|
|
35763
36392
|
const reduced = applyEdgeChanges(nextEdges, changes);
|
|
35764
36393
|
const byId = new Map(reduced.map((e) => [e.id, e]));
|
|
@@ -35768,18 +36397,18 @@ function WorkflowEditor({
|
|
|
35768
36397
|
},
|
|
35769
36398
|
[nextEdges, workflow.canvas.edges, wf]
|
|
35770
36399
|
);
|
|
35771
|
-
const onConnect =
|
|
36400
|
+
const onConnect = useCallback53(
|
|
35772
36401
|
(c) => {
|
|
35773
36402
|
wf.createEdge(c.source, c.sourceHandle ?? "default", c.target, c.targetHandle ?? "default");
|
|
35774
36403
|
},
|
|
35775
36404
|
[wf]
|
|
35776
36405
|
);
|
|
35777
|
-
const [canvasSize, setCanvasSize] =
|
|
35778
|
-
const handleCanvasRef =
|
|
36406
|
+
const [canvasSize, setCanvasSize] = useState73({ w: 0, h: 0 });
|
|
36407
|
+
const handleCanvasRef = useCallback53((node) => {
|
|
35779
36408
|
if (!node) return;
|
|
35780
36409
|
setCanvasSize({ w: node.clientWidth, h: node.clientHeight });
|
|
35781
36410
|
}, []);
|
|
35782
|
-
const fitToView =
|
|
36411
|
+
const fitToView = useCallback53(() => {
|
|
35783
36412
|
const nodes = workflow.canvas.nodes;
|
|
35784
36413
|
if (nodes.length === 0) return;
|
|
35785
36414
|
let minX = Infinity;
|
|
@@ -35808,8 +36437,8 @@ function WorkflowEditor({
|
|
|
35808
36437
|
wf.setViewport({ x: cw / 2 - cx * zoom, y: ch / 2 - cy * zoom, zoom });
|
|
35809
36438
|
}, [workflow.canvas.nodes, canvasSize, wf]);
|
|
35810
36439
|
const defaultToolbar = useMemo39(
|
|
35811
|
-
() => /* @__PURE__ */
|
|
35812
|
-
onSave && /* @__PURE__ */
|
|
36440
|
+
() => /* @__PURE__ */ jsxs146(FlowToolbar, { placement: "left", children: [
|
|
36441
|
+
onSave && /* @__PURE__ */ jsx152(
|
|
35813
36442
|
FlowToolbarButton,
|
|
35814
36443
|
{
|
|
35815
36444
|
icon: FlowToolbarIcons.save,
|
|
@@ -35818,7 +36447,7 @@ function WorkflowEditor({
|
|
|
35818
36447
|
onClick: () => onSave(workflow)
|
|
35819
36448
|
}
|
|
35820
36449
|
),
|
|
35821
|
-
onRun && /* @__PURE__ */
|
|
36450
|
+
onRun && /* @__PURE__ */ jsx152(
|
|
35822
36451
|
FlowToolbarButton,
|
|
35823
36452
|
{
|
|
35824
36453
|
icon: isExecuting ? FlowToolbarIcons.stop : FlowToolbarIcons.run,
|
|
@@ -35829,7 +36458,7 @@ function WorkflowEditor({
|
|
|
35829
36458
|
onClick: isExecuting ? onStop : onRun
|
|
35830
36459
|
}
|
|
35831
36460
|
),
|
|
35832
|
-
/* @__PURE__ */
|
|
36461
|
+
/* @__PURE__ */ jsx152(
|
|
35833
36462
|
FlowToolbarButton,
|
|
35834
36463
|
{
|
|
35835
36464
|
icon: isLockMode ? FlowToolbarIcons.lock : FlowToolbarIcons.unlock,
|
|
@@ -35839,7 +36468,7 @@ function WorkflowEditor({
|
|
|
35839
36468
|
onClick: toggleLock
|
|
35840
36469
|
}
|
|
35841
36470
|
),
|
|
35842
|
-
/* @__PURE__ */
|
|
36471
|
+
/* @__PURE__ */ jsx152(
|
|
35843
36472
|
FlowToolbarButton,
|
|
35844
36473
|
{
|
|
35845
36474
|
icon: FlowToolbarIcons.reset,
|
|
@@ -35847,7 +36476,7 @@ function WorkflowEditor({
|
|
|
35847
36476
|
onClick: handleReset
|
|
35848
36477
|
}
|
|
35849
36478
|
),
|
|
35850
|
-
drawer && /* @__PURE__ */
|
|
36479
|
+
drawer && /* @__PURE__ */ jsx152(
|
|
35851
36480
|
FlowToolbarButton,
|
|
35852
36481
|
{
|
|
35853
36482
|
icon: isDrawerOpen ? FlowToolbarIcons.drawerClose : FlowToolbarIcons.drawerOpen,
|
|
@@ -35856,8 +36485,8 @@ function WorkflowEditor({
|
|
|
35856
36485
|
onClick: toggleDrawer
|
|
35857
36486
|
}
|
|
35858
36487
|
),
|
|
35859
|
-
/* @__PURE__ */
|
|
35860
|
-
onSettings && /* @__PURE__ */
|
|
36488
|
+
/* @__PURE__ */ jsx152(FlowToolbarDivider, {}),
|
|
36489
|
+
onSettings && /* @__PURE__ */ jsx152(
|
|
35861
36490
|
FlowToolbarButton,
|
|
35862
36491
|
{
|
|
35863
36492
|
icon: FlowToolbarIcons.settings,
|
|
@@ -35865,7 +36494,7 @@ function WorkflowEditor({
|
|
|
35865
36494
|
onClick: onSettings
|
|
35866
36495
|
}
|
|
35867
36496
|
),
|
|
35868
|
-
/* @__PURE__ */
|
|
36497
|
+
/* @__PURE__ */ jsx152(
|
|
35869
36498
|
FlowToolbarButton,
|
|
35870
36499
|
{
|
|
35871
36500
|
icon: FlowToolbarIcons.history,
|
|
@@ -35874,7 +36503,7 @@ function WorkflowEditor({
|
|
|
35874
36503
|
onClick: toggleHistory
|
|
35875
36504
|
}
|
|
35876
36505
|
),
|
|
35877
|
-
isDebugModeEnabled && /* @__PURE__ */
|
|
36506
|
+
isDebugModeEnabled && /* @__PURE__ */ jsx152(
|
|
35878
36507
|
FlowToolbarButton,
|
|
35879
36508
|
{
|
|
35880
36509
|
icon: FlowToolbarIcons.debug,
|
|
@@ -35883,8 +36512,8 @@ function WorkflowEditor({
|
|
|
35883
36512
|
onClick: toggleDebug
|
|
35884
36513
|
}
|
|
35885
36514
|
),
|
|
35886
|
-
/* @__PURE__ */
|
|
35887
|
-
/* @__PURE__ */
|
|
36515
|
+
/* @__PURE__ */ jsx152(FlowToolbarDivider, {}),
|
|
36516
|
+
/* @__PURE__ */ jsx152(
|
|
35888
36517
|
FlowToolbarButton,
|
|
35889
36518
|
{
|
|
35890
36519
|
icon: FlowToolbarIcons.undo,
|
|
@@ -35894,7 +36523,7 @@ function WorkflowEditor({
|
|
|
35894
36523
|
onClick: undo
|
|
35895
36524
|
}
|
|
35896
36525
|
),
|
|
35897
|
-
/* @__PURE__ */
|
|
36526
|
+
/* @__PURE__ */ jsx152(
|
|
35898
36527
|
FlowToolbarButton,
|
|
35899
36528
|
{
|
|
35900
36529
|
icon: FlowToolbarIcons.redo,
|
|
@@ -35904,8 +36533,8 @@ function WorkflowEditor({
|
|
|
35904
36533
|
onClick: redo
|
|
35905
36534
|
}
|
|
35906
36535
|
),
|
|
35907
|
-
/* @__PURE__ */
|
|
35908
|
-
/* @__PURE__ */
|
|
36536
|
+
/* @__PURE__ */ jsx152(FlowToolbarDivider, {}),
|
|
36537
|
+
/* @__PURE__ */ jsx152(
|
|
35909
36538
|
FlowToolbarZoom,
|
|
35910
36539
|
{
|
|
35911
36540
|
zoom: workflow.canvas.viewport.zoom,
|
|
@@ -35944,21 +36573,21 @@ function WorkflowEditor({
|
|
|
35944
36573
|
);
|
|
35945
36574
|
const resolvedToolbar = toolbar === "default" ? defaultToolbar : toolbar === null ? null : toolbar;
|
|
35946
36575
|
const isEmpty = workflow.canvas.nodes.length === 0 && workflow.canvas.edges.length === 0;
|
|
35947
|
-
return /* @__PURE__ */
|
|
36576
|
+
return /* @__PURE__ */ jsxs146(
|
|
35948
36577
|
"div",
|
|
35949
36578
|
{
|
|
35950
36579
|
className: cn("ods-workflow-editor", className),
|
|
35951
36580
|
style: { width, height, position: "relative", display: "flex", overflow: "hidden" },
|
|
35952
36581
|
children: [
|
|
35953
|
-
drawer && isDrawerOpen && /* @__PURE__ */
|
|
35954
|
-
/* @__PURE__ */
|
|
36582
|
+
drawer && isDrawerOpen && /* @__PURE__ */ jsx152("div", { className: "ods-workflow-editor__drawer", children: drawer }),
|
|
36583
|
+
/* @__PURE__ */ jsxs146(
|
|
35955
36584
|
"div",
|
|
35956
36585
|
{
|
|
35957
36586
|
ref: handleCanvasRef,
|
|
35958
36587
|
className: "ods-workflow-editor__canvas-wrapper",
|
|
35959
36588
|
style: { position: "relative", flex: 1, minWidth: 0 },
|
|
35960
36589
|
children: [
|
|
35961
|
-
/* @__PURE__ */
|
|
36590
|
+
/* @__PURE__ */ jsx152(
|
|
35962
36591
|
FlowCanvas,
|
|
35963
36592
|
{
|
|
35964
36593
|
nodes: nextNodes,
|
|
@@ -35972,9 +36601,9 @@ function WorkflowEditor({
|
|
|
35972
36601
|
children: resolvedToolbar
|
|
35973
36602
|
}
|
|
35974
36603
|
),
|
|
35975
|
-
minimap && /* @__PURE__ */
|
|
35976
|
-
consoleSlot && /* @__PURE__ */
|
|
35977
|
-
isEmpty && emptyState && /* @__PURE__ */
|
|
36604
|
+
minimap && /* @__PURE__ */ jsx152("div", { className: "ods-workflow-editor__minimap", children: minimap }),
|
|
36605
|
+
consoleSlot && /* @__PURE__ */ jsx152("div", { className: "ods-workflow-editor__console", children: consoleSlot }),
|
|
36606
|
+
isEmpty && emptyState && /* @__PURE__ */ jsx152("div", { className: "ods-workflow-editor__empty", children: emptyState }),
|
|
35978
36607
|
children
|
|
35979
36608
|
]
|
|
35980
36609
|
}
|
|
@@ -35984,7 +36613,7 @@ function WorkflowEditor({
|
|
|
35984
36613
|
);
|
|
35985
36614
|
}
|
|
35986
36615
|
function DefaultEmptyState() {
|
|
35987
|
-
return /* @__PURE__ */
|
|
36616
|
+
return /* @__PURE__ */ jsxs146(
|
|
35988
36617
|
"div",
|
|
35989
36618
|
{
|
|
35990
36619
|
style: {
|
|
@@ -35999,14 +36628,14 @@ function DefaultEmptyState() {
|
|
|
35999
36628
|
pointerEvents: "none"
|
|
36000
36629
|
},
|
|
36001
36630
|
children: [
|
|
36002
|
-
/* @__PURE__ */
|
|
36631
|
+
/* @__PURE__ */ jsx152(
|
|
36003
36632
|
"div",
|
|
36004
36633
|
{
|
|
36005
36634
|
style: { fontSize: 14, fontWeight: 600, color: "var(--ods-text-primary)", marginBottom: 4 },
|
|
36006
36635
|
children: "Start with a trigger"
|
|
36007
36636
|
}
|
|
36008
36637
|
),
|
|
36009
|
-
/* @__PURE__ */
|
|
36638
|
+
/* @__PURE__ */ jsx152("div", { style: { fontSize: 12 }, children: "Drop an action here, or use the drawer to add your first node." })
|
|
36010
36639
|
]
|
|
36011
36640
|
}
|
|
36012
36641
|
);
|
|
@@ -36024,7 +36653,7 @@ import {
|
|
|
36024
36653
|
} from "@octaviaflow/icons";
|
|
36025
36654
|
|
|
36026
36655
|
// src/hooks/useWorkflowRuntime.ts
|
|
36027
|
-
import { useEffect as
|
|
36656
|
+
import { useEffect as useEffect57, useState as useState74 } from "react";
|
|
36028
36657
|
function toMs2(t) {
|
|
36029
36658
|
if (t == null) return null;
|
|
36030
36659
|
return typeof t === "number" ? t : t.getTime();
|
|
@@ -36038,8 +36667,8 @@ function formatWorkflowRuntime(ms) {
|
|
|
36038
36667
|
return h > 0 ? `${h}:${pad2(m)}:${pad2(sec)}` : `${pad2(m)}:${pad2(sec)}`;
|
|
36039
36668
|
}
|
|
36040
36669
|
function useWorkflowRuntime(startedAt, active) {
|
|
36041
|
-
const [, force] =
|
|
36042
|
-
|
|
36670
|
+
const [, force] = useState74(0);
|
|
36671
|
+
useEffect57(() => {
|
|
36043
36672
|
if (!active || startedAt == null) return;
|
|
36044
36673
|
if (typeof window === "undefined") return;
|
|
36045
36674
|
const id = window.setInterval(() => force((n) => n + 1), 1e3);
|
|
@@ -36051,7 +36680,7 @@ function useWorkflowRuntime(startedAt, active) {
|
|
|
36051
36680
|
}
|
|
36052
36681
|
|
|
36053
36682
|
// src/components/WorkflowHeader/WorkflowHeader.tsx
|
|
36054
|
-
import { Fragment as Fragment63, jsx as
|
|
36683
|
+
import { Fragment as Fragment63, jsx as jsx153, jsxs as jsxs147 } from "react/jsx-runtime";
|
|
36055
36684
|
function WorkflowHeader({
|
|
36056
36685
|
name,
|
|
36057
36686
|
statusTone,
|
|
@@ -36090,21 +36719,21 @@ function WorkflowHeader({
|
|
|
36090
36719
|
})();
|
|
36091
36720
|
const rootCls = cn("ods-workflow-header", `ods-workflow-header--${size}`, className);
|
|
36092
36721
|
if (loading) {
|
|
36093
|
-
return /* @__PURE__ */
|
|
36094
|
-
/* @__PURE__ */
|
|
36095
|
-
/* @__PURE__ */
|
|
36096
|
-
/* @__PURE__ */
|
|
36722
|
+
return /* @__PURE__ */ jsxs147("header", { className: rootCls, "data-loading": "true", children: [
|
|
36723
|
+
/* @__PURE__ */ jsxs147("div", { className: "ods-workflow-header__left", children: [
|
|
36724
|
+
/* @__PURE__ */ jsx153(Skeleton, { variant: "text", width: "120px" }),
|
|
36725
|
+
/* @__PURE__ */ jsx153(Skeleton, { variant: "text", width: "180px" })
|
|
36097
36726
|
] }),
|
|
36098
|
-
/* @__PURE__ */
|
|
36099
|
-
/* @__PURE__ */
|
|
36100
|
-
/* @__PURE__ */
|
|
36727
|
+
/* @__PURE__ */ jsxs147("div", { className: "ods-workflow-header__right", children: [
|
|
36728
|
+
/* @__PURE__ */ jsx153(Skeleton, { variant: "circular", width: "28px", height: "28px" }),
|
|
36729
|
+
/* @__PURE__ */ jsx153(Skeleton, { variant: "circular", width: "28px", height: "28px" })
|
|
36101
36730
|
] })
|
|
36102
36731
|
] });
|
|
36103
36732
|
}
|
|
36104
36733
|
const envAccentStyle = environment?.accent ? { borderLeftColor: environment.accent } : void 0;
|
|
36105
|
-
return /* @__PURE__ */
|
|
36106
|
-
/* @__PURE__ */
|
|
36107
|
-
onBack && /* @__PURE__ */
|
|
36734
|
+
return /* @__PURE__ */ jsxs147("header", { className: rootCls, "data-running": isRunning ? "true" : void 0, children: [
|
|
36735
|
+
/* @__PURE__ */ jsxs147("div", { className: "ods-workflow-header__left", children: [
|
|
36736
|
+
onBack && /* @__PURE__ */ jsxs147(
|
|
36108
36737
|
"button",
|
|
36109
36738
|
{
|
|
36110
36739
|
type: "button",
|
|
@@ -36112,13 +36741,13 @@ function WorkflowHeader({
|
|
|
36112
36741
|
onClick: onBack,
|
|
36113
36742
|
"aria-label": `Back to ${typeof parentLabel === "string" ? parentLabel : "previous"}`,
|
|
36114
36743
|
children: [
|
|
36115
|
-
/* @__PURE__ */
|
|
36116
|
-
/* @__PURE__ */
|
|
36117
|
-
/* @__PURE__ */
|
|
36744
|
+
/* @__PURE__ */ jsx153(ChevronLeftIcon3, { size: "sm" }),
|
|
36745
|
+
/* @__PURE__ */ jsx153("span", { className: "ods-workflow-header__back-label", children: parentLabel }),
|
|
36746
|
+
/* @__PURE__ */ jsx153("span", { className: "ods-workflow-header__back-separator", "aria-hidden": "true", children: "/" })
|
|
36118
36747
|
]
|
|
36119
36748
|
}
|
|
36120
36749
|
),
|
|
36121
|
-
/* @__PURE__ */
|
|
36750
|
+
/* @__PURE__ */ jsx153(
|
|
36122
36751
|
"span",
|
|
36123
36752
|
{
|
|
36124
36753
|
className: cn(
|
|
@@ -36129,7 +36758,7 @@ function WorkflowHeader({
|
|
|
36129
36758
|
role: "img"
|
|
36130
36759
|
}
|
|
36131
36760
|
),
|
|
36132
|
-
/* @__PURE__ */
|
|
36761
|
+
/* @__PURE__ */ jsx153(
|
|
36133
36762
|
"h1",
|
|
36134
36763
|
{
|
|
36135
36764
|
className: "ods-workflow-header__title",
|
|
@@ -36137,9 +36766,9 @@ function WorkflowHeader({
|
|
|
36137
36766
|
children: name
|
|
36138
36767
|
}
|
|
36139
36768
|
),
|
|
36140
|
-
saveIndicator && /* @__PURE__ */
|
|
36141
|
-
/* @__PURE__ */
|
|
36142
|
-
/* @__PURE__ */
|
|
36769
|
+
saveIndicator && /* @__PURE__ */ jsxs147(Fragment63, { children: [
|
|
36770
|
+
/* @__PURE__ */ jsx153("span", { className: "ods-workflow-header__sep", "aria-hidden": "true" }),
|
|
36771
|
+
/* @__PURE__ */ jsxs147(
|
|
36143
36772
|
"span",
|
|
36144
36773
|
{
|
|
36145
36774
|
className: cn(
|
|
@@ -36150,14 +36779,14 @@ function WorkflowHeader({
|
|
|
36150
36779
|
"aria-live": "polite",
|
|
36151
36780
|
title: saveState === "error" ? saveError ?? void 0 : void 0,
|
|
36152
36781
|
children: [
|
|
36153
|
-
saveState === "saving" ? /* @__PURE__ */
|
|
36782
|
+
saveState === "saving" ? /* @__PURE__ */ jsx153("span", { className: "ods-workflow-header__save-spinner", "aria-hidden": "true" }) : saveState === "error" ? /* @__PURE__ */ jsx153(
|
|
36154
36783
|
WarningAltIcon3,
|
|
36155
36784
|
{
|
|
36156
36785
|
size: "sm",
|
|
36157
36786
|
className: "ods-workflow-header__save-icon",
|
|
36158
36787
|
"aria-hidden": "true"
|
|
36159
36788
|
}
|
|
36160
|
-
) : /* @__PURE__ */
|
|
36789
|
+
) : /* @__PURE__ */ jsx153(
|
|
36161
36790
|
CheckmarkIcon15,
|
|
36162
36791
|
{
|
|
36163
36792
|
size: "sm",
|
|
@@ -36172,11 +36801,11 @@ function WorkflowHeader({
|
|
|
36172
36801
|
] }),
|
|
36173
36802
|
leftSlot
|
|
36174
36803
|
] }),
|
|
36175
|
-
/* @__PURE__ */
|
|
36804
|
+
/* @__PURE__ */ jsxs147("div", { className: "ods-workflow-header__right", children: [
|
|
36176
36805
|
rightSlot,
|
|
36177
36806
|
environment && // Consumer-driven env chip. Accent (left border colour) comes
|
|
36178
36807
|
// from the consumer — we don't bake in environment names.
|
|
36179
|
-
/* @__PURE__ */
|
|
36808
|
+
/* @__PURE__ */ jsx153(
|
|
36180
36809
|
Chip,
|
|
36181
36810
|
{
|
|
36182
36811
|
size: "sm",
|
|
@@ -36192,59 +36821,59 @@ function WorkflowHeader({
|
|
|
36192
36821
|
children: environment.label
|
|
36193
36822
|
}
|
|
36194
36823
|
),
|
|
36195
|
-
onToggleConsole && (isRunning || consoleHasLogs) && /* @__PURE__ */
|
|
36824
|
+
onToggleConsole && (isRunning || consoleHasLogs) && /* @__PURE__ */ jsx153(
|
|
36196
36825
|
Button,
|
|
36197
36826
|
{
|
|
36198
36827
|
variant: "ghost",
|
|
36199
36828
|
size: "sm",
|
|
36200
36829
|
pressed: !!isConsoleOpen,
|
|
36201
36830
|
"aria-label": isConsoleOpen ? "Hide execution console" : "Show execution console",
|
|
36202
|
-
leftIcon: /* @__PURE__ */
|
|
36831
|
+
leftIcon: /* @__PURE__ */ jsx153(TerminalIcon, { size: "sm" }),
|
|
36203
36832
|
onClick: onToggleConsole,
|
|
36204
36833
|
children: "Console"
|
|
36205
36834
|
}
|
|
36206
36835
|
),
|
|
36207
|
-
(environment || onToggleConsole && (isRunning || consoleHasLogs)) && (isRunning || onRun || menuItems && menuItems.length > 0) && /* @__PURE__ */
|
|
36208
|
-
isRunning ? onStop && /* @__PURE__ */
|
|
36836
|
+
(environment || onToggleConsole && (isRunning || consoleHasLogs)) && (isRunning || onRun || menuItems && menuItems.length > 0) && /* @__PURE__ */ jsx153("span", { className: "ods-workflow-header__micro-divider", "aria-hidden": "true" }),
|
|
36837
|
+
isRunning ? onStop && /* @__PURE__ */ jsx153(
|
|
36209
36838
|
Button,
|
|
36210
36839
|
{
|
|
36211
36840
|
variant: "ghost",
|
|
36212
36841
|
size: "sm",
|
|
36213
36842
|
"aria-label": runtime ? `Stop execution (running ${runtime})` : "Stop execution",
|
|
36214
|
-
leftIcon: /* @__PURE__ */
|
|
36843
|
+
leftIcon: /* @__PURE__ */ jsx153(StopFilledAltIcon2, { size: "sm", className: "ods-workflow-header__stop-glyph" }),
|
|
36215
36844
|
onClick: onStop,
|
|
36216
|
-
children: /* @__PURE__ */
|
|
36217
|
-
/* @__PURE__ */
|
|
36218
|
-
runtime && /* @__PURE__ */
|
|
36219
|
-
/* @__PURE__ */
|
|
36220
|
-
/* @__PURE__ */
|
|
36845
|
+
children: /* @__PURE__ */ jsxs147("span", { className: "ods-workflow-header__stop-label", children: [
|
|
36846
|
+
/* @__PURE__ */ jsx153("span", { children: "Stop" }),
|
|
36847
|
+
runtime && /* @__PURE__ */ jsxs147(Fragment63, { children: [
|
|
36848
|
+
/* @__PURE__ */ jsx153("span", { className: "ods-workflow-header__stop-dot", "aria-hidden": "true", children: "\xB7" }),
|
|
36849
|
+
/* @__PURE__ */ jsx153("span", { className: "ods-workflow-header__runtime", children: runtime })
|
|
36221
36850
|
] })
|
|
36222
36851
|
] })
|
|
36223
36852
|
}
|
|
36224
|
-
) : onRun && /* @__PURE__ */
|
|
36853
|
+
) : onRun && /* @__PURE__ */ jsx153(
|
|
36225
36854
|
Button,
|
|
36226
36855
|
{
|
|
36227
36856
|
variant: "primary",
|
|
36228
36857
|
size: "sm",
|
|
36229
36858
|
"aria-label": "Run workflow",
|
|
36230
|
-
leftIcon: /* @__PURE__ */
|
|
36859
|
+
leftIcon: /* @__PURE__ */ jsx153(PlayFilledAltIcon2, { size: "sm" }),
|
|
36231
36860
|
onClick: onRun,
|
|
36232
36861
|
children: "Run"
|
|
36233
36862
|
}
|
|
36234
36863
|
),
|
|
36235
|
-
menu ?? (menuItems && menuItems.length > 0 && /* @__PURE__ */
|
|
36864
|
+
menu ?? (menuItems && menuItems.length > 0 && /* @__PURE__ */ jsx153(
|
|
36236
36865
|
DropdownMenu,
|
|
36237
36866
|
{
|
|
36238
36867
|
"aria-label": menuLabel,
|
|
36239
36868
|
align: "end",
|
|
36240
36869
|
triggerClassName: "ods-workflow-header__menu-trigger",
|
|
36241
36870
|
...menuProps,
|
|
36242
|
-
trigger: menuTrigger ?? /* @__PURE__ */
|
|
36871
|
+
trigger: menuTrigger ?? /* @__PURE__ */ jsx153("span", { "aria-hidden": "true", className: "ods-workflow-header__menu-icon", children: /* @__PURE__ */ jsx153(OverflowMenuVerticalIcon, { size: "sm" }) }),
|
|
36243
36872
|
items: menuItems
|
|
36244
36873
|
}
|
|
36245
36874
|
))
|
|
36246
36875
|
] }),
|
|
36247
|
-
/* @__PURE__ */
|
|
36876
|
+
/* @__PURE__ */ jsx153("span", { className: "ods-workflow-header__progress", "aria-hidden": "true" })
|
|
36248
36877
|
] });
|
|
36249
36878
|
}
|
|
36250
36879
|
|
|
@@ -36256,7 +36885,7 @@ import {
|
|
|
36256
36885
|
StopFilledAltIcon as StopFilledAltIcon3,
|
|
36257
36886
|
TerminalIcon as TerminalIcon2
|
|
36258
36887
|
} from "@octaviaflow/icons";
|
|
36259
|
-
import { Fragment as Fragment64, jsx as
|
|
36888
|
+
import { Fragment as Fragment64, jsx as jsx154, jsxs as jsxs148 } from "react/jsx-runtime";
|
|
36260
36889
|
function WorkflowHeaderExpanded({
|
|
36261
36890
|
name,
|
|
36262
36891
|
statusTone = "draft",
|
|
@@ -36284,15 +36913,15 @@ function WorkflowHeaderExpanded({
|
|
|
36284
36913
|
const tickedRuntime = useWorkflowRuntime(runStartedAt, !!isRunning);
|
|
36285
36914
|
const runtime = runtimeOverride ?? tickedRuntime ?? void 0;
|
|
36286
36915
|
const effectiveTone = statusTone === "draft" && isRunning ? "running" : statusTone;
|
|
36287
|
-
return /* @__PURE__ */
|
|
36916
|
+
return /* @__PURE__ */ jsxs148(
|
|
36288
36917
|
"header",
|
|
36289
36918
|
{
|
|
36290
36919
|
className: cn("ods-workflow-header-expanded", className),
|
|
36291
36920
|
"data-running": isRunning ? "true" : void 0,
|
|
36292
36921
|
children: [
|
|
36293
|
-
/* @__PURE__ */
|
|
36294
|
-
/* @__PURE__ */
|
|
36295
|
-
onBack && /* @__PURE__ */
|
|
36922
|
+
/* @__PURE__ */ jsxs148("div", { className: "ods-workflow-header-expanded__row ods-workflow-header-expanded__row--top", children: [
|
|
36923
|
+
/* @__PURE__ */ jsxs148("div", { className: "ods-workflow-header-expanded__left", children: [
|
|
36924
|
+
onBack && /* @__PURE__ */ jsxs148(
|
|
36296
36925
|
"button",
|
|
36297
36926
|
{
|
|
36298
36927
|
type: "button",
|
|
@@ -36300,13 +36929,13 @@ function WorkflowHeaderExpanded({
|
|
|
36300
36929
|
onClick: onBack,
|
|
36301
36930
|
"aria-label": `Back to ${typeof parentLabel === "string" ? parentLabel : "previous"}`,
|
|
36302
36931
|
children: [
|
|
36303
|
-
/* @__PURE__ */
|
|
36304
|
-
/* @__PURE__ */
|
|
36305
|
-
/* @__PURE__ */
|
|
36932
|
+
/* @__PURE__ */ jsx154(ChevronLeftIcon4, { size: "sm" }),
|
|
36933
|
+
/* @__PURE__ */ jsx154("span", { children: parentLabel }),
|
|
36934
|
+
/* @__PURE__ */ jsx154("span", { "aria-hidden": "true", className: "ods-workflow-header-expanded__back-sep", children: "/" })
|
|
36306
36935
|
]
|
|
36307
36936
|
}
|
|
36308
36937
|
),
|
|
36309
|
-
/* @__PURE__ */
|
|
36938
|
+
/* @__PURE__ */ jsx154(
|
|
36310
36939
|
"span",
|
|
36311
36940
|
{
|
|
36312
36941
|
className: cn(
|
|
@@ -36317,10 +36946,10 @@ function WorkflowHeaderExpanded({
|
|
|
36317
36946
|
role: "img"
|
|
36318
36947
|
}
|
|
36319
36948
|
),
|
|
36320
|
-
/* @__PURE__ */
|
|
36949
|
+
/* @__PURE__ */ jsx154("h1", { className: "ods-workflow-header-expanded__title", children: name })
|
|
36321
36950
|
] }),
|
|
36322
|
-
/* @__PURE__ */
|
|
36323
|
-
environment && /* @__PURE__ */
|
|
36951
|
+
/* @__PURE__ */ jsxs148("div", { className: "ods-workflow-header-expanded__right", children: [
|
|
36952
|
+
environment && /* @__PURE__ */ jsx154(
|
|
36324
36953
|
Chip,
|
|
36325
36954
|
{
|
|
36326
36955
|
size: "sm",
|
|
@@ -36332,26 +36961,26 @@ function WorkflowHeaderExpanded({
|
|
|
36332
36961
|
children: environment.label
|
|
36333
36962
|
}
|
|
36334
36963
|
),
|
|
36335
|
-
onToggleConsole && (isRunning || consoleHasLogs) && /* @__PURE__ */
|
|
36964
|
+
onToggleConsole && (isRunning || consoleHasLogs) && /* @__PURE__ */ jsx154(
|
|
36336
36965
|
Button,
|
|
36337
36966
|
{
|
|
36338
36967
|
variant: "ghost",
|
|
36339
36968
|
size: "sm",
|
|
36340
36969
|
pressed: !!isConsoleOpen,
|
|
36341
36970
|
"aria-label": isConsoleOpen ? "Hide execution console" : "Show execution console",
|
|
36342
|
-
leftIcon: /* @__PURE__ */
|
|
36971
|
+
leftIcon: /* @__PURE__ */ jsx154(TerminalIcon2, { size: "sm" }),
|
|
36343
36972
|
onClick: onToggleConsole,
|
|
36344
36973
|
children: "Console"
|
|
36345
36974
|
}
|
|
36346
36975
|
),
|
|
36347
|
-
(environment || onToggleConsole && (isRunning || consoleHasLogs)) && (isRunning || onRun || menuItems && menuItems.length > 0) && /* @__PURE__ */
|
|
36348
|
-
isRunning ? onStop && /* @__PURE__ */
|
|
36976
|
+
(environment || onToggleConsole && (isRunning || consoleHasLogs)) && (isRunning || onRun || menuItems && menuItems.length > 0) && /* @__PURE__ */ jsx154("span", { className: "ods-workflow-header-expanded__micro-divider", "aria-hidden": "true" }),
|
|
36977
|
+
isRunning ? onStop && /* @__PURE__ */ jsx154(
|
|
36349
36978
|
Button,
|
|
36350
36979
|
{
|
|
36351
36980
|
variant: "ghost",
|
|
36352
36981
|
size: "sm",
|
|
36353
36982
|
"aria-label": runtime ? `Stop execution (running ${runtime})` : "Stop execution",
|
|
36354
|
-
leftIcon: /* @__PURE__ */
|
|
36983
|
+
leftIcon: /* @__PURE__ */ jsx154(
|
|
36355
36984
|
StopFilledAltIcon3,
|
|
36356
36985
|
{
|
|
36357
36986
|
size: "sm",
|
|
@@ -36359,37 +36988,37 @@ function WorkflowHeaderExpanded({
|
|
|
36359
36988
|
}
|
|
36360
36989
|
),
|
|
36361
36990
|
onClick: onStop,
|
|
36362
|
-
children: /* @__PURE__ */
|
|
36363
|
-
/* @__PURE__ */
|
|
36364
|
-
runtime && /* @__PURE__ */
|
|
36365
|
-
/* @__PURE__ */
|
|
36366
|
-
/* @__PURE__ */
|
|
36991
|
+
children: /* @__PURE__ */ jsxs148("span", { style: { display: "inline-flex", gap: 4, alignItems: "center" }, children: [
|
|
36992
|
+
/* @__PURE__ */ jsx154("span", { children: "Stop" }),
|
|
36993
|
+
runtime && /* @__PURE__ */ jsxs148(Fragment64, { children: [
|
|
36994
|
+
/* @__PURE__ */ jsx154("span", { "aria-hidden": "true", style: { opacity: 0.6 }, children: "\xB7" }),
|
|
36995
|
+
/* @__PURE__ */ jsx154("span", { className: "ods-workflow-header-expanded__runtime", children: runtime })
|
|
36367
36996
|
] })
|
|
36368
36997
|
] })
|
|
36369
36998
|
}
|
|
36370
|
-
) : onRun && /* @__PURE__ */
|
|
36999
|
+
) : onRun && /* @__PURE__ */ jsx154(
|
|
36371
37000
|
Button,
|
|
36372
37001
|
{
|
|
36373
37002
|
variant: "primary",
|
|
36374
37003
|
size: "sm",
|
|
36375
37004
|
"aria-label": "Run workflow",
|
|
36376
|
-
leftIcon: /* @__PURE__ */
|
|
37005
|
+
leftIcon: /* @__PURE__ */ jsx154(PlayFilledAltIcon3, { size: "sm" }),
|
|
36377
37006
|
onClick: onRun,
|
|
36378
37007
|
children: "Run"
|
|
36379
37008
|
}
|
|
36380
37009
|
),
|
|
36381
|
-
menu ?? (menuItems && menuItems.length > 0 && /* @__PURE__ */
|
|
37010
|
+
menu ?? (menuItems && menuItems.length > 0 && /* @__PURE__ */ jsx154(
|
|
36382
37011
|
DropdownMenu,
|
|
36383
37012
|
{
|
|
36384
37013
|
"aria-label": menuLabel,
|
|
36385
37014
|
align: "end",
|
|
36386
37015
|
...menuProps,
|
|
36387
|
-
trigger: menuTrigger ?? /* @__PURE__ */
|
|
37016
|
+
trigger: menuTrigger ?? /* @__PURE__ */ jsx154(
|
|
36388
37017
|
Button,
|
|
36389
37018
|
{
|
|
36390
37019
|
variant: "ghost",
|
|
36391
37020
|
size: "sm",
|
|
36392
|
-
leftIcon: /* @__PURE__ */
|
|
37021
|
+
leftIcon: /* @__PURE__ */ jsx154(OverflowMenuVerticalIcon2, { size: "sm" })
|
|
36393
37022
|
}
|
|
36394
37023
|
),
|
|
36395
37024
|
items: menuItems
|
|
@@ -36397,10 +37026,10 @@ function WorkflowHeaderExpanded({
|
|
|
36397
37026
|
))
|
|
36398
37027
|
] })
|
|
36399
37028
|
] }),
|
|
36400
|
-
(meta2 || saveLabel) && /* @__PURE__ */
|
|
37029
|
+
(meta2 || saveLabel) && /* @__PURE__ */ jsx154("div", { className: "ods-workflow-header-expanded__row ods-workflow-header-expanded__row--bottom", children: /* @__PURE__ */ jsxs148("span", { className: "ods-workflow-header-expanded__meta", children: [
|
|
36401
37030
|
meta2,
|
|
36402
|
-
meta2 && saveLabel && /* @__PURE__ */
|
|
36403
|
-
saveLabel && /* @__PURE__ */
|
|
37031
|
+
meta2 && saveLabel && /* @__PURE__ */ jsx154("span", { "aria-hidden": "true", style: { margin: "0 6px", opacity: 0.4 }, children: "\xB7" }),
|
|
37032
|
+
saveLabel && /* @__PURE__ */ jsx154(
|
|
36404
37033
|
"span",
|
|
36405
37034
|
{
|
|
36406
37035
|
className: cn(
|
|
@@ -36412,36 +37041,36 @@ function WorkflowHeaderExpanded({
|
|
|
36412
37041
|
}
|
|
36413
37042
|
)
|
|
36414
37043
|
] }) }),
|
|
36415
|
-
/* @__PURE__ */
|
|
37044
|
+
/* @__PURE__ */ jsx154("span", { className: "ods-workflow-header-expanded__progress", "aria-hidden": "true" })
|
|
36416
37045
|
]
|
|
36417
37046
|
}
|
|
36418
37047
|
);
|
|
36419
37048
|
}
|
|
36420
37049
|
|
|
36421
37050
|
// src/hooks/useBanner.ts
|
|
36422
|
-
import { useCallback as
|
|
37051
|
+
import { useCallback as useCallback54, useEffect as useEffect58, useRef as useRef51, useState as useState75 } from "react";
|
|
36423
37052
|
function useBanner(options2 = {}) {
|
|
36424
37053
|
const { defaultOpen = false, autoDismissAfter, onDismiss } = options2;
|
|
36425
|
-
const [open, setOpen] =
|
|
36426
|
-
const timerRef =
|
|
36427
|
-
const onDismissRef =
|
|
36428
|
-
|
|
37054
|
+
const [open, setOpen] = useState75(defaultOpen);
|
|
37055
|
+
const timerRef = useRef51(null);
|
|
37056
|
+
const onDismissRef = useRef51(onDismiss);
|
|
37057
|
+
useEffect58(() => {
|
|
36429
37058
|
onDismissRef.current = onDismiss;
|
|
36430
37059
|
}, [onDismiss]);
|
|
36431
|
-
const clearTimer =
|
|
37060
|
+
const clearTimer = useCallback54(() => {
|
|
36432
37061
|
if (timerRef.current !== null) {
|
|
36433
37062
|
clearTimeout(timerRef.current);
|
|
36434
37063
|
timerRef.current = null;
|
|
36435
37064
|
}
|
|
36436
37065
|
}, []);
|
|
36437
|
-
const hide =
|
|
37066
|
+
const hide = useCallback54(() => {
|
|
36438
37067
|
clearTimer();
|
|
36439
37068
|
setOpen((wasOpen) => {
|
|
36440
37069
|
if (wasOpen) onDismissRef.current?.();
|
|
36441
37070
|
return false;
|
|
36442
37071
|
});
|
|
36443
37072
|
}, [clearTimer]);
|
|
36444
|
-
const show =
|
|
37073
|
+
const show = useCallback54(() => {
|
|
36445
37074
|
clearTimer();
|
|
36446
37075
|
setOpen(true);
|
|
36447
37076
|
if (typeof autoDismissAfter === "number" && Number.isFinite(autoDismissAfter) && autoDismissAfter > 0) {
|
|
@@ -36452,11 +37081,11 @@ function useBanner(options2 = {}) {
|
|
|
36452
37081
|
}, autoDismissAfter);
|
|
36453
37082
|
}
|
|
36454
37083
|
}, [autoDismissAfter, clearTimer]);
|
|
36455
|
-
const toggle =
|
|
37084
|
+
const toggle = useCallback54(() => {
|
|
36456
37085
|
if (open) hide();
|
|
36457
37086
|
else show();
|
|
36458
37087
|
}, [open, show, hide]);
|
|
36459
|
-
|
|
37088
|
+
useEffect58(() => () => clearTimer(), [clearTimer]);
|
|
36460
37089
|
return {
|
|
36461
37090
|
open,
|
|
36462
37091
|
show,
|
|
@@ -36467,7 +37096,7 @@ function useBanner(options2 = {}) {
|
|
|
36467
37096
|
}
|
|
36468
37097
|
|
|
36469
37098
|
// src/hooks/useCallout.ts
|
|
36470
|
-
import { useCallback as
|
|
37099
|
+
import { useCallback as useCallback55, useEffect as useEffect59, useState as useState76 } from "react";
|
|
36471
37100
|
var STORAGE_PREFIX = "ods:callout:dismissed:";
|
|
36472
37101
|
function readPersisted(key) {
|
|
36473
37102
|
if (!key || typeof window === "undefined") return false;
|
|
@@ -36490,13 +37119,13 @@ function writePersisted(key, value) {
|
|
|
36490
37119
|
}
|
|
36491
37120
|
function useCallout(options2 = {}) {
|
|
36492
37121
|
const { defaultOpen = true, persistKey, onDismiss } = options2;
|
|
36493
|
-
const [open, setOpen] =
|
|
36494
|
-
|
|
37122
|
+
const [open, setOpen] = useState76(defaultOpen);
|
|
37123
|
+
useEffect59(() => {
|
|
36495
37124
|
if (persistKey && readPersisted(persistKey)) {
|
|
36496
37125
|
setOpen(false);
|
|
36497
37126
|
}
|
|
36498
37127
|
}, []);
|
|
36499
|
-
const dismiss =
|
|
37128
|
+
const dismiss = useCallback55(() => {
|
|
36500
37129
|
setOpen((wasOpen) => {
|
|
36501
37130
|
if (wasOpen) {
|
|
36502
37131
|
writePersisted(persistKey, true);
|
|
@@ -36505,10 +37134,10 @@ function useCallout(options2 = {}) {
|
|
|
36505
37134
|
return false;
|
|
36506
37135
|
});
|
|
36507
37136
|
}, [persistKey, onDismiss]);
|
|
36508
|
-
const show =
|
|
37137
|
+
const show = useCallback55(() => {
|
|
36509
37138
|
setOpen(true);
|
|
36510
37139
|
}, []);
|
|
36511
|
-
const toggle =
|
|
37140
|
+
const toggle = useCallback55(() => {
|
|
36512
37141
|
setOpen((prev) => {
|
|
36513
37142
|
const next = !prev;
|
|
36514
37143
|
if (!next) {
|
|
@@ -36518,7 +37147,7 @@ function useCallout(options2 = {}) {
|
|
|
36518
37147
|
return next;
|
|
36519
37148
|
});
|
|
36520
37149
|
}, [persistKey, onDismiss]);
|
|
36521
|
-
const reset =
|
|
37150
|
+
const reset = useCallback55(() => {
|
|
36522
37151
|
writePersisted(persistKey, false);
|
|
36523
37152
|
setOpen(true);
|
|
36524
37153
|
}, [persistKey]);
|
|
@@ -36591,7 +37220,7 @@ function breakpointMinWidth(name) {
|
|
|
36591
37220
|
}
|
|
36592
37221
|
|
|
36593
37222
|
// src/hooks/useRating.ts
|
|
36594
|
-
import { useCallback as
|
|
37223
|
+
import { useCallback as useCallback56, useState as useState77 } from "react";
|
|
36595
37224
|
function useRating({
|
|
36596
37225
|
value: controlled,
|
|
36597
37226
|
defaultValue = 0,
|
|
@@ -36599,14 +37228,14 @@ function useRating({
|
|
|
36599
37228
|
step = 1,
|
|
36600
37229
|
onChange
|
|
36601
37230
|
} = {}) {
|
|
36602
|
-
const [internal, setInternal] =
|
|
37231
|
+
const [internal, setInternal] = useState77(defaultValue);
|
|
36603
37232
|
const value = controlled ?? internal;
|
|
36604
37233
|
const isControlled = controlled !== void 0;
|
|
36605
|
-
const clamp2 =
|
|
37234
|
+
const clamp2 = useCallback56(
|
|
36606
37235
|
(v) => Math.max(0, Math.min(max, v)),
|
|
36607
37236
|
[max]
|
|
36608
37237
|
);
|
|
36609
|
-
const set =
|
|
37238
|
+
const set = useCallback56(
|
|
36610
37239
|
(next) => {
|
|
36611
37240
|
const clamped = clamp2(next);
|
|
36612
37241
|
if (!isControlled) setInternal(clamped);
|
|
@@ -36628,10 +37257,10 @@ function useBinaryRating({
|
|
|
36628
37257
|
defaultValue = null,
|
|
36629
37258
|
onChange
|
|
36630
37259
|
} = {}) {
|
|
36631
|
-
const [internal, setInternal] =
|
|
37260
|
+
const [internal, setInternal] = useState77(defaultValue);
|
|
36632
37261
|
const value = controlled ?? internal;
|
|
36633
37262
|
const isControlled = controlled !== void 0;
|
|
36634
|
-
const set =
|
|
37263
|
+
const set = useCallback56(
|
|
36635
37264
|
(next) => {
|
|
36636
37265
|
if (!isControlled) setInternal(next);
|
|
36637
37266
|
onChange?.(next);
|
|
@@ -36650,30 +37279,30 @@ function useBinaryRating({
|
|
|
36650
37279
|
}
|
|
36651
37280
|
|
|
36652
37281
|
// src/hooks/useTimeline.ts
|
|
36653
|
-
import { useCallback as
|
|
37282
|
+
import { useCallback as useCallback57, useState as useState78 } from "react";
|
|
36654
37283
|
function useTimeline({
|
|
36655
37284
|
items: controlled,
|
|
36656
37285
|
defaultItems = [],
|
|
36657
37286
|
onChange
|
|
36658
37287
|
} = {}) {
|
|
36659
|
-
const [internal, setInternal] =
|
|
37288
|
+
const [internal, setInternal] = useState78(defaultItems);
|
|
36660
37289
|
const items = controlled ?? internal;
|
|
36661
37290
|
const isControlled = controlled !== void 0;
|
|
36662
|
-
const commit =
|
|
37291
|
+
const commit = useCallback57(
|
|
36663
37292
|
(next) => {
|
|
36664
37293
|
if (!isControlled) setInternal(next);
|
|
36665
37294
|
onChange?.(next);
|
|
36666
37295
|
},
|
|
36667
37296
|
[isControlled, onChange]
|
|
36668
37297
|
);
|
|
36669
|
-
const add =
|
|
37298
|
+
const add = useCallback57(
|
|
36670
37299
|
(item) => {
|
|
36671
37300
|
if (items.some((i) => i.id === item.id)) return;
|
|
36672
37301
|
commit([...items, item]);
|
|
36673
37302
|
},
|
|
36674
37303
|
[items, commit]
|
|
36675
37304
|
);
|
|
36676
|
-
const insert =
|
|
37305
|
+
const insert = useCallback57(
|
|
36677
37306
|
(index, item) => {
|
|
36678
37307
|
if (items.some((i) => i.id === item.id)) return;
|
|
36679
37308
|
const at = Math.max(0, Math.min(items.length, index));
|
|
@@ -36683,7 +37312,7 @@ function useTimeline({
|
|
|
36683
37312
|
},
|
|
36684
37313
|
[items, commit]
|
|
36685
37314
|
);
|
|
36686
|
-
const remove =
|
|
37315
|
+
const remove = useCallback57(
|
|
36687
37316
|
(id) => {
|
|
36688
37317
|
const next = items.filter((i) => i.id !== id);
|
|
36689
37318
|
if (next.length === items.length) return;
|
|
@@ -36691,7 +37320,7 @@ function useTimeline({
|
|
|
36691
37320
|
},
|
|
36692
37321
|
[items, commit]
|
|
36693
37322
|
);
|
|
36694
|
-
const update =
|
|
37323
|
+
const update = useCallback57(
|
|
36695
37324
|
(id, patch) => {
|
|
36696
37325
|
let changed = false;
|
|
36697
37326
|
const next = items.map((i) => {
|
|
@@ -36716,7 +37345,7 @@ function useTimeline({
|
|
|
36716
37345
|
}
|
|
36717
37346
|
|
|
36718
37347
|
// src/hooks/useTraceTimeline.ts
|
|
36719
|
-
import { useCallback as
|
|
37348
|
+
import { useCallback as useCallback58, useRef as useRef52, useState as useState79 } from "react";
|
|
36720
37349
|
var GLOBAL_SEQ = 0;
|
|
36721
37350
|
var generateId = () => `ods-trace-${Date.now().toString(36)}-${(GLOBAL_SEQ++).toString(36)}`;
|
|
36722
37351
|
function useTraceTimeline({
|
|
@@ -36724,12 +37353,12 @@ function useTraceTimeline({
|
|
|
36724
37353
|
defaultSteps = [],
|
|
36725
37354
|
onChange
|
|
36726
37355
|
} = {}) {
|
|
36727
|
-
const [internal, setInternal] =
|
|
37356
|
+
const [internal, setInternal] = useState79(defaultSteps);
|
|
36728
37357
|
const steps = controlled ?? internal;
|
|
36729
37358
|
const isControlled = controlled !== void 0;
|
|
36730
|
-
const stepsRef =
|
|
37359
|
+
const stepsRef = useRef52(steps);
|
|
36731
37360
|
stepsRef.current = steps;
|
|
36732
|
-
const commit =
|
|
37361
|
+
const commit = useCallback58(
|
|
36733
37362
|
(next) => {
|
|
36734
37363
|
stepsRef.current = next;
|
|
36735
37364
|
if (!isControlled) setInternal(next);
|
|
@@ -36737,7 +37366,7 @@ function useTraceTimeline({
|
|
|
36737
37366
|
},
|
|
36738
37367
|
[isControlled, onChange]
|
|
36739
37368
|
);
|
|
36740
|
-
const start =
|
|
37369
|
+
const start = useCallback58(
|
|
36741
37370
|
(input) => {
|
|
36742
37371
|
const id = input.id ?? generateId();
|
|
36743
37372
|
const record = {
|
|
@@ -36757,7 +37386,7 @@ function useTraceTimeline({
|
|
|
36757
37386
|
},
|
|
36758
37387
|
[commit]
|
|
36759
37388
|
);
|
|
36760
|
-
const update =
|
|
37389
|
+
const update = useCallback58(
|
|
36761
37390
|
(id, patch) => {
|
|
36762
37391
|
let changed = false;
|
|
36763
37392
|
const next = stepsRef.current.map((s) => {
|
|
@@ -36769,19 +37398,19 @@ function useTraceTimeline({
|
|
|
36769
37398
|
},
|
|
36770
37399
|
[commit]
|
|
36771
37400
|
);
|
|
36772
|
-
const complete =
|
|
37401
|
+
const complete = useCallback58(
|
|
36773
37402
|
(id, patch = {}) => {
|
|
36774
37403
|
update(id, { ...patch, status: "success" });
|
|
36775
37404
|
},
|
|
36776
37405
|
[update]
|
|
36777
37406
|
);
|
|
36778
|
-
const fail =
|
|
37407
|
+
const fail = useCallback58(
|
|
36779
37408
|
(id, patch = {}) => {
|
|
36780
37409
|
update(id, { ...patch, status: "failed" });
|
|
36781
37410
|
},
|
|
36782
37411
|
[update]
|
|
36783
37412
|
);
|
|
36784
|
-
const remove =
|
|
37413
|
+
const remove = useCallback58(
|
|
36785
37414
|
(id) => {
|
|
36786
37415
|
const next = stepsRef.current.filter((s) => s.id !== id);
|
|
36787
37416
|
if (next.length === stepsRef.current.length) return;
|
|
@@ -36807,13 +37436,13 @@ function useTraceTimeline({
|
|
|
36807
37436
|
|
|
36808
37437
|
// src/provider/OdsProvider.tsx
|
|
36809
37438
|
import { generateCssVars, resolveConfig } from "@octaviaflow/config";
|
|
36810
|
-
import { createContext as createContext4, useContext as useContext5, useEffect as
|
|
37439
|
+
import { createContext as createContext4, useContext as useContext5, useEffect as useEffect60, useMemo as useMemo40 } from "react";
|
|
36811
37440
|
import { OverlayProvider as OverlayProvider3 } from "react-aria";
|
|
36812
|
-
import { jsx as
|
|
37441
|
+
import { jsx as jsx155 } from "react/jsx-runtime";
|
|
36813
37442
|
var OdsContext = createContext4(null);
|
|
36814
37443
|
function OdsProvider({ config: userConfig, children }) {
|
|
36815
37444
|
const resolved = useMemo40(() => resolveConfig(userConfig), [userConfig]);
|
|
36816
|
-
|
|
37445
|
+
useEffect60(() => {
|
|
36817
37446
|
const cssVarsBlock = generateCssVars(resolved);
|
|
36818
37447
|
const match = cssVarsBlock.match(/:root\s*\{([\s\S]*)\}/);
|
|
36819
37448
|
if (match) {
|
|
@@ -36830,7 +37459,7 @@ function OdsProvider({ config: userConfig, children }) {
|
|
|
36830
37459
|
}
|
|
36831
37460
|
}, [resolved]);
|
|
36832
37461
|
const contextValue = useMemo40(() => ({ config: resolved }), [resolved]);
|
|
36833
|
-
return /* @__PURE__ */
|
|
37462
|
+
return /* @__PURE__ */ jsx155(OdsContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx155(OverlayProvider3, { children }) });
|
|
36834
37463
|
}
|
|
36835
37464
|
function useOds() {
|
|
36836
37465
|
const ctx = useContext5(OdsContext);
|
|
@@ -37141,7 +37770,7 @@ function applyVerticalLayout(nodes, edges) {
|
|
|
37141
37770
|
}
|
|
37142
37771
|
|
|
37143
37772
|
// src/notifications/components/AlertConditionComposer/AlertConditionComposer.tsx
|
|
37144
|
-
import { useId as
|
|
37773
|
+
import { useId as useId65 } from "react";
|
|
37145
37774
|
|
|
37146
37775
|
// src/notifications/engine/catalog.ts
|
|
37147
37776
|
var DEFAULT_NOTIFICATION_CATALOG = [
|
|
@@ -37637,7 +38266,7 @@ function describeRule(rule, catalog, channels) {
|
|
|
37637
38266
|
}
|
|
37638
38267
|
|
|
37639
38268
|
// src/notifications/components/AlertConditionComposer/AlertConditionComposer.tsx
|
|
37640
|
-
import { Fragment as Fragment65, jsx as
|
|
38269
|
+
import { Fragment as Fragment65, jsx as jsx156, jsxs as jsxs149 } from "react/jsx-runtime";
|
|
37641
38270
|
var KIND_LABELS = {
|
|
37642
38271
|
every: "every time it happens",
|
|
37643
38272
|
state_change: "only when its status changes",
|
|
@@ -37663,7 +38292,7 @@ function AlertConditionComposer({
|
|
|
37663
38292
|
className,
|
|
37664
38293
|
id
|
|
37665
38294
|
}) {
|
|
37666
|
-
const reactId =
|
|
38295
|
+
const reactId = useId65();
|
|
37667
38296
|
const baseId = id ?? `${reactId}-condition`;
|
|
37668
38297
|
const helperId = `${baseId}-helper`;
|
|
37669
38298
|
const kinds = allowThreshold ? ["every", "state_change", "consecutive", "count"] : ["every", "state_change"];
|
|
@@ -37689,7 +38318,7 @@ function AlertConditionComposer({
|
|
|
37689
38318
|
onChange({ kind: "every" });
|
|
37690
38319
|
}
|
|
37691
38320
|
};
|
|
37692
|
-
return /* @__PURE__ */
|
|
38321
|
+
return /* @__PURE__ */ jsxs149(
|
|
37693
38322
|
"div",
|
|
37694
38323
|
{
|
|
37695
38324
|
className: cn("ods-alert-condition", className),
|
|
@@ -37699,10 +38328,10 @@ function AlertConditionComposer({
|
|
|
37699
38328
|
"aria-describedby": helperText ? helperId : void 0,
|
|
37700
38329
|
"data-size": size,
|
|
37701
38330
|
children: [
|
|
37702
|
-
label && /* @__PURE__ */
|
|
37703
|
-
/* @__PURE__ */
|
|
37704
|
-
/* @__PURE__ */
|
|
37705
|
-
/* @__PURE__ */
|
|
38331
|
+
label && /* @__PURE__ */ jsx156("div", { className: "ods-alert-condition__label", children: label }),
|
|
38332
|
+
/* @__PURE__ */ jsxs149("div", { className: "ods-alert-condition__sentence", children: [
|
|
38333
|
+
/* @__PURE__ */ jsx156("span", { className: "ods-alert-condition__word", children: "Notify" }),
|
|
38334
|
+
/* @__PURE__ */ jsx156(
|
|
37706
38335
|
Select,
|
|
37707
38336
|
{
|
|
37708
38337
|
"aria-label": "Condition kind",
|
|
@@ -37715,8 +38344,8 @@ function AlertConditionComposer({
|
|
|
37715
38344
|
dropdownMinWidth: 280
|
|
37716
38345
|
}
|
|
37717
38346
|
),
|
|
37718
|
-
value.kind === "consecutive" && /* @__PURE__ */
|
|
37719
|
-
/* @__PURE__ */
|
|
38347
|
+
value.kind === "consecutive" && /* @__PURE__ */ jsxs149(Fragment65, { children: [
|
|
38348
|
+
/* @__PURE__ */ jsx156(
|
|
37720
38349
|
NumberInput,
|
|
37721
38350
|
{
|
|
37722
38351
|
"aria-label": "Consecutive failures",
|
|
@@ -37730,13 +38359,13 @@ function AlertConditionComposer({
|
|
|
37730
38359
|
align: "center"
|
|
37731
38360
|
}
|
|
37732
38361
|
),
|
|
37733
|
-
/* @__PURE__ */
|
|
38362
|
+
/* @__PURE__ */ jsxs149("span", { className: "ods-alert-condition__word", children: [
|
|
37734
38363
|
"failures in a row for the same ",
|
|
37735
38364
|
subjectNoun
|
|
37736
38365
|
] })
|
|
37737
38366
|
] }),
|
|
37738
|
-
value.kind === "count" && /* @__PURE__ */
|
|
37739
|
-
/* @__PURE__ */
|
|
38367
|
+
value.kind === "count" && /* @__PURE__ */ jsxs149(Fragment65, { children: [
|
|
38368
|
+
/* @__PURE__ */ jsx156(
|
|
37740
38369
|
NumberInput,
|
|
37741
38370
|
{
|
|
37742
38371
|
"aria-label": "Occurrences",
|
|
@@ -37750,8 +38379,8 @@ function AlertConditionComposer({
|
|
|
37750
38379
|
align: "center"
|
|
37751
38380
|
}
|
|
37752
38381
|
),
|
|
37753
|
-
/* @__PURE__ */
|
|
37754
|
-
/* @__PURE__ */
|
|
38382
|
+
/* @__PURE__ */ jsx156("span", { className: "ods-alert-condition__word", children: "times in" }),
|
|
38383
|
+
/* @__PURE__ */ jsx156(
|
|
37755
38384
|
Select,
|
|
37756
38385
|
{
|
|
37757
38386
|
"aria-label": "Window",
|
|
@@ -37763,14 +38392,14 @@ function AlertConditionComposer({
|
|
|
37763
38392
|
className: "ods-alert-condition__window"
|
|
37764
38393
|
}
|
|
37765
38394
|
),
|
|
37766
|
-
/* @__PURE__ */
|
|
38395
|
+
/* @__PURE__ */ jsxs149("span", { className: "ods-alert-condition__word", children: [
|
|
37767
38396
|
"for the same ",
|
|
37768
38397
|
subjectNoun
|
|
37769
38398
|
] })
|
|
37770
38399
|
] })
|
|
37771
38400
|
] }),
|
|
37772
|
-
/* @__PURE__ */
|
|
37773
|
-
helperText && /* @__PURE__ */
|
|
38401
|
+
/* @__PURE__ */ jsx156("div", { className: "ods-alert-condition__summary", "aria-live": "polite", children: value.kind === "every" ? `Every occurrence is sent (still de-duplicated per ${subjectNoun}).` : `Sends${describeCondition(value, subjectNoun)}.` }),
|
|
38402
|
+
helperText && /* @__PURE__ */ jsx156("div", { id: helperId, className: "ods-alert-condition__helper", children: helperText })
|
|
37774
38403
|
]
|
|
37775
38404
|
}
|
|
37776
38405
|
);
|
|
@@ -37778,8 +38407,8 @@ function AlertConditionComposer({
|
|
|
37778
38407
|
AlertConditionComposer.displayName = "AlertConditionComposer";
|
|
37779
38408
|
|
|
37780
38409
|
// src/notifications/components/DeliveryFrequencyControl/DeliveryFrequencyControl.tsx
|
|
37781
|
-
import { useId as
|
|
37782
|
-
import { jsx as
|
|
38410
|
+
import { useId as useId66 } from "react";
|
|
38411
|
+
import { jsx as jsx157, jsxs as jsxs150 } from "react/jsx-runtime";
|
|
37783
38412
|
var MODE_LABELS = {
|
|
37784
38413
|
immediate: "Immediately",
|
|
37785
38414
|
batched: "Batched",
|
|
@@ -37806,7 +38435,7 @@ function DeliveryFrequencyControl({
|
|
|
37806
38435
|
className,
|
|
37807
38436
|
id
|
|
37808
38437
|
}) {
|
|
37809
|
-
const reactId =
|
|
38438
|
+
const reactId = useId66();
|
|
37810
38439
|
const baseId = id ?? `${reactId}-delivery`;
|
|
37811
38440
|
const patch = (next) => onChange({ ...value, ...next });
|
|
37812
38441
|
const windowOptions = batchWindows.map((m) => ({
|
|
@@ -37820,7 +38449,7 @@ function DeliveryFrequencyControl({
|
|
|
37820
38449
|
if (mode === "digest" && !next.schedule) next.schedule = DEFAULT_SCHEDULE;
|
|
37821
38450
|
onChange(next);
|
|
37822
38451
|
};
|
|
37823
|
-
return /* @__PURE__ */
|
|
38452
|
+
return /* @__PURE__ */ jsxs150(
|
|
37824
38453
|
"div",
|
|
37825
38454
|
{
|
|
37826
38455
|
className: cn("ods-delivery-freq", className),
|
|
@@ -37828,8 +38457,8 @@ function DeliveryFrequencyControl({
|
|
|
37828
38457
|
role: "group",
|
|
37829
38458
|
"aria-label": typeof label === "string" ? label : "Delivery",
|
|
37830
38459
|
children: [
|
|
37831
|
-
label && /* @__PURE__ */
|
|
37832
|
-
/* @__PURE__ */
|
|
38460
|
+
label && /* @__PURE__ */ jsx157("div", { className: "ods-delivery-freq__label", children: label }),
|
|
38461
|
+
/* @__PURE__ */ jsx157(
|
|
37833
38462
|
SegmentedControl,
|
|
37834
38463
|
{
|
|
37835
38464
|
"aria-label": "Delivery mode",
|
|
@@ -37840,10 +38469,10 @@ function DeliveryFrequencyControl({
|
|
|
37840
38469
|
disabled
|
|
37841
38470
|
}
|
|
37842
38471
|
),
|
|
37843
|
-
/* @__PURE__ */
|
|
37844
|
-
value.mode === "batched" && /* @__PURE__ */
|
|
37845
|
-
/* @__PURE__ */
|
|
37846
|
-
/* @__PURE__ */
|
|
38472
|
+
/* @__PURE__ */ jsx157("div", { className: "ods-delivery-freq__hint", children: MODE_HINTS[value.mode] }),
|
|
38473
|
+
value.mode === "batched" && /* @__PURE__ */ jsx157("div", { className: "ods-delivery-freq__fields", children: /* @__PURE__ */ jsxs150("div", { className: "ods-delivery-freq__row", children: [
|
|
38474
|
+
/* @__PURE__ */ jsx157("span", { className: "ods-delivery-freq__word", children: "Send at most one message every" }),
|
|
38475
|
+
/* @__PURE__ */ jsx157(
|
|
37847
38476
|
Select,
|
|
37848
38477
|
{
|
|
37849
38478
|
"aria-label": "Batch window",
|
|
@@ -37856,8 +38485,8 @@ function DeliveryFrequencyControl({
|
|
|
37856
38485
|
}
|
|
37857
38486
|
)
|
|
37858
38487
|
] }) }),
|
|
37859
|
-
value.mode === "digest" && /* @__PURE__ */
|
|
37860
|
-
/* @__PURE__ */
|
|
38488
|
+
value.mode === "digest" && /* @__PURE__ */ jsxs150("div", { className: "ods-delivery-freq__fields", children: [
|
|
38489
|
+
/* @__PURE__ */ jsx157(
|
|
37861
38490
|
ScheduleBuilder,
|
|
37862
38491
|
{
|
|
37863
38492
|
value: value.schedule ?? DEFAULT_SCHEDULE,
|
|
@@ -37867,7 +38496,7 @@ function DeliveryFrequencyControl({
|
|
|
37867
38496
|
disabled
|
|
37868
38497
|
}
|
|
37869
38498
|
),
|
|
37870
|
-
/* @__PURE__ */
|
|
38499
|
+
/* @__PURE__ */ jsx157(
|
|
37871
38500
|
Switch,
|
|
37872
38501
|
{
|
|
37873
38502
|
size: "sm",
|
|
@@ -37887,7 +38516,7 @@ DeliveryFrequencyControl.displayName = "DeliveryFrequencyControl";
|
|
|
37887
38516
|
|
|
37888
38517
|
// src/notifications/components/EventCatalogPicker/EventCatalogPicker.tsx
|
|
37889
38518
|
import { SearchIcon as SearchIcon16 } from "@octaviaflow/icons";
|
|
37890
|
-
import { useId as
|
|
38519
|
+
import { useId as useId67, useMemo as useMemo41, useState as useState80 } from "react";
|
|
37891
38520
|
|
|
37892
38521
|
// src/notifications/components/meta.tsx
|
|
37893
38522
|
import {
|
|
@@ -37902,55 +38531,55 @@ import {
|
|
|
37902
38531
|
WarningFilledIcon as WarningFilledIcon3,
|
|
37903
38532
|
WebhookIcon
|
|
37904
38533
|
} from "@octaviaflow/icons";
|
|
37905
|
-
import { jsx as
|
|
38534
|
+
import { jsx as jsx158 } from "react/jsx-runtime";
|
|
37906
38535
|
var CHANNEL_TYPE_META = {
|
|
37907
38536
|
in_app: {
|
|
37908
38537
|
label: "In-app",
|
|
37909
38538
|
hint: "The bell in the top bar. Always on.",
|
|
37910
38539
|
connected: false,
|
|
37911
|
-
icon: /* @__PURE__ */
|
|
38540
|
+
icon: /* @__PURE__ */ jsx158(NotificationIcon, { size: "sm", "aria-hidden": "true" })
|
|
37912
38541
|
},
|
|
37913
38542
|
email: {
|
|
37914
38543
|
label: "Email",
|
|
37915
38544
|
hint: "One or more addresses.",
|
|
37916
38545
|
connected: false,
|
|
37917
|
-
icon: /* @__PURE__ */
|
|
38546
|
+
icon: /* @__PURE__ */ jsx158(EmailIcon, { size: "sm", "aria-hidden": "true" })
|
|
37918
38547
|
},
|
|
37919
38548
|
slack: {
|
|
37920
38549
|
label: "Slack",
|
|
37921
38550
|
hint: "A channel in a connected workspace.",
|
|
37922
38551
|
connected: true,
|
|
37923
|
-
icon: /* @__PURE__ */
|
|
38552
|
+
icon: /* @__PURE__ */ jsx158(LogoSlackIcon, { size: "sm", "aria-hidden": "true" })
|
|
37924
38553
|
},
|
|
37925
38554
|
teams: {
|
|
37926
38555
|
label: "Microsoft Teams",
|
|
37927
38556
|
hint: "A channel in a connected team.",
|
|
37928
38557
|
connected: true,
|
|
37929
|
-
icon: /* @__PURE__ */
|
|
38558
|
+
icon: /* @__PURE__ */ jsx158(ChatOperationalIcon, { size: "sm", "aria-hidden": "true" })
|
|
37930
38559
|
},
|
|
37931
38560
|
google_chat: {
|
|
37932
38561
|
label: "Google Chat",
|
|
37933
38562
|
hint: "A space in a connected account.",
|
|
37934
38563
|
connected: true,
|
|
37935
|
-
icon: /* @__PURE__ */
|
|
38564
|
+
icon: /* @__PURE__ */ jsx158(ChatIcon2, { size: "sm", "aria-hidden": "true" })
|
|
37936
38565
|
},
|
|
37937
38566
|
whatsapp: {
|
|
37938
38567
|
label: "WhatsApp",
|
|
37939
38568
|
hint: "Template messages to a phone number.",
|
|
37940
38569
|
connected: false,
|
|
37941
|
-
icon: /* @__PURE__ */
|
|
38570
|
+
icon: /* @__PURE__ */ jsx158(ChatLaunchIcon, { size: "sm", "aria-hidden": "true" })
|
|
37942
38571
|
},
|
|
37943
38572
|
webhook: {
|
|
37944
38573
|
label: "Webhook",
|
|
37945
38574
|
hint: "Signed JSON to a URL you own.",
|
|
37946
38575
|
connected: false,
|
|
37947
|
-
icon: /* @__PURE__ */
|
|
38576
|
+
icon: /* @__PURE__ */ jsx158(WebhookIcon, { size: "sm", "aria-hidden": "true" })
|
|
37948
38577
|
}
|
|
37949
38578
|
};
|
|
37950
38579
|
var PERSONAL_CHANNEL_META = {
|
|
37951
|
-
in_app: { label: "In-app", icon: /* @__PURE__ */
|
|
37952
|
-
email: { label: "Email", icon: /* @__PURE__ */
|
|
37953
|
-
slack_dm: { label: "Slack DM", icon: /* @__PURE__ */
|
|
38580
|
+
in_app: { label: "In-app", icon: /* @__PURE__ */ jsx158(NotificationIcon, { size: "sm", "aria-hidden": "true" }) },
|
|
38581
|
+
email: { label: "Email", icon: /* @__PURE__ */ jsx158(EmailIcon, { size: "sm", "aria-hidden": "true" }) },
|
|
38582
|
+
slack_dm: { label: "Slack DM", icon: /* @__PURE__ */ jsx158(LogoSlackIcon, { size: "sm", "aria-hidden": "true" }) }
|
|
37954
38583
|
};
|
|
37955
38584
|
var CHANNEL_STATUS_META = {
|
|
37956
38585
|
verified: { label: "Verified", variant: "success" },
|
|
@@ -37962,22 +38591,22 @@ var SEVERITY_META = {
|
|
|
37962
38591
|
info: {
|
|
37963
38592
|
label: "Info",
|
|
37964
38593
|
variant: "info",
|
|
37965
|
-
icon: /* @__PURE__ */
|
|
38594
|
+
icon: /* @__PURE__ */ jsx158(InformationFilledIcon, { size: "sm", "aria-hidden": "true" })
|
|
37966
38595
|
},
|
|
37967
38596
|
warning: {
|
|
37968
38597
|
label: "Warning",
|
|
37969
38598
|
variant: "warning",
|
|
37970
|
-
icon: /* @__PURE__ */
|
|
38599
|
+
icon: /* @__PURE__ */ jsx158(WarningFilledIcon3, { size: "sm", "aria-hidden": "true" })
|
|
37971
38600
|
},
|
|
37972
38601
|
error: {
|
|
37973
38602
|
label: "Error",
|
|
37974
38603
|
variant: "error",
|
|
37975
|
-
icon: /* @__PURE__ */
|
|
38604
|
+
icon: /* @__PURE__ */ jsx158(ErrorFilledIcon2, { size: "sm", "aria-hidden": "true" })
|
|
37976
38605
|
}
|
|
37977
38606
|
};
|
|
37978
38607
|
|
|
37979
38608
|
// src/notifications/components/EventCatalogPicker/EventCatalogPicker.tsx
|
|
37980
|
-
import { jsx as
|
|
38609
|
+
import { jsx as jsx159, jsxs as jsxs151 } from "react/jsx-runtime";
|
|
37981
38610
|
function EventCatalogPicker({
|
|
37982
38611
|
catalog,
|
|
37983
38612
|
value,
|
|
@@ -37991,10 +38620,10 @@ function EventCatalogPicker({
|
|
|
37991
38620
|
className,
|
|
37992
38621
|
id
|
|
37993
38622
|
}) {
|
|
37994
|
-
const reactId =
|
|
38623
|
+
const reactId = useId67();
|
|
37995
38624
|
const baseId = id ?? `${reactId}-events`;
|
|
37996
|
-
const [query, setQuery] =
|
|
37997
|
-
const [collapsed, setCollapsed] =
|
|
38625
|
+
const [query, setQuery] = useState80("");
|
|
38626
|
+
const [collapsed, setCollapsed] = useState80({});
|
|
37998
38627
|
const selected = useMemo41(() => new Set(value), [value]);
|
|
37999
38628
|
const filtered = useMemo41(() => {
|
|
38000
38629
|
const q2 = query.trim().toLowerCase();
|
|
@@ -38030,7 +38659,7 @@ function EventCatalogPicker({
|
|
|
38030
38659
|
if (explicit != null) return explicit;
|
|
38031
38660
|
return !category.events.some((e) => selected.has(e.key));
|
|
38032
38661
|
};
|
|
38033
|
-
return /* @__PURE__ */
|
|
38662
|
+
return /* @__PURE__ */ jsxs151(
|
|
38034
38663
|
"div",
|
|
38035
38664
|
{
|
|
38036
38665
|
className: cn("ods-event-picker", className),
|
|
@@ -38038,16 +38667,16 @@ function EventCatalogPicker({
|
|
|
38038
38667
|
role: "group",
|
|
38039
38668
|
"aria-label": typeof label === "string" ? label : "Events",
|
|
38040
38669
|
children: [
|
|
38041
|
-
(label || searchable) && /* @__PURE__ */
|
|
38042
|
-
label && /* @__PURE__ */
|
|
38043
|
-
searchable && /* @__PURE__ */
|
|
38670
|
+
(label || searchable) && /* @__PURE__ */ jsxs151("div", { className: "ods-event-picker__head", children: [
|
|
38671
|
+
label && /* @__PURE__ */ jsx159("div", { className: "ods-event-picker__label", children: label }),
|
|
38672
|
+
searchable && /* @__PURE__ */ jsx159(
|
|
38044
38673
|
Input,
|
|
38045
38674
|
{
|
|
38046
38675
|
size: "sm",
|
|
38047
38676
|
type: "search",
|
|
38048
38677
|
"aria-label": "Search events",
|
|
38049
38678
|
placeholder: "Search events",
|
|
38050
|
-
leftIcon: /* @__PURE__ */
|
|
38679
|
+
leftIcon: /* @__PURE__ */ jsx159(SearchIcon16, { size: "sm", "aria-hidden": "true" }),
|
|
38051
38680
|
value: query,
|
|
38052
38681
|
onChange: (e) => setQuery(e.target.value),
|
|
38053
38682
|
clearable: true,
|
|
@@ -38056,18 +38685,18 @@ function EventCatalogPicker({
|
|
|
38056
38685
|
className: "ods-event-picker__search"
|
|
38057
38686
|
}
|
|
38058
38687
|
),
|
|
38059
|
-
/* @__PURE__ */
|
|
38688
|
+
/* @__PURE__ */ jsxs151("span", { className: "ods-event-picker__count", "aria-live": "polite", children: [
|
|
38060
38689
|
value.length,
|
|
38061
38690
|
" selected"
|
|
38062
38691
|
] })
|
|
38063
38692
|
] }),
|
|
38064
|
-
filtered.length === 0 ? /* @__PURE__ */
|
|
38693
|
+
filtered.length === 0 ? /* @__PURE__ */ jsx159("div", { className: "ods-event-picker__empty", children: emptyLabel }) : /* @__PURE__ */ jsx159("div", { className: "ods-event-picker__groups", children: filtered.map((category) => {
|
|
38065
38694
|
const total = category.events.length;
|
|
38066
38695
|
const picked = category.events.filter((e) => selected.has(e.key)).length;
|
|
38067
38696
|
const all = picked === total;
|
|
38068
38697
|
const some = picked > 0 && !all;
|
|
38069
38698
|
const open = !isCollapsed(category);
|
|
38070
|
-
return /* @__PURE__ */
|
|
38699
|
+
return /* @__PURE__ */ jsxs151(
|
|
38071
38700
|
"section",
|
|
38072
38701
|
{
|
|
38073
38702
|
className: cn(
|
|
@@ -38075,8 +38704,8 @@ function EventCatalogPicker({
|
|
|
38075
38704
|
!open && "ods-event-picker__group--collapsed"
|
|
38076
38705
|
),
|
|
38077
38706
|
children: [
|
|
38078
|
-
/* @__PURE__ */
|
|
38079
|
-
/* @__PURE__ */
|
|
38707
|
+
/* @__PURE__ */ jsxs151("header", { className: "ods-event-picker__group-head", children: [
|
|
38708
|
+
/* @__PURE__ */ jsx159(
|
|
38080
38709
|
Checkbox,
|
|
38081
38710
|
{
|
|
38082
38711
|
size: "sm",
|
|
@@ -38085,9 +38714,9 @@ function EventCatalogPicker({
|
|
|
38085
38714
|
disabled,
|
|
38086
38715
|
onChange: (on) => toggleCategory(category, on),
|
|
38087
38716
|
"aria-label": `${category.label} (all ${total} events)`,
|
|
38088
|
-
label: /* @__PURE__ */
|
|
38717
|
+
label: /* @__PURE__ */ jsxs151("span", { className: "ods-event-picker__group-title", children: [
|
|
38089
38718
|
category.label,
|
|
38090
|
-
/* @__PURE__ */
|
|
38719
|
+
/* @__PURE__ */ jsxs151("span", { className: "ods-event-picker__group-count", children: [
|
|
38091
38720
|
picked,
|
|
38092
38721
|
"/",
|
|
38093
38722
|
total
|
|
@@ -38096,7 +38725,7 @@ function EventCatalogPicker({
|
|
|
38096
38725
|
description: open ? category.description : void 0
|
|
38097
38726
|
}
|
|
38098
38727
|
),
|
|
38099
|
-
collapsible && !query && /* @__PURE__ */
|
|
38728
|
+
collapsible && !query && /* @__PURE__ */ jsx159(
|
|
38100
38729
|
"button",
|
|
38101
38730
|
{
|
|
38102
38731
|
type: "button",
|
|
@@ -38107,10 +38736,10 @@ function EventCatalogPicker({
|
|
|
38107
38736
|
}
|
|
38108
38737
|
)
|
|
38109
38738
|
] }),
|
|
38110
|
-
open && /* @__PURE__ */
|
|
38739
|
+
open && /* @__PURE__ */ jsx159("ul", { className: "ods-event-picker__rows", children: category.events.map((event) => {
|
|
38111
38740
|
const sev = SEVERITY_META[event.severity];
|
|
38112
|
-
return /* @__PURE__ */
|
|
38113
|
-
/* @__PURE__ */
|
|
38741
|
+
return /* @__PURE__ */ jsxs151("li", { className: "ods-event-picker__row", children: [
|
|
38742
|
+
/* @__PURE__ */ jsx159(
|
|
38114
38743
|
Checkbox,
|
|
38115
38744
|
{
|
|
38116
38745
|
size: "sm",
|
|
@@ -38121,9 +38750,9 @@ function EventCatalogPicker({
|
|
|
38121
38750
|
description: event.description
|
|
38122
38751
|
}
|
|
38123
38752
|
),
|
|
38124
|
-
/* @__PURE__ */
|
|
38125
|
-
event.threshold && /* @__PURE__ */
|
|
38126
|
-
showSeverity && /* @__PURE__ */
|
|
38753
|
+
/* @__PURE__ */ jsxs151("span", { className: "ods-event-picker__badges", children: [
|
|
38754
|
+
event.threshold && /* @__PURE__ */ jsx159(Badge, { size: "sm", variant: "neutral", outlined: true, children: "Threshold" }),
|
|
38755
|
+
showSeverity && /* @__PURE__ */ jsx159(Badge, { size: "sm", variant: sev.variant, dot: true, children: sev.label })
|
|
38127
38756
|
] })
|
|
38128
38757
|
] }, event.key);
|
|
38129
38758
|
}) })
|
|
@@ -38140,7 +38769,7 @@ EventCatalogPicker.displayName = "EventCatalogPicker";
|
|
|
38140
38769
|
|
|
38141
38770
|
// src/notifications/components/NotificationBell/NotificationBell.tsx
|
|
38142
38771
|
import { NotificationIcon as NotificationIcon2 } from "@octaviaflow/icons";
|
|
38143
|
-
import { useCallback as
|
|
38772
|
+
import { useCallback as useCallback59, useState as useState82 } from "react";
|
|
38144
38773
|
|
|
38145
38774
|
// src/notifications/engine/inbox.ts
|
|
38146
38775
|
function resolveInboxAction(item, catalog) {
|
|
@@ -38211,7 +38840,7 @@ function groupInboxByDay(items, now2 = Date.now()) {
|
|
|
38211
38840
|
|
|
38212
38841
|
// src/notifications/components/NotificationDetailDialog/NotificationDetailDialog.tsx
|
|
38213
38842
|
import { ArchiveIcon as ArchiveIcon2, LaunchIcon } from "@octaviaflow/icons";
|
|
38214
|
-
import { jsx as
|
|
38843
|
+
import { jsx as jsx160, jsxs as jsxs152 } from "react/jsx-runtime";
|
|
38215
38844
|
function NotificationDetailDialog({
|
|
38216
38845
|
item,
|
|
38217
38846
|
open,
|
|
@@ -38228,7 +38857,7 @@ function NotificationDetailDialog({
|
|
|
38228
38857
|
const sev = SEVERITY_META[item.severity];
|
|
38229
38858
|
const when = formatRelativeTime(new Date(item.createdAt), now2);
|
|
38230
38859
|
const fullDate = new Date(item.createdAt).toLocaleString();
|
|
38231
|
-
return /* @__PURE__ */
|
|
38860
|
+
return /* @__PURE__ */ jsxs152(
|
|
38232
38861
|
Dialog,
|
|
38233
38862
|
{
|
|
38234
38863
|
open,
|
|
@@ -38236,12 +38865,12 @@ function NotificationDetailDialog({
|
|
|
38236
38865
|
size: "md",
|
|
38237
38866
|
className: cn("ods-notif-detail", className),
|
|
38238
38867
|
title: item.title,
|
|
38239
|
-
footer: /* @__PURE__ */
|
|
38240
|
-
onArchive && !item.archivedAt && /* @__PURE__ */
|
|
38868
|
+
footer: /* @__PURE__ */ jsxs152("div", { className: "ods-notif-detail__footer", children: [
|
|
38869
|
+
onArchive && !item.archivedAt && /* @__PURE__ */ jsx160(
|
|
38241
38870
|
Button,
|
|
38242
38871
|
{
|
|
38243
38872
|
variant: "ghost",
|
|
38244
|
-
leftIcon: /* @__PURE__ */
|
|
38873
|
+
leftIcon: /* @__PURE__ */ jsx160(ArchiveIcon2, { size: "sm", "aria-hidden": "true" }),
|
|
38245
38874
|
onClick: () => {
|
|
38246
38875
|
onArchive(item);
|
|
38247
38876
|
onClose();
|
|
@@ -38249,11 +38878,11 @@ function NotificationDetailDialog({
|
|
|
38249
38878
|
children: "Archive"
|
|
38250
38879
|
}
|
|
38251
38880
|
),
|
|
38252
|
-
/* @__PURE__ */
|
|
38253
|
-
/* @__PURE__ */
|
|
38881
|
+
/* @__PURE__ */ jsx160("span", { className: "ods-notif-detail__spacer" }),
|
|
38882
|
+
/* @__PURE__ */ jsx160(Button, { variant: "ghost", onClick: onClose, children: "Close" }),
|
|
38254
38883
|
resolved.href && // asChild projects the button chrome onto the anchor and skips the
|
|
38255
38884
|
// icon slots, so the glyph is placed inline.
|
|
38256
|
-
/* @__PURE__ */
|
|
38885
|
+
/* @__PURE__ */ jsx160(Button, { variant: "primary", asChild: true, children: /* @__PURE__ */ jsxs152(
|
|
38257
38886
|
"a",
|
|
38258
38887
|
{
|
|
38259
38888
|
href: resolved.href,
|
|
@@ -38266,20 +38895,20 @@ function NotificationDetailDialog({
|
|
|
38266
38895
|
},
|
|
38267
38896
|
children: [
|
|
38268
38897
|
resolved.label ?? "Open",
|
|
38269
|
-
/* @__PURE__ */
|
|
38898
|
+
/* @__PURE__ */ jsx160(LaunchIcon, { size: "sm", "aria-hidden": "true" })
|
|
38270
38899
|
]
|
|
38271
38900
|
}
|
|
38272
38901
|
) })
|
|
38273
38902
|
] }),
|
|
38274
38903
|
children: [
|
|
38275
|
-
/* @__PURE__ */
|
|
38276
|
-
/* @__PURE__ */
|
|
38277
|
-
item.source && /* @__PURE__ */
|
|
38278
|
-
item.subject && /* @__PURE__ */
|
|
38279
|
-
/* @__PURE__ */
|
|
38904
|
+
/* @__PURE__ */ jsxs152("div", { className: "ods-notif-detail__meta", children: [
|
|
38905
|
+
/* @__PURE__ */ jsx160(Badge, { size: "sm", variant: sev.variant, dot: true, children: sev.label }),
|
|
38906
|
+
item.source && /* @__PURE__ */ jsx160("span", { children: item.source }),
|
|
38907
|
+
item.subject && /* @__PURE__ */ jsx160("span", { children: item.subject.label }),
|
|
38908
|
+
/* @__PURE__ */ jsx160("time", { dateTime: new Date(item.createdAt).toISOString(), title: fullDate, children: when ?? fullDate })
|
|
38280
38909
|
] }),
|
|
38281
|
-
item.body && /* @__PURE__ */
|
|
38282
|
-
item.details && item.details.length > 0 && /* @__PURE__ */
|
|
38910
|
+
item.body && /* @__PURE__ */ jsx160("p", { className: "ods-notif-detail__body", children: item.body }),
|
|
38911
|
+
item.details && item.details.length > 0 && /* @__PURE__ */ jsx160(
|
|
38283
38912
|
DescriptionList,
|
|
38284
38913
|
{
|
|
38285
38914
|
items: item.details.map((d) => ({ label: d.label, value: d.value })),
|
|
@@ -38295,8 +38924,8 @@ NotificationDetailDialog.displayName = "NotificationDetailDialog";
|
|
|
38295
38924
|
|
|
38296
38925
|
// src/notifications/components/NotificationInbox/NotificationInbox.tsx
|
|
38297
38926
|
import { ArchiveIcon as ArchiveIcon3, CheckmarkIcon as CheckmarkIcon16, NotificationOffIcon } from "@octaviaflow/icons";
|
|
38298
|
-
import { useMemo as useMemo42, useState as
|
|
38299
|
-
import { Fragment as Fragment66, jsx as
|
|
38927
|
+
import { useMemo as useMemo42, useState as useState81 } from "react";
|
|
38928
|
+
import { Fragment as Fragment66, jsx as jsx161, jsxs as jsxs153 } from "react/jsx-runtime";
|
|
38300
38929
|
var FILTER_OPTIONS = [
|
|
38301
38930
|
{ value: "all", label: "All" },
|
|
38302
38931
|
{ value: "unread", label: "Unread" },
|
|
@@ -38322,13 +38951,13 @@ function NotificationInbox({
|
|
|
38322
38951
|
now: now2,
|
|
38323
38952
|
className
|
|
38324
38953
|
}) {
|
|
38325
|
-
const [internalFilter, setInternalFilter] =
|
|
38954
|
+
const [internalFilter, setInternalFilter] = useState81(defaultFilter2);
|
|
38326
38955
|
const activeFilter = filter ?? internalFilter;
|
|
38327
38956
|
const setFilter = (f) => {
|
|
38328
38957
|
if (filter === void 0) setInternalFilter(f);
|
|
38329
38958
|
onFilterChange?.(f);
|
|
38330
38959
|
};
|
|
38331
|
-
const [detailItem, setDetailItem] =
|
|
38960
|
+
const [detailItem, setDetailItem] = useState81(null);
|
|
38332
38961
|
const unread = countUnread(items);
|
|
38333
38962
|
const visible = useMemo42(() => {
|
|
38334
38963
|
const list = filterInbox(items, activeFilter);
|
|
@@ -38348,20 +38977,20 @@ function NotificationInbox({
|
|
|
38348
38977
|
const action = resolveInboxAction(item, catalog);
|
|
38349
38978
|
const interactive = action.kind !== "none" && Boolean(onOpen || onMarkRead || detailDialog);
|
|
38350
38979
|
const ariaLabel = `${unreadRow ? "Unread: " : ""}${item.title}`;
|
|
38351
|
-
const inner = /* @__PURE__ */
|
|
38352
|
-
/* @__PURE__ */
|
|
38353
|
-
/* @__PURE__ */
|
|
38354
|
-
/* @__PURE__ */
|
|
38355
|
-
item.body && /* @__PURE__ */
|
|
38356
|
-
/* @__PURE__ */
|
|
38357
|
-
item.source && /* @__PURE__ */
|
|
38358
|
-
item.subject && /* @__PURE__ */
|
|
38359
|
-
when && /* @__PURE__ */
|
|
38980
|
+
const inner = /* @__PURE__ */ jsxs153(Fragment66, { children: [
|
|
38981
|
+
/* @__PURE__ */ jsx161("span", { className: "ods-inbox__glyph", "aria-hidden": "true", children: sev.icon }),
|
|
38982
|
+
/* @__PURE__ */ jsxs153("span", { className: "ods-inbox__text", children: [
|
|
38983
|
+
/* @__PURE__ */ jsx161("span", { className: "ods-inbox__title", children: item.title }),
|
|
38984
|
+
item.body && /* @__PURE__ */ jsx161("span", { className: "ods-inbox__body", children: item.body }),
|
|
38985
|
+
/* @__PURE__ */ jsxs153("span", { className: "ods-inbox__meta", children: [
|
|
38986
|
+
item.source && /* @__PURE__ */ jsx161("span", { children: item.source }),
|
|
38987
|
+
item.subject && /* @__PURE__ */ jsx161("span", { children: item.subject.label }),
|
|
38988
|
+
when && /* @__PURE__ */ jsx161("time", { dateTime: new Date(item.createdAt).toISOString(), children: when })
|
|
38360
38989
|
] })
|
|
38361
38990
|
] }),
|
|
38362
|
-
unreadRow && /* @__PURE__ */
|
|
38991
|
+
unreadRow && /* @__PURE__ */ jsx161("span", { className: "ods-inbox__dot", "aria-hidden": "true" })
|
|
38363
38992
|
] });
|
|
38364
|
-
return /* @__PURE__ */
|
|
38993
|
+
return /* @__PURE__ */ jsxs153(
|
|
38365
38994
|
"li",
|
|
38366
38995
|
{
|
|
38367
38996
|
className: cn(
|
|
@@ -38374,7 +39003,7 @@ function NotificationInbox({
|
|
|
38374
39003
|
children: [
|
|
38375
39004
|
action.kind === "link" && action.href ? (
|
|
38376
39005
|
// A real anchor: middle-click, copy link and keyboard all work.
|
|
38377
|
-
/* @__PURE__ */
|
|
39006
|
+
/* @__PURE__ */ jsx161(
|
|
38378
39007
|
"a",
|
|
38379
39008
|
{
|
|
38380
39009
|
className: "ods-inbox__main",
|
|
@@ -38389,7 +39018,7 @@ function NotificationInbox({
|
|
|
38389
39018
|
children: inner
|
|
38390
39019
|
}
|
|
38391
39020
|
)
|
|
38392
|
-
) : /* @__PURE__ */
|
|
39021
|
+
) : /* @__PURE__ */ jsx161(
|
|
38393
39022
|
"button",
|
|
38394
39023
|
{
|
|
38395
39024
|
type: "button",
|
|
@@ -38401,25 +39030,25 @@ function NotificationInbox({
|
|
|
38401
39030
|
children: inner
|
|
38402
39031
|
}
|
|
38403
39032
|
),
|
|
38404
|
-
!compact && (onMarkRead || onArchive) && !item.archivedAt && /* @__PURE__ */
|
|
38405
|
-
onMarkRead && unreadRow && /* @__PURE__ */
|
|
39033
|
+
!compact && (onMarkRead || onArchive) && !item.archivedAt && /* @__PURE__ */ jsxs153("span", { className: "ods-inbox__actions", children: [
|
|
39034
|
+
onMarkRead && unreadRow && /* @__PURE__ */ jsx161(
|
|
38406
39035
|
Button,
|
|
38407
39036
|
{
|
|
38408
39037
|
size: "sm",
|
|
38409
39038
|
variant: "ghost",
|
|
38410
39039
|
"aria-label": "Mark as read",
|
|
38411
39040
|
onClick: () => onMarkRead([item.id]),
|
|
38412
|
-
children: /* @__PURE__ */
|
|
39041
|
+
children: /* @__PURE__ */ jsx161(CheckmarkIcon16, { size: "sm", "aria-hidden": "true" })
|
|
38413
39042
|
}
|
|
38414
39043
|
),
|
|
38415
|
-
onArchive && /* @__PURE__ */
|
|
39044
|
+
onArchive && /* @__PURE__ */ jsx161(
|
|
38416
39045
|
Button,
|
|
38417
39046
|
{
|
|
38418
39047
|
size: "sm",
|
|
38419
39048
|
variant: "ghost",
|
|
38420
39049
|
"aria-label": "Archive",
|
|
38421
39050
|
onClick: () => onArchive([item.id]),
|
|
38422
|
-
children: /* @__PURE__ */
|
|
39051
|
+
children: /* @__PURE__ */ jsx161(ArchiveIcon3, { size: "sm", "aria-hidden": "true" })
|
|
38423
39052
|
}
|
|
38424
39053
|
)
|
|
38425
39054
|
] })
|
|
@@ -38428,9 +39057,9 @@ function NotificationInbox({
|
|
|
38428
39057
|
item.id
|
|
38429
39058
|
);
|
|
38430
39059
|
};
|
|
38431
|
-
return /* @__PURE__ */
|
|
38432
|
-
!compact && /* @__PURE__ */
|
|
38433
|
-
/* @__PURE__ */
|
|
39060
|
+
return /* @__PURE__ */ jsxs153("div", { className: cn("ods-inbox", compact && "ods-inbox--compact", className), children: [
|
|
39061
|
+
!compact && /* @__PURE__ */ jsxs153("div", { className: "ods-inbox__toolbar", children: [
|
|
39062
|
+
/* @__PURE__ */ jsx161(
|
|
38434
39063
|
SegmentedControl,
|
|
38435
39064
|
{
|
|
38436
39065
|
"aria-label": "Filter",
|
|
@@ -38440,22 +39069,22 @@ function NotificationInbox({
|
|
|
38440
39069
|
onChange: (v) => setFilter(v)
|
|
38441
39070
|
}
|
|
38442
39071
|
),
|
|
38443
|
-
/* @__PURE__ */
|
|
38444
|
-
onMarkAllRead && unread > 0 && /* @__PURE__ */
|
|
39072
|
+
/* @__PURE__ */ jsx161("span", { className: "ods-inbox__unread", "aria-live": "polite", children: unread === 0 ? "All caught up" : `${unread} unread` }),
|
|
39073
|
+
onMarkAllRead && unread > 0 && /* @__PURE__ */ jsx161(Button, { size: "sm", variant: "ghost", onClick: onMarkAllRead, children: "Mark all read" })
|
|
38445
39074
|
] }),
|
|
38446
|
-
visible.length === 0 ? /* @__PURE__ */
|
|
39075
|
+
visible.length === 0 ? /* @__PURE__ */ jsx161(
|
|
38447
39076
|
EmptyState,
|
|
38448
39077
|
{
|
|
38449
39078
|
size: compact ? "sm" : "md",
|
|
38450
|
-
icon: /* @__PURE__ */
|
|
39079
|
+
icon: /* @__PURE__ */ jsx161(NotificationOffIcon, { "aria-hidden": "true" }),
|
|
38451
39080
|
title: emptyTitle ?? (activeFilter === "unread" ? "You're all caught up" : activeFilter === "archived" ? "Nothing archived" : "No notifications yet"),
|
|
38452
39081
|
description: emptyDescription ?? (activeFilter === "all" ? "Run failures, apps that need re-authentication and account activity will show up here." : void 0)
|
|
38453
39082
|
}
|
|
38454
|
-
) : showDays ? /* @__PURE__ */
|
|
38455
|
-
/* @__PURE__ */
|
|
38456
|
-
/* @__PURE__ */
|
|
38457
|
-
] }, group.key)) }) : /* @__PURE__ */
|
|
38458
|
-
detailDialog && /* @__PURE__ */
|
|
39083
|
+
) : showDays ? /* @__PURE__ */ jsx161("div", { className: "ods-inbox__groups", children: groups.map((group) => /* @__PURE__ */ jsxs153("section", { className: "ods-inbox__group", "aria-label": group.label, children: [
|
|
39084
|
+
/* @__PURE__ */ jsx161("h4", { className: "ods-inbox__day", children: group.label }),
|
|
39085
|
+
/* @__PURE__ */ jsx161("ul", { className: "ods-inbox__rows", children: group.items.map(renderRow) })
|
|
39086
|
+
] }, group.key)) }) : /* @__PURE__ */ jsx161("ul", { className: "ods-inbox__rows", children: visible.map(renderRow) }),
|
|
39087
|
+
detailDialog && /* @__PURE__ */ jsx161(
|
|
38459
39088
|
NotificationDetailDialog,
|
|
38460
39089
|
{
|
|
38461
39090
|
item: detailItem,
|
|
@@ -38472,7 +39101,7 @@ function NotificationInbox({
|
|
|
38472
39101
|
NotificationInbox.displayName = "NotificationInbox";
|
|
38473
39102
|
|
|
38474
39103
|
// src/notifications/components/NotificationBell/NotificationBell.tsx
|
|
38475
|
-
import { Fragment as Fragment67, jsx as
|
|
39104
|
+
import { Fragment as Fragment67, jsx as jsx162, jsxs as jsxs154 } from "react/jsx-runtime";
|
|
38476
39105
|
function NotificationBell({
|
|
38477
39106
|
items,
|
|
38478
39107
|
unreadCount,
|
|
@@ -38495,23 +39124,23 @@ function NotificationBell({
|
|
|
38495
39124
|
const unread = unreadCount ?? countUnread(items);
|
|
38496
39125
|
const hasUnread = unread > 0;
|
|
38497
39126
|
const countLabel = unread > 99 ? "99+" : String(unread);
|
|
38498
|
-
const [internalOpen, setInternalOpen] =
|
|
39127
|
+
const [internalOpen, setInternalOpen] = useState82(false);
|
|
38499
39128
|
const isOpen = open ?? internalOpen;
|
|
38500
|
-
const setOpen =
|
|
39129
|
+
const setOpen = useCallback59(
|
|
38501
39130
|
(next) => {
|
|
38502
39131
|
if (open === void 0) setInternalOpen(next);
|
|
38503
39132
|
onOpenChange?.(next);
|
|
38504
39133
|
},
|
|
38505
39134
|
[open, onOpenChange]
|
|
38506
39135
|
);
|
|
38507
|
-
const [detailItem, setDetailItem] =
|
|
39136
|
+
const [detailItem, setDetailItem] = useState82(null);
|
|
38508
39137
|
const handleOpenItem = (item, action) => {
|
|
38509
39138
|
setOpen(false);
|
|
38510
39139
|
if (action.kind === "modal") setDetailItem(item);
|
|
38511
39140
|
onOpenItem?.(item, action);
|
|
38512
39141
|
};
|
|
38513
|
-
return /* @__PURE__ */
|
|
38514
|
-
/* @__PURE__ */
|
|
39142
|
+
return /* @__PURE__ */ jsxs154(Fragment67, { children: [
|
|
39143
|
+
/* @__PURE__ */ jsx162(
|
|
38515
39144
|
Popover,
|
|
38516
39145
|
{
|
|
38517
39146
|
open: isOpen,
|
|
@@ -38520,14 +39149,14 @@ function NotificationBell({
|
|
|
38520
39149
|
align,
|
|
38521
39150
|
"aria-label": label,
|
|
38522
39151
|
className: cn("ods-notif-bell__popover", className),
|
|
38523
|
-
content: /* @__PURE__ */
|
|
38524
|
-
/* @__PURE__ */
|
|
38525
|
-
/* @__PURE__ */
|
|
38526
|
-
/* @__PURE__ */
|
|
39152
|
+
content: /* @__PURE__ */ jsxs154("div", { className: "ods-notif-bell__panel", children: [
|
|
39153
|
+
/* @__PURE__ */ jsxs154("div", { className: "ods-notif-bell__head", children: [
|
|
39154
|
+
/* @__PURE__ */ jsx162("h3", { className: "ods-notif-bell__title", children: label }),
|
|
39155
|
+
/* @__PURE__ */ jsx162("span", { className: "ods-notif-bell__spacer" }),
|
|
38527
39156
|
onMarkAllRead && // Always offered so the control is discoverable; disabled (not
|
|
38528
39157
|
// hidden) when there's nothing unread, so it never appears to
|
|
38529
39158
|
// vanish between visits.
|
|
38530
|
-
/* @__PURE__ */
|
|
39159
|
+
/* @__PURE__ */ jsx162(
|
|
38531
39160
|
Button,
|
|
38532
39161
|
{
|
|
38533
39162
|
size: "sm",
|
|
@@ -38538,7 +39167,7 @@ function NotificationBell({
|
|
|
38538
39167
|
}
|
|
38539
39168
|
)
|
|
38540
39169
|
] }),
|
|
38541
|
-
/* @__PURE__ */
|
|
39170
|
+
/* @__PURE__ */ jsx162("div", { className: "ods-notif-bell__body", children: /* @__PURE__ */ jsx162(
|
|
38542
39171
|
NotificationInbox,
|
|
38543
39172
|
{
|
|
38544
39173
|
items,
|
|
@@ -38554,7 +39183,7 @@ function NotificationBell({
|
|
|
38554
39183
|
emptyDescription: void 0
|
|
38555
39184
|
}
|
|
38556
39185
|
) }),
|
|
38557
|
-
onViewAll && /* @__PURE__ */
|
|
39186
|
+
onViewAll && /* @__PURE__ */ jsx162("div", { className: "ods-notif-bell__foot", children: /* @__PURE__ */ jsx162(
|
|
38558
39187
|
Button,
|
|
38559
39188
|
{
|
|
38560
39189
|
size: "sm",
|
|
@@ -38567,22 +39196,22 @@ function NotificationBell({
|
|
|
38567
39196
|
}
|
|
38568
39197
|
) })
|
|
38569
39198
|
] }),
|
|
38570
|
-
children: /* @__PURE__ */
|
|
38571
|
-
/* @__PURE__ */
|
|
39199
|
+
children: /* @__PURE__ */ jsxs154("span", { className: cn("ods-notif-bell", hasUnread && "ods-notif-bell--unread"), children: [
|
|
39200
|
+
/* @__PURE__ */ jsx162(
|
|
38572
39201
|
Button,
|
|
38573
39202
|
{
|
|
38574
39203
|
variant: "icon",
|
|
38575
39204
|
size: "md",
|
|
38576
39205
|
className: "ods-notif-bell__trigger",
|
|
38577
39206
|
"aria-label": hasUnread ? `${label}, ${countLabel} unread` : label,
|
|
38578
|
-
children: /* @__PURE__ */
|
|
39207
|
+
children: /* @__PURE__ */ jsx162(NotificationIcon2, { size: "sm", "aria-hidden": "true" })
|
|
38579
39208
|
}
|
|
38580
39209
|
),
|
|
38581
|
-
hasUnread && /* @__PURE__ */
|
|
39210
|
+
hasUnread && /* @__PURE__ */ jsx162("span", { className: "ods-notif-bell__count", "aria-hidden": "true", children: countLabel })
|
|
38582
39211
|
] })
|
|
38583
39212
|
}
|
|
38584
39213
|
),
|
|
38585
|
-
/* @__PURE__ */
|
|
39214
|
+
/* @__PURE__ */ jsx162(
|
|
38586
39215
|
NotificationDetailDialog,
|
|
38587
39216
|
{
|
|
38588
39217
|
item: detailItem,
|
|
@@ -38600,7 +39229,7 @@ NotificationBell.displayName = "NotificationBell";
|
|
|
38600
39229
|
|
|
38601
39230
|
// src/notifications/components/NotificationChannelCard/NotificationChannelCard.tsx
|
|
38602
39231
|
import { EditIcon, SendIcon, TrashCanIcon as TrashCanIcon3 } from "@octaviaflow/icons";
|
|
38603
|
-
import { jsx as
|
|
39232
|
+
import { jsx as jsx163, jsxs as jsxs155 } from "react/jsx-runtime";
|
|
38604
39233
|
function NotificationChannelCard({
|
|
38605
39234
|
channel,
|
|
38606
39235
|
onTest,
|
|
@@ -38621,7 +39250,7 @@ function NotificationChannelCard({
|
|
|
38621
39250
|
now2
|
|
38622
39251
|
);
|
|
38623
39252
|
const inApp = channel.type === "in_app";
|
|
38624
|
-
return /* @__PURE__ */
|
|
39253
|
+
return /* @__PURE__ */ jsxs155(
|
|
38625
39254
|
"article",
|
|
38626
39255
|
{
|
|
38627
39256
|
className: cn(
|
|
@@ -38633,30 +39262,30 @@ function NotificationChannelCard({
|
|
|
38633
39262
|
"data-status": channel.enabled ? channel.status : "disabled",
|
|
38634
39263
|
"aria-label": `${channel.label} (${type.label})`,
|
|
38635
39264
|
children: [
|
|
38636
|
-
/* @__PURE__ */
|
|
38637
|
-
/* @__PURE__ */
|
|
38638
|
-
/* @__PURE__ */
|
|
38639
|
-
/* @__PURE__ */
|
|
38640
|
-
/* @__PURE__ */
|
|
39265
|
+
/* @__PURE__ */ jsxs155("header", { className: "ods-notif-channel__head", children: [
|
|
39266
|
+
/* @__PURE__ */ jsx163("span", { className: "ods-notif-channel__icon", "aria-hidden": "true", children: icon ?? type.icon }),
|
|
39267
|
+
/* @__PURE__ */ jsxs155("span", { className: "ods-notif-channel__titles", children: [
|
|
39268
|
+
/* @__PURE__ */ jsx163("span", { className: "ods-notif-channel__label", children: channel.label }),
|
|
39269
|
+
/* @__PURE__ */ jsxs155("span", { className: "ods-notif-channel__type", children: [
|
|
38641
39270
|
type.label,
|
|
38642
39271
|
channel.instanceLabel ? ` \xB7 ${channel.instanceLabel}` : ""
|
|
38643
39272
|
] })
|
|
38644
39273
|
] }),
|
|
38645
|
-
/* @__PURE__ */
|
|
39274
|
+
/* @__PURE__ */ jsx163(Badge, { size: "sm", variant: status.variant, dot: true, children: status.label })
|
|
38646
39275
|
] }),
|
|
38647
|
-
(channel.target || inApp) && /* @__PURE__ */
|
|
38648
|
-
/* @__PURE__ */
|
|
39276
|
+
(channel.target || inApp) && /* @__PURE__ */ jsx163("div", { className: "ods-notif-channel__target", title: channel.target, children: inApp ? "Every member's bell and inbox" : channel.target }),
|
|
39277
|
+
/* @__PURE__ */ jsx163("div", { className: "ods-notif-channel__meta", children: channel.status === "failing" && channel.lastError ? /* @__PURE__ */ jsx163("span", { className: "ods-notif-channel__error", title: channel.lastError, children: channel.lastError }) : last ? /* @__PURE__ */ jsxs155("span", { children: [
|
|
38649
39278
|
"Last delivery ",
|
|
38650
39279
|
last
|
|
38651
|
-
] }) : /* @__PURE__ */
|
|
38652
|
-
testResult && /* @__PURE__ */
|
|
38653
|
-
!readOnly && !inApp && /* @__PURE__ */
|
|
38654
|
-
onTest && /* @__PURE__ */
|
|
39280
|
+
] }) : /* @__PURE__ */ jsx163("span", { children: "No deliveries yet" }) }),
|
|
39281
|
+
testResult && /* @__PURE__ */ jsx163(InlineMessage, { tone: testResult.ok ? "success" : "danger", size: "sm", live: "polite", children: testResult.message ?? (testResult.ok ? "Test message delivered." : "Test failed.") }),
|
|
39282
|
+
!readOnly && !inApp && /* @__PURE__ */ jsxs155("footer", { className: "ods-notif-channel__actions", children: [
|
|
39283
|
+
onTest && /* @__PURE__ */ jsx163(
|
|
38655
39284
|
Button,
|
|
38656
39285
|
{
|
|
38657
39286
|
size: "sm",
|
|
38658
39287
|
variant: "secondary",
|
|
38659
|
-
leftIcon: /* @__PURE__ */
|
|
39288
|
+
leftIcon: /* @__PURE__ */ jsx163(SendIcon, { size: "sm", "aria-hidden": "true" }),
|
|
38660
39289
|
loading: testing,
|
|
38661
39290
|
loadingText: "Sending\u2026",
|
|
38662
39291
|
disabled: !channel.enabled,
|
|
@@ -38664,18 +39293,18 @@ function NotificationChannelCard({
|
|
|
38664
39293
|
children: "Send test"
|
|
38665
39294
|
}
|
|
38666
39295
|
),
|
|
38667
|
-
/* @__PURE__ */
|
|
38668
|
-
onEdit && /* @__PURE__ */
|
|
39296
|
+
/* @__PURE__ */ jsx163("span", { className: "ods-notif-channel__spacer" }),
|
|
39297
|
+
onEdit && /* @__PURE__ */ jsx163(
|
|
38669
39298
|
Button,
|
|
38670
39299
|
{
|
|
38671
39300
|
size: "sm",
|
|
38672
39301
|
variant: "ghost",
|
|
38673
39302
|
"aria-label": `Edit ${channel.label}`,
|
|
38674
39303
|
onClick: () => onEdit(channel),
|
|
38675
|
-
children: /* @__PURE__ */
|
|
39304
|
+
children: /* @__PURE__ */ jsx163(EditIcon, { size: "sm", "aria-hidden": "true" })
|
|
38676
39305
|
}
|
|
38677
39306
|
),
|
|
38678
|
-
onRemove && /* @__PURE__ */
|
|
39307
|
+
onRemove && /* @__PURE__ */ jsx163(
|
|
38679
39308
|
Button,
|
|
38680
39309
|
{
|
|
38681
39310
|
size: "sm",
|
|
@@ -38683,10 +39312,10 @@ function NotificationChannelCard({
|
|
|
38683
39312
|
"aria-label": `Remove ${channel.label}`,
|
|
38684
39313
|
className: "ods-notif-channel__remove",
|
|
38685
39314
|
onClick: () => onRemove(channel),
|
|
38686
|
-
children: /* @__PURE__ */
|
|
39315
|
+
children: /* @__PURE__ */ jsx163(TrashCanIcon3, { size: "sm", "aria-hidden": "true" })
|
|
38687
39316
|
}
|
|
38688
39317
|
),
|
|
38689
|
-
onToggle && /* @__PURE__ */
|
|
39318
|
+
onToggle && /* @__PURE__ */ jsx163(
|
|
38690
39319
|
Switch,
|
|
38691
39320
|
{
|
|
38692
39321
|
size: "sm",
|
|
@@ -38704,7 +39333,7 @@ NotificationChannelCard.displayName = "NotificationChannelCard";
|
|
|
38704
39333
|
|
|
38705
39334
|
// src/notifications/components/NotificationChannelDialog/NotificationChannelDialog.tsx
|
|
38706
39335
|
import { SendIcon as SendIcon2 } from "@octaviaflow/icons";
|
|
38707
|
-
import { useEffect as
|
|
39336
|
+
import { useEffect as useEffect61, useMemo as useMemo43, useState as useState84 } from "react";
|
|
38708
39337
|
|
|
38709
39338
|
// src/notifications/engine/channels.ts
|
|
38710
39339
|
var CONNECTED_CHANNEL_TYPES = [
|
|
@@ -38810,8 +39439,8 @@ function draftFromChannel(channel, fallbackType = "slack") {
|
|
|
38810
39439
|
|
|
38811
39440
|
// src/notifications/components/NotificationChannelForm/NotificationChannelForm.tsx
|
|
38812
39441
|
import { AddIcon as AddIcon6, CheckmarkFilledIcon as CheckmarkFilledIcon3, LaunchIcon as LaunchIcon2 } from "@octaviaflow/icons";
|
|
38813
|
-
import { useId as
|
|
38814
|
-
import { jsx as
|
|
39442
|
+
import { useId as useId68, useState as useState83 } from "react";
|
|
39443
|
+
import { jsx as jsx164, jsxs as jsxs156 } from "react/jsx-runtime";
|
|
38815
39444
|
var DEFAULT_TYPES = [
|
|
38816
39445
|
"slack",
|
|
38817
39446
|
"email",
|
|
@@ -38850,11 +39479,11 @@ function NotificationChannelForm({
|
|
|
38850
39479
|
className,
|
|
38851
39480
|
id
|
|
38852
39481
|
}) {
|
|
38853
|
-
const reactId =
|
|
39482
|
+
const reactId = useId68();
|
|
38854
39483
|
const baseId = id ?? `${reactId}-channel`;
|
|
38855
39484
|
const typeMeta = CHANNEL_TYPE_META[value.type];
|
|
38856
39485
|
const patch = (next) => onChange({ ...value, ...next });
|
|
38857
|
-
const [touched, setTouched] =
|
|
39486
|
+
const [touched, setTouched] = useState83({});
|
|
38858
39487
|
const touch = (field) => setTouched((t) => t[field] ? t : { ...t, [field]: true });
|
|
38859
39488
|
const errorFor = (field) => errors?.[field] && (showAllErrors || touched[field]) ? errors[field] : void 0;
|
|
38860
39489
|
const errorText = (field) => {
|
|
@@ -38870,7 +39499,7 @@ function NotificationChannelForm({
|
|
|
38870
39499
|
const targetLabel = targetOptions?.find((o) => o.value === value.target)?.label;
|
|
38871
39500
|
const summary = describeChannelDraft(value, instances, targetLabel);
|
|
38872
39501
|
const suggestedLabel = suggestChannelLabel(value, instances, targetLabel);
|
|
38873
|
-
const [recipientDraft, setRecipientDraft] =
|
|
39502
|
+
const [recipientDraft, setRecipientDraft] = useState83("");
|
|
38874
39503
|
const recipients = value.recipients ?? [];
|
|
38875
39504
|
const commitRecipient = () => {
|
|
38876
39505
|
const parts = recipientDraft.split(/[,\s;]+/).map((s) => s.trim()).filter(Boolean);
|
|
@@ -38894,20 +39523,20 @@ function NotificationChannelForm({
|
|
|
38894
39523
|
onChange({ type, label: value.label, id: value.id });
|
|
38895
39524
|
setTouched({});
|
|
38896
39525
|
};
|
|
38897
|
-
const stepTitle = (n, title, hint) => /* @__PURE__ */
|
|
38898
|
-
numbered && /* @__PURE__ */
|
|
38899
|
-
/* @__PURE__ */
|
|
38900
|
-
hint && /* @__PURE__ */
|
|
39526
|
+
const stepTitle = (n, title, hint) => /* @__PURE__ */ jsxs156("legend", { className: "ods-notif-channel-form__legend", children: [
|
|
39527
|
+
numbered && /* @__PURE__ */ jsx164("span", { className: "ods-notif-channel-form__step-num", children: n }),
|
|
39528
|
+
/* @__PURE__ */ jsx164("span", { className: "ods-notif-channel-form__step-title", children: title }),
|
|
39529
|
+
hint && /* @__PURE__ */ jsx164("span", { className: "ods-notif-channel-form__step-hint", children: hint })
|
|
38901
39530
|
] });
|
|
38902
39531
|
const destinationHint = typeMeta.connected ? "Pick a connected app, then where it should post." : value.type === "email" ? "Who should receive these emails?" : "Where should we send the signed JSON?";
|
|
38903
|
-
return /* @__PURE__ */
|
|
38904
|
-
/* @__PURE__ */
|
|
39532
|
+
return /* @__PURE__ */ jsxs156("div", { className: cn("ods-notif-channel-form", className), "data-size": size, id: baseId, children: [
|
|
39533
|
+
/* @__PURE__ */ jsxs156("fieldset", { className: "ods-notif-channel-form__section", children: [
|
|
38905
39534
|
stepTitle(1, "Type", lockType ? "Type cannot change after creation." : void 0),
|
|
38906
|
-
/* @__PURE__ */
|
|
39535
|
+
/* @__PURE__ */ jsx164("div", { className: "ods-notif-channel-form__types", role: "radiogroup", "aria-label": "Channel type", children: types.map((type) => {
|
|
38907
39536
|
const meta2 = CHANNEL_TYPE_META[type];
|
|
38908
39537
|
const selected = type === value.type;
|
|
38909
39538
|
const hasApp = !meta2.connected || instances.some((i) => i.type === type);
|
|
38910
|
-
return /* @__PURE__ */
|
|
39539
|
+
return /* @__PURE__ */ jsxs156(
|
|
38911
39540
|
"button",
|
|
38912
39541
|
{
|
|
38913
39542
|
type: "button",
|
|
@@ -38920,28 +39549,28 @@ function NotificationChannelForm({
|
|
|
38920
39549
|
disabled: readOnly || lockType && !selected,
|
|
38921
39550
|
onClick: () => selectType(type),
|
|
38922
39551
|
children: [
|
|
38923
|
-
/* @__PURE__ */
|
|
38924
|
-
/* @__PURE__ */
|
|
38925
|
-
/* @__PURE__ */
|
|
38926
|
-
/* @__PURE__ */
|
|
39552
|
+
/* @__PURE__ */ jsx164("span", { className: "ods-notif-channel-form__type-icon", "aria-hidden": "true", children: meta2.icon }),
|
|
39553
|
+
/* @__PURE__ */ jsxs156("span", { className: "ods-notif-channel-form__type-text", children: [
|
|
39554
|
+
/* @__PURE__ */ jsx164("span", { className: "ods-notif-channel-form__type-label", children: meta2.label }),
|
|
39555
|
+
/* @__PURE__ */ jsx164("span", { className: "ods-notif-channel-form__type-hint", children: meta2.connected && hasApp ? "Connected" : meta2.hint })
|
|
38927
39556
|
] }),
|
|
38928
|
-
selected && /* @__PURE__ */
|
|
39557
|
+
selected && /* @__PURE__ */ jsx164("span", { className: "ods-notif-channel-form__type-check", "aria-hidden": "true", children: /* @__PURE__ */ jsx164(CheckmarkFilledIcon3, { size: "sm" }) })
|
|
38929
39558
|
]
|
|
38930
39559
|
},
|
|
38931
39560
|
type
|
|
38932
39561
|
);
|
|
38933
39562
|
}) })
|
|
38934
39563
|
] }),
|
|
38935
|
-
/* @__PURE__ */
|
|
39564
|
+
/* @__PURE__ */ jsxs156("fieldset", { className: "ods-notif-channel-form__section", children: [
|
|
38936
39565
|
stepTitle(2, "Destination", destinationHint),
|
|
38937
|
-
typeMeta.connected && (forType.length === 0 ? /* @__PURE__ */
|
|
38938
|
-
/* @__PURE__ */
|
|
38939
|
-
onConnectNew && !readOnly && /* @__PURE__ */
|
|
39566
|
+
typeMeta.connected && (forType.length === 0 ? /* @__PURE__ */ jsxs156(Callout, { variant: "info", size: "sm", title: `No ${typeMeta.label} app connected yet`, children: [
|
|
39567
|
+
/* @__PURE__ */ jsx164("p", { className: "ods-notif-channel-form__p", children: "Connect one first \u2014 it takes a minute, and flows can use the same connection." }),
|
|
39568
|
+
onConnectNew && !readOnly && /* @__PURE__ */ jsxs156(
|
|
38940
39569
|
Button,
|
|
38941
39570
|
{
|
|
38942
39571
|
size: "sm",
|
|
38943
39572
|
variant: "primary",
|
|
38944
|
-
leftIcon: /* @__PURE__ */
|
|
39573
|
+
leftIcon: /* @__PURE__ */ jsx164(LaunchIcon2, { size: "sm", "aria-hidden": "true" }),
|
|
38945
39574
|
onClick: () => onConnectNew(value.type),
|
|
38946
39575
|
children: [
|
|
38947
39576
|
"Connect ",
|
|
@@ -38949,9 +39578,9 @@ function NotificationChannelForm({
|
|
|
38949
39578
|
]
|
|
38950
39579
|
}
|
|
38951
39580
|
)
|
|
38952
|
-
] }) : /* @__PURE__ */
|
|
38953
|
-
/* @__PURE__ */
|
|
38954
|
-
/* @__PURE__ */
|
|
39581
|
+
] }) : /* @__PURE__ */ jsxs156("div", { className: "ods-notif-channel-form__grid", children: [
|
|
39582
|
+
/* @__PURE__ */ jsxs156("div", { className: "ods-notif-channel-form__row", children: [
|
|
39583
|
+
/* @__PURE__ */ jsx164(
|
|
38955
39584
|
Select,
|
|
38956
39585
|
{
|
|
38957
39586
|
id: `${baseId}-instance`,
|
|
@@ -38970,12 +39599,12 @@ function NotificationChannelForm({
|
|
|
38970
39599
|
className: "ods-notif-channel-form__grow"
|
|
38971
39600
|
}
|
|
38972
39601
|
),
|
|
38973
|
-
onConnectNew && !readOnly && /* @__PURE__ */
|
|
39602
|
+
onConnectNew && !readOnly && /* @__PURE__ */ jsx164(
|
|
38974
39603
|
Button,
|
|
38975
39604
|
{
|
|
38976
39605
|
size,
|
|
38977
39606
|
variant: "ghost",
|
|
38978
|
-
leftIcon: /* @__PURE__ */
|
|
39607
|
+
leftIcon: /* @__PURE__ */ jsx164(AddIcon6, { size: "sm", "aria-hidden": "true" }),
|
|
38979
39608
|
onClick: () => onConnectNew(value.type),
|
|
38980
39609
|
className: "ods-notif-channel-form__connect",
|
|
38981
39610
|
children: "Connect new"
|
|
@@ -38987,7 +39616,7 @@ function NotificationChannelForm({
|
|
|
38987
39616
|
// modal whose focus scope would pull focus straight back
|
|
38988
39617
|
// out of a portaled search box. The Combobox input stays
|
|
38989
39618
|
// inside the dialog; only its list is portaled.
|
|
38990
|
-
/* @__PURE__ */
|
|
39619
|
+
/* @__PURE__ */ jsx164(
|
|
38991
39620
|
Combobox,
|
|
38992
39621
|
{
|
|
38993
39622
|
id: `${baseId}-target`,
|
|
@@ -39005,7 +39634,7 @@ function NotificationChannelForm({
|
|
|
39005
39634
|
size
|
|
39006
39635
|
}
|
|
39007
39636
|
)
|
|
39008
|
-
) : /* @__PURE__ */
|
|
39637
|
+
) : /* @__PURE__ */ jsx164(
|
|
39009
39638
|
Input,
|
|
39010
39639
|
{
|
|
39011
39640
|
id: `${baseId}-target`,
|
|
@@ -39021,9 +39650,9 @@ function NotificationChannelForm({
|
|
|
39021
39650
|
}
|
|
39022
39651
|
))
|
|
39023
39652
|
] })),
|
|
39024
|
-
value.type === "email" && /* @__PURE__ */
|
|
39025
|
-
/* @__PURE__ */
|
|
39026
|
-
/* @__PURE__ */
|
|
39653
|
+
value.type === "email" && /* @__PURE__ */ jsxs156("div", { className: "ods-notif-channel-form__field", children: [
|
|
39654
|
+
/* @__PURE__ */ jsx164("label", { className: "ods-notif-channel-form__label", htmlFor: `${baseId}-recipient`, children: "Recipients" }),
|
|
39655
|
+
/* @__PURE__ */ jsxs156(
|
|
39027
39656
|
"div",
|
|
39028
39657
|
{
|
|
39029
39658
|
className: cn(
|
|
@@ -39031,7 +39660,7 @@ function NotificationChannelForm({
|
|
|
39031
39660
|
errorFor("recipients") && "ods-notif-channel-form__recipients--error"
|
|
39032
39661
|
),
|
|
39033
39662
|
children: [
|
|
39034
|
-
recipients.map((r) => /* @__PURE__ */
|
|
39663
|
+
recipients.map((r) => /* @__PURE__ */ jsx164(
|
|
39035
39664
|
Chip,
|
|
39036
39665
|
{
|
|
39037
39666
|
size: "sm",
|
|
@@ -39042,7 +39671,7 @@ function NotificationChannelForm({
|
|
|
39042
39671
|
},
|
|
39043
39672
|
r
|
|
39044
39673
|
)),
|
|
39045
|
-
/* @__PURE__ */
|
|
39674
|
+
/* @__PURE__ */ jsx164(
|
|
39046
39675
|
"input",
|
|
39047
39676
|
{
|
|
39048
39677
|
id: `${baseId}-recipient`,
|
|
@@ -39060,7 +39689,7 @@ function NotificationChannelForm({
|
|
|
39060
39689
|
]
|
|
39061
39690
|
}
|
|
39062
39691
|
),
|
|
39063
|
-
/* @__PURE__ */
|
|
39692
|
+
/* @__PURE__ */ jsx164(
|
|
39064
39693
|
"div",
|
|
39065
39694
|
{
|
|
39066
39695
|
className: cn(
|
|
@@ -39071,7 +39700,7 @@ function NotificationChannelForm({
|
|
|
39071
39700
|
}
|
|
39072
39701
|
)
|
|
39073
39702
|
] }),
|
|
39074
|
-
value.type === "webhook" && /* @__PURE__ */
|
|
39703
|
+
value.type === "webhook" && /* @__PURE__ */ jsx164(
|
|
39075
39704
|
Input,
|
|
39076
39705
|
{
|
|
39077
39706
|
id: `${baseId}-url`,
|
|
@@ -39088,7 +39717,7 @@ function NotificationChannelForm({
|
|
|
39088
39717
|
size
|
|
39089
39718
|
}
|
|
39090
39719
|
),
|
|
39091
|
-
value.type === "whatsapp" && /* @__PURE__ */
|
|
39720
|
+
value.type === "whatsapp" && /* @__PURE__ */ jsx164(
|
|
39092
39721
|
Input,
|
|
39093
39722
|
{
|
|
39094
39723
|
id: `${baseId}-target`,
|
|
@@ -39106,9 +39735,9 @@ function NotificationChannelForm({
|
|
|
39106
39735
|
}
|
|
39107
39736
|
)
|
|
39108
39737
|
] }),
|
|
39109
|
-
/* @__PURE__ */
|
|
39738
|
+
/* @__PURE__ */ jsxs156("fieldset", { className: "ods-notif-channel-form__section", children: [
|
|
39110
39739
|
stepTitle(3, "Name", "How this channel appears in rules and the activity log."),
|
|
39111
|
-
/* @__PURE__ */
|
|
39740
|
+
/* @__PURE__ */ jsx164(
|
|
39112
39741
|
Input,
|
|
39113
39742
|
{
|
|
39114
39743
|
id: `${baseId}-label`,
|
|
@@ -39125,16 +39754,16 @@ function NotificationChannelForm({
|
|
|
39125
39754
|
}
|
|
39126
39755
|
)
|
|
39127
39756
|
] }),
|
|
39128
|
-
showSummary && summary && /* @__PURE__ */
|
|
39129
|
-
/* @__PURE__ */
|
|
39130
|
-
/* @__PURE__ */
|
|
39757
|
+
showSummary && summary && /* @__PURE__ */ jsxs156("div", { className: "ods-notif-channel-form__summary", "aria-live": "polite", children: [
|
|
39758
|
+
/* @__PURE__ */ jsx164(CheckmarkFilledIcon3, { size: "sm", "aria-hidden": "true" }),
|
|
39759
|
+
/* @__PURE__ */ jsx164("span", { children: summary })
|
|
39131
39760
|
] })
|
|
39132
39761
|
] });
|
|
39133
39762
|
}
|
|
39134
39763
|
NotificationChannelForm.displayName = "NotificationChannelForm";
|
|
39135
39764
|
|
|
39136
39765
|
// src/notifications/components/NotificationChannelDialog/NotificationChannelDialog.tsx
|
|
39137
|
-
import { jsx as
|
|
39766
|
+
import { jsx as jsx165, jsxs as jsxs157 } from "react/jsx-runtime";
|
|
39138
39767
|
function NotificationChannelDialog({
|
|
39139
39768
|
open,
|
|
39140
39769
|
onClose,
|
|
@@ -39155,14 +39784,14 @@ function NotificationChannelDialog({
|
|
|
39155
39784
|
className
|
|
39156
39785
|
}) {
|
|
39157
39786
|
const editing = Boolean(channel?.id);
|
|
39158
|
-
const [draft, setDraft] =
|
|
39787
|
+
const [draft, setDraft] = useState84(
|
|
39159
39788
|
() => draftFromChannel(channel, initialType)
|
|
39160
39789
|
);
|
|
39161
|
-
const [submitted, setSubmitted] =
|
|
39162
|
-
const [testing, setTesting] =
|
|
39163
|
-
const [testResult, setTestResult] =
|
|
39164
|
-
const [submitError, setSubmitError] =
|
|
39165
|
-
|
|
39790
|
+
const [submitted, setSubmitted] = useState84(false);
|
|
39791
|
+
const [testing, setTesting] = useState84(false);
|
|
39792
|
+
const [testResult, setTestResult] = useState84(null);
|
|
39793
|
+
const [submitError, setSubmitError] = useState84(null);
|
|
39794
|
+
useEffect61(() => {
|
|
39166
39795
|
if (!open) return;
|
|
39167
39796
|
setDraft(draftFromChannel(channel, initialType));
|
|
39168
39797
|
setSubmitted(false);
|
|
@@ -39205,7 +39834,7 @@ function NotificationChannelDialog({
|
|
|
39205
39834
|
setTesting(false);
|
|
39206
39835
|
}
|
|
39207
39836
|
};
|
|
39208
|
-
return /* @__PURE__ */
|
|
39837
|
+
return /* @__PURE__ */ jsxs157(
|
|
39209
39838
|
Dialog,
|
|
39210
39839
|
{
|
|
39211
39840
|
open,
|
|
@@ -39215,12 +39844,12 @@ function NotificationChannelDialog({
|
|
|
39215
39844
|
title: title ?? (editing ? "Edit channel" : "Add channel"),
|
|
39216
39845
|
description: description ?? (editing ? "Change where this channel posts or what it is called." : "Where should notifications go besides the in-app inbox?"),
|
|
39217
39846
|
closeOnOverlayClick: false,
|
|
39218
|
-
footer: /* @__PURE__ */
|
|
39219
|
-
onTest && /* @__PURE__ */
|
|
39847
|
+
footer: /* @__PURE__ */ jsxs157("div", { className: "ods-notif-channel-dialog__footer", children: [
|
|
39848
|
+
onTest && /* @__PURE__ */ jsx165(
|
|
39220
39849
|
Button,
|
|
39221
39850
|
{
|
|
39222
39851
|
variant: "secondary",
|
|
39223
|
-
leftIcon: /* @__PURE__ */
|
|
39852
|
+
leftIcon: /* @__PURE__ */ jsx165(SendIcon2, { size: "sm", "aria-hidden": "true" }),
|
|
39224
39853
|
loading: testing,
|
|
39225
39854
|
loadingText: "Sending\u2026",
|
|
39226
39855
|
disabled: !complete || saving,
|
|
@@ -39228,9 +39857,9 @@ function NotificationChannelDialog({
|
|
|
39228
39857
|
children: "Send test"
|
|
39229
39858
|
}
|
|
39230
39859
|
),
|
|
39231
|
-
/* @__PURE__ */
|
|
39232
|
-
/* @__PURE__ */
|
|
39233
|
-
/* @__PURE__ */
|
|
39860
|
+
/* @__PURE__ */ jsx165("span", { className: "ods-notif-channel-dialog__spacer" }),
|
|
39861
|
+
/* @__PURE__ */ jsx165(Button, { variant: "ghost", onClick: onClose, disabled: saving, children: "Cancel" }),
|
|
39862
|
+
/* @__PURE__ */ jsx165(
|
|
39234
39863
|
Button,
|
|
39235
39864
|
{
|
|
39236
39865
|
variant: "primary",
|
|
@@ -39242,7 +39871,7 @@ function NotificationChannelDialog({
|
|
|
39242
39871
|
)
|
|
39243
39872
|
] }),
|
|
39244
39873
|
children: [
|
|
39245
|
-
/* @__PURE__ */
|
|
39874
|
+
/* @__PURE__ */ jsx165(
|
|
39246
39875
|
NotificationChannelForm,
|
|
39247
39876
|
{
|
|
39248
39877
|
value: draft,
|
|
@@ -39257,7 +39886,7 @@ function NotificationChannelDialog({
|
|
|
39257
39886
|
showAllErrors: submitted
|
|
39258
39887
|
}
|
|
39259
39888
|
),
|
|
39260
|
-
(testResult || submitError) && /* @__PURE__ */
|
|
39889
|
+
(testResult || submitError) && /* @__PURE__ */ jsx165("div", { className: "ods-notif-channel-dialog__test", children: submitError ? /* @__PURE__ */ jsx165(InlineMessage, { tone: "danger", size: "sm", live: "assertive", children: submitError }) : testResult ? /* @__PURE__ */ jsx165(InlineMessage, { tone: testResult.ok ? "success" : "danger", size: "sm", live: "polite", children: testResult.message ?? (testResult.ok ? "Test message delivered." : "Test failed \u2014 check the destination.") }) : null })
|
|
39261
39890
|
]
|
|
39262
39891
|
}
|
|
39263
39892
|
);
|
|
@@ -39266,7 +39895,7 @@ NotificationChannelDialog.displayName = "NotificationChannelDialog";
|
|
|
39266
39895
|
|
|
39267
39896
|
// src/notifications/components/NotificationChannelList/NotificationChannelList.tsx
|
|
39268
39897
|
import { AddIcon as AddIcon7, ConnectIcon } from "@octaviaflow/icons";
|
|
39269
|
-
import { jsx as
|
|
39898
|
+
import { jsx as jsx166, jsxs as jsxs158 } from "react/jsx-runtime";
|
|
39270
39899
|
function NotificationChannelList({
|
|
39271
39900
|
channels,
|
|
39272
39901
|
title = "Channels",
|
|
@@ -39283,41 +39912,41 @@ function NotificationChannelList({
|
|
|
39283
39912
|
className
|
|
39284
39913
|
}) {
|
|
39285
39914
|
const canAdd = Boolean(onAdd) && !readOnly;
|
|
39286
|
-
return /* @__PURE__ */
|
|
39287
|
-
/* @__PURE__ */
|
|
39288
|
-
/* @__PURE__ */
|
|
39915
|
+
return /* @__PURE__ */ jsxs158("section", { className: cn("ods-notif-channels", className), "aria-label": "Notification channels", children: [
|
|
39916
|
+
/* @__PURE__ */ jsxs158("header", { className: "ods-notif-channels__head", children: [
|
|
39917
|
+
/* @__PURE__ */ jsxs158("h3", { className: "ods-notif-channels__title", children: [
|
|
39289
39918
|
title,
|
|
39290
|
-
/* @__PURE__ */
|
|
39919
|
+
/* @__PURE__ */ jsx166("span", { className: "ods-notif-channels__count", children: channels.length })
|
|
39291
39920
|
] }),
|
|
39292
|
-
canAdd && channels.length > 0 && /* @__PURE__ */
|
|
39921
|
+
canAdd && channels.length > 0 && /* @__PURE__ */ jsx166(
|
|
39293
39922
|
Button,
|
|
39294
39923
|
{
|
|
39295
39924
|
size: "sm",
|
|
39296
39925
|
variant: "secondary",
|
|
39297
|
-
leftIcon: /* @__PURE__ */
|
|
39926
|
+
leftIcon: /* @__PURE__ */ jsx166(AddIcon7, { size: "sm", "aria-hidden": "true" }),
|
|
39298
39927
|
onClick: onAdd,
|
|
39299
39928
|
children: "Add channel"
|
|
39300
39929
|
}
|
|
39301
39930
|
)
|
|
39302
39931
|
] }),
|
|
39303
|
-
channels.length === 0 ? /* @__PURE__ */
|
|
39932
|
+
channels.length === 0 ? /* @__PURE__ */ jsx166(
|
|
39304
39933
|
EmptyState,
|
|
39305
39934
|
{
|
|
39306
|
-
icon: /* @__PURE__ */
|
|
39935
|
+
icon: /* @__PURE__ */ jsx166(ConnectIcon, { "aria-hidden": "true" }),
|
|
39307
39936
|
title: "No channels yet",
|
|
39308
39937
|
description: "A channel is somewhere alerts go besides the in-app inbox \u2014 a Slack channel, an email address, a webhook. Add one, then point rules at it.",
|
|
39309
|
-
action: canAdd ? /* @__PURE__ */
|
|
39938
|
+
action: canAdd ? /* @__PURE__ */ jsx166(
|
|
39310
39939
|
Button,
|
|
39311
39940
|
{
|
|
39312
39941
|
variant: "primary",
|
|
39313
|
-
leftIcon: /* @__PURE__ */
|
|
39942
|
+
leftIcon: /* @__PURE__ */ jsx166(AddIcon7, { size: "sm", "aria-hidden": "true" }),
|
|
39314
39943
|
onClick: onAdd,
|
|
39315
39944
|
children: "Add channel"
|
|
39316
39945
|
}
|
|
39317
39946
|
) : void 0
|
|
39318
39947
|
}
|
|
39319
|
-
) : /* @__PURE__ */
|
|
39320
|
-
channels.map((channel) => /* @__PURE__ */
|
|
39948
|
+
) : /* @__PURE__ */ jsxs158("div", { className: "ods-notif-channels__grid", children: [
|
|
39949
|
+
channels.map((channel) => /* @__PURE__ */ jsx166(
|
|
39321
39950
|
NotificationChannelCard,
|
|
39322
39951
|
{
|
|
39323
39952
|
channel,
|
|
@@ -39333,8 +39962,8 @@ function NotificationChannelList({
|
|
|
39333
39962
|
},
|
|
39334
39963
|
channel.id
|
|
39335
39964
|
)),
|
|
39336
|
-
canAdd && /* @__PURE__ */
|
|
39337
|
-
/* @__PURE__ */
|
|
39965
|
+
canAdd && /* @__PURE__ */ jsxs158("button", { type: "button", className: "ods-notif-channels__add", onClick: onAdd, children: [
|
|
39966
|
+
/* @__PURE__ */ jsx166("span", { className: "ods-notif-channels__add-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx166(AddIcon7, { size: "sm" }) }),
|
|
39338
39967
|
"Add channel"
|
|
39339
39968
|
] })
|
|
39340
39969
|
] })
|
|
@@ -39344,7 +39973,7 @@ NotificationChannelList.displayName = "NotificationChannelList";
|
|
|
39344
39973
|
|
|
39345
39974
|
// src/notifications/components/NotificationPreferenceMatrix/NotificationPreferenceMatrix.tsx
|
|
39346
39975
|
import { LockedIcon as LockedIcon2 } from "@octaviaflow/icons";
|
|
39347
|
-
import { useId as
|
|
39976
|
+
import { useId as useId69, useMemo as useMemo44, useState as useState85 } from "react";
|
|
39348
39977
|
|
|
39349
39978
|
// src/notifications/engine/preferences.ts
|
|
39350
39979
|
var CRITICAL_CHANNELS = ["in_app", "email"];
|
|
@@ -39413,7 +40042,7 @@ function countEnabled(prefs, catalog, channel) {
|
|
|
39413
40042
|
}
|
|
39414
40043
|
|
|
39415
40044
|
// src/notifications/components/NotificationPreferenceMatrix/NotificationPreferenceMatrix.tsx
|
|
39416
|
-
import { jsx as
|
|
40045
|
+
import { jsx as jsx167, jsxs as jsxs159 } from "react/jsx-runtime";
|
|
39417
40046
|
var DEFAULT_COLUMNS = [{ id: "in_app" }, { id: "email" }];
|
|
39418
40047
|
var FREQUENCY_OPTIONS = [
|
|
39419
40048
|
{ value: "immediate", label: "Immediately" },
|
|
@@ -39432,13 +40061,13 @@ function NotificationPreferenceMatrix({
|
|
|
39432
40061
|
className,
|
|
39433
40062
|
id
|
|
39434
40063
|
}) {
|
|
39435
|
-
const reactId =
|
|
40064
|
+
const reactId = useId69();
|
|
39436
40065
|
const baseId = id ?? `${reactId}-prefs`;
|
|
39437
40066
|
const visible = useMemo44(
|
|
39438
40067
|
() => filterCatalog(catalog, personalAudiences(isAdmin)),
|
|
39439
40068
|
[catalog, isAdmin]
|
|
39440
40069
|
);
|
|
39441
|
-
const [notice, setNotice] =
|
|
40070
|
+
const [notice, setNotice] = useState85(null);
|
|
39442
40071
|
const toggle = (eventKey, channel, on) => {
|
|
39443
40072
|
const r = setPreference(value, catalog, eventKey, channel, on);
|
|
39444
40073
|
if (r.blocked) {
|
|
@@ -39455,13 +40084,13 @@ function NotificationPreferenceMatrix({
|
|
|
39455
40084
|
);
|
|
39456
40085
|
onChange(r.next);
|
|
39457
40086
|
};
|
|
39458
|
-
return /* @__PURE__ */
|
|
39459
|
-
showEmailFrequency && /* @__PURE__ */
|
|
39460
|
-
/* @__PURE__ */
|
|
40087
|
+
return /* @__PURE__ */ jsxs159("div", { className: cn("ods-pref-matrix", className), id: baseId, children: [
|
|
40088
|
+
showEmailFrequency && /* @__PURE__ */ jsxs159("div", { className: "ods-pref-matrix__frequency", children: [
|
|
40089
|
+
/* @__PURE__ */ jsxs159("div", { className: "ods-pref-matrix__frequency-label", children: [
|
|
39461
40090
|
"Email frequency",
|
|
39462
|
-
/* @__PURE__ */
|
|
40091
|
+
/* @__PURE__ */ jsx167("span", { className: "ods-pref-matrix__frequency-hint", children: "Critical alerts are always sent immediately." })
|
|
39463
40092
|
] }),
|
|
39464
|
-
/* @__PURE__ */
|
|
40093
|
+
/* @__PURE__ */ jsx167(
|
|
39465
40094
|
SegmentedControl,
|
|
39466
40095
|
{
|
|
39467
40096
|
"aria-label": "Email frequency",
|
|
@@ -39472,8 +40101,8 @@ function NotificationPreferenceMatrix({
|
|
|
39472
40101
|
disabled: readOnly
|
|
39473
40102
|
}
|
|
39474
40103
|
),
|
|
39475
|
-
value.emailFrequency === "daily" && /* @__PURE__ */
|
|
39476
|
-
/* @__PURE__ */
|
|
40104
|
+
value.emailFrequency === "daily" && /* @__PURE__ */ jsxs159("div", { className: "ods-pref-matrix__digest", children: [
|
|
40105
|
+
/* @__PURE__ */ jsx167(
|
|
39477
40106
|
TimePicker,
|
|
39478
40107
|
{
|
|
39479
40108
|
label: "At",
|
|
@@ -39484,7 +40113,7 @@ function NotificationPreferenceMatrix({
|
|
|
39484
40113
|
disabled: readOnly
|
|
39485
40114
|
}
|
|
39486
40115
|
),
|
|
39487
|
-
/* @__PURE__ */
|
|
40116
|
+
/* @__PURE__ */ jsx167(
|
|
39488
40117
|
TimezonePicker,
|
|
39489
40118
|
{
|
|
39490
40119
|
label: "Timezone",
|
|
@@ -39496,8 +40125,8 @@ function NotificationPreferenceMatrix({
|
|
|
39496
40125
|
)
|
|
39497
40126
|
] })
|
|
39498
40127
|
] }),
|
|
39499
|
-
notice && /* @__PURE__ */
|
|
39500
|
-
/* @__PURE__ */
|
|
40128
|
+
notice && /* @__PURE__ */ jsx167(InlineMessage, { tone: "warning", size: "sm", live: "polite", children: notice }),
|
|
40129
|
+
/* @__PURE__ */ jsxs159(
|
|
39501
40130
|
"div",
|
|
39502
40131
|
{
|
|
39503
40132
|
className: "ods-pref-matrix__table",
|
|
@@ -39505,17 +40134,17 @@ function NotificationPreferenceMatrix({
|
|
|
39505
40134
|
"aria-label": "Notification preferences",
|
|
39506
40135
|
style: { "--ods-pref-columns": channels.length },
|
|
39507
40136
|
children: [
|
|
39508
|
-
/* @__PURE__ */
|
|
39509
|
-
/* @__PURE__ */
|
|
40137
|
+
/* @__PURE__ */ jsxs159("div", { className: "ods-pref-matrix__row ods-pref-matrix__row--head", role: "row", children: [
|
|
40138
|
+
/* @__PURE__ */ jsx167("div", { className: "ods-pref-matrix__cell ods-pref-matrix__cell--label", role: "columnheader", children: "Event" }),
|
|
39510
40139
|
channels.map((col) => {
|
|
39511
40140
|
const meta2 = PERSONAL_CHANNEL_META[col.id];
|
|
39512
|
-
return /* @__PURE__ */
|
|
40141
|
+
return /* @__PURE__ */ jsxs159(
|
|
39513
40142
|
"div",
|
|
39514
40143
|
{
|
|
39515
40144
|
className: "ods-pref-matrix__cell ods-pref-matrix__cell--col",
|
|
39516
40145
|
role: "columnheader",
|
|
39517
40146
|
children: [
|
|
39518
|
-
/* @__PURE__ */
|
|
40147
|
+
/* @__PURE__ */ jsx167("span", { className: "ods-pref-matrix__col-icon", "aria-hidden": "true", children: col.icon ?? meta2.icon }),
|
|
39519
40148
|
col.label ?? meta2.label
|
|
39520
40149
|
]
|
|
39521
40150
|
},
|
|
@@ -39523,20 +40152,20 @@ function NotificationPreferenceMatrix({
|
|
|
39523
40152
|
);
|
|
39524
40153
|
})
|
|
39525
40154
|
] }),
|
|
39526
|
-
visible.map((category) => /* @__PURE__ */
|
|
39527
|
-
/* @__PURE__ */
|
|
39528
|
-
/* @__PURE__ */
|
|
39529
|
-
/* @__PURE__ */
|
|
39530
|
-
category.description && /* @__PURE__ */
|
|
40155
|
+
visible.map((category) => /* @__PURE__ */ jsxs159("div", { className: "ods-pref-matrix__group", role: "rowgroup", children: [
|
|
40156
|
+
/* @__PURE__ */ jsxs159("div", { className: "ods-pref-matrix__row ods-pref-matrix__row--group", role: "row", children: [
|
|
40157
|
+
/* @__PURE__ */ jsxs159("div", { className: "ods-pref-matrix__cell ods-pref-matrix__cell--label", role: "rowheader", children: [
|
|
40158
|
+
/* @__PURE__ */ jsx167("span", { className: "ods-pref-matrix__group-title", children: category.label }),
|
|
40159
|
+
category.description && /* @__PURE__ */ jsx167("span", { className: "ods-pref-matrix__group-desc", children: category.description })
|
|
39531
40160
|
] }),
|
|
39532
40161
|
channels.map((col) => {
|
|
39533
40162
|
const state = categoryColumnState(value, category, col.id);
|
|
39534
|
-
return /* @__PURE__ */
|
|
40163
|
+
return /* @__PURE__ */ jsx167(
|
|
39535
40164
|
"div",
|
|
39536
40165
|
{
|
|
39537
40166
|
className: "ods-pref-matrix__cell ods-pref-matrix__cell--col",
|
|
39538
40167
|
role: "cell",
|
|
39539
|
-
children: /* @__PURE__ */
|
|
40168
|
+
children: /* @__PURE__ */ jsx167(
|
|
39540
40169
|
Checkbox,
|
|
39541
40170
|
{
|
|
39542
40171
|
size: "sm",
|
|
@@ -39554,19 +40183,19 @@ function NotificationPreferenceMatrix({
|
|
|
39554
40183
|
] }),
|
|
39555
40184
|
category.events.map((event) => {
|
|
39556
40185
|
const sev = SEVERITY_META[event.severity];
|
|
39557
|
-
return /* @__PURE__ */
|
|
39558
|
-
/* @__PURE__ */
|
|
40186
|
+
return /* @__PURE__ */ jsxs159("div", { className: "ods-pref-matrix__row", role: "row", children: [
|
|
40187
|
+
/* @__PURE__ */ jsxs159(
|
|
39559
40188
|
"div",
|
|
39560
40189
|
{
|
|
39561
40190
|
className: "ods-pref-matrix__cell ods-pref-matrix__cell--label",
|
|
39562
40191
|
role: "rowheader",
|
|
39563
40192
|
children: [
|
|
39564
|
-
/* @__PURE__ */
|
|
39565
|
-
/* @__PURE__ */
|
|
39566
|
-
/* @__PURE__ */
|
|
39567
|
-
event.critical && /* @__PURE__ */
|
|
40193
|
+
/* @__PURE__ */ jsxs159("span", { className: "ods-pref-matrix__event", children: [
|
|
40194
|
+
/* @__PURE__ */ jsx167("span", { className: "ods-pref-matrix__event-label", children: event.label }),
|
|
40195
|
+
/* @__PURE__ */ jsx167(Badge, { size: "sm", variant: sev.variant, dot: true, children: sev.label }),
|
|
40196
|
+
event.critical && /* @__PURE__ */ jsx167(Badge, { size: "sm", variant: "neutral", outlined: true, children: "Critical" })
|
|
39568
40197
|
] }),
|
|
39569
|
-
event.description && /* @__PURE__ */
|
|
40198
|
+
event.description && /* @__PURE__ */ jsx167("span", { className: "ods-pref-matrix__event-desc", children: event.description })
|
|
39570
40199
|
]
|
|
39571
40200
|
}
|
|
39572
40201
|
),
|
|
@@ -39574,8 +40203,8 @@ function NotificationPreferenceMatrix({
|
|
|
39574
40203
|
const on = isPreferenceEnabled(value, event, col.id);
|
|
39575
40204
|
const locked = isPreferenceLocked(value, event, col.id);
|
|
39576
40205
|
const colLabel = typeof col.label === "string" ? col.label : PERSONAL_CHANNEL_META[col.id].label;
|
|
39577
|
-
const control = /* @__PURE__ */
|
|
39578
|
-
/* @__PURE__ */
|
|
40206
|
+
const control = /* @__PURE__ */ jsxs159("span", { className: "ods-pref-matrix__control", children: [
|
|
40207
|
+
/* @__PURE__ */ jsx167(
|
|
39579
40208
|
Switch,
|
|
39580
40209
|
{
|
|
39581
40210
|
size: "sm",
|
|
@@ -39585,14 +40214,14 @@ function NotificationPreferenceMatrix({
|
|
|
39585
40214
|
"aria-label": `${event.label} via ${colLabel}`
|
|
39586
40215
|
}
|
|
39587
40216
|
),
|
|
39588
|
-
locked && /* @__PURE__ */
|
|
40217
|
+
locked && /* @__PURE__ */ jsx167("span", { className: "ods-pref-matrix__lock", "aria-hidden": "true", children: /* @__PURE__ */ jsx167(LockedIcon2, { size: "sm" }) })
|
|
39589
40218
|
] });
|
|
39590
|
-
return /* @__PURE__ */
|
|
40219
|
+
return /* @__PURE__ */ jsx167(
|
|
39591
40220
|
"div",
|
|
39592
40221
|
{
|
|
39593
40222
|
className: "ods-pref-matrix__cell ods-pref-matrix__cell--col",
|
|
39594
40223
|
role: "cell",
|
|
39595
|
-
children: /* @__PURE__ */
|
|
40224
|
+
children: /* @__PURE__ */ jsx167(
|
|
39596
40225
|
Tooltip,
|
|
39597
40226
|
{
|
|
39598
40227
|
content: locked ? LOCK_MESSAGE : col.disabledReason ?? "",
|
|
@@ -39617,8 +40246,8 @@ NotificationPreferenceMatrix.displayName = "NotificationPreferenceMatrix";
|
|
|
39617
40246
|
|
|
39618
40247
|
// src/notifications/components/NotificationRuleEditor/NotificationRuleEditor.tsx
|
|
39619
40248
|
import { AddIcon as AddIcon8, RuleIcon } from "@octaviaflow/icons";
|
|
39620
|
-
import { useId as
|
|
39621
|
-
import { Fragment as Fragment68, jsx as
|
|
40249
|
+
import { useId as useId70, useMemo as useMemo45 } from "react";
|
|
40250
|
+
import { Fragment as Fragment68, jsx as jsx168, jsxs as jsxs160 } from "react/jsx-runtime";
|
|
39622
40251
|
var COOLDOWN_OPTIONS = [
|
|
39623
40252
|
{ value: "0", label: "No limit" },
|
|
39624
40253
|
{ value: "15", label: "Once every 15 minutes" },
|
|
@@ -39681,7 +40310,7 @@ function NotificationRuleEditor({
|
|
|
39681
40310
|
className,
|
|
39682
40311
|
id
|
|
39683
40312
|
}) {
|
|
39684
|
-
const reactId =
|
|
40313
|
+
const reactId = useId70();
|
|
39685
40314
|
const baseId = id ?? `${reactId}-rule`;
|
|
39686
40315
|
const patch = (next) => onChange({ ...value, ...next });
|
|
39687
40316
|
const ruleCatalog = useMemo45(() => filterCatalog(catalog, RULE_AUDIENCES), [catalog]);
|
|
@@ -39700,12 +40329,12 @@ function NotificationRuleEditor({
|
|
|
39700
40329
|
const setQuiet = (next) => patch({ quietHours: { ...quiet, ...next } });
|
|
39701
40330
|
const showFooter = Boolean(onSave || onCancel);
|
|
39702
40331
|
const canSave = value.events.length > 0 && value.channelIds.length > 0 && !saving && !readOnly;
|
|
39703
|
-
return /* @__PURE__ */
|
|
39704
|
-
/* @__PURE__ */
|
|
39705
|
-
/* @__PURE__ */
|
|
39706
|
-
/* @__PURE__ */
|
|
40332
|
+
return /* @__PURE__ */ jsxs160("div", { className: cn("ods-rule-editor", className), id: baseId, children: [
|
|
40333
|
+
/* @__PURE__ */ jsxs160("div", { className: "ods-rule-editor__summary", "aria-live": "polite", children: [
|
|
40334
|
+
/* @__PURE__ */ jsx168("span", { className: "ods-rule-editor__summary-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx168(RuleIcon, { size: "sm" }) }),
|
|
40335
|
+
/* @__PURE__ */ jsx168("span", { children: sentence })
|
|
39707
40336
|
] }),
|
|
39708
|
-
/* @__PURE__ */
|
|
40337
|
+
/* @__PURE__ */ jsx168(
|
|
39709
40338
|
Input,
|
|
39710
40339
|
{
|
|
39711
40340
|
id: `${baseId}-name`,
|
|
@@ -39718,13 +40347,13 @@ function NotificationRuleEditor({
|
|
|
39718
40347
|
disabled: readOnly
|
|
39719
40348
|
}
|
|
39720
40349
|
),
|
|
39721
|
-
/* @__PURE__ */
|
|
39722
|
-
/* @__PURE__ */
|
|
39723
|
-
/* @__PURE__ */
|
|
40350
|
+
/* @__PURE__ */ jsxs160("section", { className: "ods-rule-editor__step", "aria-labelledby": `${baseId}-what`, children: [
|
|
40351
|
+
/* @__PURE__ */ jsxs160("h4", { id: `${baseId}-what`, className: "ods-rule-editor__step-title", children: [
|
|
40352
|
+
/* @__PURE__ */ jsx168("span", { className: "ods-rule-editor__step-num", children: "1" }),
|
|
39724
40353
|
"What",
|
|
39725
|
-
/* @__PURE__ */
|
|
40354
|
+
/* @__PURE__ */ jsx168("span", { className: "ods-rule-editor__step-hint", children: "Which events should trigger this rule?" })
|
|
39726
40355
|
] }),
|
|
39727
|
-
/* @__PURE__ */
|
|
40356
|
+
/* @__PURE__ */ jsx168(
|
|
39728
40357
|
EventCatalogPicker,
|
|
39729
40358
|
{
|
|
39730
40359
|
catalog: ruleCatalog,
|
|
@@ -39734,20 +40363,20 @@ function NotificationRuleEditor({
|
|
|
39734
40363
|
collapsible: true
|
|
39735
40364
|
}
|
|
39736
40365
|
),
|
|
39737
|
-
errors?.events && /* @__PURE__ */
|
|
40366
|
+
errors?.events && /* @__PURE__ */ jsx168("div", { className: "ods-rule-editor__error", children: errors.events })
|
|
39738
40367
|
] }),
|
|
39739
|
-
/* @__PURE__ */
|
|
39740
|
-
/* @__PURE__ */
|
|
39741
|
-
/* @__PURE__ */
|
|
40368
|
+
/* @__PURE__ */ jsxs160("section", { className: "ods-rule-editor__step", "aria-labelledby": `${baseId}-where`, children: [
|
|
40369
|
+
/* @__PURE__ */ jsxs160("h4", { id: `${baseId}-where`, className: "ods-rule-editor__step-title", children: [
|
|
40370
|
+
/* @__PURE__ */ jsx168("span", { className: "ods-rule-editor__step-num", children: "2" }),
|
|
39742
40371
|
"Where",
|
|
39743
|
-
/* @__PURE__ */
|
|
40372
|
+
/* @__PURE__ */ jsx168("span", { className: "ods-rule-editor__step-hint", children: "Pick one or more channels." })
|
|
39744
40373
|
] }),
|
|
39745
|
-
/* @__PURE__ */
|
|
39746
|
-
channels.length === 0 && /* @__PURE__ */
|
|
40374
|
+
/* @__PURE__ */ jsxs160("div", { className: "ods-rule-editor__channels", role: "group", "aria-label": "Channels", children: [
|
|
40375
|
+
channels.length === 0 && /* @__PURE__ */ jsx168("span", { className: "ods-rule-editor__muted", children: "No channels yet." }),
|
|
39747
40376
|
channels.map((channel) => {
|
|
39748
40377
|
const on = value.channelIds.includes(channel.id);
|
|
39749
40378
|
const meta2 = CHANNEL_TYPE_META[channel.type];
|
|
39750
|
-
return /* @__PURE__ */
|
|
40379
|
+
return /* @__PURE__ */ jsx168(
|
|
39751
40380
|
Chip,
|
|
39752
40381
|
{
|
|
39753
40382
|
size: "md",
|
|
@@ -39762,26 +40391,26 @@ function NotificationRuleEditor({
|
|
|
39762
40391
|
channel.id
|
|
39763
40392
|
);
|
|
39764
40393
|
}),
|
|
39765
|
-
onAddChannel && !readOnly && /* @__PURE__ */
|
|
40394
|
+
onAddChannel && !readOnly && /* @__PURE__ */ jsx168(
|
|
39766
40395
|
Button,
|
|
39767
40396
|
{
|
|
39768
40397
|
size: "sm",
|
|
39769
40398
|
variant: "ghost",
|
|
39770
|
-
leftIcon: /* @__PURE__ */
|
|
40399
|
+
leftIcon: /* @__PURE__ */ jsx168(AddIcon8, { size: "sm", "aria-hidden": "true" }),
|
|
39771
40400
|
onClick: onAddChannel,
|
|
39772
40401
|
children: "Add channel"
|
|
39773
40402
|
}
|
|
39774
40403
|
)
|
|
39775
40404
|
] }),
|
|
39776
|
-
errors?.channelIds && /* @__PURE__ */
|
|
40405
|
+
errors?.channelIds && /* @__PURE__ */ jsx168("div", { className: "ods-rule-editor__error", children: errors.channelIds })
|
|
39777
40406
|
] }),
|
|
39778
|
-
/* @__PURE__ */
|
|
39779
|
-
/* @__PURE__ */
|
|
39780
|
-
/* @__PURE__ */
|
|
40407
|
+
/* @__PURE__ */ jsxs160("section", { className: "ods-rule-editor__step", "aria-labelledby": `${baseId}-when`, children: [
|
|
40408
|
+
/* @__PURE__ */ jsxs160("h4", { id: `${baseId}-when`, className: "ods-rule-editor__step-title", children: [
|
|
40409
|
+
/* @__PURE__ */ jsx168("span", { className: "ods-rule-editor__step-num", children: "3" }),
|
|
39781
40410
|
"When",
|
|
39782
|
-
/* @__PURE__ */
|
|
40411
|
+
/* @__PURE__ */ jsx168("span", { className: "ods-rule-editor__step-hint", children: "How quickly should it go out?" })
|
|
39783
40412
|
] }),
|
|
39784
|
-
/* @__PURE__ */
|
|
40413
|
+
/* @__PURE__ */ jsx168(
|
|
39785
40414
|
DeliveryFrequencyControl,
|
|
39786
40415
|
{
|
|
39787
40416
|
label: null,
|
|
@@ -39791,7 +40420,7 @@ function NotificationRuleEditor({
|
|
|
39791
40420
|
}
|
|
39792
40421
|
)
|
|
39793
40422
|
] }),
|
|
39794
|
-
/* @__PURE__ */
|
|
40423
|
+
/* @__PURE__ */ jsx168(
|
|
39795
40424
|
Disclosure,
|
|
39796
40425
|
{
|
|
39797
40426
|
title: "Advanced options",
|
|
@@ -39799,9 +40428,9 @@ function NotificationRuleEditor({
|
|
|
39799
40428
|
defaultOpen: openAdvanced,
|
|
39800
40429
|
size: "sm",
|
|
39801
40430
|
className: "ods-rule-editor__advanced",
|
|
39802
|
-
children: /* @__PURE__ */
|
|
39803
|
-
/* @__PURE__ */
|
|
39804
|
-
/* @__PURE__ */
|
|
40431
|
+
children: /* @__PURE__ */ jsxs160("div", { className: "ods-rule-editor__advanced-body", children: [
|
|
40432
|
+
/* @__PURE__ */ jsx168("div", { className: "ods-rule-editor__subhead", children: "Condition" }),
|
|
40433
|
+
/* @__PURE__ */ jsx168(
|
|
39805
40434
|
AlertConditionComposer,
|
|
39806
40435
|
{
|
|
39807
40436
|
label: null,
|
|
@@ -39813,10 +40442,10 @@ function NotificationRuleEditor({
|
|
|
39813
40442
|
disabled: readOnly
|
|
39814
40443
|
}
|
|
39815
40444
|
),
|
|
39816
|
-
(scopeOptions?.flows || scopeOptions?.connectors) && /* @__PURE__ */
|
|
39817
|
-
/* @__PURE__ */
|
|
39818
|
-
/* @__PURE__ */
|
|
39819
|
-
scopeOptions.flows && /* @__PURE__ */
|
|
40445
|
+
(scopeOptions?.flows || scopeOptions?.connectors) && /* @__PURE__ */ jsxs160(Fragment68, { children: [
|
|
40446
|
+
/* @__PURE__ */ jsx168("div", { className: "ods-rule-editor__subhead", children: "Scope" }),
|
|
40447
|
+
/* @__PURE__ */ jsxs160("div", { className: "ods-rule-editor__grid", children: [
|
|
40448
|
+
scopeOptions.flows && /* @__PURE__ */ jsx168(
|
|
39820
40449
|
MultiSelect,
|
|
39821
40450
|
{
|
|
39822
40451
|
label: "Only these flows",
|
|
@@ -39828,7 +40457,7 @@ function NotificationRuleEditor({
|
|
|
39828
40457
|
disabled: readOnly
|
|
39829
40458
|
}
|
|
39830
40459
|
),
|
|
39831
|
-
scopeOptions.connectors && /* @__PURE__ */
|
|
40460
|
+
scopeOptions.connectors && /* @__PURE__ */ jsx168(
|
|
39832
40461
|
MultiSelect,
|
|
39833
40462
|
{
|
|
39834
40463
|
label: "Only these apps",
|
|
@@ -39842,9 +40471,9 @@ function NotificationRuleEditor({
|
|
|
39842
40471
|
)
|
|
39843
40472
|
] })
|
|
39844
40473
|
] }),
|
|
39845
|
-
/* @__PURE__ */
|
|
39846
|
-
/* @__PURE__ */
|
|
39847
|
-
/* @__PURE__ */
|
|
40474
|
+
/* @__PURE__ */ jsx168("div", { className: "ods-rule-editor__subhead", children: "Repeat & cooldown" }),
|
|
40475
|
+
/* @__PURE__ */ jsxs160("div", { className: "ods-rule-editor__grid", children: [
|
|
40476
|
+
/* @__PURE__ */ jsx168(
|
|
39848
40477
|
Select,
|
|
39849
40478
|
{
|
|
39850
40479
|
label: `Limit per ${subjectNoun}`,
|
|
@@ -39855,7 +40484,7 @@ function NotificationRuleEditor({
|
|
|
39855
40484
|
disabled: readOnly
|
|
39856
40485
|
}
|
|
39857
40486
|
),
|
|
39858
|
-
/* @__PURE__ */
|
|
40487
|
+
/* @__PURE__ */ jsx168(
|
|
39859
40488
|
Select,
|
|
39860
40489
|
{
|
|
39861
40490
|
label: "While it keeps failing",
|
|
@@ -39867,8 +40496,8 @@ function NotificationRuleEditor({
|
|
|
39867
40496
|
}
|
|
39868
40497
|
)
|
|
39869
40498
|
] }),
|
|
39870
|
-
/* @__PURE__ */
|
|
39871
|
-
/* @__PURE__ */
|
|
40499
|
+
/* @__PURE__ */ jsx168("div", { className: "ods-rule-editor__subhead", children: "Quiet hours" }),
|
|
40500
|
+
/* @__PURE__ */ jsx168(
|
|
39872
40501
|
Switch,
|
|
39873
40502
|
{
|
|
39874
40503
|
size: "sm",
|
|
@@ -39879,8 +40508,8 @@ function NotificationRuleEditor({
|
|
|
39879
40508
|
disabled: readOnly
|
|
39880
40509
|
}
|
|
39881
40510
|
),
|
|
39882
|
-
quiet.enabled && /* @__PURE__ */
|
|
39883
|
-
/* @__PURE__ */
|
|
40511
|
+
quiet.enabled && /* @__PURE__ */ jsxs160("div", { className: "ods-rule-editor__quiet", children: [
|
|
40512
|
+
/* @__PURE__ */ jsx168(
|
|
39884
40513
|
TimePicker,
|
|
39885
40514
|
{
|
|
39886
40515
|
label: "From",
|
|
@@ -39891,7 +40520,7 @@ function NotificationRuleEditor({
|
|
|
39891
40520
|
disabled: readOnly
|
|
39892
40521
|
}
|
|
39893
40522
|
),
|
|
39894
|
-
/* @__PURE__ */
|
|
40523
|
+
/* @__PURE__ */ jsx168(
|
|
39895
40524
|
TimePicker,
|
|
39896
40525
|
{
|
|
39897
40526
|
label: "Until",
|
|
@@ -39902,7 +40531,7 @@ function NotificationRuleEditor({
|
|
|
39902
40531
|
disabled: readOnly
|
|
39903
40532
|
}
|
|
39904
40533
|
),
|
|
39905
|
-
/* @__PURE__ */
|
|
40534
|
+
/* @__PURE__ */ jsx168(
|
|
39906
40535
|
TimezonePicker,
|
|
39907
40536
|
{
|
|
39908
40537
|
label: "Timezone",
|
|
@@ -39912,7 +40541,7 @@ function NotificationRuleEditor({
|
|
|
39912
40541
|
disabled: readOnly
|
|
39913
40542
|
}
|
|
39914
40543
|
),
|
|
39915
|
-
/* @__PURE__ */
|
|
40544
|
+
/* @__PURE__ */ jsx168(
|
|
39916
40545
|
MultiSelect,
|
|
39917
40546
|
{
|
|
39918
40547
|
label: "Days",
|
|
@@ -39926,8 +40555,8 @@ function NotificationRuleEditor({
|
|
|
39926
40555
|
}
|
|
39927
40556
|
)
|
|
39928
40557
|
] }),
|
|
39929
|
-
/* @__PURE__ */
|
|
39930
|
-
/* @__PURE__ */
|
|
40558
|
+
/* @__PURE__ */ jsx168("div", { className: "ods-rule-editor__subhead", children: "Minimum severity" }),
|
|
40559
|
+
/* @__PURE__ */ jsx168(
|
|
39931
40560
|
SegmentedControl,
|
|
39932
40561
|
{
|
|
39933
40562
|
"aria-label": "Minimum severity",
|
|
@@ -39941,8 +40570,8 @@ function NotificationRuleEditor({
|
|
|
39941
40570
|
] })
|
|
39942
40571
|
}
|
|
39943
40572
|
),
|
|
39944
|
-
showFooter && /* @__PURE__ */
|
|
39945
|
-
/* @__PURE__ */
|
|
40573
|
+
showFooter && /* @__PURE__ */ jsxs160("footer", { className: "ods-rule-editor__footer", children: [
|
|
40574
|
+
/* @__PURE__ */ jsx168(
|
|
39946
40575
|
Switch,
|
|
39947
40576
|
{
|
|
39948
40577
|
size: "sm",
|
|
@@ -39952,9 +40581,9 @@ function NotificationRuleEditor({
|
|
|
39952
40581
|
disabled: readOnly
|
|
39953
40582
|
}
|
|
39954
40583
|
),
|
|
39955
|
-
/* @__PURE__ */
|
|
39956
|
-
onCancel && /* @__PURE__ */
|
|
39957
|
-
onSave && /* @__PURE__ */
|
|
40584
|
+
/* @__PURE__ */ jsx168("span", { className: "ods-rule-editor__spacer" }),
|
|
40585
|
+
onCancel && /* @__PURE__ */ jsx168(Button, { variant: "ghost", onClick: onCancel, disabled: saving, children: "Cancel" }),
|
|
40586
|
+
onSave && /* @__PURE__ */ jsx168(Button, { variant: "primary", onClick: onSave, loading: saving, disabled: !canSave, children: value.id ? "Save rule" : "Create rule" })
|
|
39958
40587
|
] })
|
|
39959
40588
|
] });
|
|
39960
40589
|
}
|
|
@@ -39962,7 +40591,7 @@ NotificationRuleEditor.displayName = "NotificationRuleEditor";
|
|
|
39962
40591
|
|
|
39963
40592
|
// src/notifications/components/NotificationRuleList/NotificationRuleList.tsx
|
|
39964
40593
|
import { AddIcon as AddIcon9, CopyIcon as CopyIcon6, EditIcon as EditIcon2, RuleIcon as RuleIcon2, TrashCanIcon as TrashCanIcon4 } from "@octaviaflow/icons";
|
|
39965
|
-
import { Fragment as Fragment69, jsx as
|
|
40594
|
+
import { Fragment as Fragment69, jsx as jsx169, jsxs as jsxs161 } from "react/jsx-runtime";
|
|
39966
40595
|
function NotificationRuleList({
|
|
39967
40596
|
rules,
|
|
39968
40597
|
catalog,
|
|
@@ -39980,61 +40609,61 @@ function NotificationRuleList({
|
|
|
39980
40609
|
className
|
|
39981
40610
|
}) {
|
|
39982
40611
|
const canCreate = Boolean(onCreate) && !readOnly;
|
|
39983
|
-
return /* @__PURE__ */
|
|
39984
|
-
/* @__PURE__ */
|
|
39985
|
-
/* @__PURE__ */
|
|
40612
|
+
return /* @__PURE__ */ jsxs161("section", { className: cn("ods-rule-list", className), "aria-label": "Notification rules", children: [
|
|
40613
|
+
/* @__PURE__ */ jsxs161("header", { className: "ods-rule-list__head", children: [
|
|
40614
|
+
/* @__PURE__ */ jsxs161("h3", { className: "ods-rule-list__title", children: [
|
|
39986
40615
|
title,
|
|
39987
|
-
/* @__PURE__ */
|
|
40616
|
+
/* @__PURE__ */ jsx169("span", { className: "ods-rule-list__count", children: rules.length })
|
|
39988
40617
|
] }),
|
|
39989
|
-
canCreate && rules.length > 0 && /* @__PURE__ */
|
|
40618
|
+
canCreate && rules.length > 0 && /* @__PURE__ */ jsx169(
|
|
39990
40619
|
Button,
|
|
39991
40620
|
{
|
|
39992
40621
|
size: "sm",
|
|
39993
40622
|
variant: "secondary",
|
|
39994
|
-
leftIcon: /* @__PURE__ */
|
|
40623
|
+
leftIcon: /* @__PURE__ */ jsx169(AddIcon9, { size: "sm", "aria-hidden": "true" }),
|
|
39995
40624
|
onClick: onCreate,
|
|
39996
40625
|
children: "New rule"
|
|
39997
40626
|
}
|
|
39998
40627
|
)
|
|
39999
40628
|
] }),
|
|
40000
|
-
rules.length === 0 ? /* @__PURE__ */
|
|
40001
|
-
/* @__PURE__ */
|
|
40629
|
+
rules.length === 0 ? /* @__PURE__ */ jsxs161(Fragment69, { children: [
|
|
40630
|
+
/* @__PURE__ */ jsx169(
|
|
40002
40631
|
EmptyState,
|
|
40003
40632
|
{
|
|
40004
|
-
icon: /* @__PURE__ */
|
|
40633
|
+
icon: /* @__PURE__ */ jsx169(RuleIcon2, { "aria-hidden": "true" }),
|
|
40005
40634
|
title: "No rules yet",
|
|
40006
40635
|
description: "Rules route events to shared channels \u2014 a Slack channel, an ops mailbox, a webhook \u2014 with thresholds and timing you choose. Everyone still gets their personal inbox and email without a rule.",
|
|
40007
|
-
action: canCreate ? /* @__PURE__ */
|
|
40636
|
+
action: canCreate ? /* @__PURE__ */ jsx169(
|
|
40008
40637
|
Button,
|
|
40009
40638
|
{
|
|
40010
40639
|
variant: "primary",
|
|
40011
|
-
leftIcon: /* @__PURE__ */
|
|
40640
|
+
leftIcon: /* @__PURE__ */ jsx169(AddIcon9, { size: "sm", "aria-hidden": "true" }),
|
|
40012
40641
|
onClick: onCreate,
|
|
40013
40642
|
children: "New rule"
|
|
40014
40643
|
}
|
|
40015
40644
|
) : void 0
|
|
40016
40645
|
}
|
|
40017
40646
|
),
|
|
40018
|
-
starters && starters.length > 0 && !readOnly && onStarter && /* @__PURE__ */
|
|
40647
|
+
starters && starters.length > 0 && !readOnly && onStarter && /* @__PURE__ */ jsx169("div", { className: "ods-rule-list__starters", children: starters.map((s) => /* @__PURE__ */ jsxs161(
|
|
40019
40648
|
"button",
|
|
40020
40649
|
{
|
|
40021
40650
|
type: "button",
|
|
40022
40651
|
className: "ods-rule-list__starter",
|
|
40023
40652
|
onClick: () => onStarter(s),
|
|
40024
40653
|
children: [
|
|
40025
|
-
/* @__PURE__ */
|
|
40026
|
-
s.description && /* @__PURE__ */
|
|
40654
|
+
/* @__PURE__ */ jsx169("span", { className: "ods-rule-list__starter-title", children: s.title }),
|
|
40655
|
+
s.description && /* @__PURE__ */ jsx169("span", { className: "ods-rule-list__starter-desc", children: s.description })
|
|
40027
40656
|
]
|
|
40028
40657
|
},
|
|
40029
40658
|
s.id
|
|
40030
40659
|
)) })
|
|
40031
|
-
] }) : /* @__PURE__ */
|
|
40660
|
+
] }) : /* @__PURE__ */ jsx169("ul", { className: "ods-rule-list__rows", children: rules.map((rule) => {
|
|
40032
40661
|
const last = formatRelativeTime(
|
|
40033
40662
|
rule.lastFiredAt ? new Date(rule.lastFiredAt) : null,
|
|
40034
40663
|
now2
|
|
40035
40664
|
);
|
|
40036
40665
|
const ruleChannels = rule.channelIds.map((id) => channels.find((c) => c.id === id)).filter((c) => Boolean(c));
|
|
40037
|
-
return /* @__PURE__ */
|
|
40666
|
+
return /* @__PURE__ */ jsxs161(
|
|
40038
40667
|
"li",
|
|
40039
40668
|
{
|
|
40040
40669
|
className: cn(
|
|
@@ -40042,7 +40671,7 @@ function NotificationRuleList({
|
|
|
40042
40671
|
!rule.enabled && "ods-rule-list__row--disabled"
|
|
40043
40672
|
),
|
|
40044
40673
|
children: [
|
|
40045
|
-
/* @__PURE__ */
|
|
40674
|
+
/* @__PURE__ */ jsx169("div", { className: "ods-rule-list__switch", children: /* @__PURE__ */ jsx169(
|
|
40046
40675
|
Switch,
|
|
40047
40676
|
{
|
|
40048
40677
|
size: "sm",
|
|
@@ -40052,43 +40681,43 @@ function NotificationRuleList({
|
|
|
40052
40681
|
"aria-label": `${rule.enabled ? "Disable" : "Enable"} ${rule.name || "rule"}`
|
|
40053
40682
|
}
|
|
40054
40683
|
) }),
|
|
40055
|
-
/* @__PURE__ */
|
|
40056
|
-
/* @__PURE__ */
|
|
40057
|
-
/* @__PURE__ */
|
|
40058
|
-
/* @__PURE__ */
|
|
40059
|
-
ruleChannels.map((c) => /* @__PURE__ */
|
|
40060
|
-
/* @__PURE__ */
|
|
40684
|
+
/* @__PURE__ */ jsxs161("div", { className: "ods-rule-list__body", children: [
|
|
40685
|
+
/* @__PURE__ */ jsx169("div", { className: "ods-rule-list__name", children: rule.name || "Untitled rule" }),
|
|
40686
|
+
/* @__PURE__ */ jsx169("div", { className: "ods-rule-list__sentence", children: describeRule(rule, catalog, channels) }),
|
|
40687
|
+
/* @__PURE__ */ jsxs161("div", { className: "ods-rule-list__meta", children: [
|
|
40688
|
+
ruleChannels.map((c) => /* @__PURE__ */ jsx169(Chip, { size: "sm", icon: CHANNEL_TYPE_META[c.type].icon, children: c.label }, c.id)),
|
|
40689
|
+
/* @__PURE__ */ jsx169("span", { children: last ? `Last fired ${last}` : "Never fired" })
|
|
40061
40690
|
] })
|
|
40062
40691
|
] }),
|
|
40063
|
-
!readOnly && /* @__PURE__ */
|
|
40064
|
-
onEdit && /* @__PURE__ */
|
|
40692
|
+
!readOnly && /* @__PURE__ */ jsxs161("div", { className: "ods-rule-list__actions", children: [
|
|
40693
|
+
onEdit && /* @__PURE__ */ jsx169(
|
|
40065
40694
|
Button,
|
|
40066
40695
|
{
|
|
40067
40696
|
size: "sm",
|
|
40068
40697
|
variant: "ghost",
|
|
40069
40698
|
"aria-label": `Edit ${rule.name || "rule"}`,
|
|
40070
40699
|
onClick: () => onEdit(rule),
|
|
40071
|
-
children: /* @__PURE__ */
|
|
40700
|
+
children: /* @__PURE__ */ jsx169(EditIcon2, { size: "sm", "aria-hidden": "true" })
|
|
40072
40701
|
}
|
|
40073
40702
|
),
|
|
40074
|
-
onDuplicate && /* @__PURE__ */
|
|
40703
|
+
onDuplicate && /* @__PURE__ */ jsx169(
|
|
40075
40704
|
Button,
|
|
40076
40705
|
{
|
|
40077
40706
|
size: "sm",
|
|
40078
40707
|
variant: "ghost",
|
|
40079
40708
|
"aria-label": `Duplicate ${rule.name || "rule"}`,
|
|
40080
40709
|
onClick: () => onDuplicate(rule),
|
|
40081
|
-
children: /* @__PURE__ */
|
|
40710
|
+
children: /* @__PURE__ */ jsx169(CopyIcon6, { size: "sm", "aria-hidden": "true" })
|
|
40082
40711
|
}
|
|
40083
40712
|
),
|
|
40084
|
-
onDelete && /* @__PURE__ */
|
|
40713
|
+
onDelete && /* @__PURE__ */ jsx169(
|
|
40085
40714
|
Button,
|
|
40086
40715
|
{
|
|
40087
40716
|
size: "sm",
|
|
40088
40717
|
variant: "ghost",
|
|
40089
40718
|
"aria-label": `Delete ${rule.name || "rule"}`,
|
|
40090
40719
|
onClick: () => onDelete(rule),
|
|
40091
|
-
children: /* @__PURE__ */
|
|
40720
|
+
children: /* @__PURE__ */ jsx169(TrashCanIcon4, { size: "sm", "aria-hidden": "true" })
|
|
40092
40721
|
}
|
|
40093
40722
|
)
|
|
40094
40723
|
] })
|
|
@@ -40188,6 +40817,7 @@ export {
|
|
|
40188
40817
|
EmptyState,
|
|
40189
40818
|
EventCatalogPicker,
|
|
40190
40819
|
ExecutionConsole,
|
|
40820
|
+
ExpressionField,
|
|
40191
40821
|
FeatureCard,
|
|
40192
40822
|
FieldPicker,
|
|
40193
40823
|
FileBrowser,
|
|
@@ -40395,6 +41025,7 @@ export {
|
|
|
40395
41025
|
googleChatAdapter,
|
|
40396
41026
|
gradient,
|
|
40397
41027
|
groupInboxByDay,
|
|
41028
|
+
insideCallArguments,
|
|
40398
41029
|
isArchived,
|
|
40399
41030
|
isChannelDraftComplete,
|
|
40400
41031
|
isPreferenceEnabled,
|
|
@@ -40412,6 +41043,7 @@ export {
|
|
|
40412
41043
|
sanitizeImageUrl,
|
|
40413
41044
|
setCategoryPreference,
|
|
40414
41045
|
setPreference,
|
|
41046
|
+
shortReferenceLabel,
|
|
40415
41047
|
slackAdapter,
|
|
40416
41048
|
suggestChannelLabel,
|
|
40417
41049
|
teamsAdapter,
|