@jskit-ai/workspaces-web 0.2.49 → 0.2.51
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/CHANGELOG.md +2 -0
- package/locales/en.json +1 -0
- package/package.json +8 -8
- package/src/client/composables/useWorkspaceMembersActions.js +9 -5
- package/src/client/runtime/bootstrapPlacementRuntime.js +21 -36
- package/test/bootstrapPlacementRuntime.test.js +57 -1
- package/test/workspaceMembersActions.test.js +15 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- After **Send invite**, the members panel has a notice for the delivery status `held`, an invitation whose email the application keeps and sends once its email is set up: "Invite created. Email isn't set up yet, so it will be sent once it is: copy the link to share it now." (`jskit.workspaces.members.inviteCreatedHeld`), a success like the other statuses that send the person to the invite link. A status the panel does not know now shows the delivery result's own `message`, in the person's language when its `messageCode` has a translation, and the general "Invite created. Copy the invite link to share it." only when the result has none. Before, both showed the general notice, which said nothing of an email the application will still send, or of what the mailer reported.
|
|
6
|
+
- A workspace's bootstrap answer applies when the person has moved to another page of the same workspace before it arrives. It was dropped because the page had changed, and a move within a workspace asks nothing again, so a person who tapped another page while the first one loaded kept no permissions until a reload: a short menu, and every command that needs a permission refused. The answer belongs to the workspace, not to a page (its request names only the workspace slug, and nothing in it depends on the page), so an answer for the workspace the route is in now applies, and one for a workspace the route has left is still dropped, as the move there asked again. A 403 or 404 for the workspace applies after such a move too. The bootstrap request's `meta` no longer carries the page's `path`, which nothing reads.
|
|
5
7
|
- After **Send invite**, the members panel's notice says whether an email went out. In a test copy (whose invitation emails are only simulated) and in an app with no invite mailer, it showed the general success "Invite created. Copy the invite link to share it.", which never said that no email had gone out, so an administrator could believe the invitation had been emailed. It now says "Invite created. This is a test copy, so no email was sent: copy the link to share it." and "Invite created. Email isn't set up, so no email was sent: copy the link to share it.". A failed email ("Invite created, but email delivery failed. …") is shown as a warning instead of a success. In each case the invite link and its Copy button stay under the form, as before. A delivery status the panel does not know still says only "Invite created. Copy the invite link to share it.". The notices come from the package's own catalog, not from the server's English: `jskit.workspaces.members.inviteCreatedSimulated` and `jskit.workspaces.members.inviteCreatedMailerUnconfigured` are new message keys. The warning uses `@jskit-ai/http-web`'s new `useUiFeedback().warning()`.
|
|
6
8
|
- A signed-out person opening a page no longer freezes the browser tab. The workspaces runtime started checking surface access while the router still sat on its start location `/`, before its opening navigation had finished, so in an app whose default surface needs sign-in it redirected that `/` to the default surface and cancelled the navigation to the page the person opened. Each cancelled navigation then ran the router's `afterEach`, which redirected again and cancelled the next one, in a loop of microtasks that never let the page render or answer (the tab stayed on its loading screen). The runtime now leaves the route alone until the opening navigation finishes, and its `afterEach` ignores navigations that failed: a cancelled, aborted or duplicate navigation leaves the route where it was, and the one that replaced it runs its own check.
|
|
7
9
|
- Inviting, revoking an invite, changing a member's role and removing a member reload only the invites or the members, not the workspace's role catalogue too: the catalogue is configuration that does not change with them, and each members response already carries it. `useWorkspaceMembersActions` no longer takes `workspaceRolesView`.
|
package/locales/en.json
CHANGED
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"inviteCreatedDeliveryFailed": "Invite created, but email delivery failed. Copy the invite link to share it.",
|
|
40
40
|
"inviteCreatedSimulated": "Invite created. This is a test copy, so no email was sent: copy the link to share it.",
|
|
41
41
|
"inviteCreatedMailerUnconfigured": "Invite created. Email isn't set up, so no email was sent: copy the link to share it.",
|
|
42
|
+
"inviteCreatedHeld": "Invite created. Email isn't set up yet, so it will be sent once it is: copy the link to share it now.",
|
|
42
43
|
"inviteCreated": "Invite created. Copy the invite link to share it.",
|
|
43
44
|
"linkReady": "Invite link ready to copy.",
|
|
44
45
|
"linkCopied": "Invite link copied.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/workspaces-web",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.51",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "jskit test"
|
|
@@ -16,15 +16,15 @@
|
|
|
16
16
|
"./locales/en.json": "./locales/en.json"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@jskit-ai/users-core": "0.2.
|
|
20
|
-
"@jskit-ai/workspaces-core": "0.2.
|
|
19
|
+
"@jskit-ai/users-core": "0.2.39",
|
|
20
|
+
"@jskit-ai/workspaces-core": "0.2.39"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@jskit-ai/auth-web": "0.2.
|
|
24
|
-
"@jskit-ai/http-web": "0.2.
|
|
25
|
-
"@jskit-ai/kernel": "0.2.
|
|
26
|
-
"@jskit-ai/shell-web": "0.2.
|
|
27
|
-
"@jskit-ai/users-web": "0.2.
|
|
23
|
+
"@jskit-ai/auth-web": "0.2.36",
|
|
24
|
+
"@jskit-ai/http-web": "0.2.39",
|
|
25
|
+
"@jskit-ai/kernel": "0.2.23",
|
|
26
|
+
"@jskit-ai/shell-web": "0.2.32",
|
|
27
|
+
"@jskit-ai/users-web": "0.2.51",
|
|
28
28
|
"@tanstack/vue-query": "^5.90.5",
|
|
29
29
|
"vue": "^3.5.13",
|
|
30
30
|
"vue-router": "^5.0.4",
|
|
@@ -37,7 +37,7 @@ function useWorkspaceMembersActions({
|
|
|
37
37
|
workspaceMembersList,
|
|
38
38
|
workspaceInvitesList
|
|
39
39
|
}) {
|
|
40
|
-
const { t } = useJskitText();
|
|
40
|
+
const { t, serverMessage } = useJskitText();
|
|
41
41
|
const inviteFeedback = useUiFeedback();
|
|
42
42
|
const membersFeedback = useUiFeedback();
|
|
43
43
|
const teamFeedback = useUiFeedback();
|
|
@@ -165,15 +165,16 @@ function useWorkspaceMembersActions({
|
|
|
165
165
|
createdInviteDeliveryStatus.value = String(delivery.status || "").trim().toLowerCase();
|
|
166
166
|
forms.invite.email = "";
|
|
167
167
|
await workspaceInvitesList.reload();
|
|
168
|
-
reportInviteDelivery(createdInviteDeliveryStatus.value);
|
|
168
|
+
reportInviteDelivery(createdInviteDeliveryStatus.value, delivery);
|
|
169
169
|
} catch (error) {
|
|
170
170
|
inviteFeedback.error(error, t("jskit.workspaces.members.createInviteFailed"));
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
// The notice for each delivery status the server answers. Only `sent` says an email went out; the others send the
|
|
175
|
-
// person to the invite link the panel shows with its Copy button.
|
|
176
|
-
|
|
175
|
+
// person to the invite link the panel shows with its Copy button. `held` is an email the application sends once its
|
|
176
|
+
// email is set up. A status this client does not know shows the server's own message, else claims nothing.
|
|
177
|
+
function reportInviteDelivery(deliveryStatus, delivery) {
|
|
177
178
|
switch (deliveryStatus) {
|
|
178
179
|
case "sent":
|
|
179
180
|
inviteFeedback.success(t("jskit.workspaces.members.inviteSent"));
|
|
@@ -184,11 +185,14 @@ function useWorkspaceMembersActions({
|
|
|
184
185
|
case "mailer_unconfigured":
|
|
185
186
|
inviteFeedback.success(t("jskit.workspaces.members.inviteCreatedMailerUnconfigured"));
|
|
186
187
|
return;
|
|
188
|
+
case "held":
|
|
189
|
+
inviteFeedback.success(t("jskit.workspaces.members.inviteCreatedHeld"));
|
|
190
|
+
return;
|
|
187
191
|
case "failed":
|
|
188
192
|
inviteFeedback.warning(t("jskit.workspaces.members.inviteCreatedDeliveryFailed"));
|
|
189
193
|
return;
|
|
190
194
|
default:
|
|
191
|
-
inviteFeedback.success(t("jskit.workspaces.members.inviteCreated"));
|
|
195
|
+
inviteFeedback.success(serverMessage(delivery, t("jskit.workspaces.members.inviteCreated")));
|
|
192
196
|
}
|
|
193
197
|
}
|
|
194
198
|
|
|
@@ -262,31 +262,25 @@ function createBootstrapPlacementRuntime({
|
|
|
262
262
|
);
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
-
function
|
|
265
|
+
function requestedWorkspaceSlug(request) {
|
|
266
266
|
const meta = request?.meta && typeof request.meta === "object" ? request.meta : {};
|
|
267
267
|
const query = request?.query && typeof request.query === "object" ? request.query : {};
|
|
268
|
-
return
|
|
269
|
-
path: String(meta.path || "").trim(),
|
|
270
|
-
workspaceSlug: normalizeLowerText(meta.workspaceSlug || query.workspaceSlug)
|
|
271
|
-
});
|
|
268
|
+
return normalizeLowerText(meta.workspaceSlug || query.workspaceSlug);
|
|
272
269
|
}
|
|
273
270
|
|
|
271
|
+
// The bootstrap answers for a workspace, not a page: its request names only the workspace slug, and its answer (the
|
|
272
|
+
// workspace, its settings, the person's permissions in it) depends on nothing else, so nothing in it is particular
|
|
273
|
+
// to the page that asked. An answer for the workspace the route is in applies after a move to another of its pages,
|
|
274
|
+
// which asks nothing again; one for a workspace the route has left is dropped, as the move there asked again.
|
|
274
275
|
function isCurrentRequestTarget(request = {}) {
|
|
275
|
-
|
|
276
|
-
const currentState = resolveRouteState(placementRuntime, router);
|
|
277
|
-
if (requested.path && requested.path !== currentState.path) {
|
|
278
|
-
return false;
|
|
279
|
-
}
|
|
280
|
-
return requested.workspaceSlug === normalizeLowerText(currentState.workspaceSlug);
|
|
276
|
+
return requestedWorkspaceSlug(request) === normalizeLowerText(resolveRouteState(placementRuntime, router).workspaceSlug);
|
|
281
277
|
}
|
|
282
278
|
|
|
283
279
|
function resolveBootstrapRequest() {
|
|
284
|
-
const
|
|
285
|
-
const workspaceSlug = normalizeLowerText(state.workspaceSlug);
|
|
280
|
+
const workspaceSlug = normalizeLowerText(resolveRouteState(placementRuntime, router).workspaceSlug);
|
|
286
281
|
return Object.freeze({
|
|
287
282
|
query: workspaceSlug ? Object.freeze({ workspaceSlug }) : Object.freeze({}),
|
|
288
283
|
meta: Object.freeze({
|
|
289
|
-
path: state.path,
|
|
290
284
|
workspaceSlug
|
|
291
285
|
})
|
|
292
286
|
});
|
|
@@ -330,41 +324,32 @@ function createBootstrapPlacementRuntime({
|
|
|
330
324
|
}
|
|
331
325
|
|
|
332
326
|
const normalizedSource = normalizeBootstrapSource(source);
|
|
333
|
-
const
|
|
334
|
-
const stateAtApply = resolveRouteState(placementRuntime, router);
|
|
327
|
+
const workspaceSlug = requestedWorkspaceSlug(request);
|
|
335
328
|
const statusCode = resolveErrorStatusCode(error);
|
|
336
329
|
|
|
337
330
|
if (statusCode === 401) {
|
|
338
|
-
if (
|
|
339
|
-
setWorkspaceBootstrapStatus(
|
|
331
|
+
if (workspaceSlug) {
|
|
332
|
+
setWorkspaceBootstrapStatus(workspaceSlug, WORKSPACE_BOOTSTRAP_STATUS_UNAUTHENTICATED, normalizedSource);
|
|
340
333
|
}
|
|
341
334
|
clearWorkspacePlacementContext(normalizedSource);
|
|
342
335
|
applyUnauthenticatedTheme(reason);
|
|
343
336
|
return null;
|
|
344
337
|
}
|
|
345
338
|
|
|
346
|
-
if (statusCode === 403) {
|
|
347
|
-
if (
|
|
348
|
-
setWorkspaceBootstrapStatus(
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
return null;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
if (statusCode === 404) {
|
|
357
|
-
if (requested.workspaceSlug) {
|
|
358
|
-
setWorkspaceBootstrapStatus(requested.workspaceSlug, WORKSPACE_BOOTSTRAP_STATUS_NOT_FOUND, normalizedSource);
|
|
359
|
-
}
|
|
360
|
-
if (requested.path === stateAtApply.path) {
|
|
361
|
-
clearWorkspacePlacementContext(normalizedSource);
|
|
339
|
+
if (statusCode === 403 || statusCode === 404) {
|
|
340
|
+
if (workspaceSlug) {
|
|
341
|
+
setWorkspaceBootstrapStatus(
|
|
342
|
+
workspaceSlug,
|
|
343
|
+
statusCode === 403 ? WORKSPACE_BOOTSTRAP_STATUS_FORBIDDEN : WORKSPACE_BOOTSTRAP_STATUS_NOT_FOUND,
|
|
344
|
+
normalizedSource
|
|
345
|
+
);
|
|
362
346
|
}
|
|
347
|
+
clearWorkspacePlacementContext(normalizedSource);
|
|
363
348
|
return null;
|
|
364
349
|
}
|
|
365
350
|
|
|
366
|
-
if (
|
|
367
|
-
setWorkspaceBootstrapStatus(
|
|
351
|
+
if (workspaceSlug) {
|
|
352
|
+
setWorkspaceBootstrapStatus(workspaceSlug, WORKSPACE_BOOTSTRAP_STATUS_ERROR, normalizedSource);
|
|
368
353
|
}
|
|
369
354
|
|
|
370
355
|
logger.warn(
|
|
@@ -244,7 +244,6 @@ test("bootstrap placement runtime contributes workspace slug to shared bootstrap
|
|
|
244
244
|
workspaceSlug: "acme"
|
|
245
245
|
},
|
|
246
246
|
meta: {
|
|
247
|
-
path: "/w/acme/dashboard",
|
|
248
247
|
workspaceSlug: "acme"
|
|
249
248
|
}
|
|
250
249
|
});
|
|
@@ -609,6 +608,63 @@ test("bootstrap placement runtime tracks status per workspace slug across route
|
|
|
609
608
|
assert.deepEqual(router.replaceCalls, ["/w/zen"]);
|
|
610
609
|
});
|
|
611
610
|
|
|
611
|
+
// The person taps another page of the workspace before its bootstrap answer arrives. Before, the answer was dropped
|
|
612
|
+
// because the page had changed, and the move asked nothing again, so the person kept no permissions until a reload.
|
|
613
|
+
test("bootstrap placement runtime applies an answer that arrives after a move to another page of the same workspace", async () => {
|
|
614
|
+
const placementRuntime = createPlacementRuntimeStub();
|
|
615
|
+
const router = createRouterStub("/w/acme/dashboard");
|
|
616
|
+
const bootstrapRuntime = createBootstrapRuntimeStub();
|
|
617
|
+
const runtime = createTestRuntime({ placementRuntime, bootstrapRuntime, router });
|
|
618
|
+
const workspaces = [{ id: "1", slug: "acme", name: "Acme Workspace" }];
|
|
619
|
+
|
|
620
|
+
await runtime.initialize();
|
|
621
|
+
const request = runtime.resolveBootstrapRequest();
|
|
622
|
+
await router.push("/w/acme/members");
|
|
623
|
+
await flushTasks();
|
|
624
|
+
assert.deepEqual(bootstrapRuntime.calls, [], "A move within the workspace asks nothing again.");
|
|
625
|
+
|
|
626
|
+
await runtime.applyBootstrapPayload({
|
|
627
|
+
request,
|
|
628
|
+
payload: {
|
|
629
|
+
session: { authenticated: true, userId: "7" },
|
|
630
|
+
workspaces,
|
|
631
|
+
permissions: ["workspace.members.view", "workspace.members.invite"]
|
|
632
|
+
}
|
|
633
|
+
});
|
|
634
|
+
|
|
635
|
+
const context = placementRuntime.getContext();
|
|
636
|
+
assert.deepEqual(context.permissions, ["workspace.members.view", "workspace.members.invite"]);
|
|
637
|
+
assert.equal(context.workspace?.slug, "acme");
|
|
638
|
+
assert.equal(runtime.getWorkspaceBootstrapStatus("acme"), WORKSPACE_BOOTSTRAP_STATUS_RESOLVED);
|
|
639
|
+
|
|
640
|
+
// An answer for a workspace the route has left is still dropped: the move there asked again.
|
|
641
|
+
await router.push("/w/zen/dashboard");
|
|
642
|
+
await flushTasks();
|
|
643
|
+
await runtime.applyBootstrapPayload({
|
|
644
|
+
request,
|
|
645
|
+
payload: { session: { authenticated: true, userId: "7" }, workspaces, permissions: ["workspace.settings.view"] }
|
|
646
|
+
});
|
|
647
|
+
assert.deepEqual(bootstrapRuntime.calls, ["route"]);
|
|
648
|
+
assert.deepEqual(placementRuntime.getContext().permissions, ["workspace.members.view", "workspace.members.invite"]);
|
|
649
|
+
});
|
|
650
|
+
|
|
651
|
+
test("bootstrap placement runtime applies a refusal that arrives after a move to another page of the same workspace", async () => {
|
|
652
|
+
for (const [statusCode, status] of [[403, WORKSPACE_BOOTSTRAP_STATUS_FORBIDDEN], [404, WORKSPACE_BOOTSTRAP_STATUS_NOT_FOUND]]) {
|
|
653
|
+
const placementRuntime = createPlacementRuntimeStub();
|
|
654
|
+
placementRuntime.setContext({ permissions: ["workspace.members.view"] }, { source: "test.seed" });
|
|
655
|
+
const router = createRouterStub("/w/acme/dashboard");
|
|
656
|
+
const runtime = createTestRuntime({ placementRuntime, router });
|
|
657
|
+
|
|
658
|
+
await runtime.initialize();
|
|
659
|
+
const request = runtime.resolveBootstrapRequest();
|
|
660
|
+
await router.push("/w/acme/members");
|
|
661
|
+
await runtime.handleBootstrapError({ request, error: createErrorWithStatus(statusCode) });
|
|
662
|
+
|
|
663
|
+
assert.equal(runtime.getWorkspaceBootstrapStatus("acme"), status, `HTTP ${statusCode}`);
|
|
664
|
+
assert.deepEqual(placementRuntime.getContext().permissions, [], `HTTP ${statusCode}`);
|
|
665
|
+
}
|
|
666
|
+
});
|
|
667
|
+
|
|
612
668
|
test("bootstrap placement runtime uses requestedWorkspace status and keeps global workspace list on inaccessible slug", async () => {
|
|
613
669
|
const placementRuntime = createPlacementRuntimeStub();
|
|
614
670
|
const router = createRouterStub("/w/tony");
|
|
@@ -104,8 +104,22 @@ const INVITE_NOTICES = Object.freeze([
|
|
|
104
104
|
message: "Invite created, but email delivery failed. Copy the invite link to share it."
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
|
+
// An application that holds invitations until its email is set up, and sends them then.
|
|
107
108
|
{
|
|
108
|
-
delivery: { status: "
|
|
109
|
+
delivery: { status: "held", message: "Held until email is set up." },
|
|
110
|
+
notice: {
|
|
111
|
+
style: "success",
|
|
112
|
+
message: "Invite created. Email isn't set up yet, so it will be sent once it is: copy the link to share it now."
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
// A status this client does not know shows the server's own message, which only the server can word; without one,
|
|
116
|
+
// the neutral text, which claims no email.
|
|
117
|
+
{
|
|
118
|
+
delivery: { status: "queued", message: "Invite queued: it goes out within the hour." },
|
|
119
|
+
notice: { style: "success", message: "Invite queued: it goes out within the hour." }
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
delivery: { status: "deferred" },
|
|
109
123
|
notice: { style: "success", message: "Invite created. Copy the invite link to share it." }
|
|
110
124
|
}
|
|
111
125
|
]);
|