@adatechnology/conversations-ui 0.16.0 → 0.17.0
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/README.md +23 -0
- package/dist/{chunk-Y326LLEP.js → chunk-7OLYCCLX.js} +1 -1
- package/dist/{chunk-WCZNIJ3M.js → chunk-Z7U22M3K.js} +7 -0
- package/dist/flows/index.d.ts +19 -3
- package/dist/flows/index.js +426 -238
- package/dist/index.d.ts +34 -3
- package/dist/index.js +88 -23
- package/dist/participant/index.js +1 -1
- package/dist/preview/index.js +2 -2
- package/package.json +2 -2
- package/src/flows/FlowNodeCard.tsx +17 -7
- package/src/flows/FlowNodePanel.tsx +10 -0
- package/src/flows/FlowPossibleNextField.tsx +89 -0
- package/src/flows/FlowRunnerFields.tsx +70 -16
- package/src/flows/flowCanvasModel.ts +16 -1
- package/src/flows/flowEditorOps.ts +19 -2
- package/src/flows/flowGraph.ts +37 -7
- package/src/flows/flowPossibleNext.test.ts +70 -0
- package/src/flows/labels.ts +28 -1
- package/src/index.ts +2 -1
- package/src/lib/phone.test.ts +20 -0
- package/src/lib/phone.ts +13 -0
- package/src/workspace/ConversationPane.tsx +13 -2
- package/src/workspace/ConversationsWorkspace.tsx +117 -18
- package/src/workspace/index.ts +1 -0
- package/src/workspace/labels.ts +2 -0
- package/src/workspace/workspaceTestContactDom.test.tsx +96 -0
package/dist/flows/index.js
CHANGED
|
@@ -29,6 +29,17 @@ import {
|
|
|
29
29
|
} from "lucide-react";
|
|
30
30
|
|
|
31
31
|
// src/flows/labels.ts
|
|
32
|
+
var OPTIONAL_RUNNER_FIELD_LABEL_DEFAULTS = {
|
|
33
|
+
minTime: "A partir de",
|
|
34
|
+
maxTime: "At\xE9",
|
|
35
|
+
timeWindowsContextKey: "Faixas permitidas guardadas em",
|
|
36
|
+
timeWindowsContextKeyHint: 'Chave do contexto com as faixas (ex.: ["11:00-14:00"]), preenchida pelo sistema antes da pergunta.',
|
|
37
|
+
possibleNext: "Destinos que a a\xE7\xE3o pode escolher",
|
|
38
|
+
possibleNextHint: "A a\xE7\xE3o decide o caminho na hora. Liste aqui os destinos poss\xEDveis para eles aparecerem no mapa.",
|
|
39
|
+
addPossibleNext: "Adicionar destino",
|
|
40
|
+
removePossibleNext: "Remover destino",
|
|
41
|
+
possibleNextRowLabel: "Pode seguir para"
|
|
42
|
+
};
|
|
32
43
|
var DEFAULT_FLOW_RUNNER_FIELD_LABELS = {
|
|
33
44
|
section: "Resposta do cliente",
|
|
34
45
|
fallbackMessage: "Mensagem quando a resposta n\xE3o serve",
|
|
@@ -37,6 +48,7 @@ var DEFAULT_FLOW_RUNNER_FIELD_LABELS = {
|
|
|
37
48
|
maxInvalidAnswersHint: "Vazio = padr\xE3o do bot (2).",
|
|
38
49
|
minDateToday: "S\xF3 aceitar de hoje em diante",
|
|
39
50
|
afterContextKey: "Depois da data guardada em",
|
|
51
|
+
...OPTIONAL_RUNNER_FIELD_LABEL_DEFAULTS,
|
|
40
52
|
minValue: "M\xEDnimo",
|
|
41
53
|
maxValue: "M\xE1ximo",
|
|
42
54
|
minLength: "M\xEDnimo de caracteres",
|
|
@@ -95,6 +107,7 @@ var DEFAULT_FLOW_EDITOR_LABELS = {
|
|
|
95
107
|
text: "Texto livre",
|
|
96
108
|
money: "Valor em R$",
|
|
97
109
|
date: "Data",
|
|
110
|
+
time: "Hor\xE1rio",
|
|
98
111
|
int: "N\xFAmero inteiro",
|
|
99
112
|
cpf: "CPF",
|
|
100
113
|
choice: "Escolha (bot\xF5es/lista)"
|
|
@@ -283,6 +296,11 @@ var keywordHandle = (keyword) => `${KEYWORD_HANDLE_PREFIX}${keyword}`;
|
|
|
283
296
|
function keywordOfHandle(handle) {
|
|
284
297
|
return handle.startsWith(KEYWORD_HANDLE_PREFIX) ? handle.slice(KEYWORD_HANDLE_PREFIX.length) : void 0;
|
|
285
298
|
}
|
|
299
|
+
var POSSIBLE_NEXT_HANDLE_PREFIX = "maybe:";
|
|
300
|
+
var possibleNextHandle = (target) => `${POSSIBLE_NEXT_HANDLE_PREFIX}${target}`;
|
|
301
|
+
function possibleNextOfHandle(handle) {
|
|
302
|
+
return handle.startsWith(POSSIBLE_NEXT_HANDLE_PREFIX) ? handle.slice(POSSIBLE_NEXT_HANDLE_PREFIX.length) : void 0;
|
|
303
|
+
}
|
|
286
304
|
var CROSS_FLOW_PREFIX = "flow:";
|
|
287
305
|
var isCrossFlowTarget = (target) => target.startsWith(CROSS_FLOW_PREFIX);
|
|
288
306
|
var crossFlowKey = (target) => target.slice(CROSS_FLOW_PREFIX.length);
|
|
@@ -293,8 +311,9 @@ function estimateNodeHeight(node) {
|
|
|
293
311
|
const PADDING = 16;
|
|
294
312
|
const ROW_HEIGHT = 34;
|
|
295
313
|
const rowCount = node.type === "action" ? (
|
|
296
|
-
// Ação de passagem desenha uma linha de saída; terminal não desenha nenhuma.
|
|
297
|
-
|
|
314
|
+
// Ação de passagem desenha uma linha de saída; terminal não desenha nenhuma. Cada destino
|
|
315
|
+
// declarado em `possibleNext` é mais uma linha.
|
|
316
|
+
(isPassThroughAction(node) ? 1 : 0) + (node.possibleNext?.length ?? 0)
|
|
298
317
|
) : node.type === "condition" ? 2 : node.type === "menu" || node.questionType === "choice" ? (node.options?.length ?? 0) + 1 + keywordCount(node) : 1 + keywordCount(node);
|
|
299
318
|
return HEADER_HEIGHT + BODY_HEIGHT + PADDING + rowCount * ROW_HEIGHT;
|
|
300
319
|
}
|
|
@@ -319,7 +338,7 @@ function rendersAsButtons(options, optionDetails) {
|
|
|
319
338
|
);
|
|
320
339
|
return !hasDetails && (options?.length ?? 0) <= WHATSAPP_LIMITS.MAX_BUTTONS;
|
|
321
340
|
}
|
|
322
|
-
function
|
|
341
|
+
function nextTargetsOf(node) {
|
|
323
342
|
if (!node.next) return [];
|
|
324
343
|
if (typeof node.next === "string") return [{ target: node.next }];
|
|
325
344
|
return [
|
|
@@ -328,6 +347,10 @@ function targetsOf(node) {
|
|
|
328
347
|
{ target: node.next.default, isDefault: true }
|
|
329
348
|
];
|
|
330
349
|
}
|
|
350
|
+
function targetsOf(node) {
|
|
351
|
+
const possible = (node.possibleNext ?? []).map((target) => ({ target, isPossible: true }));
|
|
352
|
+
return [...nextTargetsOf(node), ...possible];
|
|
353
|
+
}
|
|
331
354
|
function validateGraph(graph, issueText) {
|
|
332
355
|
const issues = [];
|
|
333
356
|
const nodeIds = new Set(Object.keys(graph.nodes));
|
|
@@ -379,6 +402,10 @@ function validateGraph(graph, issueText) {
|
|
|
379
402
|
issues.push({ severity: "error", nodeId: node.id, message: issueText.tooManyOptions(node.id, options.length) });
|
|
380
403
|
}
|
|
381
404
|
}
|
|
405
|
+
if ((node.possibleNext?.length ?? 0) > 0 && (node.type !== "action" || !node.actionKind)) {
|
|
406
|
+
const message = issueText.possibleNextIgnored?.(node.id) ?? `${node.id}: "destinos que a a\xE7\xE3o pode escolher" s\xF3 valem em n\xF3 de a\xE7\xE3o com tipo de a\xE7\xE3o.`;
|
|
407
|
+
issues.push({ severity: "warning", nodeId: node.id, message });
|
|
408
|
+
}
|
|
382
409
|
if (node.type === "dynamic_choice" && !node.choiceProvider) {
|
|
383
410
|
const message = issueText.dynamicChoiceWithoutProvider?.(node.id) ?? `${node.id}: escolha din\xE2mica sem provedor de op\xE7\xF5es.`;
|
|
384
411
|
issues.push({ severity: "error", nodeId: node.id, message });
|
|
@@ -601,7 +628,15 @@ function selfLoopHandles(node) {
|
|
|
601
628
|
}
|
|
602
629
|
function sourceRows(node, labels) {
|
|
603
630
|
if (node.type === "action") {
|
|
604
|
-
|
|
631
|
+
const rowLabel = labels.runnerFields?.possibleNextRowLabel ?? OPTIONAL_RUNNER_FIELD_LABEL_DEFAULTS.possibleNextRowLabel;
|
|
632
|
+
const possibleRows = (node.possibleNext ?? []).map((target) => ({
|
|
633
|
+
id: possibleNextHandle(target),
|
|
634
|
+
label: `${rowLabel}: ${target}`,
|
|
635
|
+
isDefault: true,
|
|
636
|
+
isSelfLoop: target === node.id
|
|
637
|
+
}));
|
|
638
|
+
const nextRows = isPassThroughAction(node) ? [{ id: "next", label: labels.nodePanel.nextRowLabel, isDefault: false, isSelfLoop: false }] : [];
|
|
639
|
+
return [...nextRows, ...possibleRows];
|
|
605
640
|
}
|
|
606
641
|
const loops = selfLoopHandles(node);
|
|
607
642
|
if (node.type === "condition") {
|
|
@@ -1365,7 +1400,7 @@ var flowEdgeTypes = { flowConnection: FlowConnectionEdge };
|
|
|
1365
1400
|
|
|
1366
1401
|
// src/flows/FlowNodePanel.tsx
|
|
1367
1402
|
import { useState as useState5 } from "react";
|
|
1368
|
-
import { Plus as
|
|
1403
|
+
import { Plus as Plus5, Trash2 as Trash23, Save, X as X3, AlertTriangle as AlertTriangle2, AlertCircle as AlertCircle2 } from "lucide-react";
|
|
1369
1404
|
|
|
1370
1405
|
// src/flows/FlowWhatsAppPreview.tsx
|
|
1371
1406
|
import { List } from "lucide-react";
|
|
@@ -1427,7 +1462,7 @@ function FlowWhatsAppPreview({
|
|
|
1427
1462
|
);
|
|
1428
1463
|
}
|
|
1429
1464
|
|
|
1430
|
-
// src/flows/
|
|
1465
|
+
// src/flows/FlowPossibleNextField.tsx
|
|
1431
1466
|
import { Plus as Plus3, Trash2 } from "lucide-react";
|
|
1432
1467
|
|
|
1433
1468
|
// src/flows/flowPanelStyles.ts
|
|
@@ -1435,8 +1470,81 @@ var PANEL_FIELD_CLASSNAME = "border border-gray-200 dark:border-gray-600 dark:bg
|
|
|
1435
1470
|
var PANEL_LABEL_CLASSNAME = "text-xs font-medium text-gray-500 dark:text-gray-400";
|
|
1436
1471
|
var PANEL_HINT_CLASSNAME = "text-[11px] text-gray-400 dark:text-gray-500 mt-1";
|
|
1437
1472
|
|
|
1438
|
-
// src/flows/
|
|
1473
|
+
// src/flows/FlowPossibleNextField.tsx
|
|
1439
1474
|
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1475
|
+
function withPossibleNext(node, targets) {
|
|
1476
|
+
return { ...node, possibleNext: targets.length > 0 ? targets : void 0 };
|
|
1477
|
+
}
|
|
1478
|
+
function FlowPossibleNextField({
|
|
1479
|
+
draft,
|
|
1480
|
+
onDraftChange,
|
|
1481
|
+
renderTargetOptions,
|
|
1482
|
+
labels
|
|
1483
|
+
}) {
|
|
1484
|
+
const defaults = OPTIONAL_RUNNER_FIELD_LABEL_DEFAULTS;
|
|
1485
|
+
const targets = draft.possibleNext ?? [];
|
|
1486
|
+
const addLabel = labels.addPossibleNext ?? defaults.addPossibleNext;
|
|
1487
|
+
const removeLabel = labels.removePossibleNext ?? defaults.removePossibleNext;
|
|
1488
|
+
const fieldLabel = labels.possibleNext ?? defaults.possibleNext;
|
|
1489
|
+
function updateTarget(index, value) {
|
|
1490
|
+
const next = targets.map((target, targetIndex) => targetIndex === index ? value : target);
|
|
1491
|
+
onDraftChange((previous) => withPossibleNext(previous, next));
|
|
1492
|
+
}
|
|
1493
|
+
return /* @__PURE__ */ jsxs10("div", { className: "pt-2 border-t border-gray-100 dark:border-gray-700", children: [
|
|
1494
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between", children: [
|
|
1495
|
+
/* @__PURE__ */ jsx11("label", { className: PANEL_LABEL_CLASSNAME, children: fieldLabel }),
|
|
1496
|
+
/* @__PURE__ */ jsxs10(
|
|
1497
|
+
"button",
|
|
1498
|
+
{
|
|
1499
|
+
type: "button",
|
|
1500
|
+
"aria-label": addLabel,
|
|
1501
|
+
onClick: () => onDraftChange((previous) => withPossibleNext(previous, [...targets, ""])),
|
|
1502
|
+
className: "text-xs text-blue-600 hover:underline flex items-center gap-1",
|
|
1503
|
+
children: [
|
|
1504
|
+
/* @__PURE__ */ jsx11(Plus3, { size: 12, "aria-hidden": "true" }),
|
|
1505
|
+
" ",
|
|
1506
|
+
addLabel
|
|
1507
|
+
]
|
|
1508
|
+
}
|
|
1509
|
+
)
|
|
1510
|
+
] }),
|
|
1511
|
+
/* @__PURE__ */ jsx11("p", { className: PANEL_HINT_CLASSNAME, children: labels.possibleNextHint ?? defaults.possibleNextHint }),
|
|
1512
|
+
/* @__PURE__ */ jsx11("div", { className: "space-y-2 mt-1", children: targets.map((target, index) => /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
1513
|
+
/* @__PURE__ */ jsxs10(
|
|
1514
|
+
"select",
|
|
1515
|
+
{
|
|
1516
|
+
value: target,
|
|
1517
|
+
"aria-label": fieldLabel,
|
|
1518
|
+
onChange: (event) => updateTarget(index, event.target.value),
|
|
1519
|
+
className: `flex-1 ${PANEL_FIELD_CLASSNAME}`,
|
|
1520
|
+
children: [
|
|
1521
|
+
/* @__PURE__ */ jsx11("option", { value: "", children: "\u2014" }),
|
|
1522
|
+
renderTargetOptions()
|
|
1523
|
+
]
|
|
1524
|
+
}
|
|
1525
|
+
),
|
|
1526
|
+
/* @__PURE__ */ jsx11(
|
|
1527
|
+
"button",
|
|
1528
|
+
{
|
|
1529
|
+
type: "button",
|
|
1530
|
+
"aria-label": removeLabel,
|
|
1531
|
+
onClick: () => onDraftChange(
|
|
1532
|
+
(previous) => withPossibleNext(
|
|
1533
|
+
previous,
|
|
1534
|
+
targets.filter((_, targetIndex) => targetIndex !== index)
|
|
1535
|
+
)
|
|
1536
|
+
),
|
|
1537
|
+
className: "text-gray-400 hover:text-red-600",
|
|
1538
|
+
children: /* @__PURE__ */ jsx11(Trash2, { size: 14, "aria-hidden": "true" })
|
|
1539
|
+
}
|
|
1540
|
+
)
|
|
1541
|
+
] }, index)) })
|
|
1542
|
+
] });
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
// src/flows/FlowKeywordRoutesField.tsx
|
|
1546
|
+
import { Plus as Plus4, Trash2 as Trash22 } from "lucide-react";
|
|
1547
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1440
1548
|
function withRoutes(node, routes) {
|
|
1441
1549
|
const current = typeof node.next === "object" && node.next ? node.next : { byAnswer: {}, default: node.next ?? "" };
|
|
1442
1550
|
const rest = { ...current };
|
|
@@ -1468,10 +1576,10 @@ function FlowKeywordRoutesField({
|
|
|
1468
1576
|
)
|
|
1469
1577
|
);
|
|
1470
1578
|
}
|
|
1471
|
-
return /* @__PURE__ */
|
|
1472
|
-
/* @__PURE__ */
|
|
1473
|
-
/* @__PURE__ */
|
|
1474
|
-
/* @__PURE__ */
|
|
1579
|
+
return /* @__PURE__ */ jsxs11("div", { children: [
|
|
1580
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between", children: [
|
|
1581
|
+
/* @__PURE__ */ jsx12("label", { className: PANEL_LABEL_CLASSNAME, children: labels.keywordRoutes }),
|
|
1582
|
+
/* @__PURE__ */ jsxs11(
|
|
1475
1583
|
"button",
|
|
1476
1584
|
{
|
|
1477
1585
|
type: "button",
|
|
@@ -1480,16 +1588,16 @@ function FlowKeywordRoutesField({
|
|
|
1480
1588
|
onClick: addRoute,
|
|
1481
1589
|
className: "text-xs text-blue-600 hover:underline flex items-center gap-1",
|
|
1482
1590
|
children: [
|
|
1483
|
-
/* @__PURE__ */
|
|
1591
|
+
/* @__PURE__ */ jsx12(Plus4, { size: 12, "aria-hidden": "true" }),
|
|
1484
1592
|
" ",
|
|
1485
1593
|
labels.addKeywordRoute
|
|
1486
1594
|
]
|
|
1487
1595
|
}
|
|
1488
1596
|
)
|
|
1489
1597
|
] }),
|
|
1490
|
-
/* @__PURE__ */
|
|
1491
|
-
/* @__PURE__ */
|
|
1492
|
-
/* @__PURE__ */
|
|
1598
|
+
/* @__PURE__ */ jsx12("p", { className: PANEL_HINT_CLASSNAME, children: labels.keywordRoutesHint }),
|
|
1599
|
+
/* @__PURE__ */ jsx12("div", { className: "space-y-2 mt-1", children: routes.map(([keyword, target], index) => /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
1600
|
+
/* @__PURE__ */ jsx12(
|
|
1493
1601
|
"input",
|
|
1494
1602
|
{
|
|
1495
1603
|
value: keyword,
|
|
@@ -1498,7 +1606,7 @@ function FlowKeywordRoutesField({
|
|
|
1498
1606
|
className: `w-28 ${PANEL_FIELD_CLASSNAME}`
|
|
1499
1607
|
}
|
|
1500
1608
|
),
|
|
1501
|
-
/* @__PURE__ */
|
|
1609
|
+
/* @__PURE__ */ jsxs11(
|
|
1502
1610
|
"select",
|
|
1503
1611
|
{
|
|
1504
1612
|
value: target,
|
|
@@ -1506,12 +1614,12 @@ function FlowKeywordRoutesField({
|
|
|
1506
1614
|
onChange: (event) => updateRoute(index, 1, event.target.value),
|
|
1507
1615
|
className: `flex-1 ${PANEL_FIELD_CLASSNAME}`,
|
|
1508
1616
|
children: [
|
|
1509
|
-
/* @__PURE__ */
|
|
1617
|
+
/* @__PURE__ */ jsx12("option", { value: "", children: "\u2014" }),
|
|
1510
1618
|
renderTargetOptions()
|
|
1511
1619
|
]
|
|
1512
1620
|
}
|
|
1513
1621
|
),
|
|
1514
|
-
/* @__PURE__ */
|
|
1622
|
+
/* @__PURE__ */ jsx12(
|
|
1515
1623
|
"button",
|
|
1516
1624
|
{
|
|
1517
1625
|
type: "button",
|
|
@@ -1519,7 +1627,7 @@ function FlowKeywordRoutesField({
|
|
|
1519
1627
|
"aria-label": labels.removeKeywordRoute,
|
|
1520
1628
|
onClick: () => removeRoute(index),
|
|
1521
1629
|
className: "text-gray-400 hover:text-red-600",
|
|
1522
|
-
children: /* @__PURE__ */
|
|
1630
|
+
children: /* @__PURE__ */ jsx12(Trash22, { size: 14, "aria-hidden": "true" })
|
|
1523
1631
|
}
|
|
1524
1632
|
)
|
|
1525
1633
|
] }, index)) })
|
|
@@ -1527,7 +1635,7 @@ function FlowKeywordRoutesField({
|
|
|
1527
1635
|
}
|
|
1528
1636
|
|
|
1529
1637
|
// src/flows/FlowRunnerFields.tsx
|
|
1530
|
-
import { Fragment as Fragment4, jsx as
|
|
1638
|
+
import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1531
1639
|
function toNumber(value) {
|
|
1532
1640
|
if (value.trim() === "") return void 0;
|
|
1533
1641
|
const parsed = Number(value);
|
|
@@ -1539,9 +1647,9 @@ function withValidation(node, patch) {
|
|
|
1539
1647
|
return { ...node, validation: Object.keys(cleaned).length > 0 ? cleaned : void 0 };
|
|
1540
1648
|
}
|
|
1541
1649
|
function NumberField(props) {
|
|
1542
|
-
return /* @__PURE__ */
|
|
1543
|
-
/* @__PURE__ */
|
|
1544
|
-
/* @__PURE__ */
|
|
1650
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex-1", children: [
|
|
1651
|
+
/* @__PURE__ */ jsx13("label", { className: PANEL_LABEL_CLASSNAME, children: props.label }),
|
|
1652
|
+
/* @__PURE__ */ jsx13(
|
|
1545
1653
|
"input",
|
|
1546
1654
|
{
|
|
1547
1655
|
type: "number",
|
|
@@ -1552,13 +1660,63 @@ function NumberField(props) {
|
|
|
1552
1660
|
)
|
|
1553
1661
|
] });
|
|
1554
1662
|
}
|
|
1555
|
-
function
|
|
1663
|
+
function ContextKeyField(props) {
|
|
1664
|
+
return /* @__PURE__ */ jsxs12("div", { children: [
|
|
1665
|
+
/* @__PURE__ */ jsx13("label", { className: PANEL_LABEL_CLASSNAME, children: props.label }),
|
|
1666
|
+
/* @__PURE__ */ jsx13(
|
|
1667
|
+
"input",
|
|
1668
|
+
{
|
|
1669
|
+
value: props.value ?? "",
|
|
1670
|
+
list: "runner-context-keys",
|
|
1671
|
+
onChange: (event) => props.onValueChange(event.target.value || void 0),
|
|
1672
|
+
className: `w-full mt-1 ${PANEL_FIELD_CLASSNAME}`
|
|
1673
|
+
}
|
|
1674
|
+
),
|
|
1675
|
+
/* @__PURE__ */ jsx13("datalist", { id: "runner-context-keys", children: props.knownContextKeys.map((key) => /* @__PURE__ */ jsx13("option", { value: key }, key)) }),
|
|
1676
|
+
props.hint && /* @__PURE__ */ jsx13("p", { className: PANEL_HINT_CLASSNAME, children: props.hint })
|
|
1677
|
+
] });
|
|
1678
|
+
}
|
|
1679
|
+
function TimeValidationFields({ draft, onDraftChange, knownContextKeys, labels }) {
|
|
1680
|
+
const validation = draft.validation ?? {};
|
|
1681
|
+
const update = (patch) => onDraftChange((previous) => withValidation(previous, patch));
|
|
1682
|
+
const defaults = OPTIONAL_RUNNER_FIELD_LABEL_DEFAULTS;
|
|
1683
|
+
const timeInput = (label, value, onValueChange) => /* @__PURE__ */ jsxs12("div", { className: "flex-1", children: [
|
|
1684
|
+
/* @__PURE__ */ jsx13("label", { className: PANEL_LABEL_CLASSNAME, children: label }),
|
|
1685
|
+
/* @__PURE__ */ jsx13(
|
|
1686
|
+
"input",
|
|
1687
|
+
{
|
|
1688
|
+
type: "time",
|
|
1689
|
+
value: value ?? "",
|
|
1690
|
+
onChange: (event) => onValueChange(event.target.value || void 0),
|
|
1691
|
+
className: `w-full mt-1 ${PANEL_FIELD_CLASSNAME}`
|
|
1692
|
+
}
|
|
1693
|
+
)
|
|
1694
|
+
] });
|
|
1695
|
+
return /* @__PURE__ */ jsxs12("div", { className: "space-y-2", children: [
|
|
1696
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex gap-2", children: [
|
|
1697
|
+
timeInput(labels.minTime ?? defaults.minTime, validation.minTime, (minTime) => update({ minTime })),
|
|
1698
|
+
timeInput(labels.maxTime ?? defaults.maxTime, validation.maxTime, (maxTime) => update({ maxTime }))
|
|
1699
|
+
] }),
|
|
1700
|
+
/* @__PURE__ */ jsx13(
|
|
1701
|
+
ContextKeyField,
|
|
1702
|
+
{
|
|
1703
|
+
label: labels.timeWindowsContextKey ?? defaults.timeWindowsContextKey,
|
|
1704
|
+
hint: labels.timeWindowsContextKeyHint ?? defaults.timeWindowsContextKeyHint,
|
|
1705
|
+
value: validation.windowsContextKey,
|
|
1706
|
+
knownContextKeys,
|
|
1707
|
+
onValueChange: (windowsContextKey) => update({ windowsContextKey })
|
|
1708
|
+
}
|
|
1709
|
+
)
|
|
1710
|
+
] });
|
|
1711
|
+
}
|
|
1712
|
+
function ValidationFields(props) {
|
|
1713
|
+
const { draft, onDraftChange, knownContextKeys, labels } = props;
|
|
1556
1714
|
const validation = draft.validation ?? {};
|
|
1557
1715
|
const update = (patch) => onDraftChange((previous) => withValidation(previous, patch));
|
|
1558
1716
|
if (draft.questionType === "date") {
|
|
1559
|
-
return /* @__PURE__ */
|
|
1560
|
-
/* @__PURE__ */
|
|
1561
|
-
/* @__PURE__ */
|
|
1717
|
+
return /* @__PURE__ */ jsxs12("div", { className: "space-y-2", children: [
|
|
1718
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-xs text-gray-600 dark:text-gray-300", children: [
|
|
1719
|
+
/* @__PURE__ */ jsx13(
|
|
1562
1720
|
"input",
|
|
1563
1721
|
{
|
|
1564
1722
|
type: "checkbox",
|
|
@@ -1568,30 +1726,27 @@ function ValidationFields({ draft, onDraftChange, knownContextKeys, labels }) {
|
|
|
1568
1726
|
),
|
|
1569
1727
|
labels.minDateToday
|
|
1570
1728
|
] }),
|
|
1571
|
-
/* @__PURE__ */
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
}
|
|
1581
|
-
),
|
|
1582
|
-
/* @__PURE__ */ jsx12("datalist", { id: "runner-context-keys", children: knownContextKeys.map((key) => /* @__PURE__ */ jsx12("option", { value: key }, key)) })
|
|
1583
|
-
] })
|
|
1729
|
+
/* @__PURE__ */ jsx13(
|
|
1730
|
+
ContextKeyField,
|
|
1731
|
+
{
|
|
1732
|
+
label: labels.afterContextKey,
|
|
1733
|
+
value: validation.afterContextKey,
|
|
1734
|
+
knownContextKeys,
|
|
1735
|
+
onValueChange: (afterContextKey) => update({ afterContextKey })
|
|
1736
|
+
}
|
|
1737
|
+
)
|
|
1584
1738
|
] });
|
|
1585
1739
|
}
|
|
1740
|
+
if (draft.questionType === "time") return /* @__PURE__ */ jsx13(TimeValidationFields, { ...props });
|
|
1586
1741
|
if (draft.questionType === "int" || draft.questionType === "money") {
|
|
1587
|
-
return /* @__PURE__ */
|
|
1588
|
-
/* @__PURE__ */
|
|
1589
|
-
/* @__PURE__ */
|
|
1742
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex gap-2", children: [
|
|
1743
|
+
/* @__PURE__ */ jsx13(NumberField, { label: labels.minValue, value: validation.min, onValueChange: (min) => update({ min }) }),
|
|
1744
|
+
/* @__PURE__ */ jsx13(NumberField, { label: labels.maxValue, value: validation.max, onValueChange: (max) => update({ max }) })
|
|
1590
1745
|
] });
|
|
1591
1746
|
}
|
|
1592
1747
|
if (!draft.questionType || draft.questionType === "text") {
|
|
1593
|
-
return /* @__PURE__ */
|
|
1594
|
-
/* @__PURE__ */
|
|
1748
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex gap-2", children: [
|
|
1749
|
+
/* @__PURE__ */ jsx13(
|
|
1595
1750
|
NumberField,
|
|
1596
1751
|
{
|
|
1597
1752
|
label: labels.minLength,
|
|
@@ -1599,7 +1754,7 @@ function ValidationFields({ draft, onDraftChange, knownContextKeys, labels }) {
|
|
|
1599
1754
|
onValueChange: (minLength) => update({ minLength })
|
|
1600
1755
|
}
|
|
1601
1756
|
),
|
|
1602
|
-
/* @__PURE__ */
|
|
1757
|
+
/* @__PURE__ */ jsx13(
|
|
1603
1758
|
NumberField,
|
|
1604
1759
|
{
|
|
1605
1760
|
label: labels.maxLength,
|
|
@@ -1621,10 +1776,10 @@ function OptionDetailsField({ draft, onDraftChange, labels }) {
|
|
|
1621
1776
|
return { ...previous, optionDetails: { ...previous.optionDetails, [optionId]: detail } };
|
|
1622
1777
|
});
|
|
1623
1778
|
}
|
|
1624
|
-
return /* @__PURE__ */
|
|
1625
|
-
/* @__PURE__ */
|
|
1626
|
-
/* @__PURE__ */
|
|
1627
|
-
/* @__PURE__ */
|
|
1779
|
+
return /* @__PURE__ */ jsx13("div", { className: "space-y-2", children: options.map(([optionId, title]) => /* @__PURE__ */ jsxs12("div", { className: "space-y-1", children: [
|
|
1780
|
+
/* @__PURE__ */ jsx13("span", { className: "text-[11px] font-medium text-gray-500 dark:text-gray-400", children: title || optionId }),
|
|
1781
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex gap-2", children: [
|
|
1782
|
+
/* @__PURE__ */ jsx13(
|
|
1628
1783
|
"input",
|
|
1629
1784
|
{
|
|
1630
1785
|
value: draft.optionDetails?.[optionId]?.description ?? "",
|
|
@@ -1634,7 +1789,7 @@ function OptionDetailsField({ draft, onDraftChange, labels }) {
|
|
|
1634
1789
|
className: `flex-1 ${PANEL_FIELD_CLASSNAME}`
|
|
1635
1790
|
}
|
|
1636
1791
|
),
|
|
1637
|
-
/* @__PURE__ */
|
|
1792
|
+
/* @__PURE__ */ jsx13(
|
|
1638
1793
|
"input",
|
|
1639
1794
|
{
|
|
1640
1795
|
value: draft.optionDetails?.[optionId]?.section ?? "",
|
|
@@ -1648,9 +1803,9 @@ function OptionDetailsField({ draft, onDraftChange, labels }) {
|
|
|
1648
1803
|
] }, optionId)) });
|
|
1649
1804
|
}
|
|
1650
1805
|
function TextField(props) {
|
|
1651
|
-
return /* @__PURE__ */
|
|
1652
|
-
/* @__PURE__ */
|
|
1653
|
-
/* @__PURE__ */
|
|
1806
|
+
return /* @__PURE__ */ jsxs12("div", { children: [
|
|
1807
|
+
/* @__PURE__ */ jsx13("label", { className: PANEL_LABEL_CLASSNAME, children: props.label }),
|
|
1808
|
+
/* @__PURE__ */ jsx13(
|
|
1654
1809
|
"input",
|
|
1655
1810
|
{
|
|
1656
1811
|
value: props.value,
|
|
@@ -1659,7 +1814,7 @@ function TextField(props) {
|
|
|
1659
1814
|
className: `w-full mt-1 ${PANEL_FIELD_CLASSNAME}`
|
|
1660
1815
|
}
|
|
1661
1816
|
),
|
|
1662
|
-
props.hint && /* @__PURE__ */
|
|
1817
|
+
props.hint && /* @__PURE__ */ jsx13("p", { className: PANEL_HINT_CLASSNAME, children: props.hint })
|
|
1663
1818
|
] });
|
|
1664
1819
|
}
|
|
1665
1820
|
function FlowRunnerFields(props) {
|
|
@@ -1667,11 +1822,11 @@ function FlowRunnerFields(props) {
|
|
|
1667
1822
|
const isDynamic = draft.type === "dynamic_choice";
|
|
1668
1823
|
const isChoice = draft.type === "menu" || draft.questionType === "choice";
|
|
1669
1824
|
const isQuestion = draft.type === "question" && !isChoice;
|
|
1670
|
-
return /* @__PURE__ */
|
|
1671
|
-
/* @__PURE__ */
|
|
1672
|
-
/* @__PURE__ */
|
|
1673
|
-
isDynamic && /* @__PURE__ */
|
|
1674
|
-
/* @__PURE__ */
|
|
1825
|
+
return /* @__PURE__ */ jsxs12("div", { className: "pt-2 border-t border-gray-100 dark:border-gray-700 space-y-3", children: [
|
|
1826
|
+
/* @__PURE__ */ jsx13("p", { className: "text-xs font-semibold text-gray-700 dark:text-gray-200", children: labels.section }),
|
|
1827
|
+
/* @__PURE__ */ jsx13("p", { className: PANEL_HINT_CLASSNAME, children: labels.placeholdersHint }),
|
|
1828
|
+
isDynamic && /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
1829
|
+
/* @__PURE__ */ jsx13(
|
|
1675
1830
|
TextField,
|
|
1676
1831
|
{
|
|
1677
1832
|
label: labels.choiceProvider,
|
|
@@ -1680,7 +1835,7 @@ function FlowRunnerFields(props) {
|
|
|
1680
1835
|
onValueChange: (value) => onDraftChange((previous) => ({ ...previous, choiceProvider: value || void 0 }))
|
|
1681
1836
|
}
|
|
1682
1837
|
),
|
|
1683
|
-
/* @__PURE__ */
|
|
1838
|
+
/* @__PURE__ */ jsx13(
|
|
1684
1839
|
TextField,
|
|
1685
1840
|
{
|
|
1686
1841
|
label: labels.contextKey,
|
|
@@ -1689,11 +1844,11 @@ function FlowRunnerFields(props) {
|
|
|
1689
1844
|
}
|
|
1690
1845
|
)
|
|
1691
1846
|
] }),
|
|
1692
|
-
isQuestion && /* @__PURE__ */
|
|
1693
|
-
isChoice && /* @__PURE__ */
|
|
1694
|
-
isChoice && /* @__PURE__ */
|
|
1695
|
-
/* @__PURE__ */
|
|
1696
|
-
/* @__PURE__ */
|
|
1847
|
+
isQuestion && /* @__PURE__ */ jsx13(ValidationFields, { ...props }),
|
|
1848
|
+
isChoice && /* @__PURE__ */ jsx13(OptionDetailsField, { ...props }),
|
|
1849
|
+
isChoice && /* @__PURE__ */ jsxs12("div", { children: [
|
|
1850
|
+
/* @__PURE__ */ jsx13("label", { className: PANEL_LABEL_CLASSNAME, children: labels.unmatchedChoice }),
|
|
1851
|
+
/* @__PURE__ */ jsxs12(
|
|
1697
1852
|
"select",
|
|
1698
1853
|
{
|
|
1699
1854
|
value: draft.unmatchedChoice ?? "reask",
|
|
@@ -1703,13 +1858,13 @@ function FlowRunnerFields(props) {
|
|
|
1703
1858
|
},
|
|
1704
1859
|
className: `w-full mt-1 ${PANEL_FIELD_CLASSNAME}`,
|
|
1705
1860
|
children: [
|
|
1706
|
-
/* @__PURE__ */
|
|
1707
|
-
/* @__PURE__ */
|
|
1861
|
+
/* @__PURE__ */ jsx13("option", { value: "reask", children: labels.unmatchedChoiceReask }),
|
|
1862
|
+
/* @__PURE__ */ jsx13("option", { value: "default", children: labels.unmatchedChoiceDefault })
|
|
1708
1863
|
]
|
|
1709
1864
|
}
|
|
1710
1865
|
)
|
|
1711
1866
|
] }),
|
|
1712
|
-
(isChoice || isDynamic) && /* @__PURE__ */
|
|
1867
|
+
(isChoice || isDynamic) && /* @__PURE__ */ jsx13(
|
|
1713
1868
|
TextField,
|
|
1714
1869
|
{
|
|
1715
1870
|
label: labels.listButtonLabel,
|
|
@@ -1717,7 +1872,7 @@ function FlowRunnerFields(props) {
|
|
|
1717
1872
|
onValueChange: (value) => onDraftChange((previous) => ({ ...previous, listButtonLabel: value || void 0 }))
|
|
1718
1873
|
}
|
|
1719
1874
|
),
|
|
1720
|
-
isQuestion && /* @__PURE__ */
|
|
1875
|
+
isQuestion && /* @__PURE__ */ jsx13(
|
|
1721
1876
|
TextField,
|
|
1722
1877
|
{
|
|
1723
1878
|
label: labels.skipKeywords,
|
|
@@ -1729,7 +1884,7 @@ function FlowRunnerFields(props) {
|
|
|
1729
1884
|
}
|
|
1730
1885
|
}
|
|
1731
1886
|
),
|
|
1732
|
-
/* @__PURE__ */
|
|
1887
|
+
/* @__PURE__ */ jsx13(
|
|
1733
1888
|
TextField,
|
|
1734
1889
|
{
|
|
1735
1890
|
label: labels.fallbackMessage,
|
|
@@ -1738,8 +1893,8 @@ function FlowRunnerFields(props) {
|
|
|
1738
1893
|
onValueChange: (value) => onDraftChange((previous) => ({ ...previous, fallbackMessage: value || void 0 }))
|
|
1739
1894
|
}
|
|
1740
1895
|
),
|
|
1741
|
-
/* @__PURE__ */
|
|
1742
|
-
/* @__PURE__ */
|
|
1896
|
+
/* @__PURE__ */ jsxs12("div", { children: [
|
|
1897
|
+
/* @__PURE__ */ jsx13(
|
|
1743
1898
|
NumberField,
|
|
1744
1899
|
{
|
|
1745
1900
|
label: labels.maxInvalidAnswers,
|
|
@@ -1750,14 +1905,14 @@ function FlowRunnerFields(props) {
|
|
|
1750
1905
|
}))
|
|
1751
1906
|
}
|
|
1752
1907
|
),
|
|
1753
|
-
/* @__PURE__ */
|
|
1908
|
+
/* @__PURE__ */ jsx13("p", { className: PANEL_HINT_CLASSNAME, children: labels.maxInvalidAnswersHint })
|
|
1754
1909
|
] }),
|
|
1755
|
-
(draft.type === "menu" || draft.type === "question") && /* @__PURE__ */
|
|
1910
|
+
(draft.type === "menu" || draft.type === "question") && /* @__PURE__ */ jsx13(FlowKeywordRoutesField, { ...props })
|
|
1756
1911
|
] });
|
|
1757
1912
|
}
|
|
1758
1913
|
|
|
1759
1914
|
// src/flows/FlowNodePanel.tsx
|
|
1760
|
-
import { Fragment as Fragment5, jsx as
|
|
1915
|
+
import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1761
1916
|
var SELECT_CLASSNAME = PANEL_FIELD_CLASSNAME;
|
|
1762
1917
|
var INPUT_CLASSNAME = PANEL_FIELD_CLASSNAME;
|
|
1763
1918
|
function truncateLabel(value, max = 60) {
|
|
@@ -1773,10 +1928,10 @@ function WhatsAppTextField({
|
|
|
1773
1928
|
placeholder,
|
|
1774
1929
|
labels
|
|
1775
1930
|
}) {
|
|
1776
|
-
return /* @__PURE__ */
|
|
1777
|
-
/* @__PURE__ */
|
|
1778
|
-
/* @__PURE__ */
|
|
1779
|
-
/* @__PURE__ */
|
|
1931
|
+
return /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
|
|
1932
|
+
/* @__PURE__ */ jsxs13("div", { children: [
|
|
1933
|
+
/* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: label }),
|
|
1934
|
+
/* @__PURE__ */ jsx14(
|
|
1780
1935
|
"textarea",
|
|
1781
1936
|
{
|
|
1782
1937
|
value,
|
|
@@ -1787,18 +1942,18 @@ function WhatsAppTextField({
|
|
|
1787
1942
|
}
|
|
1788
1943
|
)
|
|
1789
1944
|
] }),
|
|
1790
|
-
/* @__PURE__ */
|
|
1791
|
-
/* @__PURE__ */
|
|
1792
|
-
/* @__PURE__ */
|
|
1945
|
+
/* @__PURE__ */ jsxs13("div", { children: [
|
|
1946
|
+
/* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.preview }),
|
|
1947
|
+
/* @__PURE__ */ jsx14("div", { className: "mt-1", children: /* @__PURE__ */ jsx14(FlowWhatsAppPreview, { body: value, options, optionDetails, labels: labels.nodePanel }) })
|
|
1793
1948
|
] })
|
|
1794
1949
|
] });
|
|
1795
1950
|
}
|
|
1796
1951
|
function IssueRow({ issue }) {
|
|
1797
1952
|
const Icon = issue.severity === "error" ? AlertCircle2 : AlertTriangle2;
|
|
1798
1953
|
const color = issue.severity === "error" ? "text-red-600 dark:text-red-400" : "text-amber-600 dark:text-amber-400";
|
|
1799
|
-
return /* @__PURE__ */
|
|
1800
|
-
/* @__PURE__ */
|
|
1801
|
-
/* @__PURE__ */
|
|
1954
|
+
return /* @__PURE__ */ jsxs13("div", { className: `flex items-start gap-1.5 text-xs ${color}`, children: [
|
|
1955
|
+
/* @__PURE__ */ jsx14(Icon, { size: 13, className: "mt-0.5 shrink-0" }),
|
|
1956
|
+
/* @__PURE__ */ jsx14("span", { children: issue.message })
|
|
1802
1957
|
] });
|
|
1803
1958
|
}
|
|
1804
1959
|
function FlowNodePanel({
|
|
@@ -1863,24 +2018,24 @@ function FlowNodePanel({
|
|
|
1863
2018
|
setDraft((prev) => ({ ...prev, options: (prev.options ?? []).filter((_, i) => i !== index) }));
|
|
1864
2019
|
}
|
|
1865
2020
|
function nextNodeOptions() {
|
|
1866
|
-
return /* @__PURE__ */
|
|
1867
|
-
otherNodeIds.map((id) => /* @__PURE__ */
|
|
1868
|
-
otherFlows.length > 0 && /* @__PURE__ */
|
|
2021
|
+
return /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
2022
|
+
otherNodeIds.map((id) => /* @__PURE__ */ jsx14("option", { value: id, children: truncateLabel(nodeLabel(graph.nodes[id], labels)) }, id)),
|
|
2023
|
+
otherFlows.length > 0 && /* @__PURE__ */ jsx14("optgroup", { label: labels.nodePanel.otherFlowsGroup, children: otherFlows.map((flow) => /* @__PURE__ */ jsx14("option", { value: `${CROSS_FLOW_PREFIX}${flow.key}`, children: flow.label }, flow.key)) })
|
|
1869
2024
|
] });
|
|
1870
2025
|
}
|
|
1871
|
-
return /* @__PURE__ */
|
|
1872
|
-
/* @__PURE__ */
|
|
1873
|
-
/* @__PURE__ */
|
|
1874
|
-
/* @__PURE__ */
|
|
2026
|
+
return /* @__PURE__ */ jsxs13("div", { className: "fixed inset-y-0 right-0 w-96 bg-white dark:bg-gray-800 border-l border-gray-200 dark:border-gray-700 shadow-xl z-50 flex flex-col", children: [
|
|
2027
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-100 dark:border-gray-700", children: [
|
|
2028
|
+
/* @__PURE__ */ jsx14("h3", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100", children: labels.nodePanel.title }),
|
|
2029
|
+
/* @__PURE__ */ jsx14("button", { "data-cv-tooltip": labels.nodePanel.close, "aria-label": labels.nodePanel.close, onClick: onClose, className: "text-gray-400 hover:text-gray-600", children: /* @__PURE__ */ jsx14(X3, { size: 18 }) })
|
|
1875
2030
|
] }),
|
|
1876
|
-
/* @__PURE__ */
|
|
1877
|
-
nodeIssues.length > 0 && /* @__PURE__ */
|
|
1878
|
-
isFixedLogic && /* @__PURE__ */
|
|
1879
|
-
isAction && /* @__PURE__ */
|
|
1880
|
-
isCondition && /* @__PURE__ */
|
|
1881
|
-
/* @__PURE__ */
|
|
1882
|
-
/* @__PURE__ */
|
|
1883
|
-
/* @__PURE__ */
|
|
2031
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex-1 overflow-y-auto p-4 space-y-4", children: [
|
|
2032
|
+
nodeIssues.length > 0 && /* @__PURE__ */ jsx14("div", { className: "rounded-lg border border-gray-100 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/40 p-2.5 space-y-1.5", children: nodeIssues.map((issue, i) => /* @__PURE__ */ jsx14(IssueRow, { issue }, i)) }),
|
|
2033
|
+
isFixedLogic && /* @__PURE__ */ jsx14("p", { className: "text-xs text-purple-700 dark:text-purple-400 bg-purple-50 dark:bg-purple-950/30 rounded-lg p-2", children: labels.nodePanel.fixedLogicNotice }),
|
|
2034
|
+
isAction && /* @__PURE__ */ jsx14("p", { className: "text-xs text-orange-700 dark:text-orange-400 bg-orange-50 dark:bg-orange-950/30 rounded-lg p-2", children: labels.nodePanel.actionNotice }),
|
|
2035
|
+
isCondition && /* @__PURE__ */ jsx14("p", { className: "text-xs text-cyan-700 dark:text-cyan-400 bg-cyan-50 dark:bg-cyan-950/30 rounded-lg p-2", children: labels.nodePanel.conditionNotice }),
|
|
2036
|
+
/* @__PURE__ */ jsxs13("div", { children: [
|
|
2037
|
+
/* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.nodeName }),
|
|
2038
|
+
/* @__PURE__ */ jsx14(
|
|
1884
2039
|
"input",
|
|
1885
2040
|
{
|
|
1886
2041
|
value: draft.label ?? "",
|
|
@@ -1889,11 +2044,11 @@ function FlowNodePanel({
|
|
|
1889
2044
|
className: `w-full mt-1 ${INPUT_CLASSNAME}`
|
|
1890
2045
|
}
|
|
1891
2046
|
),
|
|
1892
|
-
/* @__PURE__ */
|
|
2047
|
+
/* @__PURE__ */ jsx14("p", { className: "text-[11px] text-gray-400 dark:text-gray-500 mt-1", children: labels.nodePanel.nodeNameHint })
|
|
1893
2048
|
] }),
|
|
1894
|
-
draft.contextKey && /* @__PURE__ */
|
|
1895
|
-
/* @__PURE__ */
|
|
1896
|
-
/* @__PURE__ */
|
|
2049
|
+
draft.contextKey && /* @__PURE__ */ jsxs13("div", { children: [
|
|
2050
|
+
/* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.contextKey }),
|
|
2051
|
+
/* @__PURE__ */ jsx14(
|
|
1897
2052
|
"input",
|
|
1898
2053
|
{
|
|
1899
2054
|
value: draft.contextKey,
|
|
@@ -1902,19 +2057,19 @@ function FlowNodePanel({
|
|
|
1902
2057
|
}
|
|
1903
2058
|
)
|
|
1904
2059
|
] }),
|
|
1905
|
-
!isFixedLogic && !isAction && !isCondition && !isDynamicChoice && /* @__PURE__ */
|
|
1906
|
-
/* @__PURE__ */
|
|
1907
|
-
/* @__PURE__ */
|
|
2060
|
+
!isFixedLogic && !isAction && !isCondition && !isDynamicChoice && /* @__PURE__ */ jsxs13("div", { children: [
|
|
2061
|
+
/* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.questionType }),
|
|
2062
|
+
/* @__PURE__ */ jsx14(
|
|
1908
2063
|
"select",
|
|
1909
2064
|
{
|
|
1910
2065
|
value: draft.questionType ?? "text",
|
|
1911
2066
|
onChange: (e) => setDraft((prev) => ({ ...prev, questionType: e.target.value })),
|
|
1912
2067
|
className: `w-full mt-1 ${SELECT_CLASSNAME}`,
|
|
1913
|
-
children: Object.entries(labels.questionTypeLabels).map(([key, label]) => /* @__PURE__ */
|
|
2068
|
+
children: Object.entries(labels.questionTypeLabels).map(([key, label]) => /* @__PURE__ */ jsx14("option", { value: key, children: label }, key))
|
|
1914
2069
|
}
|
|
1915
2070
|
)
|
|
1916
2071
|
] }),
|
|
1917
|
-
!isFixedLogic && !isAction && !isCondition && /* @__PURE__ */
|
|
2072
|
+
!isFixedLogic && !isAction && !isCondition && /* @__PURE__ */ jsx14(
|
|
1918
2073
|
WhatsAppTextField,
|
|
1919
2074
|
{
|
|
1920
2075
|
label: labels.nodePanel.question,
|
|
@@ -1925,10 +2080,10 @@ function FlowNodePanel({
|
|
|
1925
2080
|
labels
|
|
1926
2081
|
}
|
|
1927
2082
|
),
|
|
1928
|
-
isCondition && /* @__PURE__ */
|
|
1929
|
-
/* @__PURE__ */
|
|
1930
|
-
/* @__PURE__ */
|
|
1931
|
-
/* @__PURE__ */
|
|
2083
|
+
isCondition && /* @__PURE__ */ jsxs13("div", { className: "space-y-3", children: [
|
|
2084
|
+
/* @__PURE__ */ jsxs13("div", { children: [
|
|
2085
|
+
/* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.conditionVariable }),
|
|
2086
|
+
/* @__PURE__ */ jsx14(
|
|
1932
2087
|
"input",
|
|
1933
2088
|
{
|
|
1934
2089
|
value: draft.conditionContextKey ?? "",
|
|
@@ -1937,11 +2092,11 @@ function FlowNodePanel({
|
|
|
1937
2092
|
className: `w-full mt-1 ${INPUT_CLASSNAME}`
|
|
1938
2093
|
}
|
|
1939
2094
|
),
|
|
1940
|
-
/* @__PURE__ */
|
|
2095
|
+
/* @__PURE__ */ jsx14("datalist", { id: "condition-context-keys", children: knownContextKeys.map((key) => /* @__PURE__ */ jsx14("option", { value: key }, key)) })
|
|
1941
2096
|
] }),
|
|
1942
|
-
/* @__PURE__ */
|
|
1943
|
-
/* @__PURE__ */
|
|
1944
|
-
/* @__PURE__ */
|
|
2097
|
+
/* @__PURE__ */ jsxs13("div", { children: [
|
|
2098
|
+
/* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.conditionOperator }),
|
|
2099
|
+
/* @__PURE__ */ jsx14(
|
|
1945
2100
|
"select",
|
|
1946
2101
|
{
|
|
1947
2102
|
value: draft.conditionOperator ?? ">",
|
|
@@ -1950,13 +2105,13 @@ function FlowNodePanel({
|
|
|
1950
2105
|
conditionOperator: e.target.value
|
|
1951
2106
|
})),
|
|
1952
2107
|
className: `w-full mt-1 ${SELECT_CLASSNAME}`,
|
|
1953
|
-
children: CONDITION_OPERATORS.map((operator) => /* @__PURE__ */
|
|
2108
|
+
children: CONDITION_OPERATORS.map((operator) => /* @__PURE__ */ jsx14("option", { value: operator, children: labels.conditionOperatorLabels[operator] ?? operator }, operator))
|
|
1954
2109
|
}
|
|
1955
2110
|
)
|
|
1956
2111
|
] }),
|
|
1957
|
-
/* @__PURE__ */
|
|
1958
|
-
/* @__PURE__ */
|
|
1959
|
-
/* @__PURE__ */
|
|
2112
|
+
/* @__PURE__ */ jsxs13("div", { children: [
|
|
2113
|
+
/* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.conditionValue }),
|
|
2114
|
+
/* @__PURE__ */ jsx14(
|
|
1960
2115
|
"input",
|
|
1961
2116
|
{
|
|
1962
2117
|
value: draft.conditionValue ?? "",
|
|
@@ -1966,7 +2121,7 @@ function FlowNodePanel({
|
|
|
1966
2121
|
)
|
|
1967
2122
|
] })
|
|
1968
2123
|
] }),
|
|
1969
|
-
isAction && draft.actionKind === "send_product_list" && /* @__PURE__ */
|
|
2124
|
+
isAction && draft.actionKind === "send_product_list" && /* @__PURE__ */ jsx14(
|
|
1970
2125
|
WhatsAppTextField,
|
|
1971
2126
|
{
|
|
1972
2127
|
label: labels.nodePanel.fallbackMessage,
|
|
@@ -1976,11 +2131,11 @@ function FlowNodePanel({
|
|
|
1976
2131
|
labels
|
|
1977
2132
|
}
|
|
1978
2133
|
),
|
|
1979
|
-
isSendMedia && /* @__PURE__ */
|
|
1980
|
-
/* @__PURE__ */
|
|
1981
|
-
/* @__PURE__ */
|
|
2134
|
+
isSendMedia && /* @__PURE__ */ jsxs13("div", { children: [
|
|
2135
|
+
/* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.media }),
|
|
2136
|
+
/* @__PURE__ */ jsx14("div", { className: "mt-1", children: renderMediaPicker?.(node, graph) ?? /* @__PURE__ */ jsx14("p", { className: "text-xs text-gray-400", children: labels.nodePanel.mediaUnavailable }) })
|
|
1982
2137
|
] }),
|
|
1983
|
-
isAction && draft.actionKind !== "send_product_list" && !isSendMedia && /* @__PURE__ */
|
|
2138
|
+
isAction && draft.actionKind !== "send_product_list" && !isSendMedia && /* @__PURE__ */ jsx14(
|
|
1984
2139
|
WhatsAppTextField,
|
|
1985
2140
|
{
|
|
1986
2141
|
label: labels.nodePanel.directMessage,
|
|
@@ -1990,17 +2145,17 @@ function FlowNodePanel({
|
|
|
1990
2145
|
labels
|
|
1991
2146
|
}
|
|
1992
2147
|
),
|
|
1993
|
-
(draft.questionType === "choice" || draft.type === "menu") && /* @__PURE__ */
|
|
1994
|
-
/* @__PURE__ */
|
|
1995
|
-
/* @__PURE__ */
|
|
1996
|
-
/* @__PURE__ */
|
|
1997
|
-
/* @__PURE__ */
|
|
2148
|
+
(draft.questionType === "choice" || draft.type === "menu") && /* @__PURE__ */ jsxs13("div", { children: [
|
|
2149
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between mb-1.5", children: [
|
|
2150
|
+
/* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.options }),
|
|
2151
|
+
/* @__PURE__ */ jsxs13("button", { "data-cv-tooltip": labels.nodePanel.addOption, "aria-label": labels.nodePanel.addOption, onClick: addOption, className: "text-xs text-blue-600 hover:underline flex items-center gap-1", children: [
|
|
2152
|
+
/* @__PURE__ */ jsx14(Plus5, { size: 12 }),
|
|
1998
2153
|
" ",
|
|
1999
2154
|
labels.nodePanel.addOption
|
|
2000
2155
|
] })
|
|
2001
2156
|
] }),
|
|
2002
|
-
/* @__PURE__ */
|
|
2003
|
-
/* @__PURE__ */
|
|
2157
|
+
/* @__PURE__ */ jsx14("div", { className: "space-y-2", children: (draft.options ?? []).map(([id, label], i) => /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
|
|
2158
|
+
/* @__PURE__ */ jsx14(
|
|
2004
2159
|
"input",
|
|
2005
2160
|
{
|
|
2006
2161
|
value: id,
|
|
@@ -2009,7 +2164,7 @@ function FlowNodePanel({
|
|
|
2009
2164
|
className: `w-16 ${INPUT_CLASSNAME}`
|
|
2010
2165
|
}
|
|
2011
2166
|
),
|
|
2012
|
-
/* @__PURE__ */
|
|
2167
|
+
/* @__PURE__ */ jsx14(
|
|
2013
2168
|
"input",
|
|
2014
2169
|
{
|
|
2015
2170
|
value: label,
|
|
@@ -2018,10 +2173,10 @@ function FlowNodePanel({
|
|
|
2018
2173
|
className: `flex-1 ${INPUT_CLASSNAME}`
|
|
2019
2174
|
}
|
|
2020
2175
|
),
|
|
2021
|
-
/* @__PURE__ */
|
|
2176
|
+
/* @__PURE__ */ jsx14("button", { "data-cv-tooltip": labels.nodePanel.removeOption, "aria-label": labels.nodePanel.removeOption, onClick: () => removeOption(i), className: "text-gray-400 hover:text-red-600", children: /* @__PURE__ */ jsx14(Trash23, { size: 14 }) })
|
|
2022
2177
|
] }, i)) })
|
|
2023
2178
|
] }),
|
|
2024
|
-
!isFixedLogic && !isAction && !isCondition && /* @__PURE__ */
|
|
2179
|
+
!isFixedLogic && !isAction && !isCondition && /* @__PURE__ */ jsx14(
|
|
2025
2180
|
FlowRunnerFields,
|
|
2026
2181
|
{
|
|
2027
2182
|
draft,
|
|
@@ -2031,46 +2186,55 @@ function FlowNodePanel({
|
|
|
2031
2186
|
labels: labels.runnerFields ?? DEFAULT_FLOW_RUNNER_FIELD_LABELS
|
|
2032
2187
|
}
|
|
2033
2188
|
),
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2189
|
+
isAction && draft.actionKind && /* @__PURE__ */ jsx14(
|
|
2190
|
+
FlowPossibleNextField,
|
|
2191
|
+
{
|
|
2192
|
+
draft,
|
|
2193
|
+
onDraftChange: setDraft,
|
|
2194
|
+
renderTargetOptions: nextNodeOptions,
|
|
2195
|
+
labels: labels.runnerFields ?? DEFAULT_FLOW_RUNNER_FIELD_LABELS
|
|
2196
|
+
}
|
|
2197
|
+
),
|
|
2198
|
+
(!isAction || isPassThroughAction2) && /* @__PURE__ */ jsxs13("div", { className: "pt-2 border-t border-gray-100 dark:border-gray-700", children: [
|
|
2199
|
+
/* @__PURE__ */ jsx14("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.nodePanel.next }),
|
|
2200
|
+
/* @__PURE__ */ jsx14("p", { className: "text-[11px] text-gray-400 dark:text-gray-500 mb-1", children: labels.nodePanel.nextHint }),
|
|
2201
|
+
typeof draft.next !== "object" && !isCondition ? /* @__PURE__ */ jsxs13(
|
|
2038
2202
|
"select",
|
|
2039
2203
|
{
|
|
2040
2204
|
value: typeof draft.next === "string" ? draft.next : "",
|
|
2041
2205
|
onChange: (e) => updateNextString(e.target.value),
|
|
2042
2206
|
className: `w-full mt-1 ${SELECT_CLASSNAME}`,
|
|
2043
2207
|
children: [
|
|
2044
|
-
/* @__PURE__ */
|
|
2208
|
+
/* @__PURE__ */ jsx14("option", { value: "", children: "\u2014" }),
|
|
2045
2209
|
nextNodeOptions()
|
|
2046
2210
|
]
|
|
2047
2211
|
}
|
|
2048
|
-
) : /* @__PURE__ */
|
|
2049
|
-
conditionAnswerIds.map((id) => /* @__PURE__ */
|
|
2050
|
-
/* @__PURE__ */
|
|
2051
|
-
/* @__PURE__ */
|
|
2212
|
+
) : /* @__PURE__ */ jsxs13("div", { className: "space-y-2 mt-1", children: [
|
|
2213
|
+
conditionAnswerIds.map((id) => /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
|
|
2214
|
+
/* @__PURE__ */ jsx14("span", { className: "text-xs text-gray-500 w-32 shrink-0", children: isCondition ? id === "true" ? labels.nodePanel.conditionTrue : labels.nodePanel.conditionFalse : labels.nodePanel.nextByAnswer(id) }),
|
|
2215
|
+
/* @__PURE__ */ jsxs13(
|
|
2052
2216
|
"select",
|
|
2053
2217
|
{
|
|
2054
2218
|
value: draft.next && typeof draft.next === "object" ? draft.next.byAnswer[id] ?? "" : "",
|
|
2055
2219
|
onChange: (e) => updateNextByAnswer(id, e.target.value),
|
|
2056
2220
|
className: `flex-1 ${SELECT_CLASSNAME}`,
|
|
2057
2221
|
children: [
|
|
2058
|
-
/* @__PURE__ */
|
|
2222
|
+
/* @__PURE__ */ jsx14("option", { value: "", children: "\u2014" }),
|
|
2059
2223
|
nextNodeOptions()
|
|
2060
2224
|
]
|
|
2061
2225
|
}
|
|
2062
2226
|
)
|
|
2063
2227
|
] }, id)),
|
|
2064
|
-
/* @__PURE__ */
|
|
2065
|
-
/* @__PURE__ */
|
|
2066
|
-
/* @__PURE__ */
|
|
2228
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
|
|
2229
|
+
/* @__PURE__ */ jsx14("span", { className: "text-xs text-gray-500 w-32 shrink-0", children: isCondition ? labels.nodePanel.conditionVariableMissing : labels.nodePanel.nextDefault }),
|
|
2230
|
+
/* @__PURE__ */ jsxs13(
|
|
2067
2231
|
"select",
|
|
2068
2232
|
{
|
|
2069
2233
|
value: draft.next && typeof draft.next === "object" ? draft.next.default : "",
|
|
2070
2234
|
onChange: (e) => updateNextDefault(e.target.value),
|
|
2071
2235
|
className: `flex-1 ${SELECT_CLASSNAME}`,
|
|
2072
2236
|
children: [
|
|
2073
|
-
/* @__PURE__ */
|
|
2237
|
+
/* @__PURE__ */ jsx14("option", { value: "", children: "\u2014" }),
|
|
2074
2238
|
nextNodeOptions()
|
|
2075
2239
|
]
|
|
2076
2240
|
}
|
|
@@ -2079,8 +2243,8 @@ function FlowNodePanel({
|
|
|
2079
2243
|
] })
|
|
2080
2244
|
] })
|
|
2081
2245
|
] }),
|
|
2082
|
-
/* @__PURE__ */
|
|
2083
|
-
/* @__PURE__ */
|
|
2246
|
+
/* @__PURE__ */ jsxs13("div", { className: "p-4 border-t border-gray-100 dark:border-gray-700 flex gap-2", children: [
|
|
2247
|
+
/* @__PURE__ */ jsxs13(
|
|
2084
2248
|
"button",
|
|
2085
2249
|
{
|
|
2086
2250
|
"data-cv-tooltip": labels.nodePanel.save,
|
|
@@ -2088,13 +2252,13 @@ function FlowNodePanel({
|
|
|
2088
2252
|
onClick: () => onChange(draft),
|
|
2089
2253
|
className: "flex-1 inline-flex items-center justify-center gap-2 rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700",
|
|
2090
2254
|
children: [
|
|
2091
|
-
/* @__PURE__ */
|
|
2255
|
+
/* @__PURE__ */ jsx14(Save, { size: 14 }),
|
|
2092
2256
|
" ",
|
|
2093
2257
|
labels.nodePanel.save
|
|
2094
2258
|
]
|
|
2095
2259
|
}
|
|
2096
2260
|
),
|
|
2097
|
-
!isStart && /* @__PURE__ */
|
|
2261
|
+
!isStart && /* @__PURE__ */ jsx14(
|
|
2098
2262
|
"button",
|
|
2099
2263
|
{
|
|
2100
2264
|
onClick: () => {
|
|
@@ -2103,10 +2267,10 @@ function FlowNodePanel({
|
|
|
2103
2267
|
"data-cv-tooltip": labels.nodePanel.delete,
|
|
2104
2268
|
"aria-label": labels.nodePanel.delete,
|
|
2105
2269
|
className: "px-3 py-2 text-sm text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-950/30 rounded-lg",
|
|
2106
|
-
children: /* @__PURE__ */
|
|
2270
|
+
children: /* @__PURE__ */ jsx14(Trash23, { size: 14 })
|
|
2107
2271
|
}
|
|
2108
2272
|
),
|
|
2109
|
-
/* @__PURE__ */
|
|
2273
|
+
/* @__PURE__ */ jsx14("button", { "data-cv-tooltip": labels.nodePanel.cancel, "aria-label": labels.nodePanel.cancel, onClick: onClose, className: "px-4 py-2 text-sm text-gray-600 dark:text-gray-300 hover:underline", children: labels.nodePanel.cancel })
|
|
2110
2274
|
] })
|
|
2111
2275
|
] });
|
|
2112
2276
|
}
|
|
@@ -2123,7 +2287,7 @@ import {
|
|
|
2123
2287
|
applyNodeChanges
|
|
2124
2288
|
} from "@xyflow/react";
|
|
2125
2289
|
import "@xyflow/react/dist/style.css";
|
|
2126
|
-
import { Plus as
|
|
2290
|
+
import { Plus as Plus6, Trash2 as Trash24, LayoutGrid, AlertTriangle as AlertTriangle3, AlertCircle as AlertCircle3, Save as Save2, Undo2, Map as MapIcon, Workflow } from "lucide-react";
|
|
2127
2291
|
|
|
2128
2292
|
// src/flows/flowEditorOps.ts
|
|
2129
2293
|
var NAMESPACE_SEPARATOR = "::";
|
|
@@ -2139,7 +2303,9 @@ function removeNodeAndCleanRefs(nodes, removedId) {
|
|
|
2139
2303
|
const remaining = {};
|
|
2140
2304
|
for (const [id, node] of Object.entries(nodes)) {
|
|
2141
2305
|
if (id === removedId) continue;
|
|
2142
|
-
|
|
2306
|
+
const cleaned = { ...node, next: cleanNext(node.next, removedId) };
|
|
2307
|
+
if (node.possibleNext) cleaned.possibleNext = node.possibleNext.filter((target) => target !== removedId);
|
|
2308
|
+
remaining[id] = cleaned;
|
|
2143
2309
|
}
|
|
2144
2310
|
return remaining;
|
|
2145
2311
|
}
|
|
@@ -2188,6 +2354,8 @@ function resolveConnection(params) {
|
|
|
2188
2354
|
function applyConnection(node, resolved) {
|
|
2189
2355
|
const currentNext = typeof node.next === "object" && node.next ? node.next : void 0;
|
|
2190
2356
|
if (resolved.handle === "next") return { ...node, next: resolved.targetValue };
|
|
2357
|
+
const possible = possibleNextOfHandle(resolved.handle);
|
|
2358
|
+
if (possible !== void 0) return withPossibleNext2(node, possible, resolved.targetValue);
|
|
2191
2359
|
if (resolved.handle === "__default") {
|
|
2192
2360
|
return { ...node, next: { ...currentNext, byAnswer: currentNext?.byAnswer ?? {}, default: resolved.targetValue } };
|
|
2193
2361
|
}
|
|
@@ -2216,7 +2384,15 @@ function isGraphDirty(working, published) {
|
|
|
2216
2384
|
if (!working || !published) return false;
|
|
2217
2385
|
return JSON.stringify(working) !== JSON.stringify(published);
|
|
2218
2386
|
}
|
|
2387
|
+
function withPossibleNext2(node, replaced, target) {
|
|
2388
|
+
const current = node.possibleNext ?? [];
|
|
2389
|
+
const updated = current.flatMap((entry) => entry === replaced ? target ? [target] : [] : [entry]);
|
|
2390
|
+
if (!current.includes(replaced) && target) updated.push(target);
|
|
2391
|
+
return { ...node, possibleNext: [...new Set(updated)] };
|
|
2392
|
+
}
|
|
2219
2393
|
function clearConnection(node, handle) {
|
|
2394
|
+
const possible = possibleNextOfHandle(handle);
|
|
2395
|
+
if (possible !== void 0) return withPossibleNext2(node, possible, void 0);
|
|
2220
2396
|
if (handle === "next" || typeof node.next === "string" || node.next === void 0) {
|
|
2221
2397
|
return { ...node, next: "" };
|
|
2222
2398
|
}
|
|
@@ -2317,7 +2493,7 @@ function buildFlowEdges(params) {
|
|
|
2317
2493
|
const liveCounts = countLiveByNode({ flowKey, rootFlowKey, positions: livePositions });
|
|
2318
2494
|
for (const [nodeId, node] of Object.entries(graph.nodes)) {
|
|
2319
2495
|
const live = (liveCounts[nodeId] ?? 0) > 0;
|
|
2320
|
-
for (const { target, optionId: answerId, keyword, isDefault } of targetsOf(node)) {
|
|
2496
|
+
for (const { target, optionId: answerId, keyword, isDefault, isPossible } of targetsOf(node)) {
|
|
2321
2497
|
const optionId = keyword !== void 0 ? keywordHandle(keyword) : answerId;
|
|
2322
2498
|
if (!target) continue;
|
|
2323
2499
|
const crossFlow = isCrossFlowTarget(target);
|
|
@@ -2336,6 +2512,18 @@ function buildFlowEdges(params) {
|
|
|
2336
2512
|
const source = namespaceNodeId(flowKey, nodeId);
|
|
2337
2513
|
const edgeTarget = namespaceNodeId(targetFlowKey, targetNodeId);
|
|
2338
2514
|
if (source === edgeTarget) continue;
|
|
2515
|
+
if (isPossible) {
|
|
2516
|
+
edges.push({
|
|
2517
|
+
id: `${source}->${edgeTarget}-possible`,
|
|
2518
|
+
source,
|
|
2519
|
+
target: edgeTarget,
|
|
2520
|
+
sourceHandle: possibleNextHandle(target),
|
|
2521
|
+
kind: "fallback",
|
|
2522
|
+
crossFlow,
|
|
2523
|
+
live: false
|
|
2524
|
+
});
|
|
2525
|
+
continue;
|
|
2526
|
+
}
|
|
2339
2527
|
if (isDefault) {
|
|
2340
2528
|
edges.push({
|
|
2341
2529
|
id: `${source}->${edgeTarget}-default`,
|
|
@@ -2443,7 +2631,7 @@ function findFreeSlot(params) {
|
|
|
2443
2631
|
}
|
|
2444
2632
|
|
|
2445
2633
|
// src/flows/FlowsWorkspace.tsx
|
|
2446
|
-
import { Fragment as Fragment6, jsx as
|
|
2634
|
+
import { Fragment as Fragment6, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2447
2635
|
var RF_NODE_TYPES = {
|
|
2448
2636
|
...flowNodeTypes,
|
|
2449
2637
|
...flowPortalNodeTypes,
|
|
@@ -3042,17 +3230,17 @@ function FlowsWorkspace({
|
|
|
3042
3230
|
const keyIsValid = FLOW_KEY_PATTERN.test(newFlow.key);
|
|
3043
3231
|
const canCreateFlow = Boolean(api.createFlow);
|
|
3044
3232
|
const canDeleteFlow = Boolean(api.deleteFlow) && primaryFlowKey !== rootFlowKey;
|
|
3045
|
-
return /* @__PURE__ */
|
|
3046
|
-
/* @__PURE__ */
|
|
3047
|
-
/* @__PURE__ */
|
|
3048
|
-
showHeader && /* @__PURE__ */
|
|
3049
|
-
/* @__PURE__ */
|
|
3050
|
-
/* @__PURE__ */
|
|
3233
|
+
return /* @__PURE__ */ jsxs14("div", { className: `space-y-4 h-full flex flex-col ${className ?? ""}`, children: [
|
|
3234
|
+
/* @__PURE__ */ jsx15(TooltipLayer, {}),
|
|
3235
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between flex-wrap gap-3", children: [
|
|
3236
|
+
showHeader && /* @__PURE__ */ jsxs14("div", { className: "min-w-0", children: [
|
|
3237
|
+
/* @__PURE__ */ jsx15("h2", { className: "text-2xl font-bold text-gray-900 dark:text-gray-100", children: labels.workspace.title }),
|
|
3238
|
+
/* @__PURE__ */ jsx15("p", { className: "text-gray-500 dark:text-gray-400 text-sm mt-1", children: labels.workspace.subtitle })
|
|
3051
3239
|
] }),
|
|
3052
|
-
/* @__PURE__ */
|
|
3053
|
-
saveState === "success" && /* @__PURE__ */
|
|
3054
|
-
saveState === "error" && /* @__PURE__ */
|
|
3055
|
-
/* @__PURE__ */
|
|
3240
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center justify-end gap-3 ml-auto", children: [
|
|
3241
|
+
saveState === "success" && /* @__PURE__ */ jsx15("span", { className: "text-sm text-green-600", children: labels.workspace.saveSuccess }),
|
|
3242
|
+
saveState === "error" && /* @__PURE__ */ jsx15("span", { className: "text-sm text-red-600", children: saveErrorMessage ?? labels.workspace.saveError }),
|
|
3243
|
+
/* @__PURE__ */ jsxs14(
|
|
3056
3244
|
"button",
|
|
3057
3245
|
{
|
|
3058
3246
|
"data-cv-tooltip": viewMode === "map" ? labels.flowMap.toggleToDetail : labels.flowMap.toggleToMap,
|
|
@@ -3061,13 +3249,13 @@ function FlowsWorkspace({
|
|
|
3061
3249
|
onClick: () => setViewMode((mode) => mode === "map" ? "detail" : "map"),
|
|
3062
3250
|
className: OUTLINE_BUTTON,
|
|
3063
3251
|
children: [
|
|
3064
|
-
viewMode === "map" ? /* @__PURE__ */
|
|
3252
|
+
viewMode === "map" ? /* @__PURE__ */ jsx15(Workflow, { size: 14, "aria-hidden": "true" }) : /* @__PURE__ */ jsx15(MapIcon, { size: 14, "aria-hidden": "true" }),
|
|
3065
3253
|
viewMode === "map" ? labels.flowMap.toggleToDetail : labels.flowMap.toggleToMap
|
|
3066
3254
|
]
|
|
3067
3255
|
}
|
|
3068
3256
|
),
|
|
3069
|
-
viewMode === "detail" && /* @__PURE__ */
|
|
3070
|
-
/* @__PURE__ */
|
|
3257
|
+
viewMode === "detail" && /* @__PURE__ */ jsxs14(Fragment6, { children: [
|
|
3258
|
+
/* @__PURE__ */ jsxs14(
|
|
3071
3259
|
"button",
|
|
3072
3260
|
{
|
|
3073
3261
|
type: "button",
|
|
@@ -3077,13 +3265,13 @@ function FlowsWorkspace({
|
|
|
3077
3265
|
"aria-label": labels.workspace.organizeTooltip,
|
|
3078
3266
|
disabled: !primaryGraph,
|
|
3079
3267
|
children: [
|
|
3080
|
-
/* @__PURE__ */
|
|
3268
|
+
/* @__PURE__ */ jsx15(LayoutGrid, { size: 14, "aria-hidden": "true" }),
|
|
3081
3269
|
" ",
|
|
3082
3270
|
labels.workspace.organize
|
|
3083
3271
|
]
|
|
3084
3272
|
}
|
|
3085
3273
|
),
|
|
3086
|
-
/* @__PURE__ */
|
|
3274
|
+
/* @__PURE__ */ jsxs14(
|
|
3087
3275
|
"button",
|
|
3088
3276
|
{
|
|
3089
3277
|
type: "button",
|
|
@@ -3093,13 +3281,13 @@ function FlowsWorkspace({
|
|
|
3093
3281
|
"aria-label": labels.workspace.discardTooltip,
|
|
3094
3282
|
disabled: !isDirty || saveState === "saving",
|
|
3095
3283
|
children: [
|
|
3096
|
-
/* @__PURE__ */
|
|
3284
|
+
/* @__PURE__ */ jsx15(Undo2, { size: 14, "aria-hidden": "true" }),
|
|
3097
3285
|
" ",
|
|
3098
3286
|
labels.workspace.discardChanges
|
|
3099
3287
|
]
|
|
3100
3288
|
}
|
|
3101
3289
|
),
|
|
3102
|
-
/* @__PURE__ */
|
|
3290
|
+
/* @__PURE__ */ jsxs14(
|
|
3103
3291
|
"button",
|
|
3104
3292
|
{
|
|
3105
3293
|
"data-cv-tooltip": labels.workspace.saveGraph,
|
|
@@ -3109,7 +3297,7 @@ function FlowsWorkspace({
|
|
|
3109
3297
|
className: PRIMARY_BUTTON,
|
|
3110
3298
|
disabled: !isDirty || errorCount > 0 || saveState === "saving",
|
|
3111
3299
|
children: [
|
|
3112
|
-
/* @__PURE__ */
|
|
3300
|
+
/* @__PURE__ */ jsx15(Save2, { size: 14, "aria-hidden": "true" }),
|
|
3113
3301
|
saveState === "saving" ? labels.workspace.saving : labels.workspace.saveGraph
|
|
3114
3302
|
]
|
|
3115
3303
|
}
|
|
@@ -3117,9 +3305,9 @@ function FlowsWorkspace({
|
|
|
3117
3305
|
] })
|
|
3118
3306
|
] })
|
|
3119
3307
|
] }),
|
|
3120
|
-
viewMode === "detail" && /* @__PURE__ */
|
|
3121
|
-
/* @__PURE__ */
|
|
3122
|
-
graphs && Object.values(graphs).map((graph) => /* @__PURE__ */
|
|
3308
|
+
viewMode === "detail" && /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
|
|
3309
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
3310
|
+
graphs && Object.values(graphs).map((graph) => /* @__PURE__ */ jsx15(
|
|
3123
3311
|
"button",
|
|
3124
3312
|
{
|
|
3125
3313
|
"data-cv-tooltip": graph.label,
|
|
@@ -3131,7 +3319,7 @@ function FlowsWorkspace({
|
|
|
3131
3319
|
},
|
|
3132
3320
|
graph.key
|
|
3133
3321
|
)),
|
|
3134
|
-
canCreateFlow && /* @__PURE__ */
|
|
3322
|
+
canCreateFlow && /* @__PURE__ */ jsxs14(
|
|
3135
3323
|
"button",
|
|
3136
3324
|
{
|
|
3137
3325
|
"data-cv-tooltip": labels.flowManager.newFlow,
|
|
@@ -3143,15 +3331,15 @@ function FlowsWorkspace({
|
|
|
3143
3331
|
},
|
|
3144
3332
|
className: "inline-flex items-center gap-1 px-3 py-1.5 rounded-full text-xs font-medium border border-dashed border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:border-blue-400 hover:text-blue-600",
|
|
3145
3333
|
children: [
|
|
3146
|
-
/* @__PURE__ */
|
|
3334
|
+
/* @__PURE__ */ jsx15(Plus6, { size: 12, "aria-hidden": "true" }),
|
|
3147
3335
|
" ",
|
|
3148
3336
|
labels.flowManager.newFlow
|
|
3149
3337
|
]
|
|
3150
3338
|
}
|
|
3151
3339
|
)
|
|
3152
3340
|
] }),
|
|
3153
|
-
/* @__PURE__ */
|
|
3154
|
-
primaryGraph && /* @__PURE__ */
|
|
3341
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
|
|
3342
|
+
primaryGraph && /* @__PURE__ */ jsx15(
|
|
3155
3343
|
FlowPalette,
|
|
3156
3344
|
{
|
|
3157
3345
|
onAdd: handleAddNode,
|
|
@@ -3159,7 +3347,7 @@ function FlowsWorkspace({
|
|
|
3159
3347
|
...actionOptions ? { actionOptions: [...actionOptions] } : {}
|
|
3160
3348
|
}
|
|
3161
3349
|
),
|
|
3162
|
-
primaryGraph && canDeleteFlow && /* @__PURE__ */
|
|
3350
|
+
primaryGraph && canDeleteFlow && /* @__PURE__ */ jsxs14(
|
|
3163
3351
|
"button",
|
|
3164
3352
|
{
|
|
3165
3353
|
"data-cv-tooltip": labels.flowManager.deleteFlow,
|
|
@@ -3171,7 +3359,7 @@ function FlowsWorkspace({
|
|
|
3171
3359
|
},
|
|
3172
3360
|
className: "inline-flex items-center gap-1.5 rounded-lg border border-red-200 dark:border-red-900 px-3 py-1.5 text-xs font-medium text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-950/30",
|
|
3173
3361
|
children: [
|
|
3174
|
-
/* @__PURE__ */
|
|
3362
|
+
/* @__PURE__ */ jsx15(Trash24, { size: 13, "aria-hidden": "true" }),
|
|
3175
3363
|
" ",
|
|
3176
3364
|
labels.flowManager.deleteFlow
|
|
3177
3365
|
]
|
|
@@ -3179,26 +3367,26 @@ function FlowsWorkspace({
|
|
|
3179
3367
|
)
|
|
3180
3368
|
] })
|
|
3181
3369
|
] }),
|
|
3182
|
-
viewMode === "detail" && (errorCount > 0 || warningCount > 0) && /* @__PURE__ */
|
|
3183
|
-
/* @__PURE__ */
|
|
3370
|
+
viewMode === "detail" && (errorCount > 0 || warningCount > 0) && /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/60 px-3 py-2 text-xs", children: [
|
|
3371
|
+
/* @__PURE__ */ jsxs14("span", { className: "font-medium text-gray-600 dark:text-gray-300", children: [
|
|
3184
3372
|
labels.validation.title,
|
|
3185
3373
|
":"
|
|
3186
3374
|
] }),
|
|
3187
|
-
errorCount > 0 && /* @__PURE__ */
|
|
3188
|
-
/* @__PURE__ */
|
|
3375
|
+
errorCount > 0 && /* @__PURE__ */ jsxs14("span", { className: "flex items-center gap-1 text-red-600 dark:text-red-400 font-medium", children: [
|
|
3376
|
+
/* @__PURE__ */ jsx15(AlertCircle3, { size: 13, "aria-hidden": "true" }),
|
|
3189
3377
|
" ",
|
|
3190
3378
|
labels.validation.errors(errorCount)
|
|
3191
3379
|
] }),
|
|
3192
|
-
warningCount > 0 && /* @__PURE__ */
|
|
3193
|
-
/* @__PURE__ */
|
|
3380
|
+
warningCount > 0 && /* @__PURE__ */ jsxs14("span", { className: "flex items-center gap-1 text-amber-600 dark:text-amber-400", children: [
|
|
3381
|
+
/* @__PURE__ */ jsx15(AlertTriangle3, { size: 13, "aria-hidden": "true" }),
|
|
3194
3382
|
" ",
|
|
3195
3383
|
labels.validation.warnings(warningCount)
|
|
3196
3384
|
] })
|
|
3197
3385
|
] }),
|
|
3198
|
-
/* @__PURE__ */
|
|
3199
|
-
loadState === "loading" && /* @__PURE__ */
|
|
3200
|
-
loadState === "error" && /* @__PURE__ */
|
|
3201
|
-
loadState === "ready" && graphs && viewMode === "map" && /* @__PURE__ */
|
|
3386
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex-1 rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden relative", children: [
|
|
3387
|
+
loadState === "loading" && /* @__PURE__ */ jsx15("p", { className: "text-center text-gray-400 py-12", children: labels.workspace.loading }),
|
|
3388
|
+
loadState === "error" && /* @__PURE__ */ jsx15("p", { className: "text-center text-red-500 py-12", children: labels.workspace.loadError }),
|
|
3389
|
+
loadState === "ready" && graphs && viewMode === "map" && /* @__PURE__ */ jsx15(
|
|
3202
3390
|
FlowMapCanvas,
|
|
3203
3391
|
{
|
|
3204
3392
|
graphs,
|
|
@@ -3210,7 +3398,7 @@ function FlowsWorkspace({
|
|
|
3210
3398
|
}
|
|
3211
3399
|
}
|
|
3212
3400
|
),
|
|
3213
|
-
loadState === "ready" && viewMode === "detail" && primaryGraph && /* @__PURE__ */
|
|
3401
|
+
loadState === "ready" && viewMode === "detail" && primaryGraph && /* @__PURE__ */ jsxs14(
|
|
3214
3402
|
ReactFlow2,
|
|
3215
3403
|
{
|
|
3216
3404
|
nodes: rfNodes,
|
|
@@ -3226,9 +3414,9 @@ function FlowsWorkspace({
|
|
|
3226
3414
|
proOptions: { hideAttribution: true },
|
|
3227
3415
|
colorMode: isDark ? "dark" : "light",
|
|
3228
3416
|
children: [
|
|
3229
|
-
/* @__PURE__ */
|
|
3230
|
-
/* @__PURE__ */
|
|
3231
|
-
/* @__PURE__ */
|
|
3417
|
+
/* @__PURE__ */ jsx15(Background2, { color: isDark ? BACKGROUND_COLOR_DARK2 : BACKGROUND_COLOR_LIGHT2 }),
|
|
3418
|
+
/* @__PURE__ */ jsx15(Controls2, {}),
|
|
3419
|
+
/* @__PURE__ */ jsx15(Panel, { position: "top-right", children: /* @__PURE__ */ jsx15(
|
|
3232
3420
|
FlowLegend,
|
|
3233
3421
|
{
|
|
3234
3422
|
labels,
|
|
@@ -3236,22 +3424,22 @@ function FlowsWorkspace({
|
|
|
3236
3424
|
nodeSwatches: LEGEND_NODE_SWATCHES
|
|
3237
3425
|
}
|
|
3238
3426
|
) }),
|
|
3239
|
-
/* @__PURE__ */
|
|
3427
|
+
/* @__PURE__ */ jsx15(MiniMap, { pannable: true, zoomable: true, className: "!bg-white dark:!bg-gray-800" })
|
|
3240
3428
|
]
|
|
3241
3429
|
}
|
|
3242
3430
|
)
|
|
3243
3431
|
] }),
|
|
3244
|
-
quickAddFrom && /* @__PURE__ */
|
|
3245
|
-
/* @__PURE__ */
|
|
3246
|
-
/* @__PURE__ */
|
|
3432
|
+
quickAddFrom && /* @__PURE__ */ jsxs14(Fragment6, { children: [
|
|
3433
|
+
/* @__PURE__ */ jsx15("div", { className: "fixed inset-0 z-40", onClick: () => setQuickAddFrom(null) }),
|
|
3434
|
+
/* @__PURE__ */ jsxs14(
|
|
3247
3435
|
"div",
|
|
3248
3436
|
{
|
|
3249
3437
|
ref: quickAddMenuRef,
|
|
3250
3438
|
className: "fixed z-50 w-64 rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 shadow-lg py-1",
|
|
3251
3439
|
style: quickAddMenuStyle,
|
|
3252
3440
|
children: [
|
|
3253
|
-
/* @__PURE__ */
|
|
3254
|
-
/* @__PURE__ */
|
|
3441
|
+
/* @__PURE__ */ jsx15("p", { className: "px-3 py-1.5 text-xs font-semibold uppercase tracking-wide text-gray-400 dark:text-gray-500", children: labels.quickAdd.title }),
|
|
3442
|
+
/* @__PURE__ */ jsx15(
|
|
3255
3443
|
FlowPaletteMenu,
|
|
3256
3444
|
{
|
|
3257
3445
|
onSelect: handleQuickAdd,
|
|
@@ -3263,7 +3451,7 @@ function FlowsWorkspace({
|
|
|
3263
3451
|
}
|
|
3264
3452
|
)
|
|
3265
3453
|
] }),
|
|
3266
|
-
editingNode && editingGraph && /* @__PURE__ */
|
|
3454
|
+
editingNode && editingGraph && /* @__PURE__ */ jsx15(
|
|
3267
3455
|
FlowNodePanel,
|
|
3268
3456
|
{
|
|
3269
3457
|
graph: editingGraph,
|
|
@@ -3278,11 +3466,11 @@ function FlowsWorkspace({
|
|
|
3278
3466
|
},
|
|
3279
3467
|
`${editingRef?.flowKey}:${editingRef?.nodeId}`
|
|
3280
3468
|
),
|
|
3281
|
-
showCreateDialog && canCreateFlow && /* @__PURE__ */
|
|
3282
|
-
/* @__PURE__ */
|
|
3283
|
-
/* @__PURE__ */
|
|
3284
|
-
/* @__PURE__ */
|
|
3285
|
-
/* @__PURE__ */
|
|
3469
|
+
showCreateDialog && canCreateFlow && /* @__PURE__ */ jsxs14(FlowDialog, { title: labels.flowManager.createTitle, onClose: () => setShowCreateDialog(false), children: [
|
|
3470
|
+
/* @__PURE__ */ jsxs14("div", { className: "space-y-3", children: [
|
|
3471
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
3472
|
+
/* @__PURE__ */ jsx15("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.flowManager.label }),
|
|
3473
|
+
/* @__PURE__ */ jsx15(
|
|
3286
3474
|
"input",
|
|
3287
3475
|
{
|
|
3288
3476
|
value: newFlow.label,
|
|
@@ -3291,9 +3479,9 @@ function FlowsWorkspace({
|
|
|
3291
3479
|
}
|
|
3292
3480
|
)
|
|
3293
3481
|
] }),
|
|
3294
|
-
/* @__PURE__ */
|
|
3295
|
-
/* @__PURE__ */
|
|
3296
|
-
/* @__PURE__ */
|
|
3482
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
3483
|
+
/* @__PURE__ */ jsx15("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.flowManager.key }),
|
|
3484
|
+
/* @__PURE__ */ jsx15(
|
|
3297
3485
|
"input",
|
|
3298
3486
|
{
|
|
3299
3487
|
value: newFlow.key,
|
|
@@ -3301,10 +3489,10 @@ function FlowsWorkspace({
|
|
|
3301
3489
|
className: `mt-1 ${DIALOG_INPUT}`
|
|
3302
3490
|
}
|
|
3303
3491
|
),
|
|
3304
|
-
/* @__PURE__ */
|
|
3492
|
+
/* @__PURE__ */ jsx15("p", { className: "text-[11px] text-gray-400 mt-1", children: newFlow.key && !keyIsValid ? labels.flowManager.keyInvalid : labels.flowManager.keyHint })
|
|
3305
3493
|
] }),
|
|
3306
|
-
/* @__PURE__ */
|
|
3307
|
-
/* @__PURE__ */
|
|
3494
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-sm text-gray-700 dark:text-gray-200", children: [
|
|
3495
|
+
/* @__PURE__ */ jsx15(
|
|
3308
3496
|
"input",
|
|
3309
3497
|
{
|
|
3310
3498
|
type: "checkbox",
|
|
@@ -3314,9 +3502,9 @@ function FlowsWorkspace({
|
|
|
3314
3502
|
),
|
|
3315
3503
|
labels.flowManager.showInMenu
|
|
3316
3504
|
] }),
|
|
3317
|
-
newFlow.showInMenu && /* @__PURE__ */
|
|
3318
|
-
/* @__PURE__ */
|
|
3319
|
-
/* @__PURE__ */
|
|
3505
|
+
newFlow.showInMenu && /* @__PURE__ */ jsxs14("div", { children: [
|
|
3506
|
+
/* @__PURE__ */ jsx15("label", { className: "text-xs font-medium text-gray-500 dark:text-gray-400", children: labels.flowManager.menuOptionLabel }),
|
|
3507
|
+
/* @__PURE__ */ jsx15(
|
|
3320
3508
|
"input",
|
|
3321
3509
|
{
|
|
3322
3510
|
value: newFlow.menuOptionLabel,
|
|
@@ -3326,11 +3514,11 @@ function FlowsWorkspace({
|
|
|
3326
3514
|
}
|
|
3327
3515
|
)
|
|
3328
3516
|
] }),
|
|
3329
|
-
flowMutationState.error && /* @__PURE__ */
|
|
3517
|
+
flowMutationState.error && /* @__PURE__ */ jsx15("p", { className: "text-xs text-red-600", children: flowMutationState.error })
|
|
3330
3518
|
] }),
|
|
3331
|
-
/* @__PURE__ */
|
|
3332
|
-
/* @__PURE__ */
|
|
3333
|
-
/* @__PURE__ */
|
|
3519
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex justify-end gap-2 mt-4", children: [
|
|
3520
|
+
/* @__PURE__ */ jsx15("button", { "data-cv-tooltip": labels.nodePanel.cancel, "aria-label": labels.nodePanel.cancel, type: "button", className: OUTLINE_BUTTON, onClick: () => setShowCreateDialog(false), children: labels.nodePanel.cancel }),
|
|
3521
|
+
/* @__PURE__ */ jsx15(
|
|
3334
3522
|
"button",
|
|
3335
3523
|
{
|
|
3336
3524
|
"data-cv-tooltip": labels.flowManager.create,
|
|
@@ -3344,12 +3532,12 @@ function FlowsWorkspace({
|
|
|
3344
3532
|
)
|
|
3345
3533
|
] })
|
|
3346
3534
|
] }),
|
|
3347
|
-
showDeleteDialog && canDeleteFlow && /* @__PURE__ */
|
|
3348
|
-
/* @__PURE__ */
|
|
3349
|
-
flowMutationState.error && /* @__PURE__ */
|
|
3350
|
-
/* @__PURE__ */
|
|
3351
|
-
/* @__PURE__ */
|
|
3352
|
-
/* @__PURE__ */
|
|
3535
|
+
showDeleteDialog && canDeleteFlow && /* @__PURE__ */ jsxs14(FlowDialog, { title: labels.flowManager.deleteFlow, onClose: () => setShowDeleteDialog(false), children: [
|
|
3536
|
+
/* @__PURE__ */ jsx15("p", { className: "text-sm text-gray-600 dark:text-gray-300", children: primaryGraph ? labels.flowManager.deleteConfirm(primaryGraph.label) : "" }),
|
|
3537
|
+
flowMutationState.error && /* @__PURE__ */ jsx15("p", { className: "text-xs text-red-600 mt-2", children: flowMutationState.error }),
|
|
3538
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex justify-end gap-2 mt-4", children: [
|
|
3539
|
+
/* @__PURE__ */ jsx15("button", { "data-cv-tooltip": labels.nodePanel.cancel, "aria-label": labels.nodePanel.cancel, type: "button", className: OUTLINE_BUTTON, onClick: () => setShowDeleteDialog(false), children: labels.nodePanel.cancel }),
|
|
3540
|
+
/* @__PURE__ */ jsxs14(
|
|
3353
3541
|
"button",
|
|
3354
3542
|
{
|
|
3355
3543
|
"data-cv-tooltip": labels.flowManager.deleteFlow,
|
|
@@ -3359,7 +3547,7 @@ function FlowsWorkspace({
|
|
|
3359
3547
|
onClick: () => void handleDeleteFlow(),
|
|
3360
3548
|
disabled: flowMutationState.pending,
|
|
3361
3549
|
children: [
|
|
3362
|
-
/* @__PURE__ */
|
|
3550
|
+
/* @__PURE__ */ jsx15(Trash24, { size: 13, "aria-hidden": "true" }),
|
|
3363
3551
|
" ",
|
|
3364
3552
|
labels.flowManager.deleteFlow
|
|
3365
3553
|
]
|
|
@@ -3374,9 +3562,9 @@ function FlowDialog({
|
|
|
3374
3562
|
onClose,
|
|
3375
3563
|
children
|
|
3376
3564
|
}) {
|
|
3377
|
-
return /* @__PURE__ */
|
|
3378
|
-
/* @__PURE__ */
|
|
3379
|
-
/* @__PURE__ */
|
|
3565
|
+
return /* @__PURE__ */ jsxs14("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/40 px-4", children: [
|
|
3566
|
+
/* @__PURE__ */ jsx15("div", { className: "absolute inset-0", onClick: onClose, "aria-hidden": "true" }),
|
|
3567
|
+
/* @__PURE__ */ jsxs14(
|
|
3380
3568
|
"div",
|
|
3381
3569
|
{
|
|
3382
3570
|
role: "dialog",
|
|
@@ -3384,7 +3572,7 @@ function FlowDialog({
|
|
|
3384
3572
|
"aria-label": title,
|
|
3385
3573
|
className: "relative w-full max-w-md rounded-2xl bg-white dark:bg-gray-800 p-5 shadow-xl",
|
|
3386
3574
|
children: [
|
|
3387
|
-
/* @__PURE__ */
|
|
3575
|
+
/* @__PURE__ */ jsx15("h3", { className: "text-base font-semibold text-gray-900 dark:text-gray-100 mb-3", children: title }),
|
|
3388
3576
|
children
|
|
3389
3577
|
]
|
|
3390
3578
|
}
|