@burdenoff/microfe-i18n 2026.1125.1 → 2026.1129.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.
- 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/I18nRoot.js +43 -42
- package/dist/i18n/I18nRoutes.d.ts +20 -1
- package/dist/i18n/I18nRoutes.js +59 -37
- package/dist/i18n/utils/paths.d.ts +6 -0
- package/dist/i18n/utils/paths.js +5 -0
- package/dist/i18n/v2/LanguagesPage.d.ts +3 -0
- package/dist/i18n/v2/LanguagesPage.js +82 -0
- package/dist/i18n/v2/LanguagesTab.d.ts +8 -0
- package/dist/i18n/v2/LanguagesTab.js +102 -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 +76 -0
- package/dist/i18n/v2/model.js +87 -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 +9 -0
- package/dist/i18n/v2/useReviewActions.js +56 -0
- package/dist/i18n/v2/useReviewQueue.d.ts +44 -0
- package/dist/i18n/v2/useReviewQueue.js +60 -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 +13 -5
|
@@ -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) {
|
|
10
|
+
let f = e(), p = c(), m = s(), [h, g] = o(/* @__PURE__ */ new Set()), [_, v] = o(!1), y = () => {
|
|
11
|
+
u.refresh(), d();
|
|
12
|
+
};
|
|
13
|
+
return {
|
|
14
|
+
busy: h,
|
|
15
|
+
bulk: _,
|
|
16
|
+
approveOne: async (e) => {
|
|
17
|
+
g((t) => new Set(t).add(e.id));
|
|
18
|
+
try {
|
|
19
|
+
p(i(f, await u.approve(e.id))), y();
|
|
20
|
+
} catch {
|
|
21
|
+
p({
|
|
22
|
+
title: f("i18n.v3.approveFailed", "Couldn’t approve it. Try again."),
|
|
23
|
+
tone: "error"
|
|
24
|
+
});
|
|
25
|
+
} finally {
|
|
26
|
+
g((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;
|
|
34
|
+
if (!await m({
|
|
35
|
+
title: f("i18n.v3.approveAllTitle", "Approve {{count}} translations?", { count: t.format(e.length) }),
|
|
36
|
+
description: f("i18n.v3.approveAllBody", "They go live in every product straight away."),
|
|
37
|
+
confirmLabel: f("i18n.v3.approveAll", "Approve all shown")
|
|
38
|
+
})) return;
|
|
39
|
+
v(!0);
|
|
40
|
+
let { done: i, failed: a } = await n(e, l, (e) => u.approve(e.id));
|
|
41
|
+
v(!1), p(r(f, i.map(({ result: e }) => e), a.length)), y();
|
|
42
|
+
},
|
|
43
|
+
putLive: async () => {
|
|
44
|
+
let e = u.notLive;
|
|
45
|
+
if (!await m({
|
|
46
|
+
title: f("i18n.v3.putLiveTitle", "Put {{count}} translations live?", { count: t.format(e.length) }),
|
|
47
|
+
description: f("i18n.v3.putLiveBody", "They’re approved already. Every product shows them straight away."),
|
|
48
|
+
confirmLabel: f("i18n.v3.putLive", "Put them live")
|
|
49
|
+
})) return;
|
|
50
|
+
v(!0);
|
|
51
|
+
let { done: r, failed: i } = await n(e, l, (e) => u.publish(e.id));
|
|
52
|
+
v(!1), p(a(f, r.length, i.length)), y();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export { u as useReviewActions };
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
/** How many translations wait for review, in every language (the tab's count). */
|
|
25
|
+
export declare function useWaitingCount(): number | undefined;
|
|
26
|
+
export declare function useReviewQueue(languageCode: string | null): {
|
|
27
|
+
rows: ReviewRow[];
|
|
28
|
+
total: any;
|
|
29
|
+
hasMore: any;
|
|
30
|
+
loading: boolean;
|
|
31
|
+
loadingMore: boolean;
|
|
32
|
+
error: import('@apollo/client').ErrorLike | undefined;
|
|
33
|
+
retry: () => undefined;
|
|
34
|
+
showMore: () => void;
|
|
35
|
+
notLive: ReviewRow[];
|
|
36
|
+
notLiveTotal: any;
|
|
37
|
+
approve: (id: string) => Promise<ApproveOutcome>;
|
|
38
|
+
publish: (id: string) => Promise<void>;
|
|
39
|
+
refresh: () => import('@apollo/client').ApolloClient.RefetchQueriesResult<Promise<{
|
|
40
|
+
data: any;
|
|
41
|
+
error?: import('@apollo/client').ErrorLike;
|
|
42
|
+
}>>;
|
|
43
|
+
};
|
|
44
|
+
export type ReviewQueue = ReturnType<typeof useReviewQueue>;
|
|
@@ -0,0 +1,60 @@
|
|
|
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() {
|
|
10
|
+
let { data: e } = n({ variables: {
|
|
11
|
+
filter: { status: i.PendingReview },
|
|
12
|
+
limit: 1
|
|
13
|
+
} });
|
|
14
|
+
return e?.translations.total;
|
|
15
|
+
}
|
|
16
|
+
function u(l) {
|
|
17
|
+
let u = e(), [d, f] = o(50), p = n({
|
|
18
|
+
variables: {
|
|
19
|
+
filter: {
|
|
20
|
+
status: i.PendingReview,
|
|
21
|
+
...c(l)
|
|
22
|
+
},
|
|
23
|
+
limit: d
|
|
24
|
+
},
|
|
25
|
+
notifyOnNetworkStatusChange: !0
|
|
26
|
+
}), m = n({ variables: {
|
|
27
|
+
filter: {
|
|
28
|
+
status: i.Approved,
|
|
29
|
+
...c(l)
|
|
30
|
+
},
|
|
31
|
+
limit: 50
|
|
32
|
+
} }), [h] = t(), [g] = r(), _ = p.data?.translations.items ?? [], v = m.data?.translations.items ?? [], y = a(async (e) => {
|
|
33
|
+
let t = await g({ variables: { id: e } });
|
|
34
|
+
if (t.error) throw t.error;
|
|
35
|
+
}, [g]), b = a(async (e) => {
|
|
36
|
+
let t = await h({ variables: { id: e } });
|
|
37
|
+
if (t.error) throw t.error;
|
|
38
|
+
try {
|
|
39
|
+
return await y(e), "live";
|
|
40
|
+
} catch {
|
|
41
|
+
return "approvedOnly";
|
|
42
|
+
}
|
|
43
|
+
}, [h, y]), x = a(() => u.refetchQueries({ include: s }), [u]);
|
|
44
|
+
return {
|
|
45
|
+
rows: _,
|
|
46
|
+
total: p.data?.translations.total ?? 0,
|
|
47
|
+
hasMore: p.data?.translations.hasMore ?? !1,
|
|
48
|
+
loading: p.loading && _.length === 0,
|
|
49
|
+
loadingMore: p.loading && _.length > 0,
|
|
50
|
+
error: p.error,
|
|
51
|
+
retry: () => void p.refetch(),
|
|
52
|
+
showMore: () => f((e) => e + 50),
|
|
53
|
+
notLive: v,
|
|
54
|
+
notLiveTotal: m.data?.translations.total ?? 0,
|
|
55
|
+
approve: b,
|
|
56
|
+
publish: y,
|
|
57
|
+
refresh: x
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
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 };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { invariant as e } from "../../utilities/invariant/index.js";
|
|
2
|
+
import { getApolloContext as t } from "../context/ApolloContext.js";
|
|
3
|
+
import * as n from "react";
|
|
4
|
+
// node_modules/@apollo/client/react/hooks/useApolloClient.js
|
|
5
|
+
function r(r) {
|
|
6
|
+
let i = n.useContext(t()), a = r || i.client;
|
|
7
|
+
return e(!!a, 30), a;
|
|
8
|
+
}
|
|
9
|
+
export { r as useApolloClient };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import e from "../../../../@wry/equality/lib/index.js";
|
|
2
|
+
import { mergeOptions as t } from "../../utilities/internal/mergeOptions.js";
|
|
3
|
+
import { preventUnhandledRejection as n } from "../../utilities/internal/preventUnhandledRejection.js";
|
|
4
|
+
import { useIsomorphicLayoutEffect as r } from "./internal/useIsomorphicLayoutEffect.js";
|
|
5
|
+
import { useApolloClient as i } from "./useApolloClient.js";
|
|
6
|
+
import * as a from "react";
|
|
7
|
+
// node_modules/@apollo/client/react/hooks/useMutation.js
|
|
8
|
+
var o = function(o, c) {
|
|
9
|
+
let l = i(c?.client), [u, d] = a.useState(() => s(l)), f = a.useRef({
|
|
10
|
+
result: u,
|
|
11
|
+
mutationId: 0,
|
|
12
|
+
isMounted: !0,
|
|
13
|
+
client: l,
|
|
14
|
+
mutation: o,
|
|
15
|
+
options: c
|
|
16
|
+
});
|
|
17
|
+
r(() => {
|
|
18
|
+
Object.assign(f.current, {
|
|
19
|
+
client: l,
|
|
20
|
+
options: c,
|
|
21
|
+
mutation: o
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
let p = a.useCallback((r = {}) => {
|
|
25
|
+
let { options: i, mutation: a } = f.current, o = {
|
|
26
|
+
...i,
|
|
27
|
+
mutation: a
|
|
28
|
+
}, s = r.client || f.current.client, c = typeof r.context == "function" ? r.context(i?.context) : r.context;
|
|
29
|
+
!f.current.result.loading && f.current.isMounted && d(f.current.result = {
|
|
30
|
+
loading: !0,
|
|
31
|
+
error: void 0,
|
|
32
|
+
data: void 0,
|
|
33
|
+
called: !0,
|
|
34
|
+
client: s
|
|
35
|
+
});
|
|
36
|
+
let l = ++f.current.mutationId, u = t(o, {
|
|
37
|
+
...r,
|
|
38
|
+
context: c
|
|
39
|
+
});
|
|
40
|
+
return n(s.mutate(u).then((t) => {
|
|
41
|
+
let { data: n, error: i } = t, a = r.onError || f.current.options?.onError;
|
|
42
|
+
if (i && a && a(i, u), l === f.current.mutationId) {
|
|
43
|
+
let t = {
|
|
44
|
+
called: !0,
|
|
45
|
+
loading: !1,
|
|
46
|
+
data: n,
|
|
47
|
+
error: i,
|
|
48
|
+
client: s
|
|
49
|
+
};
|
|
50
|
+
f.current.isMounted && !e(f.current.result, t) && d(f.current.result = t);
|
|
51
|
+
}
|
|
52
|
+
let o = r.onCompleted || f.current.options?.onCompleted;
|
|
53
|
+
return i || o?.(t.data, u), t;
|
|
54
|
+
}, (t) => {
|
|
55
|
+
if (l === f.current.mutationId && f.current.isMounted) {
|
|
56
|
+
let n = {
|
|
57
|
+
loading: !1,
|
|
58
|
+
error: t,
|
|
59
|
+
data: void 0,
|
|
60
|
+
called: !0,
|
|
61
|
+
client: s
|
|
62
|
+
};
|
|
63
|
+
e(f.current.result, n) || d(f.current.result = n);
|
|
64
|
+
}
|
|
65
|
+
let n = r.onError || f.current.options?.onError;
|
|
66
|
+
throw n && n(t, u), t;
|
|
67
|
+
}));
|
|
68
|
+
}, []), m = a.useCallback(() => {
|
|
69
|
+
if (f.current.isMounted) {
|
|
70
|
+
let e = s(f.current.client);
|
|
71
|
+
Object.assign(f.current, {
|
|
72
|
+
mutationId: 0,
|
|
73
|
+
result: e
|
|
74
|
+
}), d(e);
|
|
75
|
+
}
|
|
76
|
+
}, []);
|
|
77
|
+
return a.useEffect(() => {
|
|
78
|
+
let e = f.current;
|
|
79
|
+
return e.isMounted = !0, () => {
|
|
80
|
+
e.isMounted = !1;
|
|
81
|
+
};
|
|
82
|
+
}, []), [p, {
|
|
83
|
+
reset: m,
|
|
84
|
+
...u
|
|
85
|
+
}];
|
|
86
|
+
};
|
|
87
|
+
function s(e) {
|
|
88
|
+
return {
|
|
89
|
+
data: void 0,
|
|
90
|
+
error: void 0,
|
|
91
|
+
called: !1,
|
|
92
|
+
loading: !1,
|
|
93
|
+
client: e
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export { o as useMutation };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import e from "../../../../@wry/equality/lib/index.js";
|
|
2
|
+
import { asapScheduler as t } from "../../../../rxjs/dist/esm5/internal/scheduler/asap.js";
|
|
3
|
+
import { observeOn as n } from "../../../../rxjs/dist/esm5/internal/operators/observeOn.js";
|
|
4
|
+
import { maybeDeepFreeze as r } from "../../utilities/internal/maybeDeepFreeze.js";
|
|
5
|
+
import { mergeOptions as i } from "../../utilities/internal/mergeOptions.js";
|
|
6
|
+
import { variablesUnknownSymbol as a } from "../../utilities/internal/constants.js";
|
|
7
|
+
import { skipToken as o } from "./constants.js";
|
|
8
|
+
import { useDeepMemo as s } from "./internal/useDeepMemo.js";
|
|
9
|
+
import { wrapHook as c } from "./internal/wrapHook.js";
|
|
10
|
+
import { useApolloClient as l } from "./useApolloClient.js";
|
|
11
|
+
import { useSyncExternalStore as u } from "./useSyncExternalStore.js";
|
|
12
|
+
import * as d from "react";
|
|
13
|
+
import { NetworkStatus as f } from "@apollo/client";
|
|
14
|
+
// node_modules/@apollo/client/react/hooks/useQuery.js
|
|
15
|
+
var p = Symbol(), m = function(e, ...[t]) {
|
|
16
|
+
"use no memo";
|
|
17
|
+
return c("useQuery", h, l(typeof t == "object" ? t.client : void 0))(e, t);
|
|
18
|
+
};
|
|
19
|
+
function h(e, t = {}) {
|
|
20
|
+
let n = l(typeof t == "object" ? t.client : void 0), { ssr: r } = typeof t == "object" ? t : {}, i = _(e, t, n.defaultOptions.watchQuery);
|
|
21
|
+
function a(t) {
|
|
22
|
+
let r = n.watchQuery(i);
|
|
23
|
+
return {
|
|
24
|
+
client: n,
|
|
25
|
+
query: e,
|
|
26
|
+
observable: r,
|
|
27
|
+
resultData: {
|
|
28
|
+
current: r.getCurrentResult(),
|
|
29
|
+
previousData: t?.resultData.current.data,
|
|
30
|
+
variables: r.variables
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
let [o, s] = d.useState(a);
|
|
35
|
+
(n !== o.client || e !== o.query) && s(o = a(o));
|
|
36
|
+
let { observable: c, resultData: u } = o;
|
|
37
|
+
v(i, c), b(u, c, i);
|
|
38
|
+
let f = y(c, u, r), p = d.useMemo(() => ({
|
|
39
|
+
refetch: c.refetch.bind(c),
|
|
40
|
+
fetchMore: c.fetchMore.bind(c),
|
|
41
|
+
updateQuery: c.updateQuery.bind(c),
|
|
42
|
+
startPolling: c.startPolling.bind(c),
|
|
43
|
+
stopPolling: c.stopPolling.bind(c),
|
|
44
|
+
subscribeToMore: c.subscribeToMore.bind(c)
|
|
45
|
+
}), [c]), m = u.previousData;
|
|
46
|
+
return d.useMemo(() => {
|
|
47
|
+
let { partial: e, ...t } = f;
|
|
48
|
+
return {
|
|
49
|
+
...t,
|
|
50
|
+
client: n,
|
|
51
|
+
observable: c,
|
|
52
|
+
variables: c.variables,
|
|
53
|
+
previousData: m,
|
|
54
|
+
...p
|
|
55
|
+
};
|
|
56
|
+
}, [
|
|
57
|
+
f,
|
|
58
|
+
n,
|
|
59
|
+
c,
|
|
60
|
+
m,
|
|
61
|
+
p
|
|
62
|
+
]);
|
|
63
|
+
}
|
|
64
|
+
var g = Symbol();
|
|
65
|
+
function _(e, t, n) {
|
|
66
|
+
return s(() => {
|
|
67
|
+
if (t === o) {
|
|
68
|
+
let t = {
|
|
69
|
+
...i(n, {
|
|
70
|
+
query: e,
|
|
71
|
+
fetchPolicy: "standby"
|
|
72
|
+
}),
|
|
73
|
+
[a]: !0
|
|
74
|
+
};
|
|
75
|
+
return t[g] = !0, t;
|
|
76
|
+
}
|
|
77
|
+
let r = i(n, {
|
|
78
|
+
...t,
|
|
79
|
+
query: e
|
|
80
|
+
});
|
|
81
|
+
return t.skip && (r.initialFetchPolicy = t.initialFetchPolicy || t.fetchPolicy, r.fetchPolicy = "standby"), r;
|
|
82
|
+
}, [
|
|
83
|
+
e,
|
|
84
|
+
t,
|
|
85
|
+
n
|
|
86
|
+
]);
|
|
87
|
+
}
|
|
88
|
+
function v(e, t) {
|
|
89
|
+
"use no memo";
|
|
90
|
+
e.fetchPolicy ||= t.options.initialFetchPolicy;
|
|
91
|
+
}
|
|
92
|
+
function y(r, i, a) {
|
|
93
|
+
"use no memo";
|
|
94
|
+
let o = r.options.fetchPolicy;
|
|
95
|
+
return u(d.useCallback((a) => {
|
|
96
|
+
let o = r.pipe(n(t)).subscribe((t) => {
|
|
97
|
+
let n = i.current;
|
|
98
|
+
e(n, t) && e(i.variables, r.variables) || (i.variables = r.variables, n.data && !e(n.data, t.data) && (i.previousData = n.data), i.current = t, a());
|
|
99
|
+
});
|
|
100
|
+
return () => {
|
|
101
|
+
setTimeout(() => o.unsubscribe());
|
|
102
|
+
};
|
|
103
|
+
}, [r, i]), () => i.current, () => o !== "standby" && a === !1 || o === "no-cache" ? m.ssrDisabledResult : i.current);
|
|
104
|
+
}
|
|
105
|
+
function b(t, n, r) {
|
|
106
|
+
"use no memo";
|
|
107
|
+
if (n[p] && !e(n[p], r)) {
|
|
108
|
+
n[p][g] && !r.initialFetchPolicy && (r.initialFetchPolicy = r.fetchPolicy), x(n[p], r) ? n.reobserve(r) : n.applyOptions(r);
|
|
109
|
+
let i = n.getCurrentResult();
|
|
110
|
+
e(i.data, t.current.data) || (t.previousData = t.current.data || t.previousData), t.current = i, t.variables = n.variables;
|
|
111
|
+
}
|
|
112
|
+
n[p] = r;
|
|
113
|
+
}
|
|
114
|
+
function x(t, n) {
|
|
115
|
+
return t.query !== n.query || !e(t.variables, n.variables) || t.fetchPolicy !== n.fetchPolicy && (n.fetchPolicy === "standby" || t.fetchPolicy === "standby");
|
|
116
|
+
}
|
|
117
|
+
m.ssrDisabledResult = r({
|
|
118
|
+
loading: !0,
|
|
119
|
+
data: void 0,
|
|
120
|
+
dataState: "empty",
|
|
121
|
+
error: void 0,
|
|
122
|
+
networkStatus: f.loading,
|
|
123
|
+
partial: !0
|
|
124
|
+
});
|
|
125
|
+
export { m as useQuery };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { canUseDOM as e } from "../../utilities/internal/canUseDOM.js";
|
|
2
|
+
import { maybe as t } from "../../utilities/internal/globals/maybe.js";
|
|
3
|
+
import "../../utilities/invariant/index.js";
|
|
4
|
+
import * as n from "react";
|
|
5
|
+
// node_modules/@apollo/client/react/hooks/useSyncExternalStore.js
|
|
6
|
+
var r = n.useSyncExternalStore, i = t(() => navigator.product) == "ReactNative", a = t(() => navigator.userAgent.indexOf("jsdom") >= 0) || !1, o = (e || i) && !a, s = r || ((e, t, r) => {
|
|
7
|
+
let i = t(), [{ inst: a }, s] = n.useState({ inst: {
|
|
8
|
+
value: i,
|
|
9
|
+
getSnapshot: t
|
|
10
|
+
} });
|
|
11
|
+
return o ? n.useLayoutEffect(() => {
|
|
12
|
+
Object.assign(a, {
|
|
13
|
+
value: i,
|
|
14
|
+
getSnapshot: t
|
|
15
|
+
}), c(a) && s({ inst: a });
|
|
16
|
+
}, [
|
|
17
|
+
e,
|
|
18
|
+
i,
|
|
19
|
+
t
|
|
20
|
+
]) : Object.assign(a, {
|
|
21
|
+
value: i,
|
|
22
|
+
getSnapshot: t
|
|
23
|
+
}), n.useEffect(() => (c(a) && s({ inst: a }), e(function() {
|
|
24
|
+
c(a) && s({ inst: a });
|
|
25
|
+
})), [e]), i;
|
|
26
|
+
});
|
|
27
|
+
function c({ value: e, getSnapshot: t }) {
|
|
28
|
+
try {
|
|
29
|
+
return e !== t();
|
|
30
|
+
} catch {
|
|
31
|
+
return !0;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export { s as useSyncExternalStore };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// node_modules/@apollo/client/utilities/internal/compact.js
|
|
2
|
+
function e(...e) {
|
|
3
|
+
let t = {};
|
|
4
|
+
return e.forEach((e) => {
|
|
5
|
+
e && Reflect.ownKeys(e).forEach((n) => {
|
|
6
|
+
let r = e[n];
|
|
7
|
+
r !== void 0 && (t[n] = r);
|
|
8
|
+
});
|
|
9
|
+
}), t;
|
|
10
|
+
}
|
|
11
|
+
export { e as compact };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { isNonNullObject as e } from "./isNonNullObject.js";
|
|
2
|
+
// node_modules/@apollo/client/utilities/internal/deepFreeze.js
|
|
3
|
+
function t(t) {
|
|
4
|
+
let r = /* @__PURE__ */ new Set([t]);
|
|
5
|
+
return r.forEach((t) => {
|
|
6
|
+
e(t) && n(t) === t && Object.getOwnPropertyNames(t).forEach((n) => {
|
|
7
|
+
e(t[n]) && r.add(t[n]);
|
|
8
|
+
});
|
|
9
|
+
}), t;
|
|
10
|
+
}
|
|
11
|
+
function n(e) {
|
|
12
|
+
return e;
|
|
13
|
+
}
|
|
14
|
+
export { t as deepFreeze };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { maybe as e } from "./maybe.js";
|
|
2
|
+
// node_modules/@apollo/client/utilities/internal/globals/global.js
|
|
3
|
+
var t = e(() => globalThis) || e(() => window) || e(() => self) || e(() => global) || e(function() {
|
|
4
|
+
return e.constructor("return this")();
|
|
5
|
+
});
|
|
6
|
+
export { t as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { compact as e } from "./compact.js";
|
|
2
|
+
// node_modules/@apollo/client/utilities/internal/mergeOptions.js
|
|
3
|
+
function t(t, n) {
|
|
4
|
+
return e(t, n, n.variables && { variables: e({
|
|
5
|
+
...t && t.variables,
|
|
6
|
+
...n.variables
|
|
7
|
+
}) });
|
|
8
|
+
}
|
|
9
|
+
export { t as mergeOptions };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { makeUniqueId as e } from "./makeUniqueId.js";
|
|
2
|
+
// node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js
|
|
3
|
+
function t(t, n = 0) {
|
|
4
|
+
let r = e("stringifyForDisplay");
|
|
5
|
+
return JSON.stringify(t, (e, t) => t === void 0 ? r : t, n).split(JSON.stringify(r)).join("<undefined>");
|
|
6
|
+
}
|
|
7
|
+
export { t as stringifyForDisplay };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import e from "../internal/globals/global.js";
|
|
2
|
+
import { version as t } from "../../version.js";
|
|
3
|
+
import { stringifyForDisplay as n } from "../internal/stringifyForDisplay.js";
|
|
4
|
+
// node_modules/@apollo/client/utilities/invariant/index.js
|
|
5
|
+
var r = "Invariant Violation", i = class e extends Error {
|
|
6
|
+
constructor(t = r) {
|
|
7
|
+
super(t), this.name = r, Object.setPrototypeOf(this, e.prototype);
|
|
8
|
+
}
|
|
9
|
+
}, a = [
|
|
10
|
+
"debug",
|
|
11
|
+
"log",
|
|
12
|
+
"warn",
|
|
13
|
+
"error",
|
|
14
|
+
"silent"
|
|
15
|
+
], o = a.indexOf("silent");
|
|
16
|
+
function s(e, ...t) {
|
|
17
|
+
if (!e) throw l(...t);
|
|
18
|
+
}
|
|
19
|
+
function c(e) {
|
|
20
|
+
return function(t, ...n) {
|
|
21
|
+
if (a.indexOf(e) >= o) {
|
|
22
|
+
let r = console[e] || console.log;
|
|
23
|
+
if (typeof t == "number") {
|
|
24
|
+
let e = t;
|
|
25
|
+
t = f(e), t || (t = p(e, n), n = []);
|
|
26
|
+
}
|
|
27
|
+
r(t, ...n);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
s.debug = c("debug"), s.log = c("log"), s.warn = c("warn"), s.error = c("error");
|
|
32
|
+
function l(e, ...t) {
|
|
33
|
+
return new i(f(e, t) || p(e, t));
|
|
34
|
+
}
|
|
35
|
+
var u = Symbol.for("ApolloErrorMessageHandler_" + t);
|
|
36
|
+
function d(e) {
|
|
37
|
+
if (typeof e == "string") return e;
|
|
38
|
+
try {
|
|
39
|
+
return n(e, 2).slice(0, 1e3);
|
|
40
|
+
} catch {
|
|
41
|
+
return "<non-serializable>";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function f(t, n = []) {
|
|
45
|
+
if (t) return e[u] && e[u](t, n.map(d));
|
|
46
|
+
}
|
|
47
|
+
function p(e, n = []) {
|
|
48
|
+
if (e) return typeof e == "string" ? n.reduce((e, t) => e.replace(/%[sdfo]/, d(t)), e) : `An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#${encodeURIComponent(JSON.stringify({
|
|
49
|
+
version: t,
|
|
50
|
+
message: e,
|
|
51
|
+
args: n.map(d)
|
|
52
|
+
}))}`;
|
|
53
|
+
}
|
|
54
|
+
export { u as ApolloErrorMessageHandler, i as InvariantError, s as invariant, l as newInvariantError };
|