camox 0.72.0 → 0.74.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.
Files changed (36) hide show
  1. package/dist/features/preview/components/PageInfo.js +121 -98
  2. package/dist/features/preview/components/SelectionEditor.js +1 -1
  3. package/dist/features/routes/pageRuntime.js +15 -4
  4. package/dist/features/runtime/ClaimCard.js +192 -0
  5. package/dist/features/runtime/pageApp.js +4 -3
  6. package/dist/features/runtime/runtime.js +26 -5
  7. package/dist/features/runtime/worker.js +2 -2
  8. package/dist/features/runtime/workerRequest.d.ts +6 -0
  9. package/dist/features/runtime/workerRequest.js +13 -1
  10. package/dist/features/runtime/workerRuntime.d.ts +2 -2
  11. package/dist/features/runtime/workerRuntime.js +2 -2
  12. package/dist/features/studio/components/AgentSidebar.js +7 -7
  13. package/dist/features/studio/components/ChatWidget.js +142 -106
  14. package/dist/features/studio/components/ContentFindings.js +127 -230
  15. package/dist/features/studio/components/DeleteDraftDialog.js +112 -0
  16. package/dist/features/studio/components/DraftBar.js +98 -53
  17. package/dist/features/studio/components/DraftsControl.js +203 -190
  18. package/dist/features/studio/components/ReviewDraftDialog.js +670 -0
  19. package/dist/features/studio/components/{Patrol.js → Specialists.js} +291 -330
  20. package/dist/features/studio/components/Squareling.js +5 -5
  21. package/dist/features/studio/components/ThreadComposer.js +106 -127
  22. package/dist/features/studio/components/ThreadMessages.js +94 -69
  23. package/dist/features/studio/findingSentence.js +14 -12
  24. package/dist/features/studio/fixMessage.js +23 -0
  25. package/dist/features/studio/reportSentence.js +1 -1
  26. package/dist/features/studio/{patrollerBio.js → specialistBio.js} +8 -5
  27. package/dist/features/studio/studioStore.js +29 -15
  28. package/dist/features/studio/workingSentence.js +1 -1
  29. package/dist/lib/api-client.js +5 -1
  30. package/dist/lib/queries.js +5 -5
  31. package/dist/lib/studio-reads.d.ts +1 -1
  32. package/dist/lib/studio-reads.js +5 -5
  33. package/dist/package.js +1 -1
  34. package/dist/studio.css +1 -1
  35. package/package.json +4 -4
  36. package/dist/features/studio/components/ReviewDraftSheet.js +0 -1587
@@ -1,5 +1,5 @@
1
1
  import { localeName } from "./localeOptions.js";
2
- import { reportLocale } from "@camox/api-contract/patrol";
2
+ import { reportLocale } from "@camox/api-contract/specialists";
3
3
 
4
4
  //#region src/features/studio/reportSentence.ts
5
5
  const PHRASES = {
@@ -1,16 +1,16 @@
1
- //#region src/features/studio/patrollerBio.ts
2
- /** What each patroller does, wherever it works. */
1
+ //#region src/features/studio/specialistBio.ts
2
+ /** What each specialist does, wherever it works. */
3
3
  const ABOUT = {
4
4
  seoManager: "Writes what search engines read: each page's SEO, and each file's alt text and filename.",
5
5
  translator: "Translates your website from its default language into every other one, so that each stays complete.",
6
6
  linkChecker: "Looks for links that lead nowhere, to your own pages or elsewhere, and suggests a fix when it can."
7
7
  };
8
- /** What a patroller does, as its profile card introduces it. */
8
+ /** What a specialist does, as its profile card introduces it. */
9
9
  function aboutSentence(id) {
10
10
  return ABOUT[id];
11
11
  }
12
12
  /**
13
- * When a patroller works where the editor is, by its duty there, in a draft or on Live, as its
13
+ * When a specialist works where the editor is, by its duty there, in a draft or on Live, as its
14
14
  * card's tag says it, and whether it runs there at all. In a project with a single locale, the
15
15
  * Translator waits for a second one.
16
16
  */
@@ -23,12 +23,15 @@ function whenTag(id, duty, inDraft, singleLocale) {
23
23
  label: "Runs once you add a language",
24
24
  runs: false
25
25
  };
26
- if (duty === "atPublish") return runs("Runs when you publish");
27
26
  if (duty === "asYouGo") {
28
27
  if (inDraft) return runs("Runs as you edit");
29
28
  if (id === "linkChecker") return runs("Runs every 6 hours");
30
29
  return runs("Runs while a release is translated");
31
30
  }
31
+ if (inDraft) return {
32
+ label: "Runs on Live only",
33
+ runs: false
34
+ };
32
35
  return {
33
36
  label: "Doesn't run on Live",
34
37
  runs: false
@@ -5,12 +5,13 @@ const studioStore = createStore({
5
5
  context: {
6
6
  isCommandPaletteOpen: false,
7
7
  commandPalettePages: [],
8
- isReviewDraftSheetOpen: false,
8
+ isReviewDraftDialogOpen: false,
9
9
  isDeleteDraftDialogOpen: false,
10
10
  localeDialog: null,
11
11
  websiteLocation: null,
12
- agentAsk: null,
13
- agentAsks: 0
12
+ agentMessages: [],
13
+ agentMessagesSent: 0,
14
+ agentWorkingIn: null
14
15
  },
15
16
  on: {
16
17
  openCommandPalette: (context) => {
@@ -45,16 +46,16 @@ const studioStore = createStore({
45
46
  commandPalettePages: context.commandPalettePages.slice(0, -1)
46
47
  };
47
48
  },
48
- openReviewDraftSheet: (context) => {
49
+ openReviewDraftDialog: (context) => {
49
50
  return {
50
51
  ...context,
51
- isReviewDraftSheetOpen: true
52
+ isReviewDraftDialogOpen: true
52
53
  };
53
54
  },
54
- closeReviewDraftSheet: (context) => {
55
+ closeReviewDraftDialog: (context) => {
55
56
  return {
56
57
  ...context,
57
- isReviewDraftSheetOpen: false
58
+ isReviewDraftDialogOpen: false
58
59
  };
59
60
  },
60
61
  openDeleteDraftDialog: (context) => {
@@ -81,21 +82,34 @@ const studioStore = createStore({
81
82
  localeDialog: null
82
83
  };
83
84
  },
84
- askAgent: (context, event) => {
85
+ sendToAgent: (context, event) => {
86
+ const id = context.agentMessagesSent + 1;
85
87
  return {
86
88
  ...context,
87
- isReviewDraftSheetOpen: false,
88
- agentAsk: {
89
+ isReviewDraftDialogOpen: false,
90
+ agentMessages: [...context.agentMessages, {
89
91
  text: event.text,
90
- id: context.agentAsks + 1
91
- },
92
- agentAsks: context.agentAsks + 1
92
+ id
93
+ }],
94
+ agentMessagesSent: id
93
95
  };
94
96
  },
95
- takeAgentAsk: (context) => {
97
+ takeAgentMessage: (context, event) => {
98
+ if (!context.agentMessages.some((message) => message.id === event.id)) return context;
96
99
  return {
97
100
  ...context,
98
- agentAsk: null
101
+ agentMessages: context.agentMessages.filter((message) => message.id !== event.id)
102
+ };
103
+ },
104
+ agentWorking: (context, event) => {
105
+ if (event.working) return {
106
+ ...context,
107
+ agentWorkingIn: event.draftId
108
+ };
109
+ if (context.agentWorkingIn !== event.draftId) return context;
110
+ return {
111
+ ...context,
112
+ agentWorkingIn: null
99
113
  };
100
114
  },
101
115
  rememberWebsiteLocation: (context, event) => {
@@ -35,7 +35,7 @@ function inLocales(locales, preposition) {
35
35
  return listed(parts);
36
36
  }
37
37
  /**
38
- * What a patroller is working on: "Translating hero into Spanish" for one subject, "Translating
38
+ * What a specialist is working on: "Translating hero into Spanish" for one subject, "Translating
39
39
  * 38 items into German and 12 into Spanish" for a burst, counted in each locale.
40
40
  */
41
41
  function workingSentence(id, working) {
@@ -61,6 +61,10 @@ function createStudioClient(apiUrl, draftHeaders) {
61
61
  });
62
62
  return createORPCClient(link);
63
63
  }
64
+ function getApiClient() {
65
+ if (!_client) throw new Error("API client not initialized — call initApiClient first");
66
+ return _client;
67
+ }
64
68
  function getOrpc() {
65
69
  if (!_orpc) throw new Error("API client not initialized — call initApiClient first");
66
70
  return _orpc;
@@ -79,4 +83,4 @@ function getContentWriteHeaders() {
79
83
  }
80
84
 
81
85
  //#endregion
82
- export { getApiUrl, getContentWriteHeaders, getDraftReadClient, getOrpc, initApiClient };
86
+ export { getApiClient, getApiUrl, getContentWriteHeaders, getDraftReadClient, getOrpc, initApiClient };
@@ -51,12 +51,12 @@ const draftMutations = {
51
51
  revertToLive: () => getOrpc().drafts.revertToLive.mutationOptions()
52
52
  };
53
53
  /**
54
- * What members do with a patroller's finding (ADR 0034): apply its fix in the draft viewed, or
54
+ * What members do with a specialist's finding (ADR 0034): apply its fix in the draft viewed, or
55
55
  * dismiss it for the whole project.
56
56
  */
57
- const patrolMutations = {
58
- applyFix: () => getOrpc().patrol.applyFix.mutationOptions(),
59
- dismissFinding: () => getOrpc().patrol.dismissFinding.mutationOptions()
57
+ const specialistMutations = {
58
+ applyFix: () => getOrpc().specialists.applyFix.mutationOptions(),
59
+ dismissFinding: () => getOrpc().specialists.dismissFinding.mutationOptions()
60
60
  };
61
61
  /** Adding and removing locales: content writes, so on Live they start a draft (ADR 0015). */
62
62
  const localeMutations = {
@@ -138,4 +138,4 @@ const fileMutations = {
138
138
  };
139
139
 
140
140
  //#endregion
141
- export { blockMutations, collectionMutations, draftMutations, fileMutations, localeMutations, pageMutations, patrolMutations, projectMutations, repeatableItemMutations };
141
+ export { blockMutations, collectionMutations, draftMutations, fileMutations, localeMutations, pageMutations, projectMutations, repeatableItemMutations, specialistMutations };
@@ -6,7 +6,7 @@ import { ApiClient } from "./api-client.js";
6
6
  import "./queries.js";
7
7
  import "react";
8
8
  import "@camox/api-contract/query-keys";
9
- import "@camox/api-contract/patrol";
9
+ import "@camox/api-contract/specialists";
10
10
  import { QueryClient } from "@tanstack/react-query";
11
11
  //#region src/lib/studio-reads.d.ts
12
12
  type LayoutRead = Awaited<ReturnType<ApiClient["layouts"]["get"]>>;
@@ -6,7 +6,7 @@ import { useSwitchHold } from "./view-switch.js";
6
6
  import { c } from "react/compiler-runtime";
7
7
  import * as React from "react";
8
8
  import { inScope, queryKeys, scopeOfKey } from "@camox/api-contract/query-keys";
9
- import { PATROLLER_IDS } from "@camox/api-contract/patrol";
9
+ import { SPECIALIST_IDS } from "@camox/api-contract/specialists";
10
10
  import { useQueries, useQuery, useQueryClient, useSuspenseQuery } from "@tanstack/react-query";
11
11
 
12
12
  //#region src/lib/studio-reads.ts
@@ -203,12 +203,12 @@ const reads = {
203
203
  fetch: ({ apiIn, signal }, { projectId, draftId }) => apiIn(draftId).drafts.get({ projectId }, { signal }),
204
204
  staleTime: Infinity
205
205
  }),
206
- patrol: entry({
207
- key: ({ projectId }) => [...queryKeys.patrol.get, projectId],
206
+ specialists: entry({
207
+ key: ({ projectId }) => [...queryKeys.specialists.get, projectId],
208
208
  everyLocale: true,
209
- fetch: ({ api, signal }, { projectId }) => api.patrol.get({
209
+ fetch: ({ api, signal }, { projectId }) => api.specialists.get({
210
210
  projectId,
211
- patrollers: [...PATROLLER_IDS]
211
+ specialists: [...SPECIALIST_IDS]
212
212
  }, { signal })
213
213
  }),
214
214
  publishPreview: entry({
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.72.0";
2
+ var version = "0.74.1";
3
3
 
4
4
  //#endregion
5
5
  export { version };