@remit/ui 0.0.165 → 0.0.167
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/compose-quote-missing-banner.tsx +36 -0
- package/src/components/intelligence-panel.stories.tsx +21 -0
- package/src/components/intelligence-panel.tsx +26 -5
- package/src/components/selection-wizard.render.test.ts +32 -0
- package/src/components/selection-wizard.tsx +28 -12
- package/src/components/self-update-section.tsx +51 -16
- package/src/components/self-update.render.test.ts +14 -0
- package/src/index.ts +14 -0
- package/src/lib/semantic-off.ts +20 -0
package/package.json
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Banner } from "./banner.js";
|
|
2
|
+
|
|
3
|
+
/** Which of the two composers is looking at a source it cannot quote. */
|
|
4
|
+
export type ComposeQuoteMode = "reply" | "forward";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The source has no text or html part — it is attachments and nothing else.
|
|
8
|
+
*
|
|
9
|
+
* A forward of one has nothing of the original to carry: the composer sends a
|
|
10
|
+
* text body and an html body, and no attachments, so the message would arrive
|
|
11
|
+
* holding only what the sender typed. Send refuses with these words. A reply
|
|
12
|
+
* still carries the answer and the thread it belongs to, so it goes out and
|
|
13
|
+
* these words say the original is not quoted in it. See #1030.
|
|
14
|
+
*/
|
|
15
|
+
export const NO_QUOTABLE_BODY_FORWARD_MESSAGE =
|
|
16
|
+
"This message is attachments only, and attachments aren't forwarded — a forward would arrive with nothing of the original in it.";
|
|
17
|
+
|
|
18
|
+
export const NO_QUOTABLE_BODY_REPLY_MESSAGE =
|
|
19
|
+
"This message is attachments only, so there's nothing to quote and your reply goes out without the original.";
|
|
20
|
+
|
|
21
|
+
export const composeQuoteMissingMessage = (mode: ComposeQuoteMode): string =>
|
|
22
|
+
mode === "forward"
|
|
23
|
+
? NO_QUOTABLE_BODY_FORWARD_MESSAGE
|
|
24
|
+
: NO_QUOTABLE_BODY_REPLY_MESSAGE;
|
|
25
|
+
|
|
26
|
+
export interface ComposeQuoteMissingBannerProps {
|
|
27
|
+
mode: ComposeQuoteMode;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const ComposeQuoteMissingBanner = ({
|
|
31
|
+
mode,
|
|
32
|
+
}: ComposeQuoteMissingBannerProps) => (
|
|
33
|
+
<Banner tone="warning" data-testid="compose-quote-missing">
|
|
34
|
+
<span>{composeQuoteMissingMessage(mode)}</span>
|
|
35
|
+
</Banner>
|
|
36
|
+
);
|
|
@@ -201,6 +201,27 @@ export const WithSimilarMessages: Story = {
|
|
|
201
201
|
},
|
|
202
202
|
};
|
|
203
203
|
|
|
204
|
+
/**
|
|
205
|
+
* Semantic search is off on this instance (#1068). The section states the
|
|
206
|
+
* setting, what turning it on buys — the Organize widen and semantic filters —
|
|
207
|
+
* and the command, rather than rendering nothing and reading as a sender
|
|
208
|
+
* nothing resembles.
|
|
209
|
+
*/
|
|
210
|
+
export const SimilarMessagesOff: Story = {
|
|
211
|
+
args: {
|
|
212
|
+
data: base,
|
|
213
|
+
similarState: "off",
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
/** The runtime failure, for contrast: a retry might work, so it says no more. */
|
|
218
|
+
export const SimilarMessagesUnavailable: Story = {
|
|
219
|
+
args: {
|
|
220
|
+
data: base,
|
|
221
|
+
similarState: "error",
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
|
|
204
225
|
/**
|
|
205
226
|
* The spam quick actions are a contextual pair, decided by whether the message
|
|
206
227
|
* carries a spam report — never by the mailbox it happens to sit in, since a
|
|
@@ -12,6 +12,11 @@ import {
|
|
|
12
12
|
} from "lucide-react";
|
|
13
13
|
import { type ReactElement, type ReactNode, useId, useState } from "react";
|
|
14
14
|
import { cn } from "../lib/cn.js";
|
|
15
|
+
import {
|
|
16
|
+
SEMANTIC_OFF_BUYS,
|
|
17
|
+
SEMANTIC_OFF_COMMAND,
|
|
18
|
+
SEMANTIC_OFF_TITLE,
|
|
19
|
+
} from "../lib/semantic-off.js";
|
|
15
20
|
import { categoryTone, type ThreadCategory } from "./app-shell-types.js";
|
|
16
21
|
import { Avatar } from "./avatar.js";
|
|
17
22
|
import { Badge } from "./badge.js";
|
|
@@ -165,12 +170,16 @@ export interface IntelligenceQuickActions {
|
|
|
165
170
|
}
|
|
166
171
|
|
|
167
172
|
/**
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
173
|
+
* State of the similar-messages section. The host computes these from the
|
|
174
|
+
* semantic-search query so the panel can show a skeleton while in flight and
|
|
175
|
+
* "similarity search unavailable" on failure (the rest of the sidebar still
|
|
176
|
+
* renders). Defaults to "ready" when omitted.
|
|
177
|
+
*
|
|
178
|
+
* "off" is not a failure and not a slow query: this instance stores no message
|
|
179
|
+
* vectors, and it says so with the command that changes it. Without it the
|
|
180
|
+
* section renders nothing at all, which reads as a sender nothing resembles.
|
|
172
181
|
*/
|
|
173
|
-
export type SimilarState = "loading" | "error" | "ready";
|
|
182
|
+
export type SimilarState = "loading" | "error" | "off" | "ready";
|
|
174
183
|
|
|
175
184
|
/**
|
|
176
185
|
* The two halves of the panel. Sender is what this message is; Calendar is what
|
|
@@ -574,6 +583,18 @@ export function IntelligencePanel({
|
|
|
574
583
|
<p className="text-xs text-fg-subtle">
|
|
575
584
|
Similarity search unavailable
|
|
576
585
|
</p>
|
|
586
|
+
) : similarState === "off" ? (
|
|
587
|
+
<div className="space-y-1.5 text-xs text-fg-subtle">
|
|
588
|
+
<p className="text-fg-muted">{SEMANTIC_OFF_TITLE}</p>
|
|
589
|
+
<p>{SEMANTIC_OFF_BUYS}</p>
|
|
590
|
+
<p>
|
|
591
|
+
Run{" "}
|
|
592
|
+
<code className="rounded bg-surface-sunken px-1 py-px text-2xs text-fg-muted">
|
|
593
|
+
{SEMANTIC_OFF_COMMAND}
|
|
594
|
+
</code>{" "}
|
|
595
|
+
on the server.
|
|
596
|
+
</p>
|
|
597
|
+
</div>
|
|
577
598
|
) : (
|
|
578
599
|
<ul className="-mx-1 space-y-1">
|
|
579
600
|
{similar.map((s) => {
|
|
@@ -266,6 +266,38 @@ describe("MatchStepBody", () => {
|
|
|
266
266
|
assert.match(html, /matching on the\s+senders instead/);
|
|
267
267
|
});
|
|
268
268
|
|
|
269
|
+
// Off is a property of the deployment, so the door says what an operator can
|
|
270
|
+
// do about it rather than "unavailable right now", which invites a retry that
|
|
271
|
+
// cannot succeed (#1068).
|
|
272
|
+
it("names the setting and the command when semantic search is off", () => {
|
|
273
|
+
const html = renderToString(
|
|
274
|
+
createElement(MatchStepBody, {
|
|
275
|
+
...matchProps,
|
|
276
|
+
semanticOff: true,
|
|
277
|
+
}),
|
|
278
|
+
);
|
|
279
|
+
assert.match(html, /opacity-55/);
|
|
280
|
+
assert.doesNotMatch(html, /disabled=""/);
|
|
281
|
+
assert.match(text(html), /Semantic search is off on this instance/);
|
|
282
|
+
assert.match(text(html), /remit semantic on/);
|
|
283
|
+
assert.doesNotMatch(text(html), /unavailable right now/);
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
it("supersedes the runtime failure copy, which would tell the user to retry", () => {
|
|
287
|
+
const html = renderToString(
|
|
288
|
+
createElement(MatchStepBody, {
|
|
289
|
+
...matchProps,
|
|
290
|
+
semanticOff: true,
|
|
291
|
+
semanticUnavailable: true,
|
|
292
|
+
semanticErrorDetail: "no vector index",
|
|
293
|
+
semanticFallbackTaken: true,
|
|
294
|
+
}),
|
|
295
|
+
);
|
|
296
|
+
assert.doesNotMatch(text(html), /no vector index/);
|
|
297
|
+
assert.match(text(html), /Semantic search is off on this instance/);
|
|
298
|
+
assert.match(text(html), /Matching on the senders instead/);
|
|
299
|
+
});
|
|
300
|
+
|
|
269
301
|
it("names what an escalated predicate covers instead of offering doors", () => {
|
|
270
302
|
const html = renderToString(
|
|
271
303
|
createElement(MatchStepBody, {
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
} from "lucide-react";
|
|
20
20
|
import { Fragment, type ReactNode, useEffect, useId, useRef } from "react";
|
|
21
21
|
import { cn } from "../lib/cn.js";
|
|
22
|
+
import { semanticOffReason } from "../lib/semantic-off.js";
|
|
22
23
|
import {
|
|
23
24
|
backExits,
|
|
24
25
|
crossAccountMatchReason,
|
|
@@ -384,6 +385,12 @@ export interface MatchStepProps {
|
|
|
384
385
|
* of the deployment: the door stays pressable and dimmed.
|
|
385
386
|
*/
|
|
386
387
|
semanticUnavailable?: boolean;
|
|
388
|
+
/**
|
|
389
|
+
* Semantic search is off on this instance (#1068) — a deployment setting, so
|
|
390
|
+
* the door is dimmed for a reason an operator can act on rather than a
|
|
391
|
+
* failure the user should retry. It supersedes the runtime copy above.
|
|
392
|
+
*/
|
|
393
|
+
semanticOff?: boolean;
|
|
387
394
|
/**
|
|
388
395
|
* What the mail server said when the widen was asked to run and failed. A
|
|
389
396
|
* failure is a reason the door cannot run, so it dims the door like any other
|
|
@@ -408,6 +415,7 @@ export function MatchStepBody({
|
|
|
408
415
|
accountId,
|
|
409
416
|
onModeChange,
|
|
410
417
|
semanticUnavailable,
|
|
418
|
+
semanticOff,
|
|
411
419
|
semanticErrorDetail,
|
|
412
420
|
semanticFallbackTaken,
|
|
413
421
|
onSemanticFallback,
|
|
@@ -431,6 +439,7 @@ export function MatchStepBody({
|
|
|
431
439
|
}
|
|
432
440
|
const doors = matchDoorsFor(accountId);
|
|
433
441
|
const widened = doors.length > 1;
|
|
442
|
+
const widenBlocked = semanticOff || semanticUnavailable;
|
|
434
443
|
return (
|
|
435
444
|
<>
|
|
436
445
|
<div className="space-y-2">
|
|
@@ -448,25 +457,32 @@ export function MatchStepBody({
|
|
|
448
457
|
{widened && (
|
|
449
458
|
<ChoiceCard
|
|
450
459
|
selected={mode === "similar"}
|
|
451
|
-
unavailable={
|
|
460
|
+
unavailable={widenBlocked}
|
|
452
461
|
onSelect={
|
|
453
|
-
|
|
454
|
-
? onSemanticFallback
|
|
455
|
-
: () => onModeChange("similar")
|
|
462
|
+
widenBlocked ? onSemanticFallback : () => onModeChange("similar")
|
|
456
463
|
}
|
|
457
464
|
title={matchDoorLabel("similar", selectedCount)}
|
|
458
465
|
description={matchDoorHint("similar")}
|
|
459
466
|
>
|
|
460
|
-
{
|
|
461
|
-
<p role="status" className="px-1 text-2xs text-danger">
|
|
462
|
-
Couldn't find similar messages: {semanticErrorDetail}
|
|
463
|
-
</p>
|
|
464
|
-
)}
|
|
465
|
-
{semanticFallbackTaken && (
|
|
467
|
+
{semanticOff ? (
|
|
466
468
|
<p role="status" className="px-1 text-2xs text-fg-subtle">
|
|
467
|
-
|
|
468
|
-
senders instead.
|
|
469
|
+
{semanticOffReason}
|
|
470
|
+
{semanticFallbackTaken && " Matching on the senders instead."}
|
|
469
471
|
</p>
|
|
472
|
+
) : (
|
|
473
|
+
<>
|
|
474
|
+
{semanticErrorDetail && (
|
|
475
|
+
<p role="status" className="px-1 text-2xs text-danger">
|
|
476
|
+
Couldn't find similar messages: {semanticErrorDetail}
|
|
477
|
+
</p>
|
|
478
|
+
)}
|
|
479
|
+
{semanticFallbackTaken && (
|
|
480
|
+
<p role="status" className="px-1 text-2xs text-fg-subtle">
|
|
481
|
+
Similar-mail matching is unavailable right now — matching on
|
|
482
|
+
the senders instead.
|
|
483
|
+
</p>
|
|
484
|
+
)}
|
|
485
|
+
</>
|
|
470
486
|
)}
|
|
471
487
|
</ChoiceCard>
|
|
472
488
|
)}
|
|
@@ -82,6 +82,16 @@ export function SelfUpdateSection({
|
|
|
82
82
|
onCheck();
|
|
83
83
|
};
|
|
84
84
|
|
|
85
|
+
// The pane renders one state at a time, and an undismissed run outcome wins
|
|
86
|
+
// over any check in flight — so a check pressed from the success row would
|
|
87
|
+
// leave the screen unchanged and surface its verdict, right or wrong, only
|
|
88
|
+
// once the banner was dismissed. Retiring the outcome is what makes the
|
|
89
|
+
// press visible, and pressing it is the acknowledgement that retires it.
|
|
90
|
+
const handleCheckAfterResult = () => {
|
|
91
|
+
onDismissResult();
|
|
92
|
+
handleCheck();
|
|
93
|
+
};
|
|
94
|
+
|
|
85
95
|
const handleInstall = () => {
|
|
86
96
|
if (
|
|
87
97
|
!installable &&
|
|
@@ -281,23 +291,48 @@ export function SelfUpdateSection({
|
|
|
281
291
|
|
|
282
292
|
case "succeeded":
|
|
283
293
|
return (
|
|
284
|
-
|
|
285
|
-
<
|
|
286
|
-
<
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
+
<>
|
|
295
|
+
<Banner tone="success" onDismiss={onDismissResult}>
|
|
296
|
+
<div className="space-y-1">
|
|
297
|
+
<p className="font-semibold">
|
|
298
|
+
Updated to Remit {state.version}.
|
|
299
|
+
</p>
|
|
300
|
+
<p>
|
|
301
|
+
You were on {state.previousVersion}.{" "}
|
|
302
|
+
<a
|
|
303
|
+
href={state.releaseNotesUrl}
|
|
304
|
+
target="_blank"
|
|
305
|
+
rel="noopener noreferrer"
|
|
306
|
+
className="underline"
|
|
307
|
+
>
|
|
308
|
+
See what changed
|
|
309
|
+
</a>
|
|
310
|
+
.
|
|
311
|
+
</p>
|
|
312
|
+
</div>
|
|
313
|
+
</Banner>
|
|
314
|
+
<SectionRow>
|
|
315
|
+
<div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
|
316
|
+
<div className="flex min-w-0 items-center gap-2">
|
|
317
|
+
<CheckCircle2
|
|
318
|
+
className="size-4 shrink-0 text-positive"
|
|
319
|
+
aria-hidden
|
|
320
|
+
/>
|
|
321
|
+
<p className="text-sm text-fg">
|
|
322
|
+
Remit {state.version} is running.
|
|
323
|
+
</p>
|
|
324
|
+
</div>
|
|
325
|
+
<Button
|
|
326
|
+
variant="secondary"
|
|
327
|
+
size="sm"
|
|
328
|
+
className="shrink-0"
|
|
329
|
+
onClick={handleCheckAfterResult}
|
|
294
330
|
>
|
|
295
|
-
|
|
296
|
-
</
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
</Banner>
|
|
331
|
+
Check for updates
|
|
332
|
+
</Button>
|
|
333
|
+
</div>
|
|
334
|
+
</SectionRow>
|
|
335
|
+
</>
|
|
301
336
|
);
|
|
302
337
|
|
|
303
338
|
case "rolledBack":
|
|
@@ -204,6 +204,20 @@ describe("SelfUpdateSection", () => {
|
|
|
204
204
|
assert.doesNotMatch(html, /running 0\.9\.3 again/);
|
|
205
205
|
});
|
|
206
206
|
|
|
207
|
+
it("keeps the pane's control reachable while the success banner is up", () => {
|
|
208
|
+
const html = section({
|
|
209
|
+
status: "succeeded",
|
|
210
|
+
runId: demoRunId,
|
|
211
|
+
version: "0.9.4",
|
|
212
|
+
previousVersion: CURRENT,
|
|
213
|
+
releaseNotesUrl: demoRelease.releaseNotesUrl,
|
|
214
|
+
});
|
|
215
|
+
assert.match(html, /Updated to Remit 0\.9\.4/);
|
|
216
|
+
assert.match(html, /0\.9\.4 is running/);
|
|
217
|
+
assert.match(html, /Check for updates/);
|
|
218
|
+
assert.doesNotMatch(html, /disabled=/);
|
|
219
|
+
});
|
|
220
|
+
|
|
207
221
|
it("renders an abandoned run as a no-op that changed nothing", () => {
|
|
208
222
|
const html = section({
|
|
209
223
|
status: "abandoned",
|
package/src/index.ts
CHANGED
|
@@ -258,6 +258,14 @@ export {
|
|
|
258
258
|
ComposeLanguageSetting,
|
|
259
259
|
type ComposeLanguageSettingProps,
|
|
260
260
|
} from "./components/compose-language-setting.js";
|
|
261
|
+
export {
|
|
262
|
+
ComposeQuoteMissingBanner,
|
|
263
|
+
type ComposeQuoteMissingBannerProps,
|
|
264
|
+
type ComposeQuoteMode,
|
|
265
|
+
composeQuoteMissingMessage,
|
|
266
|
+
NO_QUOTABLE_BODY_FORWARD_MESSAGE,
|
|
267
|
+
NO_QUOTABLE_BODY_REPLY_MESSAGE,
|
|
268
|
+
} from "./components/compose-quote-missing-banner.js";
|
|
261
269
|
export {
|
|
262
270
|
ComposeSmtpMissingBanner,
|
|
263
271
|
type ComposeSmtpMissingBannerProps,
|
|
@@ -1083,6 +1091,12 @@ export {
|
|
|
1083
1091
|
type SearchConversion,
|
|
1084
1092
|
searchConversionNotice,
|
|
1085
1093
|
} from "./lib/search-rule.js";
|
|
1094
|
+
export {
|
|
1095
|
+
SEMANTIC_OFF_BUYS,
|
|
1096
|
+
SEMANTIC_OFF_COMMAND,
|
|
1097
|
+
SEMANTIC_OFF_TITLE,
|
|
1098
|
+
semanticOffReason,
|
|
1099
|
+
} from "./lib/semantic-off.js";
|
|
1086
1100
|
export {
|
|
1087
1101
|
collapsibleDomain,
|
|
1088
1102
|
deriveSenderClauses,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the surfaces backed by stored message vectors say on an instance with
|
|
3
|
+
* semantic search off (#1068).
|
|
4
|
+
*
|
|
5
|
+
* Off is a deployment setting, not a failure, so the copy names the command
|
|
6
|
+
* that changes it and what changing it buys: the Organize widen to similar
|
|
7
|
+
* mail, and filters that match on similarity. It deliberately promises nothing
|
|
8
|
+
* about the "Similar messages" panel filling — answering a typed query needs a
|
|
9
|
+
* query embedder no self-host image carries, so that panel is empty either way
|
|
10
|
+
* (deploy/vps/README.md, Search).
|
|
11
|
+
*/
|
|
12
|
+
export const SEMANTIC_OFF_TITLE = "Semantic search is off on this instance.";
|
|
13
|
+
|
|
14
|
+
export const SEMANTIC_OFF_BUYS =
|
|
15
|
+
"On, it stores a vector for every message, which is what the Organize widen to similar mail and semantic filters read.";
|
|
16
|
+
|
|
17
|
+
export const SEMANTIC_OFF_COMMAND = "remit semantic on";
|
|
18
|
+
|
|
19
|
+
/** The same three facts as one line, for a surface with room for one. */
|
|
20
|
+
export const semanticOffReason = `${SEMANTIC_OFF_TITLE} ${SEMANTIC_OFF_BUYS} Run '${SEMANTIC_OFF_COMMAND}' on the server.`;
|