@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
@@ -0,0 +1,240 @@
1
+ /**
2
+ * Pure parsing helpers for the Workspace `content` block JSON and the
3
+ * JSON filter strings carried by shortcuts / quick lists / number cards.
4
+ * No DOM: HTML in header/paragraph blocks is stripped with a regex-based
5
+ * text extractor so this runs on native and gjs too.
6
+ */
7
+ import type {
8
+ FrappeFilterTuple,
9
+ WorkspaceBlock,
10
+ WorkspaceDoc,
11
+ WorkspaceLinkGroup,
12
+ WorkspaceLinkRow,
13
+ } from "./types";
14
+
15
+ /** Parse the workspace `content` JSON string into blocks (bad JSON → []). */
16
+ export function parseWorkspaceContent(content: string | undefined | null): WorkspaceBlock[] {
17
+ if (!content) return [];
18
+ try {
19
+ const parsed = JSON.parse(content);
20
+ if (!Array.isArray(parsed)) return [];
21
+ return parsed.filter(
22
+ (block): block is WorkspaceBlock =>
23
+ !!block && typeof block === "object" && typeof block.type === "string",
24
+ );
25
+ } catch {
26
+ return [];
27
+ }
28
+ }
29
+
30
+ const NAMED_ENTITIES: Record<string, string> = {
31
+ amp: "&",
32
+ lt: "<",
33
+ gt: ">",
34
+ quot: '"',
35
+ apos: "'",
36
+ nbsp: " ",
37
+ };
38
+
39
+ /**
40
+ * Extract plain text from desk's rich-text wrappers, e.g.
41
+ * `<span class="h4"><b>Reports &amp; Masters</b></span>` → "Reports & Masters".
42
+ */
43
+ export function stripHtml(html: string | undefined | null): string {
44
+ if (!html) return "";
45
+ const withoutTags = html.replace(/<br\s*\/?>/gi, "\n").replace(/<[^>]*>/g, "");
46
+ return withoutTags
47
+ .replace(/&(#[xX]?[0-9a-fA-F]+|[a-zA-Z]+);/g, (match, entity: string) => {
48
+ if (entity.startsWith("#x") || entity.startsWith("#X")) {
49
+ const code = Number.parseInt(entity.slice(2), 16);
50
+ return Number.isNaN(code) ? match : String.fromCodePoint(code);
51
+ }
52
+ if (entity.startsWith("#")) {
53
+ const code = Number.parseInt(entity.slice(1), 10);
54
+ return Number.isNaN(code) ? match : String.fromCodePoint(code);
55
+ }
56
+ return NAMED_ENTITIES[entity.toLowerCase()] ?? match;
57
+ })
58
+ .trim();
59
+ }
60
+
61
+ /**
62
+ * Heading level from a desk header block's HTML wrapper: `class="h4"` →
63
+ * 4. Desk also emits raw font-size styles (Build workspace uses
64
+ * `font-size: 18px`); those and unclassed headers fall back to 4 — the
65
+ * visual scale desk uses for workspace section headings.
66
+ */
67
+ export function headerLevel(html: string | undefined | null): 1 | 2 | 3 | 4 | 5 | 6 {
68
+ const match = (html ?? "").match(/class="[^"]*\bh([1-6])\b[^"]*"/);
69
+ if (match) return Number(match[1]) as 1 | 2 | 3 | 4 | 5 | 6;
70
+ return 4;
71
+ }
72
+
73
+ /**
74
+ * Group the flat `links` child table into cards: each "Card Break" row
75
+ * opens a group that collects the following "Link" rows (hidden rows are
76
+ * dropped). Link rows before any Card Break are ignored — desk does the
77
+ * same (they are unreachable from card blocks).
78
+ */
79
+ export function groupLinks(links: WorkspaceLinkRow[] | undefined): WorkspaceLinkGroup[] {
80
+ const groups: WorkspaceLinkGroup[] = [];
81
+ let current: WorkspaceLinkGroup | undefined;
82
+ for (const row of links ?? []) {
83
+ if (row.type === "Card Break") {
84
+ // A hidden Card Break hides its whole card: close the current group so
85
+ // its following Link rows are dropped, not leaked into the prior card.
86
+ if (row.hidden) {
87
+ current = undefined;
88
+ continue;
89
+ }
90
+ current = { label: row.label, breakRow: row, links: [] };
91
+ groups.push(current);
92
+ } else if (row.type === "Link" && current && !row.hidden) {
93
+ current.links.push(row);
94
+ }
95
+ }
96
+ return groups;
97
+ }
98
+
99
+ /**
100
+ * Normalize a frappe JSON filter string to `[field, op, value]` triples.
101
+ * Real-world shapes (all seen on the control bench):
102
+ * - dict: `{"status":"Open"}` → `[["status","=","Open"]]`
103
+ * - dict of tuples: `{"status":["=","Open"]}` → `[["status","=","Open"]]`
104
+ * - list of triples: `[["enabled","=",1]]` → as-is
105
+ * - list of quads (doctype-prefixed, Number Card `filters_json`):
106
+ * `[["User","enabled","=",1]]` → doctype element stripped.
107
+ */
108
+ export function parseFrappeFilters(
109
+ raw: string | undefined | null,
110
+ ): FrappeFilterTuple[] | undefined {
111
+ if (!raw) return undefined;
112
+ let parsed: unknown;
113
+ try {
114
+ parsed = JSON.parse(raw);
115
+ } catch {
116
+ return undefined;
117
+ }
118
+ if (Array.isArray(parsed)) {
119
+ const tuples: FrappeFilterTuple[] = [];
120
+ for (const entry of parsed) {
121
+ if (!Array.isArray(entry)) continue;
122
+ if (entry.length >= 4) {
123
+ // [doctype, field, op, value] — drop the doctype element.
124
+ tuples.push([String(entry[1]), String(entry[2]), entry[3]]);
125
+ } else if (entry.length === 3) {
126
+ tuples.push([String(entry[0]), String(entry[1]), entry[2]]);
127
+ }
128
+ }
129
+ return tuples.length > 0 ? tuples : undefined;
130
+ }
131
+ if (parsed && typeof parsed === "object") {
132
+ const tuples: FrappeFilterTuple[] = [];
133
+ for (const [field, value] of Object.entries(parsed as Record<string, unknown>)) {
134
+ if (Array.isArray(value) && value.length === 2 && typeof value[0] === "string") {
135
+ tuples.push([field, value[0], value[1]]);
136
+ } else {
137
+ tuples.push([field, "=", value]);
138
+ }
139
+ }
140
+ return tuples.length > 0 ? tuples : undefined;
141
+ }
142
+ return undefined;
143
+ }
144
+
145
+ // ---------------------------------------------------------------------------
146
+ // Dashboard-first composition (MOD-11)
147
+ // ---------------------------------------------------------------------------
148
+
149
+ /**
150
+ * Workspace blocks partitioned by class for the dashboard-first layout:
151
+ * data widgets render first, then shortcuts, then the link-card directory.
152
+ */
153
+ export interface WorkspaceComposition {
154
+ /**
155
+ * Live data widgets, ordered number cards → charts → quick lists
156
+ * (authored order within each class).
157
+ */
158
+ data: WorkspaceBlock[];
159
+ /** Shortcut blocks in authored order. */
160
+ shortcuts: WorkspaceBlock[];
161
+ /** Link-card blocks in authored order. */
162
+ cards: WorkspaceBlock[];
163
+ /**
164
+ * Narrative content in authored order: paragraphs, plus headers that do
165
+ * NOT label a widget run (see keep rule below). Section-label headers
166
+ * ("Your Shortcuts", "Reports & Masters") are dropped — the recomposed
167
+ * sections carry their own canonical headings.
168
+ */
169
+ text: WorkspaceBlock[];
170
+ }
171
+
172
+ const DATA_BLOCK_RANK: Record<string, number> = { number_card: 0, chart: 1, quick_list: 2 };
173
+
174
+ function isDataBlock(block: WorkspaceBlock): boolean {
175
+ return block.type in DATA_BLOCK_RANK;
176
+ }
177
+
178
+ /**
179
+ * Partition parsed content blocks for the dashboard-first workspace layout
180
+ * (data → shortcuts → link cards), instead of desk's authoring order.
181
+ *
182
+ * Header keep rule: a header labels the blocks that follow it up to the next
183
+ * header. If that run contains any widget block (shortcut, card, chart,
184
+ * number card, quick list, onboarding, custom block), the header is a section
185
+ * label and is dropped; if the run holds only paragraphs (or nothing — e.g.
186
+ * the text-only "Welcome Workspace"), the header is real content and is kept.
187
+ * Spacers are dropped — section spacing owns the rhythm.
188
+ */
189
+ export function composeWorkspaceBlocks(blocks: WorkspaceBlock[]): WorkspaceComposition {
190
+ const shortcuts: WorkspaceBlock[] = [];
191
+ const cards: WorkspaceBlock[] = [];
192
+ const text: WorkspaceBlock[] = [];
193
+ const dataBlocks: WorkspaceBlock[] = [];
194
+
195
+ for (const [index, block] of blocks.entries()) {
196
+ if (isDataBlock(block)) {
197
+ dataBlocks.push(block);
198
+ } else if (block.type === "shortcut") {
199
+ shortcuts.push(block);
200
+ } else if (block.type === "card") {
201
+ cards.push(block);
202
+ } else if (block.type === "paragraph") {
203
+ text.push(block);
204
+ } else if (block.type === "header") {
205
+ let labelsWidgets = false;
206
+ for (const following of blocks.slice(index + 1)) {
207
+ if (following.type === "header") break;
208
+ if (following.type === "paragraph" || following.type === "spacer") continue;
209
+ labelsWidgets = true;
210
+ break;
211
+ }
212
+ if (!labelsWidgets) text.push(block);
213
+ }
214
+ // spacer / onboarding / custom_block / unknown — dropped (see module doc).
215
+ }
216
+
217
+ // Stable class ordering: number cards → charts → quick lists.
218
+ const data = dataBlocks
219
+ .map((block, index) => ({ block, index }))
220
+ .sort(
221
+ (a, b) =>
222
+ (DATA_BLOCK_RANK[a.block.type] ?? 0) - (DATA_BLOCK_RANK[b.block.type] ?? 0) ||
223
+ a.index - b.index,
224
+ )
225
+ .map(({ block }) => block);
226
+
227
+ return { data, shortcuts, cards, text };
228
+ }
229
+
230
+ /** Find a workspace shortcut row by a shortcut block's `shortcut_name`. */
231
+ export function findShortcut(doc: WorkspaceDoc, shortcutName: string | undefined) {
232
+ if (!shortcutName) return undefined;
233
+ return doc.shortcuts?.find((row) => row.label === shortcutName);
234
+ }
235
+
236
+ /** Find a link group by a card block's `card_name`. */
237
+ export function findLinkGroup(groups: WorkspaceLinkGroup[], cardName: string | undefined) {
238
+ if (!cardName) return undefined;
239
+ return groups.find((group) => group.label === cardName);
240
+ }
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Frappe Workspace doc shapes — verified against a real bench
3
+ * (`GET /api/resource/Workspace/<name>`; see WorkspaceScreen for the
4
+ * rendering contract). `content` is an editorjs-style JSON string of
5
+ * blocks; the child tables hold the referenced widget definitions.
6
+ */
7
+
8
+ /** One row of the `shortcuts` child table (doctype "Workspace Shortcut"). */
9
+ export interface WorkspaceShortcutRow {
10
+ name: string;
11
+ /** "DocType" | "Report" | "Page" | "Dashboard" | "URL" */
12
+ type: string;
13
+ link_to?: string;
14
+ /** URL shortcuts put the target here. */
15
+ url?: string;
16
+ label: string;
17
+ /** Optional list-view variant, e.g. "List" | "Tree" | "Report Builder". */
18
+ doc_view?: string;
19
+ /** Frappe color name for the count pill, e.g. "Grey", "Blue". */
20
+ color?: string;
21
+ /** JSON filters for the live count, e.g. `{"status":"Open"}`. */
22
+ stats_filter?: string;
23
+ /** Count display template, `{}` is the count, e.g. `"{} Open"`. */
24
+ format?: string;
25
+ }
26
+
27
+ /** One row of the `links` child table (doctype "Workspace Link"). */
28
+ export interface WorkspaceLinkRow {
29
+ name: string;
30
+ /** "Card Break" starts a link group; "Link" is a member of the group. */
31
+ type: "Card Break" | "Link" | string;
32
+ label: string;
33
+ /** "DocType" | "Report" | "Page" — only on type "Link". */
34
+ link_type?: string;
35
+ link_to?: string;
36
+ hidden?: number;
37
+ onboard?: number;
38
+ is_query_report?: number;
39
+ /** On Card Break rows: number of links desk shows before "+ N more". */
40
+ link_count?: number;
41
+ dependencies?: string;
42
+ }
43
+
44
+ /** One row of the `charts` child table (doctype "Workspace Chart"). */
45
+ export interface WorkspaceChartRow {
46
+ name: string;
47
+ /** Dashboard Chart doc name. */
48
+ chart_name: string;
49
+ label?: string;
50
+ }
51
+
52
+ /** One row of the `number_cards` child table (doctype "Workspace Number Card"). */
53
+ export interface WorkspaceNumberCardRow {
54
+ name: string;
55
+ /** Number Card doc name. */
56
+ number_card_name: string;
57
+ label?: string;
58
+ }
59
+
60
+ /** One row of the `quick_lists` child table (doctype "Workspace Quick List"). */
61
+ export interface WorkspaceQuickListRow {
62
+ name: string;
63
+ document_type: string;
64
+ label?: string;
65
+ /** JSON filters, e.g. `{"status":["=","Open"]}`. */
66
+ quick_list_filter?: string;
67
+ }
68
+
69
+ /** The Workspace document (fields the workspace page renders). */
70
+ export interface WorkspaceDoc {
71
+ name: string;
72
+ doctype: string;
73
+ title?: string;
74
+ label?: string;
75
+ icon?: string;
76
+ module?: string;
77
+ public?: number;
78
+ is_hidden?: number;
79
+ /** JSON string of editorjs-style blocks. */
80
+ content?: string;
81
+ shortcuts?: WorkspaceShortcutRow[];
82
+ links?: WorkspaceLinkRow[];
83
+ charts?: WorkspaceChartRow[];
84
+ number_cards?: WorkspaceNumberCardRow[];
85
+ quick_lists?: WorkspaceQuickListRow[];
86
+ [key: string]: unknown;
87
+ }
88
+
89
+ // ---------------------------------------------------------------------------
90
+ // Parsed `content` blocks
91
+ // ---------------------------------------------------------------------------
92
+
93
+ export type WorkspaceBlockType =
94
+ | "header"
95
+ | "paragraph"
96
+ | "shortcut"
97
+ | "card"
98
+ | "chart"
99
+ | "number_card"
100
+ | "quick_list"
101
+ | "spacer"
102
+ | "onboarding"
103
+ | (string & {});
104
+
105
+ export interface WorkspaceBlock {
106
+ id: string;
107
+ type: WorkspaceBlockType;
108
+ data: {
109
+ /** header / paragraph: HTML-ish rich text. */
110
+ text?: string;
111
+ /** shortcut: matches `shortcuts[].label`. */
112
+ shortcut_name?: string;
113
+ /** card: matches a Card Break `links[].label`. */
114
+ card_name?: string;
115
+ /** chart: matches `charts[].chart_name`. */
116
+ chart_name?: string;
117
+ /** number_card: matches `number_cards[].number_card_name`. */
118
+ number_card_name?: string;
119
+ /** quick_list: matches `quick_lists[].document_type`. */
120
+ quick_list_name?: string;
121
+ /** 12-column grid span (3 = shortcut pill, 4 = card, 12 = full row). */
122
+ col?: number;
123
+ [key: string]: unknown;
124
+ };
125
+ }
126
+
127
+ /** A Card Break row grouped together with its following Link rows. */
128
+ export interface WorkspaceLinkGroup {
129
+ label: string;
130
+ breakRow: WorkspaceLinkRow;
131
+ links: WorkspaceLinkRow[];
132
+ }
133
+
134
+ /** Frappe filter triple, ready for the frappe client (`[field, op, value]`). */
135
+ export type FrappeFilterTuple = [string, string, unknown];
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Dashboard Chart data for workspace chart blocks.
3
+ *
4
+ * Desk fetches chart data through the whitelisted RPC
5
+ * `frappe.desk.doctype.dashboard_chart.dashboard_chart.get` (POST with
6
+ * `chart_name`), which returns `{message: {labels: string[], datasets:
7
+ * [{name, values: number[]}]}}` — verified against the control bench.
8
+ * The chart *type* (Line/Bar/Pie/…) lives on the Dashboard Chart doc,
9
+ * which the block reads separately via `useFrappeDoc`.
10
+ *
11
+ * Fixture mode has no RPC surface — the hook reports `unsupported` and
12
+ * the block renders an informational card instead (documented gap).
13
+ */
14
+ import { CallModule, HttpClient, type AuthConfig } from "@multiplatform.one/frappe";
15
+ import { useFrappeConfig, type FrappeConfig } from "@multiplatform.one/frappe-ui";
16
+ import { useCallback, useEffect, useRef, useState } from "react";
17
+
18
+ export interface DashboardChartSeries {
19
+ labels: string[];
20
+ datasets: Array<{ name?: string; values: number[] }>;
21
+ }
22
+
23
+ export interface DashboardChartDoc {
24
+ name: string;
25
+ doctype: string;
26
+ chart_name?: string;
27
+ /** Render style: "Line" | "Bar" | "Percentage" | "Pie" | "Donut" | "Heatmap" */
28
+ type?: string;
29
+ /** Data source kind: "Count" | "Sum" | "Average" | "Group By" | "Report" | "Custom" */
30
+ chart_type?: string;
31
+ document_type?: string;
32
+ [key: string]: unknown;
33
+ }
34
+
35
+ export interface UseDashboardChartDataResult {
36
+ series: DashboardChartSeries | undefined;
37
+ isLoading: boolean;
38
+ error: Error | undefined;
39
+ /** Fixture mode (stories/tests) — no RPC available for chart data. */
40
+ unsupported: boolean;
41
+ refresh: () => void;
42
+ }
43
+
44
+ const callCache = new Map<string, CallModule>();
45
+
46
+ function getCall(config: FrappeConfig): CallModule {
47
+ const key = `${config.baseURL}:${config.auth?.token ?? ""}:${config.auth?.type ?? ""}`;
48
+ let call = callCache.get(key);
49
+ if (!call) {
50
+ const authConfig: AuthConfig | undefined = config.auth
51
+ ? {
52
+ useToken: config.auth.useToken,
53
+ token: config.auth.token,
54
+ type: config.auth.type as AuthConfig["type"],
55
+ }
56
+ : undefined;
57
+ call = new CallModule(new HttpClient(config.baseURL, authConfig));
58
+ callCache.set(key, call);
59
+ }
60
+ return call;
61
+ }
62
+
63
+ const CHART_GET_METHOD = "frappe.desk.doctype.dashboard_chart.dashboard_chart.get";
64
+
65
+ /** Fetch a Dashboard Chart's series via the desk RPC (live mode only). */
66
+ export function useDashboardChartData(chartName: string | undefined): UseDashboardChartDataResult {
67
+ const config = useFrappeConfig();
68
+ const [series, setSeries] = useState<DashboardChartSeries | undefined>(undefined);
69
+ const [isLoading, setIsLoading] = useState(!!chartName && !config?.fixtures);
70
+ const [error, setError] = useState<Error | undefined>(undefined);
71
+ const fetchSeq = useRef(0);
72
+
73
+ const configRef = useRef(config);
74
+ configRef.current = config;
75
+
76
+ const unsupported = !!config?.fixtures;
77
+
78
+ const runFetch = useCallback(async (name: string) => {
79
+ const conn = configRef.current;
80
+ if (conn?.fixtures) return;
81
+ const seq = ++fetchSeq.current;
82
+ setIsLoading(true);
83
+ setError(undefined);
84
+ try {
85
+ if (!conn?.baseURL) {
86
+ throw new Error("useDashboardChartData requires a FrappeProvider with baseURL");
87
+ }
88
+ const res = await getCall(conn).post<{ message: DashboardChartSeries }>(CHART_GET_METHOD, {
89
+ chart_name: name,
90
+ refresh: 1,
91
+ });
92
+ if (seq !== fetchSeq.current) return;
93
+ setSeries(res.payload.message);
94
+ } catch (err) {
95
+ if (seq !== fetchSeq.current) return;
96
+ setError(err instanceof Error ? err : new Error(String(err)));
97
+ } finally {
98
+ if (seq === fetchSeq.current) setIsLoading(false);
99
+ }
100
+ }, []);
101
+
102
+ useEffect(() => {
103
+ if (!chartName || unsupported) {
104
+ setIsLoading(false);
105
+ return;
106
+ }
107
+ void runFetch(chartName);
108
+ }, [chartName, unsupported, runFetch, config?.baseURL]);
109
+
110
+ const refresh = useCallback(() => {
111
+ if (chartName) void runFetch(chartName);
112
+ }, [chartName, runFetch]);
113
+
114
+ return { series, isLoading, error, unsupported, refresh };
115
+ }
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Single-doc fetch for the workspace page.
3
+ *
4
+ * A Workspace doc is read-mostly chrome (its child tables define the page
5
+ * layout), so a plain REST `getDoc` through the frappe client is a better
6
+ * fit than spinning up a live collection for one document. Honors the
7
+ * FrappeProvider's fixture provider so stories/tests run offline.
8
+ */
9
+ import { DbModule, HttpClient, type AuthConfig } from "@multiplatform.one/frappe";
10
+ import { useFrappeConfig, type FrappeConfig } from "@multiplatform.one/frappe-ui";
11
+ import { useCallback, useEffect, useRef, useState } from "react";
12
+ import type { WorkspaceDoc } from "./types";
13
+
14
+ // One REST client per connection — screens sharing a bench share it.
15
+ const dbCache = new Map<string, DbModule>();
16
+
17
+ function getDb(config: FrappeConfig): DbModule {
18
+ const key = `${config.baseURL}:${config.auth?.token ?? ""}:${config.auth?.type ?? ""}`;
19
+ let db = dbCache.get(key);
20
+ if (!db) {
21
+ const authConfig: AuthConfig | undefined = config.auth
22
+ ? {
23
+ useToken: config.auth.useToken,
24
+ token: config.auth.token,
25
+ type: config.auth.type as AuthConfig["type"],
26
+ }
27
+ : undefined;
28
+ db = new DbModule(new HttpClient(config.baseURL, authConfig));
29
+ dbCache.set(key, db);
30
+ }
31
+ return db;
32
+ }
33
+
34
+ export interface UseFrappeDocResult<TDoc> {
35
+ doc: TDoc | undefined;
36
+ /** First load in flight — render a skeleton. */
37
+ isLoading: boolean;
38
+ error: Error | undefined;
39
+ /** True when the server rejected the read (HTTP 403). */
40
+ isPermissionError: boolean;
41
+ refresh: () => void;
42
+ }
43
+
44
+ /** Fetch one document via REST (or the provider's fixtures when present). */
45
+ export function useFrappeDoc<TDoc extends { name: string; doctype: string }>(
46
+ doctype: string,
47
+ name: string | undefined,
48
+ ): UseFrappeDocResult<TDoc> {
49
+ const config = useFrappeConfig();
50
+ const [doc, setDoc] = useState<TDoc | undefined>(undefined);
51
+ const [isLoading, setIsLoading] = useState(!!name);
52
+ const [error, setError] = useState<Error | undefined>(undefined);
53
+ const fetchSeq = useRef(0);
54
+
55
+ const configRef = useRef(config);
56
+ configRef.current = config;
57
+
58
+ const runFetch = useCallback(
59
+ async (docName: string) => {
60
+ const conn = configRef.current;
61
+ const seq = ++fetchSeq.current;
62
+ setIsLoading(true);
63
+ setError(undefined);
64
+ try {
65
+ let result: TDoc | undefined;
66
+ if (conn?.fixtures) {
67
+ const fixtureDoc = await conn.fixtures.getDoc(doctype, docName);
68
+ if (!fixtureDoc) throw new Error(`${doctype} ${docName} not found`);
69
+ result = fixtureDoc as unknown as TDoc;
70
+ } else if (conn?.baseURL) {
71
+ result = (await getDb(conn).getDoc(doctype, docName)) as unknown as TDoc;
72
+ } else {
73
+ throw new Error("useFrappeDoc requires a FrappeProvider with baseURL or fixtures");
74
+ }
75
+ if (seq !== fetchSeq.current) return;
76
+ setDoc(result);
77
+ } catch (err) {
78
+ if (seq !== fetchSeq.current) return;
79
+ setDoc(undefined);
80
+ setError(err instanceof Error ? err : new Error(String(err)));
81
+ } finally {
82
+ if (seq === fetchSeq.current) setIsLoading(false);
83
+ }
84
+ // doctype is stable per hook usage; config flows through configRef.
85
+ // eslint-disable-next-line react-hooks/exhaustive-deps
86
+ },
87
+ [doctype],
88
+ );
89
+
90
+ useEffect(() => {
91
+ if (!name) {
92
+ setDoc(undefined);
93
+ setIsLoading(false);
94
+ return;
95
+ }
96
+ void runFetch(name);
97
+ }, [name, runFetch, config?.baseURL, config?.fixtures]);
98
+
99
+ const refresh = useCallback(() => {
100
+ if (name) void runFetch(name);
101
+ }, [name, runFetch]);
102
+
103
+ const isPermissionError = (error as { status?: number } | undefined)?.status === 403;
104
+
105
+ return { doc, isLoading, error, isPermissionError, refresh };
106
+ }
107
+
108
+ /** Fetch a Workspace doc by proper-cased name (e.g. "Home", "Users"). */
109
+ export function useWorkspaceDoc(workspace: string): UseFrappeDocResult<WorkspaceDoc> {
110
+ return useFrappeDoc<WorkspaceDoc>("Workspace", workspace);
111
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"CommandPalette.d.ts","sourceRoot":"","sources":["../../src/chrome/CommandPalette.tsx"],"names":[],"mappings":"AAwDA,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC;AAED,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,mBAAmB,2CAyPzE"}
1
+ {"version":3,"file":"CommandPalette.d.ts","sourceRoot":"","sources":["../../src/chrome/CommandPalette.tsx"],"names":[],"mappings":"AAwDA,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC;AAED,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,mBAAmB,2CA6QzE"}
@@ -61,6 +61,25 @@ export declare const en: {
61
61
  readonly exitToSite: "← multiplatform.one";
62
62
  readonly logOut: "Log Out";
63
63
  };
64
+ readonly loading: "Loading";
65
+ readonly workspaceCardEmpty: "No links in this section";
66
+ readonly workspaceShortcutUnavailable: "Not available";
67
+ readonly workspaceQuickListViewAll: "View All";
68
+ readonly workspaceNumberCardError: "Couldn't load number card";
69
+ readonly workspaceNumberCardUnsupported: "This card type is only available in desk";
70
+ readonly workspaceChartFixture: "Chart data is only available on a live bench";
71
+ readonly workspaceChartError: "Couldn't load chart {{title}}";
72
+ readonly workspaceBrowseAll: "Browse all";
73
+ readonly workspaceBrowseAllCount_one: "{{count}} link";
74
+ readonly workspaceBrowseAllCount_other: "{{count}} links";
75
+ readonly workspaceFilterLinks: "Filter links...";
76
+ readonly workspaceFilterNoMatch: "No links match \"{{query}}\"";
77
+ readonly workspaceRecents: "Continue where you left off";
78
+ readonly workspacePermissionError: "You do not have permission to view {{workspace}}";
79
+ readonly workspaceError: "Couldn't load workspace {{workspace}}";
80
+ readonly workspaceEmpty: "This workspace is empty";
81
+ readonly workspaceEmptyDescription: "No blocks have been added to {{workspace}} yet";
82
+ readonly workspaceShortcuts: "Shortcuts";
64
83
  readonly help: {
65
84
  readonly label: "Help";
66
85
  readonly documentation: "Documentation";
@@ -1 +1 @@
1
- {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/i18n/en.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0EL,CAAC"}
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/i18n/en.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+FL,CAAC"}
package/types/index.d.ts CHANGED
@@ -52,4 +52,38 @@ export type { SessionUserInfo } from "./chrome/user-session";
52
52
  export { useBackofficeShortcuts } from "./chrome/shortcuts";
53
53
  export type { BackofficeShortcutHandlers } from "./chrome/shortcuts";
54
54
  export { useFrappeApp } from "./shared/useFrappeApp";
55
+ export type { FrappeFilter, FrappeFilters, SlugTarget } from "./shared/types";
56
+ export { useDoctypeMeta } from "./shared/useDoctypeMeta";
57
+ export type { DocFieldMeta, DocLinkMeta, DocPermissionRule, DoctypeMeta, DoctypeMetaBundle, } from "./shared/useDoctypeMeta";
58
+ export { invalidateDocinfo, useDocinfo } from "./shared/useDocinfo";
59
+ export type { DocInfo, DocInfoComment } from "./shared/useDocinfo";
60
+ export { useSlugTarget } from "./shared/useSlugTarget";
61
+ export { useUserRoles } from "./shared/useUserRoles";
62
+ export { useRecentVisit } from "./shared/useRecentVisit";
63
+ export type { RecentVisit } from "./shared/useRecentVisit";
64
+ export { useSessionUserId } from "./shared/useSessionUserId";
65
+ export type { FrappeFilterTuple, WorkspaceBlock, WorkspaceBlockType, WorkspaceChartRow, WorkspaceLinkGroup, WorkspaceLinkRow, WorkspaceNumberCardRow, WorkspaceDoc as WorkspacePageDoc, WorkspaceQuickListRow, WorkspaceShortcutRow, } from "./workspace/types";
66
+ export { composeWorkspaceBlocks, findLinkGroup, findShortcut, groupLinks, headerLevel, parseFrappeFilters, parseWorkspaceContent, stripHtml, } from "./workspace/parseContent";
67
+ export type { WorkspaceComposition } from "./workspace/parseContent";
68
+ export { useFrappeDoc, useWorkspaceDoc } from "./workspace/useWorkspaceDoc";
69
+ export type { UseFrappeDocResult } from "./workspace/useWorkspaceDoc";
70
+ export { useDashboardChartData } from "./workspace/useDashboardChart";
71
+ export type { DashboardChartDoc, DashboardChartSeries, UseDashboardChartDataResult, } from "./workspace/useDashboardChart";
72
+ export { WorkspaceGrid } from "./workspace/WorkspaceGrid";
73
+ export type { WorkspaceGridItem, WorkspaceGridProps } from "./workspace/WorkspaceGrid";
74
+ export { WorkspaceLinkCard, resolveLinkTarget } from "./workspace/WorkspaceLinkCard";
75
+ export type { WorkspaceLinkCardProps } from "./workspace/WorkspaceLinkCard";
76
+ export { WorkspaceShortcut, resolveShortcutTarget } from "./workspace/WorkspaceShortcut";
77
+ export type { WorkspaceShortcutProps } from "./workspace/WorkspaceShortcut";
78
+ export { WorkspaceQuickList } from "./workspace/WorkspaceQuickList";
79
+ export type { WorkspaceQuickListProps } from "./workspace/WorkspaceQuickList";
80
+ export { WorkspaceNumberCard } from "./workspace/WorkspaceNumberCard";
81
+ export type { NumberCardDoc, WorkspaceNumberCardProps } from "./workspace/WorkspaceNumberCard";
82
+ export { WorkspaceChartBlock } from "./workspace/WorkspaceChartBlock";
83
+ export type { WorkspaceChartBlockProps } from "./workspace/WorkspaceChartBlock";
84
+ export { WorkspaceLinkDirectory, filterLinkGroup } from "./workspace/WorkspaceLinkDirectory";
85
+ export type { WorkspaceLinkDirectoryItem, WorkspaceLinkDirectoryProps, } from "./workspace/WorkspaceLinkDirectory";
86
+ export { WorkspaceRecents } from "./workspace/WorkspaceRecents";
87
+ export { WorkspaceScreen } from "./workspace/WorkspaceScreen";
88
+ export type { WorkspaceBlockKind, WorkspaceScreenProps } from "./workspace/WorkspaceScreen";
55
89
  //# sourceMappingURL=index.d.ts.map