@remit/web-client 0.0.296 → 0.0.298
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 +2 -1
- package/src/components/mail/daily-brief.stories.tsx +250 -0
- package/src/components/mail/drafts.stories.tsx +61 -0
- package/src/components/mail/flagged.stories.tsx +159 -0
- package/src/components/mail/outbox.stories.tsx +59 -0
- package/src/hooks/useIntelligenceData.ts +2 -2
- package/src/mocks/story-frame/AppStory.tsx +47 -0
- package/src/mocks/story-frame/mail-handlers.ts +299 -0
- package/src/mocks/story-frame/mail-world.ts +389 -0
- package/src/mocks/story-frame/touch.ts +21 -0
- package/src/router.tsx +3 -1
- package/src/routes/settings/-accounts.test.ts +18 -0
- package/src/routes/settings/accounts.tsx +8 -1
- package/src/test-support/fixtures.ts +1 -0
package/src/router.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { QueryClient } from "@tanstack/react-query";
|
|
2
|
-
import { createRouter } from "@tanstack/react-router";
|
|
2
|
+
import { createRouter, type RouterHistory } from "@tanstack/react-router";
|
|
3
3
|
import { AppShellSkeleton } from "./components/layout/AppShellSkeleton";
|
|
4
4
|
import { recordRoute } from "./lib/route-breadcrumbs";
|
|
5
5
|
import { stringifySearch } from "./lib/search-params";
|
|
@@ -13,10 +13,12 @@ export interface RouterContext {
|
|
|
13
13
|
export const createAppRouter = (
|
|
14
14
|
queryClient: QueryClient,
|
|
15
15
|
telemetry: Telemetry,
|
|
16
|
+
history?: RouterHistory,
|
|
16
17
|
) => {
|
|
17
18
|
const router = createRouter({
|
|
18
19
|
routeTree,
|
|
19
20
|
context: { queryClient },
|
|
21
|
+
history,
|
|
20
22
|
// A query param that carries a list writes one param per value
|
|
21
23
|
// (`lib/search-params.ts`), which is what the router's own reader already
|
|
22
24
|
// expects and what a hand-written link says.
|
|
@@ -34,6 +34,13 @@ describe("mapOauthError", () => {
|
|
|
34
34
|
);
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
+
test("scope_not_granted sends the person back through the consent", () => {
|
|
38
|
+
assert.match(
|
|
39
|
+
mapOauthError("scope_not_granted"),
|
|
40
|
+
/did not grant access to every service you picked/,
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
|
|
37
44
|
test("consent_required returns admin consent message", () => {
|
|
38
45
|
const result = mapOauthError("consent_required");
|
|
39
46
|
assert.ok(
|
|
@@ -99,6 +106,7 @@ const REAUTH_ACCOUNT = {
|
|
|
99
106
|
displayName: "Matthijs",
|
|
100
107
|
authType: "oauthMicrosoft",
|
|
101
108
|
connectionState: "reauth_required",
|
|
109
|
+
syncedServices: ["Mail", "Calendar"],
|
|
102
110
|
};
|
|
103
111
|
|
|
104
112
|
// The router reads `self` at construction; the shared jsdom globals stop at
|
|
@@ -195,6 +203,16 @@ describe("the Reconnect button and the redirect it starts", () => {
|
|
|
195
203
|
Reflect.deleteProperty(document, "visibilityState");
|
|
196
204
|
});
|
|
197
205
|
|
|
206
|
+
test("asks Microsoft again for every service the account syncs", async () => {
|
|
207
|
+
const dom = await mountAccounts();
|
|
208
|
+
await startReconnect(dom);
|
|
209
|
+
|
|
210
|
+
assert.deepEqual(http?.to("/oauth/microsoft/start")[0]?.body, {
|
|
211
|
+
email: REAUTH_ACCOUNT.email,
|
|
212
|
+
services: ["Mail", "Calendar"],
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
|
|
198
216
|
test("goes busy and stays busy while the redirect is in flight", async () => {
|
|
199
217
|
const dom = await mountAccounts();
|
|
200
218
|
await startReconnect(dom);
|
|
@@ -64,6 +64,10 @@ export function mapOauthError(code: string): string {
|
|
|
64
64
|
return "You cancelled the sign-in.";
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
if (lower === "scope_not_granted") {
|
|
68
|
+
return "Microsoft did not grant access to every service you picked. Sign in again and accept each permission Microsoft asks for.";
|
|
69
|
+
}
|
|
70
|
+
|
|
67
71
|
if (
|
|
68
72
|
lower === "consent_required" ||
|
|
69
73
|
lower.includes("admin_consent") ||
|
|
@@ -440,7 +444,10 @@ function AccountsSettings() {
|
|
|
440
444
|
onClick: () => {
|
|
441
445
|
setReconnectingAccountId(account.accountId);
|
|
442
446
|
reconnectMutation.mutate({
|
|
443
|
-
body: {
|
|
447
|
+
body: {
|
|
448
|
+
email: account.email,
|
|
449
|
+
services: account.syncedServices,
|
|
450
|
+
},
|
|
444
451
|
});
|
|
445
452
|
},
|
|
446
453
|
}
|