@burdenoff/microfe-proserviceworld 2026.827.1 → 2026.1009.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/index.js +4 -4
- package/dist/proserviceworld/components/ui.js +1 -1
- package/dist/proserviceworld/components/ui.js.map +1 -1
- package/dist/proserviceworld/hooks/useProServiceWorldApi.d.ts.map +1 -1
- package/dist/proserviceworld/hooks/useProServiceWorldApi.js.map +1 -1
- package/dist/proserviceworld/hooks/useTr.d.ts +19 -0
- package/dist/proserviceworld/hooks/useTr.d.ts.map +1 -0
- package/dist/proserviceworld/hooks/useTr.js +33 -0
- package/dist/proserviceworld/hooks/useTr.js.map +1 -0
- package/dist/proserviceworld/i18n/index.d.ts +1 -1
- package/dist/proserviceworld/i18n/index.d.ts.map +1 -1
- package/dist/proserviceworld/i18n/index.js +723 -18
- package/dist/proserviceworld/i18n/index.js.map +1 -1
- package/dist/proserviceworld/index.js +4 -4
- package/dist/proserviceworld/pages/ClientsPage.d.ts.map +1 -1
- package/dist/proserviceworld/pages/ClientsPage.js +166 -164
- package/dist/proserviceworld/pages/ClientsPage.js.map +1 -1
- package/dist/proserviceworld/pages/DashboardPage.d.ts.map +1 -1
- package/dist/proserviceworld/pages/DashboardPage.js +152 -142
- package/dist/proserviceworld/pages/DashboardPage.js.map +1 -1
- package/dist/proserviceworld/pages/EngagementsPage.d.ts.map +1 -1
- package/dist/proserviceworld/pages/EngagementsPage.js +135 -135
- package/dist/proserviceworld/pages/EngagementsPage.js.map +1 -1
- package/dist/proserviceworld/pages/MattersPage.d.ts.map +1 -1
- package/dist/proserviceworld/pages/MattersPage.js +204 -197
- package/dist/proserviceworld/pages/MattersPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTr.d.ts","sourceRoot":"","sources":["../../../src/proserviceworld/hooks/useTr.ts"],"names":[],"mappings":"AA4BA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,KAAK,IAAI,CACvB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KACrC,MAAM,CA6BV"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { t as e } from "../i18n/index.js";
|
|
2
|
+
import { useCallback as t } from "react";
|
|
3
|
+
import { useI18n as n } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
4
|
+
//#region src/proserviceworld/hooks/useTr.ts
|
|
5
|
+
function r(e, t) {
|
|
6
|
+
return t ? Object.entries(t).reduce((e, [t, n]) => e.replace(RegExp(`\\{\\{${t}\\}\\}`, "g"), String(n)), e) : e;
|
|
7
|
+
}
|
|
8
|
+
function i() {
|
|
9
|
+
try {
|
|
10
|
+
return n();
|
|
11
|
+
} catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function a() {
|
|
16
|
+
let n = i();
|
|
17
|
+
return t((t, i, a) => {
|
|
18
|
+
let o;
|
|
19
|
+
if (n) {
|
|
20
|
+
let e = n.t(t);
|
|
21
|
+
e !== t && (o = e);
|
|
22
|
+
}
|
|
23
|
+
if (o === void 0) {
|
|
24
|
+
let n = e(t);
|
|
25
|
+
n !== t && (o = n);
|
|
26
|
+
}
|
|
27
|
+
return (o === void 0 || o === t) && (o = i), r(o, a);
|
|
28
|
+
}, [n]);
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { a as useTr };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=useTr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTr.js","names":[],"sources":["../../../src/proserviceworld/hooks/useTr.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { t as localT } from '../i18n';\n\n/**\n * Replace {{key}} placeholders in a template string.\n */\nfunction interpolate(template: string, params?: Record<string, string | number>): string {\n if (!params) return template;\n return Object.entries(params).reduce(\n (str, [key, value]) => str.replace(new RegExp(`\\\\{\\\\{${key}\\\\}\\\\}`, 'g'), String(value)),\n template\n );\n}\n\n/**\n * Safely access the shell I18nProvider if the MFE is mounted inside an\n * AppShellProvider. In standalone dev harnesses or tests the provider may be\n * absent; in that case we fall back to the local bundled translations.\n */\nfunction useShellI18nSafe() {\n try {\n return useI18n();\n } catch {\n return null;\n }\n}\n\n/**\n * useTr — translation hook with fallback semantics for ProServiceWorld MFE.\n *\n * Wraps the shell's `useI18n().t()` and the local bundled `t()` so that:\n * - when running inside the app shell, shell translations take precedence;\n * - when a key is missing from the shell, the MFE's curated local bundle is\n * used (useful for dev harnesses and offline fallback);\n * - when neither source has the key, the caller's English fallback string is\n * shown instead of leaking a raw key into the UI.\n *\n * Supports optional interpolation params using `{{key}}` placeholders.\n *\n * @example\n * const tr = useTr();\n * return <h1>{tr('psw.dashboard.title', 'Practice overview')}</h1>;\n * return <p>{tr('psw.clients.selected', '{{count}} clients', { count: 5 })}</p>;\n */\nexport function useTr(): (\n key: string,\n fallback: string,\n params?: Record<string, string | number>\n) => string {\n const shellI18n = useShellI18nSafe();\n\n return useCallback(\n (key: string, fallback: string, params?: Record<string, string | number>): string => {\n let value: string | undefined;\n\n if (shellI18n) {\n const shellValue = shellI18n.t(key);\n if (shellValue !== key) {\n value = shellValue;\n }\n }\n\n if (value === undefined) {\n const localValue = localT(key);\n if (localValue !== key) {\n value = localValue;\n }\n }\n\n if (value === undefined || value === key) {\n value = fallback;\n }\n\n return interpolate(value, params);\n },\n [shellI18n]\n );\n}\n"],"mappings":";;;;AAOA,SAAS,EAAY,GAAkB,GAAkD;CAEvF,OADK,IACE,OAAO,QAAQ,CAAM,CAAC,CAAC,QAC3B,GAAK,CAAC,GAAK,OAAW,EAAI,QAAY,OAAO,SAAS,EAAI,SAAS,GAAG,GAAG,OAAO,CAAK,CAAC,GACvF,CACF,IAJoB;AAKtB;AAOA,SAAS,IAAmB;CAC1B,IAAI;EACF,OAAO,EAAQ;CACjB,QAAQ;EACN,OAAO;CACT;AACF;AAmBA,SAAgB,IAIJ;CACV,IAAM,IAAY,EAAiB;CAEnC,OAAO,GACJ,GAAa,GAAkB,MAAqD;EACnF,IAAI;EAEJ,IAAI,GAAW;GACb,IAAM,IAAa,EAAU,EAAE,CAAG;GAClC,AAAI,MAAe,MACjB,IAAQ;EAEZ;EAEA,IAAI,MAAU,KAAA,GAAW;GACvB,IAAM,IAAa,EAAO,CAAG;GAC7B,AAAI,MAAe,MACjB,IAAQ;EAEZ;EAMA,QAJI,MAAU,KAAA,KAAa,MAAU,OACnC,IAAQ,IAGH,EAAY,GAAO,CAAM;CAClC,GACA,CAAC,CAAS,CACZ;AACF"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* strings (page titles, empty states, form labels) so the MFE can be mounted
|
|
7
7
|
* standalone (dev harness, tests) and still render in all supported locales.
|
|
8
8
|
* When running inside the shell, the shell's `useI18n` translations take
|
|
9
|
-
* precedence via the `
|
|
9
|
+
* precedence via the `useTr` hook.
|
|
10
10
|
*/
|
|
11
11
|
export type SupportedLocale = 'en' | 'es' | 'hi' | 'ta' | 'zh' | 'ar';
|
|
12
12
|
export declare function t(key: string, fallback?: string, locale?: SupportedLocale): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/proserviceworld/i18n/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/proserviceworld/i18n/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AA28BtE,wBAAgB,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,MAAM,CAGlF"}
|