@remit/web-client 0.0.321 → 0.0.322

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/web-client",
3
- "version": "0.0.321",
3
+ "version": "0.0.322",
4
4
  "type": "module",
5
5
  "description": "Remit web client, published as composable primitives — the app shell, auth shells, and runtime config. A distributor imports what it composes and bundles it.",
6
6
  "exports": {
@@ -10,7 +10,10 @@ import { BadgeCheck, Paperclip, Star } from "lucide-react";
10
10
  import { useState } from "react";
11
11
  import { EmptyState } from "@/components/ui/EmptyState";
12
12
  import { ErrorState } from "@/components/ui/ErrorState";
13
- import { isMessageNotFoundError } from "@/components/ui/error-banners";
13
+ import {
14
+ isMessageGoneFromServerError,
15
+ isMessageNotFoundError,
16
+ } from "@/components/ui/error-banners";
14
17
  import { toDisplayCategory } from "@/lib/display-category";
15
18
  import { formatDatePreset } from "@/lib/format";
16
19
  import { AutoMovedIndicator } from "./AutoMovedIndicator";
@@ -310,6 +313,10 @@ const ExpandedCard = ({
310
313
  <div className="h-4 bg-surface-sunken rounded w-3/4" />
311
314
  <div className="h-4 bg-surface-sunken rounded w-1/2" />
312
315
  </div>
316
+ ) : isError && isMessageGoneFromServerError(error) ? (
317
+ <div className="mt-3">
318
+ <EmptyState message="This message is no longer on the mail server. It was moved or deleted in another mail app." />
319
+ </div>
313
320
  ) : isError && isMessageNotFoundError(error) ? (
314
321
  <div className="mt-3">
315
322
  <EmptyState message="This message has been deleted" />
@@ -0,0 +1,42 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { HttpResponse, http } from "msw";
3
+ import { expect, within } from "storybook/test";
4
+ import { AppStory } from "@/mocks/story-frame/AppStory";
5
+ import { composeWorld, messageUrl } from "@/mocks/story-frame/compose-world";
6
+ import { mailHandlers } from "@/mocks/story-frame/mail-handlers";
7
+
8
+ const world = composeWorld();
9
+
10
+ const goneFromServer = http.get("/api/messages/msg-q3-planning", () =>
11
+ HttpResponse.json(
12
+ {
13
+ code: "message_gone_from_server",
14
+ message: "This message is no longer on the mail server.",
15
+ details: { messageId: "msg-q3-planning" },
16
+ },
17
+ { status: 404 },
18
+ ),
19
+ );
20
+
21
+ const meta = {
22
+ title: "Playground/Shipped/Mail/Message gone from server",
23
+ component: AppStory,
24
+ args: { url: messageUrl("q3-planning") },
25
+ parameters: {
26
+ layout: "fullscreen",
27
+ msw: { handlers: [goneFromServer, ...mailHandlers(world)] },
28
+ },
29
+ } satisfies Meta<typeof AppStory>;
30
+ export default meta;
31
+
32
+ type Story = StoryObj<typeof meta>;
33
+
34
+ export const MovedOrDeletedElsewhere: Story = {
35
+ play: async () => {
36
+ await expect(
37
+ await within(document.body).findByText(
38
+ "This message is no longer on the mail server. It was moved or deleted in another mail app.",
39
+ ),
40
+ ).toBeVisible();
41
+ },
42
+ };
@@ -1,3 +1,4 @@
1
+ import { codedApiErrorBody } from "@/lib/api";
1
2
  export type ErrorBannerSeverity = "error" | "warning" | "info";
2
3
 
3
4
  /**
@@ -67,6 +68,9 @@ export const formatErrorDetail = (error: unknown): string | undefined => {
67
68
  return undefined;
68
69
  };
69
70
 
71
+ export const isMessageGoneFromServerError = (error: unknown): boolean =>
72
+ codedApiErrorBody(error)?.code === "message_gone_from_server";
73
+
70
74
  /**
71
75
  * Detect a "describeMessage hit a deleted/missing row" error.
72
76
  *