@multiplatform.one/backoffice 6.4.0 → 6.4.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/cjs/chrome/CommandPalette.cjs +20 -9
- package/dist/cjs/chrome/CommandPalette.native.js +18 -10
- package/dist/cjs/chrome/CommandPalette.native.js.map +1 -1
- package/dist/cjs/i18n/en.cjs +21 -0
- package/dist/cjs/i18n/en.native.js +21 -0
- package/dist/cjs/i18n/en.native.js.map +1 -1
- package/dist/cjs/index.cjs +49 -1
- package/dist/cjs/index.native.js +48 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/shared/types.cjs +18 -0
- package/dist/cjs/shared/types.native.js +21 -0
- package/dist/cjs/shared/types.native.js.map +1 -0
- package/dist/cjs/shared/useDocinfo.cjs +116 -0
- package/dist/cjs/shared/useDocinfo.native.js +167 -0
- package/dist/cjs/shared/useDocinfo.native.js.map +1 -0
- package/dist/cjs/shared/useDoctypeMeta.cjs +124 -0
- package/dist/cjs/shared/useDoctypeMeta.native.js +158 -0
- package/dist/cjs/shared/useDoctypeMeta.native.js.map +1 -0
- package/dist/cjs/shared/useRecentVisit.cjs +40 -0
- package/dist/cjs/shared/useRecentVisit.native.js +43 -0
- package/dist/cjs/shared/useRecentVisit.native.js.map +1 -0
- package/dist/cjs/shared/useSessionUserId.cjs +54 -0
- package/dist/cjs/shared/useSessionUserId.native.js +59 -0
- package/dist/cjs/shared/useSessionUserId.native.js.map +1 -0
- package/dist/cjs/shared/useSlugTarget.cjs +138 -0
- package/dist/cjs/shared/useSlugTarget.native.js +166 -0
- package/dist/cjs/shared/useSlugTarget.native.js.map +1 -0
- package/dist/cjs/shared/useUserRoles.cjs +72 -0
- package/dist/cjs/shared/useUserRoles.native.js +79 -0
- package/dist/cjs/shared/useUserRoles.native.js.map +1 -0
- package/dist/cjs/workspace/WorkspaceChartBlock.cjs +136 -0
- package/dist/cjs/workspace/WorkspaceChartBlock.native.js +144 -0
- package/dist/cjs/workspace/WorkspaceChartBlock.native.js.map +1 -0
- package/dist/cjs/workspace/WorkspaceGrid.cjs +91 -0
- package/dist/cjs/workspace/WorkspaceGrid.native.js +126 -0
- package/dist/cjs/workspace/WorkspaceGrid.native.js.map +1 -0
- package/dist/cjs/workspace/WorkspaceLinkCard.cjs +139 -0
- package/dist/cjs/workspace/WorkspaceLinkCard.native.js +155 -0
- package/dist/cjs/workspace/WorkspaceLinkCard.native.js.map +1 -0
- package/dist/cjs/workspace/WorkspaceLinkDirectory.cjs +110 -0
- package/dist/cjs/workspace/WorkspaceLinkDirectory.native.js +127 -0
- package/dist/cjs/workspace/WorkspaceLinkDirectory.native.js.map +1 -0
- package/dist/cjs/workspace/WorkspaceNumberCard.cjs +133 -0
- package/dist/cjs/workspace/WorkspaceNumberCard.native.js +138 -0
- package/dist/cjs/workspace/WorkspaceNumberCard.native.js.map +1 -0
- package/dist/cjs/workspace/WorkspaceQuickList.cjs +112 -0
- package/dist/cjs/workspace/WorkspaceQuickList.native.js +130 -0
- package/dist/cjs/workspace/WorkspaceQuickList.native.js.map +1 -0
- package/dist/cjs/workspace/WorkspaceRecents.cjs +116 -0
- package/dist/cjs/workspace/WorkspaceRecents.native.js +132 -0
- package/dist/cjs/workspace/WorkspaceRecents.native.js.map +1 -0
- package/dist/cjs/workspace/WorkspaceScreen.cjs +291 -0
- package/dist/cjs/workspace/WorkspaceScreen.native.js +323 -0
- package/dist/cjs/workspace/WorkspaceScreen.native.js.map +1 -0
- package/dist/cjs/workspace/WorkspaceShortcut.cjs +185 -0
- package/dist/cjs/workspace/WorkspaceShortcut.native.js +202 -0
- package/dist/cjs/workspace/WorkspaceShortcut.native.js.map +1 -0
- package/dist/cjs/workspace/parseContent.cjs +180 -0
- package/dist/cjs/workspace/parseContent.native.js +299 -0
- package/dist/cjs/workspace/parseContent.native.js.map +1 -0
- package/dist/cjs/workspace/types.cjs +18 -0
- package/dist/cjs/workspace/types.native.js +21 -0
- package/dist/cjs/workspace/types.native.js.map +1 -0
- package/dist/cjs/workspace/useDashboardChart.cjs +96 -0
- package/dist/cjs/workspace/useDashboardChart.native.js +110 -0
- package/dist/cjs/workspace/useDashboardChart.native.js.map +1 -0
- package/dist/cjs/workspace/useWorkspaceDoc.cjs +103 -0
- package/dist/cjs/workspace/useWorkspaceDoc.native.js +120 -0
- package/dist/cjs/workspace/useWorkspaceDoc.native.js.map +1 -0
- package/dist/esm/chrome/CommandPalette.mjs +20 -9
- package/dist/esm/chrome/CommandPalette.mjs.map +1 -1
- package/dist/esm/chrome/CommandPalette.native.js +18 -10
- package/dist/esm/chrome/CommandPalette.native.js.map +1 -1
- package/dist/esm/i18n/en.mjs +21 -0
- package/dist/esm/i18n/en.mjs.map +1 -1
- package/dist/esm/i18n/en.native.js +21 -0
- package/dist/esm/i18n/en.native.js.map +1 -1
- package/dist/esm/index.mjs +19 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +19 -1
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/shared/types.mjs +2 -0
- package/dist/esm/shared/types.mjs.map +1 -0
- package/dist/esm/shared/types.native.js +2 -0
- package/dist/esm/shared/types.native.js.map +1 -0
- package/dist/esm/shared/useDocinfo.mjs +90 -0
- package/dist/esm/shared/useDocinfo.mjs.map +1 -0
- package/dist/esm/shared/useDocinfo.native.js +138 -0
- package/dist/esm/shared/useDocinfo.native.js.map +1 -0
- package/dist/esm/shared/useDoctypeMeta.mjs +99 -0
- package/dist/esm/shared/useDoctypeMeta.mjs.map +1 -0
- package/dist/esm/shared/useDoctypeMeta.native.js +130 -0
- package/dist/esm/shared/useDoctypeMeta.native.js.map +1 -0
- package/dist/esm/shared/useRecentVisit.mjs +15 -0
- package/dist/esm/shared/useRecentVisit.mjs.map +1 -0
- package/dist/esm/shared/useRecentVisit.native.js +15 -0
- package/dist/esm/shared/useRecentVisit.native.js.map +1 -0
- package/dist/esm/shared/useSessionUserId.mjs +29 -0
- package/dist/esm/shared/useSessionUserId.mjs.map +1 -0
- package/dist/esm/shared/useSessionUserId.native.js +31 -0
- package/dist/esm/shared/useSessionUserId.native.js.map +1 -0
- package/dist/esm/shared/useSlugTarget.mjs +113 -0
- package/dist/esm/shared/useSlugTarget.mjs.map +1 -0
- package/dist/esm/shared/useSlugTarget.native.js +138 -0
- package/dist/esm/shared/useSlugTarget.native.js.map +1 -0
- package/dist/esm/shared/useUserRoles.mjs +47 -0
- package/dist/esm/shared/useUserRoles.mjs.map +1 -0
- package/dist/esm/shared/useUserRoles.native.js +51 -0
- package/dist/esm/shared/useUserRoles.native.js.map +1 -0
- package/dist/esm/workspace/WorkspaceChartBlock.mjs +111 -0
- package/dist/esm/workspace/WorkspaceChartBlock.mjs.map +1 -0
- package/dist/esm/workspace/WorkspaceChartBlock.native.js +116 -0
- package/dist/esm/workspace/WorkspaceChartBlock.native.js.map +1 -0
- package/dist/esm/workspace/WorkspaceGrid.mjs +66 -0
- package/dist/esm/workspace/WorkspaceGrid.mjs.map +1 -0
- package/dist/esm/workspace/WorkspaceGrid.native.js +98 -0
- package/dist/esm/workspace/WorkspaceGrid.native.js.map +1 -0
- package/dist/esm/workspace/WorkspaceLinkCard.mjs +113 -0
- package/dist/esm/workspace/WorkspaceLinkCard.mjs.map +1 -0
- package/dist/esm/workspace/WorkspaceLinkCard.native.js +126 -0
- package/dist/esm/workspace/WorkspaceLinkCard.native.js.map +1 -0
- package/dist/esm/workspace/WorkspaceLinkDirectory.mjs +84 -0
- package/dist/esm/workspace/WorkspaceLinkDirectory.mjs.map +1 -0
- package/dist/esm/workspace/WorkspaceLinkDirectory.native.js +98 -0
- package/dist/esm/workspace/WorkspaceLinkDirectory.native.js.map +1 -0
- package/dist/esm/workspace/WorkspaceNumberCard.mjs +108 -0
- package/dist/esm/workspace/WorkspaceNumberCard.mjs.map +1 -0
- package/dist/esm/workspace/WorkspaceNumberCard.native.js +110 -0
- package/dist/esm/workspace/WorkspaceNumberCard.native.js.map +1 -0
- package/dist/esm/workspace/WorkspaceQuickList.mjs +87 -0
- package/dist/esm/workspace/WorkspaceQuickList.mjs.map +1 -0
- package/dist/esm/workspace/WorkspaceQuickList.native.js +102 -0
- package/dist/esm/workspace/WorkspaceQuickList.native.js.map +1 -0
- package/dist/esm/workspace/WorkspaceRecents.mjs +91 -0
- package/dist/esm/workspace/WorkspaceRecents.mjs.map +1 -0
- package/dist/esm/workspace/WorkspaceRecents.native.js +104 -0
- package/dist/esm/workspace/WorkspaceRecents.native.js.map +1 -0
- package/dist/esm/workspace/WorkspaceScreen.mjs +266 -0
- package/dist/esm/workspace/WorkspaceScreen.mjs.map +1 -0
- package/dist/esm/workspace/WorkspaceScreen.native.js +295 -0
- package/dist/esm/workspace/WorkspaceScreen.native.js.map +1 -0
- package/dist/esm/workspace/WorkspaceShortcut.mjs +159 -0
- package/dist/esm/workspace/WorkspaceShortcut.mjs.map +1 -0
- package/dist/esm/workspace/WorkspaceShortcut.native.js +173 -0
- package/dist/esm/workspace/WorkspaceShortcut.native.js.map +1 -0
- package/dist/esm/workspace/parseContent.mjs +148 -0
- package/dist/esm/workspace/parseContent.mjs.map +1 -0
- package/dist/esm/workspace/parseContent.native.js +264 -0
- package/dist/esm/workspace/parseContent.native.js.map +1 -0
- package/dist/esm/workspace/types.mjs +2 -0
- package/dist/esm/workspace/types.mjs.map +1 -0
- package/dist/esm/workspace/types.native.js +2 -0
- package/dist/esm/workspace/types.native.js.map +1 -0
- package/dist/esm/workspace/useDashboardChart.mjs +71 -0
- package/dist/esm/workspace/useDashboardChart.mjs.map +1 -0
- package/dist/esm/workspace/useDashboardChart.native.js +82 -0
- package/dist/esm/workspace/useDashboardChart.native.js.map +1 -0
- package/dist/esm/workspace/useWorkspaceDoc.mjs +77 -0
- package/dist/esm/workspace/useWorkspaceDoc.mjs.map +1 -0
- package/dist/esm/workspace/useWorkspaceDoc.native.js +91 -0
- package/dist/esm/workspace/useWorkspaceDoc.native.js.map +1 -0
- package/dist/jsx/chrome/CommandPalette.mjs +20 -9
- package/dist/jsx/chrome/CommandPalette.mjs.map +1 -1
- package/dist/jsx/chrome/CommandPalette.native.js +18 -10
- package/dist/jsx/chrome/CommandPalette.native.js.map +1 -1
- package/dist/jsx/i18n/en.mjs +21 -0
- package/dist/jsx/i18n/en.mjs.map +1 -1
- package/dist/jsx/i18n/en.native.js +21 -0
- package/dist/jsx/i18n/en.native.js.map +1 -1
- package/dist/jsx/index.js +19 -1
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +19 -1
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/index.native.js +48 -0
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/shared/types.mjs +2 -0
- package/dist/jsx/shared/types.mjs.map +1 -0
- package/dist/jsx/shared/types.native.js +21 -0
- package/dist/jsx/shared/types.native.js.map +1 -0
- package/dist/jsx/shared/useDocinfo.mjs +90 -0
- package/dist/jsx/shared/useDocinfo.mjs.map +1 -0
- package/dist/jsx/shared/useDocinfo.native.js +167 -0
- package/dist/jsx/shared/useDocinfo.native.js.map +1 -0
- package/dist/jsx/shared/useDoctypeMeta.mjs +99 -0
- package/dist/jsx/shared/useDoctypeMeta.mjs.map +1 -0
- package/dist/jsx/shared/useDoctypeMeta.native.js +158 -0
- package/dist/jsx/shared/useDoctypeMeta.native.js.map +1 -0
- package/dist/jsx/shared/useRecentVisit.mjs +15 -0
- package/dist/jsx/shared/useRecentVisit.mjs.map +1 -0
- package/dist/jsx/shared/useRecentVisit.native.js +43 -0
- package/dist/jsx/shared/useRecentVisit.native.js.map +1 -0
- package/dist/jsx/shared/useSessionUserId.mjs +29 -0
- package/dist/jsx/shared/useSessionUserId.mjs.map +1 -0
- package/dist/jsx/shared/useSessionUserId.native.js +59 -0
- package/dist/jsx/shared/useSessionUserId.native.js.map +1 -0
- package/dist/jsx/shared/useSlugTarget.mjs +113 -0
- package/dist/jsx/shared/useSlugTarget.mjs.map +1 -0
- package/dist/jsx/shared/useSlugTarget.native.js +166 -0
- package/dist/jsx/shared/useSlugTarget.native.js.map +1 -0
- package/dist/jsx/shared/useUserRoles.mjs +47 -0
- package/dist/jsx/shared/useUserRoles.mjs.map +1 -0
- package/dist/jsx/shared/useUserRoles.native.js +79 -0
- package/dist/jsx/shared/useUserRoles.native.js.map +1 -0
- package/dist/jsx/workspace/WorkspaceChartBlock.mjs +111 -0
- package/dist/jsx/workspace/WorkspaceChartBlock.mjs.map +1 -0
- package/dist/jsx/workspace/WorkspaceChartBlock.native.js +144 -0
- package/dist/jsx/workspace/WorkspaceChartBlock.native.js.map +1 -0
- package/dist/jsx/workspace/WorkspaceGrid.mjs +66 -0
- package/dist/jsx/workspace/WorkspaceGrid.mjs.map +1 -0
- package/dist/jsx/workspace/WorkspaceGrid.native.js +126 -0
- package/dist/jsx/workspace/WorkspaceGrid.native.js.map +1 -0
- package/dist/jsx/workspace/WorkspaceLinkCard.mjs +113 -0
- package/dist/jsx/workspace/WorkspaceLinkCard.mjs.map +1 -0
- package/dist/jsx/workspace/WorkspaceLinkCard.native.js +155 -0
- package/dist/jsx/workspace/WorkspaceLinkCard.native.js.map +1 -0
- package/dist/jsx/workspace/WorkspaceLinkDirectory.mjs +84 -0
- package/dist/jsx/workspace/WorkspaceLinkDirectory.mjs.map +1 -0
- package/dist/jsx/workspace/WorkspaceLinkDirectory.native.js +127 -0
- package/dist/jsx/workspace/WorkspaceLinkDirectory.native.js.map +1 -0
- package/dist/jsx/workspace/WorkspaceNumberCard.mjs +108 -0
- package/dist/jsx/workspace/WorkspaceNumberCard.mjs.map +1 -0
- package/dist/jsx/workspace/WorkspaceNumberCard.native.js +138 -0
- package/dist/jsx/workspace/WorkspaceNumberCard.native.js.map +1 -0
- package/dist/jsx/workspace/WorkspaceQuickList.mjs +87 -0
- package/dist/jsx/workspace/WorkspaceQuickList.mjs.map +1 -0
- package/dist/jsx/workspace/WorkspaceQuickList.native.js +130 -0
- package/dist/jsx/workspace/WorkspaceQuickList.native.js.map +1 -0
- package/dist/jsx/workspace/WorkspaceRecents.mjs +91 -0
- package/dist/jsx/workspace/WorkspaceRecents.mjs.map +1 -0
- package/dist/jsx/workspace/WorkspaceRecents.native.js +132 -0
- package/dist/jsx/workspace/WorkspaceRecents.native.js.map +1 -0
- package/dist/jsx/workspace/WorkspaceScreen.mjs +266 -0
- package/dist/jsx/workspace/WorkspaceScreen.mjs.map +1 -0
- package/dist/jsx/workspace/WorkspaceScreen.native.js +323 -0
- package/dist/jsx/workspace/WorkspaceScreen.native.js.map +1 -0
- package/dist/jsx/workspace/WorkspaceShortcut.mjs +159 -0
- package/dist/jsx/workspace/WorkspaceShortcut.mjs.map +1 -0
- package/dist/jsx/workspace/WorkspaceShortcut.native.js +202 -0
- package/dist/jsx/workspace/WorkspaceShortcut.native.js.map +1 -0
- package/dist/jsx/workspace/parseContent.mjs +148 -0
- package/dist/jsx/workspace/parseContent.mjs.map +1 -0
- package/dist/jsx/workspace/parseContent.native.js +299 -0
- package/dist/jsx/workspace/parseContent.native.js.map +1 -0
- package/dist/jsx/workspace/types.mjs +2 -0
- package/dist/jsx/workspace/types.mjs.map +1 -0
- package/dist/jsx/workspace/types.native.js +21 -0
- package/dist/jsx/workspace/types.native.js.map +1 -0
- package/dist/jsx/workspace/useDashboardChart.mjs +71 -0
- package/dist/jsx/workspace/useDashboardChart.mjs.map +1 -0
- package/dist/jsx/workspace/useDashboardChart.native.js +110 -0
- package/dist/jsx/workspace/useDashboardChart.native.js.map +1 -0
- package/dist/jsx/workspace/useWorkspaceDoc.mjs +77 -0
- package/dist/jsx/workspace/useWorkspaceDoc.mjs.map +1 -0
- package/dist/jsx/workspace/useWorkspaceDoc.native.js +120 -0
- package/dist/jsx/workspace/useWorkspaceDoc.native.js.map +1 -0
- package/package.json +12 -12
- package/src/chrome/CommandPalette.tsx +35 -15
- package/src/i18n/en.ts +21 -0
- package/src/index.ts +69 -0
- package/src/shared/types.ts +14 -0
- package/src/shared/useDocinfo.ts +163 -0
- package/src/shared/useDoctypeMeta.ts +243 -0
- package/src/shared/useRecentVisit.ts +33 -0
- package/src/shared/useSessionUserId.ts +42 -0
- package/src/shared/useSlugTarget.ts +143 -0
- package/src/shared/useUserRoles.ts +66 -0
- package/src/workspace/WorkspaceChartBlock.tsx +115 -0
- package/src/workspace/WorkspaceGrid.tsx +82 -0
- package/src/workspace/WorkspaceLinkCard.tsx +134 -0
- package/src/workspace/WorkspaceLinkDirectory.tsx +126 -0
- package/src/workspace/WorkspaceNumberCard.tsx +126 -0
- package/src/workspace/WorkspaceQuickList.tsx +100 -0
- package/src/workspace/WorkspaceRecents.tsx +100 -0
- package/src/workspace/WorkspaceScreen.tsx +322 -0
- package/src/workspace/WorkspaceShortcut.tsx +223 -0
- package/src/workspace/parseContent.spec.ts +327 -0
- package/src/workspace/parseContent.ts +240 -0
- package/src/workspace/types.ts +135 -0
- package/src/workspace/useDashboardChart.ts +115 -0
- package/src/workspace/useWorkspaceDoc.ts +111 -0
- package/types/chrome/CommandPalette.d.ts.map +1 -1
- package/types/i18n/en.d.ts +19 -0
- package/types/i18n/en.d.ts.map +1 -1
- package/types/index.d.ts +34 -0
- package/types/index.d.ts.map +1 -1
- package/types/shared/types.d.ts +21 -0
- package/types/shared/types.d.ts.map +1 -0
- package/types/shared/useDocinfo.d.ts +61 -0
- package/types/shared/useDocinfo.d.ts.map +1 -0
- package/types/shared/useDoctypeMeta.d.ts +118 -0
- package/types/shared/useDoctypeMeta.d.ts.map +1 -0
- package/types/shared/useRecentVisit.d.ts +10 -0
- package/types/shared/useRecentVisit.d.ts.map +1 -0
- package/types/shared/useSessionUserId.d.ts +6 -0
- package/types/shared/useSessionUserId.d.ts.map +1 -0
- package/types/shared/useSlugTarget.d.ts +18 -0
- package/types/shared/useSlugTarget.d.ts.map +1 -0
- package/types/shared/useUserRoles.d.ts +15 -0
- package/types/shared/useUserRoles.d.ts.map +1 -0
- package/types/workspace/WorkspaceChartBlock.d.ts +6 -0
- package/types/workspace/WorkspaceChartBlock.d.ts.map +1 -0
- package/types/workspace/WorkspaceGrid.d.ts +23 -0
- package/types/workspace/WorkspaceGrid.d.ts.map +1 -0
- package/types/workspace/WorkspaceLinkCard.d.ts +20 -0
- package/types/workspace/WorkspaceLinkCard.d.ts.map +1 -0
- package/types/workspace/WorkspaceLinkDirectory.d.ts +19 -0
- package/types/workspace/WorkspaceLinkDirectory.d.ts.map +1 -0
- package/types/workspace/WorkspaceNumberCard.d.ts +19 -0
- package/types/workspace/WorkspaceNumberCard.d.ts.map +1 -0
- package/types/workspace/WorkspaceQuickList.d.ts +6 -0
- package/types/workspace/WorkspaceQuickList.d.ts.map +1 -0
- package/types/workspace/WorkspaceRecents.d.ts +2 -0
- package/types/workspace/WorkspaceRecents.d.ts.map +1 -0
- package/types/workspace/WorkspaceScreen.d.ts +24 -0
- package/types/workspace/WorkspaceScreen.d.ts.map +1 -0
- package/types/workspace/WorkspaceShortcut.d.ts +27 -0
- package/types/workspace/WorkspaceShortcut.d.ts.map +1 -0
- package/types/workspace/parseContent.d.ts +77 -0
- package/types/workspace/parseContent.d.ts.map +1 -0
- package/types/workspace/types.d.ts +112 -0
- package/types/workspace/types.d.ts.map +1 -0
- package/types/workspace/useDashboardChart.d.ts +29 -0
- package/types/workspace/useDashboardChart.d.ts.map +1 -0
- package/types/workspace/useWorkspaceDoc.d.ts +18 -0
- package/types/workspace/useWorkspaceDoc.d.ts.map +1 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var useWorkspaceDoc_exports = {};
|
|
26
|
+
__export(useWorkspaceDoc_exports, {
|
|
27
|
+
useFrappeDoc: () => useFrappeDoc,
|
|
28
|
+
useWorkspaceDoc: () => useWorkspaceDoc
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(useWorkspaceDoc_exports);
|
|
31
|
+
var import_frappe = require("@multiplatform.one/frappe");
|
|
32
|
+
var import_frappe_ui = require("@multiplatform.one/frappe-ui");
|
|
33
|
+
var import_react = require("react");
|
|
34
|
+
function _instanceof(left, right) {
|
|
35
|
+
"@swc/helpers - instanceof";
|
|
36
|
+
|
|
37
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
38
|
+
return !!right[Symbol.hasInstance](left);
|
|
39
|
+
} else {
|
|
40
|
+
return left instanceof right;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
var dbCache = /* @__PURE__ */new Map();
|
|
44
|
+
function getDb(config) {
|
|
45
|
+
var _ref, _ref1;
|
|
46
|
+
var _config_auth, _config_auth1;
|
|
47
|
+
var key = `${config.baseURL}:${(_ref = (_config_auth = config.auth) === null || _config_auth === void 0 ? void 0 : _config_auth.token) !== null && _ref !== void 0 ? _ref : ""}:${(_ref1 = (_config_auth1 = config.auth) === null || _config_auth1 === void 0 ? void 0 : _config_auth1.type) !== null && _ref1 !== void 0 ? _ref1 : ""}`;
|
|
48
|
+
var db = dbCache.get(key);
|
|
49
|
+
if (!db) {
|
|
50
|
+
var authConfig = config.auth ? {
|
|
51
|
+
useToken: config.auth.useToken,
|
|
52
|
+
token: config.auth.token,
|
|
53
|
+
type: config.auth.type
|
|
54
|
+
} : void 0;
|
|
55
|
+
db = new import_frappe.DbModule(new import_frappe.HttpClient(config.baseURL, authConfig));
|
|
56
|
+
dbCache.set(key, db);
|
|
57
|
+
}
|
|
58
|
+
return db;
|
|
59
|
+
}
|
|
60
|
+
function useFrappeDoc(doctype, name) {
|
|
61
|
+
var config = (0, import_frappe_ui.useFrappeConfig)();
|
|
62
|
+
var [doc, setDoc] = (0, import_react.useState)(void 0);
|
|
63
|
+
var [isLoading, setIsLoading] = (0, import_react.useState)(!!name);
|
|
64
|
+
var [error, setError] = (0, import_react.useState)(void 0);
|
|
65
|
+
var fetchSeq = (0, import_react.useRef)(0);
|
|
66
|
+
var configRef = (0, import_react.useRef)(config);
|
|
67
|
+
configRef.current = config;
|
|
68
|
+
var runFetch = (0, import_react.useCallback)(async function (docName) {
|
|
69
|
+
var conn = configRef.current;
|
|
70
|
+
var seq = ++fetchSeq.current;
|
|
71
|
+
setIsLoading(true);
|
|
72
|
+
setError(void 0);
|
|
73
|
+
try {
|
|
74
|
+
var result;
|
|
75
|
+
if (conn === null || conn === void 0 ? void 0 : conn.fixtures) {
|
|
76
|
+
var fixtureDoc = await conn.fixtures.getDoc(doctype, docName);
|
|
77
|
+
if (!fixtureDoc) throw new Error(`${doctype} ${docName} not found`);
|
|
78
|
+
result = fixtureDoc;
|
|
79
|
+
} else if (conn === null || conn === void 0 ? void 0 : conn.baseURL) {
|
|
80
|
+
result = await getDb(conn).getDoc(doctype, docName);
|
|
81
|
+
} else {
|
|
82
|
+
throw new Error("useFrappeDoc requires a FrappeProvider with baseURL or fixtures");
|
|
83
|
+
}
|
|
84
|
+
if (seq !== fetchSeq.current) return;
|
|
85
|
+
setDoc(result);
|
|
86
|
+
} catch (err) {
|
|
87
|
+
if (seq !== fetchSeq.current) return;
|
|
88
|
+
setDoc(void 0);
|
|
89
|
+
setError(_instanceof(err, Error) ? err : new Error(String(err)));
|
|
90
|
+
} finally {
|
|
91
|
+
if (seq === fetchSeq.current) setIsLoading(false);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
// doctype is stable per hook usage; config flows through configRef.
|
|
95
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
96
|
+
[doctype]);
|
|
97
|
+
(0, import_react.useEffect)(function () {
|
|
98
|
+
if (!name) {
|
|
99
|
+
setDoc(void 0);
|
|
100
|
+
setIsLoading(false);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
void runFetch(name);
|
|
104
|
+
}, [name, runFetch, config === null || config === void 0 ? void 0 : config.baseURL, config === null || config === void 0 ? void 0 : config.fixtures]);
|
|
105
|
+
var refresh = (0, import_react.useCallback)(function () {
|
|
106
|
+
if (name) void runFetch(name);
|
|
107
|
+
}, [name, runFetch]);
|
|
108
|
+
var isPermissionError = (error === null || error === void 0 ? void 0 : error.status) === 403;
|
|
109
|
+
return {
|
|
110
|
+
doc,
|
|
111
|
+
isLoading,
|
|
112
|
+
error,
|
|
113
|
+
isPermissionError,
|
|
114
|
+
refresh
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function useWorkspaceDoc(workspace) {
|
|
118
|
+
return useFrappeDoc("Workspace", workspace);
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=useWorkspaceDoc.native.js.map
|
|
@@ -0,0 +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","useWorkspaceDoc_exports","useFrappeDoc","useWorkspaceDoc","module","exports","import_frappe","require","import_frappe_ui","import_react","_instanceof","left","right","Symbol","hasInstance","dbCache","Map","getDb","config","_ref","_ref1","_config_auth","_config_auth1","baseURL","auth","token","type","db","authConfig","useToken","DbModule","HttpClient","set","doctype","useFrappeConfig","doc","setDoc","useState","isLoading","setIsLoading","error","setError","fetchSeq","useRef","configRef","current","runFetch","useCallback","docName","conn","seq","result","fixtures","fixtureDoc","getDoc","Error"],"sources":["../../../src/workspace/useWorkspaceDoc.ts"],"sourcesContent":[null],"mappings":"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","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/backoffice",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.1",
|
|
4
4
|
"description": "Embeddable Frappe desk recreation (backoffice) for the multiplatform.one stack",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"backoffice",
|
|
@@ -72,15 +72,15 @@
|
|
|
72
72
|
"dependencies": {
|
|
73
73
|
"@phosphor-icons/react": "^2.1.10",
|
|
74
74
|
"tamagui": "2.0.0-rc.41",
|
|
75
|
-
"@multiplatform.one/
|
|
76
|
-
"@multiplatform.one/
|
|
77
|
-
"@multiplatform.one/frappe-ui": "6.4.
|
|
78
|
-
"@multiplatform.one/
|
|
79
|
-
"@multiplatform.one/
|
|
80
|
-
"@multiplatform.one/
|
|
81
|
-
"@multiplatform.one/
|
|
82
|
-
"@multiplatform.one/
|
|
83
|
-
"@multiplatform.one/table": "6.4.
|
|
75
|
+
"@multiplatform.one/components": "6.4.1",
|
|
76
|
+
"@multiplatform.one/i18n": "6.4.1",
|
|
77
|
+
"@multiplatform.one/frappe-ui": "6.4.1",
|
|
78
|
+
"@multiplatform.one/forms": "6.4.1",
|
|
79
|
+
"@multiplatform.one/platform": "6.4.1",
|
|
80
|
+
"@multiplatform.one/store": "6.4.1",
|
|
81
|
+
"@multiplatform.one/frappe": "6.4.1",
|
|
82
|
+
"@multiplatform.one/theme": "6.4.1",
|
|
83
|
+
"@multiplatform.one/table": "6.4.1"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@tamagui/build": "2.0.0-rc.41",
|
|
@@ -95,8 +95,8 @@
|
|
|
95
95
|
"react-dom": "19.2.5",
|
|
96
96
|
"react-i18next": "^16.6.6",
|
|
97
97
|
"vitest": "^4.1.5",
|
|
98
|
-
"@multiplatform.one/
|
|
99
|
-
"@multiplatform.one/
|
|
98
|
+
"@multiplatform.one/test-utils": "6.4.1",
|
|
99
|
+
"@multiplatform.one/config": "6.4.1"
|
|
100
100
|
},
|
|
101
101
|
"peerDependencies": {
|
|
102
102
|
"i18next": "^25.0.0",
|
|
@@ -73,7 +73,6 @@ export function CommandPalette({ open, onOpenChange }: CommandPaletteProps) {
|
|
|
73
73
|
const model = useCommandPaletteModel({ query, debouncedQuery, open });
|
|
74
74
|
const { items } = model;
|
|
75
75
|
|
|
76
|
-
const rootRef = useRef<unknown>(null);
|
|
77
76
|
const itemNodesRef = useRef<Array<unknown>>([]);
|
|
78
77
|
|
|
79
78
|
// ── D-22 FOCUS-RETURN: render-phase capture on the opening render (before
|
|
@@ -109,15 +108,32 @@ export function CommandPalette({ open, onOpenChange }: CommandPaletteProps) {
|
|
|
109
108
|
if (target?.isConnected) target.focus();
|
|
110
109
|
}, [open]);
|
|
111
110
|
|
|
112
|
-
// Focus the palette input on open
|
|
113
|
-
//
|
|
111
|
+
// Focus the palette input on open. The Dialog focus scope re-targets the
|
|
112
|
+
// SearchInput's group frame (its first tabbable) DURING the mount
|
|
113
|
+
// animation — after any one-shot focus — so assert the input for the
|
|
114
|
+
// whole settle window, re-claiming every frame it gets stolen (D-23: the
|
|
115
|
+
// input is the palette's single tab stop). The panel is found by testid:
|
|
116
|
+
// Dialog.Content mounts in a portal and does not deliver a host-element
|
|
117
|
+
// ref, and the palette is a chrome singleton. The sheet has no scope of
|
|
118
|
+
// its own on web and settles on the first pass.
|
|
114
119
|
useEffect(() => {
|
|
115
120
|
if (!open || !isWeb || typeof document === "undefined") return;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
+
let cancelled = false;
|
|
122
|
+
let raf = 0;
|
|
123
|
+
const deadline = Date.now() + 1000;
|
|
124
|
+
const claim = () => {
|
|
125
|
+
if (cancelled) return;
|
|
126
|
+
const input = document.querySelector<HTMLInputElement>(
|
|
127
|
+
'[data-testid="backoffice-command-palette"] input',
|
|
128
|
+
);
|
|
129
|
+
if (input && document.activeElement !== input) input.focus();
|
|
130
|
+
if (Date.now() < deadline) raf = requestAnimationFrame(claim);
|
|
131
|
+
};
|
|
132
|
+
raf = requestAnimationFrame(claim);
|
|
133
|
+
return () => {
|
|
134
|
+
cancelled = true;
|
|
135
|
+
cancelAnimationFrame(raf);
|
|
136
|
+
};
|
|
121
137
|
}, [open]);
|
|
122
138
|
|
|
123
139
|
// Keep the highlight on a real row as results stream in/out.
|
|
@@ -132,9 +148,18 @@ export function CommandPalette({ open, onOpenChange }: CommandPaletteProps) {
|
|
|
132
148
|
node?.scrollIntoView?.({ block: "nearest" });
|
|
133
149
|
}, [highlight]);
|
|
134
150
|
|
|
151
|
+
// One commit per open (LC-21 COMMIT class): Enter can reach both the
|
|
152
|
+
// keydown handler and the input's onSubmitEditing on web — the second
|
|
153
|
+
// call must not navigate again.
|
|
154
|
+
const activatedRef = useRef(false);
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
if (open) activatedRef.current = false;
|
|
157
|
+
}, [open]);
|
|
158
|
+
|
|
135
159
|
const activate = useCallback(
|
|
136
160
|
(item: CommandPaletteItem | undefined) => {
|
|
137
|
-
if (!item) return;
|
|
161
|
+
if (!item || activatedRef.current) return;
|
|
162
|
+
activatedRef.current = true;
|
|
138
163
|
navigator.navigate(item.path);
|
|
139
164
|
addToRecent({ label: item.label, path: item.path });
|
|
140
165
|
close();
|
|
@@ -240,11 +265,7 @@ export function CommandPalette({ open, onOpenChange }: CommandPaletteProps) {
|
|
|
240
265
|
snapPoint={92}
|
|
241
266
|
scrollable
|
|
242
267
|
header={
|
|
243
|
-
<YStack
|
|
244
|
-
ref={rootRef as never}
|
|
245
|
-
paddingBottom="$2"
|
|
246
|
-
data-testid="backoffice-command-palette"
|
|
247
|
-
>
|
|
268
|
+
<YStack paddingBottom="$2" data-testid="backoffice-command-palette">
|
|
248
269
|
{searchInput}
|
|
249
270
|
</YStack>
|
|
250
271
|
}
|
|
@@ -277,7 +298,6 @@ export function CommandPalette({ open, onOpenChange }: CommandPaletteProps) {
|
|
|
277
298
|
/>
|
|
278
299
|
<DialogContent
|
|
279
300
|
key="content"
|
|
280
|
-
ref={rootRef as never}
|
|
281
301
|
width={PANEL_WIDTH}
|
|
282
302
|
maxWidth="92%"
|
|
283
303
|
// SP-EDGE: the container owns only its border — the input band,
|
package/src/i18n/en.ts
CHANGED
|
@@ -61,6 +61,27 @@ export const en = {
|
|
|
61
61
|
exitToSite: "← multiplatform.one",
|
|
62
62
|
logOut: "Log Out",
|
|
63
63
|
},
|
|
64
|
+
// Flat surface keys (the migrated screens keep their original flat key
|
|
65
|
+
// vocabulary from the features tree — `screens.backoffice.X` → `X`).
|
|
66
|
+
loading: "Loading",
|
|
67
|
+
workspaceCardEmpty: "No links in this section",
|
|
68
|
+
workspaceShortcutUnavailable: "Not available",
|
|
69
|
+
workspaceQuickListViewAll: "View All",
|
|
70
|
+
workspaceNumberCardError: "Couldn't load number card",
|
|
71
|
+
workspaceNumberCardUnsupported: "This card type is only available in desk",
|
|
72
|
+
workspaceChartFixture: "Chart data is only available on a live bench",
|
|
73
|
+
workspaceChartError: "Couldn't load chart {{title}}",
|
|
74
|
+
workspaceBrowseAll: "Browse all",
|
|
75
|
+
workspaceBrowseAllCount_one: "{{count}} link",
|
|
76
|
+
workspaceBrowseAllCount_other: "{{count}} links",
|
|
77
|
+
workspaceFilterLinks: "Filter links...",
|
|
78
|
+
workspaceFilterNoMatch: 'No links match "{{query}}"',
|
|
79
|
+
workspaceRecents: "Continue where you left off",
|
|
80
|
+
workspacePermissionError: "You do not have permission to view {{workspace}}",
|
|
81
|
+
workspaceError: "Couldn't load workspace {{workspace}}",
|
|
82
|
+
workspaceEmpty: "This workspace is empty",
|
|
83
|
+
workspaceEmptyDescription: "No blocks have been added to {{workspace}} yet",
|
|
84
|
+
workspaceShortcuts: "Shortcuts",
|
|
64
85
|
help: {
|
|
65
86
|
label: "Help",
|
|
66
87
|
documentation: "Documentation",
|
package/src/index.ts
CHANGED
|
@@ -148,3 +148,72 @@ export type { BackofficeShortcutHandlers } from "./chrome/shortcuts";
|
|
|
148
148
|
|
|
149
149
|
// Shared
|
|
150
150
|
export { useFrappeApp } from "./shared/useFrappeApp";
|
|
151
|
+
export type { FrappeFilter, FrappeFilters, SlugTarget } from "./shared/types";
|
|
152
|
+
export { useDoctypeMeta } from "./shared/useDoctypeMeta";
|
|
153
|
+
export type {
|
|
154
|
+
DocFieldMeta,
|
|
155
|
+
DocLinkMeta,
|
|
156
|
+
DocPermissionRule,
|
|
157
|
+
DoctypeMeta,
|
|
158
|
+
DoctypeMetaBundle,
|
|
159
|
+
} from "./shared/useDoctypeMeta";
|
|
160
|
+
export { invalidateDocinfo, useDocinfo } from "./shared/useDocinfo";
|
|
161
|
+
export type { DocInfo, DocInfoComment } from "./shared/useDocinfo";
|
|
162
|
+
export { useSlugTarget } from "./shared/useSlugTarget";
|
|
163
|
+
export { useUserRoles } from "./shared/useUserRoles";
|
|
164
|
+
export { useRecentVisit } from "./shared/useRecentVisit";
|
|
165
|
+
export type { RecentVisit } from "./shared/useRecentVisit";
|
|
166
|
+
export { useSessionUserId } from "./shared/useSessionUserId";
|
|
167
|
+
|
|
168
|
+
// Workspace surface
|
|
169
|
+
export type {
|
|
170
|
+
FrappeFilterTuple,
|
|
171
|
+
WorkspaceBlock,
|
|
172
|
+
WorkspaceBlockType,
|
|
173
|
+
WorkspaceChartRow,
|
|
174
|
+
WorkspaceLinkGroup,
|
|
175
|
+
WorkspaceLinkRow,
|
|
176
|
+
WorkspaceNumberCardRow,
|
|
177
|
+
WorkspaceDoc as WorkspacePageDoc,
|
|
178
|
+
WorkspaceQuickListRow,
|
|
179
|
+
WorkspaceShortcutRow,
|
|
180
|
+
} from "./workspace/types";
|
|
181
|
+
export {
|
|
182
|
+
composeWorkspaceBlocks,
|
|
183
|
+
findLinkGroup,
|
|
184
|
+
findShortcut,
|
|
185
|
+
groupLinks,
|
|
186
|
+
headerLevel,
|
|
187
|
+
parseFrappeFilters,
|
|
188
|
+
parseWorkspaceContent,
|
|
189
|
+
stripHtml,
|
|
190
|
+
} from "./workspace/parseContent";
|
|
191
|
+
export type { WorkspaceComposition } from "./workspace/parseContent";
|
|
192
|
+
export { useFrappeDoc, useWorkspaceDoc } from "./workspace/useWorkspaceDoc";
|
|
193
|
+
export type { UseFrappeDocResult } from "./workspace/useWorkspaceDoc";
|
|
194
|
+
export { useDashboardChartData } from "./workspace/useDashboardChart";
|
|
195
|
+
export type {
|
|
196
|
+
DashboardChartDoc,
|
|
197
|
+
DashboardChartSeries,
|
|
198
|
+
UseDashboardChartDataResult,
|
|
199
|
+
} from "./workspace/useDashboardChart";
|
|
200
|
+
export { WorkspaceGrid } from "./workspace/WorkspaceGrid";
|
|
201
|
+
export type { WorkspaceGridItem, WorkspaceGridProps } from "./workspace/WorkspaceGrid";
|
|
202
|
+
export { WorkspaceLinkCard, resolveLinkTarget } from "./workspace/WorkspaceLinkCard";
|
|
203
|
+
export type { WorkspaceLinkCardProps } from "./workspace/WorkspaceLinkCard";
|
|
204
|
+
export { WorkspaceShortcut, resolveShortcutTarget } from "./workspace/WorkspaceShortcut";
|
|
205
|
+
export type { WorkspaceShortcutProps } from "./workspace/WorkspaceShortcut";
|
|
206
|
+
export { WorkspaceQuickList } from "./workspace/WorkspaceQuickList";
|
|
207
|
+
export type { WorkspaceQuickListProps } from "./workspace/WorkspaceQuickList";
|
|
208
|
+
export { WorkspaceNumberCard } from "./workspace/WorkspaceNumberCard";
|
|
209
|
+
export type { NumberCardDoc, WorkspaceNumberCardProps } from "./workspace/WorkspaceNumberCard";
|
|
210
|
+
export { WorkspaceChartBlock } from "./workspace/WorkspaceChartBlock";
|
|
211
|
+
export type { WorkspaceChartBlockProps } from "./workspace/WorkspaceChartBlock";
|
|
212
|
+
export { WorkspaceLinkDirectory, filterLinkGroup } from "./workspace/WorkspaceLinkDirectory";
|
|
213
|
+
export type {
|
|
214
|
+
WorkspaceLinkDirectoryItem,
|
|
215
|
+
WorkspaceLinkDirectoryProps,
|
|
216
|
+
} from "./workspace/WorkspaceLinkDirectory";
|
|
217
|
+
export { WorkspaceRecents } from "./workspace/WorkspaceRecents";
|
|
218
|
+
export { WorkspaceScreen } from "./workspace/WorkspaceScreen";
|
|
219
|
+
export type { WorkspaceBlockKind, WorkspaceScreenProps } from "./workspace/WorkspaceScreen";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Shared backoffice types — contracts between the backoffice surfaces. */
|
|
2
|
+
|
|
3
|
+
/** Result of resolving a URL slug to a navigable target. */
|
|
4
|
+
export type SlugTarget =
|
|
5
|
+
| { status: "loading" }
|
|
6
|
+
| { status: "resolved"; kind: "workspace"; workspace: string }
|
|
7
|
+
| { status: "resolved"; kind: "doctype"; doctype: string }
|
|
8
|
+
| { status: "not-found"; slug: string };
|
|
9
|
+
|
|
10
|
+
/** A frappe filter tuple: [fieldname, operator, value]. */
|
|
11
|
+
export type FrappeFilter = [string, string, unknown];
|
|
12
|
+
|
|
13
|
+
/** Filters exchanged between the list surface components. */
|
|
14
|
+
export type FrappeFilters = FrappeFilter[];
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// Shared contract — consumed by the form sidebar, timeline, and connections
|
|
2
|
+
// surfaces; keep signatures stable.
|
|
3
|
+
// Shape verified against the live bench: get_docinfo → { docinfo: {...} }
|
|
4
|
+
// with keys: user_info, comments, shared, assignment_logs, attachment_logs,
|
|
5
|
+
// info_logs, like_logs, workflow_logs, attachments, communications,
|
|
6
|
+
// automated_messages, versions, assignments, permissions, views,
|
|
7
|
+
// additional_timeline_content, milestones, is_document_followed, tags,
|
|
8
|
+
// document_email.
|
|
9
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
10
|
+
import { useFrappeApp } from "./useFrappeApp";
|
|
11
|
+
|
|
12
|
+
export interface DocInfoComment {
|
|
13
|
+
name: string;
|
|
14
|
+
comment_type?: string;
|
|
15
|
+
content?: string;
|
|
16
|
+
owner?: string;
|
|
17
|
+
creation?: string;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface DocInfo {
|
|
22
|
+
doctype?: string;
|
|
23
|
+
name?: string;
|
|
24
|
+
user_info?: Record<
|
|
25
|
+
string,
|
|
26
|
+
{ fullname?: string; image?: string; name?: string } & Record<string, unknown>
|
|
27
|
+
>;
|
|
28
|
+
comments?: DocInfoComment[];
|
|
29
|
+
communications?: Array<Record<string, unknown>>;
|
|
30
|
+
automated_messages?: Array<Record<string, unknown>>;
|
|
31
|
+
versions?: Array<Record<string, unknown>>;
|
|
32
|
+
assignments?: Array<
|
|
33
|
+
{ name?: string; owner?: string; description?: string } & Record<string, unknown>
|
|
34
|
+
>;
|
|
35
|
+
assignment_logs?: Array<Record<string, unknown>>;
|
|
36
|
+
attachments?: Array<
|
|
37
|
+
{ name?: string; file_name?: string; file_url?: string; is_private?: 0 | 1 } & Record<
|
|
38
|
+
string,
|
|
39
|
+
unknown
|
|
40
|
+
>
|
|
41
|
+
>;
|
|
42
|
+
attachment_logs?: Array<Record<string, unknown>>;
|
|
43
|
+
info_logs?: Array<Record<string, unknown>>;
|
|
44
|
+
like_logs?: Array<Record<string, unknown>>;
|
|
45
|
+
workflow_logs?: Array<Record<string, unknown>>;
|
|
46
|
+
shared?: Array<Record<string, unknown>>;
|
|
47
|
+
permissions?: Record<string, unknown>;
|
|
48
|
+
views?: Array<Record<string, unknown>>;
|
|
49
|
+
additional_timeline_content?: Array<Record<string, unknown>>;
|
|
50
|
+
milestones?: Array<Record<string, unknown>>;
|
|
51
|
+
is_document_followed?: number;
|
|
52
|
+
/** JSON string of tag list, e.g. "[]" or comma string — parse defensively */
|
|
53
|
+
tags?: string;
|
|
54
|
+
document_email?: unknown;
|
|
55
|
+
[key: string]: unknown;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface CacheEntry {
|
|
59
|
+
promise: Promise<DocInfo>;
|
|
60
|
+
value?: DocInfo;
|
|
61
|
+
listeners: Set<() => void>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const docinfoCache = new Map<string, CacheEntry>();
|
|
65
|
+
|
|
66
|
+
function cacheKey(doctype: string, name: string) {
|
|
67
|
+
return `${doctype}\u0000${name}`;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Shared, deduped fetch of frappe's docinfo for a document. Multiple panels
|
|
72
|
+
* (sidebar, timeline, connections) share one fetch; `reload()` from any of
|
|
73
|
+
* them refreshes all subscribers.
|
|
74
|
+
*/
|
|
75
|
+
export function useDocinfo(
|
|
76
|
+
doctype?: string,
|
|
77
|
+
name?: string,
|
|
78
|
+
): { docinfo?: DocInfo; loading: boolean; error?: Error; reload: () => void } {
|
|
79
|
+
const app = useFrappeApp();
|
|
80
|
+
const [docinfo, setDocinfo] = useState<DocInfo | undefined>(undefined);
|
|
81
|
+
const [loading, setLoading] = useState<boolean>(Boolean(doctype && name));
|
|
82
|
+
const [error, setError] = useState<Error | undefined>(undefined);
|
|
83
|
+
const [generation, setGeneration] = useState(0);
|
|
84
|
+
|
|
85
|
+
const isNewDoc = !name || name === "new";
|
|
86
|
+
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (!app || !doctype || !name || isNewDoc) {
|
|
89
|
+
setDocinfo(undefined);
|
|
90
|
+
setLoading(false);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
let cancelled = false;
|
|
94
|
+
const key = cacheKey(doctype, name);
|
|
95
|
+
let entry = docinfoCache.get(key);
|
|
96
|
+
if (!entry) {
|
|
97
|
+
const listeners = new Set<() => void>();
|
|
98
|
+
const promise = app
|
|
99
|
+
.call()
|
|
100
|
+
.get<{ docinfo?: DocInfo; message?: { docinfo?: DocInfo } }>(
|
|
101
|
+
"frappe.desk.form.load.get_docinfo",
|
|
102
|
+
{ doctype, name },
|
|
103
|
+
)
|
|
104
|
+
.then((res) => {
|
|
105
|
+
const info = res.payload?.docinfo ?? res.payload?.message?.docinfo;
|
|
106
|
+
if (!info) throw new Error(`No docinfo returned for ${doctype}/${name}`);
|
|
107
|
+
return info;
|
|
108
|
+
});
|
|
109
|
+
entry = { promise, listeners };
|
|
110
|
+
docinfoCache.set(key, entry);
|
|
111
|
+
promise
|
|
112
|
+
.then((value) => {
|
|
113
|
+
const current = docinfoCache.get(key);
|
|
114
|
+
if (current && current === entry) {
|
|
115
|
+
current.value = value;
|
|
116
|
+
for (const listener of current.listeners) listener();
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
.catch(() => {
|
|
120
|
+
if (docinfoCache.get(key) === entry) docinfoCache.delete(key);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
const currentEntry = entry;
|
|
124
|
+
const sync = () => {
|
|
125
|
+
if (!cancelled && currentEntry.value) {
|
|
126
|
+
setDocinfo(currentEntry.value);
|
|
127
|
+
setLoading(false);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
currentEntry.listeners.add(sync);
|
|
131
|
+
setLoading(!currentEntry.value);
|
|
132
|
+
setError(undefined);
|
|
133
|
+
if (currentEntry.value) setDocinfo(currentEntry.value);
|
|
134
|
+
currentEntry.promise.catch((err: Error) => {
|
|
135
|
+
if (!cancelled) {
|
|
136
|
+
setError(err);
|
|
137
|
+
setLoading(false);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
return () => {
|
|
141
|
+
cancelled = true;
|
|
142
|
+
currentEntry.listeners.delete(sync);
|
|
143
|
+
};
|
|
144
|
+
}, [app, doctype, name, isNewDoc, generation]);
|
|
145
|
+
|
|
146
|
+
const reload = useCallback(() => {
|
|
147
|
+
if (doctype && name) {
|
|
148
|
+
const key = cacheKey(doctype, name);
|
|
149
|
+
const entry = docinfoCache.get(key);
|
|
150
|
+
docinfoCache.delete(key);
|
|
151
|
+
// wake every subscriber so they re-run the effect and share the refetch
|
|
152
|
+
if (entry) for (const listener of entry.listeners) listener();
|
|
153
|
+
}
|
|
154
|
+
setGeneration((g) => g + 1);
|
|
155
|
+
}, [doctype, name]);
|
|
156
|
+
|
|
157
|
+
return useMemo(() => ({ docinfo, loading, error, reload }), [docinfo, loading, error, reload]);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** Invalidate the docinfo cache for a document (after mutations). */
|
|
161
|
+
export function invalidateDocinfo(doctype: string, name: string) {
|
|
162
|
+
docinfoCache.delete(cacheKey(doctype, name));
|
|
163
|
+
}
|