@multiplatform.one/backoffice 6.4.0 → 6.4.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/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,54 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: true
|
|
22
|
+
}), mod);
|
|
23
|
+
var useSessionUserId_exports = {};
|
|
24
|
+
__export(useSessionUserId_exports, {
|
|
25
|
+
useSessionUserId: () => useSessionUserId
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(useSessionUserId_exports);
|
|
28
|
+
var import_frappe_ui = require("@multiplatform.one/frappe-ui");
|
|
29
|
+
var import_react = require("react");
|
|
30
|
+
var import_useFrappeApp = require("./useFrappeApp.cjs");
|
|
31
|
+
const userCache = /* @__PURE__ */new Map();
|
|
32
|
+
function useSessionUserId() {
|
|
33
|
+
const config = (0, import_frappe_ui.useFrappeConfig)();
|
|
34
|
+
const app = (0, import_useFrappeApp.useFrappeApp)();
|
|
35
|
+
const fixtureMode = Boolean(config?.fixtures);
|
|
36
|
+
const [user, setUser] = (0, import_react.useState)(void 0);
|
|
37
|
+
(0, import_react.useEffect)(() => {
|
|
38
|
+
if (!app || fixtureMode || !config?.baseURL) return;
|
|
39
|
+
let cancelled = false;
|
|
40
|
+
let promise = userCache.get(config.baseURL);
|
|
41
|
+
if (!promise) {
|
|
42
|
+
promise = app.auth().getLoggedInUser();
|
|
43
|
+
userCache.set(config.baseURL, promise);
|
|
44
|
+
promise.catch(() => userCache.delete(config.baseURL));
|
|
45
|
+
}
|
|
46
|
+
promise.then(value => {
|
|
47
|
+
if (!cancelled && value) setUser(value);
|
|
48
|
+
}).catch(() => {});
|
|
49
|
+
return () => {
|
|
50
|
+
cancelled = true;
|
|
51
|
+
};
|
|
52
|
+
}, [app, fixtureMode, config?.baseURL]);
|
|
53
|
+
return user;
|
|
54
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
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 useSessionUserId_exports = {};
|
|
26
|
+
__export(useSessionUserId_exports, {
|
|
27
|
+
useSessionUserId: () => useSessionUserId
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(useSessionUserId_exports);
|
|
30
|
+
var import_frappe_ui = require("@multiplatform.one/frappe-ui");
|
|
31
|
+
var import_react = require("react");
|
|
32
|
+
var import_useFrappeApp = require("./useFrappeApp.native.js");
|
|
33
|
+
var userCache = /* @__PURE__ */new Map();
|
|
34
|
+
function useSessionUserId() {
|
|
35
|
+
var config = (0, import_frappe_ui.useFrappeConfig)();
|
|
36
|
+
var app = (0, import_useFrappeApp.useFrappeApp)();
|
|
37
|
+
var fixtureMode = Boolean(config === null || config === void 0 ? void 0 : config.fixtures);
|
|
38
|
+
var [user, setUser] = (0, import_react.useState)(void 0);
|
|
39
|
+
(0, import_react.useEffect)(function () {
|
|
40
|
+
if (!app || fixtureMode || !(config === null || config === void 0 ? void 0 : config.baseURL)) return;
|
|
41
|
+
var cancelled = false;
|
|
42
|
+
var promise = userCache.get(config.baseURL);
|
|
43
|
+
if (!promise) {
|
|
44
|
+
promise = app.auth().getLoggedInUser();
|
|
45
|
+
userCache.set(config.baseURL, promise);
|
|
46
|
+
promise.catch(function () {
|
|
47
|
+
return userCache.delete(config.baseURL);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
promise.then(function (value) {
|
|
51
|
+
if (!cancelled && value) setUser(value);
|
|
52
|
+
}).catch(function () {});
|
|
53
|
+
return function () {
|
|
54
|
+
cancelled = true;
|
|
55
|
+
};
|
|
56
|
+
}, [app, fixtureMode, config === null || config === void 0 ? void 0 : config.baseURL]);
|
|
57
|
+
return user;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=useSessionUserId.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","useSessionUserId_exports","__export","useSessionUserId","module","exports","import_frappe_ui","require","import_react","import_useFrappeApp","userCache","Map","config","useFrappeConfig","app","useFrappeApp","fixtureMode","Boolean","fixtures","user","setUser","useState","useEffect","baseURL","cancelled","promise","get","auth","getLoggedInUser","set","catch","delete","then"],"sources":["../../../src/shared/useSessionUserId.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,wBAAA;AAAAC,QAAA,CAAAD,wBAAA;EAAAE,gBAAA,EAAAA,CAAA,KAAAA;AAAA;AAGAC,MAAA,CAAAC,OAAA,GAAAT,YAAgC,CAAAK,wBAAA;AAChC,IAAAK,gBAAoC,GAAAC,OAAA;AACpC,IAAAC,YAAA,GAAAD,OAA6B;AAE7B,IAAAE,mBAAkB,GAAAF,OAAA,2BAAiC;AAM5C,IAAAG,SAAS,kBAAuC,IAAAC,GAAA;AACrD,SAAMR,gBAASA,CAAA;EACf,IAAAS,MAAM,OAAMN,gBAAA,CAAAO,eAAA,EAAa;EACzB,IAAAC,GAAM,OAAAL,mBAAsB,CAAAM,YAAgB;EAC5C,IAAAC,WAAa,GAAAC,OAAO,CAAAL,MAAI,aAAAA,MAA6B,UAAS,aAAAA,MAAA,CAAAM,QAAA;EAE9D,KAAAC,IAAA,EAAAC,OAAA,QAAAZ,YAAgB,CAAAa,QAAA;EACd,IAAAb,YAAY,CAAAc,SAAA,cAAwB;IACpC,IAAI,CAAAR,GAAA,IAAAE,WAAY,MAAAJ,MAAA,aAAAA,MAAA,uBAAAA,MAAA,CAAAW,OAAA;IAChB,IAAIC,SAAA,GAAU;IACd,IAAIC,OAAC,GAASf,SAAA,CAAAgB,GAAA,CAAAd,MAAA,CAAAW,OAAA;IACZ,KAAAE,OAAU;MACVA,OAAA,GAAUX,GAAA,CAAIa,IAAA,GAAOC,eAAS,CAAO;MACrClB,SAAQ,CAAAmB,GAAA,CAAMjB,MAAM,CAAAW,OAAA,EAAUE,OAAO;MACvCA,OAAA,CAAAK,KAAA;QACA,OACGpB,SAAM,CAAAqB,MAAU,CAAAnB,MAAA,CAAAW,OAAA;MACf;IACF;IAGAE,OAAC,CAAAO,IAAA,WAAAhC,KAAA;MACH,KAAOwB,SAAM,IAAAxB,KAAA,EAAAoB,OAAA,CAAApB,KAAA;IACX,GAAA8B,KAAA,aAAY,CACd;IACF,OAAS;MAETN,SAAO;IACT","ignoreList":[]}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: true
|
|
22
|
+
}), mod);
|
|
23
|
+
var useSlugTarget_exports = {};
|
|
24
|
+
__export(useSlugTarget_exports, {
|
|
25
|
+
useSlugTarget: () => useSlugTarget
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(useSlugTarget_exports);
|
|
28
|
+
var import_frappe = require("@multiplatform.one/frappe");
|
|
29
|
+
var import_frappe_ui = require("@multiplatform.one/frappe-ui");
|
|
30
|
+
var import_react = require("react");
|
|
31
|
+
var import_paths = require("../navigation/paths.cjs");
|
|
32
|
+
const slugIndexCache = /* @__PURE__ */new Map();
|
|
33
|
+
function toSlugMap(names) {
|
|
34
|
+
const map = /* @__PURE__ */new Map();
|
|
35
|
+
for (const row of names) {
|
|
36
|
+
if (row.name) map.set((0, import_paths.toSlug)(row.name), row.name);
|
|
37
|
+
}
|
|
38
|
+
return map;
|
|
39
|
+
}
|
|
40
|
+
async function fetchSlugIndex(source) {
|
|
41
|
+
if (source.fixtures) {
|
|
42
|
+
const [workspaces, doctypes] = await Promise.all([source.fixtures.getList("Workspace", {
|
|
43
|
+
fields: ["name"]
|
|
44
|
+
}), source.fixtures.getList("DocType", {
|
|
45
|
+
fields: ["name"]
|
|
46
|
+
})]);
|
|
47
|
+
return {
|
|
48
|
+
workspaces: toSlugMap(workspaces),
|
|
49
|
+
doctypes: toSlugMap(doctypes)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const client = new import_frappe.HttpClient(source.baseURL, source.auth);
|
|
53
|
+
const [workspacesRes, doctypesRes] = await Promise.all([client.get("/api/resource/Workspace", {
|
|
54
|
+
fields: '["name"]',
|
|
55
|
+
limit_page_length: "0"
|
|
56
|
+
}), client.get("/api/method/frappe.client.get_list", {
|
|
57
|
+
doctype: "DocType",
|
|
58
|
+
fields: '["name"]',
|
|
59
|
+
limit_page_length: "0"
|
|
60
|
+
})]);
|
|
61
|
+
return {
|
|
62
|
+
workspaces: toSlugMap(workspacesRes.payload?.data ?? []),
|
|
63
|
+
doctypes: toSlugMap(doctypesRes.payload?.message ?? [])
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function getSlugIndex(source) {
|
|
67
|
+
const key = `${source.baseURL}:${source.fixtures ? "fixtures" : "live"}`;
|
|
68
|
+
let promise = slugIndexCache.get(key);
|
|
69
|
+
if (!promise) {
|
|
70
|
+
promise = fetchSlugIndex(source);
|
|
71
|
+
promise.catch(() => {
|
|
72
|
+
if (slugIndexCache.get(key) === promise) slugIndexCache.delete(key);
|
|
73
|
+
});
|
|
74
|
+
slugIndexCache.set(key, promise);
|
|
75
|
+
}
|
|
76
|
+
return promise;
|
|
77
|
+
}
|
|
78
|
+
function useSlugTarget(slug) {
|
|
79
|
+
const config = (0, import_frappe_ui.useFrappeConfig)();
|
|
80
|
+
const baseURL = config?.baseURL;
|
|
81
|
+
const fixtures = config?.fixtures;
|
|
82
|
+
const auth = config?.auth;
|
|
83
|
+
const [index, setIndex] = (0, import_react.useState)(void 0);
|
|
84
|
+
const [failed, setFailed] = (0, import_react.useState)(false);
|
|
85
|
+
(0, import_react.useEffect)(() => {
|
|
86
|
+
let cancelled = false;
|
|
87
|
+
if (!baseURL && !fixtures) {
|
|
88
|
+
setFailed(true);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
setFailed(false);
|
|
92
|
+
getSlugIndex({
|
|
93
|
+
baseURL: baseURL ?? "",
|
|
94
|
+
auth,
|
|
95
|
+
fixtures
|
|
96
|
+
}).then(result => {
|
|
97
|
+
if (!cancelled) setIndex(result);
|
|
98
|
+
}).catch(() => {
|
|
99
|
+
if (!cancelled) setFailed(true);
|
|
100
|
+
});
|
|
101
|
+
return () => {
|
|
102
|
+
cancelled = true;
|
|
103
|
+
};
|
|
104
|
+
}, [baseURL, fixtures]);
|
|
105
|
+
return (0, import_react.useMemo)(() => {
|
|
106
|
+
if (!slug) return {
|
|
107
|
+
status: "loading"
|
|
108
|
+
};
|
|
109
|
+
if (index) {
|
|
110
|
+
const workspace = index.workspaces.get(slug);
|
|
111
|
+
if (workspace) return {
|
|
112
|
+
status: "resolved",
|
|
113
|
+
kind: "workspace",
|
|
114
|
+
workspace
|
|
115
|
+
};
|
|
116
|
+
const doctype = index.doctypes.get(slug);
|
|
117
|
+
if (doctype) return {
|
|
118
|
+
status: "resolved",
|
|
119
|
+
kind: "doctype",
|
|
120
|
+
doctype
|
|
121
|
+
};
|
|
122
|
+
return {
|
|
123
|
+
status: "not-found",
|
|
124
|
+
slug
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
if (failed) {
|
|
128
|
+
return {
|
|
129
|
+
status: "resolved",
|
|
130
|
+
kind: "doctype",
|
|
131
|
+
doctype: (0, import_paths.slugToDisplayName)(slug)
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
status: "loading"
|
|
136
|
+
};
|
|
137
|
+
}, [slug, index, failed]);
|
|
138
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
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 useSlugTarget_exports = {};
|
|
26
|
+
__export(useSlugTarget_exports, {
|
|
27
|
+
useSlugTarget: () => useSlugTarget
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(useSlugTarget_exports);
|
|
30
|
+
var import_frappe = require("@multiplatform.one/frappe");
|
|
31
|
+
var import_frappe_ui = require("@multiplatform.one/frappe-ui");
|
|
32
|
+
var import_react = require("react");
|
|
33
|
+
var import_paths = require("../navigation/paths.native.js");
|
|
34
|
+
var slugIndexCache = /* @__PURE__ */new Map();
|
|
35
|
+
function toSlugMap(names) {
|
|
36
|
+
var map = /* @__PURE__ */new Map();
|
|
37
|
+
var _iteratorNormalCompletion = true,
|
|
38
|
+
_didIteratorError = false,
|
|
39
|
+
_iteratorError = void 0;
|
|
40
|
+
try {
|
|
41
|
+
for (var _iterator = names[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
42
|
+
var row = _step.value;
|
|
43
|
+
if (row.name) map.set((0, import_paths.toSlug)(row.name), row.name);
|
|
44
|
+
}
|
|
45
|
+
} catch (err) {
|
|
46
|
+
_didIteratorError = true;
|
|
47
|
+
_iteratorError = err;
|
|
48
|
+
} finally {
|
|
49
|
+
try {
|
|
50
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
51
|
+
_iterator.return();
|
|
52
|
+
}
|
|
53
|
+
} finally {
|
|
54
|
+
if (_didIteratorError) {
|
|
55
|
+
throw _iteratorError;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return map;
|
|
60
|
+
}
|
|
61
|
+
async function fetchSlugIndex(source) {
|
|
62
|
+
var _ref, _ref1;
|
|
63
|
+
var _workspacesRes_payload, _doctypesRes_payload;
|
|
64
|
+
if (source.fixtures) {
|
|
65
|
+
var [workspaces, doctypes] = await Promise.all([source.fixtures.getList("Workspace", {
|
|
66
|
+
fields: ["name"]
|
|
67
|
+
}), source.fixtures.getList("DocType", {
|
|
68
|
+
fields: ["name"]
|
|
69
|
+
})]);
|
|
70
|
+
return {
|
|
71
|
+
workspaces: toSlugMap(workspaces),
|
|
72
|
+
doctypes: toSlugMap(doctypes)
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
var client = new import_frappe.HttpClient(source.baseURL, source.auth);
|
|
76
|
+
var [workspacesRes, doctypesRes] = await Promise.all([client.get("/api/resource/Workspace", {
|
|
77
|
+
fields: '["name"]',
|
|
78
|
+
limit_page_length: "0"
|
|
79
|
+
}), client.get("/api/method/frappe.client.get_list", {
|
|
80
|
+
doctype: "DocType",
|
|
81
|
+
fields: '["name"]',
|
|
82
|
+
limit_page_length: "0"
|
|
83
|
+
})]);
|
|
84
|
+
return {
|
|
85
|
+
workspaces: toSlugMap((_ref = (_workspacesRes_payload = workspacesRes.payload) === null || _workspacesRes_payload === void 0 ? void 0 : _workspacesRes_payload.data) !== null && _ref !== void 0 ? _ref : []),
|
|
86
|
+
doctypes: toSlugMap((_ref1 = (_doctypesRes_payload = doctypesRes.payload) === null || _doctypesRes_payload === void 0 ? void 0 : _doctypesRes_payload.message) !== null && _ref1 !== void 0 ? _ref1 : [])
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function getSlugIndex(source) {
|
|
90
|
+
var key = `${source.baseURL}:${source.fixtures ? "fixtures" : "live"}`;
|
|
91
|
+
var promise = slugIndexCache.get(key);
|
|
92
|
+
if (!promise) {
|
|
93
|
+
promise = fetchSlugIndex(source);
|
|
94
|
+
promise.catch(function () {
|
|
95
|
+
if (slugIndexCache.get(key) === promise) slugIndexCache.delete(key);
|
|
96
|
+
});
|
|
97
|
+
slugIndexCache.set(key, promise);
|
|
98
|
+
}
|
|
99
|
+
return promise;
|
|
100
|
+
}
|
|
101
|
+
function useSlugTarget(slug) {
|
|
102
|
+
var config = (0, import_frappe_ui.useFrappeConfig)();
|
|
103
|
+
var baseURL = config === null || config === void 0 ? void 0 : config.baseURL;
|
|
104
|
+
var fixtures = config === null || config === void 0 ? void 0 : config.fixtures;
|
|
105
|
+
var auth = config === null || config === void 0 ? void 0 : config.auth;
|
|
106
|
+
var [index, setIndex] = (0, import_react.useState)(void 0);
|
|
107
|
+
var [failed, setFailed] = (0, import_react.useState)(false);
|
|
108
|
+
(0, import_react.useEffect)(function () {
|
|
109
|
+
var cancelled = false;
|
|
110
|
+
if (!baseURL && !fixtures) {
|
|
111
|
+
setFailed(true);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
setFailed(false);
|
|
115
|
+
getSlugIndex({
|
|
116
|
+
baseURL: baseURL !== null && baseURL !== void 0 ? baseURL : "",
|
|
117
|
+
auth,
|
|
118
|
+
fixtures
|
|
119
|
+
}).then(function (result) {
|
|
120
|
+
if (!cancelled) setIndex(result);
|
|
121
|
+
}).catch(function () {
|
|
122
|
+
if (!cancelled) setFailed(true);
|
|
123
|
+
});
|
|
124
|
+
return function () {
|
|
125
|
+
cancelled = true;
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
// `auth` is intentionally not a dependency: the cache is keyed by
|
|
129
|
+
// baseURL/fixtures and provider auth is stable for the session.
|
|
130
|
+
// oxlint-disable-next-line exhaustive-deps
|
|
131
|
+
[baseURL, fixtures]);
|
|
132
|
+
return (0, import_react.useMemo)(function () {
|
|
133
|
+
if (!slug) return {
|
|
134
|
+
status: "loading"
|
|
135
|
+
};
|
|
136
|
+
if (index) {
|
|
137
|
+
var workspace = index.workspaces.get(slug);
|
|
138
|
+
if (workspace) return {
|
|
139
|
+
status: "resolved",
|
|
140
|
+
kind: "workspace",
|
|
141
|
+
workspace
|
|
142
|
+
};
|
|
143
|
+
var doctype = index.doctypes.get(slug);
|
|
144
|
+
if (doctype) return {
|
|
145
|
+
status: "resolved",
|
|
146
|
+
kind: "doctype",
|
|
147
|
+
doctype
|
|
148
|
+
};
|
|
149
|
+
return {
|
|
150
|
+
status: "not-found",
|
|
151
|
+
slug
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
if (failed) {
|
|
155
|
+
return {
|
|
156
|
+
status: "resolved",
|
|
157
|
+
kind: "doctype",
|
|
158
|
+
doctype: (0, import_paths.slugToDisplayName)(slug)
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
status: "loading"
|
|
163
|
+
};
|
|
164
|
+
}, [slug, index, failed]);
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=useSlugTarget.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","useSlugTarget_exports","__export","useSlugTarget","module","exports","import_frappe","require","import_frappe_ui","import_react","import_paths","slugIndexCache","Map","toSlugMap","names","map","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Symbol","iterator","_step","next","done","row","name","set","toSlug","err","return","fetchSlugIndex","source","_ref","_ref1","_workspacesRes_payload","_doctypesRes_payload","fixtures","workspaces","doctypes","Promise","all","getList","fields","client","HttpClient","baseURL","auth","workspacesRes","doctypesRes","get","limit_page_length","doctype","payload","data","message","getSlugIndex","key","promise","catch","delete","slug","config","useFrappeConfig","index","setIndex","useState","failed","setFailed","useEffect","cancelled"],"sources":["../../../src/shared/useSlugTarget.ts"],"sourcesContent":[null],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: true
|
|
22
|
+
}), mod);
|
|
23
|
+
var useUserRoles_exports = {};
|
|
24
|
+
__export(useUserRoles_exports, {
|
|
25
|
+
useUserRoles: () => useUserRoles
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(useUserRoles_exports);
|
|
28
|
+
var import_frappe_ui = require("@multiplatform.one/frappe-ui");
|
|
29
|
+
var import_react = require("react");
|
|
30
|
+
var import_useFrappeApp = require("./useFrappeApp.cjs");
|
|
31
|
+
const rolesCache = /* @__PURE__ */new Map();
|
|
32
|
+
function useUserRoles() {
|
|
33
|
+
const app = (0, import_useFrappeApp.useFrappeApp)();
|
|
34
|
+
const config = (0, import_frappe_ui.useFrappeConfig)();
|
|
35
|
+
const fixtures = config?.fixtures;
|
|
36
|
+
const baseURL = config?.baseURL;
|
|
37
|
+
const [roles, setRoles] = (0, import_react.useState)(void 0);
|
|
38
|
+
(0, import_react.useEffect)(() => {
|
|
39
|
+
if (!app || fixtures || !baseURL) {
|
|
40
|
+
setRoles(void 0);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
let cancelled = false;
|
|
44
|
+
let promise = rolesCache.get(baseURL);
|
|
45
|
+
if (!promise) {
|
|
46
|
+
promise = app.call().get("frappe.auth.get_logged_user").then(res => {
|
|
47
|
+
const user = res.payload?.message;
|
|
48
|
+
if (!user) throw new Error("No session user");
|
|
49
|
+
return app.call().get("frappe.core.doctype.user.user.get_roles", {
|
|
50
|
+
uid: user
|
|
51
|
+
});
|
|
52
|
+
}).then(res => {
|
|
53
|
+
const list = res.payload?.message;
|
|
54
|
+
if (!Array.isArray(list)) throw new Error("No roles returned");
|
|
55
|
+
return list;
|
|
56
|
+
});
|
|
57
|
+
rolesCache.set(baseURL, promise);
|
|
58
|
+
promise.catch(() => rolesCache.delete(baseURL));
|
|
59
|
+
}
|
|
60
|
+
promise.then(list => {
|
|
61
|
+
if (!cancelled) setRoles(list);
|
|
62
|
+
}).catch(() => {
|
|
63
|
+
if (!cancelled) setRoles(void 0);
|
|
64
|
+
});
|
|
65
|
+
return () => {
|
|
66
|
+
cancelled = true;
|
|
67
|
+
};
|
|
68
|
+
}, [app, fixtures, baseURL]);
|
|
69
|
+
return {
|
|
70
|
+
roles
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
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 useUserRoles_exports = {};
|
|
26
|
+
__export(useUserRoles_exports, {
|
|
27
|
+
useUserRoles: () => useUserRoles
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(useUserRoles_exports);
|
|
30
|
+
var import_frappe_ui = require("@multiplatform.one/frappe-ui");
|
|
31
|
+
var import_react = require("react");
|
|
32
|
+
var import_useFrappeApp = require("./useFrappeApp.native.js");
|
|
33
|
+
var rolesCache = /* @__PURE__ */new Map();
|
|
34
|
+
function useUserRoles() {
|
|
35
|
+
var app = (0, import_useFrappeApp.useFrappeApp)();
|
|
36
|
+
var config = (0, import_frappe_ui.useFrappeConfig)();
|
|
37
|
+
var fixtures = config === null || config === void 0 ? void 0 : config.fixtures;
|
|
38
|
+
var baseURL = config === null || config === void 0 ? void 0 : config.baseURL;
|
|
39
|
+
var [roles, setRoles] = (0, import_react.useState)(void 0);
|
|
40
|
+
(0, import_react.useEffect)(function () {
|
|
41
|
+
if (!app || fixtures || !baseURL) {
|
|
42
|
+
setRoles(void 0);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
var cancelled = false;
|
|
46
|
+
var promise = rolesCache.get(baseURL);
|
|
47
|
+
if (!promise) {
|
|
48
|
+
promise = app.call().get("frappe.auth.get_logged_user").then(function (res) {
|
|
49
|
+
var _res_payload;
|
|
50
|
+
var user = (_res_payload = res.payload) === null || _res_payload === void 0 ? void 0 : _res_payload.message;
|
|
51
|
+
if (!user) throw new Error("No session user");
|
|
52
|
+
return app.call().get("frappe.core.doctype.user.user.get_roles", {
|
|
53
|
+
uid: user
|
|
54
|
+
});
|
|
55
|
+
}).then(function (res) {
|
|
56
|
+
var _res_payload;
|
|
57
|
+
var list = (_res_payload = res.payload) === null || _res_payload === void 0 ? void 0 : _res_payload.message;
|
|
58
|
+
if (!Array.isArray(list)) throw new Error("No roles returned");
|
|
59
|
+
return list;
|
|
60
|
+
});
|
|
61
|
+
rolesCache.set(baseURL, promise);
|
|
62
|
+
promise.catch(function () {
|
|
63
|
+
return rolesCache.delete(baseURL);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
promise.then(function (list) {
|
|
67
|
+
if (!cancelled) setRoles(list);
|
|
68
|
+
}).catch(function () {
|
|
69
|
+
if (!cancelled) setRoles(void 0);
|
|
70
|
+
});
|
|
71
|
+
return function () {
|
|
72
|
+
cancelled = true;
|
|
73
|
+
};
|
|
74
|
+
}, [app, fixtures, baseURL]);
|
|
75
|
+
return {
|
|
76
|
+
roles
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=useUserRoles.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","useUserRoles_exports","__export","useUserRoles","module","exports","import_frappe_ui","require","import_react","import_useFrappeApp","rolesCache","Map","app","useFrappeApp","config","useFrappeConfig","fixtures","baseURL","roles","setRoles","useState","useEffect","cancelled","promise","get","call","then","res","_res_payload","user","payload","message","Error","uid","list","Array","isArray","set","catch","delete"],"sources":["../../../src/shared/useUserRoles.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,oBAAA;AAAAC,QAAA,CAAAD,oBAAA;EAAAE,YAAA,EAAAA,CAAA,KAAAA;AAAA;AAYAC,MAAA,CAAAC,OAAA,GAAAT,YAAgC,CAAAK,oBAAA;AAChC,IAAAK,gBAAoC,GAAAC,OAAA;AACpC,IAAAC,YAAA,GAAAD,OAA6B;AAE7B,IAAAE,mBAAmB,GAAAF,OAAA,2BAAmC;AAE/C,IAAAG,UAAS,kBAAqC,IAAAC,GAAA;AACnD,SAAMR,YAAMA,CAAA;EACZ,IAAAS,GAAM,OAAAH,mBAAS,CAAAI,YAAA;EACf,IAAAC,MAAM,OAAWR,gBAAQ,CAAAS,eAAA;EACzB,IAAAC,QAAM,GAAAF,MAAU,KAAQ,QAAAA,MAAA,uBAAAA,MAAA,CAAAE,QAAA;EACxB,IAAAC,OAAO,GAAOH,MAAA,KAAQ,QAAIA,MAAA,cAA+B,MAAS,GAAAA,MAAA,CAAAG,OAAA;EAElE,KAAAC,KAAA,EAAAC,QAAA,QAAUX,YAAM,CAAAY,QAAA;EAEd,IAAAZ,YAAY,CAAAa,SAAY,EAAC,YAAS;IAChC,KAAAT,GAAA,IAASI,QAAS,KAAAC,OAAA;MAClBE,QAAA;MACF;IACA;IACA,IAAIG,SAAA,GAAU;IACd,IAAIC,OAAC,GAASb,UAAA,CAAAc,GAAA,CAAAP,OAAA;IACZ,KAAAM,OAAU;MAINA,OAAA,GAAMX,GAAA,CAAAa,IAAO,CAAI,EAAAD,GAAA,8BAAS,EAAAE,IAAA,WAAAC,GAAA;QAC1B,IAAIC,YAAO;QACX,IAAAC,IAAO,GAAI,CAAAD,YAAmC,GAAAD,GAAA,CAAAG,OAAA,cAAAF,YAAA,KAA2C,kBAAAA,YAAA,CAAAG,OAAA;QAAA,IACvF,CAAAF,IAAK,YAAAG,KAAA;QACP,OAACpB,GAAA,CAAAa,IAAA,GAAAD,GAAA;UAEFS,GAAA,EAAMJ;QACL;MACA,GAAAH,IAAK,WAAMC,GAAA,EAAQ;QACnB,IAAAC,YAAO;QACR,IAAAM,IAAA,IAAAN,YAAA,GAAAD,GAAA,CAAAG,OAAA,cAAAF,YAAA,uBAAAA,YAAA,CAAAG,OAAA;QACH,KAAAI,KAAW,CAAAC,OAAI,CAAAF,IAAS,SAAO,IAAAF,KAAA;QAC/B,OAAQE,IAAA;MACV;MACAxB,UACG,CAAK2B,GAAC,CAAApB,OAAS,EAAAM,OAAA;MACdA,OAAK,CAAAe,KAAA,aAAoB;QAE1B,OAAM5B,UAAM,CAAA6B,MAAA,CAAAtB,OAAA;MACX;IACF;IACFM,OAAO,CAAAG,IAAA,CAAM,UAAAQ,IAAA;MACX,KAAAZ,SAAY,EAAAH,QAAA,CAAAe,IAAA;IACd,GAAAI,KAAA;MACE,KAAKhB,SAAA,EAAUH,QAAQ;IAE3B;IACF","ignoreList":[]}
|