@open-mercato/core 0.6.8-develop.7100.1.fbf66fca35 → 0.7.0

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 (967) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/helpers/integration/api.js +1 -13
  3. package/dist/helpers/integration/api.js.map +2 -2
  4. package/dist/helpers/integration/communicationChannelsFixtures.js +0 -19
  5. package/dist/helpers/integration/communicationChannelsFixtures.js.map +2 -2
  6. package/dist/modules/api_keys/api/keys/route.js +1 -1
  7. package/dist/modules/api_keys/api/keys/route.js.map +2 -2
  8. package/dist/modules/api_keys/backend/api-keys/page.js +1 -3
  9. package/dist/modules/api_keys/backend/api-keys/page.js.map +2 -2
  10. package/dist/modules/attachments/api/route.js +2 -2
  11. package/dist/modules/attachments/api/route.js.map +2 -2
  12. package/dist/modules/attachments/components/AttachmentLibrary.js +0 -2
  13. package/dist/modules/attachments/components/AttachmentLibrary.js.map +2 -2
  14. package/dist/modules/attachments/di.js +1 -11
  15. package/dist/modules/attachments/di.js.map +2 -2
  16. package/dist/modules/attachments/index.js.map +1 -1
  17. package/dist/modules/attachments/lib/scoped-upload-service.js +2 -15
  18. package/dist/modules/attachments/lib/scoped-upload-service.js.map +2 -2
  19. package/dist/modules/attachments/lib/upload-limits.js +2 -6
  20. package/dist/modules/attachments/lib/upload-limits.js.map +2 -2
  21. package/dist/modules/audit_logs/backend/audit-logs/page.js +0 -6
  22. package/dist/modules/audit_logs/backend/audit-logs/page.js.map +2 -2
  23. package/dist/modules/audit_logs/lib/display-helpers.js +11 -19
  24. package/dist/modules/audit_logs/lib/display-helpers.js.map +2 -2
  25. package/dist/modules/audit_logs/services/actionLogService.js +12 -57
  26. package/dist/modules/audit_logs/services/actionLogService.js.map +3 -3
  27. package/dist/modules/auth/acl.js +5 -30
  28. package/dist/modules/auth/acl.js.map +2 -2
  29. package/dist/modules/auth/api/feature-check.js +2 -8
  30. package/dist/modules/auth/api/feature-check.js.map +2 -2
  31. package/dist/modules/auth/api/login.js +20 -4
  32. package/dist/modules/auth/api/login.js.map +2 -2
  33. package/dist/modules/auth/api/roles/acl/route.js +33 -28
  34. package/dist/modules/auth/api/roles/acl/route.js.map +2 -2
  35. package/dist/modules/auth/api/routeError.js +11 -0
  36. package/dist/modules/auth/api/routeError.js.map +7 -0
  37. package/dist/modules/auth/api/session/refresh.js +1 -25
  38. package/dist/modules/auth/api/session/refresh.js.map +2 -2
  39. package/dist/modules/auth/api/users/acl/route.js +73 -102
  40. package/dist/modules/auth/api/users/acl/route.js.map +2 -2
  41. package/dist/modules/auth/api/users/route.js +5 -13
  42. package/dist/modules/auth/api/users/route.js.map +2 -2
  43. package/dist/modules/auth/backend/roles/[id]/edit/page.meta.js +1 -5
  44. package/dist/modules/auth/backend/roles/[id]/edit/page.meta.js.map +2 -2
  45. package/dist/modules/auth/backend/roles/page.js +1 -3
  46. package/dist/modules/auth/backend/roles/page.js.map +2 -2
  47. package/dist/modules/auth/backend/users/[id]/edit/page.meta.js +1 -5
  48. package/dist/modules/auth/backend/users/[id]/edit/page.meta.js.map +2 -2
  49. package/dist/modules/auth/backend/users/page.js +1 -2
  50. package/dist/modules/auth/backend/users/page.js.map +2 -2
  51. package/dist/modules/auth/components/AclEditor.js +30 -39
  52. package/dist/modules/auth/components/AclEditor.js.map +2 -2
  53. package/dist/modules/auth/data/entities.js.map +2 -2
  54. package/dist/modules/auth/data/validators.js +1 -5
  55. package/dist/modules/auth/data/validators.js.map +2 -2
  56. package/dist/modules/auth/di.js +9 -35
  57. package/dist/modules/auth/di.js.map +2 -2
  58. package/dist/modules/auth/frontend/reset/[token]/page.js +0 -46
  59. package/dist/modules/auth/frontend/reset/[token]/page.js.map +2 -2
  60. package/dist/modules/auth/lib/grantChecks.js.map +2 -2
  61. package/dist/modules/auth/services/authService.js +2 -16
  62. package/dist/modules/auth/services/authService.js.map +2 -2
  63. package/dist/modules/auth/services/rbacService.js +24 -67
  64. package/dist/modules/auth/services/rbacService.js.map +3 -3
  65. package/dist/modules/business_rules/backend/logs/page.js +1 -3
  66. package/dist/modules/business_rules/backend/logs/page.js.map +2 -2
  67. package/dist/modules/business_rules/backend/rules/[id]/page.meta.js +6 -1
  68. package/dist/modules/business_rules/backend/rules/[id]/page.meta.js.map +2 -2
  69. package/dist/modules/business_rules/backend/rules/create/page.meta.js +5 -1
  70. package/dist/modules/business_rules/backend/rules/create/page.meta.js.map +2 -2
  71. package/dist/modules/business_rules/backend/rules/page.js +1 -3
  72. package/dist/modules/business_rules/backend/rules/page.js.map +2 -2
  73. package/dist/modules/business_rules/backend/sets/[id]/page.meta.js +6 -1
  74. package/dist/modules/business_rules/backend/sets/[id]/page.meta.js.map +2 -2
  75. package/dist/modules/business_rules/backend/sets/create/page.meta.js +5 -1
  76. package/dist/modules/business_rules/backend/sets/create/page.meta.js.map +2 -2
  77. package/dist/modules/business_rules/backend/sets/page.js +1 -3
  78. package/dist/modules/business_rules/backend/sets/page.js.map +2 -2
  79. package/dist/modules/business_rules/lib/expression-evaluator.js +9 -9
  80. package/dist/modules/business_rules/lib/expression-evaluator.js.map +2 -2
  81. package/dist/modules/business_rules/lib/rule-evaluator.js +9 -10
  82. package/dist/modules/business_rules/lib/rule-evaluator.js.map +2 -2
  83. package/dist/modules/catalog/ai-agents.js +1 -1
  84. package/dist/modules/catalog/ai-agents.js.map +1 -1
  85. package/dist/modules/catalog/ai-tools/merchandising-pack.js +2 -2
  86. package/dist/modules/catalog/ai-tools/merchandising-pack.js.map +2 -2
  87. package/dist/modules/catalog/backend/catalog/products/MerchandisingAssistantSheet.js +2 -5
  88. package/dist/modules/catalog/backend/catalog/products/MerchandisingAssistantSheet.js.map +2 -2
  89. package/dist/modules/catalog/components/categories/CategoriesDataTable.js +0 -2
  90. package/dist/modules/catalog/components/categories/CategoriesDataTable.js.map +2 -2
  91. package/dist/modules/catalog/components/products/ProductsDataTable.js +1 -7
  92. package/dist/modules/catalog/components/products/ProductsDataTable.js.map +2 -2
  93. package/dist/modules/catalog/widgets/injection/merchandising-assistant-trigger/widget.client.js +0 -2
  94. package/dist/modules/catalog/widgets/injection/merchandising-assistant-trigger/widget.client.js.map +2 -2
  95. package/dist/modules/communication_channels/api/post/channels/[id]/test-send/route.js +1 -9
  96. package/dist/modules/communication_channels/api/post/channels/[id]/test-send/route.js.map +2 -2
  97. package/dist/modules/communication_channels/api/post/test-seed/route.js +10 -95
  98. package/dist/modules/communication_channels/api/post/test-seed/route.js.map +2 -2
  99. package/dist/modules/communication_channels/backend/communication_channels/channels/page.js +0 -3
  100. package/dist/modules/communication_channels/backend/communication_channels/channels/page.js.map +2 -2
  101. package/dist/modules/communication_channels/commands/ingest-inbound-message.js +1 -14
  102. package/dist/modules/communication_channels/commands/ingest-inbound-message.js.map +2 -2
  103. package/dist/modules/communication_channels/di.js +1 -7
  104. package/dist/modules/communication_channels/di.js.map +2 -2
  105. package/dist/modules/communication_channels/lib/email-capabilities.js +1 -4
  106. package/dist/modules/communication_channels/lib/email-capabilities.js.map +2 -2
  107. package/dist/modules/communication_channels/lib/test-seed.js +2 -41
  108. package/dist/modules/communication_channels/lib/test-seed.js.map +2 -2
  109. package/dist/modules/configs/lib/system-status.js +0 -9
  110. package/dist/modules/configs/lib/system-status.js.map +2 -2
  111. package/dist/modules/currencies/backend/currencies/page.js +1 -3
  112. package/dist/modules/currencies/backend/currencies/page.js.map +2 -2
  113. package/dist/modules/currencies/backend/exchange-rates/page.js +1 -3
  114. package/dist/modules/currencies/backend/exchange-rates/page.js.map +2 -2
  115. package/dist/modules/customer_accounts/api/admin/domain-mappings.js +0 -9
  116. package/dist/modules/customer_accounts/api/admin/domain-mappings.js.map +2 -2
  117. package/dist/modules/customer_accounts/backend/customer_accounts/roles/page.js +1 -3
  118. package/dist/modules/customer_accounts/backend/customer_accounts/roles/page.js.map +2 -2
  119. package/dist/modules/customer_accounts/backend/customer_accounts/settings/CustomerAccountsSettingsPageClient.js +84 -0
  120. package/dist/modules/customer_accounts/backend/customer_accounts/settings/CustomerAccountsSettingsPageClient.js.map +7 -0
  121. package/dist/modules/customer_accounts/backend/customer_accounts/settings/page.js +7 -81
  122. package/dist/modules/customer_accounts/backend/customer_accounts/settings/page.js.map +2 -2
  123. package/dist/modules/customer_accounts/backend/customer_accounts/users/PortalUsersPageClient.js +523 -0
  124. package/dist/modules/customer_accounts/backend/customer_accounts/users/PortalUsersPageClient.js.map +7 -0
  125. package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/PortalUserDetailPageClient.js +731 -0
  126. package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/PortalUserDetailPageClient.js.map +7 -0
  127. package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/page.js +7 -727
  128. package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/page.js.map +2 -2
  129. package/dist/modules/customer_accounts/backend/customer_accounts/users/page.js +7 -521
  130. package/dist/modules/customer_accounts/backend/customer_accounts/users/page.js.map +2 -2
  131. package/dist/modules/customer_accounts/extension-points.js +1 -1
  132. package/dist/modules/customer_accounts/extension-points.js.map +2 -2
  133. package/dist/modules/customer_accounts/lib/portalUrl.js +69 -0
  134. package/dist/modules/customer_accounts/lib/portalUrl.js.map +7 -0
  135. package/dist/modules/customer_accounts/services/domainMappingService.js +0 -10
  136. package/dist/modules/customer_accounts/services/domainMappingService.js.map +2 -2
  137. package/dist/modules/customers/ai-tools/companies-pack.js +1 -4
  138. package/dist/modules/customers/ai-tools/companies-pack.js.map +2 -2
  139. package/dist/modules/customers/ai-tools/deal-analyzer-pack.js +2 -13
  140. package/dist/modules/customers/ai-tools/deal-analyzer-pack.js.map +2 -2
  141. package/dist/modules/customers/ai-tools/deals-pack.js +6 -52
  142. package/dist/modules/customers/ai-tools/deals-pack.js.map +2 -2
  143. package/dist/modules/customers/ai-tools/people-pack.js +1 -4
  144. package/dist/modules/customers/ai-tools/people-pack.js.map +2 -2
  145. package/dist/modules/customers/api/activities/route.js +6 -48
  146. package/dist/modules/customers/api/activities/route.js.map +2 -2
  147. package/dist/modules/customers/api/companies/[id]/people/route.js +64 -20
  148. package/dist/modules/customers/api/companies/[id]/people/route.js.map +2 -2
  149. package/dist/modules/customers/api/companies/[id]/route.js +94 -17
  150. package/dist/modules/customers/api/companies/[id]/route.js.map +2 -2
  151. package/dist/modules/customers/api/dashboard/widgets/customer-todos/route.js +5 -8
  152. package/dist/modules/customers/api/dashboard/widgets/customer-todos/route.js.map +2 -2
  153. package/dist/modules/customers/api/deals/[id]/companies/route.js +1 -1
  154. package/dist/modules/customers/api/deals/[id]/companies/route.js.map +2 -2
  155. package/dist/modules/customers/api/deals/[id]/people/route.js +1 -1
  156. package/dist/modules/customers/api/deals/[id]/people/route.js.map +2 -2
  157. package/dist/modules/customers/api/deals/[id]/route.js +25 -8
  158. package/dist/modules/customers/api/deals/[id]/route.js.map +2 -2
  159. package/dist/modules/customers/api/deals/[id]/stats/route.js +22 -3
  160. package/dist/modules/customers/api/deals/[id]/stats/route.js.map +2 -2
  161. package/dist/modules/customers/api/deals/aggregate/route.js +4 -11
  162. package/dist/modules/customers/api/deals/aggregate/route.js.map +2 -2
  163. package/dist/modules/customers/api/deals/map/route.js +1 -2
  164. package/dist/modules/customers/api/deals/map/route.js.map +2 -2
  165. package/dist/modules/customers/api/deals/route.js +1 -38
  166. package/dist/modules/customers/api/deals/route.js.map +2 -2
  167. package/dist/modules/customers/api/entity-roles-factory.js +4 -4
  168. package/dist/modules/customers/api/entity-roles-factory.js.map +2 -2
  169. package/dist/modules/customers/api/interactions/route.js +1 -3
  170. package/dist/modules/customers/api/interactions/route.js.map +2 -2
  171. package/dist/modules/customers/api/interactions/tasks/route.js +4 -27
  172. package/dist/modules/customers/api/interactions/tasks/route.js.map +2 -2
  173. package/dist/modules/customers/api/people/[id]/companies/[linkId]/route.js +3 -4
  174. package/dist/modules/customers/api/people/[id]/companies/[linkId]/route.js.map +2 -2
  175. package/dist/modules/customers/api/people/[id]/companies/context.js +1 -1
  176. package/dist/modules/customers/api/people/[id]/companies/context.js.map +2 -2
  177. package/dist/modules/customers/api/people/[id]/companies/enriched/route.js +1 -1
  178. package/dist/modules/customers/api/people/[id]/companies/enriched/route.js.map +2 -2
  179. package/dist/modules/customers/api/people/[id]/route.js +10 -11
  180. package/dist/modules/customers/api/people/[id]/route.js.map +2 -2
  181. package/dist/modules/customers/api/people/check-phone/route.js +9 -51
  182. package/dist/modules/customers/api/people/check-phone/route.js.map +2 -2
  183. package/dist/modules/customers/api/todos/route.js +5 -30
  184. package/dist/modules/customers/api/todos/route.js.map +2 -2
  185. package/dist/modules/customers/backend/customers/companies/page.js +4 -6
  186. package/dist/modules/customers/backend/customers/companies/page.js.map +2 -2
  187. package/dist/modules/customers/backend/customers/deals/[id]/page.js +1 -6
  188. package/dist/modules/customers/backend/customers/deals/[id]/page.js.map +2 -2
  189. package/dist/modules/customers/backend/customers/deals/page.js +4 -7
  190. package/dist/modules/customers/backend/customers/deals/page.js.map +2 -2
  191. package/dist/modules/customers/backend/customers/deals/pipeline/components/Lane.js +13 -4
  192. package/dist/modules/customers/backend/customers/deals/pipeline/components/Lane.js.map +2 -2
  193. package/dist/modules/customers/backend/customers/deals/pipeline/components/StatusFilterPopover.js +14 -85
  194. package/dist/modules/customers/backend/customers/deals/pipeline/components/StatusFilterPopover.js.map +2 -2
  195. package/dist/modules/customers/backend/customers/people/page.js +4 -6
  196. package/dist/modules/customers/backend/customers/people/page.js.map +2 -2
  197. package/dist/modules/customers/backend/hooks/useEmailDuplicateCheck.js +3 -9
  198. package/dist/modules/customers/backend/hooks/useEmailDuplicateCheck.js.map +2 -2
  199. package/dist/modules/customers/commands/deals.js +34 -21
  200. package/dist/modules/customers/commands/deals.js.map +2 -2
  201. package/dist/modules/customers/commands/interactions.js.map +1 -1
  202. package/dist/modules/customers/commands/personCompanyLinks.js +2 -131
  203. package/dist/modules/customers/commands/personCompanyLinks.js.map +2 -2
  204. package/dist/modules/customers/components/CustomerTodosTable.js +0 -1
  205. package/dist/modules/customers/components/CustomerTodosTable.js.map +2 -2
  206. package/dist/modules/customers/components/DealsKpiStrip.js +6 -7
  207. package/dist/modules/customers/components/DealsKpiStrip.js.map +2 -2
  208. package/dist/modules/customers/components/calendar/AgendaList.js +2 -2
  209. package/dist/modules/customers/components/calendar/AgendaList.js.map +2 -2
  210. package/dist/modules/customers/components/calendar/CalendarEventEditor.js +1 -1
  211. package/dist/modules/customers/components/calendar/CalendarEventEditor.js.map +2 -2
  212. package/dist/modules/customers/components/calendar/CalendarScreen.js +1 -1
  213. package/dist/modules/customers/components/calendar/CalendarScreen.js.map +2 -2
  214. package/dist/modules/customers/components/calendar/CalendarSettingsModal.js +1 -1
  215. package/dist/modules/customers/components/calendar/CalendarSettingsModal.js.map +2 -2
  216. package/dist/modules/customers/components/calendar/EventBlock.js +1 -1
  217. package/dist/modules/customers/components/calendar/EventBlock.js.map +2 -2
  218. package/dist/modules/customers/components/calendar/EventPeekPopover.js +2 -3
  219. package/dist/modules/customers/components/calendar/EventPeekPopover.js.map +2 -2
  220. package/dist/modules/customers/components/calendar/editor/PeopleField.js +5 -40
  221. package/dist/modules/customers/components/calendar/editor/PeopleField.js.map +2 -2
  222. package/dist/modules/customers/components/calendar/editor/hooks.js +1 -2
  223. package/dist/modules/customers/components/calendar/editor/hooks.js.map +2 -2
  224. package/dist/modules/customers/components/calendar/types.js +1 -1
  225. package/dist/modules/customers/components/calendar/types.js.map +2 -2
  226. package/dist/modules/customers/components/detail/AssignRoleDialog.js +33 -28
  227. package/dist/modules/customers/components/detail/AssignRoleDialog.js.map +2 -2
  228. package/dist/modules/customers/components/detail/CompanyKpiBar.js +4 -5
  229. package/dist/modules/customers/components/detail/CompanyKpiBar.js.map +2 -2
  230. package/dist/modules/customers/components/detail/CompanyPeopleSection.js +1 -3
  231. package/dist/modules/customers/components/detail/CompanyPeopleSection.js.map +2 -2
  232. package/dist/modules/customers/components/detail/DealForm.js +7 -19
  233. package/dist/modules/customers/components/detail/DealForm.js.map +2 -2
  234. package/dist/modules/customers/components/detail/DealsSection.js +5 -6
  235. package/dist/modules/customers/components/detail/DealsSection.js.map +2 -2
  236. package/dist/modules/customers/components/detail/EntityTagsDialog.js +11 -35
  237. package/dist/modules/customers/components/detail/EntityTagsDialog.js.map +2 -2
  238. package/dist/modules/customers/components/detail/PersonCompaniesSection.js +1 -3
  239. package/dist/modules/customers/components/detail/PersonCompaniesSection.js.map +2 -2
  240. package/dist/modules/customers/components/detail/hooks/usePersonTasks.js +13 -19
  241. package/dist/modules/customers/components/detail/hooks/usePersonTasks.js.map +2 -2
  242. package/dist/modules/customers/components/detail/schedule/ParticipantsField.js +4 -4
  243. package/dist/modules/customers/components/detail/schedule/ParticipantsField.js.map +2 -2
  244. package/dist/modules/customers/components/detail/schedule/useScheduleFormState.js +3 -3
  245. package/dist/modules/customers/components/detail/schedule/useScheduleFormState.js.map +2 -2
  246. package/dist/modules/customers/components/detail/utils.js +5 -5
  247. package/dist/modules/customers/components/detail/utils.js.map +2 -2
  248. package/dist/modules/customers/data/entities.js.map +1 -1
  249. package/dist/modules/customers/data/validators.js +3 -32
  250. package/dist/modules/customers/data/validators.js.map +2 -2
  251. package/dist/modules/customers/events.js +0 -5
  252. package/dist/modules/customers/events.js.map +2 -2
  253. package/dist/modules/customers/lib/calendar/conflicts.js +2 -8
  254. package/dist/modules/customers/lib/calendar/conflicts.js.map +2 -2
  255. package/dist/modules/customers/lib/calendar/editorPayload.js +2 -3
  256. package/dist/modules/customers/lib/calendar/editorPayload.js.map +2 -2
  257. package/dist/modules/customers/lib/calendar/mapItem.js +3 -8
  258. package/dist/modules/customers/lib/calendar/mapItem.js.map +2 -2
  259. package/dist/modules/customers/lib/dealStatus.js +0 -30
  260. package/dist/modules/customers/lib/dealStatus.js.map +2 -2
  261. package/dist/modules/customers/lib/findPeopleByAddresses.js +0 -1
  262. package/dist/modules/customers/lib/findPeopleByAddresses.js.map +2 -2
  263. package/dist/modules/customers/lib/personCompanies.js +2 -100
  264. package/dist/modules/customers/lib/personCompanies.js.map +2 -2
  265. package/dist/modules/customers/lib/todoCompatibility.js +0 -12
  266. package/dist/modules/customers/lib/todoCompatibility.js.map +2 -2
  267. package/dist/modules/dashboards/lib/widgetScope.js +1 -6
  268. package/dist/modules/dashboards/lib/widgetScope.js.map +2 -2
  269. package/dist/modules/data_sync/backend/data-sync/page.js +1 -3
  270. package/dist/modules/data_sync/backend/data-sync/page.js.map +2 -2
  271. package/dist/modules/data_sync/lib/sync-engine.js +6 -72
  272. package/dist/modules/data_sync/lib/sync-engine.js.map +2 -2
  273. package/dist/modules/data_sync/workers/sync-export.js +1 -5
  274. package/dist/modules/data_sync/workers/sync-export.js.map +2 -2
  275. package/dist/modules/data_sync/workers/sync-import.js +1 -5
  276. package/dist/modules/data_sync/workers/sync-import.js.map +2 -2
  277. package/dist/modules/devices/acl.js +1 -9
  278. package/dist/modules/devices/acl.js.map +2 -2
  279. package/dist/modules/devices/api/admin/devices/[id]/route.js +32 -5
  280. package/dist/modules/devices/api/admin/devices/[id]/route.js.map +2 -2
  281. package/dist/modules/devices/api/admin/devices/route.js +1 -14
  282. package/dist/modules/devices/api/admin/devices/route.js.map +2 -2
  283. package/dist/modules/devices/api/deviceList.js +12 -99
  284. package/dist/modules/devices/api/deviceList.js.map +2 -2
  285. package/dist/modules/devices/api/openapi.js +1 -3
  286. package/dist/modules/devices/api/openapi.js.map +2 -2
  287. package/dist/modules/devices/api/route.js +1 -9
  288. package/dist/modules/devices/api/route.js.map +2 -2
  289. package/dist/modules/devices/backend/devices/[id]/page.js +26 -10
  290. package/dist/modules/devices/backend/devices/[id]/page.js.map +2 -2
  291. package/dist/modules/devices/backend/devices/create/page.js +1 -17
  292. package/dist/modules/devices/backend/devices/create/page.js.map +2 -2
  293. package/dist/modules/devices/backend/devices/page.js +34 -28
  294. package/dist/modules/devices/backend/devices/page.js.map +2 -2
  295. package/dist/modules/devices/setup.js +2 -6
  296. package/dist/modules/devices/setup.js.map +2 -2
  297. package/dist/modules/directory/backend/directory/organizations/page.js +1 -2
  298. package/dist/modules/directory/backend/directory/organizations/page.js.map +2 -2
  299. package/dist/modules/directory/backend/directory/tenants/page.js +1 -2
  300. package/dist/modules/directory/backend/directory/tenants/page.js.map +2 -2
  301. package/dist/modules/directory/di.js +0 -9
  302. package/dist/modules/directory/di.js.map +2 -2
  303. package/dist/modules/directory/utils/organizationScope.js.map +2 -2
  304. package/dist/modules/entities/api/records.js +2 -4
  305. package/dist/modules/entities/api/records.js.map +2 -2
  306. package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js +1 -3
  307. package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js.map +2 -2
  308. package/dist/modules/eudr/api/plots/route.js +1 -5
  309. package/dist/modules/eudr/api/plots/route.js.map +2 -2
  310. package/dist/modules/eudr/backend/eudr/evidence-submissions/[id]/page.meta.js +3 -1
  311. package/dist/modules/eudr/backend/eudr/evidence-submissions/[id]/page.meta.js.map +2 -2
  312. package/dist/modules/eudr/backend/eudr/evidence-submissions/create/page.meta.js +1 -0
  313. package/dist/modules/eudr/backend/eudr/evidence-submissions/create/page.meta.js.map +2 -2
  314. package/dist/modules/eudr/backend/eudr/evidence-submissions/page.js +0 -3
  315. package/dist/modules/eudr/backend/eudr/evidence-submissions/page.js.map +2 -2
  316. package/dist/modules/eudr/backend/eudr/evidence-submissions/page.meta.js +4 -1
  317. package/dist/modules/eudr/backend/eudr/evidence-submissions/page.meta.js.map +2 -2
  318. package/dist/modules/eudr/backend/eudr/page.meta.js +2 -2
  319. package/dist/modules/eudr/backend/eudr/page.meta.js.map +2 -2
  320. package/dist/modules/eudr/backend/eudr/plots/[id]/page.js +8 -2
  321. package/dist/modules/eudr/backend/eudr/plots/[id]/page.js.map +2 -2
  322. package/dist/modules/eudr/backend/eudr/plots/[id]/page.meta.js +3 -1
  323. package/dist/modules/eudr/backend/eudr/plots/[id]/page.meta.js.map +2 -2
  324. package/dist/modules/eudr/backend/eudr/plots/create/page.js +8 -2
  325. package/dist/modules/eudr/backend/eudr/plots/create/page.js.map +2 -2
  326. package/dist/modules/eudr/backend/eudr/plots/create/page.meta.js +1 -0
  327. package/dist/modules/eudr/backend/eudr/plots/create/page.meta.js.map +2 -2
  328. package/dist/modules/eudr/backend/eudr/plots/page.js +0 -3
  329. package/dist/modules/eudr/backend/eudr/plots/page.js.map +2 -2
  330. package/dist/modules/eudr/backend/eudr/plots/page.meta.js +4 -1
  331. package/dist/modules/eudr/backend/eudr/plots/page.meta.js.map +2 -2
  332. package/dist/modules/eudr/backend/eudr/product-mappings/[id]/page.meta.js +3 -1
  333. package/dist/modules/eudr/backend/eudr/product-mappings/[id]/page.meta.js.map +2 -2
  334. package/dist/modules/eudr/backend/eudr/product-mappings/create/page.meta.js +1 -0
  335. package/dist/modules/eudr/backend/eudr/product-mappings/create/page.meta.js.map +2 -2
  336. package/dist/modules/eudr/backend/eudr/product-mappings/page.js +0 -3
  337. package/dist/modules/eudr/backend/eudr/product-mappings/page.js.map +2 -2
  338. package/dist/modules/eudr/backend/eudr/product-mappings/page.meta.js +4 -1
  339. package/dist/modules/eudr/backend/eudr/product-mappings/page.meta.js.map +2 -2
  340. package/dist/modules/eudr/backend/eudr/risk-assessments/[id]/page.meta.js +3 -1
  341. package/dist/modules/eudr/backend/eudr/risk-assessments/[id]/page.meta.js.map +2 -2
  342. package/dist/modules/eudr/backend/eudr/risk-assessments/create/page.meta.js +1 -0
  343. package/dist/modules/eudr/backend/eudr/risk-assessments/create/page.meta.js.map +2 -2
  344. package/dist/modules/eudr/backend/eudr/risk-assessments/page.js +0 -3
  345. package/dist/modules/eudr/backend/eudr/risk-assessments/page.js.map +2 -2
  346. package/dist/modules/eudr/backend/eudr/risk-assessments/page.meta.js +4 -1
  347. package/dist/modules/eudr/backend/eudr/risk-assessments/page.meta.js.map +2 -2
  348. package/dist/modules/eudr/backend/eudr/statements/[id]/page.js +2 -0
  349. package/dist/modules/eudr/backend/eudr/statements/[id]/page.js.map +2 -2
  350. package/dist/modules/eudr/backend/eudr/statements/[id]/page.meta.js +3 -1
  351. package/dist/modules/eudr/backend/eudr/statements/[id]/page.meta.js.map +2 -2
  352. package/dist/modules/eudr/backend/eudr/statements/create/page.meta.js +1 -0
  353. package/dist/modules/eudr/backend/eudr/statements/create/page.meta.js.map +2 -2
  354. package/dist/modules/eudr/backend/eudr/statements/page.js +30 -28
  355. package/dist/modules/eudr/backend/eudr/statements/page.js.map +2 -2
  356. package/dist/modules/eudr/backend/eudr/statements/page.meta.js +4 -1
  357. package/dist/modules/eudr/backend/eudr/statements/page.meta.js.map +2 -2
  358. package/dist/modules/eudr/commands/statements.js +8 -3
  359. package/dist/modules/eudr/commands/statements.js.map +2 -2
  360. package/dist/modules/eudr/components/crudErrorI18n.js +21 -1
  361. package/dist/modules/eudr/components/crudErrorI18n.js.map +2 -2
  362. package/dist/modules/eudr/components/formConfig.js +6 -2
  363. package/dist/modules/eudr/components/formConfig.js.map +2 -2
  364. package/dist/modules/eudr/data/validators.js +1 -4
  365. package/dist/modules/eudr/data/validators.js.map +2 -2
  366. package/dist/modules/eudr/lib/statement-lifecycle.js +9 -1
  367. package/dist/modules/eudr/lib/statement-lifecycle.js.map +2 -2
  368. package/dist/modules/feature_toggles/components/FeatureTogglesTable.js +0 -1
  369. package/dist/modules/feature_toggles/components/FeatureTogglesTable.js.map +2 -2
  370. package/dist/modules/feature_toggles/components/OverridesTable.js +0 -1
  371. package/dist/modules/feature_toggles/components/OverridesTable.js.map +2 -2
  372. package/dist/modules/feature_toggles/defaults.json +8 -0
  373. package/dist/modules/inbox_ops/backend/inbox-ops/log/page.js +0 -3
  374. package/dist/modules/inbox_ops/backend/inbox-ops/log/page.js.map +2 -2
  375. package/dist/modules/inbox_ops/backend/inbox-ops/page.js +0 -3
  376. package/dist/modules/inbox_ops/backend/inbox-ops/page.js.map +2 -2
  377. package/dist/modules/inbox_ops/lib/htmlToPlainText.js +12 -1
  378. package/dist/modules/inbox_ops/lib/htmlToPlainText.js.map +2 -2
  379. package/dist/modules/integrations/api/[id]/credentials/route.js +1 -6
  380. package/dist/modules/integrations/api/[id]/credentials/route.js.map +2 -2
  381. package/dist/modules/integrations/backend/integrations/[id]/page.js +29 -38
  382. package/dist/modules/integrations/backend/integrations/[id]/page.js.map +2 -2
  383. package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js +9 -36
  384. package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js.map +2 -2
  385. package/dist/modules/integrations/data/validators.js +3 -11
  386. package/dist/modules/integrations/data/validators.js.map +2 -2
  387. package/dist/modules/integrations/lib/credentials-masking.js +2 -6
  388. package/dist/modules/integrations/lib/credentials-masking.js.map +2 -2
  389. package/dist/modules/messages/api/[id]/route.js +1 -29
  390. package/dist/modules/messages/api/[id]/route.js.map +2 -2
  391. package/dist/modules/messages/api/openapi.js +2 -17
  392. package/dist/modules/messages/api/openapi.js.map +2 -2
  393. package/dist/modules/messages/api/route.js +2 -17
  394. package/dist/modules/messages/api/route.js.map +2 -2
  395. package/dist/modules/messages/components/MessagesInboxPageClient.js +14 -7
  396. package/dist/modules/messages/components/MessagesInboxPageClient.js.map +2 -2
  397. package/dist/modules/messages/components/inboxFilters.js +0 -15
  398. package/dist/modules/messages/components/inboxFilters.js.map +2 -2
  399. package/dist/modules/messages/components/message-detail/hooks/useMessageDetailsConversation.js +1 -11
  400. package/dist/modules/messages/components/message-detail/hooks/useMessageDetailsConversation.js.map +2 -2
  401. package/dist/modules/messages/components/message-detail/panels/MessageHeader.js +1 -3
  402. package/dist/modules/messages/components/message-detail/panels/MessageHeader.js.map +2 -2
  403. package/dist/modules/messages/components/message-detail/panels/thread-panel.js +1 -2
  404. package/dist/modules/messages/components/message-detail/panels/thread-panel.js.map +2 -2
  405. package/dist/modules/messages/components/messageListLabels.js +2 -14
  406. package/dist/modules/messages/components/messageListLabels.js.map +2 -2
  407. package/dist/modules/messages/data/validators.js +4 -18
  408. package/dist/modules/messages/data/validators.js.map +2 -2
  409. package/dist/modules/payment_gateways/api/webhook/[provider]/route.js +6 -4
  410. package/dist/modules/payment_gateways/api/webhook/[provider]/route.js.map +2 -2
  411. package/dist/modules/payment_gateways/backend/payment-gateways/page.js +1 -3
  412. package/dist/modules/payment_gateways/backend/payment-gateways/page.js.map +2 -2
  413. package/dist/modules/payment_gateways/lib/webhook-processor.js +0 -7
  414. package/dist/modules/payment_gateways/lib/webhook-processor.js.map +2 -2
  415. package/dist/modules/planner/backend/planner/availability-rulesets/page.js +0 -3
  416. package/dist/modules/planner/backend/planner/availability-rulesets/page.js.map +2 -2
  417. package/dist/modules/push_notifications/backend/push_notifications/page.js +1 -3
  418. package/dist/modules/push_notifications/backend/push_notifications/page.js.map +2 -2
  419. package/dist/modules/push_notifications/backend/push_notifications/send/page.js +1 -1
  420. package/dist/modules/push_notifications/backend/push_notifications/send/page.js.map +2 -2
  421. package/dist/modules/query_index/lib/engine.js +51 -150
  422. package/dist/modules/query_index/lib/engine.js.map +2 -2
  423. package/dist/modules/query_index/lib/search-tokens.js +3 -79
  424. package/dist/modules/query_index/lib/search-tokens.js.map +2 -2
  425. package/dist/modules/resources/backend/resources/resource-types/page.js +1 -3
  426. package/dist/modules/resources/backend/resources/resource-types/page.js.map +2 -2
  427. package/dist/modules/resources/backend/resources/resources/page.js +1 -3
  428. package/dist/modules/resources/backend/resources/resources/page.js.map +2 -2
  429. package/dist/modules/sales/backend/sales/channels/offers/page.js +0 -3
  430. package/dist/modules/sales/backend/sales/channels/offers/page.js.map +2 -2
  431. package/dist/modules/sales/backend/sales/channels/page.js +0 -3
  432. package/dist/modules/sales/backend/sales/channels/page.js.map +2 -2
  433. package/dist/modules/sales/backend/sales/documents/[id]/page.js +8 -10
  434. package/dist/modules/sales/backend/sales/documents/[id]/page.js.map +2 -2
  435. package/dist/modules/sales/commands/documents.js +1 -79
  436. package/dist/modules/sales/commands/documents.js.map +2 -2
  437. package/dist/modules/sales/components/PriceWithCurrency.js +5 -7
  438. package/dist/modules/sales/components/PriceWithCurrency.js.map +2 -2
  439. package/dist/modules/sales/components/channels/SalesChannelOffersPanel.js +0 -3
  440. package/dist/modules/sales/components/channels/SalesChannelOffersPanel.js.map +2 -2
  441. package/dist/modules/sales/components/documents/AdjustmentsSection.js +6 -8
  442. package/dist/modules/sales/components/documents/AdjustmentsSection.js.map +2 -2
  443. package/dist/modules/sales/components/documents/ItemsSection.js +22 -51
  444. package/dist/modules/sales/components/documents/ItemsSection.js.map +2 -2
  445. package/dist/modules/sales/components/documents/LineItemDialog.js +19 -84
  446. package/dist/modules/sales/components/documents/LineItemDialog.js.map +2 -2
  447. package/dist/modules/sales/components/documents/PaymentsSection.js +9 -23
  448. package/dist/modules/sales/components/documents/PaymentsSection.js.map +2 -2
  449. package/dist/modules/sales/components/documents/ReturnsSection.js +6 -8
  450. package/dist/modules/sales/components/documents/ReturnsSection.js.map +2 -2
  451. package/dist/modules/sales/components/documents/SalesDocumentsTable.js +14 -68
  452. package/dist/modules/sales/components/documents/SalesDocumentsTable.js.map +2 -2
  453. package/dist/modules/sales/components/documents/SalesOrderDraftLines.js +5 -6
  454. package/dist/modules/sales/components/documents/SalesOrderDraftLines.js.map +2 -2
  455. package/dist/modules/sales/components/documents/ShipmentDialog.js +4 -5
  456. package/dist/modules/sales/components/documents/ShipmentDialog.js.map +2 -2
  457. package/dist/modules/sales/components/documents/ShipmentsSection.js +6 -8
  458. package/dist/modules/sales/components/documents/ShipmentsSection.js.map +2 -2
  459. package/dist/modules/sales/components/documents/lineItemUtils.js +2 -2
  460. package/dist/modules/sales/components/documents/lineItemUtils.js.map +2 -2
  461. package/dist/modules/sales/data/entities.js +2 -8
  462. package/dist/modules/sales/data/entities.js.map +2 -2
  463. package/dist/modules/sales/extension-points.js +0 -1
  464. package/dist/modules/sales/extension-points.js.map +2 -2
  465. package/dist/modules/sales/setup.js +0 -2
  466. package/dist/modules/sales/setup.js.map +2 -2
  467. package/dist/modules/sales/widgets/injection/document-history/widget.client.js +44 -2
  468. package/dist/modules/sales/widgets/injection/document-history/widget.client.js.map +2 -2
  469. package/dist/modules/sales/widgets/injection/payment-gateway-status-column/widget.js +2 -10
  470. package/dist/modules/sales/widgets/injection/payment-gateway-status-column/widget.js.map +2 -2
  471. package/dist/modules/sales/widgets/injection-table.js +7 -4
  472. package/dist/modules/sales/widgets/injection-table.js.map +2 -2
  473. package/dist/modules/staff/backend/staff/leave-requests/page.js +0 -3
  474. package/dist/modules/staff/backend/staff/leave-requests/page.js.map +2 -2
  475. package/dist/modules/staff/backend/staff/my-leave-requests/page.js +0 -3
  476. package/dist/modules/staff/backend/staff/my-leave-requests/page.js.map +2 -2
  477. package/dist/modules/staff/backend/staff/team-members/page.js +0 -3
  478. package/dist/modules/staff/backend/staff/team-members/page.js.map +2 -2
  479. package/dist/modules/staff/backend/staff/team-roles/page.js +0 -3
  480. package/dist/modules/staff/backend/staff/team-roles/page.js.map +2 -2
  481. package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js +0 -3
  482. package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js.map +2 -2
  483. package/dist/modules/staff/backend/staff/teams/page.js +0 -3
  484. package/dist/modules/staff/backend/staff/teams/page.js.map +2 -2
  485. package/dist/modules/staff/backend/staff/timesheets/page.js +18 -29
  486. package/dist/modules/staff/backend/staff/timesheets/page.js.map +2 -2
  487. package/dist/modules/staff/backend/staff/timesheets/projects/page.js +0 -3
  488. package/dist/modules/staff/backend/staff/timesheets/projects/page.js.map +2 -2
  489. package/dist/modules/sync_excel/lib/adapters/customers.js +0 -1
  490. package/dist/modules/sync_excel/lib/adapters/customers.js.map +2 -2
  491. package/dist/modules/warranty_claims/api/assignees/route.js +3 -3
  492. package/dist/modules/warranty_claims/api/assignees/route.js.map +2 -2
  493. package/dist/modules/warranty_claims/api/portal/attachments/route.js +2 -2
  494. package/dist/modules/warranty_claims/api/portal/attachments/route.js.map +2 -2
  495. package/dist/modules/warranty_claims/api/portal/claims/route.js +9 -12
  496. package/dist/modules/warranty_claims/api/portal/claims/route.js.map +2 -2
  497. package/dist/modules/warranty_claims/backend/page.js +0 -3
  498. package/dist/modules/warranty_claims/backend/page.js.map +2 -2
  499. package/dist/modules/warranty_claims/backend/warranty_claims/registrations/page.js +0 -3
  500. package/dist/modules/warranty_claims/backend/warranty_claims/registrations/page.js.map +2 -2
  501. package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/page.js +0 -3
  502. package/dist/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/page.js.map +2 -2
  503. package/dist/modules/warranty_claims/backend/warranty_claims/vendor-policies/page.js +0 -3
  504. package/dist/modules/warranty_claims/backend/warranty_claims/vendor-policies/page.js.map +2 -2
  505. package/dist/modules/warranty_claims/frontend/[orgSlug]/portal/claims/page.js +0 -3
  506. package/dist/modules/warranty_claims/frontend/[orgSlug]/portal/claims/page.js.map +2 -2
  507. package/dist/modules/wms/api/warehouses/route.js +9 -13
  508. package/dist/modules/wms/api/warehouses/route.js.map +2 -2
  509. package/dist/modules/wms/api/zones/route.js +2 -15
  510. package/dist/modules/wms/api/zones/route.js.map +2 -2
  511. package/dist/modules/wms/commands/configuration.js +9 -121
  512. package/dist/modules/wms/commands/configuration.js.map +2 -2
  513. package/dist/modules/wms/commands/inventory-actions.js +0 -3
  514. package/dist/modules/wms/commands/inventory-actions.js.map +2 -2
  515. package/dist/modules/wms/commands/shared.js +1 -9
  516. package/dist/modules/wms/commands/shared.js.map +2 -2
  517. package/dist/modules/wms/components/backend/WmsConfigurationPage.js +111 -76
  518. package/dist/modules/wms/components/backend/WmsConfigurationPage.js.map +3 -3
  519. package/dist/modules/wms/components/backend/WmsInventoryConsolePage.js +0 -1
  520. package/dist/modules/wms/components/backend/WmsInventoryConsolePage.js.map +2 -2
  521. package/dist/modules/wms/components/backend/WmsLocationDetailPage.js +20 -16
  522. package/dist/modules/wms/components/backend/WmsLocationDetailPage.js.map +2 -2
  523. package/dist/modules/wms/components/backend/WmsLotDetailPage.js +10 -6
  524. package/dist/modules/wms/components/backend/WmsLotDetailPage.js.map +2 -2
  525. package/dist/modules/wms/components/backend/WmsLotsListPage.js +0 -1
  526. package/dist/modules/wms/components/backend/WmsLotsListPage.js.map +2 -2
  527. package/dist/modules/wms/components/backend/WmsOperationalDashboardPage.js +11 -7
  528. package/dist/modules/wms/components/backend/WmsOperationalDashboardPage.js.map +2 -2
  529. package/dist/modules/wms/components/backend/WmsSkuDetailPage.js +10 -6
  530. package/dist/modules/wms/components/backend/WmsSkuDetailPage.js.map +2 -2
  531. package/dist/modules/wms/components/backend/inventoryMutationLoaders.js +20 -27
  532. package/dist/modules/wms/components/backend/inventoryMutationLoaders.js.map +2 -2
  533. package/dist/modules/workflows/backend/definitions/page.js +1 -3
  534. package/dist/modules/workflows/backend/definitions/page.js.map +2 -2
  535. package/dist/modules/workflows/backend/events/page.js +1 -3
  536. package/dist/modules/workflows/backend/events/page.js.map +2 -2
  537. package/dist/modules/workflows/backend/instances/page.js +1 -3
  538. package/dist/modules/workflows/backend/instances/page.js.map +2 -2
  539. package/dist/modules/workflows/backend/tasks/page.js +1 -3
  540. package/dist/modules/workflows/backend/tasks/page.js.map +2 -2
  541. package/dist/modules/workflows/lib/activity-executor.js +0 -4
  542. package/dist/modules/workflows/lib/activity-executor.js.map +2 -2
  543. package/package.json +10 -9
  544. package/src/helpers/integration/api.ts +1 -33
  545. package/src/helpers/integration/communicationChannelsFixtures.ts +1 -69
  546. package/src/modules/api_keys/api/keys/route.ts +1 -3
  547. package/src/modules/api_keys/backend/api-keys/page.tsx +1 -4
  548. package/src/modules/attachments/AGENTS.md +0 -15
  549. package/src/modules/attachments/api/route.ts +2 -2
  550. package/src/modules/attachments/components/AttachmentLibrary.tsx +0 -3
  551. package/src/modules/attachments/di.ts +0 -16
  552. package/src/modules/attachments/i18n/de.json +0 -5
  553. package/src/modules/attachments/i18n/en.json +0 -5
  554. package/src/modules/attachments/i18n/es.json +0 -5
  555. package/src/modules/attachments/i18n/ko.json +0 -5
  556. package/src/modules/attachments/i18n/pl.json +0 -5
  557. package/src/modules/attachments/index.ts +0 -10
  558. package/src/modules/attachments/lib/scoped-upload-service.ts +0 -46
  559. package/src/modules/attachments/lib/upload-limits.ts +2 -6
  560. package/src/modules/audit_logs/backend/audit-logs/page.tsx +0 -8
  561. package/src/modules/audit_logs/lib/display-helpers.tsx +32 -42
  562. package/src/modules/audit_logs/services/actionLogService.ts +11 -74
  563. package/src/modules/auth/acl.ts +6 -30
  564. package/src/modules/auth/api/feature-check.ts +3 -10
  565. package/src/modules/auth/api/login.ts +24 -9
  566. package/src/modules/auth/api/roles/acl/route.ts +39 -42
  567. package/src/modules/auth/api/routeError.ts +30 -0
  568. package/src/modules/auth/api/session/refresh.ts +1 -32
  569. package/src/modules/auth/api/users/acl/route.ts +101 -185
  570. package/src/modules/auth/api/users/route.ts +5 -18
  571. package/src/modules/auth/backend/roles/[id]/edit/page.meta.ts +2 -5
  572. package/src/modules/auth/backend/roles/page.tsx +2 -4
  573. package/src/modules/auth/backend/users/[id]/edit/page.meta.ts +2 -5
  574. package/src/modules/auth/backend/users/page.tsx +2 -3
  575. package/src/modules/auth/components/AclEditor.tsx +33 -63
  576. package/src/modules/auth/data/entities.ts +1 -4
  577. package/src/modules/auth/data/validators.ts +0 -5
  578. package/src/modules/auth/di.ts +16 -46
  579. package/src/modules/auth/frontend/reset/[token]/page.tsx +0 -74
  580. package/src/modules/auth/i18n/de.json +0 -389
  581. package/src/modules/auth/i18n/en.json +0 -389
  582. package/src/modules/auth/i18n/es.json +0 -389
  583. package/src/modules/auth/i18n/ko.json +0 -389
  584. package/src/modules/auth/i18n/pl.json +2 -391
  585. package/src/modules/auth/lib/grantChecks.ts +0 -6
  586. package/src/modules/auth/services/authService.ts +2 -18
  587. package/src/modules/auth/services/rbacService.ts +24 -110
  588. package/src/modules/business_rules/backend/logs/page.tsx +1 -4
  589. package/src/modules/business_rules/backend/rules/[id]/page.meta.ts +5 -0
  590. package/src/modules/business_rules/backend/rules/create/page.meta.ts +5 -1
  591. package/src/modules/business_rules/backend/rules/page.tsx +1 -4
  592. package/src/modules/business_rules/backend/sets/[id]/page.meta.ts +5 -0
  593. package/src/modules/business_rules/backend/sets/create/page.meta.ts +5 -1
  594. package/src/modules/business_rules/backend/sets/page.tsx +1 -4
  595. package/src/modules/business_rules/lib/expression-evaluator.ts +9 -9
  596. package/src/modules/business_rules/lib/rule-evaluator.ts +9 -10
  597. package/src/modules/catalog/ai-agents.ts +1 -1
  598. package/src/modules/catalog/ai-tools/merchandising-pack.ts +2 -2
  599. package/src/modules/catalog/backend/catalog/products/MerchandisingAssistantSheet.tsx +5 -12
  600. package/src/modules/catalog/components/categories/CategoriesDataTable.tsx +0 -3
  601. package/src/modules/catalog/components/products/ProductsDataTable.tsx +0 -7
  602. package/src/modules/catalog/i18n/de.json +0 -1
  603. package/src/modules/catalog/i18n/en.json +0 -1
  604. package/src/modules/catalog/i18n/es.json +0 -1
  605. package/src/modules/catalog/i18n/ko.json +0 -1
  606. package/src/modules/catalog/i18n/pl.json +0 -1
  607. package/src/modules/catalog/widgets/injection/merchandising-assistant-trigger/widget.client.tsx +0 -4
  608. package/src/modules/communication_channels/api/post/channels/[id]/test-send/route.ts +1 -17
  609. package/src/modules/communication_channels/api/post/test-seed/route.ts +16 -155
  610. package/src/modules/communication_channels/backend/communication_channels/channels/page.tsx +0 -4
  611. package/src/modules/communication_channels/commands/ingest-inbound-message.ts +1 -38
  612. package/src/modules/communication_channels/di.ts +0 -7
  613. package/src/modules/communication_channels/lib/adapter.ts +0 -14
  614. package/src/modules/communication_channels/lib/email-capabilities.ts +0 -4
  615. package/src/modules/communication_channels/lib/test-seed.ts +4 -64
  616. package/src/modules/configs/i18n/de.json +0 -2
  617. package/src/modules/configs/i18n/en.json +0 -2
  618. package/src/modules/configs/i18n/es.json +0 -2
  619. package/src/modules/configs/i18n/ko.json +0 -2
  620. package/src/modules/configs/i18n/pl.json +0 -2
  621. package/src/modules/configs/lib/system-status.ts +0 -9
  622. package/src/modules/currencies/backend/currencies/page.tsx +1 -4
  623. package/src/modules/currencies/backend/exchange-rates/page.tsx +1 -4
  624. package/src/modules/customer_accounts/api/admin/domain-mappings.ts +0 -7
  625. package/src/modules/customer_accounts/backend/customer_accounts/roles/page.tsx +1 -4
  626. package/src/modules/customer_accounts/backend/customer_accounts/settings/CustomerAccountsSettingsPageClient.tsx +138 -0
  627. package/src/modules/customer_accounts/backend/customer_accounts/settings/page.tsx +8 -132
  628. package/src/modules/customer_accounts/backend/customer_accounts/users/PortalUsersPageClient.tsx +598 -0
  629. package/src/modules/customer_accounts/backend/customer_accounts/users/[id]/PortalUserDetailPageClient.tsx +838 -0
  630. package/src/modules/customer_accounts/backend/customer_accounts/users/[id]/page.tsx +6 -838
  631. package/src/modules/customer_accounts/backend/customer_accounts/users/page.tsx +6 -590
  632. package/src/modules/customer_accounts/extension-points.ts +1 -1
  633. package/src/modules/customer_accounts/lib/portalUrl.ts +112 -0
  634. package/src/modules/customer_accounts/services/domainMappingService.ts +0 -10
  635. package/src/modules/customers/ai-tools/companies-pack.ts +1 -4
  636. package/src/modules/customers/ai-tools/deal-analyzer-pack.ts +2 -17
  637. package/src/modules/customers/ai-tools/deals-pack.ts +1 -66
  638. package/src/modules/customers/ai-tools/people-pack.ts +1 -4
  639. package/src/modules/customers/api/activities/route.ts +0 -45
  640. package/src/modules/customers/api/companies/[id]/people/route.ts +73 -24
  641. package/src/modules/customers/api/companies/[id]/route.ts +107 -24
  642. package/src/modules/customers/api/dashboard/widgets/customer-todos/route.ts +8 -16
  643. package/src/modules/customers/api/deals/[id]/companies/route.ts +1 -4
  644. package/src/modules/customers/api/deals/[id]/people/route.ts +1 -4
  645. package/src/modules/customers/api/deals/[id]/route.ts +28 -17
  646. package/src/modules/customers/api/deals/[id]/stats/route.ts +25 -10
  647. package/src/modules/customers/api/deals/aggregate/route.ts +4 -14
  648. package/src/modules/customers/api/deals/map/route.ts +0 -1
  649. package/src/modules/customers/api/deals/route.ts +1 -50
  650. package/src/modules/customers/api/entity-roles-factory.ts +4 -8
  651. package/src/modules/customers/api/interactions/route.ts +2 -8
  652. package/src/modules/customers/api/interactions/tasks/route.ts +1 -24
  653. package/src/modules/customers/api/people/[id]/companies/[linkId]/route.ts +4 -12
  654. package/src/modules/customers/api/people/[id]/companies/context.ts +1 -4
  655. package/src/modules/customers/api/people/[id]/companies/enriched/route.ts +1 -4
  656. package/src/modules/customers/api/people/[id]/route.ts +11 -16
  657. package/src/modules/customers/api/people/check-phone/route.ts +10 -75
  658. package/src/modules/customers/api/todos/route.ts +2 -27
  659. package/src/modules/customers/backend/customers/companies/page.tsx +4 -7
  660. package/src/modules/customers/backend/customers/deals/[id]/page.tsx +2 -7
  661. package/src/modules/customers/backend/customers/deals/page.tsx +4 -10
  662. package/src/modules/customers/backend/customers/deals/pipeline/components/Lane.tsx +14 -5
  663. package/src/modules/customers/backend/customers/deals/pipeline/components/StatusFilterPopover.tsx +27 -109
  664. package/src/modules/customers/backend/customers/people/page.tsx +4 -7
  665. package/src/modules/customers/backend/hooks/useEmailDuplicateCheck.ts +4 -12
  666. package/src/modules/customers/commands/deals.ts +59 -34
  667. package/src/modules/customers/commands/interactions.ts +1 -1
  668. package/src/modules/customers/commands/personCompanyLinks.ts +8 -224
  669. package/src/modules/customers/components/CustomerTodosTable.tsx +0 -2
  670. package/src/modules/customers/components/DealsKpiStrip.tsx +7 -7
  671. package/src/modules/customers/components/calendar/AgendaList.tsx +3 -3
  672. package/src/modules/customers/components/calendar/CalendarEventEditor.tsx +1 -1
  673. package/src/modules/customers/components/calendar/CalendarScreen.tsx +1 -1
  674. package/src/modules/customers/components/calendar/CalendarSettingsModal.tsx +1 -1
  675. package/src/modules/customers/components/calendar/EventBlock.tsx +2 -2
  676. package/src/modules/customers/components/calendar/EventPeekPopover.tsx +2 -4
  677. package/src/modules/customers/components/calendar/editor/PeopleField.tsx +5 -61
  678. package/src/modules/customers/components/calendar/editor/hooks.ts +1 -7
  679. package/src/modules/customers/components/calendar/types.ts +2 -2
  680. package/src/modules/customers/components/detail/AssignRoleDialog.tsx +12 -7
  681. package/src/modules/customers/components/detail/CompanyKpiBar.tsx +4 -5
  682. package/src/modules/customers/components/detail/CompanyPeopleSection.tsx +1 -8
  683. package/src/modules/customers/components/detail/DealForm.tsx +2 -22
  684. package/src/modules/customers/components/detail/DealsSection.tsx +5 -11
  685. package/src/modules/customers/components/detail/EntityTagsDialog.tsx +12 -58
  686. package/src/modules/customers/components/detail/PersonCompaniesSection.tsx +1 -8
  687. package/src/modules/customers/components/detail/hooks/usePersonTasks.ts +14 -23
  688. package/src/modules/customers/components/detail/schedule/ParticipantsField.tsx +5 -5
  689. package/src/modules/customers/components/detail/schedule/useScheduleFormState.ts +5 -5
  690. package/src/modules/customers/components/detail/types.ts +1 -1
  691. package/src/modules/customers/components/detail/utils.ts +5 -15
  692. package/src/modules/customers/data/entities.ts +1 -1
  693. package/src/modules/customers/data/validators.ts +9 -50
  694. package/src/modules/customers/events.ts +0 -5
  695. package/src/modules/customers/i18n/de.json +1 -9
  696. package/src/modules/customers/i18n/en.json +1 -9
  697. package/src/modules/customers/i18n/es.json +1 -9
  698. package/src/modules/customers/i18n/ko.json +1 -9
  699. package/src/modules/customers/i18n/pl.json +1 -9
  700. package/src/modules/customers/lib/calendar/conflicts.ts +2 -10
  701. package/src/modules/customers/lib/calendar/editorPayload.ts +3 -4
  702. package/src/modules/customers/lib/calendar/mapItem.ts +3 -8
  703. package/src/modules/customers/lib/dealStatus.ts +0 -42
  704. package/src/modules/customers/lib/findPeopleByAddresses.ts +6 -8
  705. package/src/modules/customers/lib/personCompanies.ts +1 -136
  706. package/src/modules/customers/lib/todoCompatibility.ts +1 -19
  707. package/src/modules/dashboards/i18n/es.json +4 -4
  708. package/src/modules/dashboards/i18n/pl.json +7 -7
  709. package/src/modules/dashboards/lib/widgetScope.ts +0 -6
  710. package/src/modules/data_sync/AGENTS.md +1 -1
  711. package/src/modules/data_sync/backend/data-sync/page.tsx +1 -4
  712. package/src/modules/data_sync/lib/adapter.ts +0 -36
  713. package/src/modules/data_sync/lib/sync-engine.ts +5 -113
  714. package/src/modules/data_sync/workers/sync-export.ts +0 -4
  715. package/src/modules/data_sync/workers/sync-import.ts +0 -4
  716. package/src/modules/devices/AGENTS.md +1 -20
  717. package/src/modules/devices/acl.ts +1 -9
  718. package/src/modules/devices/api/admin/devices/[id]/route.ts +34 -5
  719. package/src/modules/devices/api/admin/devices/route.ts +1 -14
  720. package/src/modules/devices/api/deviceList.ts +11 -135
  721. package/src/modules/devices/api/openapi.ts +1 -9
  722. package/src/modules/devices/api/route.ts +1 -9
  723. package/src/modules/devices/backend/devices/[id]/page.tsx +32 -18
  724. package/src/modules/devices/backend/devices/create/page.tsx +1 -17
  725. package/src/modules/devices/backend/devices/page.tsx +45 -44
  726. package/src/modules/devices/i18n/de.json +2 -3
  727. package/src/modules/devices/i18n/en.json +2 -3
  728. package/src/modules/devices/i18n/es.json +2 -3
  729. package/src/modules/devices/i18n/ko.json +2 -3
  730. package/src/modules/devices/i18n/pl.json +2 -3
  731. package/src/modules/devices/setup.ts +2 -6
  732. package/src/modules/directory/backend/directory/organizations/page.tsx +1 -3
  733. package/src/modules/directory/backend/directory/tenants/page.tsx +1 -3
  734. package/src/modules/directory/di.ts +2 -14
  735. package/src/modules/directory/utils/organizationScope.ts +15 -4
  736. package/src/modules/entities/api/records.ts +0 -2
  737. package/src/modules/entities/backend/entities/user/[entityId]/records/page.tsx +1 -4
  738. package/src/modules/eudr/api/plots/route.ts +0 -4
  739. package/src/modules/eudr/backend/eudr/evidence-submissions/[id]/page.meta.ts +2 -0
  740. package/src/modules/eudr/backend/eudr/evidence-submissions/create/page.meta.ts +1 -0
  741. package/src/modules/eudr/backend/eudr/evidence-submissions/page.meta.ts +4 -1
  742. package/src/modules/eudr/backend/eudr/evidence-submissions/page.tsx +0 -4
  743. package/src/modules/eudr/backend/eudr/page.meta.ts +2 -2
  744. package/src/modules/eudr/backend/eudr/plots/[id]/page.meta.ts +2 -0
  745. package/src/modules/eudr/backend/eudr/plots/[id]/page.tsx +8 -2
  746. package/src/modules/eudr/backend/eudr/plots/create/page.meta.ts +1 -0
  747. package/src/modules/eudr/backend/eudr/plots/create/page.tsx +8 -2
  748. package/src/modules/eudr/backend/eudr/plots/page.meta.ts +4 -1
  749. package/src/modules/eudr/backend/eudr/plots/page.tsx +0 -4
  750. package/src/modules/eudr/backend/eudr/product-mappings/[id]/page.meta.ts +2 -0
  751. package/src/modules/eudr/backend/eudr/product-mappings/create/page.meta.ts +1 -0
  752. package/src/modules/eudr/backend/eudr/product-mappings/page.meta.ts +4 -1
  753. package/src/modules/eudr/backend/eudr/product-mappings/page.tsx +0 -4
  754. package/src/modules/eudr/backend/eudr/risk-assessments/[id]/page.meta.ts +2 -0
  755. package/src/modules/eudr/backend/eudr/risk-assessments/create/page.meta.ts +1 -0
  756. package/src/modules/eudr/backend/eudr/risk-assessments/page.meta.ts +4 -1
  757. package/src/modules/eudr/backend/eudr/risk-assessments/page.tsx +0 -4
  758. package/src/modules/eudr/backend/eudr/statements/[id]/page.meta.ts +2 -0
  759. package/src/modules/eudr/backend/eudr/statements/[id]/page.tsx +2 -0
  760. package/src/modules/eudr/backend/eudr/statements/create/page.meta.ts +1 -0
  761. package/src/modules/eudr/backend/eudr/statements/page.meta.ts +4 -1
  762. package/src/modules/eudr/backend/eudr/statements/page.tsx +32 -30
  763. package/src/modules/eudr/commands/statements.ts +7 -2
  764. package/src/modules/eudr/components/crudErrorI18n.ts +31 -0
  765. package/src/modules/eudr/components/formConfig.tsx +9 -1
  766. package/src/modules/eudr/data/validators.ts +1 -16
  767. package/src/modules/eudr/i18n/de.json +3 -2
  768. package/src/modules/eudr/i18n/en.json +3 -2
  769. package/src/modules/eudr/i18n/es.json +3 -2
  770. package/src/modules/eudr/i18n/ko.json +3 -2
  771. package/src/modules/eudr/i18n/pl.json +3 -2
  772. package/src/modules/eudr/lib/statement-lifecycle.ts +8 -0
  773. package/src/modules/feature_toggles/components/FeatureTogglesTable.tsx +1 -2
  774. package/src/modules/feature_toggles/components/OverridesTable.tsx +1 -2
  775. package/src/modules/feature_toggles/defaults.json +8 -0
  776. package/src/modules/inbox_ops/backend/inbox-ops/log/page.tsx +0 -4
  777. package/src/modules/inbox_ops/backend/inbox-ops/page.tsx +0 -4
  778. package/src/modules/inbox_ops/lib/htmlToPlainText.ts +17 -1
  779. package/src/modules/integrations/api/[id]/credentials/route.ts +4 -6
  780. package/src/modules/integrations/backend/integrations/[id]/page.tsx +31 -61
  781. package/src/modules/integrations/backend/integrations/bundle/[id]/page.tsx +9 -44
  782. package/src/modules/integrations/data/validators.ts +2 -12
  783. package/src/modules/integrations/i18n/de.json +0 -1
  784. package/src/modules/integrations/i18n/en.json +0 -1
  785. package/src/modules/integrations/i18n/es.json +0 -1
  786. package/src/modules/integrations/i18n/ko.json +0 -1
  787. package/src/modules/integrations/i18n/pl.json +0 -1
  788. package/src/modules/integrations/lib/credentials-masking.ts +6 -10
  789. package/src/modules/messages/api/[id]/route.ts +1 -55
  790. package/src/modules/messages/api/openapi.ts +0 -20
  791. package/src/modules/messages/api/route.ts +2 -31
  792. package/src/modules/messages/components/MessagesInboxPageClient.tsx +16 -9
  793. package/src/modules/messages/components/inboxFilters.ts +0 -36
  794. package/src/modules/messages/components/message-detail/hooks/useMessageDetailsConversation.ts +1 -14
  795. package/src/modules/messages/components/message-detail/panels/MessageHeader.tsx +1 -3
  796. package/src/modules/messages/components/message-detail/panels/thread-panel.tsx +1 -2
  797. package/src/modules/messages/components/message-detail/types.ts +0 -3
  798. package/src/modules/messages/components/messageListLabels.ts +3 -52
  799. package/src/modules/messages/data/validators.ts +4 -43
  800. package/src/modules/payment_gateways/api/webhook/[provider]/route.ts +6 -4
  801. package/src/modules/payment_gateways/backend/payment-gateways/page.tsx +1 -4
  802. package/src/modules/payment_gateways/lib/webhook-processor.ts +0 -11
  803. package/src/modules/planner/backend/planner/availability-rulesets/page.tsx +0 -4
  804. package/src/modules/push_notifications/backend/push_notifications/page.tsx +1 -4
  805. package/src/modules/push_notifications/backend/push_notifications/send/page.tsx +4 -4
  806. package/src/modules/query_index/lib/engine.ts +61 -249
  807. package/src/modules/query_index/lib/search-tokens.ts +3 -135
  808. package/src/modules/resources/backend/resources/resource-types/page.tsx +1 -4
  809. package/src/modules/resources/backend/resources/resources/page.tsx +1 -4
  810. package/src/modules/sales/backend/sales/channels/offers/page.tsx +0 -4
  811. package/src/modules/sales/backend/sales/channels/page.tsx +0 -4
  812. package/src/modules/sales/backend/sales/documents/[id]/page.tsx +8 -14
  813. package/src/modules/sales/commands/documents.ts +0 -93
  814. package/src/modules/sales/components/PriceWithCurrency.tsx +5 -17
  815. package/src/modules/sales/components/channels/SalesChannelOffersPanel.tsx +0 -4
  816. package/src/modules/sales/components/documents/AdjustmentsSection.tsx +5 -6
  817. package/src/modules/sales/components/documents/ItemsSection.tsx +18 -56
  818. package/src/modules/sales/components/documents/LineItemDialog.tsx +21 -138
  819. package/src/modules/sales/components/documents/PaymentsSection.tsx +9 -20
  820. package/src/modules/sales/components/documents/ReturnsSection.tsx +5 -6
  821. package/src/modules/sales/components/documents/SalesDocumentsTable.tsx +14 -106
  822. package/src/modules/sales/components/documents/SalesOrderDraftLines.tsx +5 -6
  823. package/src/modules/sales/components/documents/ShipmentDialog.tsx +4 -5
  824. package/src/modules/sales/components/documents/ShipmentsSection.tsx +5 -6
  825. package/src/modules/sales/components/documents/lineItemUtils.ts +2 -7
  826. package/src/modules/sales/data/entities.ts +0 -6
  827. package/src/modules/sales/extension-points.ts +0 -1
  828. package/src/modules/sales/i18n/de.json +37 -8
  829. package/src/modules/sales/i18n/en.json +37 -8
  830. package/src/modules/sales/i18n/es.json +37 -8
  831. package/src/modules/sales/i18n/ko.json +37 -8
  832. package/src/modules/sales/i18n/pl.json +37 -8
  833. package/src/modules/sales/migrations/.snapshot-open-mercato.json +0 -60
  834. package/src/modules/sales/setup.ts +0 -2
  835. package/src/modules/sales/widgets/injection/document-history/widget.client.tsx +42 -2
  836. package/src/modules/sales/widgets/injection/payment-gateway-status-column/widget.ts +1 -9
  837. package/src/modules/sales/widgets/injection-table.ts +7 -4
  838. package/src/modules/staff/backend/staff/leave-requests/page.tsx +0 -4
  839. package/src/modules/staff/backend/staff/my-leave-requests/page.tsx +0 -4
  840. package/src/modules/staff/backend/staff/team-members/page.tsx +0 -6
  841. package/src/modules/staff/backend/staff/team-roles/page.tsx +0 -4
  842. package/src/modules/staff/backend/staff/teams/[id]/edit/page.tsx +0 -4
  843. package/src/modules/staff/backend/staff/teams/page.tsx +0 -4
  844. package/src/modules/staff/backend/staff/timesheets/page.tsx +1 -12
  845. package/src/modules/staff/backend/staff/timesheets/projects/page.tsx +0 -4
  846. package/src/modules/sync_excel/lib/adapters/customers.ts +0 -5
  847. package/src/modules/warranty_claims/api/assignees/route.ts +3 -3
  848. package/src/modules/warranty_claims/api/portal/attachments/route.ts +2 -2
  849. package/src/modules/warranty_claims/api/portal/claims/route.ts +9 -12
  850. package/src/modules/warranty_claims/backend/page.tsx +0 -4
  851. package/src/modules/warranty_claims/backend/warranty_claims/registrations/page.tsx +0 -4
  852. package/src/modules/warranty_claims/backend/warranty_claims/troubleshooting-guides/page.tsx +0 -4
  853. package/src/modules/warranty_claims/backend/warranty_claims/vendor-policies/page.tsx +0 -4
  854. package/src/modules/warranty_claims/frontend/[orgSlug]/portal/claims/page.tsx +0 -4
  855. package/src/modules/wms/api/warehouses/route.ts +9 -13
  856. package/src/modules/wms/api/zones/route.ts +0 -16
  857. package/src/modules/wms/commands/configuration.ts +10 -159
  858. package/src/modules/wms/commands/inventory-actions.ts +0 -3
  859. package/src/modules/wms/commands/shared.ts +0 -17
  860. package/src/modules/wms/components/backend/WmsConfigurationPage.tsx +141 -95
  861. package/src/modules/wms/components/backend/WmsInventoryConsolePage.tsx +0 -2
  862. package/src/modules/wms/components/backend/WmsLocationDetailPage.tsx +30 -26
  863. package/src/modules/wms/components/backend/WmsLotDetailPage.tsx +21 -17
  864. package/src/modules/wms/components/backend/WmsLotsListPage.tsx +0 -2
  865. package/src/modules/wms/components/backend/WmsOperationalDashboardPage.tsx +17 -13
  866. package/src/modules/wms/components/backend/WmsSkuDetailPage.tsx +16 -12
  867. package/src/modules/wms/components/backend/inventoryMutationLoaders.ts +20 -36
  868. package/src/modules/wms/i18n/de.json +0 -2
  869. package/src/modules/wms/i18n/en.json +0 -2
  870. package/src/modules/wms/i18n/es.json +0 -2
  871. package/src/modules/wms/i18n/ko.json +0 -2
  872. package/src/modules/wms/i18n/pl.json +0 -2
  873. package/src/modules/workflows/backend/definitions/page.tsx +1 -4
  874. package/src/modules/workflows/backend/events/page.tsx +1 -4
  875. package/src/modules/workflows/backend/instances/page.tsx +1 -4
  876. package/src/modules/workflows/backend/tasks/page.tsx +1 -4
  877. package/src/modules/workflows/lib/activity-executor.ts +0 -9
  878. package/dist/modules/api_keys/di.js +0 -9
  879. package/dist/modules/api_keys/di.js.map +0 -7
  880. package/dist/modules/api_keys/services/principalService.js +0 -31
  881. package/dist/modules/api_keys/services/principalService.js.map +0 -7
  882. package/dist/modules/attachments/lib/attachment-service.js +0 -313
  883. package/dist/modules/attachments/lib/attachment-service.js.map +0 -7
  884. package/dist/modules/auth/api/reset/validate.js +0 -55
  885. package/dist/modules/auth/api/reset/validate.js.map +0 -7
  886. package/dist/modules/auth/commands/acl.js +0 -254
  887. package/dist/modules/auth/commands/acl.js.map +0 -7
  888. package/dist/modules/auth/lib/userIdFilter.js +0 -16
  889. package/dist/modules/auth/lib/userIdFilter.js.map +0 -7
  890. package/dist/modules/auth/services/principalService.js +0 -200
  891. package/dist/modules/auth/services/principalService.js.map +0 -7
  892. package/dist/modules/auth/services/roleOrganizationScope.js +0 -41
  893. package/dist/modules/auth/services/roleOrganizationScope.js.map +0 -7
  894. package/dist/modules/communication_channels/lib/outbound-recipient.js +0 -33
  895. package/dist/modules/communication_channels/lib/outbound-recipient.js.map +0 -7
  896. package/dist/modules/communication_channels/lib/resolve-channel-type.js +0 -51
  897. package/dist/modules/communication_channels/lib/resolve-channel-type.js.map +0 -7
  898. package/dist/modules/customers/backend/customers/deals/pipeline/components/toneClasses.js +0 -18
  899. package/dist/modules/customers/backend/customers/deals/pipeline/components/toneClasses.js.map +0 -7
  900. package/dist/modules/customers/lib/calendar/participantIdentity.js +0 -9
  901. package/dist/modules/customers/lib/calendar/participantIdentity.js.map +0 -7
  902. package/dist/modules/customers/lib/closureStage.js +0 -45
  903. package/dist/modules/customers/lib/closureStage.js.map +0 -7
  904. package/dist/modules/customers/lib/detailReadAccess.js +0 -12
  905. package/dist/modules/customers/lib/detailReadAccess.js.map +0 -7
  906. package/dist/modules/data_sync/lib/abandoned-run.js +0 -19
  907. package/dist/modules/data_sync/lib/abandoned-run.js.map +0 -7
  908. package/dist/modules/devices/api/deviceSerialization.js +0 -46
  909. package/dist/modules/devices/api/deviceSerialization.js.map +0 -7
  910. package/dist/modules/devices/backend/devices/useDeviceUserLabels.js +0 -34
  911. package/dist/modules/devices/backend/devices/useDeviceUserLabels.js.map +0 -7
  912. package/dist/modules/devices/backend/devices/userOptions.js +0 -52
  913. package/dist/modules/devices/backend/devices/userOptions.js.map +0 -7
  914. package/dist/modules/directory/services/organizationHierarchyService.js +0 -29
  915. package/dist/modules/directory/services/organizationHierarchyService.js.map +0 -7
  916. package/dist/modules/directory/services/organizationScopeService.js +0 -56
  917. package/dist/modules/directory/services/organizationScopeService.js.map +0 -7
  918. package/dist/modules/integrations/backend/integrations/credential-secret-fields.js +0 -55
  919. package/dist/modules/integrations/backend/integrations/credential-secret-fields.js.map +0 -7
  920. package/dist/modules/messages/lib/channel-sender-identity.js +0 -26
  921. package/dist/modules/messages/lib/channel-sender-identity.js.map +0 -7
  922. package/dist/modules/messages/lib/composeSourceChannelType.js +0 -41
  923. package/dist/modules/messages/lib/composeSourceChannelType.js.map +0 -7
  924. package/dist/modules/query_index/lib/search-entity-policy.js +0 -14
  925. package/dist/modules/query_index/lib/search-entity-policy.js.map +0 -7
  926. package/dist/modules/sales/components/documents/lineItemShipmentLock.js +0 -54
  927. package/dist/modules/sales/components/documents/lineItemShipmentLock.js.map +0 -7
  928. package/dist/modules/sales/lib/salesChannelsToggleSeed.js +0 -33
  929. package/dist/modules/sales/lib/salesChannelsToggleSeed.js.map +0 -7
  930. package/dist/modules/sales/migrations/Migration20260821120000_sales_notes_addresses_context_idx.js +0 -32
  931. package/dist/modules/sales/migrations/Migration20260821120000_sales_notes_addresses_context_idx.js.map +0 -7
  932. package/dist/modules/wms/api/warehouseSearch.js +0 -21
  933. package/dist/modules/wms/api/warehouseSearch.js.map +0 -7
  934. package/dist/modules/wms/components/backend/WarehouseEditDialog.js +0 -158
  935. package/dist/modules/wms/components/backend/WarehouseEditDialog.js.map +0 -7
  936. package/dist/modules/wms/components/backend/warehouseFormOptions.js +0 -66
  937. package/dist/modules/wms/components/backend/warehouseFormOptions.js.map +0 -7
  938. package/src/modules/api_keys/di.ts +0 -7
  939. package/src/modules/api_keys/services/principalService.ts +0 -33
  940. package/src/modules/attachments/lib/attachment-service.ts +0 -468
  941. package/src/modules/auth/api/reset/validate.ts +0 -57
  942. package/src/modules/auth/commands/acl.ts +0 -495
  943. package/src/modules/auth/lib/userIdFilter.ts +0 -31
  944. package/src/modules/auth/services/principalService.ts +0 -266
  945. package/src/modules/auth/services/roleOrganizationScope.ts +0 -70
  946. package/src/modules/communication_channels/lib/outbound-recipient.ts +0 -71
  947. package/src/modules/communication_channels/lib/resolve-channel-type.ts +0 -99
  948. package/src/modules/customers/backend/customers/deals/pipeline/components/toneClasses.ts +0 -21
  949. package/src/modules/customers/lib/calendar/participantIdentity.ts +0 -17
  950. package/src/modules/customers/lib/closureStage.ts +0 -76
  951. package/src/modules/customers/lib/detailReadAccess.ts +0 -35
  952. package/src/modules/data_sync/lib/abandoned-run.ts +0 -56
  953. package/src/modules/devices/api/deviceSerialization.ts +0 -50
  954. package/src/modules/devices/backend/devices/useDeviceUserLabels.ts +0 -45
  955. package/src/modules/devices/backend/devices/userOptions.ts +0 -99
  956. package/src/modules/directory/services/organizationHierarchyService.ts +0 -34
  957. package/src/modules/directory/services/organizationScopeService.ts +0 -85
  958. package/src/modules/integrations/backend/integrations/credential-secret-fields.ts +0 -84
  959. package/src/modules/messages/lib/channel-sender-identity.ts +0 -55
  960. package/src/modules/messages/lib/composeSourceChannelType.ts +0 -95
  961. package/src/modules/query_index/lib/search-entity-policy.ts +0 -46
  962. package/src/modules/sales/components/documents/lineItemShipmentLock.ts +0 -74
  963. package/src/modules/sales/lib/salesChannelsToggleSeed.ts +0 -42
  964. package/src/modules/sales/migrations/Migration20260821120000_sales_notes_addresses_context_idx.ts +0 -87
  965. package/src/modules/wms/api/warehouseSearch.ts +0 -23
  966. package/src/modules/wms/components/backend/WarehouseEditDialog.tsx +0 -216
  967. package/src/modules/wms/components/backend/warehouseFormOptions.ts +0 -72
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/modules/push_notifications/backend/push_notifications/send/page.tsx"],
4
- "sourcesContent": ["\"use client\"\nimport * as React from 'react'\nimport Link from 'next/link'\nimport { useRouter } from 'next/navigation'\nimport { Plus, X } from 'lucide-react'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { CrudForm, type CrudField, type CrudFieldOption, type CrudCustomFieldRenderProps } from '@open-mercato/ui/backend/CrudForm'\nimport { apiCall, apiCallOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '@open-mercato/ui/primitives/select'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { IconButton } from '@open-mercato/ui/primitives/icon-button'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\n\ntype KeyValue = { key: string; value: string }\n\ntype FormValues = {\n userId: string\n deviceId: string\n mode: string\n title: string\n body: string\n data: KeyValue[]\n sound: string\n badge: number | string\n image: string\n priority: string\n channelId: string\n // form-only helper (never sent): drives channelId visibility (hidden in silent / for an iOS target)\n showChannelId: boolean\n}\n\nconst DELIVERIES_HREF = '/backend/push_notifications'\nconst FORM_ID = 'push-custom-send-form'\n// Radix Select forbids an empty-string item value, so \"all devices\" uses a sentinel that we map\n// back to '' (the form value that means \"fan out to every push-capable device\").\nconst ALL_DEVICES = '__all__'\n\ntype DeviceOption = { id: string; label: string; platform: string }\n// Reported up to the page so the (custom) submit button can disable when there is nothing to send to.\ntype DeviceState = { userId: string; count: number; loading: boolean }\n\n// Dependent picker: loads the *selected recipient's* push-capable devices (admin devices API,\n// filtered by userId) so an admin can target one device or all of them. Reads the live form values,\n// so it re-loads whenever the recipient changes and clears a stale selection. It also derives\n// `showChannelId` (Android channel id is Android-only + visible-only) so the channelId field can hide\n// itself for a selected iOS device or in silent mode. Degrades to \"All devices\" when the admin lacks\n// devices.admin or the recipient has no push-capable device.\nfunction DeviceField({ value, setValue, setFormValue, values, onState }: CrudCustomFieldRenderProps & { onState?: (s: DeviceState) => void }) {\n const t = useT()\n const userId = typeof values?.userId === 'string' ? values.userId : ''\n const mode = typeof values?.mode === 'string' ? values.mode : 'visible'\n const selected = typeof value === 'string' && value ? value : ''\n const [devices, setDevices] = React.useState<DeviceOption[]>([])\n const [loading, setLoading] = React.useState(false)\n\n // Report the recipient + push-capable device count up so the page can disable \"Send\" when there is\n // nowhere to deliver (no recipient, or the recipient has zero push-capable devices).\n React.useEffect(() => {\n onState?.({ userId, count: devices.length, loading })\n }, [userId, devices.length, loading, onState])\n\n React.useEffect(() => {\n if (!userId) {\n setDevices([])\n if (selected) setValue('')\n return\n }\n let cancelled = false\n setLoading(true)\n const params = new URLSearchParams({ userId, pageSize: '50' })\n apiCall<{ items?: Array<{ id: string; deviceId: string; platform: string; pushProvider?: string | null }> }>(\n `/api/devices/admin/devices?${params.toString()}`,\n { headers: { 'x-om-forbidden-redirect': '0' } },\n { fallback: null },\n )\n .catch(() => null)\n .then((call) => {\n if (cancelled) return\n const items = (call && call.ok ? call.result?.items : []) ?? []\n const opts = items\n .filter((d): d is { id: string; deviceId: string; platform: string; pushProvider?: string | null } =>\n !!d && typeof d.id === 'string' && !!d.pushProvider)\n .map((d) => ({ id: d.id, label: `${d.deviceId} \u00B7 ${d.platform}${d.pushProvider ? ` \u00B7 ${d.pushProvider}` : ''}`, platform: d.platform }))\n setDevices(opts)\n if (selected && !opts.some((o) => o.id === selected)) setValue('')\n })\n .finally(() => { if (!cancelled) setLoading(false) })\n return () => { cancelled = true }\n // Reload only when the recipient changes; `selected`/`setValue` are handled inside.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [userId])\n\n // channelId is Android-only and irrelevant to silent pushes \u2192 hide it for a selected iOS device or\n // in silent mode. Only write when the derived value actually changes (avoids a render loop).\n const selectedPlatform = React.useMemo(() => devices.find((d) => d.id === selected)?.platform, [devices, selected])\n React.useEffect(() => {\n const show = mode !== 'silent' && selectedPlatform !== 'ios'\n if (values?.showChannelId !== show) setFormValue?.('showChannelId', show)\n }, [mode, selectedPlatform, values?.showChannelId, setFormValue])\n\n return (\n <div className=\"space-y-1\">\n <Select value={selected || ALL_DEVICES} onValueChange={(v) => setValue(v === ALL_DEVICES ? '' : v)} disabled={!userId}>\n <SelectTrigger>\n <SelectValue placeholder={`${t('push_notifications.send.deviceAll')} (${devices.length})`} />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value={ALL_DEVICES}>{`${t('push_notifications.send.deviceAll')} (${devices.length})`}</SelectItem>\n {devices.map((d) => (\n <SelectItem key={d.id} value={d.id}>{d.label}</SelectItem>\n ))}\n </SelectContent>\n </Select>\n <p className={`text-xs ${userId && !loading && devices.length === 0 ? 'text-status-warning-text' : 'text-muted-foreground'}`}>\n {!userId\n ? t('push_notifications.send.deviceSelectUserFirst')\n : loading\n ? t('common.loading', 'Loading\u2026')\n : devices.length === 0\n ? t('push_notifications.send.deviceNone')\n : t('push_notifications.send.deviceHint')}\n </p>\n </div>\n )\n}\n\n// Arbitrary key/value payload delivered inside the push `data` map (the app reads it). Shown for both\n// visible and silent sends \u2014 for silent it is the entire payload.\nfunction DataField({ value, setValue }: CrudCustomFieldRenderProps) {\n const t = useT()\n const pairs: KeyValue[] = Array.isArray(value) ? (value as KeyValue[]) : []\n const update = (next: KeyValue[]) => setValue(next)\n return (\n <div className=\"space-y-2\">\n {pairs.length === 0 ? (\n <p className=\"text-xs text-muted-foreground\">{t('push_notifications.send.dataEmpty')}</p>\n ) : null}\n {pairs.map((pair, index) => (\n <div key={index} className=\"flex items-center gap-2\">\n <Input\n placeholder={t('push_notifications.send.dataKey')}\n value={pair.key}\n onChange={(e) => update(pairs.map((p, i) => (i === index ? { ...p, key: e.target.value } : p)))}\n />\n <Input\n placeholder={t('push_notifications.send.dataValue')}\n value={pair.value}\n onChange={(e) => update(pairs.map((p, i) => (i === index ? { ...p, value: e.target.value } : p)))}\n />\n <IconButton\n type=\"button\"\n variant=\"ghost\"\n aria-label={t('push_notifications.send.dataRemove')}\n onClick={() => update(pairs.filter((_, i) => i !== index))}\n >\n <X className=\"h-4 w-4\" />\n </IconButton>\n </div>\n ))}\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={() => update([...pairs, { key: '', value: '' }])}>\n <Plus className=\"h-4 w-4 mr-1\" />\n {t('push_notifications.send.dataAdd')}\n </Button>\n </div>\n )\n}\n\nexport default function PushCustomSendPage() {\n const router = useRouter()\n const t = useT()\n const [deviceState, setDeviceState] = React.useState<DeviceState>({ userId: '', count: 0, loading: false })\n const [submitting, setSubmitting] = React.useState(false)\n\n // Stable reporter for the device picker \u2192 bails when unchanged so it can't loop the render.\n const reportDeviceState = React.useCallback((next: DeviceState) => {\n setDeviceState((prev) =>\n prev.userId === next.userId && prev.count === next.count && prev.loading === next.loading ? prev : next)\n }, [])\n\n // Recipient search by name/email via /api/auth/users (mirrors the devices list + admin\n // notification-preferences picker). Return results only \u2014 the combobox retains them internally, so\n // pushing them into state that `fields` depends on would re-render the whole form per keystroke.\n const loadUserOptions = React.useCallback(async (query?: string): Promise<CrudFieldOption[]> => {\n const params = new URLSearchParams()\n params.set('page', '1')\n params.set('pageSize', '20')\n if (query && query.trim().length > 0) params.set('search', query.trim())\n const call = await apiCall<{ items?: { id: string; name?: string | null; email?: string | null }[] }>(\n `/api/auth/users?${params.toString()}`,\n { headers: { 'x-om-forbidden-redirect': '0' } },\n { fallback: null },\n ).catch(() => null)\n if (!call || !call.ok) return []\n return (call.result?.items ?? []).flatMap((item): CrudFieldOption[] => {\n if (!item || typeof item.id !== 'string' || !item.id.trim()) return []\n const name = typeof item.name === 'string' && item.name.trim() ? item.name.trim() : null\n const email = typeof item.email === 'string' && item.email.trim() ? item.email.trim() : null\n const label = name && email ? `${name} \u2014 ${email}` : email ?? name ?? item.id\n return [{ value: item.id, label }]\n })\n }, [])\n\n const visibleOnly = { field: 'mode', equals: 'visible' } as const\n\n const fields = React.useMemo<CrudField[]>(() => [\n { id: 'userId', label: t('push_notifications.send.userId'), type: 'combobox', required: true, description: t('push_notifications.send.userIdHint'), loadOptions: loadUserOptions },\n { id: 'deviceId', label: t('push_notifications.send.device'), type: 'custom', component: (props) => <DeviceField {...props} onState={reportDeviceState} /> },\n {\n id: 'mode',\n label: t('push_notifications.send.mode'),\n type: 'select',\n required: true,\n description: t('push_notifications.send.modeHint'),\n options: [\n { value: 'visible', label: t('push_notifications.send.modeVisible') },\n { value: 'silent', label: t('push_notifications.send.modeSilent') },\n ],\n },\n { id: 'title', label: t('push_notifications.send.title'), type: 'text', required: true, visibleWhen: visibleOnly },\n { id: 'body', label: t('push_notifications.send.body'), type: 'textarea', visibleWhen: visibleOnly },\n { id: 'data', label: t('push_notifications.send.data'), type: 'custom', description: t('push_notifications.send.dataHint'), component: (props) => <DataField {...props} /> },\n { id: 'sound', label: t('push_notifications.send.sound'), type: 'text', visibleWhen: visibleOnly },\n { id: 'badge', label: t('push_notifications.send.badge'), type: 'number', visibleWhen: visibleOnly },\n { id: 'image', label: t('push_notifications.send.image'), type: 'text', visibleWhen: visibleOnly },\n {\n id: 'priority',\n label: t('push_notifications.send.priority'),\n type: 'select',\n options: [\n { value: '', label: t('push_notifications.send.priorityDefault') },\n { value: 'high', label: t('push_notifications.send.priorityHigh') },\n { value: 'normal', label: t('push_notifications.send.priorityNormal') },\n ],\n },\n { id: 'channelId', label: t('push_notifications.send.channelId'), type: 'text', visibleWhen: { field: 'showChannelId', equals: true } },\n ], [t, loadUserOptions, reportDeviceState])\n\n // NOTE: intentionally a flat field list (no `groups`). CrudForm only applies `visibleWhen` in the\n // ungrouped render path \u2014 grouped fields ignore it \u2014 and this form relies on mode/platform-driven\n // field visibility (silent hides title/body/options; iOS hides channelId).\n\n return (\n <Page>\n <PageBody>\n <CrudForm<FormValues>\n title={t('push_notifications.send.pageTitle')}\n backHref={DELIVERIES_HREF}\n formId={FORM_ID}\n hideFooterActions\n fields={fields}\n initialValues={{ userId: '', deviceId: '', mode: 'visible', title: '', body: '', data: [], sound: '', badge: '', image: '', priority: '', channelId: '', showChannelId: true }}\n submitLabel={t('push_notifications.send.submit')}\n onSubmit={async (values) => {\n setSubmitting(true)\n try {\n const silent = values.mode === 'silent'\n const body = (values.body ?? '').trim()\n\n const dataMap: Record<string, string> = {}\n for (const pair of Array.isArray(values.data) ? values.data : []) {\n const key = (pair?.key ?? '').trim()\n if (key) dataMap[key] = `${pair?.value ?? ''}`\n }\n const hasData = Object.keys(dataMap).length > 0\n\n // Options that only affect a visible banner are dropped for silent.\n const pushOptions: Record<string, unknown> = {}\n if (!silent) {\n if (typeof values.sound === 'string' && values.sound.trim()) pushOptions.sound = values.sound.trim()\n const badgeNum = typeof values.badge === 'number' ? values.badge : Number.parseInt(String(values.badge ?? ''), 10)\n if (Number.isFinite(badgeNum) && badgeNum >= 0) pushOptions.badge = badgeNum\n if (typeof values.image === 'string' && values.image.trim()) pushOptions.image = values.image.trim()\n if (typeof values.channelId === 'string' && values.channelId.trim()) pushOptions.channelId = values.channelId.trim()\n }\n if (values.priority === 'high' || values.priority === 'normal') pushOptions.priority = values.priority\n const hasOptions = Object.keys(pushOptions).length > 0\n\n // Silent hides the title field; the API still needs one, so use a stable label for the log.\n const title = silent ? (values.title ?? '').trim() || 'Silent push' : (values.title ?? '').trim()\n\n await apiCallOrThrow('/api/push_notifications/custom-send', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({\n recipientUserId: (values.userId ?? '').trim(),\n deviceId: (values.deviceId ?? '').trim() || undefined,\n title,\n body: !silent && body.length > 0 ? body : undefined,\n silent,\n data: hasData ? dataMap : undefined,\n pushOptions: hasOptions ? pushOptions : undefined,\n }),\n })\n flash(t('push_notifications.send.success'), 'success')\n router.push(DELIVERIES_HREF)\n } finally {\n setSubmitting(false)\n }\n }}\n />\n <div className=\"mt-4 flex items-center justify-between gap-3\">\n <div className=\"text-xs\">\n {!deviceState.userId ? (\n <span className=\"text-muted-foreground\">{t('push_notifications.send.deviceSelectUserFirst')}</span>\n ) : deviceState.count === 0 && !deviceState.loading ? (\n <span className=\"text-status-warning-text\">{t('push_notifications.send.deviceNone')}</span>\n ) : null}\n </div>\n <div className=\"flex gap-2\">\n <Button asChild variant=\"outline\">\n <Link href={DELIVERIES_HREF}>{t('common.cancel', 'Cancel')}</Link>\n </Button>\n <Button\n type=\"submit\"\n form={FORM_ID}\n disabled={!deviceState.userId || deviceState.count === 0 || deviceState.loading || submitting}\n >\n {t('push_notifications.send.submit')}\n </Button>\n </div>\n </div>\n </PageBody>\n </Page>\n )\n}\n"],
5
- "mappings": ";AA0GU,cAEF,YAFE;AAzGV,YAAY,WAAW;AACvB,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,MAAM,SAAS;AACxB,SAAS,MAAM,gBAAgB;AAC/B,SAAS,gBAAuF;AAChG,SAAS,SAAS,sBAAsB;AACxC,SAAS,aAAa;AACtB,SAAS,QAAQ,eAAe,aAAa,eAAe,kBAAkB;AAC9E,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,SAAS,YAAY;AAoBrB,MAAM,k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nB,kBAAkB,OAAO,UAAU,IAAI,KAAK;AAAA,gBAC5C,WAAW,OAAO,YAAY,IAAI,KAAK,KAAK;AAAA,gBAC5C;AAAA,gBACA,MAAM,CAAC,UAAU,KAAK,SAAS,IAAI,OAAO;AAAA,gBAC1C;AAAA,gBACA,MAAM,UAAU,UAAU;AAAA,gBAC1B,aAAa,aAAa,cAAc;AAAA,cAC1C,CAAC;AAAA,YACH,CAAC;AACD,kBAAM,EAAE,iCAAiC,GAAG,SAAS;AACrD,mBAAO,KAAK,eAAe;AAAA,UAC3B,UAAE;AACA,0BAAc,KAAK;AAAA,UACrB;AAAA,QACF;AAAA;AAAA,IACF;AAAA,IACA,qBAAC,SAAI,WAAU,gDACb;AAAA,0BAAC,SAAI,WAAU,WACZ,WAAC,YAAY,SACZ,oBAAC,UAAK,WAAU,yBAAyB,YAAE,+CAA+C,GAAE,IAC1F,YAAY,UAAU,KAAK,CAAC,YAAY,UAC1C,oBAAC,UAAK,WAAU,4BAA4B,YAAE,oCAAoC,GAAE,IAClF,MACN;AAAA,MACA,qBAAC,SAAI,WAAU,cACb;AAAA,4BAAC,UAAO,SAAO,MAAC,SAAQ,WACtB,8BAAC,QAAK,MAAM,iBAAkB,YAAE,iBAAiB,QAAQ,GAAE,GAC7D;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,MAAM;AAAA,YACN,UAAU,CAAC,YAAY,UAAU,YAAY,UAAU,KAAK,YAAY,WAAW;AAAA,YAElF,YAAE,gCAAgC;AAAA;AAAA,QACrC;AAAA,SACF;AAAA,OACF;AAAA,KACF,GACF;AAEJ;",
4
+ "sourcesContent": ["\"use client\"\nimport * as React from 'react'\nimport Link from 'next/link'\nimport { useRouter } from 'next/navigation'\nimport { Plus, X } from 'lucide-react'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { CrudForm, type CrudField, type CrudFieldOption, type CrudCustomFieldRenderProps } from '@open-mercato/ui/backend/CrudForm'\nimport { apiCall, apiCallOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '@open-mercato/ui/primitives/select'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { IconButton } from '@open-mercato/ui/primitives/icon-button'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\n\ntype KeyValue = { key: string; value: string }\n\ntype FormValues = {\n userId: string\n deviceId: string\n mode: string\n title: string\n body: string\n data: KeyValue[]\n sound: string\n badge: number | string\n image: string\n priority: string\n channelId: string\n // form-only helper (never sent): drives channelId visibility (hidden in silent / for an iOS target)\n showChannelId: boolean\n}\n\nconst DELIVERIES_HREF = '/backend/push_notifications'\nconst FORM_ID = 'push-custom-send-form'\n// Radix Select forbids an empty-string item value, so \"all devices\" uses a sentinel that we map\n// back to '' (the form value that means \"fan out to every push-capable device\").\nconst ALL_DEVICES = '__all__'\n\ntype DeviceOption = { id: string; label: string; platform: string }\n// Reported up to the page so the (custom) submit button can disable when there is nothing to send to.\ntype DeviceState = { userId: string; count: number; loading: boolean }\n\n// Dependent picker: loads the *selected recipient's* push-capable devices (admin devices API,\n// filtered by userId) so an admin can target one device or all of them. Reads the live form values,\n// so it re-loads whenever the recipient changes and clears a stale selection. It also derives\n// `showChannelId` (Android channel id is Android-only + visible-only) so the channelId field can hide\n// itself for a selected iOS device or in silent mode. Degrades to \"All devices\" when the admin lacks\n// devices.admin or the recipient has no push-capable device.\nfunction DeviceField({ value, setValue, setFormValue, values, onState }: CrudCustomFieldRenderProps & { onState?: (s: DeviceState) => void }) {\n const t = useT()\n const userId = typeof values?.userId === 'string' ? values.userId : ''\n const mode = typeof values?.mode === 'string' ? values.mode : 'visible'\n const selected = typeof value === 'string' && value ? value : ''\n const [devices, setDevices] = React.useState<DeviceOption[]>([])\n const [loading, setLoading] = React.useState(false)\n\n // Report the recipient + push-capable device count up so the page can disable \"Send\" when there is\n // nowhere to deliver (no recipient, or the recipient has zero push-capable devices).\n React.useEffect(() => {\n onState?.({ userId, count: devices.length, loading })\n }, [userId, devices.length, loading, onState])\n\n React.useEffect(() => {\n if (!userId) {\n setDevices([])\n if (selected) setValue('')\n return\n }\n let cancelled = false\n setLoading(true)\n const params = new URLSearchParams({ userId, pageSize: '50' })\n apiCall<{ items?: Array<{ id: string; device_id: string; platform: string; push_provider?: string | null }> }>(\n `/api/devices/admin/devices?${params.toString()}`,\n { headers: { 'x-om-forbidden-redirect': '0' } },\n { fallback: null },\n )\n .catch(() => null)\n .then((call) => {\n if (cancelled) return\n const items = (call && call.ok ? call.result?.items : []) ?? []\n const opts = items\n .filter((d): d is { id: string; device_id: string; platform: string; push_provider?: string | null } =>\n !!d && typeof d.id === 'string' && !!d.push_provider)\n .map((d) => ({ id: d.id, label: `${d.device_id} \u00B7 ${d.platform}${d.push_provider ? ` \u00B7 ${d.push_provider}` : ''}`, platform: d.platform }))\n setDevices(opts)\n if (selected && !opts.some((o) => o.id === selected)) setValue('')\n })\n .finally(() => { if (!cancelled) setLoading(false) })\n return () => { cancelled = true }\n // Reload only when the recipient changes; `selected`/`setValue` are handled inside.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [userId])\n\n // channelId is Android-only and irrelevant to silent pushes \u2192 hide it for a selected iOS device or\n // in silent mode. Only write when the derived value actually changes (avoids a render loop).\n const selectedPlatform = React.useMemo(() => devices.find((d) => d.id === selected)?.platform, [devices, selected])\n React.useEffect(() => {\n const show = mode !== 'silent' && selectedPlatform !== 'ios'\n if (values?.showChannelId !== show) setFormValue?.('showChannelId', show)\n }, [mode, selectedPlatform, values?.showChannelId, setFormValue])\n\n return (\n <div className=\"space-y-1\">\n <Select value={selected || ALL_DEVICES} onValueChange={(v) => setValue(v === ALL_DEVICES ? '' : v)} disabled={!userId}>\n <SelectTrigger>\n <SelectValue placeholder={`${t('push_notifications.send.deviceAll')} (${devices.length})`} />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value={ALL_DEVICES}>{`${t('push_notifications.send.deviceAll')} (${devices.length})`}</SelectItem>\n {devices.map((d) => (\n <SelectItem key={d.id} value={d.id}>{d.label}</SelectItem>\n ))}\n </SelectContent>\n </Select>\n <p className={`text-xs ${userId && !loading && devices.length === 0 ? 'text-status-warning-text' : 'text-muted-foreground'}`}>\n {!userId\n ? t('push_notifications.send.deviceSelectUserFirst')\n : loading\n ? t('common.loading', 'Loading\u2026')\n : devices.length === 0\n ? t('push_notifications.send.deviceNone')\n : t('push_notifications.send.deviceHint')}\n </p>\n </div>\n )\n}\n\n// Arbitrary key/value payload delivered inside the push `data` map (the app reads it). Shown for both\n// visible and silent sends \u2014 for silent it is the entire payload.\nfunction DataField({ value, setValue }: CrudCustomFieldRenderProps) {\n const t = useT()\n const pairs: KeyValue[] = Array.isArray(value) ? (value as KeyValue[]) : []\n const update = (next: KeyValue[]) => setValue(next)\n return (\n <div className=\"space-y-2\">\n {pairs.length === 0 ? (\n <p className=\"text-xs text-muted-foreground\">{t('push_notifications.send.dataEmpty')}</p>\n ) : null}\n {pairs.map((pair, index) => (\n <div key={index} className=\"flex items-center gap-2\">\n <Input\n placeholder={t('push_notifications.send.dataKey')}\n value={pair.key}\n onChange={(e) => update(pairs.map((p, i) => (i === index ? { ...p, key: e.target.value } : p)))}\n />\n <Input\n placeholder={t('push_notifications.send.dataValue')}\n value={pair.value}\n onChange={(e) => update(pairs.map((p, i) => (i === index ? { ...p, value: e.target.value } : p)))}\n />\n <IconButton\n type=\"button\"\n variant=\"ghost\"\n aria-label={t('push_notifications.send.dataRemove')}\n onClick={() => update(pairs.filter((_, i) => i !== index))}\n >\n <X className=\"h-4 w-4\" />\n </IconButton>\n </div>\n ))}\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={() => update([...pairs, { key: '', value: '' }])}>\n <Plus className=\"h-4 w-4 mr-1\" />\n {t('push_notifications.send.dataAdd')}\n </Button>\n </div>\n )\n}\n\nexport default function PushCustomSendPage() {\n const router = useRouter()\n const t = useT()\n const [deviceState, setDeviceState] = React.useState<DeviceState>({ userId: '', count: 0, loading: false })\n const [submitting, setSubmitting] = React.useState(false)\n\n // Stable reporter for the device picker \u2192 bails when unchanged so it can't loop the render.\n const reportDeviceState = React.useCallback((next: DeviceState) => {\n setDeviceState((prev) =>\n prev.userId === next.userId && prev.count === next.count && prev.loading === next.loading ? prev : next)\n }, [])\n\n // Recipient search by name/email via /api/auth/users (mirrors the devices list + admin\n // notification-preferences picker). Return results only \u2014 the combobox retains them internally, so\n // pushing them into state that `fields` depends on would re-render the whole form per keystroke.\n const loadUserOptions = React.useCallback(async (query?: string): Promise<CrudFieldOption[]> => {\n const params = new URLSearchParams()\n params.set('page', '1')\n params.set('pageSize', '20')\n if (query && query.trim().length > 0) params.set('search', query.trim())\n const call = await apiCall<{ items?: { id: string; name?: string | null; email?: string | null }[] }>(\n `/api/auth/users?${params.toString()}`,\n { headers: { 'x-om-forbidden-redirect': '0' } },\n { fallback: null },\n ).catch(() => null)\n if (!call || !call.ok) return []\n return (call.result?.items ?? []).flatMap((item): CrudFieldOption[] => {\n if (!item || typeof item.id !== 'string' || !item.id.trim()) return []\n const name = typeof item.name === 'string' && item.name.trim() ? item.name.trim() : null\n const email = typeof item.email === 'string' && item.email.trim() ? item.email.trim() : null\n const label = name && email ? `${name} \u2014 ${email}` : email ?? name ?? item.id\n return [{ value: item.id, label }]\n })\n }, [])\n\n const visibleOnly = { field: 'mode', equals: 'visible' } as const\n\n const fields = React.useMemo<CrudField[]>(() => [\n { id: 'userId', label: t('push_notifications.send.userId'), type: 'combobox', required: true, description: t('push_notifications.send.userIdHint'), loadOptions: loadUserOptions },\n { id: 'deviceId', label: t('push_notifications.send.device'), type: 'custom', component: (props) => <DeviceField {...props} onState={reportDeviceState} /> },\n {\n id: 'mode',\n label: t('push_notifications.send.mode'),\n type: 'select',\n required: true,\n description: t('push_notifications.send.modeHint'),\n options: [\n { value: 'visible', label: t('push_notifications.send.modeVisible') },\n { value: 'silent', label: t('push_notifications.send.modeSilent') },\n ],\n },\n { id: 'title', label: t('push_notifications.send.title'), type: 'text', required: true, visibleWhen: visibleOnly },\n { id: 'body', label: t('push_notifications.send.body'), type: 'textarea', visibleWhen: visibleOnly },\n { id: 'data', label: t('push_notifications.send.data'), type: 'custom', description: t('push_notifications.send.dataHint'), component: (props) => <DataField {...props} /> },\n { id: 'sound', label: t('push_notifications.send.sound'), type: 'text', visibleWhen: visibleOnly },\n { id: 'badge', label: t('push_notifications.send.badge'), type: 'number', visibleWhen: visibleOnly },\n { id: 'image', label: t('push_notifications.send.image'), type: 'text', visibleWhen: visibleOnly },\n {\n id: 'priority',\n label: t('push_notifications.send.priority'),\n type: 'select',\n options: [\n { value: '', label: t('push_notifications.send.priorityDefault') },\n { value: 'high', label: t('push_notifications.send.priorityHigh') },\n { value: 'normal', label: t('push_notifications.send.priorityNormal') },\n ],\n },\n { id: 'channelId', label: t('push_notifications.send.channelId'), type: 'text', visibleWhen: { field: 'showChannelId', equals: true } },\n ], [t, loadUserOptions, reportDeviceState])\n\n // NOTE: intentionally a flat field list (no `groups`). CrudForm only applies `visibleWhen` in the\n // ungrouped render path \u2014 grouped fields ignore it \u2014 and this form relies on mode/platform-driven\n // field visibility (silent hides title/body/options; iOS hides channelId).\n\n return (\n <Page>\n <PageBody>\n <CrudForm<FormValues>\n title={t('push_notifications.send.pageTitle')}\n backHref={DELIVERIES_HREF}\n formId={FORM_ID}\n hideFooterActions\n fields={fields}\n initialValues={{ userId: '', deviceId: '', mode: 'visible', title: '', body: '', data: [], sound: '', badge: '', image: '', priority: '', channelId: '', showChannelId: true }}\n submitLabel={t('push_notifications.send.submit')}\n onSubmit={async (values) => {\n setSubmitting(true)\n try {\n const silent = values.mode === 'silent'\n const body = (values.body ?? '').trim()\n\n const dataMap: Record<string, string> = {}\n for (const pair of Array.isArray(values.data) ? values.data : []) {\n const key = (pair?.key ?? '').trim()\n if (key) dataMap[key] = `${pair?.value ?? ''}`\n }\n const hasData = Object.keys(dataMap).length > 0\n\n // Options that only affect a visible banner are dropped for silent.\n const pushOptions: Record<string, unknown> = {}\n if (!silent) {\n if (typeof values.sound === 'string' && values.sound.trim()) pushOptions.sound = values.sound.trim()\n const badgeNum = typeof values.badge === 'number' ? values.badge : Number.parseInt(String(values.badge ?? ''), 10)\n if (Number.isFinite(badgeNum) && badgeNum >= 0) pushOptions.badge = badgeNum\n if (typeof values.image === 'string' && values.image.trim()) pushOptions.image = values.image.trim()\n if (typeof values.channelId === 'string' && values.channelId.trim()) pushOptions.channelId = values.channelId.trim()\n }\n if (values.priority === 'high' || values.priority === 'normal') pushOptions.priority = values.priority\n const hasOptions = Object.keys(pushOptions).length > 0\n\n // Silent hides the title field; the API still needs one, so use a stable label for the log.\n const title = silent ? (values.title ?? '').trim() || 'Silent push' : (values.title ?? '').trim()\n\n await apiCallOrThrow('/api/push_notifications/custom-send', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({\n recipientUserId: (values.userId ?? '').trim(),\n deviceId: (values.deviceId ?? '').trim() || undefined,\n title,\n body: !silent && body.length > 0 ? body : undefined,\n silent,\n data: hasData ? dataMap : undefined,\n pushOptions: hasOptions ? pushOptions : undefined,\n }),\n })\n flash(t('push_notifications.send.success'), 'success')\n router.push(DELIVERIES_HREF)\n } finally {\n setSubmitting(false)\n }\n }}\n />\n <div className=\"mt-4 flex items-center justify-between gap-3\">\n <div className=\"text-xs\">\n {!deviceState.userId ? (\n <span className=\"text-muted-foreground\">{t('push_notifications.send.deviceSelectUserFirst')}</span>\n ) : deviceState.count === 0 && !deviceState.loading ? (\n <span className=\"text-status-warning-text\">{t('push_notifications.send.deviceNone')}</span>\n ) : null}\n </div>\n <div className=\"flex gap-2\">\n <Button asChild variant=\"outline\">\n <Link href={DELIVERIES_HREF}>{t('common.cancel', 'Cancel')}</Link>\n </Button>\n <Button\n type=\"submit\"\n form={FORM_ID}\n disabled={!deviceState.userId || deviceState.count === 0 || de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A;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,MAAM;AAAA,YACN,UAAU,CAAC,YAAY,UAAU,YAAY,UAAU,KAAK,YAAY,WAAW;AAAA,YAElF,YAAE,gCAAgC;AAAA;AAAA,QACrC;AAAA,SACF;AAAA,OACF;AAAA,KACF,GACF;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -13,8 +13,6 @@ import {
13
13
  resolveJoins
14
14
  } from "@open-mercato/shared/lib/query/join-utils";
15
15
  import { resolveSearchConfig } from "@open-mercato/shared/lib/search/config";
16
- import { isEncryptedLikeField, resolveEncryptedLikeFieldSet } from "@open-mercato/shared/lib/query/engine";
17
- import { isTenantDataEncryptionEnabled } from "@open-mercato/shared/lib/encryption/toggles";
18
16
  import {
19
17
  createSearchTokenAvailability,
20
18
  isSearchFilterOp,
@@ -24,7 +22,6 @@ import { tokenizeText } from "@open-mercato/shared/lib/search/tokenize";
24
22
  import { runBeforeQueryPipeline, runAfterQueryPipeline } from "@open-mercato/shared/lib/query/query-extension-runner";
25
23
  import { warnOnCiphertextLikeFallback } from "@open-mercato/shared/lib/query/ciphertext-search-warning";
26
24
  import { resolveEncryptedSortFields, resolveEncryptedSortMaxRows, sortRowsInMemory } from "@open-mercato/shared/lib/query/encrypted-sort";
27
- import { resolveListCountCap } from "@open-mercato/shared/lib/query/count-cap";
28
25
  import { mapWithConcurrency } from "@open-mercato/shared/lib/query/bounded-decrypt";
29
26
  import { createLogger } from "@open-mercato/shared/lib/logger";
30
27
  import { parseNumberWithDefault } from "@open-mercato/shared/lib/number";
@@ -390,34 +387,6 @@ class HybridQueryEngine {
390
387
  ].filter((filter) => isSearchFilterOp(filter.op));
391
388
  const hasSearchTokens = searchEnabled && searchSources.length && sourceSearchFilters.length ? await this.searchAvailability().anySourceHasTokens(searchSources, opts.tenantId ?? null, orgScope) : false;
392
389
  const searchRuntime = { ...searchRuntimeBase, searchSources, enabled: searchEnabled && hasSearchTokens };
393
- if (searchRuntime.enabled && searchConfig.useIlikeForNonEncryptedFields === true && sourceSearchFilters.some((filter) => !String(filter.field).startsWith("cf:"))) {
394
- try {
395
- const encryptionService = this.getEncryptionService();
396
- const readEncryptedFieldNames = encryptionService?.getEncryptedFieldNames?.bind(encryptionService);
397
- if (readEncryptedFieldNames) {
398
- searchRuntime.encryptedFields = await resolveEncryptedLikeFieldSet(
399
- () => readEncryptedFieldNames(
400
- entity,
401
- opts.tenantId ?? null,
402
- null,
403
- { ignoreRuntimeHealth: true }
404
- ),
405
- String(entity),
406
- opts.tenantId ?? null
407
- );
408
- } else if (isTenantDataEncryptionEnabled()) {
409
- searchRuntime.encryptedFields = null;
410
- } else {
411
- searchRuntime.encryptedFields = /* @__PURE__ */ new Set();
412
- }
413
- } catch (err) {
414
- logger.warn("search: encrypted-field map unavailable; keeping the token rewrite for all columns", {
415
- entity: String(entity),
416
- error: err instanceof Error ? err.message : String(err)
417
- });
418
- searchRuntime.encryptedFields = null;
419
- }
420
- }
421
390
  if (searchFilters.length) {
422
391
  this.logSearchDebug("search:init", {
423
392
  entity,
@@ -800,79 +769,6 @@ class HybridQueryEngine {
800
769
  };
801
770
  const hasCustomFieldFilters = cfFilters.length > 0;
802
771
  const canOptimizeCount = !hasCustomFieldFilters && !hasNonBaseSearchSource;
803
- const isRowsetDependentFilter = (filter) => {
804
- const baseField = resolveBaseColumn(String(filter.field));
805
- if (!baseField) return true;
806
- if ((filter.op === "like" || filter.op === "ilike") && searchRuntime.enabled && typeof filter.value === "string" && hasNonBaseSearchSource) return true;
807
- return false;
808
- };
809
- const rowsetRegularFilters = regularBaseFilters.filter((filter) => isRowsetDependentFilter(filter));
810
- const outerRegularFilters = regularBaseFilters.filter((filter) => !isRowsetDependentFilter(filter));
811
- const orGroupsRowsetDependent = orGroupCfFilters.length > 0 || orGroupFilters.some((filter) => isRowsetDependentFilter(filter));
812
- const hasInnerTypedCfSource = preparedCfSources.some((source) => ((opts.customFieldSources ?? []).find((s) => s && (s.alias ?? void 0) === source.alias)?.join?.type ?? "left") === "inner");
813
- const needsIndexRowset = hasCustomFieldFilters || rowsetRegularFilters.length > 0 || orGroupsRowsetDependent || hasInnerTypedCfSource;
814
- const applyCountShape = async (q) => {
815
- let next = applyBaseScope(q);
816
- for (const filter of outerRegularFilters) {
817
- const baseField = resolveBaseColumn(String(filter.field));
818
- if (!baseField) continue;
819
- next = this.applyColumnFilter(next, qualify(baseField), filter, {
820
- ...searchRuntime,
821
- entity,
822
- field: String(filter.field),
823
- recordIdColumn: qualify("id")
824
- });
825
- }
826
- if (!orGroupsRowsetDependent) next = applyOrGroupedBaseFilters(next);
827
- if (needsIndexRowset) {
828
- let rowset = db.selectFrom(sql`(select 1)`.as("om_count_seed")).select(sql`1`.as("one"));
829
- rowset = applyEntityIndexesJoin(rowset);
830
- rowset = applyCustomFieldSourceJoins(rowset);
831
- rowset = applyCfFilters(rowset);
832
- for (const filter of rowsetRegularFilters) {
833
- const baseField = resolveBaseColumn(String(filter.field));
834
- if (!baseField) {
835
- rowset = this.applyIndexDocFilterFromAlias(
836
- rowset,
837
- "ei",
838
- entity,
839
- String(filter.field),
840
- filter.op,
841
- filter.value,
842
- qualify("id"),
843
- searchRuntime
844
- );
845
- continue;
846
- }
847
- rowset = this.applyColumnFilter(rowset, qualify(baseField), filter, {
848
- ...searchRuntime,
849
- entity,
850
- field: String(filter.field),
851
- recordIdColumn: qualify("id")
852
- });
853
- }
854
- if (orGroupsRowsetDependent) rowset = applyOrGroupedBaseFilters(rowset);
855
- const capturedRowset = rowset;
856
- next = next.where((eb) => eb.exists(capturedRowset));
857
- }
858
- next = await applyJoinFilters({
859
- db,
860
- baseTable,
861
- builder: next,
862
- joinMap,
863
- joinFilters,
864
- aliasTables,
865
- qualifyBase: (column) => qualify(column),
866
- applyAliasScope: async (target, alias) => applyAliasScopes(target, alias),
867
- applyFilterOp: (target, column, op, value) => applyJoinFilterOpFn(target, column, op, value),
868
- applyJoinFilterOp: async (target, filter, qualified, join) => {
869
- const applied = await applyJoinSearchFilterOp(target, filter, qualified, join);
870
- return { applied, builder: target };
871
- },
872
- columnExists: (tbl, column) => this.columnExists(tbl, column)
873
- });
874
- return next;
875
- };
876
772
  const selectFieldSet = new Set(opts.fields && opts.fields.length ? opts.fields.map(String) : Array.from(columns.keys()));
877
773
  if (requiresPlaintextSort) {
878
774
  for (const field of encryptedSortFields) selectFieldSet.add(field);
@@ -928,11 +824,30 @@ class HybridQueryEngine {
928
824
  const page = opts.page?.page ?? 1;
929
825
  const pageSize = opts.page?.pageSize ?? 20;
930
826
  const sqlDebugEnabled = this.isSqlDebugEnabled();
931
- const countCap = resolveListCountCap();
932
- const runBoundedCount = async (wasOptimizable) => {
933
- const countRoot = db.selectFrom(`${baseTable} as b`);
934
- const shape = await applyCountShape(countRoot);
935
- const countQuery = countCap !== null ? db.selectFrom(shape.select(sql`1`.as("one")).limit(countCap + 1).as("om_count_probe")).select(sql`count(*)`.as("count")) : shape.select(sql`count(*)`.as("count"));
827
+ let total;
828
+ if (canOptimizeCount) {
829
+ const optimizedRoot = db.selectFrom(`${baseTable} as b`);
830
+ let countCore = applyBaseScope(optimizedRoot);
831
+ countCore = applyRegularBaseFilters(countCore);
832
+ countCore = applyOrGroupedBaseFilters(countCore);
833
+ countCore = await applyJoinFilters({
834
+ db,
835
+ baseTable,
836
+ builder: countCore,
837
+ joinMap,
838
+ joinFilters,
839
+ aliasTables,
840
+ qualifyBase: (column) => qualify(column),
841
+ applyAliasScope: async (target, alias) => applyAliasScopes(target, alias),
842
+ applyFilterOp: (target, column, op, value) => applyJoinFilterOpFn(target, column, op, value),
843
+ applyJoinFilterOp: async (target, filter, qualified, join) => {
844
+ const applied = await applyJoinSearchFilterOp(target, filter, qualified, join);
845
+ return { applied, builder: target };
846
+ },
847
+ columnExists: (tbl, column) => this.columnExists(tbl, column)
848
+ });
849
+ const sub = countCore.select(sql.ref(qualify("id")).as("id")).groupBy(qualify("id")).as("sq");
850
+ const countQuery = db.selectFrom(sub).select(sql`count(*)`.as("count"));
936
851
  if (debugEnabled && sqlDebugEnabled) {
937
852
  const compiled = countQuery.compile();
938
853
  this.debug("query:sql:count", { entity, sql: compiled.sql, bindings: compiled.parameters });
@@ -941,18 +856,26 @@ class HybridQueryEngine {
941
856
  "query:sql:count",
942
857
  entity,
943
858
  () => countQuery.executeTakeFirst(),
944
- { optimized: wasOptimizable },
859
+ { optimized: true },
945
860
  profiler
946
861
  );
947
- const probed = this.parseCount(countRow);
948
- if (countCap !== null && probed > countCap) {
949
- return { total: countCap, warning: { entity, cap: countCap } };
862
+ total = this.parseCount(countRow);
863
+ } else {
864
+ const countRoot = db.selectFrom(`${baseTable} as b`);
865
+ const countBuilder = (await applyQueryShape(countRoot)).select(sql`count(distinct ${sql.ref(qualify("id"))})`.as("count"));
866
+ if (debugEnabled && sqlDebugEnabled) {
867
+ const compiled = countBuilder.compile();
868
+ this.debug("query:sql:count", { entity, sql: compiled.sql, bindings: compiled.parameters });
950
869
  }
951
- return { total: probed };
952
- };
953
- const counted = await runBoundedCount(canOptimizeCount);
954
- const total = counted.total;
955
- const listCountCapWarning = counted.warning;
870
+ const countRow = await this.captureSqlTiming(
871
+ "query:sql:count",
872
+ entity,
873
+ () => countBuilder.executeTakeFirst(),
874
+ { optimized: false },
875
+ profiler
876
+ );
877
+ total = this.parseCount(countRow);
878
+ }
956
879
  const dekKeyCache = /* @__PURE__ */ new Map();
957
880
  const decryptRow = async (item) => {
958
881
  let next = item;
@@ -999,25 +922,23 @@ class HybridQueryEngine {
999
922
  const sortFieldNames = Array.from(/* @__PURE__ */ new Set(["id", ...scopeFieldNames, ...resolvedSorts.map((s) => String(s.field))]));
1000
923
  phase1 = applySelection(phase1, sortFieldNames);
1001
924
  if (cap !== null) {
1002
- phase1 = phase1.limit(cap + 1).orderBy(qualify("id"), "asc");
925
+ phase1 = phase1.limit(cap).orderBy(qualify("id"), "asc");
1003
926
  }
1004
927
  if (debugEnabled && sqlDebugEnabled) {
1005
928
  const compiled = phase1.compile();
1006
929
  this.debug("query:sql:data:phase1", { entity, sql: compiled.sql, bindings: compiled.parameters });
1007
930
  }
1008
- const candidateRowsRaw = await this.captureSqlTiming(
931
+ const candidateRows = await this.captureSqlTiming(
1009
932
  "query:sql:data:phase1",
1010
933
  entity,
1011
934
  () => phase1.execute(),
1012
935
  { phase: 1 },
1013
936
  profiler
1014
937
  );
1015
- const sortTruncated = cap !== null && candidateRowsRaw.length > cap;
1016
- const candidateRows = sortTruncated && cap !== null ? candidateRowsRaw.slice(0, cap) : candidateRowsRaw;
1017
938
  const decryptedCandidates = await mapWithConcurrency(candidateRows, DECRYPT_CONCURRENCY, decryptRow);
1018
939
  const orderedCandidates = sortRowsInMemory(decryptedCandidates, resolvedSorts);
1019
940
  const pageIds = orderedCandidates.slice((page - 1) * pageSize, page * pageSize).map((row) => row.id);
1020
- if (sortTruncated && cap !== null) {
941
+ if (cap !== null && total > cap) {
1021
942
  encryptedSortRowCapWarning = {
1022
943
  entity,
1023
944
  sortFields: resolvedSorts.map((s) => String(s.field)),
@@ -1069,11 +990,10 @@ class HybridQueryEngine {
1069
990
  if (debugEnabled) this.debug("query:complete", { entity, total, items: items.length });
1070
991
  const typedItems = items;
1071
992
  let result = { items: typedItems, page, pageSize, total };
1072
- if (partialIndexWarning || encryptedSortRowCapWarning || listCountCapWarning) {
993
+ if (partialIndexWarning || encryptedSortRowCapWarning) {
1073
994
  const meta = {};
1074
995
  if (partialIndexWarning) meta.partialIndexWarning = partialIndexWarning;
1075
996
  if (encryptedSortRowCapWarning) meta.encryptedSortRowCapWarning = encryptedSortRowCapWarning;
1076
- if (listCountCapWarning) meta.listCountCapWarning = listCountCapWarning;
1077
997
  result.meta = meta;
1078
998
  }
1079
999
  result = await applyAfterExtensions(result);
@@ -1499,7 +1419,7 @@ class HybridQueryEngine {
1499
1419
  if (!baseField) {
1500
1420
  return this.buildIndexDocFilterExpression(eb, "ei", entity, fieldName, filter.op, filter.value, "b.id", searchRuntime);
1501
1421
  }
1502
- if ((filter.op === "like" || filter.op === "ilike") && searchRuntime?.enabled && typeof filter.value === "string" && (searchRuntime.encryptedFields == null || isEncryptedLikeField(searchRuntime.encryptedFields, fieldName))) {
1422
+ if ((filter.op === "like" || filter.op === "ilike") && searchRuntime?.enabled && typeof filter.value === "string") {
1503
1423
  const tokens = tokenizeText(String(filter.value), searchRuntime.config);
1504
1424
  if (tokens.hashes.length) {
1505
1425
  const sources = (searchRuntime.searchSources && searchRuntime.searchSources.length ? searchRuntime.searchSources : [{ entity: String(entity), recordIdColumn: "b.id" }]).filter((src) => src.recordIdColumn && src.entity);
@@ -1519,7 +1439,7 @@ class HybridQueryEngine {
1519
1439
  );
1520
1440
  }
1521
1441
  }
1522
- return searchRuntime?.encryptedFields != null && isEncryptedLikeField(searchRuntime.encryptedFields, fieldName) ? sql`false` : sql`true`;
1442
+ return sql`true`;
1523
1443
  }
1524
1444
  return this.buildColumnFilterExpression(eb, qualify(baseField), filter.op, filter.value);
1525
1445
  }
@@ -1695,26 +1615,16 @@ class HybridQueryEngine {
1695
1615
  };
1696
1616
  const page = opts.page?.page ?? 1;
1697
1617
  const pageSize = opts.page?.pageSize ?? 20;
1698
- const countCap = resolveListCountCap();
1699
1618
  const root = db.selectFrom(`custom_entities_storage as ${alias}`);
1700
- const countShape = applyScope(root);
1701
- const countQuery = countCap !== null ? db.selectFrom(countShape.select(sql`1`.as("one")).limit(countCap + 1).as("om_count_probe")).select(sql`count(*)`.as("count")) : countShape.select(sql`count(*)`.as("count"));
1619
+ const countQuery = applyScope(root).select(sql`count(distinct ${sql.ref(`${alias}.entity_id`)})`.as("count"));
1702
1620
  const countRow = await countQuery.executeTakeFirst();
1703
- const probed = this.parseCount(countRow);
1704
- let total = probed;
1705
- let listCountCapWarning;
1706
- if (countCap !== null && probed > countCap) {
1707
- total = countCap;
1708
- listCountCapWarning = { entity, cap: countCap };
1709
- }
1621
+ const total = this.parseCount(countRow);
1710
1622
  let dataQuery = applyScope(db.selectFrom(`custom_entities_storage as ${alias}`));
1711
1623
  dataQuery = applySelection(dataQuery);
1712
1624
  dataQuery = applySort(dataQuery);
1713
1625
  dataQuery = dataQuery.limit(pageSize).offset((page - 1) * pageSize);
1714
1626
  const items = await dataQuery.execute();
1715
- const result = { items, page, pageSize, total };
1716
- if (listCountCapWarning) result.meta = { listCountCapWarning };
1717
- return result;
1627
+ return { items, page, pageSize, total };
1718
1628
  }
1719
1629
  async tableExists(table) {
1720
1630
  const db = this.getDb();
@@ -2069,10 +1979,7 @@ class HybridQueryEngine {
2069
1979
  logger.debug("Search debug event", { event, payload });
2070
1980
  }
2071
1981
  applyColumnFilter(q, column, filter, search) {
2072
- if ((filter.op === "like" || filter.op === "ilike") && search?.enabled && typeof filter.value === "string" && // Plaintext base columns keep exact SQL ILIKE -- see SearchRuntime.encryptedFields.
2073
- // Membership runs across name-shape candidates: maps may declare `displayName` while the
2074
- // filter carries the column name `display_name`.
2075
- (search.encryptedFields == null || isEncryptedLikeField(search.encryptedFields, search.field))) {
1982
+ if ((filter.op === "like" || filter.op === "ilike") && search?.enabled && typeof filter.value === "string") {
2076
1983
  const tokens = tokenizeText(String(filter.value), search.config);
2077
1984
  const hashes = tokens.hashes;
2078
1985
  if (hashes.length) {
@@ -2102,18 +2009,12 @@ class HybridQueryEngine {
2102
2009
  });
2103
2010
  return q;
2104
2011
  }
2105
- if (search.encryptedFields != null && isEncryptedLikeField(search.encryptedFields, search.field)) {
2106
- return q.where(sql`false`);
2107
- }
2108
2012
  } else {
2109
2013
  this.logSearchDebug("search:skip-empty-hashes", {
2110
2014
  entity: search.entity,
2111
2015
  field: search.field,
2112
2016
  value: filter.value
2113
2017
  });
2114
- if (search.encryptedFields != null && isEncryptedLikeField(search.encryptedFields, search.field)) {
2115
- return q.where(sql`false`);
2116
- }
2117
2018
  }
2118
2019
  return q;
2119
2020
  }