@jskit-ai/workspaces-web 0.1.230 → 0.2.1

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.
@@ -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: "Unable to load workspaces.",
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: "Unable to respond to invitation.",
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: "Unable to respond to invitation."
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: "Unable to create workspace.",
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: "Unable to create workspace."
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 "Unavailable";
232
+ return t("jskit.workspaces.workspacesView.unavailable");
231
233
  }
232
- return selectingWorkspaceSlug.value === workspace.slug ? "Opening…" : "Open";
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: "Workspace surface is not configured.",
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("Workspace navigation is unavailable.");
270
+ throw new Error(t("jskit.workspaces.workspacesView.navigationUnavailable"));
269
271
  }
270
272
  } catch (error) {
271
273
  reportFeedback({
272
- message: String(error?.message || "Unable to open workspace."),
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: "Invitation refused.",
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: String(
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: "Workspace name is required.",
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: String(error?.message || "Unable to create workspace."),
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">Your workspaces</h1>
420
- <p class="text-body-2 text-medium-emphasis mb-0">Select a workspace or respond to invitations.</p>
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">Unable to load workspaces</h2>
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 ? "Retrying…" : "Retry" }}
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">Workspaces</div>
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">You do not have a workspace yet.</p>
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="Workspace name"
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="Slug (optional)"
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 ? "Creating…" : "Create Workspace" }}
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
- Ask an administrator for an invite, or create one after policy is enabled.
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
- ? `/${workspace.slug} • role: ${workspace.roleLabel || workspace.roleSid || 'member'}`
485
- : `/${workspace.slug} • unavailable on this surface`
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">Invitations</div>
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">No pending invitations.</p>
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="`Role: ${invite.roleLabel || invite.roleSid}`"
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">?</span>
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") ? "Refusing…" : "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") ? "Joining…" : "Join" }}
554
+ {{ t(isRespondingToInvite(invite, "accept") ? "jskit.workspaces.common.joining" : "jskit.workspaces.common.join") }}
555
555
  </v-btn>
556
556
  </div>
557
557
  </template>
@@ -0,0 +1,6 @@
1
+ import { registerJskitMessages, useJskitText } from "@jskit-ai/kernel/client";
2
+ import en from "../../locales/en.json" with { type: "json" };
3
+
4
+ registerJskitMessages(en);
5
+
6
+ export { useJskitText };
@@ -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 configuredLabel = String(surfaceDefinition?.label || "").trim();
75
+ const { t, text } = useJskitText();
76
+ const configuredLabel = text(surfaceDefinition?.label).trim();
75
77
  const label = configuredLabel || normalizedSurfaceId;
76
78
  if (!label) {
77
- return "Go to surface";
79
+ return t("jskit.workspaces.menu.goToAnySurface");
78
80
  }
79
- return `Go to ${label.toLowerCase()}`;
81
+ return t("jskit.workspaces.menu.goToSurface", { surface: label.toLowerCase() });
80
82
  }
81
83
 
82
84
  function resolveSurfaceSwitchLinks({ context, surface } = {}) {
@@ -1,6 +1,7 @@
1
1
  const ADMIN_COG_OUTLET = Object.freeze({
2
2
  target: "admin-cog:primary-menu",
3
- ariaLabel: "Admin cog"
3
+ // A message key; renderers translate it with useJskitText().text().
4
+ ariaLabel: "jskit.workspaces.tools.adminCog"
4
5
  });
5
6
 
6
7
  export { ADMIN_COG_OUTLET };
@@ -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
+ });