@ethisyscore/plugin-ui 1.93.0 → 1.95.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.
@@ -8,6 +8,94 @@ var react = require('react');
8
8
  function Dialog(props) {
9
9
  return /* @__PURE__ */ jsxRuntime.jsx(material.Dialog, { disableScrollLock: true, disableRestoreFocus: true, ...props });
10
10
  }
11
+ function NiArchive({
12
+ className,
13
+ variant = "outlined",
14
+ size = "medium",
15
+ oneTone = false
16
+ }) {
17
+ const iconSize = sizeHelper(size);
18
+ const iconStrokeWidth = strokeSizeHelper(iconSize);
19
+ if (variant === "outlined") {
20
+ return /* @__PURE__ */ jsxRuntime.jsxs(
21
+ "svg",
22
+ {
23
+ width: iconSize,
24
+ height: iconSize,
25
+ className,
26
+ viewBox: "0 0 24 24",
27
+ fill: "none",
28
+ xmlns: "http://www.w3.org/2000/svg",
29
+ children: [
30
+ /* @__PURE__ */ jsxRuntime.jsx(
31
+ "path",
32
+ {
33
+ d: "M22 7V5.71496C22 4.17371 20.8321 2.88321 19.2985 2.72985L17.9702 2.59702C14 2.2 10 2.2 6.02978 2.59702L4.70149 2.72985C3.16788 2.88321 2 4.17371 2 5.71496V7C2 8.10457 2.89543 9 4 9H20C21.1046 9 22 8.10457 22 7Z",
34
+ stroke: "currentColor",
35
+ strokeWidth: iconStrokeWidth,
36
+ strokeLinecap: "round",
37
+ strokeLinejoin: "round"
38
+ }
39
+ ),
40
+ /* @__PURE__ */ jsxRuntime.jsx(
41
+ "path",
42
+ {
43
+ d: "M4.53333 9.5L4.4768 9.74619C3.83435 12.544 3.8494 15.4543 4.51997 18.2455V18.2455C4.85389 19.6354 5.95655 20.7108 7.35451 21.009V21.009C10.4171 21.6623 13.5829 21.6623 16.6455 21.009V21.009C18.0434 20.7108 19.1461 19.6354 19.48 18.2455V18.2455C20.1506 15.4543 20.1657 12.544 19.5232 9.74618L19.4667 9.5",
44
+ stroke: "currentColor",
45
+ strokeWidth: iconStrokeWidth,
46
+ strokeLinecap: "round"
47
+ }
48
+ ),
49
+ /* @__PURE__ */ jsxRuntime.jsx(
50
+ "path",
51
+ {
52
+ opacity: oneTone ? 1 : 0.6,
53
+ d: "M14.0945 13.9189C14.3504 13.9701 14.5682 14.1365 14.6849 14.3698V14.3698C14.8833 14.7665 14.8833 15.2335 14.6849 15.6302V15.6302C14.5682 15.8635 14.3504 16.0299 14.0945 16.0811L13.8853 16.1229C12.6408 16.3718 11.3592 16.3718 10.1147 16.1229L9.90546 16.0811C9.64963 16.0299 9.43176 15.8635 9.31508 15.6302V15.6302C9.11673 15.2335 9.11673 14.7665 9.31508 14.3698V14.3698C9.43176 14.1365 9.64963 13.9701 9.90546 13.9189L10.1147 13.8771C11.3592 13.6282 12.6408 13.6282 13.8853 13.8771L14.0945 13.9189Z",
54
+ stroke: "currentColor",
55
+ strokeWidth: iconStrokeWidth
56
+ }
57
+ )
58
+ ]
59
+ }
60
+ );
61
+ } else {
62
+ return /* @__PURE__ */ jsxRuntime.jsxs(
63
+ "svg",
64
+ {
65
+ width: iconSize,
66
+ height: iconSize,
67
+ className,
68
+ viewBox: "0 0 24 24",
69
+ fill: "none",
70
+ xmlns: "http://www.w3.org/2000/svg",
71
+ children: [
72
+ /* @__PURE__ */ jsxRuntime.jsx(
73
+ "path",
74
+ {
75
+ d: "M5.95508 1.85031C9.9749 1.44833 14.0251 1.44833 18.0449 1.85031L19.373 1.98312C21.2897 2.17479 22.7495 3.78844 22.75 5.71457V6.99972C22.75 7.86931 22.345 8.64326 21.7148 9.14719C21.1107 7.71812 19.7022 6.75088 18.1025 6.7507H5.89746C4.29778 6.75078 2.8884 7.71735 2.28418 9.14621C1.65469 8.64226 1.25 7.86881 1.25 6.99972V5.71457C1.2505 3.78844 2.71028 2.17479 4.62695 1.98312L5.95508 1.85031Z",
76
+ fill: "currentColor"
77
+ }
78
+ ),
79
+ /* @__PURE__ */ jsxRuntime.jsx(
80
+ "path",
81
+ {
82
+ d: "M18.1028 8.25C19.2525 8.25003 20.2447 9.05777 20.4778 10.1836C20.9988 12.7045 20.957 15.3105 20.3557 17.8135L20.2092 18.4219C19.8078 20.0924 18.4823 21.3837 16.802 21.7422C13.6364 22.4174 10.3641 22.4174 7.19849 21.7422C5.51812 21.3837 4.19273 20.0925 3.79126 18.4219L3.64478 17.8135C3.04349 15.3105 3.00171 12.7045 3.52271 10.1836C3.75577 9.05776 4.74793 8.25 5.89771 8.25H18.1028ZM14.0334 13.1406C12.6922 12.8724 11.3103 12.8725 9.96899 13.1406L9.75903 13.1826C9.27649 13.2792 8.86496 13.5931 8.64477 14.0332C8.34086 14.641 8.34086 15.357 8.64477 15.9648C8.86494 16.405 9.27646 16.7188 9.75903 16.8154L9.96899 16.8574C11.3103 17.1255 12.6922 17.1257 14.0334 16.8574L14.2424 16.8154C14.7249 16.7187 15.1366 16.4049 15.3567 15.9648C15.6604 15.3571 15.6604 14.6409 15.3567 14.0332C15.1366 13.5931 14.7249 13.2793 14.2424 13.1826L14.0334 13.1406Z",
83
+ fill: "currentColor"
84
+ }
85
+ ),
86
+ /* @__PURE__ */ jsxRuntime.jsx(
87
+ "path",
88
+ {
89
+ opacity: oneTone ? 0 : 0.4,
90
+ d: "M9.96866 13.1406C11.3101 12.8724 12.6917 12.8723 14.0331 13.1406L14.2421 13.1826C14.7247 13.2792 15.1362 13.593 15.3563 14.0332C15.6602 14.641 15.6602 15.357 15.3563 15.9648C15.1362 16.405 14.7247 16.7188 14.2421 16.8154L14.0331 16.8574C12.6917 17.1257 11.3101 17.1256 9.96866 16.8574L9.7587 16.8154C9.27607 16.7188 8.86459 16.4051 8.64444 15.9648C8.34052 15.357 8.34052 14.641 8.64444 14.0332C8.86461 13.593 9.27611 13.2792 9.7587 13.1826L9.96866 13.1406Z",
91
+ fill: "currentColor"
92
+ }
93
+ )
94
+ ]
95
+ }
96
+ );
97
+ }
98
+ }
11
99
  function NiBinEmpty({ className, variant = "outlined", size = "medium" }) {
12
100
  const iconSize = sizeHelper(size);
13
101
  const iconStrokeWidth = strokeSizeHelper(iconSize);
@@ -220,6 +308,94 @@ function NiChevronUpSmall({ className, variant = "outlined", size = "medium" })
220
308
  );
221
309
  }
222
310
  }
311
+ function NiCode({
312
+ className,
313
+ variant = "outlined",
314
+ size = "medium",
315
+ oneTone = false
316
+ }) {
317
+ const iconSize = sizeHelper(size);
318
+ const iconStrokeWidth = strokeSizeHelper(iconSize);
319
+ if (variant === "outlined") {
320
+ return /* @__PURE__ */ jsxRuntime.jsxs(
321
+ "svg",
322
+ {
323
+ width: iconSize,
324
+ height: iconSize,
325
+ className,
326
+ viewBox: "0 0 24 24",
327
+ fill: "none",
328
+ xmlns: "http://www.w3.org/2000/svg",
329
+ children: [
330
+ /* @__PURE__ */ jsxRuntime.jsx(
331
+ "path",
332
+ {
333
+ d: "M17 6L21.5858 10.5858C22.3668 11.3668 22.3668 12.6332 21.5858 13.4142L17 18",
334
+ stroke: "currentColor",
335
+ strokeWidth: iconStrokeWidth,
336
+ strokeLinecap: "round"
337
+ }
338
+ ),
339
+ /* @__PURE__ */ jsxRuntime.jsx(
340
+ "path",
341
+ {
342
+ d: "M7 6L2.41421 10.5858C1.63317 11.3668 1.63316 12.6332 2.41421 13.4142L7 18",
343
+ stroke: "currentColor",
344
+ strokeWidth: iconStrokeWidth,
345
+ strokeLinecap: "round"
346
+ }
347
+ ),
348
+ /* @__PURE__ */ jsxRuntime.jsx(
349
+ "path",
350
+ {
351
+ opacity: oneTone ? 1 : 0.6,
352
+ d: "M9.81053 20.2205L14.2104 3.7998",
353
+ stroke: "currentColor",
354
+ strokeWidth: iconStrokeWidth,
355
+ strokeLinecap: "round"
356
+ }
357
+ )
358
+ ]
359
+ }
360
+ );
361
+ } else {
362
+ return /* @__PURE__ */ jsxRuntime.jsxs(
363
+ "svg",
364
+ {
365
+ width: iconSize,
366
+ height: iconSize,
367
+ className,
368
+ viewBox: "0 0 24 24",
369
+ fill: "none",
370
+ xmlns: "http://www.w3.org/2000/svg",
371
+ children: [
372
+ /* @__PURE__ */ jsxRuntime.jsx(
373
+ "path",
374
+ {
375
+ d: "M16.4697 5.46967C16.7626 5.17678 17.2373 5.17678 17.5302 5.46967L22.1162 10.0556C23.1899 11.1295 23.1899 12.8704 22.1162 13.9443L17.5302 18.5302C17.2373 18.8231 16.7626 18.8231 16.4697 18.5302C16.1768 18.2373 16.1768 17.7626 16.4697 17.4697L21.0556 12.8837C21.5436 12.3956 21.5436 11.6043 21.0556 11.1162L16.4697 6.53022C16.1768 6.23732 16.1768 5.76256 16.4697 5.46967Z",
376
+ fill: "currentColor"
377
+ }
378
+ ),
379
+ /* @__PURE__ */ jsxRuntime.jsx(
380
+ "path",
381
+ {
382
+ d: "M7.53033 5.46967C7.23744 5.17678 6.76268 5.17678 6.46978 5.46967L1.88385 10.0556C0.810106 11.1295 0.810105 12.8704 1.88385 13.9443L6.46978 18.5302C6.76268 18.8231 7.23744 18.8231 7.53033 18.5302C7.82322 18.2373 7.82322 17.7626 7.53033 17.4697L2.94439 12.8837C2.45644 12.3956 2.45644 11.6043 2.94439 11.1162L7.53033 6.53022C7.82322 6.23732 7.82322 5.76256 7.53033 5.46967Z",
383
+ fill: "currentColor"
384
+ }
385
+ ),
386
+ /* @__PURE__ */ jsxRuntime.jsx(
387
+ "path",
388
+ {
389
+ opacity: oneTone ? 1 : 0.4,
390
+ d: "M10.5349 20.4147C10.4277 20.8148 10.0164 21.0523 9.61631 20.945C9.21621 20.8378 8.97877 20.4266 9.08598 20.0265L13.4859 3.60575C13.5931 3.20565 14.0044 2.96821 14.4045 3.07542C14.8046 3.18262 15.042 3.59388 14.9348 3.99398L10.5349 20.4147Z",
391
+ fill: "currentColor"
392
+ }
393
+ )
394
+ ]
395
+ }
396
+ );
397
+ }
398
+ }
223
399
  function NiCross({ className, variant = "outlined", size = "medium" }) {
224
400
  const iconSize = sizeHelper(size);
225
401
  const iconStrokeWidth = strokeSizeHelper(iconSize);
@@ -401,6 +577,112 @@ function NiPlus({ className, variant = "outlined", size = "medium" }) {
401
577
  );
402
578
  }
403
579
  }
580
+ function NiRefresh({
581
+ className,
582
+ variant = "outlined",
583
+ size = "medium",
584
+ oneTone = false
585
+ }) {
586
+ const iconSize = sizeHelper(size);
587
+ const iconStrokeWidth = strokeSizeHelper(iconSize);
588
+ if (variant === "outlined") {
589
+ return /* @__PURE__ */ jsxRuntime.jsxs(
590
+ "svg",
591
+ {
592
+ width: iconSize,
593
+ height: iconSize,
594
+ viewBox: "0 0 24 24",
595
+ className,
596
+ fill: "none",
597
+ xmlns: "http://www.w3.org/2000/svg",
598
+ children: [
599
+ /* @__PURE__ */ jsxRuntime.jsx(
600
+ "path",
601
+ {
602
+ opacity: oneTone ? 1 : 0.6,
603
+ d: "M4.24658 5.68421C6.08028 3.4358 8.87252 2 12.0001 2C17.5229 2 22.0001 6.47715 22.0001 12C22.0001 12.6849 21.9312 13.3538 21.8001 14",
604
+ stroke: "currentColor",
605
+ strokeWidth: iconStrokeWidth,
606
+ strokeLinecap: "round"
607
+ }
608
+ ),
609
+ /* @__PURE__ */ jsxRuntime.jsx(
610
+ "path",
611
+ {
612
+ d: "M4 2L4 4.99995C4 5.55223 4.44771 5.99995 4.99998 5.99995L8 6",
613
+ stroke: "currentColor",
614
+ strokeWidth: iconStrokeWidth,
615
+ strokeLinecap: "round"
616
+ }
617
+ ),
618
+ /* @__PURE__ */ jsxRuntime.jsx(
619
+ "path",
620
+ {
621
+ opacity: oneTone ? 1 : 0.6,
622
+ d: "M19.7534 18.3158C17.9197 20.5642 15.1275 22 11.9999 22C6.47705 22 1.9999 17.5228 1.9999 12C1.9999 11.3151 2.06876 10.6462 2.19994 10",
623
+ stroke: "currentColor",
624
+ strokeWidth: iconStrokeWidth,
625
+ strokeLinecap: "round"
626
+ }
627
+ ),
628
+ /* @__PURE__ */ jsxRuntime.jsx(
629
+ "path",
630
+ {
631
+ d: "M20 22L20 19C20 18.4478 19.5523 18.0001 19 18L16 18",
632
+ stroke: "currentColor",
633
+ strokeWidth: iconStrokeWidth,
634
+ strokeLinecap: "round"
635
+ }
636
+ )
637
+ ]
638
+ }
639
+ );
640
+ } else {
641
+ return /* @__PURE__ */ jsxRuntime.jsxs(
642
+ "svg",
643
+ {
644
+ width: iconSize,
645
+ height: iconSize,
646
+ className,
647
+ viewBox: "0 0 24 24",
648
+ fill: "none",
649
+ xmlns: "http://www.w3.org/2000/svg",
650
+ children: [
651
+ /* @__PURE__ */ jsxRuntime.jsx(
652
+ "path",
653
+ {
654
+ opacity: oneTone ? 1 : 0.4,
655
+ d: "M21.2503 12C21.2503 6.8915 17.1087 2.75021 12.0003 2.75C9.10755 2.75 6.5248 4.07694 4.82741 6.1582C4.5657 6.47903 4.09369 6.5271 3.77272 6.26562C3.45173 6.00383 3.40351 5.53096 3.6653 5.20996C5.63532 2.79453 8.63792 1.25 12.0003 1.25C17.9371 1.25021 22.7503 6.06307 22.7503 12C22.7503 12.7353 22.6755 13.4544 22.5344 14.1494C22.4519 14.5552 22.0565 14.8177 21.6507 14.7354C21.2447 14.653 20.9823 14.2565 21.0647 13.8506C21.186 13.2533 21.2503 12.6345 21.2503 12Z",
656
+ fill: "currentColor"
657
+ }
658
+ ),
659
+ /* @__PURE__ */ jsxRuntime.jsx(
660
+ "path",
661
+ {
662
+ d: "M4 1.25011C3.58579 1.25011 3.25008 1.58582 3.25008 2.00003L3.25008 4.99971C3.25008 5.96617 4.03344 6.74947 4.99989 6.74953L8.00026 6.75022C8.41427 6.75008 8.75004 6.4143 8.75018 6.0003C8.75019 5.58617 8.41436 5.25052 8.00026 5.25038L4.99989 5.24969C4.86187 5.24963 4.74992 5.13775 4.74992 4.99971L4.74992 2.00003C4.74992 1.58582 4.41421 1.25011 4 1.25011Z",
663
+ fill: "currentColor"
664
+ }
665
+ ),
666
+ /* @__PURE__ */ jsxRuntime.jsx(
667
+ "path",
668
+ {
669
+ opacity: oneTone ? 1 : 0.4,
670
+ d: "M2.74974 12C2.74974 17.1085 6.89128 21.2498 11.9997 21.25C14.8925 21.25 17.4752 19.9231 19.1726 17.8418C19.4343 17.521 19.9063 17.4729 20.2273 17.7344C20.5483 17.9962 20.5965 18.469 20.3347 18.79C18.3647 21.2055 15.3621 22.75 11.9997 22.75C6.06285 22.7498 1.24974 17.9369 1.24974 12C1.24974 11.2647 1.32447 10.5456 1.46556 9.85059C1.54808 9.44484 1.94354 9.18232 2.34935 9.26465C2.75528 9.34705 3.01768 9.74348 2.93528 10.1494C2.81404 10.7467 2.74974 11.3655 2.74974 12Z",
671
+ fill: "currentColor"
672
+ }
673
+ ),
674
+ /* @__PURE__ */ jsxRuntime.jsx(
675
+ "path",
676
+ {
677
+ d: "M20 22.7499C20.4142 22.7499 20.7499 22.4142 20.7499 22L20.7499 19.0003C20.7499 18.0338 19.9666 17.2505 19.0001 17.2505L15.9997 17.2498C15.5857 17.2499 15.25 17.5857 15.2498 17.9997C15.2498 18.4138 15.5856 18.7495 15.9997 18.7496L19.0001 18.7503C19.1381 18.7504 19.2501 18.8623 19.2501 19.0003L19.2501 22C19.2501 22.4142 19.5858 22.7499 20 22.7499Z",
678
+ fill: "currentColor"
679
+ }
680
+ )
681
+ ]
682
+ }
683
+ );
684
+ }
685
+ }
404
686
  function NiSearch({
405
687
  className,
406
688
  variant = "outlined",
@@ -848,17 +1130,27 @@ function selectMappingReadiness(operations) {
848
1130
  isReady: required.length > 0 && complete === required.length
849
1131
  };
850
1132
  }
1133
+
1134
+ // src/components/connectors/providerLabels.ts
1135
+ var PROVIDER_CONTROL_LABEL = "Served by";
1136
+ var PROVIDER_OPTION_LABEL = {
1137
+ plugin: "This organisation's apps",
1138
+ connector: "External system"
1139
+ };
1140
+ var PLUGIN_PROVIDER_CONTROL_LABEL = "App";
1141
+ var CONNECTOR_CONTROL_LABEL = "Connector";
851
1142
  function MappingCompletenessBanner({
852
1143
  operations,
853
1144
  onSuggestWithAi,
854
1145
  onOpenMappingEditor,
855
1146
  onConfigureTranslation,
856
1147
  suggestingOperationKey = null,
857
- disableSuggest = false
1148
+ disableSuggest = false,
1149
+ isProviderUnconfigured = false
858
1150
  }) {
859
1151
  const required = selectRequiredIncompleteOperations(operations);
860
1152
  const optional = selectOptionalIncompleteOperations(operations);
861
- if (required.length === 0 && optional.length === 0) {
1153
+ if (!isProviderUnconfigured && required.length === 0 && optional.length === 0) {
862
1154
  return null;
863
1155
  }
864
1156
  const renderRow = (op) => {
@@ -913,6 +1205,26 @@ function MappingCompletenessBanner({
913
1205
  ) }, op.operationKey);
914
1206
  };
915
1207
  return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { mb: 2 }, children: [
1208
+ isProviderUnconfigured && /* @__PURE__ */ jsxRuntime.jsxs(
1209
+ material.Alert,
1210
+ {
1211
+ severity: "warning",
1212
+ sx: { mb: required.length > 0 || optional.length > 0 ? 2 : 0 },
1213
+ "data-testid": "provider-unconfigured-alert",
1214
+ children: [
1215
+ /* @__PURE__ */ jsxRuntime.jsx(material.AlertTitle, { children: "Nothing serves this module yet" }),
1216
+ /* @__PURE__ */ jsxRuntime.jsxs(material.Typography, { variant: "body2", children: [
1217
+ 'No provider has been chosen, so every operation below resolves as unmapped no matter what is mapped against it. Set one with the "',
1218
+ PROVIDER_CONTROL_LABEL,
1219
+ '" control at the top of this page: choose "',
1220
+ PROVIDER_OPTION_LABEL.plugin,
1221
+ '" to have another app this organisation already runs answer these operations, or "',
1222
+ PROVIDER_OPTION_LABEL.connector,
1223
+ '" to route them through a connector to a third-party system. The choice is per module and can be changed later.'
1224
+ ] })
1225
+ ]
1226
+ }
1227
+ ),
916
1228
  required.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(material.Alert, { severity: "warning", sx: { mb: optional.length > 0 ? 2 : 0 }, children: [
917
1229
  /* @__PURE__ */ jsxRuntime.jsx(material.AlertTitle, { children: "Required operations are missing request-field mappings" }),
918
1230
  /* @__PURE__ */ jsxRuntime.jsxs(material.Typography, { variant: "body2", children: [
@@ -942,6 +1254,335 @@ function MappingCompletenessBanner({
942
1254
  ] })
943
1255
  ] });
944
1256
  }
1257
+ function EmptyState({
1258
+ icon = /* @__PURE__ */ jsxRuntime.jsx(NiArchive, { className: "text-text-disabled", size: "large" }),
1259
+ title = "No items yet",
1260
+ description = "Create your first item to get started",
1261
+ fill = false
1262
+ }) {
1263
+ return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { className: `flex flex-col items-center justify-center py-12 text-center ${fill ? "flex-1" : ""}`, children: [
1264
+ /* @__PURE__ */ jsxRuntime.jsx(material.Box, { className: "mb-3", children: icon }),
1265
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "body1", className: "text-text-secondary", children: title }),
1266
+ description ? /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "body2", className: "text-text-disabled mt-1", children: description }) : null
1267
+ ] });
1268
+ }
1269
+ var SOURCE = {
1270
+ keyword: "keyword",
1271
+ ai: "ai",
1272
+ manual: "manual"
1273
+ };
1274
+ var SOURCE_COLOURS = {
1275
+ [SOURCE.keyword]: "info",
1276
+ [SOURCE.ai]: "secondary",
1277
+ [SOURCE.manual]: "success"
1278
+ };
1279
+ var CONFLICT_REASON = {
1280
+ AnotherAutoMatchInProgress: "another_auto_match_in_progress"
1281
+ };
1282
+ function renderSourceChip(item) {
1283
+ if (!item.mappedToolName || !item.source) {
1284
+ return /* @__PURE__ */ jsxRuntime.jsx(material.Chip, { label: "\u2014", size: "small", color: "default", variant: "outlined" });
1285
+ }
1286
+ let label;
1287
+ if (item.source === SOURCE.manual) {
1288
+ label = "manual";
1289
+ } else if (item.source === SOURCE.keyword) {
1290
+ label = "auto (keyword)";
1291
+ } else {
1292
+ const pct = Math.round((item.confidence ?? 0) * 100);
1293
+ label = `auto (AI, ${pct}%)`;
1294
+ }
1295
+ return /* @__PURE__ */ jsxRuntime.jsx(material.Chip, { label, size: "small", color: SOURCE_COLOURS[item.source], variant: "outlined" });
1296
+ }
1297
+ function renderBanner(banner, onDismiss) {
1298
+ const dismissButton = /* @__PURE__ */ jsxRuntime.jsx(
1299
+ material.IconButton,
1300
+ {
1301
+ "aria-label": "Dismiss",
1302
+ size: "small",
1303
+ onClick: onDismiss,
1304
+ "data-testid": "dismiss-banner",
1305
+ children: /* @__PURE__ */ jsxRuntime.jsx(NiCross, { size: "small" })
1306
+ }
1307
+ );
1308
+ if (banner.conflictReason === CONFLICT_REASON.AnotherAutoMatchInProgress) {
1309
+ return /* @__PURE__ */ jsxRuntime.jsxs(material.Alert, { severity: "warning", className: "mb-2", action: dismissButton, children: [
1310
+ /* @__PURE__ */ jsxRuntime.jsx(material.AlertTitle, { children: "Auto-match already running" }),
1311
+ "Another user is currently running auto-match. Please refresh the page in a few seconds."
1312
+ ] });
1313
+ }
1314
+ if (banner.unmatchedRequiredCount > 0) {
1315
+ return /* @__PURE__ */ jsxRuntime.jsxs(material.Alert, { severity: "warning", className: "mb-2", action: dismissButton, children: [
1316
+ /* @__PURE__ */ jsxRuntime.jsx(material.AlertTitle, { children: "Some required operations are unmapped" }),
1317
+ banner.aiAvailable ? `AI matched ${banner.matchedByAi}, keywords matched ${banner.matchedByKeyword}.` : `Keywords matched ${banner.matchedByKeyword}.`,
1318
+ " ",
1319
+ banner.unmatchedRequiredCount,
1320
+ " required operation",
1321
+ banner.unmatchedRequiredCount === 1 ? "" : "s",
1322
+ " still need",
1323
+ banner.unmatchedRequiredCount === 1 ? "s" : "",
1324
+ " a mapping."
1325
+ ] });
1326
+ }
1327
+ return null;
1328
+ }
1329
+ function renderNoProviderEmptyState(kind, moduleLabel) {
1330
+ const icon = /* @__PURE__ */ jsxRuntime.jsx(NiCode, { className: "text-text-disabled", size: "large" });
1331
+ const module = moduleLabel.toLowerCase();
1332
+ if (kind === void 0) {
1333
+ return /* @__PURE__ */ jsxRuntime.jsx(
1334
+ EmptyState,
1335
+ {
1336
+ icon,
1337
+ title: `Choose what serves ${module}`,
1338
+ description: `Use "${PROVIDER_CONTROL_LABEL}" above: "${PROVIDER_OPTION_LABEL.plugin}" to have another app you already run answer these operations, or "${PROVIDER_OPTION_LABEL.connector}" to route them through a connector. Nothing resolves until one is chosen.`
1339
+ }
1340
+ );
1341
+ }
1342
+ if (kind === "plugin") {
1343
+ return /* @__PURE__ */ jsxRuntime.jsx(
1344
+ EmptyState,
1345
+ {
1346
+ icon,
1347
+ title: "Select an app",
1348
+ description: `Choose the app under "${PLUGIN_PROVIDER_CONTROL_LABEL}" above to view and configure which of its tools answer each ${module} operation`
1349
+ }
1350
+ );
1351
+ }
1352
+ return /* @__PURE__ */ jsxRuntime.jsx(
1353
+ EmptyState,
1354
+ {
1355
+ icon,
1356
+ title: "Select a connector",
1357
+ description: `Choose a connector to view and configure its ${module} tool mappings`
1358
+ }
1359
+ );
1360
+ }
1361
+ function ConnectorMappingView({
1362
+ isLoading,
1363
+ moduleLabel,
1364
+ breadcrumbs,
1365
+ loadingFallback,
1366
+ connectors,
1367
+ selectedConnectorId,
1368
+ onConnectorChange,
1369
+ providerKind,
1370
+ onProviderKindChange,
1371
+ pluginProviders = [],
1372
+ selectedPluginExtensionId = "",
1373
+ onPluginProviderChange,
1374
+ mappings,
1375
+ availableTools,
1376
+ onUpdateMapping,
1377
+ onAutoMatch,
1378
+ isUpdating,
1379
+ isAutoMatching,
1380
+ bannerState,
1381
+ onDismissBanner,
1382
+ onEditTranslation,
1383
+ withHeader = true
1384
+ }) {
1385
+ if (isLoading) {
1386
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: loadingFallback ?? /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { className: "flex flex-col gap-4", "data-testid": "connector-mapping-skeleton", children: [
1387
+ /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { variant: "rounded", height: 56 }),
1388
+ /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { variant: "rounded", height: 240 })
1389
+ ] }) });
1390
+ }
1391
+ const disableInputs = isUpdating || isAutoMatching;
1392
+ const banner = bannerState ? renderBanner(bannerState, onDismissBanner) : null;
1393
+ const providerPickerEnabled = !!onProviderKindChange;
1394
+ const effectiveKind = providerPickerEnabled ? providerKind : "connector";
1395
+ const isPluginMode = effectiveKind === "plugin";
1396
+ const hasProvider = isPluginMode ? !!selectedPluginExtensionId : !!selectedConnectorId;
1397
+ const showAutoMatch = !isPluginMode && !!selectedConnectorId;
1398
+ return /* @__PURE__ */ jsxRuntime.jsxs(material.Grid, { container: true, spacing: 5, children: [
1399
+ (withHeader || showAutoMatch) && /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(
1400
+ material.Box,
1401
+ {
1402
+ className: `flex flex-row items-start ${withHeader ? "justify-between" : "justify-end"}`,
1403
+ children: [
1404
+ withHeader && /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { children: [
1405
+ /* @__PURE__ */ jsxRuntime.jsxs(material.Typography, { variant: "h1", component: "h1", className: "mb-0", children: [
1406
+ moduleLabel,
1407
+ " Mappings"
1408
+ ] }),
1409
+ breadcrumbs
1410
+ ] }),
1411
+ showAutoMatch && /* @__PURE__ */ jsxRuntime.jsx(material.Box, { className: "flex flex-row items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Re-run Auto-Match", children: /* @__PURE__ */ jsxRuntime.jsx(
1412
+ material.Button,
1413
+ {
1414
+ className: "icon-only surface-standard",
1415
+ color: "grey",
1416
+ variant: "surface",
1417
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(NiRefresh, { size: "medium" }),
1418
+ onClick: onAutoMatch,
1419
+ "aria-label": "Re-run Auto-Match",
1420
+ disabled: disableInputs,
1421
+ "data-testid": "auto-match-button"
1422
+ }
1423
+ ) }) })
1424
+ ]
1425
+ }
1426
+ ) }),
1427
+ providerPickerEnabled && /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: { xs: 12, sm: 6 }, children: /* @__PURE__ */ jsxRuntime.jsxs(material.FormControl, { variant: "filled", size: "medium", className: "surface mb-0 w-full", children: [
1428
+ /* @__PURE__ */ jsxRuntime.jsx(material.InputLabel, { children: PROVIDER_CONTROL_LABEL }),
1429
+ /* @__PURE__ */ jsxRuntime.jsxs(
1430
+ material.Select,
1431
+ {
1432
+ value: providerKind ?? "",
1433
+ onChange: (e) => onProviderKindChange?.(e.target.value),
1434
+ disabled: disableInputs,
1435
+ "data-testid": "provider-kind-select",
1436
+ children: [
1437
+ /* @__PURE__ */ jsxRuntime.jsx(material.MenuItem, { value: "plugin", children: PROVIDER_OPTION_LABEL.plugin }),
1438
+ /* @__PURE__ */ jsxRuntime.jsx(material.MenuItem, { value: "connector", children: PROVIDER_OPTION_LABEL.connector })
1439
+ ]
1440
+ }
1441
+ )
1442
+ ] }) }),
1443
+ providerPickerEnabled && isPluginMode && /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: { xs: 12, sm: 6 }, children: /* @__PURE__ */ jsxRuntime.jsxs(material.FormControl, { variant: "filled", size: "medium", className: "surface mb-0 w-full", children: [
1444
+ /* @__PURE__ */ jsxRuntime.jsx(material.InputLabel, { children: PLUGIN_PROVIDER_CONTROL_LABEL }),
1445
+ /* @__PURE__ */ jsxRuntime.jsxs(
1446
+ material.Select,
1447
+ {
1448
+ value: selectedPluginExtensionId,
1449
+ onChange: (e) => onPluginProviderChange?.(e.target.value),
1450
+ disabled: disableInputs,
1451
+ "data-testid": "plugin-provider-select",
1452
+ children: [
1453
+ selectedPluginExtensionId ? /* @__PURE__ */ jsxRuntime.jsx(material.MenuItem, { value: "", children: /* @__PURE__ */ jsxRuntime.jsx("em", { children: "None" }) }) : null,
1454
+ pluginProviders.map((p) => /* @__PURE__ */ jsxRuntime.jsx(material.MenuItem, { value: p.extensionId, children: p.name }, p.extensionId))
1455
+ ]
1456
+ }
1457
+ )
1458
+ ] }) }),
1459
+ !isPluginMode && /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: { xs: 12, sm: 6 }, children: /* @__PURE__ */ jsxRuntime.jsxs(material.FormControl, { variant: "filled", size: "medium", className: "surface mb-0 w-full", children: [
1460
+ /* @__PURE__ */ jsxRuntime.jsx(material.InputLabel, { children: CONNECTOR_CONTROL_LABEL }),
1461
+ /* @__PURE__ */ jsxRuntime.jsxs(
1462
+ material.Select,
1463
+ {
1464
+ value: selectedConnectorId,
1465
+ onChange: (e) => onConnectorChange(e.target.value),
1466
+ "data-testid": "connector-select",
1467
+ children: [
1468
+ selectedConnectorId ? /* @__PURE__ */ jsxRuntime.jsx(material.MenuItem, { value: "", children: /* @__PURE__ */ jsxRuntime.jsx("em", { children: "None" }) }) : null,
1469
+ connectors.map((c) => /* @__PURE__ */ jsxRuntime.jsx(material.MenuItem, { value: c.id, children: c.name }, c.id))
1470
+ ]
1471
+ }
1472
+ )
1473
+ ] }) }),
1474
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: 12, children: !hasProvider ? renderNoProviderEmptyState(effectiveKind, moduleLabel) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1475
+ banner,
1476
+ /* @__PURE__ */ jsxRuntime.jsx(material.Card, { children: /* @__PURE__ */ jsxRuntime.jsx(material.CardContent, { children: /* @__PURE__ */ jsxRuntime.jsxs(material.Grid, { container: true, spacing: 2, children: [
1477
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { className: "border-border flex flex-row items-center gap-4 border-b px-2 pb-2", children: [
1478
+ /* @__PURE__ */ jsxRuntime.jsx(
1479
+ material.Typography,
1480
+ {
1481
+ variant: "caption",
1482
+ className: "text-text-secondary flex-1 font-semibold uppercase tracking-wider",
1483
+ children: "Operation"
1484
+ }
1485
+ ),
1486
+ /* @__PURE__ */ jsxRuntime.jsx(
1487
+ material.Typography,
1488
+ {
1489
+ variant: "caption",
1490
+ className: "text-text-secondary font-semibold uppercase tracking-wider",
1491
+ sx: { width: 300 },
1492
+ children: "Mapped Tool"
1493
+ }
1494
+ ),
1495
+ /* @__PURE__ */ jsxRuntime.jsx(
1496
+ material.Typography,
1497
+ {
1498
+ variant: "caption",
1499
+ className: "text-text-secondary font-semibold uppercase tracking-wider",
1500
+ sx: { width: 160 },
1501
+ children: "Source"
1502
+ }
1503
+ )
1504
+ ] }) }),
1505
+ mappings.map((m) => {
1506
+ const canEditTranslation = !!m.mappedToolName && m.canonicalRequestFields != null && m.canonicalResponseFields != null;
1507
+ return /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { size: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(
1508
+ material.Box,
1509
+ {
1510
+ className: "flex flex-row items-center gap-4 px-2 py-1.5",
1511
+ "data-testid": `mapping-row-${m.operationKey}`,
1512
+ children: [
1513
+ /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { className: "flex flex-1 items-center gap-2", children: [
1514
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "subtitle2", children: m.label }),
1515
+ m.isRequired && /* @__PURE__ */ jsxRuntime.jsx(material.Chip, { label: "Required", size: "small", color: "primary", variant: "outlined" })
1516
+ ] }),
1517
+ /* @__PURE__ */ jsxRuntime.jsx(
1518
+ material.Autocomplete,
1519
+ {
1520
+ sx: { width: 300 },
1521
+ size: "small",
1522
+ options: availableTools.map((t) => t.name),
1523
+ value: m.mappedToolName ?? null,
1524
+ onChange: (_, next) => onUpdateMapping(m.operationKey, next ?? "", m.rowVersion ?? ""),
1525
+ disabled: disableInputs,
1526
+ disableClearable: false,
1527
+ clearText: "Not mapped",
1528
+ renderInput: (params) => /* @__PURE__ */ jsxRuntime.jsx(
1529
+ material.TextField,
1530
+ {
1531
+ ...params,
1532
+ variant: "filled",
1533
+ label: "Tool",
1534
+ placeholder: "Type to search\u2026",
1535
+ className: "surface mb-0",
1536
+ slotProps: { inputLabel: { shrink: true } },
1537
+ "data-testid": `mapping-tool-input-${m.operationKey}`
1538
+ }
1539
+ ),
1540
+ renderOption: (props, option) => {
1541
+ const tool = availableTools.find((t) => t.name === option);
1542
+ return /* @__PURE__ */ react.createElement(material.Box, { component: "li", ...props, key: option }, /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { children: [
1543
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "body2", children: option }),
1544
+ tool?.description && /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", className: "text-text-secondary", children: tool.description })
1545
+ ] }));
1546
+ }
1547
+ }
1548
+ ),
1549
+ canEditTranslation ? /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Configure field translation", children: /* @__PURE__ */ jsxRuntime.jsx(
1550
+ material.IconButton,
1551
+ {
1552
+ size: "small",
1553
+ onClick: () => onEditTranslation(m.operationKey, {
1554
+ requestFieldMap: m.requestFieldMap ?? null,
1555
+ responseFieldPaths: m.responseFieldPaths ?? null,
1556
+ staticRequestFields: m.staticRequestFields ?? null
1557
+ }),
1558
+ disabled: disableInputs,
1559
+ "aria-label": "Configure field translation",
1560
+ "data-testid": `edit-translation-${m.operationKey}`,
1561
+ children: /* @__PURE__ */ jsxRuntime.jsx(NiSettings, { size: "small" })
1562
+ }
1563
+ ) }) : (
1564
+ // A spacer, not nothing. Without it the source column shifts left on
1565
+ // rows with no translation affordance and the table stops being a table.
1566
+ /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { width: 32, flexShrink: 0 } })
1567
+ ),
1568
+ /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { className: "flex items-center gap-1.5", sx: { width: 160 }, children: [
1569
+ renderSourceChip(m),
1570
+ m.requiresReview && /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "AI suggestion, low confidence \u2014 please confirm.", children: /* @__PURE__ */ jsxRuntime.jsx(
1571
+ material.Box,
1572
+ {
1573
+ className: "bg-warning",
1574
+ sx: { width: 8, height: 8, borderRadius: "50%" }
1575
+ }
1576
+ ) })
1577
+ ] })
1578
+ ]
1579
+ }
1580
+ ) }, m.operationKey);
1581
+ })
1582
+ ] }) }) })
1583
+ ] }) })
1584
+ ] });
1585
+ }
945
1586
  function ConnectorMappingTranslationEditorView({
946
1587
  open,
947
1588
  operationLabel,
@@ -1383,14 +2024,27 @@ var CONNECTOR_MAPPINGS_ROOT = "connector-mappings";
1383
2024
  function connectorMappingsQueryKey(connectorId, moduleKey) {
1384
2025
  return [CONNECTOR_MAPPINGS_ROOT, connectorId, moduleKey];
1385
2026
  }
2027
+ function connectorMappingsRootQueryKey() {
2028
+ return [CONNECTOR_MAPPINGS_ROOT];
2029
+ }
2030
+ function pluginTargetMappingsQueryKey(moduleKey) {
2031
+ return [CONNECTOR_MAPPINGS_ROOT, "plugin-target", moduleKey];
2032
+ }
1386
2033
  function connectorMappingCompletenessQueryKey(connectorId, moduleKey) {
1387
2034
  return [...connectorMappingsQueryKey(connectorId, moduleKey), "completeness"];
1388
2035
  }
1389
2036
 
2037
+ exports.CONNECTOR_CONTROL_LABEL = CONNECTOR_CONTROL_LABEL;
1390
2038
  exports.ConnectorMappingTranslationEditorView = ConnectorMappingTranslationEditorView;
2039
+ exports.ConnectorMappingView = ConnectorMappingView;
1391
2040
  exports.MappingCompletenessBanner = MappingCompletenessBanner;
2041
+ exports.PLUGIN_PROVIDER_CONTROL_LABEL = PLUGIN_PROVIDER_CONTROL_LABEL;
2042
+ exports.PROVIDER_CONTROL_LABEL = PROVIDER_CONTROL_LABEL;
2043
+ exports.PROVIDER_OPTION_LABEL = PROVIDER_OPTION_LABEL;
1392
2044
  exports.connectorMappingCompletenessQueryKey = connectorMappingCompletenessQueryKey;
1393
2045
  exports.connectorMappingsQueryKey = connectorMappingsQueryKey;
2046
+ exports.connectorMappingsRootQueryKey = connectorMappingsRootQueryKey;
2047
+ exports.pluginTargetMappingsQueryKey = pluginTargetMappingsQueryKey;
1394
2048
  exports.selectIncompleteOperations = selectIncompleteOperations;
1395
2049
  exports.selectMappingReadiness = selectMappingReadiness;
1396
2050
  exports.selectOptionalIncompleteOperations = selectOptionalIncompleteOperations;