@krosoft/react 0.0.383 → 0.0.385
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/i18n/index.d.ts +1 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +4 -3
- package/dist/i18n/krosoftLocales.d.ts +8 -0
- package/dist/i18n/krosoftLocales.d.ts.map +1 -1
- package/dist/i18n/translateKrosoft.d.ts +20 -0
- package/dist/i18n/translateKrosoft.d.ts.map +1 -0
- package/dist/i18n/translateKrosoft.js +18 -0
- package/dist/i18n/useKrosoftTranslation.d.ts +1 -2
- package/dist/i18n/useKrosoftTranslation.d.ts.map +1 -1
- package/dist/i18n/useKrosoftTranslation.js +7 -10
- package/dist/locales/en.json.js +13 -9
- package/dist/locales/fr.json.js +13 -9
- package/dist/query/createQueryClient.d.ts +34 -0
- package/dist/query/createQueryClient.d.ts.map +1 -0
- package/dist/query/createQueryClient.js +35 -0
- package/dist/query/index.d.ts +2 -0
- package/dist/query/index.d.ts.map +1 -0
- package/dist/query/index.js +1 -0
- package/package.json +4 -4
package/dist/i18n/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { KROSOFT_NAMESPACE, krosoftLocales, registerKrosoftLocales } from "./krosoftLocales";
|
|
2
|
+
export { translateKrosoft, type I18nTranslator } from "./translateKrosoft";
|
|
2
3
|
export { dateFnsLocale, useDateFnsLocale } from "./useDateFnsLocale";
|
|
3
4
|
export { useKrosoftTranslation } from "./useKrosoftTranslation";
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/i18n/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/i18n/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { KROSOFT_NAMESPACE as e, krosoftLocales as t, registerKrosoftLocales as n } from "./krosoftLocales.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { translateKrosoft as r } from "./translateKrosoft.js";
|
|
3
|
+
import { dateFnsLocale as i, useDateFnsLocale as a } from "./useDateFnsLocale.js";
|
|
4
|
+
import { useKrosoftTranslation as o } from "./useKrosoftTranslation.js";
|
|
5
|
+
export { e as KROSOFT_NAMESPACE, i as dateFnsLocale, t as krosoftLocales, n as registerKrosoftLocales, r as translateKrosoft, a as useDateFnsLocale, o as useKrosoftTranslation };
|
|
@@ -140,6 +140,10 @@ export declare const krosoftLocales: {
|
|
|
140
140
|
updateAction: string;
|
|
141
141
|
updateDismiss: string;
|
|
142
142
|
};
|
|
143
|
+
query: {
|
|
144
|
+
errorTitle: string;
|
|
145
|
+
mutationErrorTitle: string;
|
|
146
|
+
};
|
|
143
147
|
seasonal: {
|
|
144
148
|
snow: {
|
|
145
149
|
label: string;
|
|
@@ -311,6 +315,10 @@ export declare const krosoftLocales: {
|
|
|
311
315
|
updateAction: string;
|
|
312
316
|
updateDismiss: string;
|
|
313
317
|
};
|
|
318
|
+
query: {
|
|
319
|
+
errorTitle: string;
|
|
320
|
+
mutationErrorTitle: string;
|
|
321
|
+
};
|
|
314
322
|
seasonal: {
|
|
315
323
|
snow: {
|
|
316
324
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"krosoftLocales.d.ts","sourceRoot":"","sources":["../../src/i18n/krosoftLocales.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,8FAA8F;AAC9F,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"krosoftLocales.d.ts","sourceRoot":"","sources":["../../src/i18n/krosoftLocales.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,8FAA8F;AAC9F,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAa,CAAC;AAEzC,gGAAgG;AAChG,UAAU,QAAQ;IAChB,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;IACjH,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;CAC1D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,sBAAsB,GAAI,MAAM,QAAQ,EAAE,gBAAuB;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAO,KAAG,IAM5G,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type InterpolationValues = Record<string, string | number>;
|
|
2
|
+
/** Sous-ensemble d'i18next utile pour traduire hors d'un composant. */
|
|
3
|
+
export interface I18nTranslator {
|
|
4
|
+
t(key: string, options?: Record<string, unknown>): string;
|
|
5
|
+
exists(key: string, options?: Record<string, unknown>): boolean;
|
|
6
|
+
}
|
|
7
|
+
/** Lit une clé pointée dans les traductions françaises embarquées. */
|
|
8
|
+
export declare const readBundled: (key: string) => string | undefined;
|
|
9
|
+
/** Interpolation `{{valeur}}`, alignée sur la syntaxe d'i18next. */
|
|
10
|
+
export declare const interpolate: (text: string, values?: InterpolationValues) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Équivalent de `useKrosoftTranslation` hors de React (callbacks d'un `QueryCache`,
|
|
13
|
+
* services…), sur une instance i18next passée explicitement.
|
|
14
|
+
*
|
|
15
|
+
* Même ordre de résolution : namespace de l'application, puis namespace `krosoft`,
|
|
16
|
+
* puis français embarqué, puis la clé elle-même. Sans instance, on retombe
|
|
17
|
+
* directement sur le français embarqué.
|
|
18
|
+
*/
|
|
19
|
+
export declare const translateKrosoft: (i18n: I18nTranslator | undefined, key: string, values?: InterpolationValues) => string;
|
|
20
|
+
//# sourceMappingURL=translateKrosoft.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translateKrosoft.d.ts","sourceRoot":"","sources":["../../src/i18n/translateKrosoft.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAElE,uEAAuE;AAGvE,MAAM,WAAW,cAAc;IAC7B,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC;IAC1D,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;CACjE;AAED,sEAAsE;AACtE,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,SAMlD,CAAC;AAEF,oEAAoE;AACpE,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,SAAS,mBAAmB,KAAG,MAC+D,CAAC;AAEzI;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,cAAc,GAAG,SAAS,EAAE,KAAK,MAAM,EAAE,SAAS,mBAAmB,KAAG,MAY9G,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import e from "../locales/fr.json.js";
|
|
2
|
+
import { KROSOFT_NAMESPACE as t } from "./krosoftLocales.js";
|
|
3
|
+
//#region src/i18n/translateKrosoft.ts
|
|
4
|
+
var n = (t) => {
|
|
5
|
+
let n = t.split(".").reduce((e, t) => typeof e == "object" && e ? e[t] : void 0, e);
|
|
6
|
+
return typeof n == "string" ? n : void 0;
|
|
7
|
+
}, r = (e, t) => t === void 0 ? e : e.replace(/\{\{(\w+)\}\}/g, (e, n) => n in t ? String(t[n]) : e), i = (e, i, a) => {
|
|
8
|
+
if (e !== void 0) {
|
|
9
|
+
if (e.exists(i)) return e.t(i, a ?? {});
|
|
10
|
+
if (e.exists(i, { ns: "krosoft" })) return e.t(i, {
|
|
11
|
+
...a,
|
|
12
|
+
ns: t
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return r(n(i) ?? i, a);
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { r as interpolate, n as readBundled, i as translateKrosoft };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type InterpolationValues
|
|
1
|
+
import { type InterpolationValues } from "./translateKrosoft";
|
|
2
2
|
/**
|
|
3
3
|
* Traduction unifiée du package : un seul `t`, que la clé vienne de
|
|
4
4
|
* l'application (`headerKey`, `labelKey`, `emptyKey`…) ou du package lui-même.
|
|
@@ -14,5 +14,4 @@ type InterpolationValues = Record<string, string | number>;
|
|
|
14
14
|
export declare const useKrosoftTranslation: () => {
|
|
15
15
|
t: (key: string, values?: InterpolationValues) => string;
|
|
16
16
|
};
|
|
17
|
-
export {};
|
|
18
17
|
//# sourceMappingURL=useKrosoftTranslation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKrosoftTranslation.d.ts","sourceRoot":"","sources":["../../src/i18n/useKrosoftTranslation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useKrosoftTranslation.d.ts","sourceRoot":"","sources":["../../src/i18n/useKrosoftTranslation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,mBAAmB,EAA4B,MAAM,oBAAoB,CAAC;AAExF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,QAAO;IAAE,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,mBAAmB,KAAK,MAAM,CAAA;CAqBlG,CAAC"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import {
|
|
3
|
-
import { useTranslation as
|
|
1
|
+
import { KROSOFT_NAMESPACE as e } from "./krosoftLocales.js";
|
|
2
|
+
import { interpolate as t, readBundled as n } from "./translateKrosoft.js";
|
|
3
|
+
import { useTranslation as r } from "react-i18next";
|
|
4
4
|
//#region src/i18n/useKrosoftTranslation.ts
|
|
5
|
-
var
|
|
6
|
-
let
|
|
7
|
-
return
|
|
8
|
-
}, i = (e, t) => t === void 0 ? e : e.replace(/\{\{(\w+)\}\}/g, (e, n) => n in t ? String(t[n]) : e), a = () => {
|
|
9
|
-
let { t: e, i18n: a, ready: o } = n(t, { useSuspense: !1 }), { t: s } = n(void 0, { useSuspense: !1 });
|
|
10
|
-
return { t: (t, n) => o && a.exists(t) ? s(t, n ?? {}) : o && a.exists(t, { ns: "krosoft" }) ? e(t, n ?? {}) : i(r(t) ?? t, n) };
|
|
5
|
+
var i = () => {
|
|
6
|
+
let { t: i, i18n: a, ready: o } = r(e, { useSuspense: !1 }), { t: s } = r(void 0, { useSuspense: !1 });
|
|
7
|
+
return { t: (e, r) => o && a.exists(e) ? s(e, r ?? {}) : o && a.exists(e, { ns: "krosoft" }) ? i(e, r ?? {}) : t(n(e) ?? e, r) };
|
|
11
8
|
};
|
|
12
9
|
//#endregion
|
|
13
|
-
export {
|
|
10
|
+
export { i as useKrosoftTranslation };
|
package/dist/locales/en.json.js
CHANGED
|
@@ -118,6 +118,9 @@ var e = {
|
|
|
118
118
|
updateAction: "Refresh",
|
|
119
119
|
updateDismiss: "Dismiss"
|
|
120
120
|
}, h = {
|
|
121
|
+
errorTitle: "Failed to load data",
|
|
122
|
+
mutationErrorTitle: "The operation failed"
|
|
123
|
+
}, g = {
|
|
121
124
|
snow: {
|
|
122
125
|
label: "Snow effect",
|
|
123
126
|
description: "Show snowflakes in December",
|
|
@@ -134,22 +137,22 @@ var e = {
|
|
|
134
137
|
messageEnabled: "The pumpkins are out.",
|
|
135
138
|
messageDisabled: "The pumpkins have been put away."
|
|
136
139
|
}
|
|
137
|
-
},
|
|
140
|
+
}, _ = {
|
|
138
141
|
title: "About",
|
|
139
142
|
version: "Version",
|
|
140
143
|
environment: "Environment",
|
|
141
144
|
buildDate: "Build date"
|
|
142
|
-
},
|
|
145
|
+
}, v = {
|
|
143
146
|
copyLink: "Copy link to this section",
|
|
144
147
|
linkCopied: "Link copied to clipboard.",
|
|
145
148
|
linkCopyError: "Unable to copy the link."
|
|
146
|
-
},
|
|
149
|
+
}, y = {
|
|
147
150
|
nav: "Dates",
|
|
148
151
|
empty: "No release notes.",
|
|
149
152
|
noResult: "No release note matches your criteria.",
|
|
150
153
|
tagsPlaceholder: "Categories",
|
|
151
154
|
version: "Version {{version}}"
|
|
152
|
-
},
|
|
155
|
+
}, b = {
|
|
153
156
|
actions: e,
|
|
154
157
|
states: t,
|
|
155
158
|
search: n,
|
|
@@ -165,10 +168,11 @@ var e = {
|
|
|
165
168
|
language: f,
|
|
166
169
|
theme: p,
|
|
167
170
|
pwa: m,
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
query: h,
|
|
172
|
+
seasonal: g,
|
|
173
|
+
about: _,
|
|
174
|
+
markdown: v,
|
|
175
|
+
changelog: y
|
|
172
176
|
};
|
|
173
177
|
//#endregion
|
|
174
|
-
export {
|
|
178
|
+
export { _ as about, e as actions, y as changelog, a as date, b as default, l as dropzone, o as filters, s as form, c as image, f as language, v as markdown, r as notifications, m as pwa, h as query, n as search, g as seasonal, i as select, d as sidebar, t as states, u as table, p as theme };
|
package/dist/locales/fr.json.js
CHANGED
|
@@ -118,6 +118,9 @@ var e = {
|
|
|
118
118
|
updateAction: "Actualiser",
|
|
119
119
|
updateDismiss: "Ignorer"
|
|
120
120
|
}, h = {
|
|
121
|
+
errorTitle: "Échec du chargement des données",
|
|
122
|
+
mutationErrorTitle: "L'opération a échoué"
|
|
123
|
+
}, g = {
|
|
121
124
|
snow: {
|
|
122
125
|
label: "Effet neige",
|
|
123
126
|
description: "Afficher les flocons de neige en décembre",
|
|
@@ -134,22 +137,22 @@ var e = {
|
|
|
134
137
|
messageEnabled: "Les citrouilles sont de sortie.",
|
|
135
138
|
messageDisabled: "Les citrouilles ont été rangées."
|
|
136
139
|
}
|
|
137
|
-
},
|
|
140
|
+
}, _ = {
|
|
138
141
|
title: "À propos",
|
|
139
142
|
version: "Version",
|
|
140
143
|
environment: "Environnement",
|
|
141
144
|
buildDate: "Date de build"
|
|
142
|
-
},
|
|
145
|
+
}, v = {
|
|
143
146
|
copyLink: "Copier le lien vers cette section",
|
|
144
147
|
linkCopied: "Lien copié dans le presse-papiers.",
|
|
145
148
|
linkCopyError: "Impossible de copier le lien."
|
|
146
|
-
},
|
|
149
|
+
}, y = {
|
|
147
150
|
nav: "Dates",
|
|
148
151
|
empty: "Aucune note de version.",
|
|
149
152
|
noResult: "Aucune note ne correspond à vos critères.",
|
|
150
153
|
tagsPlaceholder: "Catégories",
|
|
151
154
|
version: "Version {{version}}"
|
|
152
|
-
},
|
|
155
|
+
}, b = {
|
|
153
156
|
actions: e,
|
|
154
157
|
states: t,
|
|
155
158
|
search: n,
|
|
@@ -165,10 +168,11 @@ var e = {
|
|
|
165
168
|
language: f,
|
|
166
169
|
theme: p,
|
|
167
170
|
pwa: m,
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
query: h,
|
|
172
|
+
seasonal: g,
|
|
173
|
+
about: _,
|
|
174
|
+
markdown: v,
|
|
175
|
+
changelog: y
|
|
172
176
|
};
|
|
173
177
|
//#endregion
|
|
174
|
-
export {
|
|
178
|
+
export { _ as about, e as actions, y as changelog, a as date, b as default, l as dropzone, o as filters, s as form, c as image, f as language, v as markdown, r as notifications, m as pwa, h as query, n as search, g as seasonal, i as select, d as sidebar, t as states, u as table, p as theme };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type DefaultOptions, QueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { type I18nTranslator } from "../i18n/translateKrosoft";
|
|
3
|
+
export interface CreateQueryClientOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Surcharge des options par défaut, fusionnée avec celles du package
|
|
6
|
+
* (`queries.retry: 1`, `mutations.retry: false`).
|
|
7
|
+
*/
|
|
8
|
+
defaultOptions?: DefaultOptions;
|
|
9
|
+
/**
|
|
10
|
+
* Affiche un toast d'erreur global (Sonner) pour toute requête en échec et pour
|
|
11
|
+
* toute mutation sans `onError` déclaré dans `useMutation`. Faux par défaut :
|
|
12
|
+
* à activer seulement si les écrans n'affichent pas déjà leurs propres erreurs.
|
|
13
|
+
*
|
|
14
|
+
* Une requête ou une mutation s'en exclut avec `meta: { errorToast: false }`.
|
|
15
|
+
*/
|
|
16
|
+
errorToast?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Instance i18next de l'application, pour traduire les titres des toasts.
|
|
19
|
+
* Sans elle, les titres restent dans le français embarqué du package.
|
|
20
|
+
*/
|
|
21
|
+
i18n?: I18nTranslator;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Crée le `QueryClient` partagé des applications Krosoft.
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* import i18n from "../i18n/index.js";
|
|
28
|
+
* import { createQueryClient } from "@krosoft/react/query";
|
|
29
|
+
*
|
|
30
|
+
* export const queryClient = createQueryClient({ errorToast: true, i18n });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare const createQueryClient: ({ defaultOptions, errorToast, i18n }?: CreateQueryClientOptions) => QueryClient;
|
|
34
|
+
//# sourceMappingURL=createQueryClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createQueryClient.d.ts","sourceRoot":"","sources":["../../src/query/createQueryClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAA6B,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpG,OAAO,EAAE,KAAK,cAAc,EAAoB,MAAM,0BAA0B,CAAC;AAEjF,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB;AAaD;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAAI,uCAA8C,wBAA6B,KAAG,WAmC/G,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { translateKrosoft as e } from "../i18n/translateKrosoft.js";
|
|
2
|
+
import { getErrorMessage as t } from "@krosoft/core/helpers";
|
|
3
|
+
import { toast as n } from "sonner";
|
|
4
|
+
import { MutationCache as r, QueryCache as i, QueryClient as a } from "@tanstack/react-query";
|
|
5
|
+
//#region src/query/createQueryClient.ts
|
|
6
|
+
var o = {
|
|
7
|
+
queries: { retry: 1 },
|
|
8
|
+
mutations: { retry: !1 }
|
|
9
|
+
}, s = (e) => e?.errorToast === !1, c = ({ defaultOptions: c, errorToast: l = !1, i18n: u } = {}) => {
|
|
10
|
+
let d = {
|
|
11
|
+
...c,
|
|
12
|
+
queries: {
|
|
13
|
+
...o.queries,
|
|
14
|
+
...c?.queries
|
|
15
|
+
},
|
|
16
|
+
mutations: {
|
|
17
|
+
...o.mutations,
|
|
18
|
+
...c?.mutations
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
return l ? new a({
|
|
22
|
+
defaultOptions: d,
|
|
23
|
+
queryCache: new i({ onError: (r, i) => {
|
|
24
|
+
s(i.meta) || n.error(e(u, "query.errorTitle"), {
|
|
25
|
+
id: i.queryHash,
|
|
26
|
+
description: t(r)
|
|
27
|
+
});
|
|
28
|
+
} }),
|
|
29
|
+
mutationCache: new r({ onError: (r, i, a, o) => {
|
|
30
|
+
o.options.onError || s(o.meta) || n.error(e(u, "query.mutationErrorTitle"), { description: t(r) });
|
|
31
|
+
} })
|
|
32
|
+
}) : new a({ defaultOptions: d });
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
export { c as createQueryClient };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/query/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createQueryClient } from "./createQueryClient.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krosoft/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.385",
|
|
4
4
|
"description": "Krosoft shared React package",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"@storybook/addon-docs": "^10.6.5",
|
|
118
118
|
"@storybook/addon-themes": "^10.6.5",
|
|
119
119
|
"@storybook/react-vite": "^10.6.5",
|
|
120
|
-
"@tanstack/react-query": "^5.105.
|
|
120
|
+
"@tanstack/react-query": "^5.105.2",
|
|
121
121
|
"@testing-library/dom": "^10.4.2",
|
|
122
122
|
"@testing-library/react": "^16.3.3",
|
|
123
123
|
"@types/node": "^25.9.9",
|
|
@@ -125,13 +125,13 @@
|
|
|
125
125
|
"@types/react-dom": "^19.3.0",
|
|
126
126
|
"autoprefixer": "^10.6.2",
|
|
127
127
|
"eslint-plugin-storybook": "10.6.5",
|
|
128
|
-
"i18next": "^26.
|
|
128
|
+
"i18next": "^26.7.1",
|
|
129
129
|
"jsdom": "^30.1.3",
|
|
130
130
|
"next-themes": "^0.4.6",
|
|
131
131
|
"prettier": "^3.9.10",
|
|
132
132
|
"react": "^19.3.1",
|
|
133
133
|
"react-dom": "^19.3.1",
|
|
134
|
-
"react-i18next": "^17.1.
|
|
134
|
+
"react-i18next": "^17.1.11",
|
|
135
135
|
"react-router-dom": "^7.18.5",
|
|
136
136
|
"react-snowfall": "^2.4.0",
|
|
137
137
|
"storybook": "^10.6.5",
|