@burdenoff/microfe-i18n 2026.1126.1 → 2026.1129.2
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/generated/global-operations.d.ts +299 -0
- package/dist/generated/global-operations.js +135 -0
- package/dist/generated/global-types.d.ts +34021 -0
- package/dist/generated/global-types.js +11 -0
- package/dist/i18n/I18nRoutes.d.ts +11 -0
- package/dist/i18n/I18nRoutes.js +54 -41
- package/dist/i18n/v2/LanguagesPage.d.ts +3 -0
- package/dist/i18n/v2/LanguagesPage.js +83 -0
- package/dist/i18n/v2/LanguagesTab.d.ts +10 -0
- package/dist/i18n/v2/LanguagesTab.js +107 -0
- package/dist/i18n/v2/ProductsTab.d.ts +4 -0
- package/dist/i18n/v2/ProductsTab.js +60 -0
- package/dist/i18n/v2/ReviewRows.d.ts +9 -0
- package/dist/i18n/v2/ReviewRows.js +71 -0
- package/dist/i18n/v2/ReviewTab.d.ts +6 -0
- package/dist/i18n/v2/ReviewTab.js +121 -0
- package/dist/i18n/v2/ShareBar.d.ts +5 -0
- package/dist/i18n/v2/ShareBar.js +28 -0
- package/dist/i18n/v2/TabRedirect.d.ts +4 -0
- package/dist/i18n/v2/TabRedirect.js +14 -0
- package/dist/i18n/v2/__tests__/routeShapes.d.ts +7 -0
- package/dist/i18n/v2/formats.d.ts +3 -0
- package/dist/i18n/v2/formats.js +6 -0
- package/dist/i18n/v2/links.d.ts +13 -0
- package/dist/i18n/v2/links.js +16 -0
- package/dist/i18n/v2/model.d.ts +86 -0
- package/dist/i18n/v2/model.js +90 -0
- package/dist/i18n/v2/reviewMessages.d.ts +9 -0
- package/dist/i18n/v2/reviewMessages.js +40 -0
- package/dist/i18n/v2/useLanguagesData.d.ts +35 -0
- package/dist/i18n/v2/useLanguagesData.js +62 -0
- package/dist/i18n/v2/useReviewActions.d.ts +11 -0
- package/dist/i18n/v2/useReviewActions.js +56 -0
- package/dist/i18n/v2/useReviewQueue.d.ts +47 -0
- package/dist/i18n/v2/useReviewQueue.js +63 -0
- package/dist/node_modules/@apollo/client/react/context/ApolloContext.js +15 -0
- package/dist/node_modules/@apollo/client/react/hooks/constants.js +3 -0
- package/dist/node_modules/@apollo/client/react/hooks/internal/useDeepMemo.js +11 -0
- package/dist/node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.js +5 -0
- package/dist/node_modules/@apollo/client/react/hooks/internal/wrapHook.js +13 -0
- package/dist/node_modules/@apollo/client/react/hooks/useApolloClient.js +9 -0
- package/dist/node_modules/@apollo/client/react/hooks/useMutation.js +96 -0
- package/dist/node_modules/@apollo/client/react/hooks/useQuery.js +125 -0
- package/dist/node_modules/@apollo/client/react/hooks/useSyncExternalStore.js +34 -0
- package/dist/node_modules/@apollo/client/react/internal/index.js +3 -0
- package/dist/node_modules/@apollo/client/utilities/internal/canUseDOM.js +4 -0
- package/dist/node_modules/@apollo/client/utilities/internal/compact.js +11 -0
- package/dist/node_modules/@apollo/client/utilities/internal/constants.js +3 -0
- package/dist/node_modules/@apollo/client/utilities/internal/deepFreeze.js +14 -0
- package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js +6 -0
- package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js +7 -0
- package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js +5 -0
- package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js +7 -0
- package/dist/node_modules/@apollo/client/utilities/internal/maybeDeepFreeze.js +6 -0
- package/dist/node_modules/@apollo/client/utilities/internal/mergeOptions.js +9 -0
- package/dist/node_modules/@apollo/client/utilities/internal/preventUnhandledRejection.js +5 -0
- package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js +7 -0
- package/dist/node_modules/@apollo/client/utilities/invariant/index.js +54 -0
- package/dist/node_modules/@apollo/client/version.js +3 -0
- package/dist/node_modules/@wry/equality/lib/index.js +86 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/check-check.js +10 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/check.js +7 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/pencil.js +10 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js +18 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/Scheduler.js +11 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js +114 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js +94 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/config.js +9 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/operators/OperatorSubscriber.js +43 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/operators/observeOn.js +22 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/Action.js +13 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/AsapAction.js +19 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/AsapScheduler.js +24 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/AsyncAction.js +43 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/AsyncScheduler.js +27 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/asap.js +5 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/dateTimestampProvider.js +8 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/immediateProvider.js +14 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/intervalProvider.js +13 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +13 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/Immediate.js +17 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +10 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +8 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +8 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +5 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/executeSchedule.js +9 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +5 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/lift.js +18 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js +3 -0
- package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +11 -0
- package/dist/node_modules/tslib/tslib.es6.js +49 -0
- package/package.json +12 -5
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SHARE as e } from "./formats.js";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import { Skeleton as r } from "@burdenoff/fe-libs/ui";
|
|
4
|
+
// src/i18n/v2/ShareBar.tsx
|
|
5
|
+
function i({ share: i, loading: a }) {
|
|
6
|
+
if (a) return /* @__PURE__ */ t(r, { className: "h-4 w-36 rounded" });
|
|
7
|
+
if (i === null) return /* @__PURE__ */ t("span", {
|
|
8
|
+
className: "text-sm text-text-secondary",
|
|
9
|
+
children: "—"
|
|
10
|
+
});
|
|
11
|
+
let o = Math.floor(i * 100);
|
|
12
|
+
return /* @__PURE__ */ n("span", {
|
|
13
|
+
className: "inline-flex items-center gap-2",
|
|
14
|
+
"data-share-bar": "",
|
|
15
|
+
children: [/* @__PURE__ */ t("span", {
|
|
16
|
+
"aria-hidden": "true",
|
|
17
|
+
className: "h-1.5 w-28 shrink-0 overflow-hidden rounded-full bg-bg-sunken",
|
|
18
|
+
children: /* @__PURE__ */ t("span", {
|
|
19
|
+
className: "block h-full rounded-full bg-action-primary-bg",
|
|
20
|
+
style: { width: `${o}%` }
|
|
21
|
+
})
|
|
22
|
+
}), /* @__PURE__ */ t("span", {
|
|
23
|
+
className: "text-sm tabular-nums text-text-primary",
|
|
24
|
+
children: e.format(o / 100)
|
|
25
|
+
})]
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export { i as ShareBar };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { joinPath as e } from "../utils/paths.js";
|
|
2
|
+
import { Navigate as t, useSearchParams as n } from "react-router";
|
|
3
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
4
|
+
// src/i18n/v2/TabRedirect.tsx
|
|
5
|
+
function i({ basePath: i, tab: a }) {
|
|
6
|
+
let [o] = n(), s = new URLSearchParams(o);
|
|
7
|
+
a === "languages" ? s.delete("tab") : s.set("tab", a);
|
|
8
|
+
let c = s.toString(), l = e(i, "languages");
|
|
9
|
+
return /* @__PURE__ */ r(t, {
|
|
10
|
+
to: c ? `${l}?${c}` : l,
|
|
11
|
+
replace: !0
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export { i as TabRedirect };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LanguagesTab } from './model';
|
|
2
|
+
export declare function languagesLinks(basePath: string): {
|
|
3
|
+
page: string;
|
|
4
|
+
tab: (tab: LanguagesTab) => string;
|
|
5
|
+
/** The review queue, showing one language. */
|
|
6
|
+
review: (languageCode: string) => string;
|
|
7
|
+
/** One language: today's language settings until C5b. */
|
|
8
|
+
language: (code: string) => string;
|
|
9
|
+
addLanguage: string;
|
|
10
|
+
importWords: string;
|
|
11
|
+
exportWords: string;
|
|
12
|
+
};
|
|
13
|
+
export type LanguagesLinks = ReturnType<typeof languagesLinks>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { joinPath as e } from "../utils/paths.js";
|
|
2
|
+
import { LANGUAGE_PARAM as t } from "./model.js";
|
|
3
|
+
// src/i18n/v2/links.ts
|
|
4
|
+
function n(n) {
|
|
5
|
+
let r = e(n, "languages");
|
|
6
|
+
return {
|
|
7
|
+
page: r,
|
|
8
|
+
tab: (e) => e === "languages" ? r : `${r}?tab=${e}`,
|
|
9
|
+
review: (e) => `${r}?tab=review&${t}=${encodeURIComponent(e)}`,
|
|
10
|
+
language: (t) => e(n, `languages/${encodeURIComponent(t)}`),
|
|
11
|
+
addLanguage: e(n, "languages/new"),
|
|
12
|
+
importWords: e(n, "import"),
|
|
13
|
+
exportWords: e(n, "export")
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export { n as languagesLinks };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Languages page's numbers (BOFF-16785, C5; the mockup's `languages`): how
|
|
3
|
+
* much of each language is translated across every product, how much of each
|
|
4
|
+
* product is translated, and what waits for review. Pure, so it is tested
|
|
5
|
+
* without a page.
|
|
6
|
+
*/
|
|
7
|
+
export declare const LANGUAGES_TABS: readonly ["languages", "products", "review"];
|
|
8
|
+
export type LanguagesTab = (typeof LANGUAGES_TABS)[number];
|
|
9
|
+
/**
|
|
10
|
+
* Whether the service can list translations waiting for review. Today
|
|
11
|
+
* `translations` returns only live ones, whatever status is asked for, so the
|
|
12
|
+
* review queue would show live words as waiting (BOFF-16785's backend list).
|
|
13
|
+
* Until it can, the queue, its tab and its links stay hidden; the waiting
|
|
14
|
+
* counts (from `translationCoverage`) still show, as plain text.
|
|
15
|
+
*/
|
|
16
|
+
export declare const REVIEW_QUEUE_LISTS = false;
|
|
17
|
+
/** The tabs shown: the review queue only once the service can list it. */
|
|
18
|
+
export declare function shownTabs(reviewQueue: boolean): LanguagesTab[];
|
|
19
|
+
/** `?tab=`; anything else, or a hidden tab, is the Languages tab. */
|
|
20
|
+
export declare function readLanguagesTab(value: string | null, reviewQueue?: boolean): LanguagesTab;
|
|
21
|
+
/** The review queue's language filter (`?language=`). */
|
|
22
|
+
export declare const LANGUAGE_PARAM = "language";
|
|
23
|
+
/** One language's line of `translationCoverage` for one product. */
|
|
24
|
+
export interface CoverageLine {
|
|
25
|
+
languageCode: string;
|
|
26
|
+
totalKeys: number;
|
|
27
|
+
translatedKeys: number;
|
|
28
|
+
missingCount: number;
|
|
29
|
+
pendingReviewKeys: number;
|
|
30
|
+
}
|
|
31
|
+
/** How far along something is: what's translated out of how much. */
|
|
32
|
+
export interface Progress {
|
|
33
|
+
translated: number;
|
|
34
|
+
total: number;
|
|
35
|
+
/** What waits for review. */
|
|
36
|
+
waiting: number;
|
|
37
|
+
/** What nobody has translated yet. */
|
|
38
|
+
missing: number;
|
|
39
|
+
/** `translated / total`, 0 to 1; null when there is nothing to translate. */
|
|
40
|
+
share: number | null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Each language across every product: the products' lines for that language
|
|
44
|
+
* added up. A language with no line (not active, so not counted) is missing
|
|
45
|
+
* from the map.
|
|
46
|
+
*/
|
|
47
|
+
export declare function languageProgress(byProduct: ReadonlyMap<string, readonly CoverageLine[]>): Map<string, Progress>;
|
|
48
|
+
/** One product: how much text it has, and how much of it is translated. */
|
|
49
|
+
export interface ProductProgress extends Progress {
|
|
50
|
+
/** The product's texts (each is translated once per language). */
|
|
51
|
+
texts: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* One product across the languages it is translated into. The source language
|
|
55
|
+
* (`sourceCode`) is left out: it is where the words come from, so counting it
|
|
56
|
+
* would make every product look further along. With only the source language,
|
|
57
|
+
* that one counts.
|
|
58
|
+
*/
|
|
59
|
+
export declare function productProgress(lines: readonly CoverageLine[], sourceCode: string | null): ProductProgress;
|
|
60
|
+
/** A translation's text: where it appears, and the product. */
|
|
61
|
+
export interface TranslationPlace {
|
|
62
|
+
product: {
|
|
63
|
+
displayName: string;
|
|
64
|
+
};
|
|
65
|
+
namespace: {
|
|
66
|
+
displayName: string;
|
|
67
|
+
} | null;
|
|
68
|
+
}
|
|
69
|
+
/** Where a text appears, in words: its section, or the product when it has none. */
|
|
70
|
+
export declare function whereItAppears(key: TranslationPlace): string;
|
|
71
|
+
/** The languages, the source language first, then by name. */
|
|
72
|
+
export declare function sortLanguages<T extends {
|
|
73
|
+
isDefault: boolean;
|
|
74
|
+
name: string;
|
|
75
|
+
}>(languages: readonly T[]): T[];
|
|
76
|
+
/**
|
|
77
|
+
* `run` for every item, at most `limit` at a time, keeping the order. A failed
|
|
78
|
+
* item is reported in `failed` and doesn't stop the others.
|
|
79
|
+
*/
|
|
80
|
+
export declare function eachLimited<T, R>(items: readonly T[], limit: number, run: (item: T) => Promise<R>): Promise<{
|
|
81
|
+
done: Array<{
|
|
82
|
+
item: T;
|
|
83
|
+
result: R;
|
|
84
|
+
}>;
|
|
85
|
+
failed: T[];
|
|
86
|
+
}>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// src/i18n/v2/model.ts
|
|
2
|
+
var e = [
|
|
3
|
+
"languages",
|
|
4
|
+
"products",
|
|
5
|
+
"review"
|
|
6
|
+
];
|
|
7
|
+
function t(t) {
|
|
8
|
+
return e.filter((e) => t || e !== "review");
|
|
9
|
+
}
|
|
10
|
+
function n(e, n = !1) {
|
|
11
|
+
return t(n).find((t) => t === e) ?? "languages";
|
|
12
|
+
}
|
|
13
|
+
var r = "language", i = {
|
|
14
|
+
translated: 0,
|
|
15
|
+
total: 0,
|
|
16
|
+
waiting: 0,
|
|
17
|
+
missing: 0,
|
|
18
|
+
share: null
|
|
19
|
+
};
|
|
20
|
+
function a(e) {
|
|
21
|
+
return {
|
|
22
|
+
...e,
|
|
23
|
+
share: e.total > 0 ? e.translated / e.total : null
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function o(e) {
|
|
27
|
+
let t = /* @__PURE__ */ new Map();
|
|
28
|
+
for (let n of e.values()) for (let e of n) {
|
|
29
|
+
let n = t.get(e.languageCode) ?? { ...i };
|
|
30
|
+
t.set(e.languageCode, {
|
|
31
|
+
translated: n.translated + e.translatedKeys,
|
|
32
|
+
total: n.total + e.totalKeys,
|
|
33
|
+
waiting: n.waiting + e.pendingReviewKeys,
|
|
34
|
+
missing: n.missing + e.missingCount
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
let n = /* @__PURE__ */ new Map();
|
|
38
|
+
for (let [e, r] of t) n.set(e, a(r));
|
|
39
|
+
return n;
|
|
40
|
+
}
|
|
41
|
+
function s(e, t) {
|
|
42
|
+
let n = e.reduce((e, t) => Math.max(e, t.totalKeys), 0), r = e.filter((e) => e.languageCode !== t);
|
|
43
|
+
return {
|
|
44
|
+
...a((r.length > 0 ? r : e).reduce((e, t) => ({
|
|
45
|
+
translated: e.translated + t.translatedKeys,
|
|
46
|
+
total: e.total + t.totalKeys,
|
|
47
|
+
waiting: e.waiting + t.pendingReviewKeys,
|
|
48
|
+
missing: e.missing + t.missingCount
|
|
49
|
+
}), { ...i })),
|
|
50
|
+
texts: n
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function c(e) {
|
|
54
|
+
return e.namespace?.displayName || e.product.displayName;
|
|
55
|
+
}
|
|
56
|
+
function l(e) {
|
|
57
|
+
return [...e].sort((e, t) => e.isDefault === t.isDefault ? e.name.localeCompare(t.name) : e.isDefault ? -1 : 1);
|
|
58
|
+
}
|
|
59
|
+
async function u(e, t, n) {
|
|
60
|
+
let r = Array(e.length), i = 0;
|
|
61
|
+
await Promise.all(Array.from({ length: Math.max(1, Math.min(t, e.length)) }, async () => {
|
|
62
|
+
for (; i < e.length;) {
|
|
63
|
+
let t = i;
|
|
64
|
+
i += 1;
|
|
65
|
+
let a = e[t];
|
|
66
|
+
try {
|
|
67
|
+
r[t] = {
|
|
68
|
+
ok: !0,
|
|
69
|
+
item: a,
|
|
70
|
+
result: await n(a)
|
|
71
|
+
};
|
|
72
|
+
} catch {
|
|
73
|
+
r[t] = {
|
|
74
|
+
ok: !1,
|
|
75
|
+
item: a
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}));
|
|
80
|
+
let a = [], o = [];
|
|
81
|
+
for (let e of r) e && (e.ok ? a.push({
|
|
82
|
+
item: e.item,
|
|
83
|
+
result: e.result
|
|
84
|
+
}) : o.push(e.item));
|
|
85
|
+
return {
|
|
86
|
+
done: a,
|
|
87
|
+
failed: o
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export { e as LANGUAGES_TABS, r as LANGUAGE_PARAM, u as eachLimited, o as languageProgress, s as productProgress, n as readLanguagesTab, t as shownTabs, l as sortLanguages, c as whereItAppears };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NotifyOptions } from '@burdenoff/fe-libs/ui';
|
|
2
|
+
import { ApproveOutcome } from './useReviewQueue';
|
|
3
|
+
export type Tr = (key: string, fallback: string, params?: Record<string, string | number>) => string;
|
|
4
|
+
/** After one Approve. */
|
|
5
|
+
export declare function approvedMessage(tr: Tr, outcome: ApproveOutcome): NotifyOptions;
|
|
6
|
+
/** After approving every row shown: how many were approved, and what went wrong. */
|
|
7
|
+
export declare function approvedManyMessage(tr: Tr, outcomes: readonly ApproveOutcome[], failed: number): NotifyOptions;
|
|
8
|
+
/** After Put them live. */
|
|
9
|
+
export declare function liveMessage(tr: Tr, done: number, failed: number): NotifyOptions;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { COUNT as e } from "./formats.js";
|
|
2
|
+
// src/i18n/v2/reviewMessages.ts
|
|
3
|
+
function t(e, t) {
|
|
4
|
+
return t === "live" ? {
|
|
5
|
+
title: e("i18n.v3.approved", "Approved. It’s live now."),
|
|
6
|
+
tone: "success"
|
|
7
|
+
} : {
|
|
8
|
+
title: e("i18n.v3.approvedNotLive", "Approved, but it isn’t live yet."),
|
|
9
|
+
description: e("i18n.v3.approvedNotLiveBody", "Put it live from the note above the queue."),
|
|
10
|
+
tone: "warning"
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function n(t, n, r) {
|
|
14
|
+
let i = n.filter((e) => e !== "live").length;
|
|
15
|
+
return r === 0 && i === 0 ? {
|
|
16
|
+
title: t("i18n.v3.approvedCount", "Approved {{count}}. They’re live now.", { count: e.format(n.length) }),
|
|
17
|
+
tone: "success"
|
|
18
|
+
} : {
|
|
19
|
+
title: t("i18n.v3.approvedSome", "Approved {{done}} of {{count}}.", {
|
|
20
|
+
done: e.format(n.length),
|
|
21
|
+
count: e.format(n.length + r)
|
|
22
|
+
}),
|
|
23
|
+
description: r > 0 ? t("i18n.v3.approvedSomeFailed", "The rest couldn’t be approved. Try again.") : t("i18n.v3.approvedSomeNotLive", "Some aren’t live yet: put them live from the note above the queue."),
|
|
24
|
+
tone: "warning"
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function r(t, n, r) {
|
|
28
|
+
return r === 0 ? {
|
|
29
|
+
title: t("i18n.v3.liveCount", "{{count}} translations are live now.", { count: e.format(n) }),
|
|
30
|
+
tone: "success"
|
|
31
|
+
} : {
|
|
32
|
+
title: t("i18n.v3.liveSome", "Put {{done}} of {{count}} live.", {
|
|
33
|
+
done: e.format(n),
|
|
34
|
+
count: e.format(n + r)
|
|
35
|
+
}),
|
|
36
|
+
description: t("i18n.v3.liveSomeFailed", "The rest couldn’t be put live. Try again."),
|
|
37
|
+
tone: "warning"
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export { n as approvedManyMessage, t as approvedMessage, r as liveMessage };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { LanguageDirection, LanguageStatus } from '../../generated/global-types';
|
|
2
|
+
import { CoverageLine } from './model';
|
|
3
|
+
export interface LanguageRow {
|
|
4
|
+
id: string;
|
|
5
|
+
code: string;
|
|
6
|
+
name: string;
|
|
7
|
+
nativeName: string;
|
|
8
|
+
direction: LanguageDirection;
|
|
9
|
+
status: LanguageStatus;
|
|
10
|
+
isDefault: boolean;
|
|
11
|
+
region: string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface ProductRow {
|
|
14
|
+
id: string;
|
|
15
|
+
displayName: string;
|
|
16
|
+
description: string | null;
|
|
17
|
+
}
|
|
18
|
+
export declare function useLanguagesData(): {
|
|
19
|
+
languages: LanguageRow[];
|
|
20
|
+
products: ProductRow[];
|
|
21
|
+
sourceCode: string | null;
|
|
22
|
+
coverage: {
|
|
23
|
+
byProduct: Map<string, CoverageLine[]>;
|
|
24
|
+
failed: string[];
|
|
25
|
+
/** The first load only. */
|
|
26
|
+
loading: boolean;
|
|
27
|
+
reload: () => void;
|
|
28
|
+
};
|
|
29
|
+
languagesLoading: boolean;
|
|
30
|
+
productsLoading: boolean;
|
|
31
|
+
languagesError: import('@apollo/client').ErrorLike | undefined;
|
|
32
|
+
productsError: import('@apollo/client').ErrorLike | undefined;
|
|
33
|
+
retry: () => void;
|
|
34
|
+
};
|
|
35
|
+
export type LanguagesData = ReturnType<typeof useLanguagesData>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { useApolloClient as e } from "../../node_modules/@apollo/client/react/hooks/useApolloClient.js";
|
|
2
|
+
import { GetI18nCoverageDocument as t, useGetI18nLanguagesQuery as n, useGetI18nProductsQuery as r } from "../../generated/global-operations.js";
|
|
3
|
+
import { I18nProductStatus as i } from "../../generated/global-types.js";
|
|
4
|
+
import { eachLimited as a } from "./model.js";
|
|
5
|
+
import { useCallback as o, useEffect as s, useMemo as c, useState as l } from "react";
|
|
6
|
+
// src/i18n/v2/useLanguagesData.ts
|
|
7
|
+
var u = 4, d = {
|
|
8
|
+
for: "",
|
|
9
|
+
byProduct: /* @__PURE__ */ new Map(),
|
|
10
|
+
failed: []
|
|
11
|
+
};
|
|
12
|
+
function f(n) {
|
|
13
|
+
let r = e(), i = n.join(","), [c, f] = l(0), [p, m] = l(d);
|
|
14
|
+
s(() => {
|
|
15
|
+
if (!i) return;
|
|
16
|
+
let e = !0;
|
|
17
|
+
return a(i.split(","), u, async (e) => (await r.query({
|
|
18
|
+
query: t,
|
|
19
|
+
variables: { productId: e },
|
|
20
|
+
fetchPolicy: c > 0 ? "network-only" : "cache-first"
|
|
21
|
+
})).data?.translationCoverage ?? []).then(({ done: t, failed: n }) => {
|
|
22
|
+
e && m({
|
|
23
|
+
for: `${i}#${c}`,
|
|
24
|
+
byProduct: new Map(t.map(({ item: e, result: t }) => [e, t])),
|
|
25
|
+
failed: n
|
|
26
|
+
});
|
|
27
|
+
}), () => {
|
|
28
|
+
e = !1;
|
|
29
|
+
};
|
|
30
|
+
}, [
|
|
31
|
+
r,
|
|
32
|
+
i,
|
|
33
|
+
c
|
|
34
|
+
]);
|
|
35
|
+
let h = o(() => f((e) => e + 1), []);
|
|
36
|
+
return {
|
|
37
|
+
byProduct: p.byProduct,
|
|
38
|
+
failed: p.failed,
|
|
39
|
+
loading: !!i && p.for === "",
|
|
40
|
+
reload: h
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function p() {
|
|
44
|
+
let e = n({ variables: { limit: 100 } }), t = r({ variables: {
|
|
45
|
+
filter: { status: i.Active },
|
|
46
|
+
limit: 100
|
|
47
|
+
} }), a = c(() => e.data?.languages.items ?? [], [e.data]), s = c(() => t.data?.i18nProducts.items ?? [], [t.data]), l = f(c(() => s.map((e) => e.id), [s])), u = a.find((e) => e.isDefault)?.code ?? null, { refetch: d } = e, { refetch: p } = t, m = o(() => {
|
|
48
|
+
d(), p();
|
|
49
|
+
}, [d, p]);
|
|
50
|
+
return {
|
|
51
|
+
languages: a,
|
|
52
|
+
products: s,
|
|
53
|
+
sourceCode: u,
|
|
54
|
+
coverage: l,
|
|
55
|
+
languagesLoading: e.loading && a.length === 0,
|
|
56
|
+
productsLoading: t.loading && s.length === 0,
|
|
57
|
+
languagesError: e.error,
|
|
58
|
+
productsError: t.error,
|
|
59
|
+
retry: m
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export { p as useLanguagesData };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReviewQueue, ReviewRow } from './useReviewQueue';
|
|
2
|
+
export declare function useReviewActions(queue: ReviewQueue,
|
|
3
|
+
/** The queue's language, for the confirm; null for every language. */
|
|
4
|
+
languageName: string | null, onReviewed: () => void): {
|
|
5
|
+
busy: ReadonlySet<string>;
|
|
6
|
+
bulk: boolean;
|
|
7
|
+
approveOne: (row: ReviewRow) => Promise<void>;
|
|
8
|
+
approveShown: () => Promise<void>;
|
|
9
|
+
putLive: () => Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
export type ReviewActions = ReturnType<typeof useReviewActions>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useTr as e } from "../hooks/useTr.js";
|
|
2
|
+
import { COUNT as t } from "./formats.js";
|
|
3
|
+
import { eachLimited as n } from "./model.js";
|
|
4
|
+
import { approvedManyMessage as r, approvedMessage as i, liveMessage as a } from "./reviewMessages.js";
|
|
5
|
+
import { useState as o } from "react";
|
|
6
|
+
import { useConfirm as s, useNotify as c } from "@burdenoff/fe-libs/ui";
|
|
7
|
+
// src/i18n/v2/useReviewActions.ts
|
|
8
|
+
var l = 4;
|
|
9
|
+
function u(u, d, f) {
|
|
10
|
+
let p = e(), m = c(), h = s(), [g, _] = o(/* @__PURE__ */ new Set()), [v, y] = o(!1), b = () => {
|
|
11
|
+
u.refresh(), f();
|
|
12
|
+
};
|
|
13
|
+
return {
|
|
14
|
+
busy: g,
|
|
15
|
+
bulk: v,
|
|
16
|
+
approveOne: async (e) => {
|
|
17
|
+
_((t) => new Set(t).add(e.id));
|
|
18
|
+
try {
|
|
19
|
+
m(i(p, await u.approve(e.id))), b();
|
|
20
|
+
} catch {
|
|
21
|
+
m({
|
|
22
|
+
title: p("i18n.v3.approveFailed", "Couldn’t approve it. Try again."),
|
|
23
|
+
tone: "error"
|
|
24
|
+
});
|
|
25
|
+
} finally {
|
|
26
|
+
_((t) => {
|
|
27
|
+
let n = new Set(t);
|
|
28
|
+
return n.delete(e.id), n;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
approveShown: async () => {
|
|
33
|
+
let e = u.rows, i = t.format(e.length);
|
|
34
|
+
if (!await h({
|
|
35
|
+
title: p("i18n.v3.approveLiveAllTitle", "Approve and put live {{count}} translations?", { count: i }),
|
|
36
|
+
description: d ? p("i18n.v3.approveLiveAllBodyIn", "They go live straight away for everyone using {{name}}.", { name: d }) : p("i18n.v3.approveLiveAllBody", "Each one goes live straight away for everyone using its language."),
|
|
37
|
+
confirmLabel: p("i18n.v3.approveLiveAll", "Approve and put live ({{count}})", { count: i })
|
|
38
|
+
})) return;
|
|
39
|
+
y(!0);
|
|
40
|
+
let { done: a, failed: o } = await n(e, l, (e) => u.approve(e.id));
|
|
41
|
+
y(!1), m(r(p, a.map(({ result: e }) => e), o.length)), b();
|
|
42
|
+
},
|
|
43
|
+
putLive: async () => {
|
|
44
|
+
let e = u.notLive;
|
|
45
|
+
if (!await h({
|
|
46
|
+
title: p("i18n.v3.putLiveTitle", "Put {{count}} translations live?", { count: t.format(e.length) }),
|
|
47
|
+
description: p("i18n.v3.putLiveBody", "They’re approved already. Every product shows them straight away."),
|
|
48
|
+
confirmLabel: p("i18n.v3.putLive", "Put them live")
|
|
49
|
+
})) return;
|
|
50
|
+
y(!0);
|
|
51
|
+
let { done: r, failed: i } = await n(e, l, (e) => u.publish(e.id));
|
|
52
|
+
y(!1), m(a(p, r.length, i.length)), b();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export { u as useReviewActions };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export interface ReviewRow {
|
|
2
|
+
id: string;
|
|
3
|
+
value: string;
|
|
4
|
+
languageCode: string;
|
|
5
|
+
updatedAt: string;
|
|
6
|
+
key: {
|
|
7
|
+
id: string;
|
|
8
|
+
defaultValue: string | null;
|
|
9
|
+
description: string | null;
|
|
10
|
+
product: {
|
|
11
|
+
id: string;
|
|
12
|
+
displayName: string;
|
|
13
|
+
};
|
|
14
|
+
namespace: {
|
|
15
|
+
id: string;
|
|
16
|
+
displayName: string;
|
|
17
|
+
} | null;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** How many rows a page of the queue shows; Show more adds as many again. */
|
|
21
|
+
export declare const REVIEW_PAGE = 50;
|
|
22
|
+
/** What one approval ended as. */
|
|
23
|
+
export type ApproveOutcome = "live" | "approvedOnly";
|
|
24
|
+
/**
|
|
25
|
+
* How many translations wait for review, in every language (the tab's count).
|
|
26
|
+
* Not asked while the review queue is hidden.
|
|
27
|
+
*/
|
|
28
|
+
export declare function useWaitingCount(enabled: boolean): number | undefined;
|
|
29
|
+
export declare function useReviewQueue(languageCode: string | null): {
|
|
30
|
+
rows: ReviewRow[];
|
|
31
|
+
total: any;
|
|
32
|
+
hasMore: any;
|
|
33
|
+
loading: boolean;
|
|
34
|
+
loadingMore: boolean;
|
|
35
|
+
error: import('@apollo/client').ErrorLike | undefined;
|
|
36
|
+
retry: () => undefined;
|
|
37
|
+
showMore: () => void;
|
|
38
|
+
notLive: ReviewRow[];
|
|
39
|
+
notLiveTotal: any;
|
|
40
|
+
approve: (id: string) => Promise<ApproveOutcome>;
|
|
41
|
+
publish: (id: string) => Promise<void>;
|
|
42
|
+
refresh: () => import('@apollo/client').ApolloClient.RefetchQueriesResult<Promise<{
|
|
43
|
+
data: any;
|
|
44
|
+
error?: import('@apollo/client').ErrorLike;
|
|
45
|
+
}>>;
|
|
46
|
+
};
|
|
47
|
+
export type ReviewQueue = ReturnType<typeof useReviewQueue>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { useApolloClient as e } from "../../node_modules/@apollo/client/react/hooks/useApolloClient.js";
|
|
2
|
+
import { useApproveI18nTranslationMutation as t, useGetI18nTranslationsByStatusQuery as n, usePublishI18nTranslationMutation as r } from "../../generated/global-operations.js";
|
|
3
|
+
import { TranslationStatus as i } from "../../generated/global-types.js";
|
|
4
|
+
import { useCallback as a, useState as o } from "react";
|
|
5
|
+
var s = ["GetI18nTranslationsByStatus"];
|
|
6
|
+
function c(e) {
|
|
7
|
+
return e ? { languageCode: e } : {};
|
|
8
|
+
}
|
|
9
|
+
function l(e) {
|
|
10
|
+
let { data: t } = n({
|
|
11
|
+
variables: {
|
|
12
|
+
filter: { status: i.PendingReview },
|
|
13
|
+
limit: 1
|
|
14
|
+
},
|
|
15
|
+
skip: !e
|
|
16
|
+
});
|
|
17
|
+
return t?.translations.total;
|
|
18
|
+
}
|
|
19
|
+
function u(l) {
|
|
20
|
+
let u = e(), [d, f] = o(50), p = n({
|
|
21
|
+
variables: {
|
|
22
|
+
filter: {
|
|
23
|
+
status: i.PendingReview,
|
|
24
|
+
...c(l)
|
|
25
|
+
},
|
|
26
|
+
limit: d
|
|
27
|
+
},
|
|
28
|
+
notifyOnNetworkStatusChange: !0
|
|
29
|
+
}), m = n({ variables: {
|
|
30
|
+
filter: {
|
|
31
|
+
status: i.Approved,
|
|
32
|
+
...c(l)
|
|
33
|
+
},
|
|
34
|
+
limit: 50
|
|
35
|
+
} }), [h] = t(), [g] = r(), _ = p.data?.translations.items ?? [], v = m.data?.translations.items ?? [], y = a(async (e) => {
|
|
36
|
+
let t = await g({ variables: { id: e } });
|
|
37
|
+
if (t.error) throw t.error;
|
|
38
|
+
}, [g]), b = a(async (e) => {
|
|
39
|
+
let t = await h({ variables: { id: e } });
|
|
40
|
+
if (t.error) throw t.error;
|
|
41
|
+
try {
|
|
42
|
+
return await y(e), "live";
|
|
43
|
+
} catch {
|
|
44
|
+
return "approvedOnly";
|
|
45
|
+
}
|
|
46
|
+
}, [h, y]), x = a(() => u.refetchQueries({ include: s }), [u]);
|
|
47
|
+
return {
|
|
48
|
+
rows: _,
|
|
49
|
+
total: p.data?.translations.total ?? 0,
|
|
50
|
+
hasMore: p.data?.translations.hasMore ?? !1,
|
|
51
|
+
loading: p.loading && _.length === 0,
|
|
52
|
+
loadingMore: p.loading && _.length > 0,
|
|
53
|
+
error: p.error,
|
|
54
|
+
retry: () => void p.refetch(),
|
|
55
|
+
showMore: () => f((e) => e + 50),
|
|
56
|
+
notLive: v,
|
|
57
|
+
notLiveTotal: m.data?.translations.total ?? 0,
|
|
58
|
+
approve: b,
|
|
59
|
+
publish: y,
|
|
60
|
+
refresh: x
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export { u as useReviewQueue, l as useWaitingCount };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { invariant as e } from "../../utilities/invariant/index.js";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
// node_modules/@apollo/client/react/context/ApolloContext.js
|
|
4
|
+
var n = Symbol.for("__APOLLO_CONTEXT__");
|
|
5
|
+
function r() {
|
|
6
|
+
e("createContext" in t, 39);
|
|
7
|
+
let r = t.createContext[n];
|
|
8
|
+
return r || (Object.defineProperty(t.createContext, n, {
|
|
9
|
+
value: r = t.createContext({}),
|
|
10
|
+
enumerable: !1,
|
|
11
|
+
writable: !1,
|
|
12
|
+
configurable: !0
|
|
13
|
+
}), r.displayName = "ApolloContext"), r;
|
|
14
|
+
}
|
|
15
|
+
export { r as getApolloContext };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import e from "../../../../../@wry/equality/lib/index.js";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
// node_modules/@apollo/client/react/hooks/internal/useDeepMemo.js
|
|
4
|
+
function n(n, r) {
|
|
5
|
+
let i = t.useRef(void 0);
|
|
6
|
+
return i.current && e(i.current.deps, r) || (i.current = {
|
|
7
|
+
value: n(),
|
|
8
|
+
deps: r
|
|
9
|
+
}), i.current.value;
|
|
10
|
+
}
|
|
11
|
+
export { n as useDeepMemo };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { canUseDOM as e } from "../../../utilities/internal/canUseDOM.js";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
// node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.js
|
|
4
|
+
var n = e ? t.useLayoutEffect : t.useEffect;
|
|
5
|
+
export { n as useIsomorphicLayoutEffect };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { wrapperSymbol as e } from "../../internal/index.js";
|
|
2
|
+
import { getApolloContext as t } from "../../context/ApolloContext.js";
|
|
3
|
+
import * as n from "react";
|
|
4
|
+
// node_modules/@apollo/client/react/hooks/internal/wrapHook.js
|
|
5
|
+
function r(r, i, a) {
|
|
6
|
+
let o = [a.queryManager, r.startsWith("use") ? n.useContext(t()) : void 0], s = i;
|
|
7
|
+
for (let t of o) {
|
|
8
|
+
let n = t?.[e]?.[r];
|
|
9
|
+
n && (s = n(s));
|
|
10
|
+
}
|
|
11
|
+
return s;
|
|
12
|
+
}
|
|
13
|
+
export { r as wrapHook };
|