@multiplatform.one/backoffice 6.3.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.
Files changed (338) hide show
  1. package/dist/cjs/chrome/CommandPalette.cjs +20 -9
  2. package/dist/cjs/chrome/CommandPalette.native.js +18 -10
  3. package/dist/cjs/chrome/CommandPalette.native.js.map +1 -1
  4. package/dist/cjs/i18n/en.cjs +21 -0
  5. package/dist/cjs/i18n/en.native.js +21 -0
  6. package/dist/cjs/i18n/en.native.js.map +1 -1
  7. package/dist/cjs/index.cjs +49 -1
  8. package/dist/cjs/index.native.js +48 -0
  9. package/dist/cjs/index.native.js.map +1 -1
  10. package/dist/cjs/shared/types.cjs +18 -0
  11. package/dist/cjs/shared/types.native.js +21 -0
  12. package/dist/cjs/shared/types.native.js.map +1 -0
  13. package/dist/cjs/shared/useDocinfo.cjs +116 -0
  14. package/dist/cjs/shared/useDocinfo.native.js +167 -0
  15. package/dist/cjs/shared/useDocinfo.native.js.map +1 -0
  16. package/dist/cjs/shared/useDoctypeMeta.cjs +124 -0
  17. package/dist/cjs/shared/useDoctypeMeta.native.js +158 -0
  18. package/dist/cjs/shared/useDoctypeMeta.native.js.map +1 -0
  19. package/dist/cjs/shared/useRecentVisit.cjs +40 -0
  20. package/dist/cjs/shared/useRecentVisit.native.js +43 -0
  21. package/dist/cjs/shared/useRecentVisit.native.js.map +1 -0
  22. package/dist/cjs/shared/useSessionUserId.cjs +54 -0
  23. package/dist/cjs/shared/useSessionUserId.native.js +59 -0
  24. package/dist/cjs/shared/useSessionUserId.native.js.map +1 -0
  25. package/dist/cjs/shared/useSlugTarget.cjs +138 -0
  26. package/dist/cjs/shared/useSlugTarget.native.js +166 -0
  27. package/dist/cjs/shared/useSlugTarget.native.js.map +1 -0
  28. package/dist/cjs/shared/useUserRoles.cjs +72 -0
  29. package/dist/cjs/shared/useUserRoles.native.js +79 -0
  30. package/dist/cjs/shared/useUserRoles.native.js.map +1 -0
  31. package/dist/cjs/shell/WorkspaceSidebar.cjs +4 -0
  32. package/dist/cjs/shell/WorkspaceSidebar.native.js +4 -0
  33. package/dist/cjs/shell/WorkspaceSidebar.native.js.map +1 -1
  34. package/dist/cjs/workspace/WorkspaceChartBlock.cjs +136 -0
  35. package/dist/cjs/workspace/WorkspaceChartBlock.native.js +144 -0
  36. package/dist/cjs/workspace/WorkspaceChartBlock.native.js.map +1 -0
  37. package/dist/cjs/workspace/WorkspaceGrid.cjs +91 -0
  38. package/dist/cjs/workspace/WorkspaceGrid.native.js +126 -0
  39. package/dist/cjs/workspace/WorkspaceGrid.native.js.map +1 -0
  40. package/dist/cjs/workspace/WorkspaceLinkCard.cjs +139 -0
  41. package/dist/cjs/workspace/WorkspaceLinkCard.native.js +155 -0
  42. package/dist/cjs/workspace/WorkspaceLinkCard.native.js.map +1 -0
  43. package/dist/cjs/workspace/WorkspaceLinkDirectory.cjs +110 -0
  44. package/dist/cjs/workspace/WorkspaceLinkDirectory.native.js +127 -0
  45. package/dist/cjs/workspace/WorkspaceLinkDirectory.native.js.map +1 -0
  46. package/dist/cjs/workspace/WorkspaceNumberCard.cjs +133 -0
  47. package/dist/cjs/workspace/WorkspaceNumberCard.native.js +138 -0
  48. package/dist/cjs/workspace/WorkspaceNumberCard.native.js.map +1 -0
  49. package/dist/cjs/workspace/WorkspaceQuickList.cjs +112 -0
  50. package/dist/cjs/workspace/WorkspaceQuickList.native.js +130 -0
  51. package/dist/cjs/workspace/WorkspaceQuickList.native.js.map +1 -0
  52. package/dist/cjs/workspace/WorkspaceRecents.cjs +116 -0
  53. package/dist/cjs/workspace/WorkspaceRecents.native.js +132 -0
  54. package/dist/cjs/workspace/WorkspaceRecents.native.js.map +1 -0
  55. package/dist/cjs/workspace/WorkspaceScreen.cjs +291 -0
  56. package/dist/cjs/workspace/WorkspaceScreen.native.js +323 -0
  57. package/dist/cjs/workspace/WorkspaceScreen.native.js.map +1 -0
  58. package/dist/cjs/workspace/WorkspaceShortcut.cjs +185 -0
  59. package/dist/cjs/workspace/WorkspaceShortcut.native.js +202 -0
  60. package/dist/cjs/workspace/WorkspaceShortcut.native.js.map +1 -0
  61. package/dist/cjs/workspace/parseContent.cjs +180 -0
  62. package/dist/cjs/workspace/parseContent.native.js +299 -0
  63. package/dist/cjs/workspace/parseContent.native.js.map +1 -0
  64. package/dist/cjs/workspace/types.cjs +18 -0
  65. package/dist/cjs/workspace/types.native.js +21 -0
  66. package/dist/cjs/workspace/types.native.js.map +1 -0
  67. package/dist/cjs/workspace/useDashboardChart.cjs +96 -0
  68. package/dist/cjs/workspace/useDashboardChart.native.js +110 -0
  69. package/dist/cjs/workspace/useDashboardChart.native.js.map +1 -0
  70. package/dist/cjs/workspace/useWorkspaceDoc.cjs +103 -0
  71. package/dist/cjs/workspace/useWorkspaceDoc.native.js +120 -0
  72. package/dist/cjs/workspace/useWorkspaceDoc.native.js.map +1 -0
  73. package/dist/esm/chrome/CommandPalette.mjs +20 -9
  74. package/dist/esm/chrome/CommandPalette.mjs.map +1 -1
  75. package/dist/esm/chrome/CommandPalette.native.js +18 -10
  76. package/dist/esm/chrome/CommandPalette.native.js.map +1 -1
  77. package/dist/esm/i18n/en.mjs +21 -0
  78. package/dist/esm/i18n/en.mjs.map +1 -1
  79. package/dist/esm/i18n/en.native.js +21 -0
  80. package/dist/esm/i18n/en.native.js.map +1 -1
  81. package/dist/esm/index.mjs +19 -1
  82. package/dist/esm/index.mjs.map +1 -1
  83. package/dist/esm/index.native.js +19 -1
  84. package/dist/esm/index.native.js.map +1 -1
  85. package/dist/esm/shared/types.mjs +2 -0
  86. package/dist/esm/shared/types.mjs.map +1 -0
  87. package/dist/esm/shared/types.native.js +2 -0
  88. package/dist/esm/shared/types.native.js.map +1 -0
  89. package/dist/esm/shared/useDocinfo.mjs +90 -0
  90. package/dist/esm/shared/useDocinfo.mjs.map +1 -0
  91. package/dist/esm/shared/useDocinfo.native.js +138 -0
  92. package/dist/esm/shared/useDocinfo.native.js.map +1 -0
  93. package/dist/esm/shared/useDoctypeMeta.mjs +99 -0
  94. package/dist/esm/shared/useDoctypeMeta.mjs.map +1 -0
  95. package/dist/esm/shared/useDoctypeMeta.native.js +130 -0
  96. package/dist/esm/shared/useDoctypeMeta.native.js.map +1 -0
  97. package/dist/esm/shared/useRecentVisit.mjs +15 -0
  98. package/dist/esm/shared/useRecentVisit.mjs.map +1 -0
  99. package/dist/esm/shared/useRecentVisit.native.js +15 -0
  100. package/dist/esm/shared/useRecentVisit.native.js.map +1 -0
  101. package/dist/esm/shared/useSessionUserId.mjs +29 -0
  102. package/dist/esm/shared/useSessionUserId.mjs.map +1 -0
  103. package/dist/esm/shared/useSessionUserId.native.js +31 -0
  104. package/dist/esm/shared/useSessionUserId.native.js.map +1 -0
  105. package/dist/esm/shared/useSlugTarget.mjs +113 -0
  106. package/dist/esm/shared/useSlugTarget.mjs.map +1 -0
  107. package/dist/esm/shared/useSlugTarget.native.js +138 -0
  108. package/dist/esm/shared/useSlugTarget.native.js.map +1 -0
  109. package/dist/esm/shared/useUserRoles.mjs +47 -0
  110. package/dist/esm/shared/useUserRoles.mjs.map +1 -0
  111. package/dist/esm/shared/useUserRoles.native.js +51 -0
  112. package/dist/esm/shared/useUserRoles.native.js.map +1 -0
  113. package/dist/esm/shell/WorkspaceSidebar.mjs +4 -0
  114. package/dist/esm/shell/WorkspaceSidebar.mjs.map +1 -1
  115. package/dist/esm/shell/WorkspaceSidebar.native.js +4 -0
  116. package/dist/esm/shell/WorkspaceSidebar.native.js.map +1 -1
  117. package/dist/esm/workspace/WorkspaceChartBlock.mjs +111 -0
  118. package/dist/esm/workspace/WorkspaceChartBlock.mjs.map +1 -0
  119. package/dist/esm/workspace/WorkspaceChartBlock.native.js +116 -0
  120. package/dist/esm/workspace/WorkspaceChartBlock.native.js.map +1 -0
  121. package/dist/esm/workspace/WorkspaceGrid.mjs +66 -0
  122. package/dist/esm/workspace/WorkspaceGrid.mjs.map +1 -0
  123. package/dist/esm/workspace/WorkspaceGrid.native.js +98 -0
  124. package/dist/esm/workspace/WorkspaceGrid.native.js.map +1 -0
  125. package/dist/esm/workspace/WorkspaceLinkCard.mjs +113 -0
  126. package/dist/esm/workspace/WorkspaceLinkCard.mjs.map +1 -0
  127. package/dist/esm/workspace/WorkspaceLinkCard.native.js +126 -0
  128. package/dist/esm/workspace/WorkspaceLinkCard.native.js.map +1 -0
  129. package/dist/esm/workspace/WorkspaceLinkDirectory.mjs +84 -0
  130. package/dist/esm/workspace/WorkspaceLinkDirectory.mjs.map +1 -0
  131. package/dist/esm/workspace/WorkspaceLinkDirectory.native.js +98 -0
  132. package/dist/esm/workspace/WorkspaceLinkDirectory.native.js.map +1 -0
  133. package/dist/esm/workspace/WorkspaceNumberCard.mjs +108 -0
  134. package/dist/esm/workspace/WorkspaceNumberCard.mjs.map +1 -0
  135. package/dist/esm/workspace/WorkspaceNumberCard.native.js +110 -0
  136. package/dist/esm/workspace/WorkspaceNumberCard.native.js.map +1 -0
  137. package/dist/esm/workspace/WorkspaceQuickList.mjs +87 -0
  138. package/dist/esm/workspace/WorkspaceQuickList.mjs.map +1 -0
  139. package/dist/esm/workspace/WorkspaceQuickList.native.js +102 -0
  140. package/dist/esm/workspace/WorkspaceQuickList.native.js.map +1 -0
  141. package/dist/esm/workspace/WorkspaceRecents.mjs +91 -0
  142. package/dist/esm/workspace/WorkspaceRecents.mjs.map +1 -0
  143. package/dist/esm/workspace/WorkspaceRecents.native.js +104 -0
  144. package/dist/esm/workspace/WorkspaceRecents.native.js.map +1 -0
  145. package/dist/esm/workspace/WorkspaceScreen.mjs +266 -0
  146. package/dist/esm/workspace/WorkspaceScreen.mjs.map +1 -0
  147. package/dist/esm/workspace/WorkspaceScreen.native.js +295 -0
  148. package/dist/esm/workspace/WorkspaceScreen.native.js.map +1 -0
  149. package/dist/esm/workspace/WorkspaceShortcut.mjs +159 -0
  150. package/dist/esm/workspace/WorkspaceShortcut.mjs.map +1 -0
  151. package/dist/esm/workspace/WorkspaceShortcut.native.js +173 -0
  152. package/dist/esm/workspace/WorkspaceShortcut.native.js.map +1 -0
  153. package/dist/esm/workspace/parseContent.mjs +148 -0
  154. package/dist/esm/workspace/parseContent.mjs.map +1 -0
  155. package/dist/esm/workspace/parseContent.native.js +264 -0
  156. package/dist/esm/workspace/parseContent.native.js.map +1 -0
  157. package/dist/esm/workspace/types.mjs +2 -0
  158. package/dist/esm/workspace/types.mjs.map +1 -0
  159. package/dist/esm/workspace/types.native.js +2 -0
  160. package/dist/esm/workspace/types.native.js.map +1 -0
  161. package/dist/esm/workspace/useDashboardChart.mjs +71 -0
  162. package/dist/esm/workspace/useDashboardChart.mjs.map +1 -0
  163. package/dist/esm/workspace/useDashboardChart.native.js +82 -0
  164. package/dist/esm/workspace/useDashboardChart.native.js.map +1 -0
  165. package/dist/esm/workspace/useWorkspaceDoc.mjs +77 -0
  166. package/dist/esm/workspace/useWorkspaceDoc.mjs.map +1 -0
  167. package/dist/esm/workspace/useWorkspaceDoc.native.js +91 -0
  168. package/dist/esm/workspace/useWorkspaceDoc.native.js.map +1 -0
  169. package/dist/jsx/chrome/CommandPalette.mjs +20 -9
  170. package/dist/jsx/chrome/CommandPalette.mjs.map +1 -1
  171. package/dist/jsx/chrome/CommandPalette.native.js +18 -10
  172. package/dist/jsx/chrome/CommandPalette.native.js.map +1 -1
  173. package/dist/jsx/i18n/en.mjs +21 -0
  174. package/dist/jsx/i18n/en.mjs.map +1 -1
  175. package/dist/jsx/i18n/en.native.js +21 -0
  176. package/dist/jsx/i18n/en.native.js.map +1 -1
  177. package/dist/jsx/index.js +19 -1
  178. package/dist/jsx/index.js.map +1 -1
  179. package/dist/jsx/index.mjs +19 -1
  180. package/dist/jsx/index.mjs.map +1 -1
  181. package/dist/jsx/index.native.js +48 -0
  182. package/dist/jsx/index.native.js.map +1 -1
  183. package/dist/jsx/shared/types.mjs +2 -0
  184. package/dist/jsx/shared/types.mjs.map +1 -0
  185. package/dist/jsx/shared/types.native.js +21 -0
  186. package/dist/jsx/shared/types.native.js.map +1 -0
  187. package/dist/jsx/shared/useDocinfo.mjs +90 -0
  188. package/dist/jsx/shared/useDocinfo.mjs.map +1 -0
  189. package/dist/jsx/shared/useDocinfo.native.js +167 -0
  190. package/dist/jsx/shared/useDocinfo.native.js.map +1 -0
  191. package/dist/jsx/shared/useDoctypeMeta.mjs +99 -0
  192. package/dist/jsx/shared/useDoctypeMeta.mjs.map +1 -0
  193. package/dist/jsx/shared/useDoctypeMeta.native.js +158 -0
  194. package/dist/jsx/shared/useDoctypeMeta.native.js.map +1 -0
  195. package/dist/jsx/shared/useRecentVisit.mjs +15 -0
  196. package/dist/jsx/shared/useRecentVisit.mjs.map +1 -0
  197. package/dist/jsx/shared/useRecentVisit.native.js +43 -0
  198. package/dist/jsx/shared/useRecentVisit.native.js.map +1 -0
  199. package/dist/jsx/shared/useSessionUserId.mjs +29 -0
  200. package/dist/jsx/shared/useSessionUserId.mjs.map +1 -0
  201. package/dist/jsx/shared/useSessionUserId.native.js +59 -0
  202. package/dist/jsx/shared/useSessionUserId.native.js.map +1 -0
  203. package/dist/jsx/shared/useSlugTarget.mjs +113 -0
  204. package/dist/jsx/shared/useSlugTarget.mjs.map +1 -0
  205. package/dist/jsx/shared/useSlugTarget.native.js +166 -0
  206. package/dist/jsx/shared/useSlugTarget.native.js.map +1 -0
  207. package/dist/jsx/shared/useUserRoles.mjs +47 -0
  208. package/dist/jsx/shared/useUserRoles.mjs.map +1 -0
  209. package/dist/jsx/shared/useUserRoles.native.js +79 -0
  210. package/dist/jsx/shared/useUserRoles.native.js.map +1 -0
  211. package/dist/jsx/shell/WorkspaceSidebar.mjs +4 -0
  212. package/dist/jsx/shell/WorkspaceSidebar.mjs.map +1 -1
  213. package/dist/jsx/shell/WorkspaceSidebar.native.js +4 -0
  214. package/dist/jsx/shell/WorkspaceSidebar.native.js.map +1 -1
  215. package/dist/jsx/workspace/WorkspaceChartBlock.mjs +111 -0
  216. package/dist/jsx/workspace/WorkspaceChartBlock.mjs.map +1 -0
  217. package/dist/jsx/workspace/WorkspaceChartBlock.native.js +144 -0
  218. package/dist/jsx/workspace/WorkspaceChartBlock.native.js.map +1 -0
  219. package/dist/jsx/workspace/WorkspaceGrid.mjs +66 -0
  220. package/dist/jsx/workspace/WorkspaceGrid.mjs.map +1 -0
  221. package/dist/jsx/workspace/WorkspaceGrid.native.js +126 -0
  222. package/dist/jsx/workspace/WorkspaceGrid.native.js.map +1 -0
  223. package/dist/jsx/workspace/WorkspaceLinkCard.mjs +113 -0
  224. package/dist/jsx/workspace/WorkspaceLinkCard.mjs.map +1 -0
  225. package/dist/jsx/workspace/WorkspaceLinkCard.native.js +155 -0
  226. package/dist/jsx/workspace/WorkspaceLinkCard.native.js.map +1 -0
  227. package/dist/jsx/workspace/WorkspaceLinkDirectory.mjs +84 -0
  228. package/dist/jsx/workspace/WorkspaceLinkDirectory.mjs.map +1 -0
  229. package/dist/jsx/workspace/WorkspaceLinkDirectory.native.js +127 -0
  230. package/dist/jsx/workspace/WorkspaceLinkDirectory.native.js.map +1 -0
  231. package/dist/jsx/workspace/WorkspaceNumberCard.mjs +108 -0
  232. package/dist/jsx/workspace/WorkspaceNumberCard.mjs.map +1 -0
  233. package/dist/jsx/workspace/WorkspaceNumberCard.native.js +138 -0
  234. package/dist/jsx/workspace/WorkspaceNumberCard.native.js.map +1 -0
  235. package/dist/jsx/workspace/WorkspaceQuickList.mjs +87 -0
  236. package/dist/jsx/workspace/WorkspaceQuickList.mjs.map +1 -0
  237. package/dist/jsx/workspace/WorkspaceQuickList.native.js +130 -0
  238. package/dist/jsx/workspace/WorkspaceQuickList.native.js.map +1 -0
  239. package/dist/jsx/workspace/WorkspaceRecents.mjs +91 -0
  240. package/dist/jsx/workspace/WorkspaceRecents.mjs.map +1 -0
  241. package/dist/jsx/workspace/WorkspaceRecents.native.js +132 -0
  242. package/dist/jsx/workspace/WorkspaceRecents.native.js.map +1 -0
  243. package/dist/jsx/workspace/WorkspaceScreen.mjs +266 -0
  244. package/dist/jsx/workspace/WorkspaceScreen.mjs.map +1 -0
  245. package/dist/jsx/workspace/WorkspaceScreen.native.js +323 -0
  246. package/dist/jsx/workspace/WorkspaceScreen.native.js.map +1 -0
  247. package/dist/jsx/workspace/WorkspaceShortcut.mjs +159 -0
  248. package/dist/jsx/workspace/WorkspaceShortcut.mjs.map +1 -0
  249. package/dist/jsx/workspace/WorkspaceShortcut.native.js +202 -0
  250. package/dist/jsx/workspace/WorkspaceShortcut.native.js.map +1 -0
  251. package/dist/jsx/workspace/parseContent.mjs +148 -0
  252. package/dist/jsx/workspace/parseContent.mjs.map +1 -0
  253. package/dist/jsx/workspace/parseContent.native.js +299 -0
  254. package/dist/jsx/workspace/parseContent.native.js.map +1 -0
  255. package/dist/jsx/workspace/types.mjs +2 -0
  256. package/dist/jsx/workspace/types.mjs.map +1 -0
  257. package/dist/jsx/workspace/types.native.js +21 -0
  258. package/dist/jsx/workspace/types.native.js.map +1 -0
  259. package/dist/jsx/workspace/useDashboardChart.mjs +71 -0
  260. package/dist/jsx/workspace/useDashboardChart.mjs.map +1 -0
  261. package/dist/jsx/workspace/useDashboardChart.native.js +110 -0
  262. package/dist/jsx/workspace/useDashboardChart.native.js.map +1 -0
  263. package/dist/jsx/workspace/useWorkspaceDoc.mjs +77 -0
  264. package/dist/jsx/workspace/useWorkspaceDoc.mjs.map +1 -0
  265. package/dist/jsx/workspace/useWorkspaceDoc.native.js +120 -0
  266. package/dist/jsx/workspace/useWorkspaceDoc.native.js.map +1 -0
  267. package/package.json +12 -12
  268. package/src/chrome/CommandPalette.tsx +35 -15
  269. package/src/i18n/en.ts +21 -0
  270. package/src/index.ts +69 -0
  271. package/src/shared/types.ts +14 -0
  272. package/src/shared/useDocinfo.ts +163 -0
  273. package/src/shared/useDoctypeMeta.ts +243 -0
  274. package/src/shared/useRecentVisit.ts +33 -0
  275. package/src/shared/useSessionUserId.ts +42 -0
  276. package/src/shared/useSlugTarget.ts +143 -0
  277. package/src/shared/useUserRoles.ts +66 -0
  278. package/src/shell/WorkspaceSidebar.tsx +3 -0
  279. package/src/workspace/WorkspaceChartBlock.tsx +115 -0
  280. package/src/workspace/WorkspaceGrid.tsx +82 -0
  281. package/src/workspace/WorkspaceLinkCard.tsx +134 -0
  282. package/src/workspace/WorkspaceLinkDirectory.tsx +126 -0
  283. package/src/workspace/WorkspaceNumberCard.tsx +126 -0
  284. package/src/workspace/WorkspaceQuickList.tsx +100 -0
  285. package/src/workspace/WorkspaceRecents.tsx +100 -0
  286. package/src/workspace/WorkspaceScreen.tsx +322 -0
  287. package/src/workspace/WorkspaceShortcut.tsx +223 -0
  288. package/src/workspace/parseContent.spec.ts +327 -0
  289. package/src/workspace/parseContent.ts +240 -0
  290. package/src/workspace/types.ts +135 -0
  291. package/src/workspace/useDashboardChart.ts +115 -0
  292. package/src/workspace/useWorkspaceDoc.ts +111 -0
  293. package/types/chrome/CommandPalette.d.ts.map +1 -1
  294. package/types/i18n/en.d.ts +19 -0
  295. package/types/i18n/en.d.ts.map +1 -1
  296. package/types/index.d.ts +34 -0
  297. package/types/index.d.ts.map +1 -1
  298. package/types/shared/types.d.ts +21 -0
  299. package/types/shared/types.d.ts.map +1 -0
  300. package/types/shared/useDocinfo.d.ts +61 -0
  301. package/types/shared/useDocinfo.d.ts.map +1 -0
  302. package/types/shared/useDoctypeMeta.d.ts +118 -0
  303. package/types/shared/useDoctypeMeta.d.ts.map +1 -0
  304. package/types/shared/useRecentVisit.d.ts +10 -0
  305. package/types/shared/useRecentVisit.d.ts.map +1 -0
  306. package/types/shared/useSessionUserId.d.ts +6 -0
  307. package/types/shared/useSessionUserId.d.ts.map +1 -0
  308. package/types/shared/useSlugTarget.d.ts +18 -0
  309. package/types/shared/useSlugTarget.d.ts.map +1 -0
  310. package/types/shared/useUserRoles.d.ts +15 -0
  311. package/types/shared/useUserRoles.d.ts.map +1 -0
  312. package/types/shell/WorkspaceSidebar.d.ts.map +1 -1
  313. package/types/workspace/WorkspaceChartBlock.d.ts +6 -0
  314. package/types/workspace/WorkspaceChartBlock.d.ts.map +1 -0
  315. package/types/workspace/WorkspaceGrid.d.ts +23 -0
  316. package/types/workspace/WorkspaceGrid.d.ts.map +1 -0
  317. package/types/workspace/WorkspaceLinkCard.d.ts +20 -0
  318. package/types/workspace/WorkspaceLinkCard.d.ts.map +1 -0
  319. package/types/workspace/WorkspaceLinkDirectory.d.ts +19 -0
  320. package/types/workspace/WorkspaceLinkDirectory.d.ts.map +1 -0
  321. package/types/workspace/WorkspaceNumberCard.d.ts +19 -0
  322. package/types/workspace/WorkspaceNumberCard.d.ts.map +1 -0
  323. package/types/workspace/WorkspaceQuickList.d.ts +6 -0
  324. package/types/workspace/WorkspaceQuickList.d.ts.map +1 -0
  325. package/types/workspace/WorkspaceRecents.d.ts +2 -0
  326. package/types/workspace/WorkspaceRecents.d.ts.map +1 -0
  327. package/types/workspace/WorkspaceScreen.d.ts +24 -0
  328. package/types/workspace/WorkspaceScreen.d.ts.map +1 -0
  329. package/types/workspace/WorkspaceShortcut.d.ts +27 -0
  330. package/types/workspace/WorkspaceShortcut.d.ts.map +1 -0
  331. package/types/workspace/parseContent.d.ts +77 -0
  332. package/types/workspace/parseContent.d.ts.map +1 -0
  333. package/types/workspace/types.d.ts +112 -0
  334. package/types/workspace/types.d.ts.map +1 -0
  335. package/types/workspace/useDashboardChart.d.ts +29 -0
  336. package/types/workspace/useDashboardChart.d.ts.map +1 -0
  337. package/types/workspace/useWorkspaceDoc.d.ts +18 -0
  338. package/types/workspace/useWorkspaceDoc.d.ts.map +1 -0
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
+ }
@@ -0,0 +1,243 @@
1
+ // Shared contract — consumed by the list, form, views, and quick-entry
2
+ // surfaces; keep signatures stable.
3
+ // This is the ONE meta loader for backoffice surfaces (form/deskMeta.ts and
4
+ // views/viewMeta.ts loaders were consolidated here): getdoctype RPC on live
5
+ // benches, the FrappeProvider fixture branch for stories/tests, one
6
+ // module-wide cache either way.
7
+ import type { FixtureProvider } from "@multiplatform.one/frappe";
8
+ import { useFrappeConfig } from "@multiplatform.one/frappe-ui";
9
+ import { useCallback, useEffect, useMemo, useState } from "react";
10
+ import { useFrappeApp } from "./useFrappeApp";
11
+
12
+ /** A single DocField row from a DocType meta (loose — server is source of truth). */
13
+ export interface DocFieldMeta {
14
+ fieldname: string;
15
+ label?: string;
16
+ fieldtype: string;
17
+ options?: string;
18
+ reqd?: 0 | 1;
19
+ hidden?: 0 | 1;
20
+ read_only?: 0 | 1;
21
+ bold?: 0 | 1;
22
+ in_list_view?: 0 | 1;
23
+ in_standard_filter?: 0 | 1;
24
+ in_global_search?: 0 | 1;
25
+ allow_in_quick_entry?: 0 | 1;
26
+ allow_on_submit?: 0 | 1;
27
+ no_copy?: 0 | 1;
28
+ collapsible?: 0 | 1;
29
+ collapsible_depends_on?: string;
30
+ depends_on?: string;
31
+ mandatory_depends_on?: string;
32
+ read_only_depends_on?: string;
33
+ fetch_from?: string;
34
+ permlevel?: number;
35
+ length?: number;
36
+ default?: string;
37
+ description?: string;
38
+ precision?: string | number;
39
+ idx?: number;
40
+ [key: string]: unknown;
41
+ }
42
+
43
+ /** DocType Link child row (Connections tab). Probed: `group` arrives null when unset. */
44
+ export interface DocLinkMeta {
45
+ name?: string;
46
+ link_doctype: string;
47
+ link_fieldname: string;
48
+ group?: string | null;
49
+ hidden?: 0 | 1;
50
+ is_child_table?: 0 | 1;
51
+ parent_doctype?: string;
52
+ table_fieldname?: string;
53
+ [key: string]: unknown;
54
+ }
55
+
56
+ /** Role permission row from the DocType meta. */
57
+ export interface DocPermissionRule {
58
+ role?: string;
59
+ permlevel?: number;
60
+ read?: 0 | 1;
61
+ write?: 0 | 1;
62
+ create?: 0 | 1;
63
+ delete?: 0 | 1;
64
+ submit?: 0 | 1;
65
+ cancel?: 0 | 1;
66
+ amend?: 0 | 1;
67
+ print?: 0 | 1;
68
+ email?: 0 | 1;
69
+ share?: 0 | 1;
70
+ if_owner?: 0 | 1;
71
+ [key: string]: unknown;
72
+ }
73
+
74
+ /** DocType meta as returned by frappe.desk.form.load.getdoctype (loose). */
75
+ export interface DoctypeMeta {
76
+ doctype?: string;
77
+ name: string;
78
+ module?: string;
79
+ issingle?: 0 | 1;
80
+ istable?: 0 | 1;
81
+ is_submittable?: 0 | 1;
82
+ is_tree?: 0 | 1;
83
+ is_virtual?: 0 | 1;
84
+ editable_grid?: 0 | 1;
85
+ track_changes?: 0 | 1;
86
+ quick_entry?: 0 | 1;
87
+ autoname?: string;
88
+ naming_rule?: string;
89
+ allow_rename?: 0 | 1;
90
+ allow_copy?: 0 | 1;
91
+ read_only?: 0 | 1;
92
+ in_create?: 0 | 1;
93
+ hide_toolbar?: 0 | 1;
94
+ max_attachments?: number;
95
+ title_field?: string;
96
+ image_field?: string;
97
+ search_fields?: string;
98
+ sort_field?: string;
99
+ sort_order?: string;
100
+ icon?: string;
101
+ document_type?: string;
102
+ fields: DocFieldMeta[];
103
+ permissions?: DocPermissionRule[];
104
+ links?: DocLinkMeta[];
105
+ states?: Array<{ title?: string; color?: string } & Record<string, unknown>>;
106
+ [key: string]: unknown;
107
+ }
108
+
109
+ export interface DoctypeMetaBundle {
110
+ /** Parent doctype meta (docs[0]) */
111
+ meta: DoctypeMeta;
112
+ /** Child table doctype metas keyed by doctype name (docs[1..]) */
113
+ childMetas: Record<string, DoctypeMeta>;
114
+ /** Parsed user_settings (list view settings etc.), when present */
115
+ userSettings?: Record<string, unknown>;
116
+ }
117
+
118
+ interface GetDoctypeResponse {
119
+ docs?: DoctypeMeta[];
120
+ user_settings?: string | Record<string, unknown>;
121
+ }
122
+
123
+ const metaCache = new Map<string, Promise<DoctypeMetaBundle>>();
124
+
125
+ function parseUserSettings(raw: GetDoctypeResponse["user_settings"]) {
126
+ if (!raw) return undefined;
127
+ if (typeof raw !== "string") return raw;
128
+ try {
129
+ return JSON.parse(raw) as Record<string, unknown>;
130
+ } catch {
131
+ return undefined;
132
+ }
133
+ }
134
+
135
+ /**
136
+ * Fixture path (stories / tests): the raw getdoctype-shaped meta doc lives in
137
+ * the fixture provider's "DocType" collection under the doctype's name
138
+ * (fields / links / permissions arrays inline).
139
+ */
140
+ async function loadBundleFromFixtures(
141
+ fixtures: FixtureProvider,
142
+ doctype: string,
143
+ ): Promise<DoctypeMetaBundle> {
144
+ const doc = await fixtures.getDoc("DocType", doctype);
145
+ if (!doc) throw new Error(`No fixture meta for DocType "${doctype}"`);
146
+ const raw = doc as Record<string, unknown>;
147
+ const meta = { ...raw, fields: (raw.fields as DocFieldMeta[] | undefined) ?? [] } as DoctypeMeta;
148
+ return { meta, childMetas: {} };
149
+ }
150
+
151
+ /**
152
+ * Load (and cache, module-wide) the meta bundle for a doctype via
153
+ * `frappe.desk.form.load.getdoctype` — or, when the ambient FrappeProvider
154
+ * carries a fixture provider, from its "DocType" collection. All backoffice
155
+ * surfaces share this cache, so meta is fetched once per doctype per session.
156
+ */
157
+ export function useDoctypeMeta(doctype?: string): {
158
+ bundle?: DoctypeMetaBundle;
159
+ meta?: DoctypeMeta;
160
+ loading: boolean;
161
+ error?: Error;
162
+ reload: () => void;
163
+ } {
164
+ const app = useFrappeApp();
165
+ const config = useFrappeConfig();
166
+ const fixtures = config?.fixtures;
167
+ const [bundle, setBundle] = useState<DoctypeMetaBundle | undefined>(undefined);
168
+ const [loading, setLoading] = useState<boolean>(Boolean(doctype));
169
+ const [error, setError] = useState<Error | undefined>(undefined);
170
+ const [generation, setGeneration] = useState(0);
171
+
172
+ // Fixture and live providers must not share cache entries (storybook mounts
173
+ // both kinds in one session); baseURL keeps multi-bench setups apart.
174
+ const cacheKey = doctype
175
+ ? `${config?.baseURL ?? ""}\u0000${fixtures ? "fixtures" : "live"}\u0000${doctype}`
176
+ : undefined;
177
+
178
+ useEffect(() => {
179
+ if ((!app && !fixtures) || !doctype || !cacheKey) {
180
+ setBundle(undefined);
181
+ setLoading(Boolean(doctype));
182
+ return;
183
+ }
184
+ let cancelled = false;
185
+ let promise = metaCache.get(cacheKey);
186
+ if (!promise) {
187
+ if (fixtures) {
188
+ promise = loadBundleFromFixtures(fixtures, doctype);
189
+ } else if (app) {
190
+ promise = app
191
+ .call()
192
+ .get<GetDoctypeResponse>("frappe.desk.form.load.getdoctype", {
193
+ doctype,
194
+ with_parent: 1,
195
+ })
196
+ .then((res) => {
197
+ const docs = res.payload?.docs ?? [];
198
+ const meta = docs.find((d) => d.name === doctype) ?? docs[0];
199
+ if (!meta) throw new Error(`No meta returned for ${doctype}`);
200
+ const childMetas: Record<string, DoctypeMeta> = {};
201
+ for (const doc of docs) {
202
+ if (doc !== meta) childMetas[doc.name] = doc;
203
+ }
204
+ return {
205
+ meta,
206
+ childMetas,
207
+ userSettings: parseUserSettings(res.payload?.user_settings),
208
+ };
209
+ });
210
+ } else {
211
+ return;
212
+ }
213
+ metaCache.set(cacheKey, promise);
214
+ promise.catch(() => metaCache.delete(cacheKey));
215
+ }
216
+ setLoading(true);
217
+ setError(undefined);
218
+ promise
219
+ .then((value) => {
220
+ if (cancelled) return;
221
+ setBundle(value);
222
+ setLoading(false);
223
+ })
224
+ .catch((err: Error) => {
225
+ if (cancelled) return;
226
+ setError(err);
227
+ setLoading(false);
228
+ });
229
+ return () => {
230
+ cancelled = true;
231
+ };
232
+ }, [app, fixtures, doctype, cacheKey, generation]);
233
+
234
+ const reload = useCallback(() => {
235
+ if (cacheKey) metaCache.delete(cacheKey);
236
+ setGeneration((g) => g + 1);
237
+ }, [cacheKey]);
238
+
239
+ return useMemo(
240
+ () => ({ bundle, meta: bundle?.meta, loading, error, reload }),
241
+ [bundle, loading, error, reload],
242
+ );
243
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Write side of the shared desk recents store ("frappe-desk-recent") for
3
+ * plain navigation. The awesomebar/command palette already writes recents
4
+ * when it navigates, but sidebar/list navigation never did — so the
5
+ * workspace "Continue where you left off" strip stayed empty for anyone who
6
+ * doesn't use the palette. Screens call this on mount (and whenever the
7
+ * visited path changes) so every doctype-list and document visit lands in
8
+ * the same store the palette, sidebar recents, and the workspace strip read.
9
+ *
10
+ * Label vocabulary follows the existing writers: doctype lists use the bare
11
+ * doctype (command-palette navigation items), documents use
12
+ * "{doctype}: {name}" (frappe-ui DeskFormPage precedent).
13
+ */
14
+ import { addToRecent } from "@multiplatform.one/frappe-ui";
15
+ import { useEffect } from "react";
16
+
17
+ export interface RecentVisit {
18
+ label: string;
19
+ path: string;
20
+ }
21
+
22
+ /**
23
+ * Record a visit in the shared recents store. Pass `undefined` to skip
24
+ * (create mode, fixture/story mode). Dedup/cap is owned by `addToRecent`.
25
+ */
26
+ export function useRecentVisit(visit: RecentVisit | undefined): void {
27
+ const label = visit?.label;
28
+ const path = visit?.path;
29
+ useEffect(() => {
30
+ if (!label || !path) return;
31
+ addToRecent({ label, path });
32
+ }, [label, path]);
33
+ }
@@ -0,0 +1,42 @@
1
+ // Session user id (for liked-hearts + "assigned to me"), cached per app.
2
+ // (The shell's useSessionUser in shell/useWorkspaces.ts is the HttpClient
3
+ // variant used by the sidebar; this one rides the FrappeApp auth module.)
4
+ import { useFrappeConfig } from "@multiplatform.one/frappe-ui";
5
+ import { useEffect, useState } from "react";
6
+ import { useFrappeApp } from "./useFrappeApp";
7
+
8
+ const userCache = new Map<string, Promise<string>>();
9
+
10
+ /**
11
+ * The logged-in user's id (`frappe.auth.get_logged_user`), or undefined
12
+ * while loading / in fixture mode (no session exists against fixtures).
13
+ */
14
+ export function useSessionUserId(): string | undefined {
15
+ const config = useFrappeConfig();
16
+ const app = useFrappeApp();
17
+ const fixtureMode = Boolean(config?.fixtures);
18
+ const [user, setUser] = useState<string | undefined>(undefined);
19
+
20
+ useEffect(() => {
21
+ if (!app || fixtureMode || !config?.baseURL) return;
22
+ let cancelled = false;
23
+ let promise = userCache.get(config.baseURL);
24
+ if (!promise) {
25
+ promise = app.auth().getLoggedInUser();
26
+ userCache.set(config.baseURL, promise);
27
+ promise.catch(() => userCache.delete(config.baseURL));
28
+ }
29
+ promise
30
+ .then((value) => {
31
+ if (!cancelled && value) setUser(value);
32
+ })
33
+ .catch(() => {
34
+ // No session — hearts render unfilled, "me" facets hidden.
35
+ });
36
+ return () => {
37
+ cancelled = true;
38
+ };
39
+ }, [app, fixtureMode, config?.baseURL]);
40
+
41
+ return user;
42
+ }