@jskit-ai/workspaces-web 0.1.229 → 0.2.0
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 +125 -0
- package/locales/en.json +135 -0
- package/package.json +10 -9
- package/src/client/account-settings/accountSettingsInvitesRuntime.js +6 -7
- package/src/client/account-settings/useAccountSettingsInvitesSectionRuntime.js +8 -6
- package/src/client/components/AccountSettingsInvitesSection.vue +10 -7
- package/src/client/components/MembersAdminClientElement.vue +27 -25
- package/src/client/components/WorkspaceInviteLanding.vue +22 -19
- package/src/client/components/WorkspaceMembersClientElement.vue +36 -34
- package/src/client/components/WorkspaceMembersMenuItem.vue +4 -2
- package/src/client/components/WorkspaceSelector.vue +9 -7
- package/src/client/components/WorkspaceSettingsMenuItem.vue +4 -2
- package/src/client/components/WorkspaceToolsWidget.vue +4 -1
- package/src/client/components/WorkspacesClientElement.vue +34 -34
- package/src/client/i18n.js +6 -0
- package/src/client/lib/profileSurfaceMenuLinks.js +5 -3
- package/src/shared/toolsOutletContracts.js +2 -1
- package/test/exportsContract.test.js +3 -1
- package/test/i18nCatalog.test.js +16 -0
|
@@ -19,6 +19,7 @@ import { usePaths } from "@jskit-ai/shell-web/client/navigation/usePaths";
|
|
|
19
19
|
import { useRealtimeQueryInvalidation } from "@jskit-ai/http-web/client/composables/useRealtimeQueryInvalidation";
|
|
20
20
|
import { useWorkspaceSurfaceId } from "../composables/useWorkspaceSurfaceId.js";
|
|
21
21
|
import { normalizeRecordId } from "@jskit-ai/kernel/shared/support/normalize";
|
|
22
|
+
import { useJskitText } from "../i18n.js";
|
|
22
23
|
|
|
23
24
|
function normalizePendingInvite(entry) {
|
|
24
25
|
if (!entry || typeof entry !== "object") {
|
|
@@ -51,6 +52,7 @@ function normalizePendingInvite(entry) {
|
|
|
51
52
|
};
|
|
52
53
|
}
|
|
53
54
|
|
|
55
|
+
const { t, errorMessage } = useJskitText();
|
|
54
56
|
const route = useRoute();
|
|
55
57
|
const router = useRouter();
|
|
56
58
|
const { context: placementContext } = useWebPlacementContext();
|
|
@@ -89,7 +91,7 @@ const bootstrapView = useView({
|
|
|
89
91
|
realtime: {
|
|
90
92
|
event: "workspace.settings.changed"
|
|
91
93
|
},
|
|
92
|
-
fallbackLoadError: "
|
|
94
|
+
fallbackLoadError: t("jskit.workspaces.workspacesView.loadFailed"),
|
|
93
95
|
model: bootstrapModel,
|
|
94
96
|
mapLoadedToModel: (model, payload = {}) => {
|
|
95
97
|
model.sessionAuthenticated = Boolean(payload?.session?.authenticated);
|
|
@@ -111,7 +113,7 @@ const redeemInviteCommand = useCommand({
|
|
|
111
113
|
apiSuffix: "/workspace/invitations/redeem",
|
|
112
114
|
writeMethod: "POST",
|
|
113
115
|
transport: WORKSPACE_INVITE_REDEEM_TRANSPORT,
|
|
114
|
-
fallbackRunError: "
|
|
116
|
+
fallbackRunError: t("jskit.workspaces.common.respondToInvitationFailed"),
|
|
115
117
|
suppressSuccessMessage: true,
|
|
116
118
|
model: redeemInviteModel,
|
|
117
119
|
buildRawPayload: (model) => ({
|
|
@@ -119,7 +121,7 @@ const redeemInviteCommand = useCommand({
|
|
|
119
121
|
decision: String(model.decision || "").trim().toLowerCase()
|
|
120
122
|
}),
|
|
121
123
|
messages: {
|
|
122
|
-
error: "
|
|
124
|
+
error: t("jskit.workspaces.common.respondToInvitationFailed")
|
|
123
125
|
}
|
|
124
126
|
});
|
|
125
127
|
|
|
@@ -128,7 +130,7 @@ const createWorkspaceCommand = useCommand({
|
|
|
128
130
|
apiSuffix: "/workspaces",
|
|
129
131
|
writeMethod: "POST",
|
|
130
132
|
transport: WORKSPACES_TRANSPORT,
|
|
131
|
-
fallbackRunError: "
|
|
133
|
+
fallbackRunError: t("jskit.workspaces.workspacesView.createFailed"),
|
|
132
134
|
suppressSuccessMessage: true,
|
|
133
135
|
model: createWorkspaceModel,
|
|
134
136
|
buildRawPayload: (model) => {
|
|
@@ -142,7 +144,7 @@ const createWorkspaceCommand = useCommand({
|
|
|
142
144
|
return payload;
|
|
143
145
|
},
|
|
144
146
|
messages: {
|
|
145
|
-
error: "
|
|
147
|
+
error: t("jskit.workspaces.workspacesView.createFailed")
|
|
146
148
|
}
|
|
147
149
|
});
|
|
148
150
|
|
|
@@ -227,9 +229,9 @@ function resolveLandingSlug() {
|
|
|
227
229
|
|
|
228
230
|
function workspaceOpenLabel(workspace) {
|
|
229
231
|
if (!workspace.isAccessible) {
|
|
230
|
-
return "
|
|
232
|
+
return t("jskit.workspaces.workspacesView.unavailable");
|
|
231
233
|
}
|
|
232
|
-
return selectingWorkspaceSlug.value === workspace.slug ? "
|
|
234
|
+
return t(selectingWorkspaceSlug.value === workspace.slug ? "jskit.workspaces.workspacesView.opening" : "jskit.workspaces.workspacesView.open");
|
|
233
235
|
}
|
|
234
236
|
|
|
235
237
|
function isRespondingToInvite(invite, decision) {
|
|
@@ -245,7 +247,7 @@ async function openWorkspace(workspaceSlug) {
|
|
|
245
247
|
const targetPath = workspaceHomePath(normalizedSlug);
|
|
246
248
|
if (!targetPath) {
|
|
247
249
|
reportFeedback({
|
|
248
|
-
message: "
|
|
250
|
+
message: t("jskit.workspaces.common.surfaceNotConfigured"),
|
|
249
251
|
severity: "error",
|
|
250
252
|
dedupeKey: "workspaces-web.workspaces-view:workspace-surface-missing"
|
|
251
253
|
});
|
|
@@ -265,11 +267,11 @@ async function openWorkspace(workspaceSlug) {
|
|
|
265
267
|
window.location.assign(navigationTarget.href);
|
|
266
268
|
return;
|
|
267
269
|
} else {
|
|
268
|
-
throw new Error("
|
|
270
|
+
throw new Error(t("jskit.workspaces.workspacesView.navigationUnavailable"));
|
|
269
271
|
}
|
|
270
272
|
} catch (error) {
|
|
271
273
|
reportFeedback({
|
|
272
|
-
message:
|
|
274
|
+
message: errorMessage(error, t("jskit.workspaces.common.openWorkspaceFailed")),
|
|
273
275
|
severity: "error",
|
|
274
276
|
dedupeKey: `workspaces-web.workspaces-view:open-workspace:${normalizedSlug}`
|
|
275
277
|
});
|
|
@@ -311,15 +313,13 @@ async function respondToInvite(invite, decision) {
|
|
|
311
313
|
}
|
|
312
314
|
|
|
313
315
|
reportFeedback({
|
|
314
|
-
message: "
|
|
316
|
+
message: t("jskit.workspaces.common.invitationRefused"),
|
|
315
317
|
severity: "success",
|
|
316
318
|
dedupeKey: `workspaces-web.workspaces-view:invite-refused:${token}`
|
|
317
319
|
});
|
|
318
320
|
} catch (error) {
|
|
319
321
|
reportFeedback({
|
|
320
|
-
message:
|
|
321
|
-
error?.message || (normalizedDecision === "accept" ? "Unable to accept invite." : "Unable to refuse invite.")
|
|
322
|
-
),
|
|
322
|
+
message: errorMessage(error, t(normalizedDecision === "accept" ? "jskit.workspaces.workspacesView.acceptFailed" : "jskit.workspaces.workspacesView.refuseFailed")),
|
|
323
323
|
severity: "error",
|
|
324
324
|
dedupeKey: `workspaces-web.workspaces-view:invite-${normalizedDecision}:${token}`
|
|
325
325
|
});
|
|
@@ -349,7 +349,7 @@ async function createWorkspace() {
|
|
|
349
349
|
const name = String(createWorkspaceModel.name || "").trim();
|
|
350
350
|
if (!name) {
|
|
351
351
|
reportFeedback({
|
|
352
|
-
message: "
|
|
352
|
+
message: t("jskit.workspaces.workspacesView.nameRequired"),
|
|
353
353
|
severity: "error",
|
|
354
354
|
dedupeKey: "workspaces-web.workspaces-view:create-workspace-name-required"
|
|
355
355
|
});
|
|
@@ -368,7 +368,7 @@ async function createWorkspace() {
|
|
|
368
368
|
createWorkspaceModel.slug = "";
|
|
369
369
|
} catch (error) {
|
|
370
370
|
reportFeedback({
|
|
371
|
-
message:
|
|
371
|
+
message: errorMessage(error, t("jskit.workspaces.workspacesView.createFailed")),
|
|
372
372
|
severity: "error",
|
|
373
373
|
dedupeKey: "workspaces-web.workspaces-view:create-workspace-error"
|
|
374
374
|
});
|
|
@@ -416,8 +416,8 @@ watch(
|
|
|
416
416
|
<v-container class="mx-auto" max-width="860">
|
|
417
417
|
<v-sheet rounded="lg" border class="workspaces-view__panel">
|
|
418
418
|
<header class="workspaces-view__header">
|
|
419
|
-
<h1 class="workspaces-view__title">
|
|
420
|
-
<p class="text-body-2 text-medium-emphasis mb-0">
|
|
419
|
+
<h1 class="workspaces-view__title">{{ t("jskit.workspaces.workspacesView.title") }}</h1>
|
|
420
|
+
<p class="text-body-2 text-medium-emphasis mb-0">{{ t("jskit.workspaces.workspacesView.subtitle") }}</p>
|
|
421
421
|
</header>
|
|
422
422
|
|
|
423
423
|
<div class="workspaces-view__body">
|
|
@@ -427,7 +427,7 @@ watch(
|
|
|
427
427
|
<v-skeleton-loader type="text, list-item-avatar-two-line@3" />
|
|
428
428
|
</template>
|
|
429
429
|
<div v-else-if="bootstrapLoadError" class="workspaces-view__state">
|
|
430
|
-
<h2 class="text-h6 mb-2">
|
|
430
|
+
<h2 class="text-h6 mb-2">{{ t("jskit.workspaces.workspacesView.loadFailedTitle") }}</h2>
|
|
431
431
|
<p class="text-body-2 text-medium-emphasis mb-4">{{ bootstrapLoadError }}</p>
|
|
432
432
|
<v-btn
|
|
433
433
|
color="primary"
|
|
@@ -435,18 +435,18 @@ watch(
|
|
|
435
435
|
:disabled="isRefreshingBootstrap"
|
|
436
436
|
@click="refreshBootstrap"
|
|
437
437
|
>
|
|
438
|
-
{{ isRefreshingBootstrap ? "
|
|
438
|
+
{{ t(isRefreshingBootstrap ? "jskit.workspaces.common.retrying" : "jskit.workspaces.common.retry") }}
|
|
439
439
|
</v-btn>
|
|
440
440
|
</div>
|
|
441
441
|
<template v-else>
|
|
442
|
-
<div class="text-subtitle-2 mb-2">
|
|
442
|
+
<div class="text-subtitle-2 mb-2">{{ t("jskit.workspaces.common.workspaces") }}</div>
|
|
443
443
|
<template v-if="workspaceItems.length === 0">
|
|
444
|
-
<p class="text-body-1 mb-2">
|
|
444
|
+
<p class="text-body-1 mb-2">{{ t("jskit.workspaces.workspacesView.noWorkspace") }}</p>
|
|
445
445
|
<template v-if="canCreateWorkspace">
|
|
446
446
|
<v-text-field
|
|
447
447
|
v-model="createWorkspaceModel.name"
|
|
448
448
|
density="comfortable"
|
|
449
|
-
label="
|
|
449
|
+
:label="t('jskit.workspaces.workspacesView.nameLabel')"
|
|
450
450
|
variant="outlined"
|
|
451
451
|
hide-details
|
|
452
452
|
class="mb-2"
|
|
@@ -454,7 +454,7 @@ watch(
|
|
|
454
454
|
<v-text-field
|
|
455
455
|
v-model="createWorkspaceModel.slug"
|
|
456
456
|
density="comfortable"
|
|
457
|
-
label="
|
|
457
|
+
:label="t('jskit.workspaces.workspacesView.slugLabel')"
|
|
458
458
|
variant="outlined"
|
|
459
459
|
hide-details
|
|
460
460
|
class="mb-3"
|
|
@@ -465,11 +465,11 @@ watch(
|
|
|
465
465
|
:disabled="isCreatingWorkspace"
|
|
466
466
|
@click="createWorkspace"
|
|
467
467
|
>
|
|
468
|
-
{{ isCreatingWorkspace ? "
|
|
468
|
+
{{ t(isCreatingWorkspace ? "jskit.workspaces.workspacesView.creating" : "jskit.workspaces.workspacesView.create") }}
|
|
469
469
|
</v-btn>
|
|
470
470
|
</template>
|
|
471
471
|
<p v-else class="text-body-2 text-medium-emphasis mb-0">
|
|
472
|
-
|
|
472
|
+
{{ t("jskit.workspaces.workspacesView.askAdministrator") }}
|
|
473
473
|
</p>
|
|
474
474
|
</template>
|
|
475
475
|
|
|
@@ -481,8 +481,8 @@ watch(
|
|
|
481
481
|
:title="workspace.name"
|
|
482
482
|
:subtitle="
|
|
483
483
|
workspace.isAccessible
|
|
484
|
-
?
|
|
485
|
-
:
|
|
484
|
+
? t('jskit.workspaces.common.slugAndRole', { slug: workspace.slug, role: workspace.roleLabel || workspace.roleSid || 'member' })
|
|
485
|
+
: t('jskit.workspaces.workspacesView.unavailableOnSurface', { slug: workspace.slug })
|
|
486
486
|
"
|
|
487
487
|
class="px-0"
|
|
488
488
|
>
|
|
@@ -514,9 +514,9 @@ watch(
|
|
|
514
514
|
<v-skeleton-loader type="text, list-item-two-line@3" />
|
|
515
515
|
</template>
|
|
516
516
|
<template v-else>
|
|
517
|
-
<div class="text-subtitle-2 mb-2">
|
|
517
|
+
<div class="text-subtitle-2 mb-2">{{ t("jskit.workspaces.common.invitations") }}</div>
|
|
518
518
|
<template v-if="pendingInvites.length === 0">
|
|
519
|
-
<p class="text-body-2 text-medium-emphasis mb-0">
|
|
519
|
+
<p class="text-body-2 text-medium-emphasis mb-0">{{ t("jskit.workspaces.common.noPendingInvitations") }}</p>
|
|
520
520
|
</template>
|
|
521
521
|
|
|
522
522
|
<template v-else>
|
|
@@ -525,12 +525,12 @@ watch(
|
|
|
525
525
|
v-for="invite in pendingInvites"
|
|
526
526
|
:key="invite.id"
|
|
527
527
|
:title="invite.workspaceName"
|
|
528
|
-
:subtitle="
|
|
528
|
+
:subtitle="t('jskit.workspaces.common.role', { role: invite.roleLabel || invite.roleSid })"
|
|
529
529
|
class="px-0"
|
|
530
530
|
>
|
|
531
531
|
<template #prepend>
|
|
532
532
|
<v-avatar color="warning" size="28">
|
|
533
|
-
<span class="text-caption font-weight-bold"
|
|
533
|
+
<span class="text-caption font-weight-bold">{{ t("jskit.workspaces.common.pendingInviteMark") }}</span>
|
|
534
534
|
</v-avatar>
|
|
535
535
|
</template>
|
|
536
536
|
<template #append>
|
|
@@ -542,7 +542,7 @@ watch(
|
|
|
542
542
|
:disabled="isRespondingToInvite(invite, 'refuse')"
|
|
543
543
|
@click="refuseInvite(invite)"
|
|
544
544
|
>
|
|
545
|
-
{{ isRespondingToInvite(invite, "refuse") ? "
|
|
545
|
+
{{ t(isRespondingToInvite(invite, "refuse") ? "jskit.workspaces.common.refusing" : "jskit.workspaces.common.refuse") }}
|
|
546
546
|
</v-btn>
|
|
547
547
|
<v-btn
|
|
548
548
|
size="small"
|
|
@@ -551,7 +551,7 @@ watch(
|
|
|
551
551
|
:disabled="isRespondingToInvite(invite, 'accept')"
|
|
552
552
|
@click="acceptInvite(invite)"
|
|
553
553
|
>
|
|
554
|
-
{{ isRespondingToInvite(invite, "accept") ? "
|
|
554
|
+
{{ t(isRespondingToInvite(invite, "accept") ? "jskit.workspaces.common.joining" : "jskit.workspaces.common.join") }}
|
|
555
555
|
</v-btn>
|
|
556
556
|
</div>
|
|
557
557
|
</template>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveSurfaceIdFromPlacementPathname
|
|
3
3
|
} from "@jskit-ai/shell-web/client/placement";
|
|
4
|
+
import { useJskitText } from "../i18n.js";
|
|
4
5
|
import { resolveWorkspaceShellLinkPath } from "./workspaceLinkResolver.js";
|
|
5
6
|
import { resolveSurfaceSwitchTargetsFromPlacementContext } from "./workspaceSurfaceContext.js";
|
|
6
7
|
import { evaluateSurfaceAccess, hasWorkspaceMembership } from "./surfaceAccessPolicy.js";
|
|
@@ -71,12 +72,13 @@ function shouldIncludeSurfaceSwitchTarget(surfaceDefinition = null) {
|
|
|
71
72
|
|
|
72
73
|
function resolveSurfaceSwitchLinkLabel(surfaceDefinition = null, surfaceId = "") {
|
|
73
74
|
const normalizedSurfaceId = String(surfaceId || "").trim();
|
|
74
|
-
const
|
|
75
|
+
const { t, text } = useJskitText();
|
|
76
|
+
const configuredLabel = text(surfaceDefinition?.label).trim();
|
|
75
77
|
const label = configuredLabel || normalizedSurfaceId;
|
|
76
78
|
if (!label) {
|
|
77
|
-
return "
|
|
79
|
+
return t("jskit.workspaces.menu.goToAnySurface");
|
|
78
80
|
}
|
|
79
|
-
return
|
|
81
|
+
return t("jskit.workspaces.menu.goToSurface", { surface: label.toLowerCase() });
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
function resolveSurfaceSwitchLinks({ context, surface } = {}) {
|
|
@@ -19,7 +19,9 @@ test("workspaces-web exports are explicit and aligned with production usage", ()
|
|
|
19
19
|
"./client/components/WorkspaceInviteLanding",
|
|
20
20
|
"./client/components/WorkspacesClientElement",
|
|
21
21
|
"./client/providers/WorkspacesWebClientProvider",
|
|
22
|
-
"./client/composables/useWorkspaceRouteContext"
|
|
22
|
+
"./client/composables/useWorkspaceRouteContext",
|
|
23
|
+
// The generated client bootstrap registers it.
|
|
24
|
+
"./locales/en.json"
|
|
23
25
|
]
|
|
24
26
|
});
|
|
25
27
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import test from "node:test";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { evaluateI18nCatalogContract } from "../../../tooling/test-support/i18nCatalogContract.mjs";
|
|
6
|
+
|
|
7
|
+
const TEST_DIRECTORY = path.dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const REPO_ROOT = path.resolve(TEST_DIRECTORY, "..", "..", "..");
|
|
9
|
+
|
|
10
|
+
test("workspaces-web English catalog matches its source", () => {
|
|
11
|
+
const { problems } = evaluateI18nCatalogContract({
|
|
12
|
+
repoRoot: REPO_ROOT,
|
|
13
|
+
packageDir: path.join(REPO_ROOT, "packages", "workspaces-web")
|
|
14
|
+
});
|
|
15
|
+
assert.deepEqual(problems, []);
|
|
16
|
+
});
|