@justanarthur/payload-plugin-translator 3.4.1 → 3.4.3

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/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  hasTranslateWorkflow,
17
17
  queueBulkTranslation,
18
18
  runQueuedTranslations
19
- } from "./shared/chunk-9ky9w8k3.js";
19
+ } from "./shared/chunk-0d3gtdzw.js";
20
20
  import {
21
21
  TRANSLATION_STATUS_SLUG2,
22
22
  REVIEW_VIEW_PATH
package/dist/rsc.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  loadGlobalsReview,
6
6
  loadEntityLocaleReview,
7
7
  loadJobsProgress
8
- } from "./shared/chunk-9ky9w8k3.js";
8
+ } from "./shared/chunk-0d3gtdzw.js";
9
9
  import {
10
10
  REVIEW_VIEW_PATH
11
11
  } from "./shared/chunk-31qgv1zk.js";
@@ -97,12 +97,11 @@ var reviewEntity = (config, source, targetByLocale, targetLocales, hash, rowByLo
97
97
  const crossLocale = buildCrossLocaleTexts(fieldsPerLocale);
98
98
  return Object.fromEntries(fieldsPerLocale.map(({ locale, fields }) => {
99
99
  const row = rowByLocale(locale);
100
- const { fields: _fields, ...review } = {
100
+ return [locale, {
101
101
  ...computeStatus(fields, { locale, check, crossLocale }),
102
102
  stale: Boolean(row?.sourceHash) && row?.sourceHash !== hash,
103
103
  reviewed: Boolean(row?.reviewedHash) && row?.reviewedHash === hash
104
- };
105
- return [locale, review];
104
+ }];
106
105
  }));
107
106
  };
108
107
  var labelOf = (config, doc) => {
@@ -149,12 +148,13 @@ var loadCollectionReview = async ({ req, collectionSlug, page = 1, limit = 25 })
149
148
  const source = doc;
150
149
  const key = entityKey({ collectionSlug, id: source.id });
151
150
  const hash = hashOf(config, source, req);
151
+ const byLocale = reviewEntity(config, source, Object.fromEntries(targetLocales.map((locale) => [locale, targets[locale].get(String(source.id))])), targetLocales, hash, (locale) => rows.find((row) => row.entity === key && row.locale === locale), req, check);
152
152
  return {
153
153
  key,
154
154
  label: labelOf(config, source),
155
155
  collectionSlug,
156
156
  id: source.id,
157
- locales: reviewEntity(config, source, Object.fromEntries(targetLocales.map((locale) => [locale, targets[locale].get(String(source.id))])), targetLocales, hash, (locale) => rows.find((row) => row.entity === key && row.locale === locale), req, check)
157
+ locales: Object.fromEntries(Object.entries(byLocale).map(([locale, { fields: _fields, ...review }]) => [locale, review]))
158
158
  };
159
159
  });
160
160
  return {
@@ -189,7 +189,8 @@ var loadGlobalsReview = async ({ req, globalSlugs }) => {
189
189
  for (const locale of targetLocales) {
190
190
  targetByLocale[locale] = await read(locale);
191
191
  }
192
- const locales = reviewEntity(config, source, targetByLocale, targetLocales, hash, (locale) => rows.find((row) => row.entity === key && row.locale === locale), req, check);
192
+ const reviews = reviewEntity(config, source, targetByLocale, targetLocales, hash, (locale) => rows.find((row) => row.entity === key && row.locale === locale), req, check);
193
+ const locales = Object.fromEntries(Object.entries(reviews).map(([locale, { fields: _fields, ...review }]) => [locale, review]));
193
194
  entities.push({ key, label: globalLabel(config), globalSlug, locales });
194
195
  }
195
196
  return { entities, locales: targetLocales };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justanarthur/payload-plugin-translator",
3
3
  "description": "Translator plugin for Payload CMS — automatic localization via Google, OpenAI, LibreTranslate, or custom resolvers.",
4
- "version": "3.4.1",
4
+ "version": "3.4.3",
5
5
  "type": "module",
6
6
  "private": false,
7
7
  "files": [