@nivaro/react 0.3.116 → 0.3.118

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 (142) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +140 -14
  4. package/dist/index.js +488 -485
  5. package/dist/shared/components/ActivityEntry.js +130 -125
  6. package/dist/shared/components/AgentPresenceChip.js +36 -26
  7. package/dist/shared/components/CellCopyLayer.js +50 -45
  8. package/dist/shared/components/CollectionBrowserView.js +3855 -3785
  9. package/dist/shared/components/FilePreviewLightbox.js +96 -58
  10. package/dist/shared/components/InStep.js +18 -17
  11. package/dist/shared/components/ItemEditForm.js +4220 -4175
  12. package/dist/shared/components/JobsTray.js +8 -8
  13. package/dist/shared/components/LiveNewMatchesPill.js +21 -14
  14. package/dist/shared/components/LiveOffNote.js +3 -2
  15. package/dist/shared/components/LiveRowMark.js +53 -23
  16. package/dist/shared/components/LiveTraceView.js +162 -123
  17. package/dist/shared/components/MyWorkView.js +320 -299
  18. package/dist/shared/components/NotificationBell.js +14 -14
  19. package/dist/shared/components/OverflowRail.js +1 -1
  20. package/dist/shared/components/PageRenderer.js +120 -116
  21. package/dist/shared/components/ProfileView.js +203 -202
  22. package/dist/shared/components/RealtimeStatusBanner.js +31 -29
  23. package/dist/shared/components/RecordDrilldownSheet.js +7 -7
  24. package/dist/shared/components/RecordHoverCard.js +102 -84
  25. package/dist/shared/components/RecordReadView.js +146 -146
  26. package/dist/shared/components/ReportView.js +1086 -1091
  27. package/dist/shared/components/ScreenRefreshButton.js +34 -32
  28. package/dist/shared/components/TipLayer.js +65 -58
  29. package/dist/shared/components/WidgetImageMenu.js +83 -43
  30. package/dist/shared/components/activity/RecordActivityStream.js +175 -173
  31. package/dist/shared/components/bulk/BulkSelectionNotices.js +142 -119
  32. package/dist/shared/components/cbv/column-totals.js +62 -57
  33. package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +158 -143
  34. package/dist/shared/components/change-proposals/ProposeChangeButton.js +17 -11
  35. package/dist/shared/components/change-proposals/ProposeChangeDialog.js +201 -173
  36. package/dist/shared/components/charts/category-axis.js +93 -0
  37. package/dist/shared/components/chat/ChatAnalyticsView.js +27 -27
  38. package/dist/shared/components/chat/HuddleAnalyticsTab.js +17 -17
  39. package/dist/shared/components/collections-directory/CollectionsToolbar.js +39 -41
  40. package/dist/shared/components/collections-directory/page-model.js +72 -67
  41. package/dist/shared/components/integrations/RecordIntegrationPreview.js +48 -56
  42. package/dist/shared/components/integrations/SendStatus.js +65 -59
  43. package/dist/shared/components/integrations/console/ReadyToSendView.js +275 -209
  44. package/dist/shared/components/integrations/console/SignalCard.js +237 -230
  45. package/dist/shared/components/item-edit/CatalogPickerField.js +227 -205
  46. package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +131 -92
  47. package/dist/shared/components/item-edit/CloneDialog.js +191 -161
  48. package/dist/shared/components/item-edit/DerivedCauseNote.js +44 -30
  49. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +153 -134
  50. package/dist/shared/components/item-edit/FieldComments.js +54 -53
  51. package/dist/shared/components/item-edit/FieldPointer.js +82 -67
  52. package/dist/shared/components/item-edit/FieldRow.js +106 -100
  53. package/dist/shared/components/item-edit/FieldSourceBadge.js +58 -56
  54. package/dist/shared/components/item-edit/FilePickerField.js +452 -387
  55. package/dist/shared/components/item-edit/HeaderSummaryChip.js +78 -56
  56. package/dist/shared/components/item-edit/HeaderTools.js +94 -85
  57. package/dist/shared/components/item-edit/InlineTableField.js +1242 -1218
  58. package/dist/shared/components/item-edit/ListNeighborNav.js +47 -50
  59. package/dist/shared/components/item-edit/LiveTraceSheet.js +15 -10
  60. package/dist/shared/components/item-edit/MembershipSetField.js +285 -254
  61. package/dist/shared/components/item-edit/OutboxReviewTray.js +155 -144
  62. package/dist/shared/components/item-edit/QueueReturnChip.js +15 -36
  63. package/dist/shared/components/item-edit/RecalcValue.js +57 -32
  64. package/dist/shared/components/item-edit/RecordHelpChip.js +21 -22
  65. package/dist/shared/components/item-edit/RecordLiveSync.js +283 -231
  66. package/dist/shared/components/item-edit/RelationCombobox.js +439 -393
  67. package/dist/shared/components/item-edit/RemoteChangeUi.js +292 -224
  68. package/dist/shared/components/item-edit/RemoteUploads.js +26 -20
  69. package/dist/shared/components/item-edit/RemovedLineNote.js +77 -67
  70. package/dist/shared/components/item-edit/RichTextEditorImpl.js +184 -179
  71. package/dist/shared/components/item-edit/ScheduledChangeChip.js +168 -134
  72. package/dist/shared/components/item-edit/SectionPresence.js +18 -10
  73. package/dist/shared/components/item-edit/SplitLinesButton.js +163 -139
  74. package/dist/shared/components/item-edit/UserChip.js +1 -1
  75. package/dist/shared/components/item-edit/file-live.js +69 -54
  76. package/dist/shared/components/item-edit/layout-switch.js +98 -89
  77. package/dist/shared/components/item-edit/partner-needs.js +12 -12
  78. package/dist/shared/components/item-edit/removed-line.js +31 -25
  79. package/dist/shared/components/layout-editor/pickers/field-picker.js +112 -104
  80. package/dist/shared/components/list/ListViewers.js +46 -35
  81. package/dist/shared/components/notifications/NotificationCenterView.js +479 -437
  82. package/dist/shared/components/panels/AccessDeniedPanel.js +176 -101
  83. package/dist/shared/components/panels/AlertBanners.js +82 -72
  84. package/dist/shared/components/panels/BranchLanes.js +22 -22
  85. package/dist/shared/components/panels/CommentImages.js +123 -102
  86. package/dist/shared/components/panels/CommentPanel.js +186 -185
  87. package/dist/shared/components/panels/ExternalRequestsChip.js +111 -119
  88. package/dist/shared/components/panels/OwnerOpenedLine.js +31 -24
  89. package/dist/shared/components/panels/PipelinePanel.js +2037 -1885
  90. package/dist/shared/components/panels/ResubmissionDiff.js +163 -142
  91. package/dist/shared/components/pipeline/BindingStartStateSettings.js +163 -0
  92. package/dist/shared/components/pipeline/OwnerMatrixSheet.js +400 -288
  93. package/dist/shared/components/pipeline/PipelineEditorView.js +320 -299
  94. package/dist/shared/components/profile/AgentNameField.js +107 -81
  95. package/dist/shared/components/profile/AgentsPanel.js +184 -184
  96. package/dist/shared/components/profile/PersonAccess.js +599 -495
  97. package/dist/shared/components/profile/SignInTroubleshooter.js +160 -127
  98. package/dist/shared/components/profile/SignedInDevices.js +17 -17
  99. package/dist/shared/components/profile/primitives.js +1 -1
  100. package/dist/shared/components/queue/OwnerAvatars.js +91 -54
  101. package/dist/shared/components/queue/QueueTeamStrip.js +56 -46
  102. package/dist/shared/components/queue/QueueWorklist.js +1002 -983
  103. package/dist/shared/components/support/AssignRules.js +1733 -0
  104. package/dist/shared/components/support/PersonPick.js +88 -0
  105. package/dist/shared/components/support/RequestList.js +790 -0
  106. package/dist/shared/components/support/ScreenShare.js +158 -152
  107. package/dist/shared/components/support/SupportRequestDialog.js +50 -48
  108. package/dist/shared/components/support/SupportView.js +140 -246
  109. package/dist/shared/components/support/TicketDetailSheet.js +82 -75
  110. package/dist/shared/components/support/TicketSlowScreens.js +9 -9
  111. package/dist/shared/components/support/assign-rules-text.js +171 -0
  112. package/dist/shared/components/support/support-list.js +125 -0
  113. package/dist/shared/components/ui/SimpleSelect.js +28 -20
  114. package/dist/shared/components/ui/checkbox.js +6 -6
  115. package/dist/shared/components/ui/select.js +43 -39
  116. package/dist/shared/components/ui/sheet.js +9 -9
  117. package/dist/shared/components/ui/switch.js +12 -11
  118. package/dist/shared/components/watch-list/WatchDock.js +532 -459
  119. package/dist/shared/components/watch-list/WatchExtras.js +332 -286
  120. package/dist/shared/components/watch-list/WatchRows.js +164 -140
  121. package/dist/shared/lib/activity-sentence.js +103 -91
  122. package/dist/shared/lib/agent-presence.js +27 -21
  123. package/dist/shared/lib/approval-progress.js +2 -2
  124. package/dist/shared/lib/copy-rules.js +31 -24
  125. package/dist/shared/lib/derived-causes.js +113 -78
  126. package/dist/shared/lib/grid-cursors.js +26 -26
  127. package/dist/shared/lib/label-flash.js +27 -0
  128. package/dist/shared/lib/list-return.js +137 -125
  129. package/dist/shared/lib/live-deltas.js +40 -34
  130. package/dist/shared/lib/live-groups.js +56 -52
  131. package/dist/shared/lib/live-preference.js +64 -59
  132. package/dist/shared/lib/live-screen.js +223 -192
  133. package/dist/shared/lib/partner-failure.js +11 -11
  134. package/dist/shared/lib/rollup-recalc.js +68 -64
  135. package/dist/shared/lib/screen-refresh.js +74 -68
  136. package/dist/shared/lib/screen-share.js +108 -104
  137. package/dist/shared/lib/send-status.js +77 -61
  138. package/dist/shared/lib/text-diff-window.js +29 -0
  139. package/dist/shared/lib/use-query-entry.js +17 -0
  140. package/dist/shared/lib/watch-list.js +210 -209
  141. package/dist/shared/lib/widget-image-render.js +72 -49
  142. package/package.json +1 -1
@@ -4,78 +4,78 @@ import { DEFAULT_REPLAY_MASKING as Y, normalizeReplayMasking as z, buildReplayMa
4
4
  const J = 6e4, X = 200, G = 1e4, K = 24e6, L = /* @__PURE__ */ new Set([2, 3, 4]), Q = 2, V = 4;
5
5
  let v = null;
6
6
  function oe(e) {
7
- return v = e, x(), () => {
8
- v === e && (v = null, x());
7
+ return v = e, _(), () => {
8
+ v === e && (v = null, _());
9
9
  };
10
10
  }
11
11
  function ie() {
12
12
  return v;
13
13
  }
14
14
  function W(e) {
15
- return e.filter((o) => L.has(Number(o == null ? void 0 : o.type)));
15
+ return e.filter((a) => L.has(Number(a == null ? void 0 : a.type)));
16
16
  }
17
- function Z(e, o, r = J) {
18
- const n = JSON.stringify(o), c = Math.max(1, Math.ceil(n.length / r)), a = [];
19
- for (let s = 0; s < c; s++)
20
- a.push({ seq: e, part: s, parts: c, data: n.slice(s * r, (s + 1) * r) });
21
- return a;
17
+ function Z(e, a, r = J) {
18
+ const n = JSON.stringify(a), c = Math.max(1, Math.ceil(n.length / r)), o = [];
19
+ for (let u = 0; u < c; u++)
20
+ o.push({ seq: e, part: u, parts: c, data: n.slice(u * r, (u + 1) * r) });
21
+ return o;
22
22
  }
23
23
  function ae() {
24
24
  const e = /* @__PURE__ */ new Map();
25
- let o = -1, r = !0;
25
+ let a = -1, r = !0;
26
26
  return {
27
27
  /** Feed one part; returns the events to play now (maybe none) and whether a gap was seen. */
28
28
  push(n) {
29
29
  const c = { events: [], gap: !1, snapshot: !1 };
30
- if (!Number.isSafeInteger(n.seq) || n.seq <= o - 1e3) return c;
31
- let a = e.get(n.seq);
32
- if (a || (a = { parts: n.parts, got: /* @__PURE__ */ new Map() }, e.set(n.seq, a)), a.got.set(n.part, n.data), a.got.size < a.parts) {
33
- for (const i of [...e.keys()]) i < n.seq - 50 && e.delete(i);
30
+ if (!Number.isSafeInteger(n.seq) || n.seq <= a - 1e3) return c;
31
+ let o = e.get(n.seq);
32
+ if (o || (o = { parts: n.parts, got: /* @__PURE__ */ new Map() }, e.set(n.seq, o)), o.got.set(n.part, n.data), o.got.size < o.parts) {
33
+ for (const s of [...e.keys()]) s < n.seq - 50 && e.delete(s);
34
34
  return c;
35
35
  }
36
36
  e.delete(n.seq);
37
- let s;
37
+ let u;
38
38
  try {
39
- const i = Array.from({ length: a.parts }, (h, m) => (a == null ? void 0 : a.got.get(m)) ?? "").join(""), l = JSON.parse(i);
40
- s = Array.isArray(l) ? l : [];
39
+ const s = Array.from({ length: o.parts }, (S, m) => (o == null ? void 0 : o.got.get(m)) ?? "").join(""), i = JSON.parse(s);
40
+ u = Array.isArray(i) ? i : [];
41
41
  } catch {
42
- s = [];
42
+ u = [];
43
43
  }
44
- const u = o >= 0 && n.seq !== o + 1;
45
- n.seq > o && (o = n.seq), s = W(s);
46
- const f = s.findIndex((i) => Number(i.type) === Q);
47
- if (u && (r = !0), r) {
48
- if (f < 0) return { events: [], gap: u, snapshot: !1 };
44
+ const g = a >= 0 && n.seq !== a + 1;
45
+ n.seq > a && (a = n.seq), u = W(u);
46
+ const f = u.findIndex((s) => Number(s.type) === Q);
47
+ if (g && (r = !0), r) {
48
+ if (f < 0) return { events: [], gap: g, snapshot: !1 };
49
49
  r = !1;
50
- let i = -1;
51
- for (let l = f - 1; l >= 0; l--)
52
- if (Number(s[l].type) === V) {
53
- i = l;
50
+ let s = -1;
51
+ for (let i = f - 1; i >= 0; i--)
52
+ if (Number(u[i].type) === V) {
53
+ s = i;
54
54
  break;
55
55
  }
56
- return { events: s.slice(i >= 0 ? i : f), gap: u, snapshot: !0 };
56
+ return { events: u.slice(s >= 0 ? s : f), gap: g, snapshot: !0 };
57
57
  }
58
- return { events: s, gap: u, snapshot: f >= 0 };
58
+ return { events: u, gap: g, snapshot: f >= 0 };
59
59
  },
60
60
  reset() {
61
- e.clear(), o = -1, r = !0;
61
+ e.clear(), a = -1, r = !0;
62
62
  }
63
63
  };
64
64
  }
65
65
  let p = null;
66
- const b = /* @__PURE__ */ new Set();
67
- function x() {
68
- for (const e of b) e();
66
+ const T = /* @__PURE__ */ new Set();
67
+ function _() {
68
+ for (const e of T) e();
69
69
  }
70
- function A(e) {
71
- p = e, x();
70
+ function E(e) {
71
+ p = e, _();
72
72
  }
73
73
  function ee() {
74
74
  return p;
75
75
  }
76
76
  function F(e) {
77
- return b.add(e), () => {
78
- b.delete(e);
77
+ return T.add(e), () => {
78
+ T.delete(e);
79
79
  };
80
80
  }
81
81
  function ue() {
@@ -88,9 +88,9 @@ function ce() {
88
88
  () => !1
89
89
  );
90
90
  }
91
- let k = null;
91
+ let q = null;
92
92
  function le() {
93
- k == null || k.stop("stopped");
93
+ q == null || q.stop("stopped");
94
94
  }
95
95
  const R = {
96
96
  stopped: "You stopped sharing",
@@ -103,42 +103,42 @@ const R = {
103
103
  gone: "Sharing stopped"
104
104
  };
105
105
  async function fe(e) {
106
- const o = e.runtime ?? v;
107
- if (!o || k) return !1;
108
- const r = await o.loadRecord().catch(() => null);
106
+ const a = e.runtime ?? v;
107
+ if (!a || q) return !1;
108
+ const r = await a.loadRecord().catch(() => null);
109
109
  if (!r) return !1;
110
- const { share: n, transport: c } = e, a = e.now ?? Date.now, s = e.win === void 0 ? typeof window < "u" ? window : null : e.win, u = e.masking == null ? Y : z(e.masking);
111
- let f = !1, i = [], l = 0, h = [], m = 0, S = null, w = null, y = !1;
112
- const E = [], M = (t) => {
113
- !f || y || L.has(Number(t == null ? void 0 : t.type)) && i.push(t);
114
- }, N = () => {
115
- if (S = null, y) return;
116
- const t = h.shift();
117
- t && (m -= t.data.length, c.emit("screenshare:frame", { ticket: n.ticket, share: n.id, ...t }), S = setTimeout(N, Math.max(16, Math.round(t.data.length / 1e3))));
110
+ const { share: n, transport: c } = e, o = e.now ?? Date.now, u = e.win === void 0 ? typeof window < "u" ? window : null : e.win, g = e.masking == null ? Y : z(e.masking);
111
+ let f = !1, s = [], i = 0, S = [], m = 0, h = null, l = null, w = !1;
112
+ const k = [], x = (t) => {
113
+ !f || w || L.has(Number(t == null ? void 0 : t.type)) && s.push(t);
114
+ }, M = () => {
115
+ if (h = null, w) return;
116
+ const t = S.shift();
117
+ t && (m -= t.data.length, c.emit("screenshare:frame", { ticket: n.ticket, share: n.id, ...t }), h = setTimeout(M, Math.max(16, Math.round(t.data.length / 1e3))));
118
118
  }, I = () => {
119
- if (y || i.length === 0) return;
120
- const t = i;
121
- i = [];
122
- const d = Z(l++, t);
123
- for (const g of d)
124
- h.push(g), m += g.data.length;
125
- m > K && (h = [], m = 0), S || N();
126
- }, H = async () => {
119
+ if (w || s.length === 0) return;
120
+ const t = s;
121
+ s = [];
122
+ const d = Z(i++, t);
123
+ for (const y of d)
124
+ S.push(y), m += y.data.length;
125
+ m > K && (S = [], m = 0), h || M();
126
+ }, U = async () => {
127
127
  var t, d;
128
- if (!y) {
128
+ if (!w) {
129
129
  f = !0;
130
130
  try {
131
- const g = O();
132
- w ? (d = r.takeFullSnapshot) == null || d.call(r, !0) : g === "full" || g === "clip" ? (w = j(M), (t = r.takeFullSnapshot) == null || t.call(r, !0)) : w = r({ emit: M, ...B(() => u) }) ?? null;
131
+ const y = O();
132
+ l ? (d = r.takeFullSnapshot) == null || d.call(r, !0) : y === "full" || y === "clip" ? (l = j(x), (t = r.takeFullSnapshot) == null || t.call(r, !0)) : l = r({ emit: x, ...B(() => g) }) ?? null;
133
133
  } catch {
134
134
  }
135
135
  }
136
- }, q = (t, d) => {
137
- if (y) return;
138
- y = !0, f = !1, k = null, clearInterval(P), clearInterval(U), clearTimeout(C), S && clearTimeout(S), h = [], i = [];
139
- for (const D of E) D();
136
+ }, A = (t, d) => {
137
+ if (w) return;
138
+ w = !0, f = !1, q = null, clearInterval(C), clearInterval(H), clearTimeout(P), h && clearTimeout(h), S = [], s = [];
139
+ for (const D of k) D();
140
140
  try {
141
- w == null || w();
141
+ l == null || l();
142
142
  } catch {
143
143
  }
144
144
  if (t !== "ended")
@@ -149,68 +149,72 @@ async function fe(e) {
149
149
  });
150
150
  } catch {
151
151
  }
152
- A({ share: n, watching: [], ended: R[t === "ended" ? d ?? "gone" : t] ?? R.gone }), setTimeout(() => {
153
- (p == null ? void 0 : p.share.id) === n.id && p.ended && A(null);
152
+ E({ share: n, watching: [], ended: R[t === "ended" ? d ?? "gone" : t] ?? R.gone }), setTimeout(() => {
153
+ (p == null ? void 0 : p.share.id) === n.id && p.ended && E(null);
154
154
  }, 4e3);
155
- }, T = (t) => !!t && Number(t.ticket) === n.ticket && t.share === n.id;
156
- if (E.push(
155
+ }, b = (t) => !!t && Number(t.ticket) === n.ticket && t.share === n.id;
156
+ if (k.push(
157
157
  c.on("screenshare:snapshot", (t) => {
158
- T(t) && H();
158
+ b(t) && U();
159
159
  }),
160
160
  c.on("screenshare:watching", (t) => {
161
- if (!T(t)) return;
162
- const d = Array.isArray(t.names) ? t.names.filter((g) => typeof g == "string") : [];
163
- d.length === 0 && (f = !1), (p == null ? void 0 : p.share.id) === n.id && !p.ended && A({ ...p, watching: d });
161
+ if (!b(t)) return;
162
+ const d = Array.isArray(t.names) ? t.names.filter((y) => typeof y == "string") : [];
163
+ d.length === 0 && (f = !1), (p == null ? void 0 : p.share.id) === n.id && !p.ended && E({ ...p, watching: d });
164
164
  }),
165
165
  c.on("screenshare:ended", (t) => {
166
- T(t) && q("ended", typeof t.reason == "string" ? t.reason : void 0);
166
+ b(t) && A("ended", typeof t.reason == "string" ? t.reason : void 0);
167
167
  })
168
- ), s) {
168
+ ), u) {
169
169
  const t = (d) => {
170
- d.persisted || q("page");
170
+ d.persisted || A("page");
171
171
  };
172
- s.addEventListener("pagehide", t), E.push(() => s.removeEventListener("pagehide", t));
172
+ u.addEventListener("pagehide", t), k.push(() => u.removeEventListener("pagehide", t));
173
173
  }
174
- const _ = () => c.emit("screenshare:beat", { ticket: n.ticket, share: n.id }), P = setInterval(I, X), U = setInterval(_, G), C = setTimeout(() => q("expired"), Math.max(1e3, n.expires_at - a()));
175
- return k = { stop: q }, A({ share: n, watching: [], ended: null }), _(), !0;
174
+ const N = () => c.emit("screenshare:beat", { ticket: n.ticket, share: n.id }), C = setInterval(I, X), H = setInterval(N, G), P = setTimeout(() => A("expired"), Math.max(1e3, n.expires_at - o()));
175
+ return q = { stop: A }, E({ share: n, watching: [], ended: null }), N(), !0;
176
176
  }
177
177
  function te(e) {
178
178
  return /^Stopped sharing/i.test(e) ? null : /page closed/i.test(e) ? "ended when the page closed" : /30 minutes/i.test(e) ? "ended after 30 minutes" : /moved/i.test(e) ? "ended when the request moved" : /request closed/i.test(e) ? "ended when the request closed" : /restarted/i.test(e) ? "restarted" : "ended";
179
179
  }
180
- function he(e, o) {
180
+ function he(e, a) {
181
181
  if (e.action !== "support-traffic-view") return { text: e.text, showAuthor: !0 };
182
182
  const r = e.user_name ?? "Someone";
183
- if (o.isRequester)
183
+ if (a.isRequester)
184
184
  return { text: `${r} looked at your recent activity around this ticket`, showAuthor: !1 };
185
- const n = o.requesterName ? `${o.requesterName}'s` : "the requester’s";
185
+ const n = a.requesterName ? `${a.requesterName}'s` : "the requester’s";
186
186
  return { text: `${r} viewed ${n} activity around the ticket`, showAuthor: !1 };
187
187
  }
188
- function de(e) {
189
- var c, a;
190
- const o = [];
191
- let r = null;
192
- const n = (s, u, f) => {
193
- if (!r) return;
194
- const { to: i, watchers: l } = r, h = [
195
- f ? `Sharing their screen with ${i} now` : `Shared their screen with ${i}`
188
+ function de(e, a = {}) {
189
+ var g, f;
190
+ const r = [], n = a.requester ? String(a.requester).toUpperCase() : null, c = /* @__PURE__ */ new Set();
191
+ let o = null;
192
+ const u = (s, i, S) => {
193
+ if (!o) return;
194
+ const { to: m, watchers: h } = o, l = [
195
+ S ? `Sharing their screen with ${m} now` : `Shared their screen with ${m}`
196
196
  ];
197
- s && h.push(s);
198
- const m = l.length > 0 && l.every((S) => S === i);
199
- f ? h.push(l.length ? "watching now" : "not opened yet") : l.length === 0 ? h.push("not watched") : h.push(m ? "watched" : `watched by ${l.join(", ")}`), u && h.push(u), o[r.at] = { ...r.row, text: h.join(" · ") }, r = null;
197
+ s && l.push(s);
198
+ const w = h.length > 0 && h.every((k) => k === m);
199
+ S ? l.push(h.length ? "watching now" : "not opened yet") : h.length === 0 ? l.push("not watched") : l.push(w ? "watched" : `watched by ${h.join(", ")}`), i && l.push(i), r[o.at] = { ...o.row, text: l.join(" · ") }, o = null;
200
200
  };
201
201
  for (const s of e)
202
202
  if (s.action === "screen-share-start") {
203
- n(null, "restarted", !1);
204
- const u = ((c = /with (.+)$/.exec(s.text)) == null ? void 0 : c[1]) ?? "support";
205
- r = { at: o.length, row: s, to: u, watchers: [] }, o.push(s);
206
- } else if (s.action === "screen-share-watch" && r) {
207
- const u = s.user_name ?? "someone";
208
- r.watchers.includes(u) || r.watchers.push(u);
209
- } else if (s.action === "screen-share-stop" && r) {
210
- const u = ((a = /\(([^)]+)\)\s*$/.exec(s.text)) == null ? void 0 : a[1]) ?? null;
211
- n(u, te(s.text), !1);
212
- } else o.push(s);
213
- return n(null, null, !0), o;
203
+ u(null, "restarted", !1);
204
+ const i = ((g = /with (.+)$/.exec(s.text)) == null ? void 0 : g[1]) ?? "support";
205
+ o = { at: r.length, row: s, to: i, watchers: [] }, r.push(s);
206
+ } else if (s.action === "screen-share-watch" && o) {
207
+ const i = s.user_name ?? "someone";
208
+ o.watchers.includes(i) || o.watchers.push(i);
209
+ } else if (s.action === "screen-share-stop" && o) {
210
+ const i = ((f = /\(([^)]+)\)\s*$/.exec(s.text)) == null ? void 0 : f[1]) ?? null;
211
+ u(i, te(s.text), !1);
212
+ } else if (s.action === "support-traffic-view") {
213
+ const i = String(s.user ?? s.user_name ?? "").toUpperCase();
214
+ if (n && i === n || i && c.has(i)) continue;
215
+ i && c.add(i), r.push(s);
216
+ } else r.push(s);
217
+ return u(null, null, !0), r;
214
218
  }
215
219
  export {
216
220
  G as BEAT_MS,
@@ -1,24 +1,31 @@
1
- import { describeError as S } from "./error-message.js";
2
- import { partnerWords as N, partnerOutcome as C, partnerSaid as A } from "./partner-failure.js";
3
- import { getDisplayTimezone as R } from "./utils.js";
4
- function q(t, e = Date.now()) {
1
+ import { describeError as R } from "./error-message.js";
2
+ import { partnerWords as k, partnerOutcome as I, partnerSaid as U } from "./partner-failure.js";
3
+ import { getDisplayTimezone as v } from "./utils.js";
4
+ const T = "Integrations at the top of the record";
5
+ function A(t, e = Date.now()) {
5
6
  const n = t instanceof Date ? t : new Date(t);
6
7
  if (Number.isNaN(n.getTime())) return "";
7
- const r = R(), a = r ? { timeZone: r } : {}, o = (u) => new Intl.DateTimeFormat("en-US", {
8
- ...a,
8
+ const r = v(), o = r ? { timeZone: r } : {}, i = (c) => new Intl.DateTimeFormat("en-US", {
9
+ ...o,
9
10
  year: "numeric",
10
11
  month: "numeric",
11
12
  day: "numeric"
12
- }).format(u), c = new Intl.DateTimeFormat("en-US", {
13
- ...a,
13
+ }).format(c), u = new Intl.DateTimeFormat("en-US", {
14
+ ...o,
14
15
  hour: "numeric",
15
16
  minute: "2-digit"
16
17
  }).format(n);
17
- return o(n) === o(new Date(e)) ? c : `${new Intl.DateTimeFormat("en-US", { ...a, month: "short", day: "numeric" }).format(
18
+ return i(n) === i(new Date(e)) ? u : `${new Intl.DateTimeFormat("en-US", { ...o, month: "short", day: "numeric" }).format(
18
19
  n
19
- )}, ${c}`;
20
+ )}, ${u}`;
20
21
  }
21
- function w(t) {
22
+ function L(t, e = Date.now()) {
23
+ const n = A(t, e);
24
+ if (!n) return "";
25
+ const r = /^(.+), (\d{1,2}:\d{2}\s?[AP]M)$/.exec(n);
26
+ return r ? `on ${r[1]} at ${r[2]}` : `at ${n}`;
27
+ }
28
+ function f(t) {
22
29
  if (!Number.isFinite(t) || t < 6e4) return "less than a minute";
23
30
  const e = Math.round(t / 6e4);
24
31
  if (e < 60) return `${e} minute${e === 1 ? "" : "s"}`;
@@ -27,106 +34,115 @@ function w(t) {
27
34
  const r = Math.round(t / 864e5);
28
35
  return `${r} day${r === 1 ? "" : "s"}`;
29
36
  }
30
- function M(t) {
37
+ function z(t) {
31
38
  const e = (t ?? "").trim();
32
39
  if (!e) return { text: "", quoted: !1 };
33
- const n = /\bHTTP \d{3}: /.exec(e), r = N(n ? e.slice(n.index) : e);
34
- return r ? { text: r.replace(/[\s.,;:]+$/, ""), quoted: !0 } : { text: D(e), quoted: !1 };
40
+ const n = /\bHTTP \d{3}: /.exec(e), r = k(n ? e.slice(n.index) : e);
41
+ return r ? { text: F(r).replace(/[\s.,;:]+$/, ""), quoted: !0 } : { text: S(e), quoted: !1 };
42
+ }
43
+ function F(t) {
44
+ const e = t.replace(
45
+ /(^|[.!]\s*)(please\s+)?contact\s+(support|(the\s+)?help\s*desk|your\s+(system\s+)?administrator|an?\s+administrator)[^.!]*[.!]?\s*$/i,
46
+ "$1"
47
+ );
48
+ return e.trim() ? e.trim() : t;
35
49
  }
36
- function D(t) {
50
+ function S(t) {
37
51
  const e = (t ?? "").trim();
38
52
  if (!e) return "";
39
- const n = /\bHTTP \d{3}: /.exec(e), r = N(n ? e.slice(n.index) : e) ?? C(e) ?? A(e);
40
- return r ? r.replace(/[\s.,;:]+$/, "") : S({ message: e }, "").title.replace(/[\s.,;:]+$/, "");
53
+ const n = /\bHTTP \d{3}: /.exec(e), r = k(n ? e.slice(n.index) : e) ?? I(e) ?? U(e);
54
+ return r ? F(r).replace(/[\s.,;:]+$/, "") : R({ message: e }, "").title.replace(/[\s.,;:]+$/, "");
41
55
  }
42
- const U = /* @__PURE__ */ new Set(["transient", "rate_limited"]);
43
- function E(t, e = {}) {
44
- var g, b, x, _;
45
- const n = e.now ?? Date.now(), r = e.time ?? ((s) => q(s, n));
56
+ const E = /* @__PURE__ */ new Set(["transient", "rate_limited"]);
57
+ function j(t, e = {}) {
58
+ var _, p, x, N;
59
+ const n = e.now ?? Date.now(), r = e.time ?? ((s) => A(s, n)), o = (s) => e.time ? `at ${e.time(s)}` : L(s, n);
46
60
  e.reason;
47
- const a = ((g = t.api) == null ? void 0 : g.trim()) || "the other system", o = (t.status ?? "").toLowerCase(), c = t.finished_at ?? t.started_at;
48
- if (o === "sending") {
61
+ const i = ((_ = t.api) == null ? void 0 : _.trim()) || "the other system", u = (t.status ?? "").toLowerCase(), d = t.finished_at ?? t.started_at;
62
+ if (u === "sending") {
49
63
  const s = t.answer_by ? new Date(t.answer_by).getTime() : Number.NaN;
50
64
  return Number.isFinite(s) && n > s ? {
51
65
  state: "no_answer",
52
66
  tone: "held",
53
- text: `No answer from ${a} after ${w(n - new Date(t.started_at).getTime())} — the send is held and will not be repeated automatically`
67
+ text: `No answer from ${i} after ${f(n - new Date(t.started_at).getTime())} — the send is held and will not be repeated automatically. An administrator can mark it received or not received.`
54
68
  } : {
55
69
  state: "sending",
56
70
  tone: "busy",
57
- text: `Sending to ${a} now (started ${r(t.started_at)})`
71
+ text: `Sending to ${i} now (started ${r(t.started_at)})`
58
72
  };
59
73
  }
60
- if (o === "pending") {
61
- const s = t.usual_answer_ms != null && t.usual_answer_ms > 0 ? ` · usually answers within ${w(t.usual_answer_ms)}` : "";
74
+ if (u === "pending") {
75
+ const s = t.usual_answer_ms != null && t.usual_answer_ms > 0 ? ` · usually answers within ${f(t.usual_answer_ms)}` : "";
62
76
  return {
63
77
  state: "waiting",
64
78
  tone: "waiting",
65
- text: `Sent to ${a} at ${r(t.started_at)} — waiting for ${a}'s answer${s}`
79
+ text: `Sent to ${i} ${o(t.started_at)} — waiting for ${i}'s answer${s}`
66
80
  };
67
81
  }
68
- if (o === "accepted") {
69
- const s = (b = t.external_ref) == null ? void 0 : b.trim(), $ = ((x = t.ref_label) == null ? void 0 : x.trim()) || "reference";
82
+ if (u === "accepted") {
83
+ const s = (p = t.external_ref) == null ? void 0 : p.trim(), h = ((x = t.ref_label) == null ? void 0 : x.trim()) || "reference";
70
84
  return {
71
85
  state: "accepted",
72
86
  tone: "ok",
73
- text: `${a} accepted it at ${r(c)}${s ? ` — ${$} ${s}` : ""}`
87
+ text: `${i} accepted it ${o(d)}${s ? ` — ${h} ${s}` : ""}`
74
88
  };
75
89
  }
76
- const d = (t.error_class ?? "").toLowerCase(), u = e.reason ? { text: e.reason(t.reason), quoted: !1 } : M(t.reason), i = t.retry && t.retry.at ? t.retry : null, h = i ? new Date(i.at).getTime() : Number.NaN, m = i ? `${Number.isFinite(h) && h > n ? `Retrying at ${r(i.at)}` : "Retrying now"} (attempt ${i.attempt} of ${i.of})` : "", y = (_ = t.no_retry) == null ? void 0 : _.trim(), l = (s) => i ? { retry_at: i.at } : s && y ? { detail: `It won't be sent again automatically — ${y}.` } : {};
77
- if (U.has(d)) {
78
- const $ = d === "rate_limited" ? `${a} was too busy to take it at ${r(c)} — nothing was sent.` : `Couldn't reach ${a} — nothing was sent.`, p = !i && t.can_resend === !0, F = i ? ` ${m}` : p ? "" : " Ask an admin to send it again.";
90
+ const c = (t.error_class ?? "").toLowerCase(), m = e.reason ? { text: e.reason(t.reason), quoted: !1 } : z(t.reason), a = t.retry && t.retry.at ? t.retry : null, y = a ? new Date(a.at).getTime() : Number.NaN, $ = a ? `${Number.isFinite(y) && y > n ? `Retrying at ${r(a.at)}` : "Retrying now"} (attempt ${a.attempt} of ${a.of})` : "", g = (N = t.no_retry) == null ? void 0 : N.trim(), w = (s) => a ? { retry_at: a.at } : s && g ? { detail: `It won't be sent again automatically — ${g}.` } : {};
91
+ if (E.has(c)) {
92
+ const h = c === "rate_limited" ? `${i} was too busy to take it ${o(d)} — nothing was sent.` : `Couldn't reach ${i} — nothing was sent.`, D = !a && t.can_resend === !0, M = a ? ` ${$}` : D ? "" : " Ask an admin to send it again.";
79
93
  return {
80
94
  state: "not_taken",
81
- tone: i ? "waiting" : "problem",
82
- text: `${$}${F}`,
83
- ...p ? { resend: !0 } : {},
84
- ...l(!0)
95
+ tone: a ? "waiting" : "problem",
96
+ text: `${h}${M}`,
97
+ ...D ? { resend: !0 } : {},
98
+ ...w(!0)
85
99
  };
86
100
  }
87
- const f = `${a} refused it at ${r(c)}`;
88
- if (d === "auth")
101
+ const b = `${i} refused it ${o(d)}`;
102
+ if (c === "auth")
89
103
  return {
90
104
  state: "refused",
91
- tone: i ? "waiting" : "problem",
92
- text: `${f}: it did not accept this app's sign-in. ${i ? m : `An administrator needs to check the connection to ${a}.`}`,
93
- ...l(!0)
105
+ tone: a ? "waiting" : "problem",
106
+ text: `${b}: it did not accept this app's sign-in. ${a ? $ : `An administrator needs to check the connection to ${i}.`}`,
107
+ ...w(!0)
94
108
  };
95
- const T = u.text ? u.quoted ? `: “${u.text}.”` : `: ${u.text}.` : ".", k = o === "rejected" || ["validation", "not_found"].includes(d);
109
+ const l = !m.quoted && /^The other system refused the request\.?$/.test(m.text) ? "" : m.text, C = l ? m.quoted ? `: “${l}.”` : `: ${l}.` : " without giving a reason.", q = u === "rejected" || ["validation", "not_found"].includes(c);
96
110
  return {
97
111
  state: "refused",
98
- tone: i ? "waiting" : "problem",
99
- text: `${f}${T} ${i ? m : u.text ? "Change that on the record, then send it again." : "Check the record, then send it again."}`,
112
+ tone: a ? "waiting" : "problem",
113
+ text: `${b}${C} ${a ? $ : l ? `Change that on the record, then send it again from ${T}.` : `Check the record, then send it again from ${T}.`}`,
100
114
  // "Repeating it cannot fix it" is already what the next step says.
101
- ...l(!k)
115
+ ...w(!q)
102
116
  };
103
117
  }
104
- function H(t, e = Date.now()) {
118
+ function G(t, e = Date.now()) {
105
119
  if (!t) return null;
106
120
  const n = new Date(t).getTime();
107
121
  if (!Number.isFinite(n) || n <= e) return null;
108
122
  const r = Math.ceil((n - e) / 6e4);
109
- return r < 60 ? `in ${r} minute${r === 1 ? "" : "s"}` : `in ${w(n - e)}`;
123
+ return r < 60 ? `in ${r} minute${r === 1 ? "" : "s"}` : `in ${f(n - e)}`;
110
124
  }
111
- function O(t, e = Date.now()) {
112
- var a;
113
- const n = (a = t.retry) != null && a.at ? new Date(t.retry.at).getTime() : Number.NaN;
125
+ function K(t, e = Date.now()) {
126
+ var o;
127
+ const n = (o = t.retry) != null && o.at ? new Date(t.retry.at).getTime() : Number.NaN;
114
128
  if (!Number.isFinite(n) || n <= e) return null;
115
129
  const r = n - e;
116
130
  return Math.min(r, (r - 1) % 6e4 + 1) + 250;
117
131
  }
118
- function P(t, e = Date.now()) {
132
+ function Z(t, e = Date.now()) {
119
133
  if ((t.status ?? "").toLowerCase() !== "sending" || !t.answer_by) return null;
120
134
  const n = new Date(t.answer_by).getTime();
121
135
  return !Number.isFinite(n) || n < e ? null : n - e + 500;
122
136
  }
123
137
  export {
124
- q as atClock,
125
- P as msUntilNoAnswer,
126
- O as msUntilRetryTick,
127
- w as plainDuration,
128
- D as plainSendReason,
129
- H as retryCountdown,
130
- M as sendReason,
131
- E as sendStatusWords
138
+ A as atClock,
139
+ L as atWhen,
140
+ Z as msUntilNoAnswer,
141
+ K as msUntilRetryTick,
142
+ f as plainDuration,
143
+ S as plainSendReason,
144
+ G as retryCountdown,
145
+ z as sendReason,
146
+ j as sendStatusWords,
147
+ F as withoutContactLine
132
148
  };
@@ -0,0 +1,29 @@
1
+ function a(n, t) {
2
+ if (t <= 0) return 0;
3
+ const l = n.lastIndexOf(" ", t);
4
+ return l > 0 && t - l <= 12 ? l + 1 : t;
5
+ }
6
+ function $(n, t) {
7
+ if (t >= n.length) return n.length;
8
+ const l = n.indexOf(" ", t);
9
+ return l >= 0 && l - t <= 12 ? l : t;
10
+ }
11
+ function p(n, t, { max: l = 60, context: r = 20 } = {}) {
12
+ if (n.length <= l && t.length <= l) return { before: n, after: t, trimmed: !1 };
13
+ let e = 0;
14
+ const u = Math.min(n.length, t.length);
15
+ for (; e < u && n[e] === t[e]; ) e++;
16
+ let c = 0;
17
+ for (; c < u - e && n[n.length - 1 - c] === t[t.length - 1 - c]; )
18
+ c++;
19
+ const d = (h) => {
20
+ const m = Math.max(0, e - r), w = Math.min(h.length, h.length - c + r), g = a(h, m), o = $(h, w);
21
+ let i = h.slice(g, o);
22
+ const s = l + r * 2;
23
+ return i.length > s && (i = `${i.slice(0, s - 20)}…${i.slice(-19)}`), `${g > 0 ? "…" : ""}${i.trim()}${o < h.length ? "…" : ""}`;
24
+ };
25
+ return { before: d(n), after: d(t), trimmed: !0 };
26
+ }
27
+ export {
28
+ p as diffWindow
29
+ };
@@ -0,0 +1,17 @@
1
+ import { useQueryClient as n, hashKey as o } from "@tanstack/react-query";
2
+ import { useCallback as y, useSyncExternalStore as h } from "react";
3
+ function f(u) {
4
+ const t = n(), r = o(u), c = y(
5
+ (e) => t.getQueryCache().subscribe((a) => {
6
+ a.query.queryHash === r && e();
7
+ }),
8
+ [t, r]
9
+ ), s = () => {
10
+ var e;
11
+ return (e = t.getQueryCache().get(r)) == null ? void 0 : e.state;
12
+ };
13
+ return h(c, s, s);
14
+ }
15
+ export {
16
+ f as useQueryEntryState
17
+ };