@webiny/app-admin 6.6.0-alpha.0 → 6.6.0-alpha.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 (293) hide show
  1. package/base/Admin.js +17 -2
  2. package/base/Admin.js.map +1 -1
  3. package/base/Base/DefaultFieldRenderers.js +17 -2
  4. package/base/Base/DefaultFieldRenderers.js.map +1 -1
  5. package/base/Base/FieldRenderers/AutoCompleteRenderer.d.ts +13 -0
  6. package/base/Base/FieldRenderers/AutoCompleteRenderer.js +29 -0
  7. package/base/Base/FieldRenderers/AutoCompleteRenderer.js.map +1 -0
  8. package/base/Base/FieldRenderers/HorizontalTabsRenderer.d.ts +2 -2
  9. package/base/Base/FieldRenderers/LexicalRenderer.js +10 -6
  10. package/base/Base/FieldRenderers/LexicalRenderer.js.map +1 -1
  11. package/base/Base/FieldRenderers/MultiFilePickerRenderer.js +8 -5
  12. package/base/Base/FieldRenderers/MultiFilePickerRenderer.js.map +1 -1
  13. package/base/Base/FieldRenderers/MultiSelectRenderer.d.ts +15 -0
  14. package/base/Base/FieldRenderers/MultiSelectRenderer.js +31 -0
  15. package/base/Base/FieldRenderers/MultiSelectRenderer.js.map +1 -0
  16. package/base/Base/FieldRenderers/ObjectRenderer/DynamicZoneRenderer.d.ts +2 -0
  17. package/base/Base/FieldRenderers/ObjectRenderer/DynamicZoneRenderer.js +5 -2
  18. package/base/Base/FieldRenderers/ObjectRenderer/DynamicZoneRenderer.js.map +1 -1
  19. package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/MultiValueDynamicZone.d.ts +11 -0
  20. package/base/Base/FieldRenderers/ObjectRenderer/{MultiValueDynamicZone.js → MultiValueDynamicZone/MultiValueDynamicZone.js} +65 -14
  21. package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/MultiValueDynamicZone.js.map +1 -0
  22. package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/MultiValueDynamicZonePresenter.d.ts +13 -0
  23. package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/MultiValueDynamicZonePresenter.js +28 -0
  24. package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/MultiValueDynamicZonePresenter.js.map +1 -0
  25. package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/abstractions.d.ts +15 -0
  26. package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/abstractions.js +5 -0
  27. package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/abstractions.js.map +1 -0
  28. package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/feature.d.ts +1 -0
  29. package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/feature.js +11 -0
  30. package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/feature.js.map +1 -0
  31. package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/index.d.ts +2 -0
  32. package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/index.js +2 -0
  33. package/base/Base/FieldRenderers/ObjectRenderer/ObjectAccordionMultipleRenderer.d.ts +1 -1
  34. package/base/Base/FieldRenderers/ObjectRenderer/ObjectAccordionMultipleRenderer.js +19 -3
  35. package/base/Base/FieldRenderers/ObjectRenderer/ObjectAccordionMultipleRenderer.js.map +1 -1
  36. package/base/Base/FieldRenderers/ObjectRenderer/ObjectFieldComponents.d.ts +10 -8
  37. package/base/Base/FieldRenderers/ObjectRenderer/ObjectFieldComponents.js +34 -3
  38. package/base/Base/FieldRenderers/ObjectRenderer/ObjectFieldComponents.js.map +1 -1
  39. package/base/Base/FieldRenderers/ObjectRenderer/SingleValueDynamicZone.d.ts +3 -2
  40. package/base/Base/FieldRenderers/ObjectRenderer/SingleValueDynamicZone.js +11 -5
  41. package/base/Base/FieldRenderers/ObjectRenderer/SingleValueDynamicZone.js.map +1 -1
  42. package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker.js +1 -1
  43. package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker.js.map +1 -1
  44. package/base/Base/FieldRenderers/SelectRenderer.d.ts +6 -0
  45. package/base/Base/FieldRenderers/SelectRenderer.js.map +1 -1
  46. package/base/Base/FieldRenderers/VerticalTabsRenderer.d.ts +2 -2
  47. package/base/Base/Menus.js +4 -4
  48. package/base/Base/Menus.js.map +1 -1
  49. package/base/createRootContainer.js +4 -2
  50. package/base/createRootContainer.js.map +1 -1
  51. package/components/Drawers/DrawerParamsContext.d.ts +6 -0
  52. package/components/Drawers/DrawerParamsContext.js +10 -0
  53. package/components/Drawers/DrawerParamsContext.js.map +1 -0
  54. package/components/Drawers/DrawersContext.d.ts +13 -0
  55. package/components/Drawers/DrawersContext.js +50 -0
  56. package/components/Drawers/DrawersContext.js.map +1 -0
  57. package/components/Drawers/useDrawers.d.ts +2 -0
  58. package/components/Drawers/useDrawers.js +10 -0
  59. package/components/Drawers/useDrawers.js.map +1 -0
  60. package/components/Filters/Filters.js +4 -3
  61. package/components/Filters/Filters.js.map +1 -1
  62. package/components/IconPicker/IconPickerComponent.d.ts +2 -2
  63. package/components/LexicalEditor/LexicalLinkForm.js +3 -0
  64. package/components/LexicalEditor/LexicalLinkForm.js.map +1 -1
  65. package/components/ListView/ListViewBulkActions.d.ts +2 -2
  66. package/components/ListView/ListViewContent.d.ts +2 -2
  67. package/components/ListView/ListViewFilters.d.ts +2 -2
  68. package/components/ListView/index.d.ts +6 -6
  69. package/components/OverlayLayout/OverlayLayout.js +4 -2
  70. package/components/OverlayLayout/OverlayLayout.js.map +1 -1
  71. package/components/OverlayLayout/components/OverlayContent.js +1 -0
  72. package/components/OverlayLayout/components/OverlayContent.js.map +1 -1
  73. package/components/RolesMultiAutocomplete/index.d.ts +4 -2
  74. package/components/SplitView/SplitView.js +1 -1
  75. package/components/SplitView/SplitView.js.map +1 -1
  76. package/components/Table/components/Table/TableInner.d.ts +2 -2
  77. package/components/TeamAutocomplete/index.d.ts +4 -2
  78. package/components/TeamsMultiAutocomplete/index.d.ts +4 -2
  79. package/components/index.d.ts +0 -1
  80. package/components/index.js +0 -1
  81. package/config/AdminConfig/Breadcrumbs.d.ts +42 -0
  82. package/config/AdminConfig/Breadcrumbs.js +24 -0
  83. package/config/AdminConfig/Breadcrumbs.js.map +1 -0
  84. package/config/AdminConfig/Drawer.d.ts +10 -0
  85. package/config/AdminConfig/Drawer.js +19 -0
  86. package/config/AdminConfig/Drawer.js.map +1 -0
  87. package/config/AdminConfig/LexicalTheme/AllowCustomColors.d.ts +5 -0
  88. package/config/AdminConfig/LexicalTheme/AllowCustomColors.js +18 -0
  89. package/config/AdminConfig/LexicalTheme/AllowCustomColors.js.map +1 -0
  90. package/config/AdminConfig/LexicalTheme.d.ts +2 -0
  91. package/config/AdminConfig/LexicalTheme.js +2 -0
  92. package/config/AdminConfig/LexicalTheme.js.map +1 -1
  93. package/config/AdminConfig.d.ts +8 -0
  94. package/config/AdminConfig.js +8 -1
  95. package/config/AdminConfig.js.map +1 -1
  96. package/exports/admin.d.ts +3 -0
  97. package/exports/admin.js +3 -0
  98. package/features/accessManagement/types.d.ts +3 -3
  99. package/features/aiChat/AiChatGateway.d.ts +30 -0
  100. package/features/aiChat/AiChatGateway.js +41 -0
  101. package/features/aiChat/AiChatGateway.js.map +1 -0
  102. package/features/aiChat/AiChatPresenter.d.ts +32 -0
  103. package/features/aiChat/AiChatPresenter.js +220 -0
  104. package/features/aiChat/AiChatPresenter.js.map +1 -0
  105. package/features/aiChat/abstractions.d.ts +124 -0
  106. package/features/aiChat/abstractions.js +6 -0
  107. package/features/aiChat/abstractions.js.map +1 -0
  108. package/features/aiChat/feature.d.ts +3 -0
  109. package/features/aiChat/feature.js +19 -0
  110. package/features/aiChat/feature.js.map +1 -0
  111. package/features/aiChat/index.d.ts +6 -0
  112. package/features/aiChat/index.js +3 -0
  113. package/features/dateFormatter/DefaultDateFormatter.d.ts +8 -0
  114. package/features/dateFormatter/DefaultDateFormatter.js +25 -0
  115. package/features/dateFormatter/DefaultDateFormatter.js.map +1 -0
  116. package/features/dateFormatter/abstractions.d.ts +13 -0
  117. package/features/dateFormatter/abstractions.js +5 -0
  118. package/features/dateFormatter/abstractions.js.map +1 -0
  119. package/features/dateFormatter/feature.d.ts +3 -0
  120. package/features/dateFormatter/feature.js +17 -0
  121. package/features/dateFormatter/feature.js.map +1 -0
  122. package/features/dateFormatter/index.d.ts +4 -0
  123. package/features/dateFormatter/index.js +4 -0
  124. package/features/dateFormatter/useDateFormatter.d.ts +5 -0
  125. package/features/dateFormatter/useDateFormatter.js +8 -0
  126. package/features/dateFormatter/useDateFormatter.js.map +1 -0
  127. package/features/featureFlags/FeatureFlagsGateway.d.ts +10 -0
  128. package/features/featureFlags/FeatureFlagsGateway.js +40 -0
  129. package/features/featureFlags/FeatureFlagsGateway.js.map +1 -0
  130. package/features/featureFlags/FeatureFlagsService.d.ts +16 -0
  131. package/features/featureFlags/FeatureFlagsService.js +64 -0
  132. package/features/featureFlags/FeatureFlagsService.js.map +1 -0
  133. package/features/featureFlags/abstractions.d.ts +19 -0
  134. package/features/featureFlags/abstractions.js +6 -0
  135. package/features/featureFlags/abstractions.js.map +1 -0
  136. package/features/featureFlags/feature.d.ts +3 -0
  137. package/features/featureFlags/feature.js +19 -0
  138. package/features/featureFlags/feature.js.map +1 -0
  139. package/features/formModel/Field.js +10 -0
  140. package/features/formModel/Field.js.map +1 -1
  141. package/features/formModel/FieldBuilder.js +1 -1
  142. package/features/formModel/FieldBuilder.js.map +1 -1
  143. package/features/formModel/FieldBuilder.test.js +4 -4
  144. package/features/formModel/FieldBuilder.test.js.map +1 -1
  145. package/features/formModel/FormErrors.d.ts +2 -2
  146. package/features/formModel/FormModel.test.js +50 -0
  147. package/features/formModel/FormModel.test.js.map +1 -1
  148. package/features/formModel/FormView.d.ts +8 -4
  149. package/features/formModel/PresenterErrors.d.ts +2 -2
  150. package/features/formModel/demo/FormModelDemo.d.ts +2 -2
  151. package/features/formModel/renderers.d.ts +1 -0
  152. package/features/formModel/renderers.js +1 -0
  153. package/features/notifications/NotificationsRenderer.d.ts +2 -2
  154. package/features/security/AuthenticationContext/ApiStreamClientDecorator.d.ts +22 -0
  155. package/features/security/AuthenticationContext/ApiStreamClientDecorator.js +32 -0
  156. package/features/security/AuthenticationContext/ApiStreamClientDecorator.js.map +1 -0
  157. package/features/security/AuthenticationContext/feature.js +2 -0
  158. package/features/security/AuthenticationContext/feature.js.map +1 -1
  159. package/features/slugify/DefaultSlugify.d.ts +8 -0
  160. package/features/slugify/DefaultSlugify.js +20 -0
  161. package/features/slugify/DefaultSlugify.js.map +1 -0
  162. package/features/slugify/abstractions.d.ts +12 -0
  163. package/features/slugify/abstractions.js +5 -0
  164. package/features/slugify/abstractions.js.map +1 -0
  165. package/features/slugify/feature.d.ts +1 -0
  166. package/features/slugify/feature.js +11 -0
  167. package/features/slugify/feature.js.map +1 -0
  168. package/features/slugify/index.d.ts +3 -0
  169. package/features/slugify/index.js +3 -0
  170. package/features/stringFormatter/DefaultStringFormatter.d.ts +17 -0
  171. package/features/stringFormatter/DefaultStringFormatter.js +19 -0
  172. package/features/stringFormatter/DefaultStringFormatter.js.map +1 -0
  173. package/features/stringFormatter/abstractions.d.ts +11 -0
  174. package/features/stringFormatter/abstractions.js +5 -0
  175. package/features/stringFormatter/abstractions.js.map +1 -0
  176. package/features/stringFormatter/feature.d.ts +3 -0
  177. package/features/stringFormatter/feature.js +19 -0
  178. package/features/stringFormatter/feature.js.map +1 -0
  179. package/features/stringFormatter/index.d.ts +4 -0
  180. package/features/stringFormatter/index.js +4 -0
  181. package/features/stringFormatter/useStringFormatter.d.ts +5 -0
  182. package/features/stringFormatter/useStringFormatter.js +8 -0
  183. package/features/stringFormatter/useStringFormatter.js.map +1 -0
  184. package/features/tenancy/ApiStreamClientDecorator.d.ts +16 -0
  185. package/features/tenancy/ApiStreamClientDecorator.js +30 -0
  186. package/features/tenancy/ApiStreamClientDecorator.js.map +1 -0
  187. package/features/tenancy/feature.js +2 -0
  188. package/features/tenancy/feature.js.map +1 -1
  189. package/features/wcp/ReactLicense.d.ts +6 -0
  190. package/features/wcp/ReactLicense.js +18 -0
  191. package/features/wcp/ReactLicense.js.map +1 -1
  192. package/features/wcp/WcpGateway.js +3 -0
  193. package/features/wcp/WcpGateway.js.map +1 -1
  194. package/hooks/index.d.ts +3 -0
  195. package/hooks/index.js +3 -0
  196. package/hooks/useDrawer.d.ts +9 -0
  197. package/hooks/useDrawer.js +19 -0
  198. package/hooks/useDrawer.js.map +1 -0
  199. package/hooks/useHotkeys.js +5 -3
  200. package/hooks/useHotkeys.js.map +1 -1
  201. package/hooks/useOpenDrawer.d.ts +7 -0
  202. package/hooks/useOpenDrawer.js +18 -0
  203. package/hooks/useOpenDrawer.js.map +1 -0
  204. package/hooks/useSnackbar.js.map +1 -1
  205. package/index.d.ts +18 -1
  206. package/index.js +23 -12
  207. package/modules/AccessManagementExtension.js +46 -22
  208. package/modules/AccessManagementExtension.js.map +1 -1
  209. package/package.json +31 -28
  210. package/presentation/accessManagement/SecurityPermissions.js +3 -3
  211. package/presentation/accessManagement/SecurityPermissions.js.map +1 -1
  212. package/presentation/accessManagement/apiKeys/ApiKeysPresenter.d.ts +3 -1
  213. package/presentation/accessManagement/apiKeys/ApiKeysPresenter.js +13 -16
  214. package/presentation/accessManagement/apiKeys/ApiKeysPresenter.js.map +1 -1
  215. package/presentation/accessManagement/apiKeys/components/ApiKeysView.d.ts +2 -2
  216. package/presentation/accessManagement/apiKeys/components/ApiKeysView.js +13 -7
  217. package/presentation/accessManagement/apiKeys/components/ApiKeysView.js.map +1 -1
  218. package/presentation/accessManagement/roles/RolesPresenter.d.ts +3 -1
  219. package/presentation/accessManagement/roles/RolesPresenter.js +11 -14
  220. package/presentation/accessManagement/roles/RolesPresenter.js.map +1 -1
  221. package/presentation/accessManagement/roles/components/RolesView.d.ts +2 -2
  222. package/presentation/accessManagement/roles/components/RolesView.js +10 -6
  223. package/presentation/accessManagement/roles/components/RolesView.js.map +1 -1
  224. package/presentation/accessManagement/teams/TeamsPresenter.d.ts +3 -1
  225. package/presentation/accessManagement/teams/TeamsPresenter.js +11 -14
  226. package/presentation/accessManagement/teams/TeamsPresenter.js.map +1 -1
  227. package/presentation/accessManagement/teams/components/TeamsView.d.ts +2 -2
  228. package/presentation/accessManagement/teams/components/TeamsView.js +10 -6
  229. package/presentation/accessManagement/teams/components/TeamsView.js.map +1 -1
  230. package/presentation/commandPalette/CommandPalettePresenter.d.ts +21 -0
  231. package/presentation/commandPalette/CommandPalettePresenter.js +91 -0
  232. package/presentation/commandPalette/CommandPalettePresenter.js.map +1 -0
  233. package/presentation/commandPalette/abstractions.d.ts +76 -0
  234. package/presentation/commandPalette/abstractions.js +7 -0
  235. package/presentation/commandPalette/abstractions.js.map +1 -0
  236. package/presentation/commandPalette/commands/AskAiCommand.d.ts +25 -0
  237. package/presentation/commandPalette/commands/AskAiCommand.js +33 -0
  238. package/presentation/commandPalette/commands/AskAiCommand.js.map +1 -0
  239. package/presentation/commandPalette/commands/CopyCurrentUrlCommand.d.ts +15 -0
  240. package/presentation/commandPalette/commands/CopyCurrentUrlCommand.js +33 -0
  241. package/presentation/commandPalette/commands/CopyCurrentUrlCommand.js.map +1 -0
  242. package/presentation/commandPalette/commands/SendMessageCommand.d.ts +23 -0
  243. package/presentation/commandPalette/commands/SendMessageCommand.js +66 -0
  244. package/presentation/commandPalette/commands/SendMessageCommand.js.map +1 -0
  245. package/presentation/commandPalette/commands/SignOutCommand.d.ts +18 -0
  246. package/presentation/commandPalette/commands/SignOutCommand.js +37 -0
  247. package/presentation/commandPalette/commands/SignOutCommand.js.map +1 -0
  248. package/presentation/commandPalette/commands/feature.d.ts +5 -0
  249. package/presentation/commandPalette/commands/feature.js +17 -0
  250. package/presentation/commandPalette/commands/feature.js.map +1 -0
  251. package/presentation/commandPalette/feature.d.ts +3 -0
  252. package/presentation/commandPalette/feature.js +17 -0
  253. package/presentation/commandPalette/feature.js.map +1 -0
  254. package/presentation/commandPalette/index.d.ts +3 -0
  255. package/presentation/commandPalette/index.js +2 -0
  256. package/presentation/featureFlags/FeatureFlagsProvider.d.ts +7 -0
  257. package/presentation/featureFlags/FeatureFlagsProvider.js +22 -0
  258. package/presentation/featureFlags/FeatureFlagsProvider.js.map +1 -0
  259. package/presentation/featureFlags/useFeatureFlags.d.ts +2 -0
  260. package/presentation/featureFlags/useFeatureFlags.js +17 -0
  261. package/presentation/featureFlags/useFeatureFlags.js.map +1 -0
  262. package/presentation/installation/components/SystemInstaller/SystemInstaller.d.ts +2 -2
  263. package/presentation/installation/components/SystemInstaller/steps/FinishSetup/handleStartUsing.js +0 -3
  264. package/presentation/installation/components/SystemInstaller/steps/FinishSetup/handleStartUsing.js.map +1 -1
  265. package/presentation/listPresenter/FolderAwareDataSource.js +4 -1
  266. package/presentation/listPresenter/FolderAwareDataSource.js.map +1 -1
  267. package/presentation/listPresenter/QueryMatcher.js +2 -2
  268. package/presentation/listPresenter/QueryMatcher.js.map +1 -1
  269. package/presentation/sortable/SortablePresenter.d.ts +23 -0
  270. package/presentation/sortable/SortablePresenter.js +175 -0
  271. package/presentation/sortable/SortablePresenter.js.map +1 -0
  272. package/presentation/sortable/abstractions.d.ts +24 -0
  273. package/presentation/sortable/abstractions.js +5 -0
  274. package/presentation/sortable/abstractions.js.map +1 -0
  275. package/presentation/sortable/feature.d.ts +1 -0
  276. package/presentation/sortable/feature.js +11 -0
  277. package/presentation/sortable/feature.js.map +1 -0
  278. package/presentation/sortable/index.d.ts +2 -0
  279. package/presentation/sortable/index.js +2 -0
  280. package/presentation/trashBin/components/BulkActions/DeleteItems.d.ts +2 -2
  281. package/presentation/trashBin/components/BulkActions/RestoreItems.d.ts +2 -2
  282. package/presentation/trashBin/components/TrashBinOverlay.d.ts +2 -2
  283. package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone.d.ts +0 -10
  284. package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone.js.map +0 -1
  285. package/base/Base/Menus/WebinyVersion.d.ts +0 -2
  286. package/base/Base/Menus/WebinyVersion.js +0 -23
  287. package/base/Base/Menus/WebinyVersion.js.map +0 -1
  288. package/base/WebinyVersion.d.ts +0 -2
  289. package/base/WebinyVersion.js +0 -23
  290. package/base/WebinyVersion.js.map +0 -1
  291. package/components/Wcp.d.ts +0 -19
  292. package/components/Wcp.js +0 -37
  293. package/components/Wcp.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/aiChat/AiChatPresenter.js","sources":["../../../src/features/aiChat/AiChatPresenter.ts"],"sourcesContent":["import { makeAutoObservable } from \"mobx\";\nimport { AiChatGateway } from \"./abstractions.js\";\nimport type { AiChatMessage, AiChatRequest } from \"./abstractions.js\";\nimport {\n AiChatPresenter as Abstraction,\n type AiTurnViewModel,\n type IAiChatViewModel\n} from \"./abstractions.js\";\n\n/** A turn plus the conversation state the view never sees. */\ninterface Turn extends AiTurnViewModel {\n /** Server messages replayed to continue this conversation or resume its approval. */\n messages: AiChatMessage[];\n}\n\nconst emptyTurn = (question: string): Turn => ({\n question,\n text: \"\",\n tools: [],\n completed: [],\n failed: [],\n running: false,\n pendingApprovals: [],\n messages: [],\n settled: false\n});\n\n/**\n * Owns the palette's AI conversation.\n *\n * A presenter rather than component state: several pieces change together, a network stream drives\n * them, and an abort has to outlive any one render.\n *\n * Registered as a singleton, so `reset` genuinely clears rather than relying on unmount.\n */\nclass AiChatPresenterImpl implements Abstraction.Interface {\n private turns: Turn[] = [];\n private busy = false;\n private controller: AbortController | null = null;\n\n constructor(private gateway: AiChatGateway.Interface) {\n // The controller is machinery, not state anything renders, so keep it out of the map.\n makeAutoObservable<AiChatPresenterImpl, \"controller\">(this, { controller: false });\n }\n\n get vm(): IAiChatViewModel {\n return {\n busy: this.busy,\n turns: this.turns.map(turn => ({\n question: turn.question,\n text: turn.text,\n tools: turn.tools,\n completed: turn.completed,\n failed: turn.failed,\n running: turn.running,\n pendingApprovals: turn.pendingApprovals,\n settled: turn.settled,\n ...(turn.error === undefined ? {} : { error: turn.error })\n }))\n };\n }\n\n ask(question: string): void {\n const trimmed = question.trim();\n\n if (!trimmed || this.busy) {\n return;\n }\n\n const index = this.turns.length;\n this.addTurn(trimmed);\n\n void this.run(index, {\n messages: [...this.historyBefore(index), { role: \"user\", content: trimmed }]\n });\n }\n\n decide(turnIndex: number, approved: boolean): void {\n const turn = this.turns[turnIndex];\n\n if (!turn?.pendingApprovals.length || this.busy) {\n return;\n }\n\n const approvals = turn.pendingApprovals.map(approval => ({\n approvalId: approval.approvalId,\n approved\n }));\n\n /*\n * The paused assistant message must be replayed unchanged: the approval request lives only in\n * the server's messages, so resuming means sending the same history back plus the decision.\n */\n const messages: AiChatMessage[] = [\n ...this.historyBefore(turnIndex),\n { role: \"user\", content: turn.question },\n ...turn.messages\n ];\n\n // Clear the block immediately so the plan cannot be submitted twice.\n this.patch(turnIndex, { pendingApprovals: [], settled: false, running: true });\n\n void this.run(turnIndex, { messages, approvals }, true);\n }\n\n reset(): void {\n this.controller?.abort();\n this.controller = null;\n this.clear();\n }\n\n /** Replays settled turns so a follow-up (\"and which of those is cheapest?\") has context. */\n private historyBefore(upTo: number): AiChatMessage[] {\n const history: AiChatMessage[] = [];\n\n for (const turn of this.turns.slice(0, upTo)) {\n if (!turn.settled || turn.error) {\n continue;\n }\n history.push({ role: \"user\", content: turn.question });\n history.push(...turn.messages);\n }\n\n return history;\n }\n\n private async run(index: number, request: AiChatRequest, resuming = false): Promise<void> {\n this.controller?.abort();\n const controller = new AbortController();\n this.controller = controller;\n\n this.setBusy(true);\n\n try {\n /*\n * Resuming continues the same turn: the tools already called, the text already shown and\n * the messages already collected all still belong to it. Starting from empty would strand\n * earlier chips as running and, worse, drop the assistant message carrying the `tool_use`\n * that the replayed `tool_result` refers to.\n */\n const existing = resuming ? this.turns[index] : undefined;\n let text = existing?.text ?? \"\";\n const tools: string[] = existing ? [...existing.tools] : [];\n const completed: string[] = existing ? [...existing.completed] : [];\n const failed: string[] = existing ? [...existing.failed] : [];\n const priorMessages: AiChatMessage[] = existing ? [...existing.messages] : [];\n\n for await (const event of this.gateway.stream(request, controller.signal)) {\n if (event.type === \"text\") {\n text += event.text;\n this.patch(index, { text, running: false });\n continue;\n }\n\n if (event.type === \"tool-call\") {\n tools.push(event.name);\n this.patch(index, { tools: [...tools], running: true });\n continue;\n }\n\n if (event.type === \"tool-result\") {\n completed.push(event.name);\n this.patch(index, { completed: [...completed] });\n continue;\n }\n\n if (event.type === \"tool-error\") {\n failed.push(event.name);\n this.patch(index, { failed: [...failed] });\n continue;\n }\n\n if (event.type === \"approval\") {\n this.patch(index, { pendingApprovals: event.approvals, running: false });\n continue;\n }\n\n if (event.type === \"done\") {\n this.patch(index, {\n messages: [...priorMessages, ...event.messages],\n settled: true,\n running: false\n });\n continue;\n }\n\n if (event.type === \"error\") {\n this.patch(index, { error: event.message, settled: true, running: false });\n return;\n }\n }\n } catch (error) {\n // An abort is the palette closing, not a failure worth showing.\n if (!controller.signal.aborted) {\n this.patch(index, {\n error: error instanceof Error ? error.message : String(error),\n settled: true,\n running: false\n });\n }\n } finally {\n this.setBusy(false);\n }\n }\n\n /*\n * Every mutation below is its own method on purpose. `run` awaits, and a mutation after an await\n * has escaped the action it started in; `makeAutoObservable` makes these methods actions, so\n * calling them from there is correct.\n */\n private addTurn(question: string): void {\n this.turns = [...this.turns, { ...emptyTurn(question), running: true }];\n }\n\n private patch(index: number, change: Partial<Turn>): void {\n this.turns = this.turns.map((turn, i) => (i === index ? { ...turn, ...change } : turn));\n }\n\n private setBusy(busy: boolean): void {\n this.busy = busy;\n }\n\n private clear(): void {\n this.turns = [];\n this.busy = false;\n }\n}\n\nexport const AiChatPresenter = Abstraction.createImplementation({\n implementation: AiChatPresenterImpl,\n dependencies: [AiChatGateway]\n});\n"],"names":["emptyTurn","question","AiChatPresenterImpl","gateway","makeAutoObservable","turn","undefined","trimmed","index","turnIndex","approved","approvals","approval","messages","upTo","history","request","resuming","controller","AbortController","existing","text","tools","completed","failed","priorMessages","event","error","Error","String","change","i","busy","AiChatPresenter","Abstraction","AiChatGateway"],"mappings":"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"}
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Messages are opaque here on purpose. Beyond plain user/assistant turns the server also returns
3
+ * assistant and tool messages carrying approval requests, which must be replayed VERBATIM for the
4
+ * agent loop to resume — the request exists nowhere else, since the server keeps no session.
5
+ */
6
+ export type AiChatMessage = {
7
+ role: string;
8
+ content: unknown;
9
+ };
10
+ /** A tool the assistant invoked, so the UI can show its work rather than just an answer. */
11
+ export interface AiChatToolCall {
12
+ name: string;
13
+ input: unknown;
14
+ }
15
+ /** A tool call the assistant wants to make but has not made, because it changes something. */
16
+ export interface AiChatPendingApproval {
17
+ approvalId: string;
18
+ toolName: string;
19
+ title?: string;
20
+ input: unknown;
21
+ /** The tool declared itself destructive — the UI should say so more loudly. */
22
+ destructive: boolean;
23
+ }
24
+ export interface AiChatDecision {
25
+ approvalId: string;
26
+ approved: boolean;
27
+ reason?: string;
28
+ }
29
+ export interface AiChatRequest {
30
+ messages: AiChatMessage[];
31
+ /** Approve or reject calls the server paused on. */
32
+ approvals?: AiChatDecision[];
33
+ }
34
+ /**
35
+ * What the assistant emits while it works. Mirrors the server's `AiChatEvent`; declared here so the
36
+ * admin bundle carries no server or AI SDK code.
37
+ */
38
+ export type AiChatStreamEvent = {
39
+ type: "text";
40
+ text: string;
41
+ } | {
42
+ type: "tool-call";
43
+ name: string;
44
+ } | {
45
+ type: "tool-result";
46
+ name: string;
47
+ } | {
48
+ type: "tool-error";
49
+ name: string;
50
+ message: string;
51
+ } | {
52
+ type: "approval";
53
+ approvals: AiChatPendingApproval[];
54
+ } | {
55
+ type: "done";
56
+ messages: AiChatMessage[];
57
+ steps: number;
58
+ } | {
59
+ type: "error";
60
+ message: string;
61
+ };
62
+ export interface IAiChatGateway {
63
+ /**
64
+ * Run and yield progress as it arrives. Preferred in the UI: a multi-tool question takes tens of
65
+ * seconds, and an approval request is worth showing the moment it appears.
66
+ */
67
+ stream(request: AiChatRequest, signal?: AbortSignal): AsyncIterable<AiChatStreamEvent>;
68
+ }
69
+ /** Sends a question to the server-side AI assistant (`POST /ai/chat`). */
70
+ export declare const AiChatGateway: import("@webiny/di").Abstraction<IAiChatGateway>;
71
+ export declare namespace AiChatGateway {
72
+ type Interface = IAiChatGateway;
73
+ type Message = AiChatMessage;
74
+ type ToolCall = AiChatToolCall;
75
+ type PendingApproval = AiChatPendingApproval;
76
+ type Decision = AiChatDecision;
77
+ type Request = AiChatRequest;
78
+ type StreamEvent = AiChatStreamEvent;
79
+ }
80
+ /**
81
+ * One question and the answer to it, as the view needs it.
82
+ *
83
+ * The server messages that make a follow-up or a resumed approval work are deliberately absent: they
84
+ * are conversation state, not something rendered, so they stay inside the presenter.
85
+ */
86
+ export interface AiTurnViewModel {
87
+ question: string;
88
+ /** Answer text so far. Grows as the stream arrives. */
89
+ text: string;
90
+ /** Tools called this turn, in call order. */
91
+ tools: string[];
92
+ /**
93
+ * Tools that returned. A call pending approval still emits `tool-call`, so this is the only way
94
+ * to tell a completed tool from one merely proposed.
95
+ */
96
+ completed: string[];
97
+ /** Tools that threw. Settles the chip as a failure; the run continues. */
98
+ failed: string[];
99
+ /** Set while a tool is running and no answer text has arrived yet. */
100
+ running: boolean;
101
+ pendingApprovals: AiChatPendingApproval[];
102
+ settled: boolean;
103
+ error?: string;
104
+ }
105
+ export interface IAiChatViewModel {
106
+ turns: AiTurnViewModel[];
107
+ /** A run is in flight. Asking again or deciding again is refused while true. */
108
+ busy: boolean;
109
+ }
110
+ export interface IAiChatPresenter {
111
+ readonly vm: IAiChatViewModel;
112
+ /** Ask a question, carrying the settled turns before it as context. */
113
+ ask(question: string): void;
114
+ /** Approve or reject the calls a turn paused on, then resume it. */
115
+ decide(turnIndex: number, approved: boolean): void;
116
+ /** Drop the conversation and stop anything in flight. */
117
+ reset(): void;
118
+ }
119
+ export declare const AiChatPresenter: import("@webiny/di").Abstraction<IAiChatPresenter>;
120
+ export declare namespace AiChatPresenter {
121
+ type Interface = IAiChatPresenter;
122
+ type ViewModel = IAiChatViewModel;
123
+ type Turn = AiTurnViewModel;
124
+ }
@@ -0,0 +1,6 @@
1
+ import { createAbstraction } from "@webiny/feature/admin";
2
+ const AiChatGateway = createAbstraction("AiChatGateway");
3
+ const AiChatPresenter = createAbstraction("AiChatPresenter");
4
+ export { AiChatGateway, AiChatPresenter };
5
+
6
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/aiChat/abstractions.js","sources":["../../../src/features/aiChat/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\n\n/**\n * Messages are opaque here on purpose. Beyond plain user/assistant turns the server also returns\n * assistant and tool messages carrying approval requests, which must be replayed VERBATIM for the\n * agent loop to resume — the request exists nowhere else, since the server keeps no session.\n */\nexport type AiChatMessage = { role: string; content: unknown };\n\n/** A tool the assistant invoked, so the UI can show its work rather than just an answer. */\nexport interface AiChatToolCall {\n name: string;\n input: unknown;\n}\n\n/** A tool call the assistant wants to make but has not made, because it changes something. */\nexport interface AiChatPendingApproval {\n approvalId: string;\n toolName: string;\n title?: string;\n input: unknown;\n /** The tool declared itself destructive — the UI should say so more loudly. */\n destructive: boolean;\n}\n\nexport interface AiChatDecision {\n approvalId: string;\n approved: boolean;\n reason?: string;\n}\n\nexport interface AiChatRequest {\n messages: AiChatMessage[];\n /** Approve or reject calls the server paused on. */\n approvals?: AiChatDecision[];\n}\n\n/**\n * What the assistant emits while it works. Mirrors the server's `AiChatEvent`; declared here so the\n * admin bundle carries no server or AI SDK code.\n */\nexport type AiChatStreamEvent =\n | { type: \"text\"; text: string }\n | { type: \"tool-call\"; name: string }\n | { type: \"tool-result\"; name: string }\n // A tool threw. Pairs with `tool-call` by name, and does not end the run.\n | { type: \"tool-error\"; name: string; message: string }\n | { type: \"approval\"; approvals: AiChatPendingApproval[] }\n | { type: \"done\"; messages: AiChatMessage[]; steps: number }\n | { type: \"error\"; message: string };\n\nexport interface IAiChatGateway {\n /**\n * Run and yield progress as it arrives. Preferred in the UI: a multi-tool question takes tens of\n * seconds, and an approval request is worth showing the moment it appears.\n */\n stream(request: AiChatRequest, signal?: AbortSignal): AsyncIterable<AiChatStreamEvent>;\n}\n\n/** Sends a question to the server-side AI assistant (`POST /ai/chat`). */\nexport const AiChatGateway = createAbstraction<IAiChatGateway>(\"AiChatGateway\");\n\nexport namespace AiChatGateway {\n export type Interface = IAiChatGateway;\n export type Message = AiChatMessage;\n export type ToolCall = AiChatToolCall;\n export type PendingApproval = AiChatPendingApproval;\n export type Decision = AiChatDecision;\n export type Request = AiChatRequest;\n export type StreamEvent = AiChatStreamEvent;\n}\n\n/**\n * One question and the answer to it, as the view needs it.\n *\n * The server messages that make a follow-up or a resumed approval work are deliberately absent: they\n * are conversation state, not something rendered, so they stay inside the presenter.\n */\nexport interface AiTurnViewModel {\n question: string;\n /** Answer text so far. Grows as the stream arrives. */\n text: string;\n /** Tools called this turn, in call order. */\n tools: string[];\n /**\n * Tools that returned. A call pending approval still emits `tool-call`, so this is the only way\n * to tell a completed tool from one merely proposed.\n */\n completed: string[];\n /** Tools that threw. Settles the chip as a failure; the run continues. */\n failed: string[];\n /** Set while a tool is running and no answer text has arrived yet. */\n running: boolean;\n pendingApprovals: AiChatPendingApproval[];\n settled: boolean;\n error?: string;\n}\n\nexport interface IAiChatViewModel {\n turns: AiTurnViewModel[];\n /** A run is in flight. Asking again or deciding again is refused while true. */\n busy: boolean;\n}\n\nexport interface IAiChatPresenter {\n readonly vm: IAiChatViewModel;\n /** Ask a question, carrying the settled turns before it as context. */\n ask(question: string): void;\n /** Approve or reject the calls a turn paused on, then resume it. */\n decide(turnIndex: number, approved: boolean): void;\n /** Drop the conversation and stop anything in flight. */\n reset(): void;\n}\n\nexport const AiChatPresenter = createAbstraction<IAiChatPresenter>(\"AiChatPresenter\");\n\nexport namespace AiChatPresenter {\n export type Interface = IAiChatPresenter;\n export type ViewModel = IAiChatViewModel;\n export type Turn = AiTurnViewModel;\n}\n"],"names":["AiChatGateway","createAbstraction","AiChatPresenter"],"mappings":";AA4DO,MAAMA,gBAAgBC,kBAAkC;AAsDxD,MAAMC,kBAAkBD,kBAAoC"}
@@ -0,0 +1,3 @@
1
+ export declare const AiChatFeature: import("@webiny/feature/admin").FeatureDefinition<{
2
+ presenter: import("./abstractions.js").IAiChatPresenter;
3
+ }, []>;
@@ -0,0 +1,19 @@
1
+ import { createFeature } from "@webiny/feature/admin";
2
+ import { AiChatGateway } from "./AiChatGateway.js";
3
+ import { AiChatPresenter } from "./AiChatPresenter.js";
4
+ import { AiChatPresenter as external_abstractions_js_AiChatPresenter } from "./abstractions.js";
5
+ const AiChatFeature = createFeature({
6
+ name: "AiChat",
7
+ register (container) {
8
+ container.register(AiChatGateway);
9
+ container.register(AiChatPresenter).inSingletonScope();
10
+ },
11
+ resolve (container) {
12
+ return {
13
+ presenter: container.resolve(external_abstractions_js_AiChatPresenter)
14
+ };
15
+ }
16
+ });
17
+ export { AiChatFeature };
18
+
19
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/aiChat/feature.js","sources":["../../../src/features/aiChat/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { AiChatGateway } from \"./AiChatGateway.js\";\nimport { AiChatPresenter } from \"./AiChatPresenter.js\";\nimport { AiChatPresenter as Abstraction } from \"./abstractions.js\";\n\nexport const AiChatFeature = createFeature({\n name: \"AiChat\",\n register(container) {\n container.register(AiChatGateway);\n // Singleton so the conversation survives re-renders of the palette that reads it.\n container.register(AiChatPresenter).inSingletonScope();\n },\n resolve(container) {\n return { presenter: container.resolve(Abstraction) };\n }\n});\n"],"names":["AiChatFeature","createFeature","container","AiChatGateway","AiChatPresenter","Abstraction"],"mappings":";;;;AAKO,MAAMA,gBAAgBC,cAAc;IACvC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QAEnBD,UAAU,QAAQ,CAACE,iBAAiB,gBAAgB;IACxD;IACA,SAAQF,SAAS;QACb,OAAO;YAAE,WAAWA,UAAU,OAAO,CAACG;QAAa;IACvD;AACJ"}
@@ -0,0 +1,6 @@
1
+ export { AiChatGateway } from "./abstractions.js";
2
+ export type { IAiChatGateway, AiChatMessage, AiChatToolCall, AiChatPendingApproval, AiChatDecision, AiChatRequest, AiChatStreamEvent } from "./abstractions.js";
3
+ export { AiChatGateway as AiChatGatewayImplementation } from "./AiChatGateway.js";
4
+ export { AiChatFeature } from "./feature.js";
5
+ export { AiChatPresenter } from "./abstractions.js";
6
+ export type { AiTurnViewModel, IAiChatPresenter, IAiChatViewModel } from "./abstractions.js";
@@ -0,0 +1,3 @@
1
+ export { AiChatGateway, AiChatPresenter } from "./abstractions.js";
2
+ export { AiChatGateway as AiChatGatewayImplementation } from "./AiChatGateway.js";
3
+ export { AiChatFeature } from "./feature.js";
@@ -0,0 +1,8 @@
1
+ import type { FormattableDate, IDateFormatter } from "./abstractions.js";
2
+ declare class DefaultDateFormatterImpl implements IDateFormatter {
3
+ format(date: FormattableDate, options?: Intl.DateTimeFormatOptions): string;
4
+ }
5
+ export declare const DefaultDateFormatter: typeof DefaultDateFormatterImpl & {
6
+ __abstraction: import("@webiny/di").Abstraction<IDateFormatter>;
7
+ };
8
+ export {};
@@ -0,0 +1,25 @@
1
+ import { DateFormatter } from "./abstractions.js";
2
+ const DEFAULT_OPTIONS = {
3
+ year: "numeric",
4
+ month: "2-digit",
5
+ day: "2-digit",
6
+ hour: "2-digit",
7
+ minute: "2-digit",
8
+ hour12: false
9
+ };
10
+ class DefaultDateFormatterImpl {
11
+ format(date, options) {
12
+ const formatter = new Intl.DateTimeFormat(void 0, {
13
+ ...DEFAULT_OPTIONS,
14
+ ...options
15
+ });
16
+ return formatter.format(new Date(date));
17
+ }
18
+ }
19
+ const DefaultDateFormatter = DateFormatter.createImplementation({
20
+ implementation: DefaultDateFormatterImpl,
21
+ dependencies: []
22
+ });
23
+ export { DefaultDateFormatter };
24
+
25
+ //# sourceMappingURL=DefaultDateFormatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/dateFormatter/DefaultDateFormatter.js","sources":["../../../src/features/dateFormatter/DefaultDateFormatter.ts"],"sourcesContent":["import { DateFormatter } from \"./abstractions.js\";\nimport type { FormattableDate, IDateFormatter } from \"./abstractions.js\";\n\n/**\n * Default absolute date/time format used across the admin app: `YYYY-MM-DD HH:mm`, 24-hour, in the\n * browser's locale. This is the single place these dates are formatted, so projects can change the\n * format everywhere at once by decorating the DateFormatter abstraction.\n */\nconst DEFAULT_OPTIONS: Intl.DateTimeFormatOptions = {\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n hour12: false\n};\n\nclass DefaultDateFormatterImpl implements IDateFormatter {\n format(date: FormattableDate, options?: Intl.DateTimeFormatOptions): string {\n const formatter = new Intl.DateTimeFormat(undefined, { ...DEFAULT_OPTIONS, ...options });\n return formatter.format(new Date(date));\n }\n}\n\nexport const DefaultDateFormatter = DateFormatter.createImplementation({\n implementation: DefaultDateFormatterImpl,\n dependencies: []\n});\n"],"names":["DEFAULT_OPTIONS","DefaultDateFormatterImpl","date","options","formatter","Intl","undefined","Date","DefaultDateFormatter","DateFormatter"],"mappings":";AAQA,MAAMA,kBAA8C;IAChD,MAAM;IACN,OAAO;IACP,KAAK;IACL,MAAM;IACN,QAAQ;IACR,QAAQ;AACZ;AAEA,MAAMC;IACF,OAAOC,IAAqB,EAAEC,OAAoC,EAAU;QACxE,MAAMC,YAAY,IAAIC,KAAK,cAAc,CAACC,QAAW;YAAE,GAAGN,eAAe;YAAE,GAAGG,OAAO;QAAC;QACtF,OAAOC,UAAU,MAAM,CAAC,IAAIG,KAAKL;IACrC;AACJ;AAEO,MAAMM,uBAAuBC,cAAc,oBAAoB,CAAC;IACnE,gBAAgBR;IAChB,cAAc,EAAE;AACpB"}
@@ -0,0 +1,13 @@
1
+ export type FormattableDate = Date | string | number;
2
+ export interface IDateFormatter {
3
+ /**
4
+ * Formats an absolute date/time as a locale string. Pass `options` to override the defaults for
5
+ * a specific call; change the defaults globally by decorating this abstraction.
6
+ */
7
+ format(date: FormattableDate, options?: Intl.DateTimeFormatOptions): string;
8
+ }
9
+ export declare const DateFormatter: import("@webiny/di").Abstraction<IDateFormatter>;
10
+ export declare namespace DateFormatter {
11
+ type Interface = IDateFormatter;
12
+ type Value = FormattableDate;
13
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/admin";
2
+ const DateFormatter = createAbstraction("DateFormatter");
3
+ export { DateFormatter };
4
+
5
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/dateFormatter/abstractions.js","sources":["../../../src/features/dateFormatter/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\n\nexport type FormattableDate = Date | string | number;\n\nexport interface IDateFormatter {\n /**\n * Formats an absolute date/time as a locale string. Pass `options` to override the defaults for\n * a specific call; change the defaults globally by decorating this abstraction.\n */\n format(date: FormattableDate, options?: Intl.DateTimeFormatOptions): string;\n}\n\nexport const DateFormatter = createAbstraction<IDateFormatter>(\"DateFormatter\");\n\nexport namespace DateFormatter {\n export type Interface = IDateFormatter;\n export type Value = FormattableDate;\n}\n"],"names":["DateFormatter","createAbstraction"],"mappings":";AAYO,MAAMA,gBAAgBC,kBAAkC"}
@@ -0,0 +1,3 @@
1
+ export declare const DateFormatterFeature: import("@webiny/feature/admin").FeatureDefinition<{
2
+ formatter: import("./abstractions.js").IDateFormatter;
3
+ }, []>;
@@ -0,0 +1,17 @@
1
+ import { createFeature } from "@webiny/feature/admin";
2
+ import { DateFormatter } from "./abstractions.js";
3
+ import { DefaultDateFormatter } from "./DefaultDateFormatter.js";
4
+ const DateFormatterFeature = createFeature({
5
+ name: "DateFormatter",
6
+ register (container) {
7
+ container.register(DefaultDateFormatter).inSingletonScope();
8
+ },
9
+ resolve (container) {
10
+ return {
11
+ formatter: container.resolve(DateFormatter)
12
+ };
13
+ }
14
+ });
15
+ export { DateFormatterFeature };
16
+
17
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/dateFormatter/feature.js","sources":["../../../src/features/dateFormatter/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { DateFormatter } from \"./abstractions.js\";\nimport { DefaultDateFormatter } from \"./DefaultDateFormatter.js\";\n\nexport const DateFormatterFeature = createFeature({\n name: \"DateFormatter\",\n register(container) {\n container.register(DefaultDateFormatter).inSingletonScope();\n },\n resolve(container) {\n return {\n formatter: container.resolve(DateFormatter)\n };\n }\n});\n"],"names":["DateFormatterFeature","createFeature","container","DefaultDateFormatter","DateFormatter"],"mappings":";;;AAIO,MAAMA,uBAAuBC,cAAc;IAC9C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC,sBAAsB,gBAAgB;IAC7D;IACA,SAAQD,SAAS;QACb,OAAO;YACH,WAAWA,UAAU,OAAO,CAACE;QACjC;IACJ;AACJ"}
@@ -0,0 +1,4 @@
1
+ export * from "./abstractions.js";
2
+ export * from "./DefaultDateFormatter.js";
3
+ export * from "./feature.js";
4
+ export * from "./useDateFormatter.js";
@@ -0,0 +1,4 @@
1
+ export * from "./abstractions.js";
2
+ export * from "./DefaultDateFormatter.js";
3
+ export * from "./feature.js";
4
+ export * from "./useDateFormatter.js";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Resolves the shared DateFormatter for components that have no presenter of their own. Prefer
3
+ * formatting in a presenter's view model where one exists.
4
+ */
5
+ export declare function useDateFormatter(): import("./abstractions.js").IDateFormatter;
@@ -0,0 +1,8 @@
1
+ import { useFeature } from "@webiny/app";
2
+ import { DateFormatterFeature } from "./feature.js";
3
+ function useDateFormatter() {
4
+ return useFeature(DateFormatterFeature).formatter;
5
+ }
6
+ export { useDateFormatter };
7
+
8
+ //# sourceMappingURL=useDateFormatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/dateFormatter/useDateFormatter.js","sources":["../../../src/features/dateFormatter/useDateFormatter.ts"],"sourcesContent":["import { useFeature } from \"@webiny/app\";\nimport { DateFormatterFeature } from \"./feature.js\";\n\n/**\n * Resolves the shared DateFormatter for components that have no presenter of their own. Prefer\n * formatting in a presenter's view model where one exists.\n */\nexport function useDateFormatter() {\n return useFeature(DateFormatterFeature).formatter;\n}\n"],"names":["useDateFormatter","useFeature","DateFormatterFeature"],"mappings":";;AAOO,SAASA;IACZ,OAAOC,WAAWC,sBAAsB,SAAS;AACrD"}
@@ -0,0 +1,10 @@
1
+ import { FeatureFlagsGateway as Abstraction } from "./abstractions.js";
2
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
3
+ import type { IFeatureFlagsDto } from "@webiny/feature-flags";
4
+ declare class FeatureFlagsGraphQLGateway implements Abstraction.Interface {
5
+ private client;
6
+ constructor(client: MainGraphQLClient.Interface);
7
+ fetchFlags(): Promise<IFeatureFlagsDto | null>;
8
+ }
9
+ export declare const FeatureFlagsGateway: import("@webiny/di").Implementation<typeof FeatureFlagsGraphQLGateway>;
10
+ export {};
@@ -0,0 +1,40 @@
1
+ import { createImplementation } from "@webiny/di";
2
+ import { FeatureFlagsGateway } from "./abstractions.js";
3
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
4
+ const GET_FEATURE_FLAGS = `
5
+ query GetFeatureFlags {
6
+ featureFlags {
7
+ data
8
+ error {
9
+ message
10
+ code
11
+ data
12
+ }
13
+ }
14
+ }
15
+ `;
16
+ class FeatureFlagsGraphQLGateway {
17
+ constructor(client){
18
+ this.client = client;
19
+ }
20
+ async fetchFlags() {
21
+ const response = await this.client.execute({
22
+ query: GET_FEATURE_FLAGS,
23
+ headers: {
24
+ "x-tenant": "root"
25
+ }
26
+ });
27
+ if (response.featureFlags.error) throw new Error(response.featureFlags.error.message);
28
+ return response.featureFlags.data;
29
+ }
30
+ }
31
+ const FeatureFlagsGateway_FeatureFlagsGateway = createImplementation({
32
+ abstraction: FeatureFlagsGateway,
33
+ implementation: FeatureFlagsGraphQLGateway,
34
+ dependencies: [
35
+ MainGraphQLClient
36
+ ]
37
+ });
38
+ export { FeatureFlagsGateway_FeatureFlagsGateway as FeatureFlagsGateway };
39
+
40
+ //# sourceMappingURL=FeatureFlagsGateway.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/featureFlags/FeatureFlagsGateway.js","sources":["../../../src/features/featureFlags/FeatureFlagsGateway.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { FeatureFlagsGateway as Abstraction } from \"./abstractions.js\";\nimport { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport type { IFeatureFlagsDto } from \"@webiny/feature-flags\";\n\ninterface GetFeatureFlagsResponse {\n featureFlags: {\n data: IFeatureFlagsDto | null;\n error: { message: string; code: string; data: unknown } | null;\n };\n}\n\nconst GET_FEATURE_FLAGS = /* GraphQL */ `\n query GetFeatureFlags {\n featureFlags {\n data\n error {\n message\n code\n data\n }\n }\n }\n`;\n\nclass FeatureFlagsGraphQLGateway implements Abstraction.Interface {\n constructor(private client: MainGraphQLClient.Interface) {}\n\n async fetchFlags(): Promise<IFeatureFlagsDto | null> {\n const response = await this.client.execute<GetFeatureFlagsResponse>({\n query: GET_FEATURE_FLAGS,\n headers: {\n \"x-tenant\": \"root\"\n }\n });\n\n if (response.featureFlags.error) {\n throw new Error(response.featureFlags.error.message);\n }\n\n return response.featureFlags.data;\n }\n}\n\nexport const FeatureFlagsGateway = createImplementation({\n abstraction: Abstraction,\n implementation: FeatureFlagsGraphQLGateway,\n dependencies: [MainGraphQLClient]\n});\n"],"names":["GET_FEATURE_FLAGS","FeatureFlagsGraphQLGateway","client","response","Error","FeatureFlagsGateway","createImplementation","Abstraction","MainGraphQLClient"],"mappings":";;;AAYA,MAAMA,oBAAkC,CAAC;;;;;;;;;;;AAWzC,CAAC;AAED,MAAMC;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,aAA+C;QACjD,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA0B;YAChE,OAAOH;YACP,SAAS;gBACL,YAAY;YAChB;QACJ;QAEA,IAAIG,SAAS,YAAY,CAAC,KAAK,EAC3B,MAAM,IAAIC,MAAMD,SAAS,YAAY,CAAC,KAAK,CAAC,OAAO;QAGvD,OAAOA,SAAS,YAAY,CAAC,IAAI;IACrC;AACJ;AAEO,MAAME,0CAAsBC,qBAAqB;IACpD,aAAaC;IACb,gBAAgBN;IAChB,cAAc;QAACO;KAAkB;AACrC"}
@@ -0,0 +1,16 @@
1
+ import { LocalStorage } from "@webiny/app/features/localStorage";
2
+ import { FeatureFlags } from "@webiny/feature-flags";
3
+ import { FeatureFlagsService as Abstraction, FeatureFlagsGateway } from "./abstractions.js";
4
+ declare class FeatureFlagsServiceImpl implements Abstraction.Interface {
5
+ private gateway;
6
+ private localStorage;
7
+ private flags;
8
+ private loaded;
9
+ constructor(gateway: FeatureFlagsGateway.Interface, localStorage: LocalStorage.Interface);
10
+ private initializeFromLocalStorage;
11
+ getFlags(): FeatureFlags;
12
+ isLoaded(): boolean;
13
+ loadFlags(): Promise<void>;
14
+ }
15
+ export declare const FeatureFlagsService: import("@webiny/di").Implementation<typeof FeatureFlagsServiceImpl>;
16
+ export {};
@@ -0,0 +1,64 @@
1
+ import { makeAutoObservable, runInAction } from "mobx";
2
+ import { createImplementation } from "@webiny/di";
3
+ import { LocalStorage } from "@webiny/app/features/localStorage";
4
+ import { FeatureFlags } from "@webiny/feature-flags";
5
+ import { FeatureFlagsGateway, FeatureFlagsService } from "./abstractions.js";
6
+ const LOCAL_STORAGE_KEY = "featureFlags";
7
+ class FeatureFlagsServiceImpl {
8
+ constructor(gateway, localStorage){
9
+ this.gateway = gateway;
10
+ this.localStorage = localStorage;
11
+ this.flags = new FeatureFlags({});
12
+ this.loaded = false;
13
+ makeAutoObservable(this, {}, {
14
+ autoBind: true
15
+ });
16
+ this.initializeFromLocalStorage();
17
+ }
18
+ initializeFromLocalStorage() {
19
+ try {
20
+ const cached = this.localStorage.get(LOCAL_STORAGE_KEY);
21
+ if (cached) {
22
+ this.flags = FeatureFlags.fromDto(cached);
23
+ this.loaded = true;
24
+ }
25
+ } catch (error) {
26
+ console.warn("Failed to load feature flags from localStorage:", error);
27
+ }
28
+ this.loadFlags();
29
+ }
30
+ getFlags() {
31
+ return this.flags;
32
+ }
33
+ isLoaded() {
34
+ return this.loaded;
35
+ }
36
+ async loadFlags() {
37
+ try {
38
+ const data = await this.gateway.fetchFlags();
39
+ const dto = data ?? {};
40
+ const flags = FeatureFlags.fromDto(dto);
41
+ runInAction(()=>{
42
+ this.flags = flags;
43
+ this.loaded = true;
44
+ });
45
+ this.localStorage.set(LOCAL_STORAGE_KEY, dto);
46
+ } catch (error) {
47
+ console.error("Failed to load feature flags:", error);
48
+ runInAction(()=>{
49
+ this.loaded = true;
50
+ });
51
+ }
52
+ }
53
+ }
54
+ const FeatureFlagsService_FeatureFlagsService = createImplementation({
55
+ abstraction: FeatureFlagsService,
56
+ implementation: FeatureFlagsServiceImpl,
57
+ dependencies: [
58
+ FeatureFlagsGateway,
59
+ LocalStorage
60
+ ]
61
+ });
62
+ export { FeatureFlagsService_FeatureFlagsService as FeatureFlagsService };
63
+
64
+ //# sourceMappingURL=FeatureFlagsService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/featureFlags/FeatureFlagsService.js","sources":["../../../src/features/featureFlags/FeatureFlagsService.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from \"mobx\";\nimport { createImplementation } from \"@webiny/di\";\nimport { LocalStorage } from \"@webiny/app/features/localStorage\";\nimport { FeatureFlags } from \"@webiny/feature-flags\";\nimport type { IFeatureFlagsDto } from \"@webiny/feature-flags\";\nimport { FeatureFlagsService as Abstraction, FeatureFlagsGateway } from \"./abstractions.js\";\n\nconst LOCAL_STORAGE_KEY = \"featureFlags\";\n\nclass FeatureFlagsServiceImpl implements Abstraction.Interface {\n private flags: FeatureFlags = new FeatureFlags({});\n private loaded = false;\n\n constructor(\n private gateway: FeatureFlagsGateway.Interface,\n private localStorage: LocalStorage.Interface\n ) {\n makeAutoObservable(this, {}, { autoBind: true });\n this.initializeFromLocalStorage();\n }\n\n private initializeFromLocalStorage(): void {\n try {\n const cached = this.localStorage.get<IFeatureFlagsDto>(LOCAL_STORAGE_KEY);\n if (cached) {\n this.flags = FeatureFlags.fromDto(cached);\n this.loaded = true;\n }\n } catch (error) {\n console.warn(\"Failed to load feature flags from localStorage:\", error);\n }\n\n this.loadFlags();\n }\n\n getFlags(): FeatureFlags {\n return this.flags;\n }\n\n isLoaded(): boolean {\n return this.loaded;\n }\n\n async loadFlags(): Promise<void> {\n try {\n const data = await this.gateway.fetchFlags();\n const dto = data ?? {};\n const flags = FeatureFlags.fromDto(dto);\n\n runInAction(() => {\n this.flags = flags;\n this.loaded = true;\n });\n\n this.localStorage.set(LOCAL_STORAGE_KEY, dto);\n } catch (error) {\n console.error(\"Failed to load feature flags:\", error);\n runInAction(() => {\n this.loaded = true;\n });\n }\n }\n}\n\nexport const FeatureFlagsService = createImplementation({\n abstraction: Abstraction,\n implementation: FeatureFlagsServiceImpl,\n dependencies: [FeatureFlagsGateway, LocalStorage]\n});\n"],"names":["LOCAL_STORAGE_KEY","FeatureFlagsServiceImpl","gateway","localStorage","FeatureFlags","makeAutoObservable","cached","error","console","data","dto","flags","runInAction","FeatureFlagsService","createImplementation","Abstraction","FeatureFlagsGateway","LocalStorage"],"mappings":";;;;;AAOA,MAAMA,oBAAoB;AAE1B,MAAMC;IAIF,YACYC,OAAsC,EACtCC,YAAoC,CAC9C;aAFUD,OAAO,GAAPA;aACAC,YAAY,GAAZA;aALJ,KAAK,GAAiB,IAAIC,aAAa,CAAC;aACxC,MAAM,GAAG;QAMbC,mBAAmB,IAAI,EAAE,CAAC,GAAG;YAAE,UAAU;QAAK;QAC9C,IAAI,CAAC,0BAA0B;IACnC;IAEQ,6BAAmC;QACvC,IAAI;YACA,MAAMC,SAAS,IAAI,CAAC,YAAY,CAAC,GAAG,CAAmBN;YACvD,IAAIM,QAAQ;gBACR,IAAI,CAAC,KAAK,GAAGF,aAAa,OAAO,CAACE;gBAClC,IAAI,CAAC,MAAM,GAAG;YAClB;QACJ,EAAE,OAAOC,OAAO;YACZC,QAAQ,IAAI,CAAC,mDAAmDD;QACpE;QAEA,IAAI,CAAC,SAAS;IAClB;IAEA,WAAyB;QACrB,OAAO,IAAI,CAAC,KAAK;IACrB;IAEA,WAAoB;QAChB,OAAO,IAAI,CAAC,MAAM;IACtB;IAEA,MAAM,YAA2B;QAC7B,IAAI;YACA,MAAME,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU;YAC1C,MAAMC,MAAMD,QAAQ,CAAC;YACrB,MAAME,QAAQP,aAAa,OAAO,CAACM;YAEnCE,YAAY;gBACR,IAAI,CAAC,KAAK,GAAGD;gBACb,IAAI,CAAC,MAAM,GAAG;YAClB;YAEA,IAAI,CAAC,YAAY,CAAC,GAAG,CAACX,mBAAmBU;QAC7C,EAAE,OAAOH,OAAO;YACZC,QAAQ,KAAK,CAAC,iCAAiCD;YAC/CK,YAAY;gBACR,IAAI,CAAC,MAAM,GAAG;YAClB;QACJ;IACJ;AACJ;AAEO,MAAMC,0CAAsBC,qBAAqB;IACpD,aAAaC;IACb,gBAAgBd;IAChB,cAAc;QAACe;QAAqBC;KAAa;AACrD"}
@@ -0,0 +1,19 @@
1
+ import { Abstraction } from "@webiny/di";
2
+ import type { IFeatureFlagsDto } from "@webiny/feature-flags";
3
+ import { FeatureFlags } from "@webiny/feature-flags";
4
+ export interface IFeatureFlagsGateway {
5
+ fetchFlags(): Promise<IFeatureFlagsDto | null>;
6
+ }
7
+ export declare const FeatureFlagsGateway: Abstraction<IFeatureFlagsGateway>;
8
+ export declare namespace FeatureFlagsGateway {
9
+ type Interface = IFeatureFlagsGateway;
10
+ }
11
+ export interface IFeatureFlagsService {
12
+ getFlags(): FeatureFlags;
13
+ isLoaded(): boolean;
14
+ loadFlags(): Promise<void>;
15
+ }
16
+ export declare const FeatureFlagsService: Abstraction<IFeatureFlagsService>;
17
+ export declare namespace FeatureFlagsService {
18
+ type Interface = IFeatureFlagsService;
19
+ }
@@ -0,0 +1,6 @@
1
+ import { Abstraction } from "@webiny/di";
2
+ const FeatureFlagsGateway = new Abstraction("FeatureFlagsGateway");
3
+ const FeatureFlagsService = new Abstraction("FeatureFlagsService");
4
+ export { FeatureFlagsGateway, FeatureFlagsService };
5
+
6
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/featureFlags/abstractions.js","sources":["../../../src/features/featureFlags/abstractions.ts"],"sourcesContent":["import { Abstraction } from \"@webiny/di\";\nimport type { IFeatureFlagsDto } from \"@webiny/feature-flags\";\nimport { FeatureFlags } from \"@webiny/feature-flags\";\n\nexport interface IFeatureFlagsGateway {\n fetchFlags(): Promise<IFeatureFlagsDto | null>;\n}\n\nexport const FeatureFlagsGateway = new Abstraction<IFeatureFlagsGateway>(\"FeatureFlagsGateway\");\n\nexport namespace FeatureFlagsGateway {\n export type Interface = IFeatureFlagsGateway;\n}\n\nexport interface IFeatureFlagsService {\n getFlags(): FeatureFlags;\n isLoaded(): boolean;\n loadFlags(): Promise<void>;\n}\n\nexport const FeatureFlagsService = new Abstraction<IFeatureFlagsService>(\"FeatureFlagsService\");\n\nexport namespace FeatureFlagsService {\n export type Interface = IFeatureFlagsService;\n}\n"],"names":["FeatureFlagsGateway","Abstraction","FeatureFlagsService"],"mappings":";AAQO,MAAMA,sBAAsB,IAAIC,YAAkC;AAYlE,MAAMC,sBAAsB,IAAID,YAAkC"}
@@ -0,0 +1,3 @@
1
+ export declare const FeatureFlagsFeature: import("@webiny/feature/admin").FeatureDefinition<{
2
+ service: import("./abstractions.js").IFeatureFlagsService;
3
+ }, []>;
@@ -0,0 +1,19 @@
1
+ import { createFeature } from "@webiny/feature/admin";
2
+ import { FeatureFlagsService } from "./abstractions.js";
3
+ import { FeatureFlagsService as external_FeatureFlagsService_js_FeatureFlagsService } from "./FeatureFlagsService.js";
4
+ import { FeatureFlagsGateway } from "./FeatureFlagsGateway.js";
5
+ const FeatureFlagsFeature = createFeature({
6
+ name: "FeatureFlags",
7
+ register (container) {
8
+ container.register(FeatureFlagsGateway).inSingletonScope();
9
+ container.register(external_FeatureFlagsService_js_FeatureFlagsService).inSingletonScope();
10
+ },
11
+ resolve (container) {
12
+ return {
13
+ service: container.resolve(FeatureFlagsService)
14
+ };
15
+ }
16
+ });
17
+ export { FeatureFlagsFeature };
18
+
19
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/featureFlags/feature.js","sources":["../../../src/features/featureFlags/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { Container } from \"@webiny/di\";\nimport { FeatureFlagsService as ServiceAbstraction } from \"./abstractions.js\";\nimport { FeatureFlagsService } from \"./FeatureFlagsService.js\";\nimport { FeatureFlagsGateway } from \"./FeatureFlagsGateway.js\";\n\nexport const FeatureFlagsFeature = createFeature({\n name: \"FeatureFlags\",\n register(container: Container) {\n container.register(FeatureFlagsGateway).inSingletonScope();\n container.register(FeatureFlagsService).inSingletonScope();\n },\n resolve(container: Container) {\n return {\n service: container.resolve(ServiceAbstraction)\n };\n }\n});\n"],"names":["FeatureFlagsFeature","createFeature","container","FeatureFlagsGateway","FeatureFlagsService","ServiceAbstraction"],"mappings":";;;;AAMO,MAAMA,sBAAsBC,cAAc;IAC7C,MAAM;IACN,UAASC,SAAoB;QACzBA,UAAU,QAAQ,CAACC,qBAAqB,gBAAgB;QACxDD,UAAU,QAAQ,CAACE,qDAAqB,gBAAgB;IAC5D;IACA,SAAQF,SAAoB;QACxB,OAAO;YACH,SAASA,UAAU,OAAO,CAACG;QAC/B;IACJ;AACJ"}
@@ -134,6 +134,16 @@ class Field {
134
134
  visible: true,
135
135
  disabled: false
136
136
  };
137
+ if (this._parentPath) {
138
+ const resolved = all.map((rule)=>{
139
+ if (rule.target.startsWith("$.")) return {
140
+ ...rule,
141
+ target: `${this._parentPath}.${rule.target.slice(2)}`
142
+ };
143
+ return rule;
144
+ });
145
+ return this._form.evaluateRules(resolved);
146
+ }
137
147
  return this._form.evaluateRules(all);
138
148
  }
139
149
  get visible() {