@nivaro/react 0.3.63 → 0.3.65

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.
Files changed (64) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +54 -5
  4. package/dist/shared/components/CollectionBrowserView.js +3029 -2947
  5. package/dist/shared/components/ConformanceView.js +235 -221
  6. package/dist/shared/components/DataTable.js +478 -459
  7. package/dist/shared/components/ItemEditForm.js +4469 -4266
  8. package/dist/shared/components/PageRenderer.js +146 -138
  9. package/dist/shared/components/RecordDrilldownSheet.js +73 -65
  10. package/dist/shared/components/bulk/BulkActionButtons.js +72 -72
  11. package/dist/shared/components/bulk/BulkFieldUpdate.js +114 -103
  12. package/dist/shared/components/bulk/BulkFieldUpdateButton.js +73 -0
  13. package/dist/shared/components/bulk/bulk-field-options.js +29 -23
  14. package/dist/shared/components/integrations/IntegrationObligationsView.js +191 -173
  15. package/dist/shared/components/integrations/IntegrationStatusLines.js +101 -85
  16. package/dist/shared/components/integrations/RecordIntegrationPreview.js +11 -9
  17. package/dist/shared/components/integrations/SendCurrentData.js +126 -0
  18. package/dist/shared/components/item-edit/CatalogPickerField.js +1530 -1437
  19. package/dist/shared/components/item-edit/FieldRenderer.js +49 -45
  20. package/dist/shared/components/item-edit/FieldRow.js +413 -403
  21. package/dist/shared/components/item-edit/InlineTableField.js +2903 -2816
  22. package/dist/shared/components/item-edit/M2MCombobox.js +172 -168
  23. package/dist/shared/components/item-edit/MidairCollisionDialog.js +341 -114
  24. package/dist/shared/components/item-edit/NestedRelationEditor.js +171 -163
  25. package/dist/shared/components/item-edit/PlanGrid.js +783 -724
  26. package/dist/shared/components/item-edit/QuickCreateButton.js +291 -224
  27. package/dist/shared/components/item-edit/RecordInsights.js +113 -111
  28. package/dist/shared/components/item-edit/RecordLiveSync.js +4 -1
  29. package/dist/shared/components/item-edit/RelationCombobox.js +332 -314
  30. package/dist/shared/components/item-edit/cascade-clear-notice.js +52 -0
  31. package/dist/shared/components/item-edit/collision-format.js +37 -0
  32. package/dist/shared/components/item-edit/field-a11y.js +25 -0
  33. package/dist/shared/components/item-edit/line-merge.js +58 -0
  34. package/dist/shared/components/item-edit/line-midair.js +94 -87
  35. package/dist/shared/components/item-edit/move-guard.js +17 -0
  36. package/dist/shared/components/item-edit/picker-search.js +22 -15
  37. package/dist/shared/components/item-edit/rail-width.js +8 -0
  38. package/dist/shared/components/monitoring/InactiveUserLinksView.js +322 -291
  39. package/dist/shared/components/panels/AccessDeniedPanel.js +96 -55
  40. package/dist/shared/components/panels/CommentPanel.js +142 -136
  41. package/dist/shared/components/panels/ItemLockBanner.js +246 -240
  42. package/dist/shared/components/panels/PipelinePanel.js +1366 -1194
  43. package/dist/shared/components/panels/RevisionsPanel.js +106 -102
  44. package/dist/shared/components/panels/SlaBreachBanner.js +16 -20
  45. package/dist/shared/components/panels/SlaClock.js +90 -68
  46. package/dist/shared/components/queue/QueueItemSheet.js +94 -87
  47. package/dist/shared/components/queue/QueueWorklist.js +1502 -1354
  48. package/dist/shared/components/queue/worklist-csv.js +75 -0
  49. package/dist/shared/components/queue/worklist-helpers.js +20 -0
  50. package/dist/shared/components/widgets/ReviewListWidget.js +226 -207
  51. package/dist/shared/lib/bulk-copy.js +17 -0
  52. package/dist/shared/lib/cbv-export.js +122 -0
  53. package/dist/shared/lib/delete-offer.js +13 -0
  54. package/dist/shared/lib/error-hints.js +1 -0
  55. package/dist/shared/lib/leave-guard.js +41 -26
  56. package/dist/shared/lib/list-link.js +72 -56
  57. package/dist/shared/lib/live-queries.js +32 -30
  58. package/dist/shared/lib/moved-notice.js +25 -0
  59. package/dist/shared/lib/notification-target.js +56 -54
  60. package/dist/shared/lib/obligation-banner.js +11 -8
  61. package/dist/shared/lib/obligation-reason-text.js +6 -6
  62. package/dist/shared/lib/sort-cycle.js +6 -0
  63. package/dist/shared/lib/summary-mode.js +59 -41
  64. package/package.json +1 -1
@@ -1,71 +1,72 @@
1
- import { jsx as n, jsxs as i } from "react/jsx-runtime";
2
- import { useQuery as _, useQueryClient as $, useMutation as j } from "@tanstack/react-query";
3
- import { RotateCcw as V, RefreshCw as v, Eye as F, Loader2 as L, Send as T } from "lucide-react";
1
+ import { jsx as n, jsxs as u } from "react/jsx-runtime";
2
+ import { useQuery as V, useQueryClient as w, useMutation as B } from "@tanstack/react-query";
3
+ import { RotateCcw as F, RefreshCw as v, Eye as L, Loader2 as Q, Send as T } from "lucide-react";
4
4
  import { useState as A } from "react";
5
5
  import { toast as y } from "sonner";
6
- import { useNivaroClient as w } from "../../context.js";
7
- import { get as B, post as E } from "../../lib/commands.js";
8
- import { bannerLines as P } from "../../lib/obligation-banner.js";
9
- import { requestTransitionRun as Q } from "../../lib/run-transition.js";
6
+ import { useNivaroClient as S } from "../../context.js";
7
+ import { get as K, post as P } from "../../lib/commands.js";
8
+ import { bannerLines as D } from "../../lib/obligation-banner.js";
9
+ import { requestTransitionRun as E } from "../../lib/run-transition.js";
10
10
  import { cn as f } from "../../lib/utils.js";
11
11
  import { colorPair as I } from "../QueryTable.js";
12
- import { roleForTone as K } from "./IntegrationObligationsView.js";
13
- function O({
12
+ import { roleForTone as O } from "./IntegrationObligationsView.js";
13
+ import { SendCurrentDataButton as M } from "./SendCurrentData.js";
14
+ function U({
14
15
  obligationId: d,
15
- collection: s,
16
+ collection: i,
16
17
  itemId: m,
17
18
  enabled: o = !0
18
19
  }) {
19
- const e = w(), t = $(), [b, l] = A(!1), g = j({
20
+ const e = S(), b = w(), [r, c] = A(!1), s = B({
20
21
  mutationFn: () => e.request(
21
- E(`/integration-obligations/${d}/send`)
22
+ P(`/integration-obligations/${d}/send`)
22
23
  ),
23
- onSuccess: (r) => {
24
- var u;
25
- y.message(((u = r == null ? void 0 : r.data) == null ? void 0 : u.detail) ?? "Sent"), t.invalidateQueries({
26
- queryKey: ["integration-obligations", "record", s, String(m)]
24
+ onSuccess: (l) => {
25
+ var a;
26
+ y.message(((a = l == null ? void 0 : l.data) == null ? void 0 : a.detail) ?? "Sent"), b.invalidateQueries({
27
+ queryKey: ["integration-obligations", "record", i, String(m)]
27
28
  });
28
29
  },
29
- onError: (r) => {
30
- const u = r == null ? void 0 : r.response;
31
- y.error((u == null ? void 0 : u.error) ?? "Send now failed", { duration: 8e3 });
30
+ onError: (l) => {
31
+ const a = l == null ? void 0 : l.response;
32
+ y.error((a == null ? void 0 : a.error) ?? "Send now failed", { duration: 8e3 });
32
33
  },
33
- onSettled: () => l(!1)
34
+ onSettled: () => c(!1)
34
35
  });
35
- return /* @__PURE__ */ i(
36
+ return /* @__PURE__ */ u(
36
37
  "button",
37
38
  {
38
39
  type: "button",
39
40
  "data-obligation-send-now": !0,
40
41
  "data-obligation-send-now-enabled": o,
41
- disabled: g.isPending || !o,
42
- title: o ? "Re-send the newest request for this partner (admins)" : "Remediation is off for this deployment — an admin turns it on under Integrations › Remediation, then this sends from here",
42
+ disabled: s.isPending || !o,
43
+ title: o ? "Send the stored request again, unchanged (admins)" : "Remediation is off for this deployment — an admin turns it on under Integrations › Remediation, then this sends from here",
43
44
  onClick: () => {
44
- if (!b) {
45
- l(!0);
45
+ if (!r) {
46
+ c(!0);
46
47
  return;
47
48
  }
48
- g.mutate();
49
+ s.mutate();
49
50
  },
50
51
  className: f(
51
52
  "inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-[10.5px] font-medium transition-colors disabled:opacity-60",
52
- b ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan dark:border-nvr-cyan dark:bg-nvr-cyan/15" : "border-slate-200 text-slate-500 hover:border-slate-300 hover:bg-slate-50 dark:border-border dark:text-muted-foreground dark:hover:bg-muted"
53
+ r ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan dark:border-nvr-cyan dark:bg-nvr-cyan/15" : "border-slate-200 text-slate-500 hover:border-slate-300 hover:bg-slate-50 dark:border-border dark:text-muted-foreground dark:hover:bg-muted"
53
54
  ),
54
55
  children: [
55
- g.isPending ? /* @__PURE__ */ n(L, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ n(T, { className: "h-3 w-3" }),
56
- b ? "Confirm send?" : "Send now"
56
+ s.isPending ? /* @__PURE__ */ n(Q, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ n(T, { className: "h-3 w-3" }),
57
+ r ? "Confirm send?" : "Send now"
57
58
  ]
58
59
  }
59
60
  );
60
61
  }
61
- function te(d, s) {
62
- var e, t;
63
- const m = w(), o = _({
64
- queryKey: ["integration-obligations", "record", d, String(s)],
62
+ function ae(d, i) {
63
+ var e, b;
64
+ const m = S(), o = V({
65
+ queryKey: ["integration-obligations", "record", d, String(i)],
65
66
  queryFn: () => m.request(
66
- B(`/integration-obligations/record/${d}/${encodeURIComponent(String(s))}`)
67
+ K(`/integration-obligations/record/${d}/${encodeURIComponent(String(i))}`)
67
68
  ),
68
- enabled: !!d && !!s,
69
+ enabled: !!d && !!i,
69
70
  staleTime: 3e4,
70
71
  // A 403 means this viewer may not read the record's integrations — that
71
72
  // is an answer, not something to retry.
@@ -73,41 +74,42 @@ function te(d, s) {
73
74
  });
74
75
  return {
75
76
  ...o,
76
- lines: P(((e = o.data) == null ? void 0 : e.data) ?? []),
77
- remediationEnabled: ((t = o.data) == null ? void 0 : t.remediation_enabled) === !0
77
+ lines: D(((e = o.data) == null ? void 0 : e.data) ?? []),
78
+ remediationEnabled: ((b = o.data) == null ? void 0 : b.remediation_enabled) === !0
78
79
  };
79
80
  }
80
- const p = "inline-flex shrink-0 items-center gap-1 rounded-full border border-slate-200 px-2 py-0.5 text-[10.5px] font-medium text-slate-600 transition-colors hover:border-slate-300 hover:bg-slate-50 disabled:opacity-60 dark:border-border dark:text-muted-foreground dark:hover:bg-muted";
81
- function re({
81
+ const h = "inline-flex shrink-0 items-center gap-1 rounded-full border border-slate-200 px-2 py-0.5 text-[10.5px] font-medium text-slate-600 transition-colors hover:border-slate-300 hover:bg-slate-50 disabled:opacity-60 dark:border-border dark:text-muted-foreground dark:hover:bg-muted";
82
+ function de({
82
83
  collection: d,
83
- itemId: s,
84
+ itemId: i,
84
85
  lines: m,
85
86
  remediationEnabled: o,
86
87
  actions: e
87
88
  }) {
88
- return m.length === 0 ? null : /* @__PURE__ */ n("div", { className: "space-y-1.5", "data-integration-lines": !0, children: m.map((t) => {
89
+ const b = w();
90
+ return m.length === 0 ? null : /* @__PURE__ */ n("div", { className: "space-y-1.5", "data-integration-lines": !0, children: m.map((r) => {
89
91
  var k;
90
- const b = K(t.tone), [l, g] = b ? I(b) : [null, null], r = t.outcome === "failed" || t.outcome === "missing" || t.outcome === "overdue", u = r, c = (k = e == null ? void 0 : e.newestSubmissionByApi) == null ? void 0 : k.get(t.api.toLowerCase()), h = t.submission_id ?? (c == null ? void 0 : c.id) ?? null, N = !!(e != null && e.onRetry) && h != null && (t.outcome === "failed" || (c == null ? void 0 : c.status) === "failed"), S = !!(e != null && e.onView) && h != null, C = !!t.transition_id && !!t.transition_label && r, R = !!(e != null && e.onCheck) && (t.outcome === "pending" || t.outcome === "overdue"), q = () => {
92
+ const c = O(r.tone), [s, l] = c ? I(c) : [null, null], a = r.outcome === "failed" || r.outcome === "missing" || r.outcome === "overdue", N = a && r.can_resend !== !1, C = a && r.can_send_current === !0, g = (k = e == null ? void 0 : e.newestSubmissionByApi) == null ? void 0 : k.get(r.api.toLowerCase()), p = r.submission_id ?? (g == null ? void 0 : g.id) ?? null, q = !!(e != null && e.onRetry) && p != null && (r.outcome === "failed" || (g == null ? void 0 : g.status) === "failed"), R = !!(e != null && e.onView) && p != null, _ = !!r.transition_id && !!r.transition_label && a, $ = !!(e != null && e.onCheck) && (r.outcome === "pending" || r.outcome === "overdue"), j = () => {
91
93
  var x;
92
- if (!Q({
94
+ if (!E({
93
95
  collection: d,
94
- item: String(s),
95
- transition_id: t.transition_id
96
+ item: String(i),
97
+ transition_id: r.transition_id
96
98
  })) {
97
- y.error(`Open the record to run “${t.transition_label}”`);
99
+ y.error(`Open the record to run “${r.transition_label}”`);
98
100
  return;
99
101
  }
100
102
  (x = e == null ? void 0 : e.onRanTransition) == null || x.call(e);
101
103
  };
102
- return /* @__PURE__ */ i(
104
+ return /* @__PURE__ */ u(
103
105
  "div",
104
106
  {
105
- "data-integration-line": t.api,
106
- "data-integration-outcome": t.outcome,
107
- style: l ? { "--obt": l, "--obtd": g } : void 0,
107
+ "data-integration-line": r.api,
108
+ "data-integration-outcome": r.outcome,
109
+ style: s ? { "--obt": s, "--obtd": l } : void 0,
108
110
  className: f(
109
111
  "flex items-start gap-2 rounded-lg border border-slate-200 bg-white px-3 py-1.5 text-[12px] dark:border-border dark:bg-card",
110
- l && "border-t-2 border-t-[color:var(--obt)] dark:border-t-[color:var(--obtd)]"
112
+ s && "border-t-2 border-t-[color:var(--obt)] dark:border-t-[color:var(--obtd)]"
111
113
  ),
112
114
  children: [
113
115
  /* @__PURE__ */ n(
@@ -116,13 +118,13 @@ function re({
116
118
  "aria-hidden": !0,
117
119
  className: f(
118
120
  "mt-1 h-1.5 w-1.5 shrink-0 rounded-full",
119
- l ? "bg-[color:var(--obt)] dark:bg-[color:var(--obtd)]" : "bg-slate-400 dark:bg-slate-600"
121
+ s ? "bg-[color:var(--obt)] dark:bg-[color:var(--obtd)]" : "bg-slate-400 dark:bg-slate-600"
120
122
  )
121
123
  }
122
124
  ),
123
- /* @__PURE__ */ i("p", { className: "min-w-0 flex-1 leading-5 text-slate-700 dark:text-slate-200", children: [
124
- /* @__PURE__ */ i("span", { className: "font-semibold text-slate-800 dark:text-foreground", children: [
125
- t.api,
125
+ /* @__PURE__ */ u("p", { className: "min-w-0 flex-1 leading-5 text-slate-700 dark:text-slate-200", children: [
126
+ /* @__PURE__ */ u("span", { className: "font-semibold text-slate-800 dark:text-foreground", children: [
127
+ r.api,
126
128
  ":"
127
129
  ] }),
128
130
  " ",
@@ -130,95 +132,109 @@ function re({
130
132
  "span",
131
133
  {
132
134
  "data-integration-reason": !0,
133
- className: l ? "text-[color:var(--obt)] dark:text-[color:var(--obtd)]" : "text-slate-500 dark:text-muted-foreground",
134
- children: t.text
135
+ className: s ? "text-[color:var(--obt)] dark:text-[color:var(--obtd)]" : "text-slate-500 dark:text-muted-foreground",
136
+ children: r.text
135
137
  }
136
138
  )
137
139
  ] }),
138
- /* @__PURE__ */ i("span", { className: "ml-auto flex shrink-0 flex-wrap items-center justify-end gap-1", children: [
139
- C && /* @__PURE__ */ i(
140
+ /* @__PURE__ */ u("span", { className: "ml-auto flex shrink-0 flex-wrap items-center justify-end gap-1", children: [
141
+ _ && /* @__PURE__ */ u(
140
142
  "button",
141
143
  {
142
144
  type: "button",
143
145
  "data-integration-action": "rerun",
144
- onClick: q,
145
- title: `Fix what ${t.api} rejected, then run “${t.transition_label}” again — it re-sends from the current values`,
146
- className: f(p, "border-nvr-cyan/40 text-nvr-cyan hover:bg-nvr-cyan/10"),
146
+ onClick: j,
147
+ title: `Fix what ${r.api} rejected, then run “${r.transition_label}” again — it re-sends from the current values`,
148
+ className: f(h, "border-nvr-cyan/40 text-nvr-cyan hover:bg-nvr-cyan/10"),
147
149
  children: [
148
- /* @__PURE__ */ n(V, { className: "h-3 w-3" }),
150
+ /* @__PURE__ */ n(F, { className: "h-3 w-3" }),
149
151
  "Re-run ",
150
- t.transition_label
152
+ r.transition_label
151
153
  ]
152
154
  }
153
155
  ),
154
- N && /* @__PURE__ */ i(
156
+ q && /* @__PURE__ */ u(
155
157
  "button",
156
158
  {
157
159
  type: "button",
158
160
  "data-integration-action": "retry",
159
161
  onClick: () => {
160
- var a;
161
- return (a = e == null ? void 0 : e.onRetry) == null ? void 0 : a.call(e, h);
162
+ var t;
163
+ return (t = e == null ? void 0 : e.onRetry) == null ? void 0 : t.call(e, p);
162
164
  },
163
165
  title: "Send the same request again, unchanged — for a partner that was down, not for data it rejected",
164
- className: p,
166
+ className: h,
165
167
  children: [
166
168
  /* @__PURE__ */ n(v, { className: "h-3 w-3" }),
167
169
  "Retry"
168
170
  ]
169
171
  }
170
172
  ),
171
- R && /* @__PURE__ */ i(
173
+ $ && /* @__PURE__ */ u(
172
174
  "button",
173
175
  {
174
176
  type: "button",
175
177
  "data-integration-action": "check",
176
178
  onClick: () => {
177
- var a;
178
- return (a = e == null ? void 0 : e.onCheck) == null ? void 0 : a.call(e);
179
+ var t;
180
+ return (t = e == null ? void 0 : e.onCheck) == null ? void 0 : t.call(e);
179
181
  },
180
182
  title: "Ask again whether the partner has acknowledged it",
181
- className: p,
183
+ className: h,
182
184
  children: [
183
185
  /* @__PURE__ */ n(v, { className: "h-3 w-3" }),
184
186
  "Check now"
185
187
  ]
186
188
  }
187
189
  ),
188
- S && /* @__PURE__ */ i(
190
+ R && /* @__PURE__ */ u(
189
191
  "button",
190
192
  {
191
193
  type: "button",
192
194
  "data-integration-action": "view",
193
195
  onClick: () => {
194
- var a;
195
- return (a = e == null ? void 0 : e.onView) == null ? void 0 : a.call(e, h);
196
+ var t;
197
+ return (t = e == null ? void 0 : e.onView) == null ? void 0 : t.call(e, p);
196
198
  },
197
199
  title: "Show the request and the reply",
198
- className: p,
200
+ className: h,
199
201
  children: [
200
- /* @__PURE__ */ n(F, { className: "h-3 w-3" }),
201
- t.outcome === "failed" ? "View error" : "View request"
202
+ /* @__PURE__ */ n(L, { className: "h-3 w-3" }),
203
+ r.outcome === "failed" ? "View error" : "View request"
202
204
  ]
203
205
  }
204
206
  ),
205
- u && /* @__PURE__ */ n(
206
- O,
207
+ N && /* @__PURE__ */ n(
208
+ U,
207
209
  {
208
- obligationId: t.obligation_id,
210
+ obligationId: r.obligation_id,
209
211
  collection: d,
210
- itemId: s,
212
+ itemId: i,
211
213
  enabled: o
212
214
  }
215
+ ),
216
+ C && /* @__PURE__ */ n(
217
+ M,
218
+ {
219
+ obligationId: r.obligation_id,
220
+ api: r.api,
221
+ enabled: o,
222
+ onSent: () => {
223
+ var t;
224
+ b.invalidateQueries({
225
+ queryKey: ["integration-obligations", "record", d, String(i)]
226
+ }), (t = e == null ? void 0 : e.onCheck) == null || t.call(e);
227
+ }
228
+ }
213
229
  )
214
230
  ] })
215
231
  ]
216
232
  },
217
- t.api
233
+ r.api
218
234
  );
219
235
  }) });
220
236
  }
221
237
  export {
222
- re as IntegrationStatusLines,
223
- te as useRecordObligations
238
+ de as IntegrationStatusLines,
239
+ ae as useRecordObligations
224
240
  };
@@ -1,12 +1,12 @@
1
1
  import { jsxs as n, jsx as t, Fragment as M } from "react/jsx-runtime";
2
2
  import { useQuery as L, useQueryClient as V } from "@tanstack/react-query";
3
- import { Loader2 as Z, Check as X, CheckCircle2 as P, AlertTriangle as Q, Zap as Y, ChevronDown as I, ChevronRight as J, PencilLine as ee } from "lucide-react";
3
+ import { Loader2 as Z, Send as X, CheckCircle2 as S, AlertTriangle as Q, Zap as Y, ChevronDown as I, ChevronRight as J, PencilLine as ee } from "lucide-react";
4
4
  import { useState as W, useEffect as te } from "react";
5
5
  import { useNivaroClient as R } from "../../context.js";
6
6
  import { get as _ } from "../../lib/commands.js";
7
7
  import { cn as y, formatRelative as ae, formatDateTime as re } from "../../lib/utils.js";
8
8
  import { Popover as se, PopoverTrigger as ne, PopoverContent as le } from "../ui/popover.js";
9
- function S(r) {
9
+ function P(r) {
10
10
  typeof window > "u" || window.dispatchEvent(new CustomEvent("nvr:record-focus", { detail: r }));
11
11
  }
12
12
  function A({
@@ -41,7 +41,7 @@ function A({
41
41
  type: "button",
42
42
  "data-preflight-jump-row": e.id,
43
43
  onClick: () => {
44
- o == null || o(), S({
44
+ o == null || o(), P({
45
45
  collection: s,
46
46
  item: h,
47
47
  childCollection: l.collection,
@@ -66,7 +66,7 @@ function A({
66
66
  type: "button",
67
67
  "data-preflight-jump-field": l.field,
68
68
  onClick: () => {
69
- o == null || o(), S({ collection: s, item: h, field: l.field });
69
+ o == null || o(), P({ collection: s, item: h, field: l.field });
70
70
  },
71
71
  className: "mt-0.5 text-[11px] text-nvr-navy underline-offset-2 hover:underline dark:text-nvr-cyan",
72
72
  children: "Go to the field"
@@ -171,9 +171,11 @@ function ie({
171
171
  "after:absolute after:-inset-1.5 after:content-['']",
172
172
  "text-white transition-[filter,transform] duration-150 ease-out hover:brightness-110 active:scale-90",
173
173
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
174
- p === "ready" ? "h-3.5 w-3.5 bg-[#047857]" : p === "block" ? "h-4 min-w-4 px-1 bg-[#dc2626]" : "h-4 min-w-4 px-1 bg-[#b45309]"
174
+ // Ready to send = a neutral send disc, never a green ✓ that reads
175
+ // as "approved / recommended" on an order button (army 11 a2 F2).
176
+ p === "ready" ? "h-3.5 w-3.5 bg-[#475569] dark:bg-[#64748b]" : p === "block" ? "h-4 min-w-4 px-1 bg-[#dc2626]" : "h-4 min-w-4 px-1 bg-[#b45309]"
175
177
  ),
176
- children: p === "ready" ? /* @__PURE__ */ t(X, { className: "h-2.5 w-2.5", strokeWidth: 3.5 }) : g.length > 0 ? /* @__PURE__ */ t("span", { className: "text-[10px] font-semibold leading-none tabular-nums", children: g.length > 9 ? "9+" : g.length }) : /* @__PURE__ */ t("span", { className: "text-[10px] font-bold leading-none", children: "!" })
178
+ children: p === "ready" ? /* @__PURE__ */ t(X, { className: "h-2 w-2", strokeWidth: 3, "aria-hidden": !0 }) : g.length > 0 ? /* @__PURE__ */ t("span", { className: "text-[10px] font-semibold leading-none tabular-nums", children: g.length > 9 ? "9+" : g.length }) : /* @__PURE__ */ t("span", { className: "text-[10px] font-bold leading-none", children: "!" })
177
179
  }
178
180
  ) : /* @__PURE__ */ n(
179
181
  "button",
@@ -187,7 +189,7 @@ function ie({
187
189
  ),
188
190
  "data-tip": $,
189
191
  children: [
190
- p === "ready" ? /* @__PURE__ */ t(P, { className: "h-3 w-3 shrink-0" }) : /* @__PURE__ */ t(Q, { className: "h-3 w-3 shrink-0" }),
192
+ p === "ready" ? /* @__PURE__ */ t(S, { className: "h-3 w-3 shrink-0" }) : /* @__PURE__ */ t(Q, { className: "h-3 w-3 shrink-0" }),
191
193
  /* @__PURE__ */ t("span", { className: "truncate", children: j }),
192
194
  C && /* @__PURE__ */ t("span", { className: "shrink-0 opacity-70", children: C })
193
195
  ]
@@ -203,7 +205,7 @@ function ie({
203
205
  (c == null ? void 0 : c.error) ?? "The check could not run.",
204
206
  " Nothing is assumed ready."
205
207
  ] }) : g.length === 0 ? /* @__PURE__ */ n("p", { className: "mt-2 flex items-center gap-1.5 text-[12px] text-emerald-800 dark:text-emerald-300", children: [
206
- /* @__PURE__ */ t(P, { className: "h-3.5 w-3.5" }),
208
+ /* @__PURE__ */ t(S, { className: "h-3.5 w-3.5" }),
207
209
  O ? b.length > 0 ? `Nothing new to send: ${v(b)} already has these values.` : "Nothing goes to a partner from this record." : f.length > 0 ? "Nothing stands in the way." : "Everything it needs is filled in."
208
210
  ] }) : /* @__PURE__ */ t("div", { className: "mt-2", children: /* @__PURE__ */ t(
209
211
  A,
@@ -432,5 +434,5 @@ function fe({
432
434
  export {
433
435
  fe as OutboundPreviewSection,
434
436
  ie as PushReadinessChip,
435
- S as focusRecordTarget
437
+ P as focusRecordTarget
436
438
  };
@@ -0,0 +1,126 @@
1
+ import { jsxs as a, jsx as n } from "react/jsx-runtime";
2
+ import { useQuery as x, useMutation as y } from "@tanstack/react-query";
3
+ import { Send as f, Loader2 as h, AlertTriangle as w } from "lucide-react";
4
+ import { useState as k } from "react";
5
+ import { toast as b } from "sonner";
6
+ import { useNivaroClient as N } from "../../context.js";
7
+ import { get as C, post as P } from "../../lib/commands.js";
8
+ import { cn as $ } from "../../lib/utils.js";
9
+ import { Popover as q, PopoverTrigger as T, PopoverContent as S } from "../ui/popover.js";
10
+ function j(o, t) {
11
+ return `This sends the record's current data${t != null && t.trim() ? ` (${t.trim()})` : ""} to ${o} now — not the original request.`;
12
+ }
13
+ function M({
14
+ obligationId: o,
15
+ api: t,
16
+ enabled: d = !0,
17
+ onSent: l,
18
+ className: v
19
+ }) {
20
+ var g;
21
+ const p = N(), [c, u] = k(!1), m = x({
22
+ queryKey: ["integration-obligations", "fresh-preview", o],
23
+ queryFn: () => p.request(
24
+ C(`/integration-obligations/${o}/fresh-preview`)
25
+ ),
26
+ enabled: c,
27
+ // Always rebuilt when the confirm opens: the point is the CURRENT data.
28
+ staleTime: 0,
29
+ gcTime: 0,
30
+ retry: !1
31
+ }), r = (g = m.data) == null ? void 0 : g.data, s = y({
32
+ mutationFn: () => p.request(
33
+ P(`/integration-obligations/${o}/send`, { fresh: !0 })
34
+ ),
35
+ onSuccess: (e) => {
36
+ var i;
37
+ b.message(((i = e == null ? void 0 : e.data) == null ? void 0 : i.detail) ?? `Sent to ${t}`), u(!1), l == null || l();
38
+ },
39
+ onError: (e) => {
40
+ const i = e == null ? void 0 : e.response;
41
+ b.error((i == null ? void 0 : i.error) ?? `Could not send to ${t}`, { duration: 8e3 });
42
+ }
43
+ });
44
+ return /* @__PURE__ */ a(q, { open: c, onOpenChange: (e) => !s.isPending && u(e), children: [
45
+ /* @__PURE__ */ n(T, { asChild: !0, children: /* @__PURE__ */ a(
46
+ "button",
47
+ {
48
+ type: "button",
49
+ "data-obligation-send-current": !0,
50
+ disabled: !d,
51
+ "data-tip": d ? `Send ${t} what the record says now` : "Remediation is off for this deployment — an admin turns it on under Integrations › Remediation",
52
+ onClick: (e) => e.stopPropagation(),
53
+ className: $(
54
+ "inline-flex shrink-0 items-center gap-1 rounded-full border border-slate-200 px-2 py-0.5 text-[10.5px] font-medium text-slate-600 transition-colors hover:border-slate-300 hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 disabled:opacity-60 dark:border-border dark:text-muted-foreground dark:hover:bg-muted",
55
+ c && "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan dark:border-nvr-cyan dark:bg-nvr-cyan/15",
56
+ v
57
+ ),
58
+ children: [
59
+ /* @__PURE__ */ n(f, { className: "h-3 w-3" }),
60
+ "Send current data"
61
+ ]
62
+ }
63
+ ) }),
64
+ /* @__PURE__ */ n(
65
+ S,
66
+ {
67
+ align: "end",
68
+ className: "w-[320px] max-w-[calc(100vw-32px)] p-3 text-[12px]",
69
+ onClick: (e) => e.stopPropagation(),
70
+ children: m.isLoading ? /* @__PURE__ */ a("p", { className: "flex items-center gap-2 text-slate-500 dark:text-muted-foreground", children: [
71
+ /* @__PURE__ */ n(h, { className: "h-3.5 w-3.5 animate-spin" }),
72
+ "Building the message from the current data…"
73
+ ] }) : r != null && r.available ? /* @__PURE__ */ a("div", { className: "space-y-3", children: [
74
+ /* @__PURE__ */ a(
75
+ "p",
76
+ {
77
+ className: "flex gap-2 leading-5 text-slate-700 dark:text-slate-200",
78
+ "data-send-current-warning": !0,
79
+ children: [
80
+ /* @__PURE__ */ n(
81
+ w,
82
+ {
83
+ "aria-hidden": !0,
84
+ className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-amber-600 dark:text-amber-400"
85
+ }
86
+ ),
87
+ /* @__PURE__ */ n("span", { children: j(r.api ?? t, r.summary) })
88
+ ]
89
+ }
90
+ ),
91
+ /* @__PURE__ */ a("div", { className: "flex justify-end gap-2", children: [
92
+ /* @__PURE__ */ n(
93
+ "button",
94
+ {
95
+ type: "button",
96
+ onClick: () => u(!1),
97
+ disabled: s.isPending,
98
+ className: "rounded-md px-2.5 py-1 text-[12px] font-medium text-slate-600 hover:bg-slate-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:text-muted-foreground dark:hover:bg-muted",
99
+ children: "Cancel"
100
+ }
101
+ ),
102
+ /* @__PURE__ */ a(
103
+ "button",
104
+ {
105
+ type: "button",
106
+ "data-send-current-confirm": !0,
107
+ onClick: () => s.mutate(),
108
+ disabled: s.isPending,
109
+ className: "inline-flex items-center gap-1.5 rounded-md bg-nvr-cyan px-2.5 py-1 text-[12px] font-medium text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 focus-visible:ring-offset-1 disabled:opacity-60",
110
+ children: [
111
+ s.isPending ? /* @__PURE__ */ n(h, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ n(f, { className: "h-3 w-3" }),
112
+ "Send to ",
113
+ r.api ?? t
114
+ ]
115
+ }
116
+ )
117
+ ] })
118
+ ] }) : /* @__PURE__ */ n("p", { className: "text-slate-600 dark:text-slate-300", "data-send-current-refused": !0, children: (r == null ? void 0 : r.detail) ?? (m.isError ? "Could not build the message." : "Nothing to send.") })
119
+ }
120
+ )
121
+ ] });
122
+ }
123
+ export {
124
+ M as SendCurrentDataButton,
125
+ j as sendCurrentWarning
126
+ };