@jskit-ai/workspaces-web 0.2.43 → 0.2.45
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
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- 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()`.
|
|
5
6
|
- 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.
|
|
6
7
|
- 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`.
|
|
7
8
|
- The members screen loads its members and pending-invites lists 20 at a time, with a Load more button under each list while it has more. A refetch, such as a realtime change, reads every loaded page again. The members admin status adds `hasMoreMembers`, `isLoadingMoreMembers`, `hasMoreInvites` and `isLoadingMoreInvites`, and its actions add `loadMoreMembers` and `loadMoreInvites`. `useWorkspaceMembersPage` no longer passes the role catalog view to `useWorkspaceMembersActions`.
|
package/locales/en.json
CHANGED
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
"memberIdInvalid": "Member user id is invalid.",
|
|
38
38
|
"inviteSent": "Invite sent.",
|
|
39
39
|
"inviteCreatedDeliveryFailed": "Invite created, but email delivery failed. Copy the invite link to share it.",
|
|
40
|
+
"inviteCreatedSimulated": "Invite created. This is a test copy, so no email was sent: copy the link to share it.",
|
|
41
|
+
"inviteCreatedMailerUnconfigured": "Invite created. Email isn't set up, so no email was sent: copy the link to share it.",
|
|
40
42
|
"inviteCreated": "Invite created. Copy the invite link to share it.",
|
|
41
43
|
"linkReady": "Invite link ready to copy.",
|
|
42
44
|
"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.45",
|
|
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.34",
|
|
20
|
+
"@jskit-ai/workspaces-core": "0.2.34"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@jskit-ai/auth-web": "0.2.
|
|
24
|
-
"@jskit-ai/http-web": "0.2.
|
|
23
|
+
"@jskit-ai/auth-web": "0.2.32",
|
|
24
|
+
"@jskit-ai/http-web": "0.2.36",
|
|
25
25
|
"@jskit-ai/kernel": "0.2.21",
|
|
26
|
-
"@jskit-ai/shell-web": "0.2.
|
|
27
|
-
"@jskit-ai/users-web": "0.2.
|
|
26
|
+
"@jskit-ai/shell-web": "0.2.30",
|
|
27
|
+
"@jskit-ai/users-web": "0.2.45",
|
|
28
28
|
"@tanstack/vue-query": "^5.90.5",
|
|
29
29
|
"vue": "^3.5.13",
|
|
30
30
|
"vue-router": "^5.0.4",
|
|
@@ -276,6 +276,6 @@
|
|
|
276
276
|
}
|
|
277
277
|
},
|
|
278
278
|
"devDependencies": {
|
|
279
|
-
"@jskit-ai/material-web": "0.1.
|
|
279
|
+
"@jskit-ai/material-web": "0.1.6"
|
|
280
280
|
}
|
|
281
281
|
}
|
|
@@ -165,18 +165,33 @@ function useWorkspaceMembersActions({
|
|
|
165
165
|
createdInviteDeliveryStatus.value = String(delivery.status || "").trim().toLowerCase();
|
|
166
166
|
forms.invite.email = "";
|
|
167
167
|
await workspaceInvitesList.reload();
|
|
168
|
-
|
|
169
|
-
inviteFeedback.success(t("jskit.workspaces.members.inviteSent"));
|
|
170
|
-
} else if (createdInviteDeliveryStatus.value === "failed") {
|
|
171
|
-
inviteFeedback.success(t("jskit.workspaces.members.inviteCreatedDeliveryFailed"));
|
|
172
|
-
} else {
|
|
173
|
-
inviteFeedback.success(t("jskit.workspaces.members.inviteCreated"));
|
|
174
|
-
}
|
|
168
|
+
reportInviteDelivery(createdInviteDeliveryStatus.value);
|
|
175
169
|
} catch (error) {
|
|
176
170
|
inviteFeedback.error(error, t("jskit.workspaces.members.createInviteFailed"));
|
|
177
171
|
}
|
|
178
172
|
}
|
|
179
173
|
|
|
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. A status this client does not know claims nothing.
|
|
176
|
+
function reportInviteDelivery(deliveryStatus) {
|
|
177
|
+
switch (deliveryStatus) {
|
|
178
|
+
case "sent":
|
|
179
|
+
inviteFeedback.success(t("jskit.workspaces.members.inviteSent"));
|
|
180
|
+
return;
|
|
181
|
+
case "simulated":
|
|
182
|
+
inviteFeedback.success(t("jskit.workspaces.members.inviteCreatedSimulated"));
|
|
183
|
+
return;
|
|
184
|
+
case "mailer_unconfigured":
|
|
185
|
+
inviteFeedback.success(t("jskit.workspaces.members.inviteCreatedMailerUnconfigured"));
|
|
186
|
+
return;
|
|
187
|
+
case "failed":
|
|
188
|
+
inviteFeedback.warning(t("jskit.workspaces.members.inviteCreatedDeliveryFailed"));
|
|
189
|
+
return;
|
|
190
|
+
default:
|
|
191
|
+
inviteFeedback.success(t("jskit.workspaces.members.inviteCreated"));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
180
195
|
async function copyCreatedInviteLink() {
|
|
181
196
|
const inviteUrl = String(createdInviteUrl.value || "").trim();
|
|
182
197
|
if (!inviteUrl || isCopyingInviteLink.value) {
|
|
@@ -2,7 +2,8 @@ import assert from "node:assert/strict";
|
|
|
2
2
|
import { registerHooks } from "node:module";
|
|
3
3
|
import test from "node:test";
|
|
4
4
|
|
|
5
|
-
// The commands and feedback stand in for http-web's, so the test sees which reads each action makes afterwards
|
|
5
|
+
// The commands and feedback stand in for http-web's, so the test sees which reads each action makes afterwards and
|
|
6
|
+
// which notice each one shows. `commandResult.value` is what every command answers; `notices` records each notice.
|
|
6
7
|
const commandUrl = import.meta.resolve("@jskit-ai/http-web/client/composables/useCommand");
|
|
7
8
|
const feedbackUrl = import.meta.resolve("@jskit-ai/http-web/client/composables/useUiFeedback");
|
|
8
9
|
const hooks = registerHooks({
|
|
@@ -11,35 +12,53 @@ const hooks = registerHooks({
|
|
|
11
12
|
return {
|
|
12
13
|
format: "module",
|
|
13
14
|
shortCircuit: true,
|
|
14
|
-
source:
|
|
15
|
+
source: [
|
|
16
|
+
"export const commandResult = { value: { inviteUrl: '', inviteDelivery: { status: 'sent' } } };",
|
|
17
|
+
"export const useCommand = () => ({ isRunning: false, async run() { return commandResult.value; } });"
|
|
18
|
+
].join("\n")
|
|
15
19
|
};
|
|
16
20
|
}
|
|
17
21
|
if (url === feedbackUrl) {
|
|
18
22
|
return {
|
|
19
23
|
format: "module",
|
|
20
24
|
shortCircuit: true,
|
|
21
|
-
source:
|
|
25
|
+
source: [
|
|
26
|
+
"export const notices = [];",
|
|
27
|
+
"export const useUiFeedback = () => ({",
|
|
28
|
+
" clear() {},",
|
|
29
|
+
" success(message) { notices.push({ style: 'success', message }); },",
|
|
30
|
+
" warning(message) { notices.push({ style: 'warning', message }); },",
|
|
31
|
+
" error(error) { throw error; }",
|
|
32
|
+
"});"
|
|
33
|
+
].join("\n")
|
|
22
34
|
};
|
|
23
35
|
}
|
|
24
36
|
return nextLoad(url, context);
|
|
25
37
|
}
|
|
26
38
|
});
|
|
39
|
+
const { commandResult } = await import(commandUrl);
|
|
40
|
+
const { notices } = await import(feedbackUrl);
|
|
27
41
|
const { useWorkspaceMembersActions } = await import("../src/client/composables/useWorkspaceMembersActions.js");
|
|
28
42
|
hooks.deregister();
|
|
29
43
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
44
|
+
const INVITE_URL = "https://app.example.test/invite/token-1";
|
|
45
|
+
|
|
46
|
+
function membersActions(reads = []) {
|
|
47
|
+
return useWorkspaceMembersActions({
|
|
33
48
|
forms: { invite: { email: "guest@example.test", roleSid: "member" } },
|
|
34
49
|
workspaceMembersApiPath: { value: "/api/w/team/members" },
|
|
35
50
|
workspaceInvitesApiPath: { value: "/api/w/team/invites" },
|
|
36
51
|
canInviteMembers: { value: true },
|
|
37
52
|
canManageMembers: { value: true },
|
|
38
53
|
canRevokeInvites: { value: true },
|
|
39
|
-
workspaceRolesView: { async refresh() { reads.push("roles"); } },
|
|
40
54
|
workspaceMembersList: { async reload() { reads.push("members"); } },
|
|
41
55
|
workspaceInvitesList: { async reload() { reads.push("invites"); } }
|
|
42
56
|
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
test("member and invite actions reload the list they changed, never the static role catalogue", async () => {
|
|
60
|
+
const reads = [];
|
|
61
|
+
const { actions } = membersActions(reads);
|
|
43
62
|
|
|
44
63
|
await actions.submitInvite();
|
|
45
64
|
await actions.submitRevokeInvite("5");
|
|
@@ -48,3 +67,69 @@ test("member and invite actions reload the list they changed, never the static r
|
|
|
48
67
|
|
|
49
68
|
assert.deepEqual(reads, ["invites", "invites", "members", "members"]);
|
|
50
69
|
});
|
|
70
|
+
|
|
71
|
+
// What the invite notice says for each delivery status the server answers. Only `sent` says an email went out; the
|
|
72
|
+
// others leave the link and its Copy button in the panel as the next step.
|
|
73
|
+
const INVITE_NOTICES = Object.freeze([
|
|
74
|
+
{
|
|
75
|
+
delivery: { status: "sent", message: "Invite sent." },
|
|
76
|
+
notice: { style: "success", message: "Invite sent." }
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
delivery: {
|
|
80
|
+
status: "simulated",
|
|
81
|
+
message: "Test copy: the invitation email was not sent. Copy the invite link to share it.",
|
|
82
|
+
messageCode: "workspaces.invite.simulated"
|
|
83
|
+
},
|
|
84
|
+
notice: {
|
|
85
|
+
style: "success",
|
|
86
|
+
message: "Invite created. This is a test copy, so no email was sent: copy the link to share it."
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
delivery: {
|
|
91
|
+
status: "mailer_unconfigured",
|
|
92
|
+
message: "No workspace invite mailer is configured.",
|
|
93
|
+
messageCode: "workspaces.invite.mailerUnconfigured"
|
|
94
|
+
},
|
|
95
|
+
notice: {
|
|
96
|
+
style: "success",
|
|
97
|
+
message: "Invite created. Email isn't set up, so no email was sent: copy the link to share it."
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
delivery: { status: "failed", message: "The mail server refused the message." },
|
|
102
|
+
notice: {
|
|
103
|
+
style: "warning",
|
|
104
|
+
message: "Invite created, but email delivery failed. Copy the invite link to share it."
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
delivery: { status: "queued", message: "A status this client does not know yet." },
|
|
109
|
+
notice: { style: "success", message: "Invite created. Copy the invite link to share it." }
|
|
110
|
+
}
|
|
111
|
+
]);
|
|
112
|
+
|
|
113
|
+
for (const { delivery, notice } of INVITE_NOTICES) {
|
|
114
|
+
test(`an invite whose delivery is ${delivery.status} shows a ${notice.style} notice of its own and keeps the link`, async () => {
|
|
115
|
+
commandResult.value = { inviteUrl: INVITE_URL, inviteDelivery: delivery };
|
|
116
|
+
notices.length = 0;
|
|
117
|
+
const { actions, createdInviteUrl, createdInviteDeliveryStatus } = membersActions();
|
|
118
|
+
|
|
119
|
+
await actions.submitInvite();
|
|
120
|
+
|
|
121
|
+
assert.deepEqual(notices, [notice]);
|
|
122
|
+
assert.equal(createdInviteUrl.value, INVITE_URL, "The panel shows the link with its Copy button.");
|
|
123
|
+
assert.equal(createdInviteDeliveryStatus.value, delivery.status);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
test("an invite answered without a delivery claims no email either", async () => {
|
|
128
|
+
commandResult.value = { inviteUrl: INVITE_URL };
|
|
129
|
+
notices.length = 0;
|
|
130
|
+
const { actions } = membersActions();
|
|
131
|
+
|
|
132
|
+
await actions.submitInvite();
|
|
133
|
+
|
|
134
|
+
assert.deepEqual(notices, [{ style: "success", message: "Invite created. Copy the invite link to share it." }]);
|
|
135
|
+
});
|