@bison-lab/payload-core 4.40.0 → 5.1.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/README.md +47 -4
- package/dist/admin.d.mts +21 -1
- package/dist/admin.d.mts.map +1 -1
- package/dist/admin.mjs +270 -5
- package/dist/admin.mjs.map +1 -1
- package/dist/{capability-DdnN7AHB.mjs → capability-Cb62lWQo.mjs} +1392 -32
- package/dist/capability-Cb62lWQo.mjs.map +1 -0
- package/dist/{capability-BVDhJV8A.d.mts → capability-Dotbq58Q.d.mts} +85 -9
- package/dist/capability-Dotbq58Q.d.mts.map +1 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/locale-B6rUVwpg.mjs.map +1 -1
- package/dist/{locale-5z7KTvRJ.d.mts → locale-CTT3nn6T.d.mts} +5 -4
- package/dist/locale-CTT3nn6T.d.mts.map +1 -0
- package/dist/{messages-Bk1uYO3o.mjs → messages-dZV_aAnR.mjs} +2 -2
- package/dist/{messages-Bk1uYO3o.mjs.map → messages-dZV_aAnR.mjs.map} +1 -1
- package/dist/navigation.d.mts +2 -2
- package/dist/og.d.mts +1 -1
- package/dist/{published-CY5PIy5W.d.mts → published-B3etM6X5.d.mts} +2 -2
- package/dist/{published-CY5PIy5W.d.mts.map → published-B3etM6X5.d.mts.map} +1 -1
- package/dist/{published-BC8kg47c.d.mts → published-QDNmDi02.d.mts} +2 -2
- package/dist/{published-BC8kg47c.d.mts.map → published-QDNmDi02.d.mts.map} +1 -1
- package/dist/{strings-Bafwdg67.mjs → strings-Fd7kUCT7.mjs} +4 -4
- package/dist/strings-Fd7kUCT7.mjs.map +1 -0
- package/dist/theme.d.mts +2 -2
- package/dist/translate-messages-cli.mjs +3 -3
- package/dist/translate-messages-cli.mjs.map +1 -1
- package/dist/translate.d.mts +366 -6
- package/dist/translate.d.mts.map +1 -1
- package/dist/translate.mjs +238 -5
- package/dist/translate.mjs.map +1 -1
- package/package.json +8 -10
- package/dist/capability-BVDhJV8A.d.mts.map +0 -1
- package/dist/capability-DdnN7AHB.mjs.map +0 -1
- package/dist/locale-5z7KTvRJ.d.mts.map +0 -1
- package/dist/strings-Bafwdg67.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ lockstep.
|
|
|
33
33
|
| `@bison-lab/payload-core/taxonomy` | `facetField`, `FacetEntry` | Anywhere. What a block config imports to tag content from a taxonomy; no plugin, no React, so a browser bundle can take it (`@bison-lab/payload-blocks` main entry reaches the docs island and Storybook). |
|
|
34
34
|
| `@bison-lab/payload-core/block-thumbnails` | `captureThumbnails`, `thumbnailCss`, `NEUTRAL_THEME`, `thumbnailVersion`; the `bison-block-thumbnails` bin | Node, beside Playwright. What a site's thumbnail script imports; no Payload, no React. |
|
|
35
35
|
| `@bison-lab/payload-core/wireframe` | Deprecated: the 4.15 wireframe generator and the `bison-wireframes` bin | Node. Kept for one release so a site's script keeps working; use `./block-thumbnails`. Goes in the next major. |
|
|
36
|
-
| `@bison-lab/payload-core/translate` | `applyTranslation` / `translation`, the deprecated `autoTranslate`, `anthropicTranslator`, `translateDocument`, `translateStrings`, the settings readers and key helpers, `BisonTranslationMarker`, the test seam (`readTranslateState`, `withTranslator`), the guard and walk helpers; the `bison-translate-messages` bin | Node. What `payload.config.ts` and a seed script import (#278); no React. `@anthropic-ai/sdk` is
|
|
36
|
+
| `@bison-lab/payload-core/translate` | `applyTranslation` / `translation`, the deprecated `autoTranslate`, `anthropicTranslator`, `translateDocument`, `translateStrings`, the settings readers and key helpers, `BisonTranslationMarker`, the languages (`LIBRARY_LOCALES`, `activeLocales`, `inactiveLocaleRedirect`, `activeAlternates`), the `localizeExistingContent` migration and `isLocalizedPath`, the test seam (`readTranslateState`, `withTranslator`), the guard and walk helpers; the `bison-translate-messages` bin | Node. What `payload.config.ts` and a seed script import (#278); no React. `@anthropic-ai/sdk` is a required peer (every site has translation), imported on the first translation. |
|
|
37
37
|
| `@bison-lab/payload-core/admin` | Theme fields, the Roles and Features matrices, the Block library field, Admin nav, the Users Roles checklist, the FAQ Library list, "Translate now" (`TranslateNowMenuItem`) and the Translation key panel (`TranslationKeyPanel`) | Admin. Referenced by import-map string; `generate:importmap` writes it. |
|
|
38
38
|
| `@bison-lab/payload-core/react` | `BlockLibraryIsland`; `ThemePreview` (legacy; Theme has no preview pane) | Client. What a Block library preview route wraps its sample in. |
|
|
39
39
|
|
|
@@ -256,7 +256,9 @@ export async function up({ payload }) {
|
|
|
256
256
|
|
|
257
257
|
**3. Serve the catalogue.** A Next route around `serveFont` from
|
|
258
258
|
`@bison-lab/fonts/server`, listed in `serverExternalPackages`, at the path
|
|
259
|
-
you pass as `fontsBaseUrl` (default `/fonts`)
|
|
259
|
+
you pass as `fontsBaseUrl` (default `/fonts`), with the package's `files/`
|
|
260
|
+
folder in that route's `outputFileTracingIncludes` (see the fonts README;
|
|
261
|
+
without it a deploy answers 500 for every font).
|
|
260
262
|
|
|
261
263
|
**4. Render the published theme in the root layout.**
|
|
262
264
|
|
|
@@ -826,8 +828,9 @@ title and description (and the plugin's share image, its own setting), a
|
|
|
826
828
|
FAQ Library `question`, `answer` and `answerText`, a taxonomy term's
|
|
827
829
|
`name`, Header and Footer link labels, footer section headings and the
|
|
828
830
|
text below the logo, and a Media `alt`. Slugs, links, social URLs and
|
|
829
|
-
settings are shared.
|
|
830
|
-
|
|
831
|
+
settings are shared. Every site has `localization` (the library's
|
|
832
|
+
languages, #297), so these fields live in the `_locales` tables; a site
|
|
833
|
+
coming from one locale runs `localizeExistingContent` once.
|
|
831
834
|
`getNavigation` and `getPublishedIdentity` take the request's `locale` and
|
|
832
835
|
`fallbackLocale` (`LocaleRead`, exported from `./navigation` and
|
|
833
836
|
`./theme`). `src/__tests__/localized.test.ts` lists the localized paths.
|
|
@@ -882,6 +885,46 @@ the translator with `readTranslateState` / `withTranslator`; a test
|
|
|
882
885
|
translator still needs the switch on. See
|
|
883
886
|
[Auto-translation](https://payload.bisonlab.ai/site/auto-translate/).
|
|
884
887
|
|
|
888
|
+
### Languages (#297)
|
|
889
|
+
|
|
890
|
+
`LIBRARY_LOCALES` (English default, Spanish) is the list every site
|
|
891
|
+
carries: `applyTranslation` puts them into `localization` with
|
|
892
|
+
`withLibraryLocales`, keeping a site's own. The ticks on Settings →
|
|
893
|
+
Translation (`languages`, with a server-set `languagesChosen`; until it is
|
|
894
|
+
set the defaults apply, and a site's own declared target locales are the
|
|
895
|
+
defaults) decide which target languages are translated and live.
|
|
896
|
+
`activeLocales(payload)` caches the answer per process
|
|
897
|
+
(`ACTIVE_LOCALES_CACHE_MS`, cleared by a save in the same process) for
|
|
898
|
+
middleware; `inactiveLocaleRedirect` and `activeAlternates` are the 308 and
|
|
899
|
+
the switcher/hreflang filter; `GET /api/translation/locales` serves it to an
|
|
900
|
+
edge runtime. `localizeExistingContent` is the one-to-several locale data
|
|
901
|
+
migration: it runs the generated SQL with every `DROP COLUMN` / `DROP TYPE`
|
|
902
|
+
moved last and each moving column copied into `<table>_locales` first.
|
|
903
|
+
It also sets the default locale on the new `locale` column of `_rels` / `_texts` / `_numbers` rows whose `path` is a localized field (`isLocalizedPath` over the migration's `payload.config`), and stops when such rows exist without it. Postgres only. `pnpm --filter @bison-lab/payload-core test:postgres` runs it against a local Postgres with recorded `migrate:create` output (`src/__tests__/fixtures/localize/`); the normal suite skips it.
|
|
904
|
+
|
|
905
|
+
### Jobs, usage and failures (#295, #296)
|
|
906
|
+
|
|
907
|
+
`translate/jobs.ts`: a hidden `translation-jobs` collection holds each job's
|
|
908
|
+
queue of documents and a cursor, saved after every document. `runJobSlice`
|
|
909
|
+
runs for `RUN_BUDGET_MS`, re-reading the job, the switch and the recorded
|
|
910
|
+
failure before each document; `continueJob` hands on with a POST to
|
|
911
|
+
`/api/translation/jobs/run` signed with an HMAC of `PAYLOAD_SECRET`, and
|
|
912
|
+
`resumeStaleJobs` (from `onInit` and the jobs endpoint) restarts a job whose
|
|
913
|
+
lease lapsed. One runner holds a job: `claimJob` and every lease-guarded
|
|
914
|
+
write go through `compareAndSet` (`translate/cas.ts`), a parameterized
|
|
915
|
+
`UPDATE … WHERE … ` on the Postgres pool, because Payload's update-by-where
|
|
916
|
+
reads then writes and lets two writers win; the usage counter uses it too.
|
|
917
|
+
A stopping failure pauses the job on its document; any other failure skips
|
|
918
|
+
and counts it. The settings Global's afterChange starts
|
|
919
|
+
`startBackfill` on switch-on and pauses running jobs on switch-off, past
|
|
920
|
+
the commit. Frozen-word fix is `translationJob({ force })`. `translate/usage.ts`:
|
|
921
|
+
`translation-usage` rows per month (`recordUsage`, from the screen
|
|
922
|
+
translator's `onCall`), `nextFailure` (out of credit and 401 at once, 429
|
|
923
|
+
after `RATE_LIMIT_STREAK`), and the cap check in `settingsTranslator`. The
|
|
924
|
+
failure sits on `translation-state` and clears on success.
|
|
925
|
+
`TranslationStatusBar` is added to `admin.components.header` and asks
|
|
926
|
+
`/api/translation/summary` (grant holders only).
|
|
927
|
+
|
|
885
928
|
## No generated types
|
|
886
929
|
|
|
887
930
|
The package cannot import a site's `payload-types`, so the shapes it reads
|
package/dist/admin.d.mts
CHANGED
|
@@ -411,5 +411,25 @@ declare function TranslateNowMenuItem({
|
|
|
411
411
|
*/
|
|
412
412
|
declare function TranslationKeyPanel(): react_jsx_runtime0.JSX.Element;
|
|
413
413
|
//#endregion
|
|
414
|
-
|
|
414
|
+
//#region src/admin/translation-activity-panel.d.ts
|
|
415
|
+
/**
|
|
416
|
+
* Usage, background jobs and the bulk buttons on Settings → Translation.
|
|
417
|
+
* Every bulk job shows its estimate ("about 2,100 strings across 85
|
|
418
|
+
* documents") and waits for a confirm before it starts; a running job's
|
|
419
|
+
* progress refreshes every few seconds; a paused one offers Resume.
|
|
420
|
+
*/
|
|
421
|
+
declare function TranslationActivityPanel(): react_jsx_runtime0.JSX.Element;
|
|
422
|
+
//#endregion
|
|
423
|
+
//#region src/admin/translation-status-bar.d.ts
|
|
424
|
+
/**
|
|
425
|
+
* The slim line across the admin (`admin.components.header`): this month's
|
|
426
|
+
* translated strings and estimated cost, and, while a failure is recorded
|
|
427
|
+
* (out of credit, a rejected key, persistent rate limits, the cap), a
|
|
428
|
+
* banner saying what to do. Asks `GET /api/translation/summary`, which
|
|
429
|
+
* answers only `translation` grant holders; for anyone else it renders
|
|
430
|
+
* nothing.
|
|
431
|
+
*/
|
|
432
|
+
declare function TranslationStatusBar(): react_jsx_runtime0.JSX.Element | null;
|
|
433
|
+
//#endregion
|
|
434
|
+
export { AdminNav, AdminNavEntityField, AdminNavItemRowLabel, AdminNavRowLabel, AppearanceField, BlockDrawerStyles, BlockLibraryField, ColorField, ColorScaleField, ContrastReport, DocumentCreateNew, DocumentTitleActions, FeaturesMatrixField, FontField, GreyScaleField, HiddenSaveButton, IdentityFallback, LibraryField, ListAlignStyles, LookField, MediaAltAutofill, MediaListView, PageSlugCell, PageTitleCell, PairingField, PublishChild, QuestionsList, RequiredPageCell, RequiredPageField, RichTextEditorFontStyles, RoleNameField, RoleSlugField, RolesCell, RolesField, RolesGrantsField, RolesMatrixField, RolesRowLabel, SectionHeading, SlugField, ThemeDocumentControls, ThemeSaveButton, TranslateNowMenuItem, TranslationActivityPanel, TranslationKeyPanel, TranslationStatusBar, setThemePreviewMode };
|
|
415
435
|
//# sourceMappingURL=admin.d.mts.map
|
package/dist/admin.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.d.mts","names":[],"sources":["../src/admin/color-field.tsx","../src/admin/color-scale-field.tsx","../src/admin/library-field.tsx","../src/admin/font-field.tsx","../src/admin/pairing-field.tsx","../src/admin/appearance-field.tsx","../src/admin/grey-scale-field.tsx","../src/admin/contrast-report.tsx","../src/admin/section-heading.tsx","../src/admin/publish-child.tsx","../src/admin/save-button.tsx","../src/admin/preview-mode.tsx","../src/admin/identity-fallback.tsx","../src/admin/look-field.tsx","../src/admin/roles-cell.tsx","../src/admin/roles-matrix-field.tsx","../src/admin/roles-row-label.tsx","../src/admin/role-slug-field.tsx","../src/admin/slug-field.tsx","../src/admin/page-title-cell.tsx","../src/admin/page-slug-cell.tsx","../src/admin/required-page-cell.tsx","../src/admin/role-name-field.tsx","../src/admin/roles-field.tsx","../src/admin/roles-grants-field.tsx","../src/admin/features-matrix-field.tsx","../src/admin/block-library-field.tsx","../src/admin/document-title-actions.tsx","../src/admin/list-align-styles.tsx","../src/admin/block-drawer-styles.tsx","../src/admin/rich-text-editor-font-styles.tsx","../src/admin/document-create-new.tsx","../src/admin-nav/types.ts","../src/admin/admin-nav.tsx","../src/admin/admin-nav-row-label.tsx","../src/admin/admin-nav-item-row-label.tsx","../src/admin/admin-nav-entity-field.tsx","../src/taxonomy/facet-field.ts","../src/questions/types.ts","../src/admin/questions-list.tsx","../src/admin/media-alt-autofill.tsx","../src/admin/media-list-view.tsx","../src/admin/translate-now.tsx","../src/admin/translation-key-panel.tsx"],"mappings":";;;;;;;;;;;cAWa,UAAA,EAAY,wBAAA;;;;;;;;cCuBZ,eAAA,EAAiB,yBAAA;;;;;;;;;cCMjB,YAAA,EAAc,yBAAA;;;;;;;;;cCtBd,SAAA,EAAW,0BAAA;;;;;;;cCNX,YAAA,EAAc,sBAAA;;;;;;;cCCd,eAAA,EAAiB,yBAAA;;;ALF9B;;;;AAAA,cM4Da,cAAA,EAAgB,0BAAA;;;;;;;cCnDhB,cAAA,EAAgB,sBAAA;;;;;;cCbhB,cAAA,EAAgB,sBAAA;;;cC0IhB,YAAA,EAAc,sBAAA;;;;;;;;iBCtIX,qBAAA,CAAA;;AVAhB;;;iBUQgB,eAAA,CAAA,GAAe,kBAAA,CAAA,GAAA,CAAA,OAAA;;iBA0Bf,gBAAA,CAAA,GAAgB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;KCpCpB,gBAAA;AAAA,iBAgDI,mBAAA,CAAoB,IAAA,EAAM,gBAAA;;;;;;;cCjD7B,gBAAA,EAAkB,sBAAA;;;;;;;cCIlB,SAAA,EAAW,wBAAA;;;;;;;;;iBCOR,SAA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1CXD;iB2CoBgB,mBAAA,CAAA,GAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
1
|
+
{"version":3,"file":"admin.d.mts","names":[],"sources":["../src/admin/color-field.tsx","../src/admin/color-scale-field.tsx","../src/admin/library-field.tsx","../src/admin/font-field.tsx","../src/admin/pairing-field.tsx","../src/admin/appearance-field.tsx","../src/admin/grey-scale-field.tsx","../src/admin/contrast-report.tsx","../src/admin/section-heading.tsx","../src/admin/publish-child.tsx","../src/admin/save-button.tsx","../src/admin/preview-mode.tsx","../src/admin/identity-fallback.tsx","../src/admin/look-field.tsx","../src/admin/roles-cell.tsx","../src/admin/roles-matrix-field.tsx","../src/admin/roles-row-label.tsx","../src/admin/role-slug-field.tsx","../src/admin/slug-field.tsx","../src/admin/page-title-cell.tsx","../src/admin/page-slug-cell.tsx","../src/admin/required-page-cell.tsx","../src/admin/role-name-field.tsx","../src/admin/roles-field.tsx","../src/admin/roles-grants-field.tsx","../src/admin/features-matrix-field.tsx","../src/admin/block-library-field.tsx","../src/admin/document-title-actions.tsx","../src/admin/list-align-styles.tsx","../src/admin/block-drawer-styles.tsx","../src/admin/rich-text-editor-font-styles.tsx","../src/admin/document-create-new.tsx","../src/admin-nav/types.ts","../src/admin/admin-nav.tsx","../src/admin/admin-nav-row-label.tsx","../src/admin/admin-nav-item-row-label.tsx","../src/admin/admin-nav-entity-field.tsx","../src/taxonomy/facet-field.ts","../src/questions/types.ts","../src/admin/questions-list.tsx","../src/admin/media-alt-autofill.tsx","../src/admin/media-list-view.tsx","../src/admin/translate-now.tsx","../src/admin/translation-key-panel.tsx","../src/admin/translation-activity-panel.tsx","../src/admin/translation-status-bar.tsx"],"mappings":";;;;;;;;;;;cAWa,UAAA,EAAY,wBAAA;;;;;;;;cCuBZ,eAAA,EAAiB,yBAAA;;;;;;;;;cCMjB,YAAA,EAAc,yBAAA;;;;;;;;;cCtBd,SAAA,EAAW,0BAAA;;;;;;;cCNX,YAAA,EAAc,sBAAA;;;;;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AA,SAAwB,UAAA;;;;;EAKvC,MAAA;;EAEA,IAAA,GAAO,cAAA;AAAA;;;iBCwKO,aAAA,CACd,KAAA,EAAO,mBAAA;EAAwB,UAAA,YAAsB,eAAA;AAAA,IAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;iBChM1D,gBAAA,CAAA;EAAmB;AAAA;EAAU,IAAA;AAAA;;;iBCmH7B,aAAA,CAAc,KAAA,EAAO,mBAAA,GAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;;;;AzCnHxD;iB0CEgB,oBAAA,CAAA;EACd,YAAA;EACA,aAAA;EACA;AAAA;EAEA,YAAA;EACA,aAAA,a1CiED;E0C/DC,UAAA;AAAA,IACD,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;;;;A1CXD;iB2CoBgB,mBAAA,CAAA,GAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;;;iBCWnB,wBAAA,CAAA,GAAwB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;A5C/BxC;;;;;iB6CuBgB,oBAAA,CAAA,GAAoB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/admin.mjs
CHANGED
|
@@ -7066,11 +7066,14 @@ function TranslateNowMenuItem({ sourceLocale, targetLocales = [], configured = t
|
|
|
7066
7066
|
const locale = useLocale();
|
|
7067
7067
|
const [busy, setBusy] = useState(false);
|
|
7068
7068
|
const [available, setAvailable] = useState(false);
|
|
7069
|
+
const [languages, setLanguages] = useState(targetLocales);
|
|
7069
7070
|
useEffect(() => {
|
|
7070
7071
|
if (!configured) return;
|
|
7071
7072
|
let cancelled = false;
|
|
7072
7073
|
fetch(`${config.serverURL ?? ""}${config.routes.api}/translation/available`, { credentials: "include" }).then((response) => response.ok ? response.json() : { available: false }).then((body) => {
|
|
7073
|
-
if (
|
|
7074
|
+
if (cancelled) return;
|
|
7075
|
+
setAvailable(body.available === true);
|
|
7076
|
+
if (Array.isArray(body.languages)) setLanguages(body.languages.filter((code) => typeof code === "string"));
|
|
7074
7077
|
}).catch(() => void 0);
|
|
7075
7078
|
return () => {
|
|
7076
7079
|
cancelled = true;
|
|
@@ -7082,7 +7085,7 @@ function TranslateNowMenuItem({ sourceLocale, targetLocales = [], configured = t
|
|
|
7082
7085
|
]);
|
|
7083
7086
|
if (!collectionSlug || !configured || !available) return null;
|
|
7084
7087
|
const viewing = locale && typeof locale === "object" ? locale.code : void 0;
|
|
7085
|
-
const into = viewing && viewing !== sourceLocale &&
|
|
7088
|
+
const into = viewing && viewing !== sourceLocale && languages.includes(viewing) ? viewing : void 0;
|
|
7086
7089
|
async function translate() {
|
|
7087
7090
|
if (!id || busy) return;
|
|
7088
7091
|
setBusy(true);
|
|
@@ -7109,7 +7112,7 @@ function TranslateNowMenuItem({ sourceLocale, targetLocales = [], configured = t
|
|
|
7109
7112
|
}
|
|
7110
7113
|
//#endregion
|
|
7111
7114
|
//#region src/admin/translation-key-panel.tsx
|
|
7112
|
-
const PANEL_CSS = `.bl-translation-key{padding:1rem 1.25rem;border:1px solid var(--theme-elevation-150,#e2e8f0);border-radius:8px;margin-block-end:1.5rem}.bl-translation-key__title{margin:0 0 .25rem;font-size:1rem;font-weight:600}.bl-translation-key__line{margin:0;font-size:14px;color:var(--theme-elevation-800,#1e293b)}.bl-translation-key__note{margin:0;font-size:13px;color:var(--theme-elevation-500,#64748b)}.bl-translation-key__warn{margin:0;font-size:14px;color:var(--theme-warning-650,#b45309)}.bl-translation-key__error{margin:0;font-size:14px;color:var(--theme-error-650,#b91c1c)}.bl-translation-key__row{display:flex;gap:.5rem;flex-wrap:wrap;align-items:flex-end}.bl-translation-key__row>:first-child{flex:1 1 18rem}`;
|
|
7115
|
+
const PANEL_CSS$1 = `.bl-translation-key{padding:1rem 1.25rem;border:1px solid var(--theme-elevation-150,#e2e8f0);border-radius:8px;margin-block-end:1.5rem}.bl-translation-key__title{margin:0 0 .25rem;font-size:1rem;font-weight:600}.bl-translation-key__line{margin:0;font-size:14px;color:var(--theme-elevation-800,#1e293b)}.bl-translation-key__note{margin:0;font-size:13px;color:var(--theme-elevation-500,#64748b)}.bl-translation-key__warn{margin:0;font-size:14px;color:var(--theme-warning-650,#b45309)}.bl-translation-key__error{margin:0;font-size:14px;color:var(--theme-error-650,#b91c1c)}.bl-translation-key__row{display:flex;gap:.5rem;flex-wrap:wrap;align-items:flex-end}.bl-translation-key__row>:first-child{flex:1 1 18rem}`;
|
|
7113
7116
|
const STATUS_WORDS = {
|
|
7114
7117
|
valid: "checked and working",
|
|
7115
7118
|
"out-of-credit": "its Anthropic account is out of credit",
|
|
@@ -7179,7 +7182,7 @@ function TranslationKeyPanel() {
|
|
|
7179
7182
|
return /* @__PURE__ */ jsxs(KitProvider, { children: [/* @__PURE__ */ jsx("style", {
|
|
7180
7183
|
href: "bl-translation-key",
|
|
7181
7184
|
precedence: "default",
|
|
7182
|
-
children: PANEL_CSS
|
|
7185
|
+
children: PANEL_CSS$1
|
|
7183
7186
|
}), /* @__PURE__ */ jsx("section", {
|
|
7184
7187
|
className: "bl-translation-key",
|
|
7185
7188
|
"aria-labelledby": "bl-translation-key-title",
|
|
@@ -7274,6 +7277,268 @@ function TranslationKeyPanel() {
|
|
|
7274
7277
|
})] });
|
|
7275
7278
|
}
|
|
7276
7279
|
//#endregion
|
|
7277
|
-
|
|
7280
|
+
//#region src/admin/translation-status-bar.tsx
|
|
7281
|
+
const BAR_CSS = `.bl-translation-bar{display:flex;flex-wrap:wrap;gap:.25rem 1rem;align-items:center;padding:.3rem var(--gutter-h,1.5rem);font-size:12px;line-height:1.4;color:var(--theme-elevation-600,#475569);background:var(--theme-elevation-50,#f8fafc);border-block-end:1px solid var(--theme-elevation-100,#e2e8f0)}.bl-translation-bar__alert{display:block;padding:.6rem var(--gutter-h,1.5rem);font-size:14px;line-height:1.45;color:var(--theme-error-800,#7f1d1d);background:var(--theme-error-50,#fef2f2);border-block-end:1px solid var(--theme-error-200,#fecaca)}.bl-translation-bar a{color:inherit;text-decoration:underline}`;
|
|
7282
|
+
/** An estimate in USD: "about $1.20", or "less than a cent". */
|
|
7283
|
+
function money(value) {
|
|
7284
|
+
if (value > 0 && value < .01) return "less than a cent";
|
|
7285
|
+
return `about $${value.toFixed(2)}`;
|
|
7286
|
+
}
|
|
7287
|
+
/** A set amount (a cap) in USD, as entered. */
|
|
7288
|
+
function amount(value) {
|
|
7289
|
+
return `$${value < .01 ? String(value) : value.toFixed(2)}`;
|
|
7290
|
+
}
|
|
7291
|
+
/**
|
|
7292
|
+
* The slim line across the admin (`admin.components.header`): this month's
|
|
7293
|
+
* translated strings and estimated cost, and, while a failure is recorded
|
|
7294
|
+
* (out of credit, a rejected key, persistent rate limits, the cap), a
|
|
7295
|
+
* banner saying what to do. Asks `GET /api/translation/summary`, which
|
|
7296
|
+
* answers only `translation` grant holders; for anyone else it renders
|
|
7297
|
+
* nothing.
|
|
7298
|
+
*/
|
|
7299
|
+
function TranslationStatusBar() {
|
|
7300
|
+
const { config } = useConfig();
|
|
7301
|
+
const [summary, setSummary] = useState(null);
|
|
7302
|
+
const api = `${config.serverURL ?? ""}${config.routes.api}`;
|
|
7303
|
+
const admin = config.routes.admin ?? "/admin";
|
|
7304
|
+
useEffect(() => {
|
|
7305
|
+
let cancelled = false;
|
|
7306
|
+
const load = () => fetch(`${api}/translation/summary`, { credentials: "include" }).then((response) => response.ok ? response.json() : null).then((body) => {
|
|
7307
|
+
if (!cancelled) setSummary(body);
|
|
7308
|
+
}).catch(() => void 0);
|
|
7309
|
+
load();
|
|
7310
|
+
const timer = setInterval(load, 6e4);
|
|
7311
|
+
return () => {
|
|
7312
|
+
cancelled = true;
|
|
7313
|
+
clearInterval(timer);
|
|
7314
|
+
};
|
|
7315
|
+
}, [api]);
|
|
7316
|
+
if (!summary?.visible) return null;
|
|
7317
|
+
const month = summary.month;
|
|
7318
|
+
const settings = `${admin}/globals/translation-settings`;
|
|
7319
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7320
|
+
/* @__PURE__ */ jsx("style", {
|
|
7321
|
+
href: "bl-translation-bar",
|
|
7322
|
+
precedence: "default",
|
|
7323
|
+
children: BAR_CSS
|
|
7324
|
+
}),
|
|
7325
|
+
summary.failure ? /* @__PURE__ */ jsxs("div", {
|
|
7326
|
+
className: "bl-translation-bar__alert",
|
|
7327
|
+
role: "alert",
|
|
7328
|
+
children: [
|
|
7329
|
+
/* @__PURE__ */ jsx("strong", { children: "Translation stopped." }),
|
|
7330
|
+
" ",
|
|
7331
|
+
summary.failure.advice,
|
|
7332
|
+
" ",
|
|
7333
|
+
/* @__PURE__ */ jsx("a", {
|
|
7334
|
+
href: settings,
|
|
7335
|
+
children: "Settings → Translation"
|
|
7336
|
+
})
|
|
7337
|
+
]
|
|
7338
|
+
}) : null,
|
|
7339
|
+
month && (summary.enabled || month.strings > 0) ? /* @__PURE__ */ jsx("div", {
|
|
7340
|
+
className: "bl-translation-bar",
|
|
7341
|
+
"aria-label": "Translation this month",
|
|
7342
|
+
children: /* @__PURE__ */ jsxs("span", { children: [
|
|
7343
|
+
"Translation this month: ",
|
|
7344
|
+
month.strings.toLocaleString(),
|
|
7345
|
+
" string(s), ",
|
|
7346
|
+
money(month.cost),
|
|
7347
|
+
typeof summary.cap === "number" ? ` (cap ${amount(summary.cap)})` : ""
|
|
7348
|
+
] })
|
|
7349
|
+
}) : null
|
|
7350
|
+
] });
|
|
7351
|
+
}
|
|
7352
|
+
//#endregion
|
|
7353
|
+
//#region src/admin/translation-activity-panel.tsx
|
|
7354
|
+
const PANEL_CSS = `.bl-translation-activity{padding:1rem 1.25rem;border:1px solid var(--theme-elevation-150,#e2e8f0);border-radius:8px;margin-block-end:1.5rem}.bl-translation-activity h3{margin:0 0 .25rem;font-size:1rem;font-weight:600}.bl-translation-activity p{margin:0;font-size:14px}.bl-translation-activity__note{font-size:13px;color:var(--theme-elevation-500,#64748b)}.bl-translation-activity__alert{color:var(--theme-error-700,#b91c1c)}.bl-translation-activity__row{display:flex;gap:.5rem;flex-wrap:wrap}.bl-translation-activity table{border-collapse:collapse;font-size:13px}.bl-translation-activity td,.bl-translation-activity th{padding:.2rem .75rem .2rem 0;text-align:start}.bl-translation-activity progress{inline-size:100%;max-inline-size:28rem}`;
|
|
7355
|
+
const KIND_LABEL = {
|
|
7356
|
+
backfill: "Backfill",
|
|
7357
|
+
"fill-blank": "Fill all blank",
|
|
7358
|
+
"frozen-fix": "Frozen-word fix"
|
|
7359
|
+
};
|
|
7360
|
+
/**
|
|
7361
|
+
* Usage, background jobs and the bulk buttons on Settings → Translation.
|
|
7362
|
+
* Every bulk job shows its estimate ("about 2,100 strings across 85
|
|
7363
|
+
* documents") and waits for a confirm before it starts; a running job's
|
|
7364
|
+
* progress refreshes every few seconds; a paused one offers Resume.
|
|
7365
|
+
*/
|
|
7366
|
+
function TranslationActivityPanel() {
|
|
7367
|
+
const { config } = useConfig();
|
|
7368
|
+
const base = `${config.serverURL ?? ""}${config.routes.api}/translation`;
|
|
7369
|
+
const [status, setStatus] = useState(null);
|
|
7370
|
+
const [jobs, setJobs] = useState([]);
|
|
7371
|
+
const [pending, setPending] = useState(null);
|
|
7372
|
+
const [busy, setBusy] = useState(false);
|
|
7373
|
+
const [error, setError] = useState(null);
|
|
7374
|
+
const load = useCallback(async () => {
|
|
7375
|
+
const [statusResponse, jobsResponse] = await Promise.all([fetch(`${base}/status`, { credentials: "include" }), fetch(`${base}/jobs`, { credentials: "include" })]);
|
|
7376
|
+
if (statusResponse.ok) setStatus(await statusResponse.json());
|
|
7377
|
+
if (jobsResponse.ok) setJobs((await jobsResponse.json()).jobs);
|
|
7378
|
+
}, [base]);
|
|
7379
|
+
const running = jobs.some((job) => job.status === "running");
|
|
7380
|
+
useEffect(() => {
|
|
7381
|
+
load().catch(() => void 0);
|
|
7382
|
+
const timer = setInterval(() => void load().catch(() => void 0), running ? 3e3 : 5e3);
|
|
7383
|
+
return () => clearInterval(timer);
|
|
7384
|
+
}, [load, running]);
|
|
7385
|
+
async function post(path, body) {
|
|
7386
|
+
setBusy(true);
|
|
7387
|
+
setError(null);
|
|
7388
|
+
try {
|
|
7389
|
+
const response = await fetch(`${base}${path}`, {
|
|
7390
|
+
method: "POST",
|
|
7391
|
+
credentials: "include",
|
|
7392
|
+
headers: { "Content-Type": "application/json" },
|
|
7393
|
+
body: JSON.stringify(body)
|
|
7394
|
+
});
|
|
7395
|
+
const result = await response.json().catch(() => ({}));
|
|
7396
|
+
if (!response.ok) setError(typeof result.error === "string" ? result.error : "That did not work.");
|
|
7397
|
+
return response.ok ? result : null;
|
|
7398
|
+
} finally {
|
|
7399
|
+
setBusy(false);
|
|
7400
|
+
}
|
|
7401
|
+
}
|
|
7402
|
+
async function estimate(kind) {
|
|
7403
|
+
const result = await post("/jobs/estimate", { kind });
|
|
7404
|
+
if (result) setPending({
|
|
7405
|
+
kind,
|
|
7406
|
+
estimate: result
|
|
7407
|
+
});
|
|
7408
|
+
}
|
|
7409
|
+
async function confirm() {
|
|
7410
|
+
if (!pending) return;
|
|
7411
|
+
const kind = pending.kind;
|
|
7412
|
+
setPending(null);
|
|
7413
|
+
await post("/jobs", { kind });
|
|
7414
|
+
await load();
|
|
7415
|
+
}
|
|
7416
|
+
const month = status?.usage.month;
|
|
7417
|
+
const latest = jobs[0];
|
|
7418
|
+
const paused = jobs.find((job) => job.status === "paused");
|
|
7419
|
+
const describe = (value, kind) => kind === "frozen-fix" ? `${value.strings.toLocaleString()} string(s) on ${value.documents.toLocaleString()} document(s) don't keep ${(value.words ?? []).map((word) => `"${word}"`).join(", ") || "the frozen words"}. Re-translating them costs ${money(value.cost)}.` : `About ${value.strings.toLocaleString()} blank string(s) across ${value.documents.toLocaleString()} document(s), ${money(value.cost)}.`;
|
|
7420
|
+
return /* @__PURE__ */ jsxs(KitProvider, { children: [
|
|
7421
|
+
/* @__PURE__ */ jsx("style", {
|
|
7422
|
+
href: "bl-translation-activity",
|
|
7423
|
+
precedence: "default",
|
|
7424
|
+
children: PANEL_CSS
|
|
7425
|
+
}),
|
|
7426
|
+
/* @__PURE__ */ jsx("section", {
|
|
7427
|
+
className: "bl-translation-activity",
|
|
7428
|
+
"aria-labelledby": "bl-translation-activity-title",
|
|
7429
|
+
children: /* @__PURE__ */ jsxs(Stack, {
|
|
7430
|
+
size: "field",
|
|
7431
|
+
children: [
|
|
7432
|
+
/* @__PURE__ */ jsx("h3", {
|
|
7433
|
+
id: "bl-translation-activity-title",
|
|
7434
|
+
children: "Usage and jobs"
|
|
7435
|
+
}),
|
|
7436
|
+
status?.failure ? /* @__PURE__ */ jsx("p", {
|
|
7437
|
+
className: "bl-translation-activity__alert",
|
|
7438
|
+
role: "alert",
|
|
7439
|
+
children: status.failure.advice
|
|
7440
|
+
}) : null,
|
|
7441
|
+
month ? /* @__PURE__ */ jsxs("p", { children: [
|
|
7442
|
+
"This month: ",
|
|
7443
|
+
month.strings.toLocaleString(),
|
|
7444
|
+
" string(s) translated, ",
|
|
7445
|
+
money(month.cost),
|
|
7446
|
+
typeof status?.usage.cap === "number" ? ` (cap ${amount(status.usage.cap)})` : "",
|
|
7447
|
+
"."
|
|
7448
|
+
] }) : null,
|
|
7449
|
+
latest ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("p", { children: [
|
|
7450
|
+
KIND_LABEL[latest.kind],
|
|
7451
|
+
": ",
|
|
7452
|
+
latest.status === "running" ? "running" : latest.status,
|
|
7453
|
+
latest.total ? `, ${latest.done} of ${latest.total} document(s)` : "",
|
|
7454
|
+
latest.strings ? ` (estimate: about ${latest.strings.toLocaleString()} strings)` : "",
|
|
7455
|
+
".",
|
|
7456
|
+
latest.message ? ` ${latest.message}.` : ""
|
|
7457
|
+
] }), latest.status === "running" && latest.total ? /* @__PURE__ */ jsx("progress", {
|
|
7458
|
+
max: latest.total,
|
|
7459
|
+
value: latest.done,
|
|
7460
|
+
"aria-label": "Job progress"
|
|
7461
|
+
}) : null] }) : /* @__PURE__ */ jsx("p", {
|
|
7462
|
+
className: "bl-translation-activity__note",
|
|
7463
|
+
children: "No background job has run yet."
|
|
7464
|
+
}),
|
|
7465
|
+
/* @__PURE__ */ jsxs("div", {
|
|
7466
|
+
className: "bl-translation-activity__row",
|
|
7467
|
+
children: [
|
|
7468
|
+
paused ? /* @__PURE__ */ jsxs(Button$1, {
|
|
7469
|
+
type: "button",
|
|
7470
|
+
disabled: busy,
|
|
7471
|
+
onClick: () => void post("/jobs/resume", { id: paused.id }).then(load),
|
|
7472
|
+
children: [
|
|
7473
|
+
"Resume (",
|
|
7474
|
+
paused.done,
|
|
7475
|
+
" of ",
|
|
7476
|
+
paused.total,
|
|
7477
|
+
")"
|
|
7478
|
+
]
|
|
7479
|
+
}) : null,
|
|
7480
|
+
/* @__PURE__ */ jsx(Button$1, {
|
|
7481
|
+
type: "button",
|
|
7482
|
+
variant: "outline",
|
|
7483
|
+
disabled: busy || running,
|
|
7484
|
+
onClick: () => void estimate("fill-blank"),
|
|
7485
|
+
children: "Fill all blank"
|
|
7486
|
+
}),
|
|
7487
|
+
/* @__PURE__ */ jsx(Button$1, {
|
|
7488
|
+
type: "button",
|
|
7489
|
+
variant: "outline",
|
|
7490
|
+
disabled: busy || running,
|
|
7491
|
+
onClick: () => void estimate("frozen-fix"),
|
|
7492
|
+
children: "Apply frozen words to existing translations"
|
|
7493
|
+
})
|
|
7494
|
+
]
|
|
7495
|
+
}),
|
|
7496
|
+
error ? /* @__PURE__ */ jsx("p", {
|
|
7497
|
+
className: "bl-translation-activity__alert",
|
|
7498
|
+
role: "status",
|
|
7499
|
+
children: error
|
|
7500
|
+
}) : null,
|
|
7501
|
+
status && status.usage.history.length > 0 ? /* @__PURE__ */ jsxs("table", { children: [
|
|
7502
|
+
/* @__PURE__ */ jsx("caption", {
|
|
7503
|
+
className: "bl-translation-activity__note",
|
|
7504
|
+
style: { textAlign: "start" },
|
|
7505
|
+
children: "Usage by month"
|
|
7506
|
+
}),
|
|
7507
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
7508
|
+
/* @__PURE__ */ jsx("th", {
|
|
7509
|
+
scope: "col",
|
|
7510
|
+
children: "Month"
|
|
7511
|
+
}),
|
|
7512
|
+
/* @__PURE__ */ jsx("th", {
|
|
7513
|
+
scope: "col",
|
|
7514
|
+
children: "Strings"
|
|
7515
|
+
}),
|
|
7516
|
+
/* @__PURE__ */ jsx("th", {
|
|
7517
|
+
scope: "col",
|
|
7518
|
+
children: "Estimated cost"
|
|
7519
|
+
})
|
|
7520
|
+
] }) }),
|
|
7521
|
+
/* @__PURE__ */ jsx("tbody", { children: status.usage.history.map((row) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
7522
|
+
/* @__PURE__ */ jsx("td", { children: row.month }),
|
|
7523
|
+
/* @__PURE__ */ jsx("td", { children: row.strings.toLocaleString() }),
|
|
7524
|
+
/* @__PURE__ */ jsx("td", { children: money(row.cost) })
|
|
7525
|
+
] }, row.month)) })
|
|
7526
|
+
] }) : null
|
|
7527
|
+
]
|
|
7528
|
+
})
|
|
7529
|
+
}),
|
|
7530
|
+
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
7531
|
+
open: pending !== null,
|
|
7532
|
+
title: pending?.kind === "frozen-fix" ? "Apply frozen words?" : "Fill all blank translations?",
|
|
7533
|
+
cancelLabel: "Cancel",
|
|
7534
|
+
confirmLabel: pending?.estimate.strings ? "Start" : "OK",
|
|
7535
|
+
onCancel: () => setPending(null),
|
|
7536
|
+
onConfirm: () => void (pending?.estimate.strings ? confirm() : setPending(null)),
|
|
7537
|
+
children: pending ? describe(pending.estimate, pending.kind) : ""
|
|
7538
|
+
})
|
|
7539
|
+
] });
|
|
7540
|
+
}
|
|
7541
|
+
//#endregion
|
|
7542
|
+
export { AdminNav, AdminNavEntityField, AdminNavItemRowLabel, AdminNavRowLabel, AppearanceField, BlockDrawerStyles, BlockLibraryField, ColorField, ColorScaleField, ContrastReport, DocumentCreateNew, DocumentTitleActions, FeaturesMatrixField, FontField, GreyScaleField, HiddenSaveButton, IdentityFallback, LibraryField, ListAlignStyles, LookField, MediaAltAutofill, MediaListView, PageSlugCell, PageTitleCell, PairingField, PublishChild, QuestionsList, RequiredPageCell, RequiredPageField, RichTextEditorFontStyles, RoleNameField, RoleSlugField, RolesCell, RolesField, RolesGrantsField, RolesMatrixField, RolesRowLabel, SectionHeading, SlugField, ThemeDocumentControls, ThemeSaveButton, TranslateNowMenuItem, TranslationActivityPanel, TranslationKeyPanel, TranslationStatusBar, setThemePreviewMode };
|
|
7278
7543
|
|
|
7279
7544
|
//# sourceMappingURL=admin.mjs.map
|