@multiplatform.one/backoffice 7.83.1 → 7.83.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/cjs/chrome/HelpMenu.cjs +11 -0
- package/dist/cjs/chrome/HelpMenu.native.js +11 -0
- package/dist/cjs/chrome/HelpMenu.native.js.map +1 -1
- package/dist/cjs/chrome/user-session.cjs +9 -0
- package/dist/cjs/chrome/user-session.native.js +9 -0
- package/dist/cjs/chrome/user-session.native.js.map +1 -1
- package/dist/cjs/index.cjs +1 -0
- package/dist/cjs/index.native.js +1 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/shared/sessionUser.cjs +11 -50
- package/dist/cjs/shared/sessionUser.native.js +11 -77
- package/dist/cjs/shared/sessionUser.native.js.map +1 -1
- package/dist/cjs/shared/useSlugTarget.cjs +8 -4
- package/dist/cjs/shared/useSlugTarget.native.js +8 -4
- package/dist/cjs/shared/useSlugTarget.native.js.map +1 -1
- package/dist/cjs/shell/BackofficeShell.cjs +2 -1
- package/dist/cjs/shell/BackofficeShell.native.js +2 -1
- package/dist/cjs/shell/BackofficeShell.native.js.map +1 -1
- package/dist/cjs/shell/WorkspaceSidebar.cjs +36 -2
- package/dist/cjs/shell/WorkspaceSidebar.native.js +40 -2
- package/dist/cjs/shell/WorkspaceSidebar.native.js.map +1 -1
- package/dist/esm/chrome/HelpMenu.mjs +11 -1
- package/dist/esm/chrome/HelpMenu.mjs.map +1 -1
- package/dist/esm/chrome/HelpMenu.native.js +11 -1
- package/dist/esm/chrome/HelpMenu.native.js.map +1 -1
- package/dist/esm/chrome/user-session.mjs +9 -1
- package/dist/esm/chrome/user-session.mjs.map +1 -1
- package/dist/esm/chrome/user-session.native.js +9 -1
- package/dist/esm/chrome/user-session.native.js.map +1 -1
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +2 -2
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/shared/sessionUser.mjs +7 -46
- package/dist/esm/shared/sessionUser.mjs.map +1 -1
- package/dist/esm/shared/sessionUser.native.js +7 -73
- package/dist/esm/shared/sessionUser.native.js.map +1 -1
- package/dist/esm/shared/useSlugTarget.mjs +9 -5
- package/dist/esm/shared/useSlugTarget.mjs.map +1 -1
- package/dist/esm/shared/useSlugTarget.native.js +9 -5
- package/dist/esm/shared/useSlugTarget.native.js.map +1 -1
- package/dist/esm/shell/BackofficeShell.mjs +2 -1
- package/dist/esm/shell/BackofficeShell.mjs.map +1 -1
- package/dist/esm/shell/BackofficeShell.native.js +2 -1
- package/dist/esm/shell/BackofficeShell.native.js.map +1 -1
- package/dist/esm/shell/WorkspaceSidebar.mjs +37 -3
- package/dist/esm/shell/WorkspaceSidebar.mjs.map +1 -1
- package/dist/esm/shell/WorkspaceSidebar.native.js +41 -3
- package/dist/esm/shell/WorkspaceSidebar.native.js.map +1 -1
- package/dist/jsx/chrome/HelpMenu.mjs +11 -1
- package/dist/jsx/chrome/HelpMenu.mjs.map +1 -1
- package/dist/jsx/chrome/HelpMenu.native.js +11 -0
- package/dist/jsx/chrome/HelpMenu.native.js.map +1 -1
- package/dist/jsx/chrome/user-session.mjs +9 -1
- package/dist/jsx/chrome/user-session.mjs.map +1 -1
- package/dist/jsx/chrome/user-session.native.js +9 -0
- package/dist/jsx/chrome/user-session.native.js.map +1 -1
- package/dist/jsx/index.js +2 -2
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +2 -2
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/index.native.js +1 -0
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/shared/sessionUser.mjs +7 -46
- package/dist/jsx/shared/sessionUser.mjs.map +1 -1
- package/dist/jsx/shared/sessionUser.native.js +11 -77
- package/dist/jsx/shared/sessionUser.native.js.map +1 -1
- package/dist/jsx/shared/useSlugTarget.mjs +9 -5
- package/dist/jsx/shared/useSlugTarget.mjs.map +1 -1
- package/dist/jsx/shared/useSlugTarget.native.js +8 -4
- package/dist/jsx/shared/useSlugTarget.native.js.map +1 -1
- package/dist/jsx/shell/BackofficeShell.mjs +2 -1
- package/dist/jsx/shell/BackofficeShell.mjs.map +1 -1
- package/dist/jsx/shell/BackofficeShell.native.js +2 -1
- package/dist/jsx/shell/BackofficeShell.native.js.map +1 -1
- package/dist/jsx/shell/WorkspaceSidebar.mjs +37 -3
- package/dist/jsx/shell/WorkspaceSidebar.mjs.map +1 -1
- package/dist/jsx/shell/WorkspaceSidebar.native.js +40 -2
- package/dist/jsx/shell/WorkspaceSidebar.native.js.map +1 -1
- package/package.json +12 -12
- package/src/chrome/HelpMenu.tsx +6 -0
- package/src/chrome/command-palette-model.spec.tsx +6 -1
- package/src/chrome/user-session.tsx +15 -0
- package/src/index.ts +1 -0
- package/src/shared/sessionReset.spec.tsx +81 -0
- package/src/shared/sessionUser.ts +9 -48
- package/src/shared/useSlugTarget.ts +16 -6
- package/src/shell/BackofficeShell.sheet.spec.tsx +20 -0
- package/src/shell/BackofficeShell.spec.tsx +2 -2
- package/src/shell/BackofficeShell.tsx +1 -0
- package/src/shell/WorkspaceSidebar.tsx +35 -2
- package/types/chrome/HelpMenu.d.ts +10 -0
- package/types/chrome/HelpMenu.d.ts.map +1 -1
- package/types/chrome/user-session.d.ts +1 -0
- package/types/chrome/user-session.d.ts.map +1 -1
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/shared/sessionUser.d.ts +2 -5
- package/types/shared/sessionUser.d.ts.map +1 -1
- package/types/shared/useSlugTarget.d.ts.map +1 -1
- package/types/shell/BackofficeShell.d.ts.map +1 -1
- package/types/shell/WorkspaceSidebar.d.ts +3 -1
- package/types/shell/WorkspaceSidebar.d.ts.map +1 -1
|
@@ -32,10 +32,12 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
32
32
|
var import_components = require("@multiplatform.one/components");
|
|
33
33
|
var import_theme = require("@multiplatform.one/theme");
|
|
34
34
|
var import_react = require("@phosphor-icons/react");
|
|
35
|
+
var import_platform = require("@multiplatform.one/platform");
|
|
35
36
|
var import_react2 = require("react");
|
|
36
37
|
var import_react_i18next = require("react-i18next");
|
|
37
38
|
var import_BackofficeProvider = require("../config/BackofficeProvider.native.js");
|
|
38
39
|
var import_i18n = require("../i18n/index.native.js");
|
|
40
|
+
var import_HelpMenu = require("../chrome/HelpMenu.native.js");
|
|
39
41
|
var import_useWorkspaces = require("./useWorkspaces.native.js");
|
|
40
42
|
var import_workspaceIcons = require("./workspaceIcons.native.js");
|
|
41
43
|
var WORKSPACE_SIDEBAR_WIDTH = 250;
|
|
@@ -111,7 +113,8 @@ function WorkspaceSidebar(param) {
|
|
|
111
113
|
width = WORKSPACE_SIDEBAR_WIDTH,
|
|
112
114
|
divider = true,
|
|
113
115
|
footer,
|
|
114
|
-
hug
|
|
116
|
+
hug,
|
|
117
|
+
help
|
|
115
118
|
} = param;
|
|
116
119
|
var {
|
|
117
120
|
t
|
|
@@ -178,8 +181,43 @@ function WorkspaceSidebar(param) {
|
|
|
178
181
|
})
|
|
179
182
|
}]
|
|
180
183
|
}] : sections;
|
|
184
|
+
var helpSection = (0, import_react2.useMemo)(function () {
|
|
185
|
+
if (!help) return void 0;
|
|
186
|
+
var rows = {
|
|
187
|
+
documentation: {
|
|
188
|
+
label: t("help.documentation", "Documentation"),
|
|
189
|
+
Icon: import_react.BookOpenIcon
|
|
190
|
+
},
|
|
191
|
+
userForum: {
|
|
192
|
+
label: t("help.userForum", "User Forum"),
|
|
193
|
+
Icon: import_react.ChatsCircleIcon
|
|
194
|
+
},
|
|
195
|
+
reportIssue: {
|
|
196
|
+
label: t("help.reportIssue", "Report an Issue"),
|
|
197
|
+
Icon: import_react.BugIcon
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
return {
|
|
201
|
+
title: t("help.label", "Help"),
|
|
202
|
+
items: import_HelpMenu.HELP_LINKS.map(function (link) {
|
|
203
|
+
return {
|
|
204
|
+
label: rows[link.key].label,
|
|
205
|
+
value: link.url,
|
|
206
|
+
icon: /* @__PURE__ */(0, import_jsx_runtime.jsx)(NavIcon, {
|
|
207
|
+
Icon: rows[link.key].Icon,
|
|
208
|
+
active: false
|
|
209
|
+
}),
|
|
210
|
+
testID: `backoffice-sidebar-help-${link.key}`,
|
|
211
|
+
onPress: function onPress() {
|
|
212
|
+
return (0, import_platform.openUrl)(link.url, "_blank");
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
})
|
|
216
|
+
};
|
|
217
|
+
}, [help, t]);
|
|
218
|
+
var navSections = allDoctypes ? [allDoctypes, ...workspaceSections] : workspaceSections;
|
|
181
219
|
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_components.Sidebar, {
|
|
182
|
-
sections:
|
|
220
|
+
sections: helpSection ? [...navSections, helpSection] : navSections,
|
|
183
221
|
width,
|
|
184
222
|
divider,
|
|
185
223
|
footer,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","WorkspaceSidebar_exports","WORKSPACE_SIDEBAR_WIDTH","WorkspaceSidebar","module","exports","import_jsx_runtime","require","import_components","import_theme","import_react","import_react2","import_react_i18next","import_BackofficeProvider","import_i18n","import_useWorkspaces","import_workspaceIcons","workspaceItem","workspace","depth","paths","activePath","onNavigate","path","IconComponent","workspaceIcon","icon","active","jsx","NavIcon","Icon","label","title","onPress","flattenTree","roots","childrenByParent","arguments","length","items","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Symbol","iterator","_step","next","done","push","children","err","return","param","_knobProps_controlIcon","knobProps","useResolvedKnobs","size","Number","controlIcon","width","weight","divider","footer","hug","t","useTranslation","BACKOFFICE_I18N_NAMESPACE","useBackofficePaths","views","useBackofficeCapabilities","privateWorkspaces","publicRoots","isLoading","useWorkspaces","sections","useMemo","result","map"],"sources":["../../../src/shell/WorkspaceSidebar.tsx"],"sourcesContent":[null],"mappings":"AAcA;;AAAA,IACEA,SAAA,GAAAC,MAAA,CAAAC,cAAA;AAAA,IACAC,gBAAA,GAAAF,MAAA,CAAAG,wBAAA;AAAA,IAAAC,iBAGK,GAAAJ,MAAA,CAAAK,mBAAA;AACP,IAAAC,YAAS,GAAAN,MAAA,CAAAO,SAAwB,CAAAC,cAAA;AACjC,IAAAC,
|
|
1
|
+
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","WorkspaceSidebar_exports","WORKSPACE_SIDEBAR_WIDTH","WorkspaceSidebar","module","exports","import_jsx_runtime","require","import_components","import_theme","import_react","import_platform","import_react2","import_react_i18next","import_BackofficeProvider","import_i18n","import_HelpMenu","import_useWorkspaces","import_workspaceIcons","workspaceItem","workspace","depth","paths","activePath","onNavigate","path","IconComponent","workspaceIcon","icon","active","jsx","NavIcon","Icon","label","title","onPress","flattenTree","roots","childrenByParent","arguments","length","items","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Symbol","iterator","_step","next","done","push","children","err","return","param","_knobProps_controlIcon","knobProps","useResolvedKnobs","size","Number","controlIcon","width","weight","divider","footer","hug","help","t","useTranslation","BACKOFFICE_I18N_NAMESPACE","useBackofficePaths","views","useBackofficeCapabilities","privateWorkspaces","publicRoots","isLoading","useWorkspaces","sections","useMemo","result","map","allDoctypes","enabled","StackIcon","testID"],"sources":["../../../src/shell/WorkspaceSidebar.tsx"],"sourcesContent":[null],"mappings":"AAcA;;AAAA,IACEA,SAAA,GAAAC,MAAA,CAAAC,cAAA;AAAA,IACAC,gBAAA,GAAAF,MAAA,CAAAG,wBAAA;AAAA,IAAAC,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AmE,OAAA;IAEZ,IAAM,CAAAP,KAAA,CAAAW,OAAc,cAAc,CAAC;IAEnC,IAAA1D,IACE,GAAAH,KAAA,CAAA4D,WAAA;IAAC,IAAArD,MAAA,GAAAN,UAAA,KAAAE,IAAA;IAAA;MACCgB,KAAA,GACA;QACAR,KAAA,EAAAmC,CAAA;QACApE,KAAA,EAAAyB,IAAA;QACAG,IAAA,qBAAAtB,kBAAA,CAAAwB,GAAA,EAAAC,OAAA;UACAC,IAAA,EAAAtB,YAAc,CAAA0E,SAAA;UACdvD;QAAO;QACTA,MAAA;QAEJwD,MAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/backoffice",
|
|
3
|
-
"version": "7.83.
|
|
3
|
+
"version": "7.83.2",
|
|
4
4
|
"description": "Embeddable Frappe desk recreation (backoffice) for the multiplatform.one stack",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"backoffice",
|
|
@@ -71,21 +71,21 @@
|
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@multiplatform.one/components": "^7.83.
|
|
75
|
-
"@multiplatform.one/forms": "^7.83.
|
|
76
|
-
"@multiplatform.one/frappe": "^7.83.
|
|
77
|
-
"@multiplatform.one/frappe-ui": "^7.83.
|
|
78
|
-
"@multiplatform.one/i18n": "^7.83.
|
|
79
|
-
"@multiplatform.one/platform": "^7.83.
|
|
80
|
-
"@multiplatform.one/store": "^7.83.
|
|
81
|
-
"@multiplatform.one/table": "^7.83.
|
|
82
|
-
"@multiplatform.one/theme": "^7.83.
|
|
74
|
+
"@multiplatform.one/components": "^7.83.2",
|
|
75
|
+
"@multiplatform.one/forms": "^7.83.2",
|
|
76
|
+
"@multiplatform.one/frappe": "^7.83.2",
|
|
77
|
+
"@multiplatform.one/frappe-ui": "^7.83.2",
|
|
78
|
+
"@multiplatform.one/i18n": "^7.83.2",
|
|
79
|
+
"@multiplatform.one/platform": "^7.83.2",
|
|
80
|
+
"@multiplatform.one/store": "^7.83.2",
|
|
81
|
+
"@multiplatform.one/table": "^7.83.2",
|
|
82
|
+
"@multiplatform.one/theme": "^7.83.2",
|
|
83
83
|
"@phosphor-icons/react": "^2.1.10",
|
|
84
84
|
"tamagui": "2.7.6"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
|
-
"@multiplatform.one/config": "7.83.
|
|
88
|
-
"@multiplatform.one/test-utils": "7.83.
|
|
87
|
+
"@multiplatform.one/config": "7.83.2",
|
|
88
|
+
"@multiplatform.one/test-utils": "7.83.2",
|
|
89
89
|
"@tamagui/build": "2.7.6",
|
|
90
90
|
"@testing-library/react": "^16.3.3",
|
|
91
91
|
"@types/react-dom": "^19.2.3",
|
package/src/chrome/HelpMenu.tsx
CHANGED
|
@@ -29,6 +29,12 @@ const DOCUMENTATION_URL = "https://docs.frappe.io";
|
|
|
29
29
|
const USER_FORUM_URL = "https://discuss.frappe.io";
|
|
30
30
|
const REPORT_ISSUE_URL = "https://github.com/frappe/frappe/issues";
|
|
31
31
|
|
|
32
|
+
export const HELP_LINKS = [
|
|
33
|
+
{ key: "documentation", url: DOCUMENTATION_URL },
|
|
34
|
+
{ key: "userForum", url: USER_FORUM_URL },
|
|
35
|
+
{ key: "reportIssue", url: REPORT_ISSUE_URL },
|
|
36
|
+
] as const;
|
|
37
|
+
|
|
32
38
|
export function HelpMenu() {
|
|
33
39
|
const { t } = useTranslation(BACKOFFICE_I18N_NAMESPACE);
|
|
34
40
|
const { knobProps } = useResolvedKnobs();
|
|
@@ -3,7 +3,12 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
3
3
|
import { useCommandPaletteModel } from "./command-palette-model";
|
|
4
4
|
|
|
5
5
|
const provider = vi.hoisted(() => ({ baseURL: "" }));
|
|
6
|
-
vi.mock("@multiplatform.one/frappe-ui", () => ({
|
|
6
|
+
vi.mock("@multiplatform.one/frappe-ui", () => ({
|
|
7
|
+
getSessionRevision: () => 0,
|
|
8
|
+
useFrappeConfig: () => provider,
|
|
9
|
+
sessionUserKey: ({ baseURL }: { baseURL?: string }) => baseURL ?? "",
|
|
10
|
+
useSessionRevision: () => 0,
|
|
11
|
+
}));
|
|
7
12
|
vi.mock("../config/BackofficeProvider", () => ({
|
|
8
13
|
useBackofficePaths: () => ({
|
|
9
14
|
workspace: (name: string) => `/workspace/${name}`,
|
|
@@ -40,6 +40,21 @@ export function clearSessionUserCache(): void {
|
|
|
40
40
|
clearSessionIdentityCache();
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Drops the session caches when the signed-in identity settles on a new
|
|
45
|
+
* value. `identity` is undefined while the host's session is still loading;
|
|
46
|
+
* a guest starts settled, so loading/guest flips cost no refetch.
|
|
47
|
+
*/
|
|
48
|
+
let settledIdentity = "guest";
|
|
49
|
+
|
|
50
|
+
export function useSessionIdentityReset(identity: string | undefined): void {
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (identity === undefined || identity === settledIdentity) return;
|
|
53
|
+
settledIdentity = identity;
|
|
54
|
+
clearSessionUserCache();
|
|
55
|
+
}, [identity]);
|
|
56
|
+
}
|
|
57
|
+
|
|
43
58
|
/** Resolve a User.user_image value (usually "/files/…") to an absolute URL. */
|
|
44
59
|
export function resolveUserImageUrl(
|
|
45
60
|
userImage: string | null | undefined,
|
package/src/index.ts
CHANGED
|
@@ -172,6 +172,7 @@ export type { UserMenuProps } from "./chrome/UserMenu";
|
|
|
172
172
|
export {
|
|
173
173
|
clearSessionUserCache,
|
|
174
174
|
resolveUserImageUrl,
|
|
175
|
+
useSessionIdentityReset,
|
|
175
176
|
useSessionUserInfo,
|
|
176
177
|
} from "./chrome/user-session";
|
|
177
178
|
export type { SessionUserInfo } from "./chrome/user-session";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FrappeProvider } from "@multiplatform.one/frappe-ui";
|
|
3
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
4
|
+
import { cleanup, screen, waitFor } from "@testing-library/react";
|
|
5
|
+
import { afterEach, beforeEach, expect, it, vi } from "vitest";
|
|
6
|
+
import { useSessionIdentityReset } from "../chrome/user-session";
|
|
7
|
+
import { useSessionIdentity } from "./sessionUser";
|
|
8
|
+
import { useSlugTarget } from "./useSlugTarget";
|
|
9
|
+
|
|
10
|
+
let run = 0;
|
|
11
|
+
const calls = { user: 0, workspaces: 0, doctypes: 0 };
|
|
12
|
+
|
|
13
|
+
function Consumers({ identity }: { identity?: string }) {
|
|
14
|
+
useSessionIdentityReset(identity);
|
|
15
|
+
const target = useSlugTarget("pokemon");
|
|
16
|
+
const { resolved } = useSessionIdentity();
|
|
17
|
+
return <div data-testid="state">{`${target.status}:${resolved}`}</div>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function Tree({ identity }: { identity?: string }) {
|
|
21
|
+
return (
|
|
22
|
+
<FrappeProvider baseURL={`https://session-reset-${run}.spec.test`} realtime={false}>
|
|
23
|
+
<Consumers identity={identity} />
|
|
24
|
+
</FrappeProvider>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function settled() {
|
|
29
|
+
await waitFor(() => expect(screen.getByTestId("state").textContent).toBe("resolved:true"));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
beforeEach(() => {
|
|
33
|
+
run += 1;
|
|
34
|
+
calls.user = 0;
|
|
35
|
+
calls.workspaces = 0;
|
|
36
|
+
calls.doctypes = 0;
|
|
37
|
+
vi.stubGlobal("fetch", async (input: string | URL | Request) => {
|
|
38
|
+
const url = new URL(String(input instanceof Request ? input.url : input));
|
|
39
|
+
const refused = () =>
|
|
40
|
+
new Response(JSON.stringify({ exc_type: "PermissionError" }), {
|
|
41
|
+
status: 403,
|
|
42
|
+
headers: { "content-type": "application/json" },
|
|
43
|
+
});
|
|
44
|
+
if (url.pathname.endsWith("frappe.auth.get_logged_user")) {
|
|
45
|
+
calls.user += 1;
|
|
46
|
+
return refused();
|
|
47
|
+
}
|
|
48
|
+
if (url.pathname.endsWith("/api/resource/Workspace")) {
|
|
49
|
+
calls.workspaces += 1;
|
|
50
|
+
return refused();
|
|
51
|
+
}
|
|
52
|
+
if (url.pathname.endsWith("frappe.client.get_list")) {
|
|
53
|
+
calls.doctypes += 1;
|
|
54
|
+
return refused();
|
|
55
|
+
}
|
|
56
|
+
return new Response("{}", { headers: { "content-type": "application/json" } });
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
afterEach(() => {
|
|
61
|
+
cleanup();
|
|
62
|
+
vi.unstubAllGlobals();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("reads a guest's identity and slug index once through loading flips and remounts", async () => {
|
|
66
|
+
const view = renderWithProviders(<Tree identity="guest" />);
|
|
67
|
+
await settled();
|
|
68
|
+
view.rerender(<Tree identity={undefined} />);
|
|
69
|
+
view.rerender(<Tree identity="guest" />);
|
|
70
|
+
view.unmount();
|
|
71
|
+
renderWithProviders(<Tree identity="guest" />);
|
|
72
|
+
await settled();
|
|
73
|
+
expect(calls).toEqual({ user: 1, workspaces: 1, doctypes: 1 });
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("reads them again once a user signs in", async () => {
|
|
77
|
+
const view = renderWithProviders(<Tree identity="guest" />);
|
|
78
|
+
await settled();
|
|
79
|
+
view.rerender(<Tree identity="user:jane" />);
|
|
80
|
+
await waitFor(() => expect(calls).toEqual({ user: 2, workspaces: 2, doctypes: 2 }));
|
|
81
|
+
});
|
|
@@ -1,52 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
clearSessionIdentityCache,
|
|
3
|
+
loadSessionUser,
|
|
4
|
+
sessionUserKey,
|
|
5
|
+
useFrappeConfig,
|
|
6
|
+
useSessionRevision,
|
|
7
|
+
} from "@multiplatform.one/frappe-ui";
|
|
8
|
+
import { useEffect, useState } from "react";
|
|
4
9
|
|
|
5
|
-
|
|
6
|
-
let revision = 0;
|
|
7
|
-
const listeners = new Set<() => void>();
|
|
8
|
-
const subscribe = (listener: () => void) => {
|
|
9
|
-
listeners.add(listener);
|
|
10
|
-
return () => {
|
|
11
|
-
listeners.delete(listener);
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
const getRevision = () => revision;
|
|
15
|
-
|
|
16
|
-
export function useSessionRevision(): number {
|
|
17
|
-
return useSyncExternalStore(subscribe, getRevision, getRevision);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function sessionUserKey(config: Pick<FrappeConfig, "baseURL" | "auth">): string {
|
|
21
|
-
const auth = config.auth;
|
|
22
|
-
return `${config.baseURL}:${auth?.useToken ? "t" : ""}:${auth?.token ?? ""}:${auth?.type ?? ""}`;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function clearSessionIdentityCache(): void {
|
|
26
|
-
cache.clear();
|
|
27
|
-
revision += 1;
|
|
28
|
-
for (const listener of listeners) listener();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function loadSessionUser(config: Pick<FrappeConfig, "baseURL" | "auth">): Promise<string> {
|
|
32
|
-
if (!config.baseURL) return Promise.reject(new Error("No session endpoint"));
|
|
33
|
-
const key = sessionUserKey(config);
|
|
34
|
-
let promise = cache.get(key);
|
|
35
|
-
if (!promise) {
|
|
36
|
-
const client = new HttpClient(config.baseURL, config.auth as AuthConfig | undefined);
|
|
37
|
-
promise = client
|
|
38
|
-
.get<{ message?: string }>("/api/method/frappe.auth.get_logged_user")
|
|
39
|
-
.then((response) => response.payload?.message || "Guest")
|
|
40
|
-
.catch((error: unknown) => {
|
|
41
|
-
const status = (error as { status?: number })?.status;
|
|
42
|
-
if (status === 401 || status === 403) return "Guest";
|
|
43
|
-
if (cache.get(key) === promise) cache.delete(key);
|
|
44
|
-
throw error;
|
|
45
|
-
});
|
|
46
|
-
cache.set(key, promise);
|
|
47
|
-
}
|
|
48
|
-
return promise;
|
|
49
|
-
}
|
|
10
|
+
export { clearSessionIdentityCache, loadSessionUser, sessionUserKey, useSessionRevision };
|
|
50
11
|
|
|
51
12
|
export function useSessionIdentity(): { user?: string; resolved: boolean } {
|
|
52
13
|
const config = useFrappeConfig();
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// Contract: resolve a {basePath}/[slug] segment to a workspace or doctype.
|
|
2
2
|
// Every backoffice route relies on this hook; keep the signature stable.
|
|
3
3
|
import { HttpClient, type AuthConfig, type FixtureProvider } from "@multiplatform.one/frappe";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
getSessionRevision,
|
|
6
|
+
useFrappeConfig,
|
|
7
|
+
useSessionRevision,
|
|
8
|
+
type FrappeConfig,
|
|
9
|
+
} from "@multiplatform.one/frappe-ui";
|
|
5
10
|
import { useEffect, useMemo, useState } from "react";
|
|
6
11
|
import { slugToDisplayName, toSlug } from "../navigation/paths";
|
|
7
12
|
import type { SlugTarget } from "./types";
|
|
@@ -88,12 +93,15 @@ async function fetchSlugIndex(source: SlugIndexSource): Promise<SlugIndex> {
|
|
|
88
93
|
}
|
|
89
94
|
|
|
90
95
|
function getSlugIndex(source: SlugIndexSource): Promise<SlugIndex> {
|
|
91
|
-
const key = `${source.baseURL}:${source.fixtures ? "fixtures" : "live"}`;
|
|
96
|
+
const key = `${source.baseURL}:${source.fixtures ? "fixtures" : "live"}:${getSessionRevision()}`;
|
|
92
97
|
let promise = slugIndexCache.get(key);
|
|
93
98
|
if (!promise) {
|
|
94
99
|
promise = fetchSlugIndex(source);
|
|
95
|
-
//
|
|
96
|
-
|
|
100
|
+
// A refusal holds until the session identity changes; any other failure
|
|
101
|
+
// is evicted so a later mount can retry.
|
|
102
|
+
promise.catch((error: unknown) => {
|
|
103
|
+
const status = (error as { status?: number })?.status;
|
|
104
|
+
if (status === 401 || status === 403) return;
|
|
97
105
|
if (slugIndexCache.get(key) === promise) slugIndexCache.delete(key);
|
|
98
106
|
});
|
|
99
107
|
slugIndexCache.set(key, promise);
|
|
@@ -121,6 +129,7 @@ export function useSlugTarget(slug: string | undefined): SlugTarget {
|
|
|
121
129
|
const baseURL = config?.baseURL;
|
|
122
130
|
const fixtures = config?.fixtures;
|
|
123
131
|
const auth = config?.auth;
|
|
132
|
+
const revision = useSessionRevision();
|
|
124
133
|
|
|
125
134
|
const [index, setIndex] = useState<SlugIndex | undefined>(undefined);
|
|
126
135
|
const [failed, setFailed] = useState(false);
|
|
@@ -146,7 +155,7 @@ export function useSlugTarget(slug: string | undefined): SlugTarget {
|
|
|
146
155
|
// `auth` is intentionally not a dependency: the cache is keyed by
|
|
147
156
|
// baseURL/fixtures and provider auth is stable for the session.
|
|
148
157
|
// oxlint-disable-next-line exhaustive-deps
|
|
149
|
-
}, [baseURL, fixtures]);
|
|
158
|
+
}, [baseURL, fixtures, revision]);
|
|
150
159
|
|
|
151
160
|
return useMemo<SlugTarget>(() => {
|
|
152
161
|
if (!slug) return { status: "loading" };
|
|
@@ -181,6 +190,7 @@ export function useSingleDoctypes(): ReadonlySet<string> | undefined {
|
|
|
181
190
|
const baseURL = config?.baseURL;
|
|
182
191
|
const fixtures = config?.fixtures;
|
|
183
192
|
const auth = config?.auth;
|
|
193
|
+
const revision = useSessionRevision();
|
|
184
194
|
|
|
185
195
|
const [singles, setSingles] = useState<ReadonlySet<string> | undefined>(undefined);
|
|
186
196
|
|
|
@@ -202,7 +212,7 @@ export function useSingleDoctypes(): ReadonlySet<string> | undefined {
|
|
|
202
212
|
};
|
|
203
213
|
// `auth` is session-stable; the index cache is keyed by baseURL/fixtures.
|
|
204
214
|
// oxlint-disable-next-line exhaustive-deps
|
|
205
|
-
}, [baseURL, fixtures]);
|
|
215
|
+
}, [baseURL, fixtures, revision]);
|
|
206
216
|
|
|
207
217
|
return singles;
|
|
208
218
|
}
|
|
@@ -138,6 +138,26 @@ describe("the phone nav sheet (LC-111)", () => {
|
|
|
138
138
|
});
|
|
139
139
|
});
|
|
140
140
|
|
|
141
|
+
describe("help on a phone (FZ-7374)", () => {
|
|
142
|
+
it("rides the nav sheet the compact banner leaves it out of", async () => {
|
|
143
|
+
layout.size = "compact";
|
|
144
|
+
renderShell();
|
|
145
|
+
expect(within(screen.getByRole("banner")).queryByLabelText("Help")).toBeNull();
|
|
146
|
+
openSheet();
|
|
147
|
+
const drawer = (await screen.findAllByTestId("backoffice-sidebar-drawer"))[0]!;
|
|
148
|
+
await waitFor(() => expect(within(drawer).getByText("Help")).toBeTruthy());
|
|
149
|
+
for (const label of ["Documentation", "User Forum", "Report an Issue"]) {
|
|
150
|
+
expect(within(drawer).getByText(label)).toBeTruthy();
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it("stays in the banner at 1440, never in the rail", () => {
|
|
155
|
+
renderShell();
|
|
156
|
+
expect(within(screen.getByRole("banner")).getByLabelText("Help")).toBeTruthy();
|
|
157
|
+
expect(screen.queryByTestId("backoffice-sidebar-help-documentation")).toBeNull();
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
|
|
141
161
|
describe("the sheet's ✕ (LC-176)", () => {
|
|
142
162
|
it.each(Object.keys(presets))("%s: a bare tinted glyph, no plate at rest", async (preset) => {
|
|
143
163
|
layout.size = "compact";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { InMemoryFixtureProvider } from "@multiplatform.one/frappe";
|
|
3
3
|
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
4
|
-
import { cleanup, fireEvent, screen, waitFor } from "@testing-library/react";
|
|
4
|
+
import { cleanup, fireEvent, screen, waitFor, within } from "@testing-library/react";
|
|
5
5
|
import { defaultKnobs, resolveKnobs, type LayoutSizeClass } from "@multiplatform.one/theme";
|
|
6
6
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
7
7
|
import { BackofficeProvider } from "../config/BackofficeProvider";
|
|
@@ -146,7 +146,7 @@ it("uses an icon-only search trigger in the compact header", async () => {
|
|
|
146
146
|
expect(search.textContent?.trim()).toBe("");
|
|
147
147
|
expect(getComputedStyle(search).flexShrink).toBe("0");
|
|
148
148
|
const banner = screen.getByRole("banner");
|
|
149
|
-
expect(
|
|
149
|
+
expect(within(banner).queryByLabelText("Help")).toBeNull();
|
|
150
150
|
for (const label of ["Notifications", "Log in"]) {
|
|
151
151
|
let node = screen.getByRole("button", { name: label }).parentElement;
|
|
152
152
|
while (node && node !== banner) {
|
|
@@ -19,12 +19,20 @@ import {
|
|
|
19
19
|
type SidebarSection,
|
|
20
20
|
} from "@multiplatform.one/components";
|
|
21
21
|
import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
BookOpenIcon,
|
|
24
|
+
BugIcon,
|
|
25
|
+
ChatsCircleIcon,
|
|
26
|
+
StackIcon,
|
|
27
|
+
type Icon as PhosphorIcon,
|
|
28
|
+
} from "@phosphor-icons/react";
|
|
29
|
+
import { openUrl } from "@multiplatform.one/platform";
|
|
23
30
|
import { useMemo, type ReactNode } from "react";
|
|
24
31
|
import { useTranslation } from "react-i18next";
|
|
25
32
|
import { useBackofficeCapabilities, useBackofficePaths } from "../config/BackofficeProvider";
|
|
26
33
|
import { BACKOFFICE_I18N_NAMESPACE } from "../i18n";
|
|
27
34
|
import type { BackofficePaths } from "../navigation/paths";
|
|
35
|
+
import { HELP_LINKS } from "../chrome/HelpMenu";
|
|
28
36
|
import { useWorkspaces, type WorkspaceDoc } from "./useWorkspaces";
|
|
29
37
|
import { workspaceIcon } from "./workspaceIcons";
|
|
30
38
|
|
|
@@ -43,6 +51,8 @@ export interface WorkspaceSidebarProps {
|
|
|
43
51
|
footer?: ReactNode;
|
|
44
52
|
/** Height of the rows, not the column's: the nav in a content-sized sheet. */
|
|
45
53
|
hug?: boolean;
|
|
54
|
+
/** Phone sheet only: the help links the compact banner gives up. */
|
|
55
|
+
help?: boolean;
|
|
46
56
|
}
|
|
47
57
|
|
|
48
58
|
function workspaceItem(
|
|
@@ -105,6 +115,7 @@ export function WorkspaceSidebar({
|
|
|
105
115
|
divider = true,
|
|
106
116
|
footer,
|
|
107
117
|
hug,
|
|
118
|
+
help,
|
|
108
119
|
}: WorkspaceSidebarProps) {
|
|
109
120
|
const { t } = useTranslation(BACKOFFICE_I18N_NAMESPACE);
|
|
110
121
|
const paths = useBackofficePaths();
|
|
@@ -166,9 +177,31 @@ export function WorkspaceSidebar({
|
|
|
166
177
|
]
|
|
167
178
|
: sections;
|
|
168
179
|
|
|
180
|
+
const helpSection = useMemo<SidebarSection | undefined>(() => {
|
|
181
|
+
if (!help) return undefined;
|
|
182
|
+
const rows: Record<(typeof HELP_LINKS)[number]["key"], { label: string; Icon: PhosphorIcon }> =
|
|
183
|
+
{
|
|
184
|
+
documentation: { label: t("help.documentation", "Documentation"), Icon: BookOpenIcon },
|
|
185
|
+
userForum: { label: t("help.userForum", "User Forum"), Icon: ChatsCircleIcon },
|
|
186
|
+
reportIssue: { label: t("help.reportIssue", "Report an Issue"), Icon: BugIcon },
|
|
187
|
+
};
|
|
188
|
+
return {
|
|
189
|
+
title: t("help.label", "Help"),
|
|
190
|
+
items: HELP_LINKS.map((link) => ({
|
|
191
|
+
label: rows[link.key].label,
|
|
192
|
+
value: link.url,
|
|
193
|
+
icon: <NavIcon Icon={rows[link.key].Icon} active={false} />,
|
|
194
|
+
testID: `backoffice-sidebar-help-${link.key}`,
|
|
195
|
+
onPress: () => openUrl(link.url, "_blank"),
|
|
196
|
+
})),
|
|
197
|
+
};
|
|
198
|
+
}, [help, t]);
|
|
199
|
+
|
|
200
|
+
const navSections = allDoctypes ? [allDoctypes, ...workspaceSections] : workspaceSections;
|
|
201
|
+
|
|
169
202
|
return (
|
|
170
203
|
<Sidebar
|
|
171
|
-
sections={
|
|
204
|
+
sections={helpSection ? [...navSections, helpSection] : navSections}
|
|
172
205
|
width={width}
|
|
173
206
|
divider={divider}
|
|
174
207
|
footer={footer}
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
+
export declare const HELP_LINKS: readonly [{
|
|
2
|
+
readonly key: "documentation";
|
|
3
|
+
readonly url: "https://docs.frappe.io";
|
|
4
|
+
}, {
|
|
5
|
+
readonly key: "userForum";
|
|
6
|
+
readonly url: "https://discuss.frappe.io";
|
|
7
|
+
}, {
|
|
8
|
+
readonly key: "reportIssue";
|
|
9
|
+
readonly url: "https://github.com/frappe/frappe/issues";
|
|
10
|
+
}];
|
|
1
11
|
export declare function HelpMenu(): import("react/jsx-runtime").JSX.Element;
|
|
2
12
|
//# sourceMappingURL=HelpMenu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HelpMenu.d.ts","sourceRoot":"","sources":["../../src/chrome/HelpMenu.tsx"],"names":[],"mappings":"AA+BA,wBAAgB,QAAQ,4CAuEvB"}
|
|
1
|
+
{"version":3,"file":"HelpMenu.d.ts","sourceRoot":"","sources":["../../src/chrome/HelpMenu.tsx"],"names":[],"mappings":"AA+BA,eAAO,MAAM,UAAU;;;;;;;;;EAIb,CAAC;AAEX,wBAAgB,QAAQ,4CAuEvB"}
|
|
@@ -8,6 +8,7 @@ export interface SessionUserInfo {
|
|
|
8
8
|
}
|
|
9
9
|
/** Logout hygiene: drops every cached session-user fetch in this module. */
|
|
10
10
|
export declare function clearSessionUserCache(): void;
|
|
11
|
+
export declare function useSessionIdentityReset(identity: string | undefined): void;
|
|
11
12
|
/** Resolve a User.user_image value (usually "/files/…") to an absolute URL. */
|
|
12
13
|
export declare function resolveUserImageUrl(userImage: string | null | undefined, baseURL: string): string | undefined;
|
|
13
14
|
/** Module-cached session-user info from the ambient Frappe connection. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-session.d.ts","sourceRoot":"","sources":["../../src/chrome/user-session.tsx"],"names":[],"mappings":"AAmBA,MAAM,WAAW,eAAe;IAC9B,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAUD,4EAA4E;AAC5E,wBAAgB,qBAAqB,IAAI,IAAI,CAG5C;AAED,+EAA+E;AAC/E,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAKpB;AAgCD,0EAA0E;AAC1E,wBAAgB,kBAAkB,IAAI;IACpC,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CA4CA"}
|
|
1
|
+
{"version":3,"file":"user-session.d.ts","sourceRoot":"","sources":["../../src/chrome/user-session.tsx"],"names":[],"mappings":"AAmBA,MAAM,WAAW,eAAe;IAC9B,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAUD,4EAA4E;AAC5E,wBAAgB,qBAAqB,IAAI,IAAI,CAG5C;AASD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAM1E;AAED,+EAA+E;AAC/E,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAKpB;AAgCD,0EAA0E;AAC1E,wBAAgB,kBAAkB,IAAI;IACpC,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CA4CA"}
|
package/types/index.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ export { HelpShortcutsDialog } from "./chrome/help-shortcuts-dialog";
|
|
|
63
63
|
export type { HelpShortcutsDialogProps } from "./chrome/help-shortcuts-dialog";
|
|
64
64
|
export { UserMenu } from "./chrome/UserMenu";
|
|
65
65
|
export type { UserMenuProps } from "./chrome/UserMenu";
|
|
66
|
-
export { clearSessionUserCache, resolveUserImageUrl, useSessionUserInfo, } from "./chrome/user-session";
|
|
66
|
+
export { clearSessionUserCache, resolveUserImageUrl, useSessionIdentityReset, useSessionUserInfo, } from "./chrome/user-session";
|
|
67
67
|
export type { SessionUserInfo } from "./chrome/user-session";
|
|
68
68
|
export { useBackofficeShortcuts } from "./chrome/shortcuts";
|
|
69
69
|
export type { BackofficeShortcutHandlers } from "./chrome/shortcuts";
|